@virtualdisplay.io/client 4.0.0-alpha.6 → 4.0.0-alpha.8

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.
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./chunk-350yNsax.cjs`);var t={NO_MAPPING:`NO_MAPPING`,ATTRIBUTE_NOT_FOUND:`ATTRIBUTE_NOT_FOUND`,VALUE_NOT_FOUND:`VALUE_NOT_FOUND`,PARENT_NOT_FOUND:`PARENT_NOT_FOUND`,INVALID_PARAMETER:`INVALID_PARAMETER`,SNAPSHOT_FAILED:`SNAPSHOT_FAILED`},n=class e extends Error{code;constructor(e,t){super(e),this.name=`VirtualdisplayError`,this.code=t}static noMapping(){return new e(`No attributes available. Waiting for server metadata.`,t.NO_MAPPING)}static attributeNotFound(n){return new e(`Attribute "${n}" not found in mapping`,t.ATTRIBUTE_NOT_FOUND)}static valueNotFound(n,r){return new e(`Value "${r}" not found for attribute "${n}"`,t.VALUE_NOT_FOUND)}static parentNotFound(n){return new e(`Parent element not found: ${n}`,t.PARENT_NOT_FOUND)}static invalidParameter(n){return new e(n,t.INVALID_PARAMETER)}static snapshotFailed(n,r){return new e(`Snapshot failed for "${n}": ${r}`,t.SNAPSHOT_FAILED)}},r=class{defaultServer=`https://server.virtualdisplay.io`;options;constructor(e){this.options=e}create(){let e=this.createContainer(),t=this.createIframe();return e.appendChild(t),this.attachToParent(e),{container:e,iframe:t}}createContainer(){let e=document.createElement(`div`);return e.className=`vd-container`,Object.assign(e.style,{position:`relative`,width:`100%`,height:`100%`,overflow:`hidden`}),e}createIframe(){let e=document.createElement(`iframe`);return e.src=this.buildUrl(),Object.assign(e.style,{width:`100%`,height:`100%`,border:`none`,display:`block`}),e.setAttribute(`allow`,`xr-spatial-tracking; fullscreen`),e}attachToParent(e){this.getParentElement().appendChild(e)}buildUrl(){let e=this.getServerUrl(),t=new URL(e);return t.searchParams.set(`license`,this.options.license),t.searchParams.set(`model`,this.options.model),this.options.language!==void 0&&t.searchParams.set(`language`,this.options.language),this.options.debug===!0&&t.searchParams.set(`debug`,`true`),t.toString()}getServerUrl(){return this.defaultServer}getParentElement(){if(typeof this.options.parent!=`string`)return this.options.parent;let e=document.querySelector(this.options.parent);if(e===null)throw n.parentNotFound(this.options.parent);return e}};function i(e){let t=new Date(e.timestamp).toLocaleTimeString(`en-GB`,{hour12:!1}),n=e.level.toUpperCase().padEnd(5),r=e.trace_id?.slice(0,8)??`--------`,i=e.msg,a=[`timestamp`,`level`,`msg`,`service`,`trace_id`,`span_id`],o=Object.entries(e).filter(([e])=>!a.includes(e)).map(([e,t])=>`${e}=${JSON.stringify(t)}`).join(` `);return`${t} ${n} [${r}] ${i}${o?` `+o:``}`}function a(e){return JSON.stringify(e)}function o(e,t){let n=t?i(e):a(e);e.level===`error`?console.error(n):e.level===`warn`?console.warn(n):console.log(n)}function s(){return new Date}function c(e){return e.toISOString()}var l=class e{constructor(e){this.config=e}log(e,t,n={}){let r=this.config.traceProvider?.()??{};o({timestamp:c(s()),level:e,msg:t,service:this.config.service,...r,...n},this.config.isDev)}debug(e,t){this.config.isDev&&this.log(`debug`,e,t)}info(e,t){this.log(`info`,e,t)}warn(e,t){this.log(`warn`,e,t)}error(e,t){this.log(`error`,e,t)}with(t){let n=new e(this.config);return n.log=((e,n,r={})=>{this.log(e,n,{...t,...r})}).bind(this),n}};function u(e,t){return new l({service:e,isDev:t?.isDev===void 0?typeof process<`u`?process.env.NODE_ENV!==`production`:!0:t.isDev,traceProvider:t?.traceProvider})}function d(e){if(e!==void 0)return typeof e==`object`&&e&&!Array.isArray(e)&&!(e instanceof Error)?e:e instanceof Error?{error:e.message}:{value:e}}function f(e){return{debug:(t,n)=>e.debug(t,d(n)),info:(t,n)=>e.info(t,d(n)),warn:(t,n)=>e.warn(t,d(n)),error:(t,n)=>e.error(t,d(n))}}var p=!1,m=f(u(`client`,{isDev:!1}));function h(){p=!0,m=f(u(`client`,{isDev:!0}))}function g(){return p}var _=class{ready=!1;onReady;constructor(e){this.onReady=e}handleMappingReceived(){this.ready||(this.ready=!0,m.info(`Mapping received from server, client is now ready`),this.onReady?.())}get isReady(){return this.ready}clear(){this.ready=!1}},v=class{isSelectedValue=!1;constructor(e,t){this.value=e,this.attribute=t}get isSelected(){return this.isSelectedValue}setSelected(e){this.isSelectedValue=e}},ee=class{name;defaultValue;values;onSelect;onChangeCallback;constructor(e){this.name=e.name,this.defaultValue=e.defaultValue,this.onSelect=e.onSelect,this.values=this.createValues(e.values)}select(e){if(!this.values.has(e))throw n.valueNotFound(this.name,e);this.onSelect(this.name,e)}getValues(){return Array.from(this.values.values())}getValue(e){return this.values.get(e)}onChange(e){this.onChangeCallback=e}handleResult(e){let t;for(let n of this.values.values()){let r=n.value===e;n.setSelected(r),r&&(t=n)}t!==void 0&&this.onChangeCallback!==void 0&&this.onChangeCallback(t)}createValues(e){let t=new Map;for(let n of e){let e=new v(n,this.name);n===this.defaultValue&&e.setSelected(!0),t.set(n,e)}return t}},te=class{attributes=new Map;constructor(e,t,n){for(let n of e){let e=this.buildOptions(n,t);this.attributes.set(n.name,new ee(e))}this.onMutationFailed=n}onMutationFailed;get(e){return this.attributes.get(e)}defaults(){let e=[];for(let t of this.attributes.values())t.defaultValue!==void 0&&e.push({name:t.name,value:t.defaultValue});return e}handleResults(e){for(let t of e){if(!t.success){this.onMutationFailed?.(t.name,t.value);continue}this.get(t.name)?.handleResult(t.value)}}buildOptions(e,t){let n={name:e.name,values:e.values,onSelect:(e,n)=>{t([{name:e,value:n}],!1)}};return e.defaultValue===void 0?n:{...n,defaultValue:e.defaultValue}}},y={HANDSHAKE:`handshake`,MUTATION:`mutation`,STATE:`state`,LOADING_INDICATOR:`loading_indicator`,CAMERA:`camera`,SNAPSHOT:`snapshot`,MAPPING:`mapping`,AR_ACTIVATE:`ar_activate`,CONFIG:`config`,INTERACTION:`interaction`},ne=new Set(Object.values(y));function re(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.target==`string`?!1:typeof t.type==`string`&&ne.has(t.type)}function ie(e){let t=b(e);return t!==null&&t.type===y.HANDSHAKE}function ae(e){let t=b(e);return t!==null&&t.type===y.MUTATION&&Array.isArray(t.results)}function oe(e){let t=b(e);return t!==null&&t.type===y.SNAPSHOT&&(`data`in t||`error`in t)}function se(e){let t=b(e);return t!==null&&t.type===y.CAMERA&&Array.isArray(t.transforms)}function ce(e){let t=b(e);return t!==null&&t.type===y.MAPPING&&Array.isArray(t.attributes)}function le(e){let t=b(e);return t!==null&&t.type===y.LOADING_INDICATOR&&typeof t.progress==`number`}function ue(e){let t=b(e);return t!==null&&t.type===y.CONFIG&&typeof t.viewerSettings==`object`}function b(e){return typeof e!=`object`||!e?null:e}var de=class{pending=[];isReady=!1;constructor(e){this.processor=e}enqueue(e){if(this.isReady){this.processor(e);return}this.pending.push(e)}markReady(){if(this.isReady||(this.isReady=!0,this.pending.length===0))return;let e=[...this.pending];this.pending.length=0;for(let t of e)this.processor(t)}get ready(){return this.isReady}get pendingCount(){return this.pending.length}hasPending(e){return this.pending.some(t=>t.type===e)}clear(){this.pending.length=0}},fe=class{handlers=new Map;publisher;consumer;shouldBuffer;listener=null;sourceId;constructor(e,t){this.getTarget=e,this.sourceId=`vd-${Math.random().toString(36).slice(2,8)}`,this.publisher=new de(e=>this.post(e)),this.consumer=new de(e=>this.routeToHandler(e)),this.shouldBuffer=t?.shouldBuffer??null,t?.bufferIncoming!==!0&&this.consumer.markReady()}on(e,t){this.handlers.set(e,t)}off(e){this.handlers.delete(e)}send(e){this.publisher.enqueue(e)}markReady(){this.publisher.markReady()}markConsumerReady(){this.consumer.markReady()}consumerHasPending(e){return this.consumer.hasPending(e)}start(){this.listener===null&&(this.listener=e=>{let{data:t}=e;if(!re(t)||t._source===this.sourceId)return;let n=t;if(this.shouldBuffer!==null&&!this.shouldBuffer(n)){this.routeToHandler(n);return}this.consumer.enqueue(n)},window.addEventListener(`message`,this.listener))}destroy(){this.listener!==null&&(window.removeEventListener(`message`,this.listener),this.listener=null),this.publisher.clear(),this.consumer.clear(),this.handlers.clear()}get ready(){return this.publisher.ready}get pendingCount(){return this.publisher.pendingCount}post(e){let t=this.getTarget();t!==null&&t.postMessage({...e,_source:this.sourceId},`*`)}routeToHandler(e){let t=this.handlers.get(e.type);if(t===void 0)return;let n=t(e);n instanceof Promise&&n.catch(t=>{let n=t instanceof Error?t.message:String(t);console.error(`Virtualdisplay: error handling ${e.type}: ${n}`)})}};new Set([y.CAMERA]);var pe=class{registry;pendingCallbacks=[];constructor(e,t){this.send=e,this.onMutationFailed=t}handleMappingReceived(e){m.debug(`Initializing from server mapping`,{attributeCount:e.attributes.length}),this.registry=new te(e.attributes,(e,t)=>this.sendMutation(e,t),this.onMutationFailed),this.replayPendingCallbacks()}handleMutationResult(e){this.registry?.handleResults(e.results)}select(e,t){this.sendMutation([{name:e,value:t}],!1)}getValues(e){return this.registry?.get(e)?.getValues()??[]}getValue(e,t){return this.registry?.get(e)?.getValue(t)}onChange(e,t){if(this.registry===void 0){this.pendingCallbacks.push({name:e,callback:t});return}let n=this.registry.get(e);if(n===void 0){m.warn(`onChange: attribute "${e}" not found — callback will not fire`);return}n.onChange(t)}getAttribute(e){return this.registry?.get(e)}get hasMapping(){return this.registry!==void 0}sendMutation(e,t){let n={type:y.MUTATION,mutations:e,isInitial:t};this.send(n)}replayPendingCallbacks(){for(let{name:e,callback:t}of this.pendingCallbacks){let n=this.registry?.get(e);n===void 0&&m.warn(`onChange: attribute "${e}" not found — buffered callback will not fire`),n?.onChange(t)}this.pendingCallbacks.length=0}},me=class{commands=[];constructor(e){this.send=e}rotate(e){return this.validateFiniteNumber(e,`rotate`),this.commands.push({action:`rotate`,value:e}),this}tilt(e){return this.validateFiniteNumber(e,`tilt`),this.commands.push({action:`tilt`,value:e}),this}zoom(e){return this.validateFiniteNumber(e,`zoom`),this.commands.push({action:`zoom`,value:e}),this}set(){if(this.commands.length===0)throw n.invalidParameter(`No camera commands to execute. Call rotate(), tilt(), or zoom() before set().`);let e={type:y.CAMERA,commands:this.commands};this.send(e),this.commands=[]}validateFiniteNumber(e,t){if(!Number.isFinite(e))throw n.invalidParameter(`${t}() requires a finite number, got ${String(e)}`)}reset(){let e={type:y.CAMERA,commands:[{action:`reset`}]};this.send(e)}},he=class{state;limitsState;changeCallbacks=[];constructor(){this.state={rotation:0,tilt:0,zoom:100}}get rotation(){return this.state.rotation}get tilt(){return this.state.tilt}get zoom(){return this.state.zoom}onChange(e){this.changeCallbacks.push(e)}get limits(){return this.limitsState}applyLimits(e){this.limitsState=e;let t={rotation:this.rotation,tilt:this.tilt,zoom:this.zoom};for(let e of this.changeCallbacks)e(t)}handlePositionUpdate(e){this.update(e.transforms)}update(e){let t=!1;for(let n of e)switch(n.type){case`rotation`:this.state.rotation=n.value,t=!0;break;case`tilt`:this.state.tilt=n.value,t=!0;break;case`zoom`:this.state.zoom=n.value,t=!0;break;default:break}if(t){let e={rotation:this.rotation,tilt:this.tilt,zoom:this.zoom};for(let t of this.changeCallbacks)t(e)}}},ge=class{developedCallbacks=new Set;errorCallbacks=new Set;developed=!1;failed=!1;photoData=null;constructor(e){this.filename=e}onDeveloped(e){return this.developed&&this.photoData!==null?(e(this.photoData),this):(this.developedCallbacks.add(e),this)}onError(e){return this.errorCallbacks.add(e),this}getFilename(){return this.filename}develop(e){this.developed||this.failed||(this.photoData=e,this.developed=!0,this.developedCallbacks.forEach(e=>{e(this.photoData)}),this.developedCallbacks.clear(),this.errorCallbacks.clear())}fail(e){this.developed||this.failed||(this.failed=!0,this.errorCallbacks.forEach(t=>{t(e)}),this.developedCallbacks.clear(),this.errorCallbacks.clear())}},_e=class{validExtensions=[`.png`];pendingPhotos=new Map;constructor(e){this.send=e}take(e){this.validateFilename(e),m.debug(`Taking snapshot`,{filename:e});let t=new ge(e);return this.pendingPhotos.set(t.getFilename(),t),this.send({type:y.SNAPSHOT,filename:e}),t}handleSnapshotResult(e){let r=this.pendingPhotos.get(e.filename);if(r===void 0){m.warn(`No pending photo found for filename`,{filename:e.filename,pendingFilenames:Array.from(this.pendingPhotos.keys())});return}if(this.pendingPhotos.delete(e.filename),e.error!==void 0){r.fail(new n(e.error,t.SNAPSHOT_FAILED));return}e.data!==void 0&&r.develop({filename:e.filename,data:e.data})}validateFilename(e){if(e===``||typeof e!=`string`)throw new n(`Filename must be a non-empty string`,t.INVALID_PARAMETER);if(!this.validExtensions.some(t=>e.toLowerCase().endsWith(t)))throw new n(`Invalid filename: "${e}". Filename must end with one of: ${this.validExtensions.join(`, `)}`,t.INVALID_PARAMETER);if(e.includes(`..`)||e.includes(`/`)||e.includes(`\\`))throw new n(`Filename cannot contain path separators or ".."`,t.INVALID_PARAMETER)}},ve=class{container=null;attach(e){this.container=e}dispatch(e,t,n=!1){let r=new CustomEvent(e,{detail:t,cancelable:n});return this.container?.dispatchEvent(r),r}on(e,t){let n=e=>{let n=e;t({...n.detail,preventDefault:()=>{n.preventDefault()}})};return this.container?.addEventListener(e,n),()=>{this.container?.removeEventListener(e,n)}}},ye={},be=[`en`,`nl`,`de`],x=[`baseLocale`],S=[],C,w;function xe(e){if(S.length===0)return;let t=typeof e==`string`?e:e.href;if(C===t)return w;let n=new URL(t,`http://dummy.com`),r;for(let e of S)if(new ye(e.match,n.href).exec(n.href)){r=e;break}return C=t,w=r,r}function T(e){let t=xe(e);return t&&t.exclude!==!0&&Array.isArray(t.strategy)?t.strategy:x}var E=void 0,D=typeof window>`u`;globalThis.__paraglide=globalThis.__paraglide??{},globalThis.__paraglide.ssr=globalThis.__paraglide.ssr??{};var O=!1,k=()=>{if(E){let e=E?.getStore()?.locale;if(e)return e}let e=x;!D&&typeof window<`u`&&window.location?.href&&(e=T(window.location.href));let t=Se(e,typeof window<`u`?window.location?.href:void 0);if(t)return O||(O=!0,A(t,{reload:!1})),t;throw Error(`No locale found. Read the docs https://inlang.com/m/gerre34r/library-inlang-paraglideJs/errors#no-locale-found`)};function Se(e,t){let n;for(let t of e){if(t===`baseLocale`)n=`en`;else if(N(t)&&M.has(t)){let e=M.get(t);if(e){let t=e.getLocale();if(t instanceof Promise)continue;if(t!==void 0)return we(t)}}let e=j(n);if(e)return e}}var Ce=e=>{e?window.location.href=e:window.location.reload()},A=(e,t)=>{let n={reload:!0,...t},r;try{r=k()}catch{}let i=[],a=x;!D&&typeof window<`u`&&window.location?.href&&(a=T(window.location.href));for(let t of a)if(t===`baseLocale`)continue;else if(N(t)&&M.has(t)){let n=M.get(t);if(n){let r=n.setLocale(e);r instanceof Promise&&(r=r.catch(e=>{throw Error(`Custom strategy "${t}" setLocale failed.`,{cause:e})}),i.push(r))}}let o=()=>{!D&&n.reload&&window.location&&e!==r&&Ce(void 0)};if(i.length)return Promise.all(i).then(()=>{o()});o()};function j(e){if(typeof e!=`string`)return;let t=e.toLowerCase();for(let e of be)if(e.toLowerCase()===t)return e}function we(e){let t=j(e);if(t)return t;throw Error(`Invalid locale: ${e}. Expected one of: ${be.join(`, `)}`)}var M=new Map;function N(e){return typeof e==`string`&&/^custom-[A-Za-z0-9_-]+$/.test(e)}var Te=()=>`Activate AR`,Ee=()=>`AR activeren`,De=()=>`AR aktivieren`,Oe=((e={},t={})=>{let n=t.locale??k();return n===`en`?Te(e):n===`nl`?Ee(e):De(e)}),ke=()=>`Scan to view in AR`,Ae=()=>`Scan om in AR te bekijken`,je=()=>`Scannen für AR-Ansicht`,Me=((e={},t={})=>{let n=t.locale??k();return n===`en`?ke(e):n===`nl`?Ae(e):je(e)}),Ne=()=>`Use your smartphone camera to scan this QR code`,Pe=()=>`Gebruik de camera van uw smartphone om deze QR-code te scannen`,Fe=()=>`Verwenden Sie die Kamera Ihres Smartphones, um diesen QR-Code zu scannen`,Ie=((e={},t={})=>{let n=t.locale??k();return n===`en`?Ne(e):n===`nl`?Pe(e):Fe(e)}),Le=()=>`The 3D model will open in your phone's AR mode`,Re=()=>`Het 3D-model wordt geopend in de AR-modus van uw telefoon`,ze=()=>`Das 3D-Modell wird im AR-Modus Ihres Telefons geöffnet`,Be=((e={},t={})=>{let n=t.locale??k();return n===`en`?Le(e):n===`nl`?Re(e):ze(e)}),Ve=()=>`Close`,He=()=>`Sluiten`,Ue=()=>`Schließen`,We=((e={},t={})=>{let n=t.locale??k();return n===`en`?Ve(e):n===`nl`?He(e):Ue(e)}),Ge=()=>`Toggle fullscreen`,Ke=()=>`Volledig scherm`,qe=()=>`Vollbild umschalten`,Je=((e={},t={})=>{let n=t.locale??k();return n===`en`?Ge(e):n===`nl`?Ke(e):qe(e)}),Ye=()=>`Downloading`,Xe=()=>`Downloaden`,Ze=()=>`Herunterladen`,P=((e={},t={})=>{let n=t.locale??k();return n===`en`?Ye(e):n===`nl`?Xe(e):Ze(e)}),Qe=()=>`Rendering`,$e=()=>`Renderen`,et=()=>`Rendern`,tt=((e={},t={})=>{let n=t.locale??k();return n===`en`?Qe(e):n===`nl`?$e(e):et(e)}),nt=()=>`Screenshot`,rt=()=>`Screenshot`,it=()=>`Screenshot`,at=((e={},t={})=>{let n=t.locale??k();return n===`en`?nt(e):n===`nl`?rt(e):it(e)}),ot=()=>`Reset camera`,st=()=>`Camera resetten`,ct=()=>`Kamera zurücksetzen`,lt=((e={},t={})=>{let n=t.locale??k();return n===`en`?ot(e):n===`nl`?st(e):ct(e)}),ut=()=>`Zoom in`,dt=()=>`Inzoomen`,ft=()=>`Hineinzoomen`,pt=((e={},t={})=>{let n=t.locale??k();return n===`en`?ut(e):n===`nl`?dt(e):ft(e)}),mt=()=>`Zoom out`,ht=()=>`Uitzoomen`,gt=()=>`Herauszoomen`,_t=((e={},t={})=>{let n=t.locale??k();return n===`en`?mt(e):n===`nl`?ht(e):gt(e)}),vt=()=>`Rotate left`,yt=()=>`Naar links draaien`,bt=()=>`Nach links drehen`,xt=((e={},t={})=>{let n=t.locale??k();return n===`en`?vt(e):n===`nl`?yt(e):bt(e)}),St=()=>`Rotate right`,Ct=()=>`Naar rechts draaien`,wt=()=>`Nach rechts drehen`,Tt=((e={},t={})=>{let n=t.locale??k();return n===`en`?St(e):n===`nl`?Ct(e):wt(e)}),Et=()=>`Tilt up`,Dt=()=>`Omhoog kantelen`,Ot=()=>`Nach oben kippen`,kt=((e={},t={})=>{let n=t.locale??k();return n===`en`?Et(e):n===`nl`?Dt(e):Ot(e)}),At=()=>`Tilt down`,jt=()=>`Omlaag kantelen`,Mt=()=>`Nach unten kippen`,Nt=((e={},t={})=>{let n=t.locale??k();return n===`en`?At(e):n===`nl`?jt(e):Mt(e)});function F(e){let t=Math.max(0,Math.min(1,e));return t*t*(3-2*t)}function Pt(e,t,n,r,i,a){let[o,s,c]=e,l=Math.cos(t),u=Math.sin(t),d=l*o+u*c,f=-u*o+l*c,p=Math.cos(n),m=Math.sin(n),h=p*s-m*f,g=m*s+p*f,_=.55;return[r+d*a*_,i-h*a*_,g]}function Ft(e,t,n){e.beginPath(),e.moveTo(t[0],t[1]),e.lineTo(n[0],n[1]),e.strokeStyle=`#000`,e.lineWidth=2,e.stroke()}function It(e,t,n,r,i){let a=t(n),o=t(r);Ft(e,a,[a[0]+(o[0]-a[0])*i,a[1]+(o[1]-a[1])*i,a[2]])}var I=[-1,-1,1],L=[1,-1,1],R=[1,-1,-1],z=[-1,-1,-1],B=[-1,1,1],V=[1,1,1],H=[1,1,-1],U=[-1,1,-1],Lt=[[I,L],[L,R],[R,z],[z,I],[I,B],[L,V],[R,H],[z,U],[B,V],[V,H],[H,U],[U,B]],Rt=400,zt=`-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif`;function Bt(){let e=document.createElement(`div`);Object.assign(e.style,{position:`absolute`,inset:`0`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,background:`#fff`,zIndex:`20`,opacity:`0`,transition:`opacity 0.3s ease-in-out`});let t=document.createElement(`canvas`);Object.assign(t.style,{width:`100%`,height:`100%`,position:`absolute`,inset:`0`});let n=document.createElement(`div`);Object.assign(n.style,{position:`absolute`,top:`56%`,left:`0`,right:`0`,textAlign:`center`,pointerEvents:`none`});let r=document.createElement(`span`);Object.assign(r.style,{fontSize:`13px`,fontWeight:`400`,color:`#000`,fontVariantNumeric:`tabular-nums`,fontFamily:zt});let i=document.createElement(`span`);return Object.assign(i.style,{fontSize:`13px`,color:`#000`,fontFamily:zt}),i.textContent=P(),n.appendChild(r),n.appendChild(i),e.appendChild(t),e.appendChild(n),{overlay:e,canvas:t,pctEl:r,phaseEl:i}}var Vt=class{overlay;canvas;ctx;pctEl;phaseEl;animationId=null;showTimerId=null;startTime;hidden=!1;visible=!1;constructor(e,t={}){this.startTime=performance.now();let n=Bt();this.overlay=n.overlay,this.canvas=n.canvas,this.pctEl=n.pctEl,this.phaseEl=n.phaseEl,e.appendChild(this.overlay),this.ctx=this.canvas.getContext(`2d`),this.ctx!==null&&(this.sizeCanvas(),this.tick());let r=t.showDelay??Rt;this.showTimerId=setTimeout(()=>{this.reveal()},r)}get loadingTexts(){return{downloading:P(),rendering:tt()}}updateProgress(e,t){this.hidden||(this.pctEl.textContent=`${Math.round(e)}%`,this.phaseEl.textContent=t===``?``:` \u00B7 ${t}`)}showError(e){if(this.hidden=!1,this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null),this.ctx!==null){let e=Math.min(devicePixelRatio,2),t=this.canvas.width/e,n=this.canvas.height/e;this.ctx.fillStyle=`#fff`,this.ctx.fillRect(0,0,t*e,n*e)}this.pctEl.textContent=``,this.phaseEl.textContent=e,this.phaseEl.style.color=`#b91c1c`,this.reveal()}hide(){if(!this.hidden){if(this.hidden=!0,this.cancelShowTimer(),!this.visible){this.destroy();return}this.overlay.style.opacity=`0`,this.overlay.addEventListener(`transitionend`,()=>{this.destroy()},{once:!0}),setTimeout(()=>{this.destroy()},500)}}destroy(){this.cancelShowTimer(),this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null),this.overlay.remove()}reveal(){this.hidden||this.visible||(this.visible=!0,this.overlay.style.opacity=`1`)}cancelShowTimer(){this.showTimerId!==null&&(clearTimeout(this.showTimerId),this.showTimerId=null)}sizeCanvas(){if(this.ctx===null)return;let e=Math.min(devicePixelRatio,2),t=this.overlay.clientWidth||440,n=this.overlay.clientHeight||360;this.canvas.width=t*e,this.canvas.height=n*e,this.ctx.scale(e,e),this.ctx.lineCap=`round`,this.ctx.lineJoin=`round`}tick=()=>{this.hidden||(this.drawFrame(),this.animationId=requestAnimationFrame(this.tick))};drawFrame(){if(this.ctx===null)return;let e=this.canvas.width/Math.min(devicePixelRatio,2),t=this.canvas.height/Math.min(devicePixelRatio,2),n=(performance.now()-this.startTime)/1e3;this.ctx.fillStyle=`#fff`,this.ctx.fillRect(0,0,e,t);let r=e/2,i=t*.44,a=Math.min(e,t)*.08,o=e=>Pt(e,.785,.615,r,i,a),s=n%6/6,c=Lt.length,l;l=s<.35?F(s/.35)*c:s<.55?c:s<.9?(1-F((s-.55)/.35))*c:0,this.ctx.shadowBlur=5,this.ctx.shadowColor=`rgba(30,30,30,0.08)`;for(let e=0;e<c&&!(e>=l);e++){let t=Lt[e];if(t===void 0)continue;let n=Math.min(1,l-e);It(this.ctx,o,t[0],t[1],n)}this.ctx.shadowBlur=0}},Ht={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`},Ut=([e,t,n])=>{let r=document.createElementNS(`http://www.w3.org/2000/svg`,e);return Object.keys(t).forEach(e=>{r.setAttribute(e,String(t[e]))}),n?.length&&n.forEach(e=>{let t=Ut(e);r.appendChild(t)}),r},Wt=(e,t={})=>Ut([`svg`,{...Ht,...t},e]),Gt=[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`}],[`path`,{d:`M12 22V12`}]],Kt=[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`}],[`circle`,{cx:`12`,cy:`13`,r:`3`}]],qt=[[`path`,{d:`m6 9 6 6 6-6`}]],Jt=[[`path`,{d:`m15 18-6-6 6-6`}]],Yt=[[`path`,{d:`m9 18 6-6-6-6`}]],Xt=[[`path`,{d:`m18 15-6-6-6 6`}]],Zt=[[`path`,{d:`M15 3h6v6`}],[`path`,{d:`m21 3-7 7`}],[`path`,{d:`m3 21 7-7`}],[`path`,{d:`M9 21H3v-6`}]],Qt=[[`path`,{d:`m14 10 7-7`}],[`path`,{d:`M20 10h-6V4`}],[`path`,{d:`m3 21 7-7`}],[`path`,{d:`M4 14h6v6`}]],$t=[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`}],[`path`,{d:`M3 3v5h5`}]],en=[[`circle`,{cx:`11`,cy:`11`,r:`8`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`}]],tn=[[`circle`,{cx:`11`,cy:`11`,r:`8`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`}]];function W(e,{size:t=20,strokeWidth:n=1.75}={}){return Wt(e,{width:t,height:t,"stroke-width":n})}var G={ar:e=>W(Gt,e),fullscreen:e=>W(Zt,e),exitFullscreen:e=>W(Qt,e),screenshot:e=>W(Kt,e),tiltUp:e=>W(Xt,e),tiltDown:e=>W(qt,e),rotateLeft:e=>W(Jt,e),rotateRight:e=>W(Yt,e),zoomIn:e=>W(en,e),zoomOut:e=>W(tn,e),reset:e=>W($t,e)},K=class{element;constructor({variant:e=`default`,size:t=`default`,label:n,icon:r,onClick:i,disabled:a=!1}={}){this.element=document.createElement(`button`),this.element.className=`ui-btn ui-btn--${e} ui-btn--size-${t}`,n!==void 0&&(this.element.setAttribute(`aria-label`,n),this.element.title=n),r===void 0?n!==void 0&&(this.element.textContent=n):this.element.appendChild(r),i&&this.element.addEventListener(`click`,i),this.element.disabled=a}setIcon(e){let t=this.element.querySelector(`svg`);t===null?this.element.appendChild(e):t.replaceWith(e)}},q={brand:{DEFAULT:`#171717`,primary:`#171717`,hover:`#262626`,light:`#f5f5f5`,50:`#fafafa`,100:`#f5f5f5`,200:`#e5e5e5`,300:`#d4d4d4`,400:`#a3a3a3`,500:`#737373`,600:`#525252`,700:`#404040`,800:`#262626`,900:`#171717`,950:`#0a0a0a`},semantic:{success:`#16a34a`,warning:`#ca8a04`,error:`#dc2626`,info:`#0891b2`},neutral:{50:`#fafafa`,100:`#f5f5f5`,200:`#e5e5e5`,300:`#d4d4d4`,400:`#a3a3a3`,500:`#737373`,600:`#525252`,700:`#404040`,800:`#262626`,900:`#171717`,950:`#0a0a0a`},white:`#ffffff`,black:`#000000`},J={px:`1px`,0:`0`,.5:`0.125rem`,1:`0.25rem`,1.5:`0.375rem`,2:`0.5rem`,2.5:`0.625rem`,3:`0.75rem`,3.5:`0.875rem`,4:`1rem`,5:`1.25rem`,6:`1.5rem`,7:`1.75rem`,8:`2rem`,9:`2.25rem`,10:`2.5rem`,12:`3rem`,14:`3.5rem`,16:`4rem`,20:`5rem`,24:`6rem`};J[1],J[2],J[4],J[6],J[8],J[12];var nn=class{element;constructor(){this.element=document.createElement(`div`),Object.assign(this.element.style,{background:q.white,borderRadius:J[3],padding:J[6],boxShadow:`0 ${J[2]} ${J[8]} oklch(0% 0 0 / 20%)`,maxWidth:`20rem`,width:`100%`})}},rn=class{card;backdrop;keyHandler=null;constructor(e={}){this.options=e,this.card=new nn,this.backdrop=this.createBackdrop(),this.backdrop.appendChild(this.card.element)}open(){document.body.appendChild(this.backdrop),this.keyHandler=e=>{e.key===`Escape`&&this.close()},document.addEventListener(`keydown`,this.keyHandler)}close(){this.backdrop.remove(),this.keyHandler!==null&&(document.removeEventListener(`keydown`,this.keyHandler),this.keyHandler=null),this.options.onClose?.()}createBackdrop(){let e=document.createElement(`div`);return Object.assign(e.style,{position:`fixed`,inset:J[0],background:`oklch(0% 0 0 / 50%)`,zIndex:`9999`,display:`flex`,alignItems:`center`,justifyContent:`center`}),e.addEventListener(`click`,t=>{t.target===e&&this.close()}),e}},an=class{element;selectCallback=null;constructor(e,t,n){this.element=document.createElement(`div`),this.element.className=`ui-toggle-group`;for(let r=0;r<e.length;r++){let i=e[r],a=document.createElement(`button`);a.className=`ui-toggle-group-item`,a.dataset.value=i,a.textContent=n?.[r]??i,a.dataset.state=i===t?`on`:`off`,a.addEventListener(`click`,()=>{this.selectCallback?.(i)}),this.element.appendChild(a)}}setSelected(e){for(let t of this.element.querySelectorAll(`.ui-toggle-group-item`))t.dataset.state=t.dataset.value===e?`on`:`off`}onSelect(e){this.selectCallback=e}},on=class{element;select;constructor(e,t,n,r,i){this.select=document.createElement(`select`),this.select.className=`ui-native-select`,this.select.dataset.name=e;let a=document.createElement(`option`);a.value=``,a.disabled=!0,a.textContent=n,this.select.appendChild(a);let o=!1;for(let e=0;e<t.length;e++){let n=t[e],a=document.createElement(`option`);a.value=n,a.textContent=i?.[e]??n,n===r&&(a.selected=!0,o=!0),this.select.appendChild(a)}o||(a.selected=!0);let s=Wt(qt,{width:16,height:16,"stroke-width":2});s.classList.add(`ui-native-select-icon`),this.element=document.createElement(`div`),this.element.className=`ui-native-select-wrap`,this.element.appendChild(this.select),this.element.appendChild(s)}setSelected(e){this.select.value=e}onSelect(e){this.select.addEventListener(`change`,()=>{e(this.select.value)})}},Y={fontFamily:{sans:[`Mona Sans`,`ui-sans-serif`,`system-ui`,`sans-serif`,`Apple Color Emoji`,`Segoe UI Emoji`,`Segoe UI Symbol`,`Noto Color Emoji`],mono:[`JetBrains Mono`,`ui-monospace`,`monospace`]},fontSize:{xs:`0.75rem`,sm:`0.875rem`,base:`1rem`,lg:`1.125rem`,xl:`1.25rem`,"2xl":`1.5rem`,"3xl":`1.875rem`,"4xl":`2.25rem`},fontWeight:{normal:`400`,medium:`500`,semibold:`600`,bold:`700`},lineHeight:{tight:`1.25`,normal:`1.5`,relaxed:`1.75`}},sn=Y.fontFamily.sans.join(`, `),cn=class{qrLib=null;dialog=null;async show(t){this.hide(),this.qrLib??=await Promise.resolve().then(()=>e.n(require(`./browser-DiwLZG-y.cjs`).default,1));let n=await this.qrLib.toDataURL(t,{width:256,margin:4,errorCorrectionLevel:`M`,color:{dark:q.black,light:q.white}});this.dialog=new rn({onClose:()=>{this.dialog=null}}),Object.assign(this.dialog.card.element.style,{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:J[3],fontFamily:sn}),this.dialog.card.element.appendChild(this.createText(Me(),{fontSize:Y.fontSize.base,fontWeight:Y.fontWeight.semibold,color:q.neutral[900]})),this.dialog.card.element.appendChild(this.createText(Ie(),{fontSize:Y.fontSize.sm,color:q.neutral[600]})),this.dialog.card.element.appendChild(this.createQrImage(n)),this.dialog.card.element.appendChild(this.createText(Be(),{fontSize:Y.fontSize.xs,color:q.neutral[500]}));let r=new K({variant:`outline`,label:We(),onClick:()=>{this.hide()}});this.dialog.card.element.appendChild(r.element),this.dialog.open()}hide(){this.dialog?.close(),this.dialog=null}createText(e,t){let n=document.createElement(`p`);return n.textContent=e,Object.assign(n.style,{margin:`0`,textAlign:`center`,...t}),n}createQrImage(e){let t=document.createElement(`img`);return t.src=e,t.alt=`QR code`,Object.assign(t.style,{width:J[24],height:J[24],borderRadius:J[1]}),t}},X=Y.fontFamily.sans.join(`, `),ln=`
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./chunk-BcutgqC9.cjs`);var t={NO_MAPPING:`NO_MAPPING`,ATTRIBUTE_NOT_FOUND:`ATTRIBUTE_NOT_FOUND`,VALUE_NOT_FOUND:`VALUE_NOT_FOUND`,PARENT_NOT_FOUND:`PARENT_NOT_FOUND`,INVALID_PARAMETER:`INVALID_PARAMETER`,SNAPSHOT_FAILED:`SNAPSHOT_FAILED`},n=class e extends Error{code;constructor(e,t){super(e),this.name=`VirtualdisplayError`,this.code=t}static noMapping(){return new e(`No attributes available. Waiting for server metadata.`,t.NO_MAPPING)}static attributeNotFound(n){return new e(`Attribute "${n}" not found in mapping`,t.ATTRIBUTE_NOT_FOUND)}static valueNotFound(n,r){return new e(`Value "${r}" not found for attribute "${n}"`,t.VALUE_NOT_FOUND)}static parentNotFound(n){return new e(`Parent element not found: ${n}`,t.PARENT_NOT_FOUND)}static invalidParameter(n){return new e(n,t.INVALID_PARAMETER)}static snapshotFailed(n,r){return new e(`Snapshot failed for "${n}": ${r}`,t.SNAPSHOT_FAILED)}},r=class{defaultServer=`https://server.virtualdisplay.io`;options;constructor(e){this.options=e}create(){let e=this.createContainer(),t=this.createIframe();return e.appendChild(t),this.attachToParent(e),{container:e,iframe:t}}createContainer(){let e=document.createElement(`div`);return e.className=`vd-container`,Object.assign(e.style,{position:`relative`,width:`100%`,height:`100%`,overflow:`hidden`}),e}createIframe(){let e=document.createElement(`iframe`);return e.src=this.buildUrl(),Object.assign(e.style,{width:`100%`,height:`100%`,border:`none`,display:`block`}),e.setAttribute(`allow`,`xr-spatial-tracking; fullscreen`),e}attachToParent(e){this.getParentElement().appendChild(e)}buildUrl(){let e=this.getServerUrl(),t=new URL(e);return t.searchParams.set(`license`,this.options.license),t.searchParams.set(`model`,this.options.model),this.options.language!==void 0&&t.searchParams.set(`language`,this.options.language),this.options.debug===!0&&t.searchParams.set(`debug`,`true`),this.options.traceparent!==void 0&&t.searchParams.set(`traceparent`,this.options.traceparent),t.toString()}getServerUrl(){return this.defaultServer}getParentElement(){if(typeof this.options.parent!=`string`)return this.options.parent;let e=document.querySelector(this.options.parent);if(e===null)throw n.parentNotFound(this.options.parent);return e}};function i(e){let t=new Date(e.timestamp).toLocaleTimeString(`en-GB`,{hour12:!1}),n=e.level.toUpperCase().padEnd(5),r=e.trace_id?.slice(0,8)??`--------`,i=e.msg,a=[`timestamp`,`level`,`msg`,`service`,`trace_id`,`span_id`],o=Object.entries(e).filter(([e])=>!a.includes(e)).map(([e,t])=>`${e}=${JSON.stringify(t)}`).join(` `);return`${t} ${n} [${r}] ${i}${o?` `+o:``}`}function a(e){return JSON.stringify(e)}function o(e,t){let n=t?i(e):a(e);e.level===`error`?console.error(n):e.level===`warn`?console.warn(n):console.log(n)}function s(e,t=0){let n={name:e.name,message:e.message};e.stack!==void 0&&(n.stack=e.stack);for(let t of Object.getOwnPropertyNames(e)){if(t===`name`||t===`message`||t===`stack`||t===`cause`)continue;let r=e[t];r!==void 0&&(n[t]=r)}return e.cause!==void 0&&e.cause!==null&&(n.cause=e.cause instanceof Error&&t<5?s(e.cause,t+1):String(e.cause)),n}function c(e){let t={};for(let[n,r]of Object.entries(e))t[n]=r instanceof Error?s(r):r;return t}function l(){return new Date}function u(e){return e.toISOString()}var d=class e{constructor(e){this.config=e}log(e,t,n={}){let r=this.config.traceProvider?.()??{};o({timestamp:u(l()),level:e,msg:t,service:this.config.service,...r,...c(n)},this.config.isDev)}debug(e,t){this.config.isDev&&this.log(`debug`,e,t)}info(e,t){this.log(`info`,e,t)}warn(e,t){this.log(`warn`,e,t)}error(e,t){this.log(`error`,e,t)}with(t){let n=new e(this.config);return n.log=((e,n,r={})=>{this.log(e,n,{...t,...r})}).bind(this),n}};function f(e,t){return new d({service:e,isDev:t?.isDev===void 0?typeof process<`u`?process.env.NODE_ENV!==`production`:!0:t.isDev,traceProvider:t?.traceProvider})}function p(e){if(e!==void 0)return typeof e==`object`&&e&&!Array.isArray(e)&&!(e instanceof Error)?e:e instanceof Error?{error:e.message}:{value:e}}function m(e){return{debug:(t,n)=>e.debug(t,p(n)),info:(t,n)=>e.info(t,p(n)),warn:(t,n)=>e.warn(t,p(n)),error:(t,n)=>e.error(t,p(n))}}var h=!1,g=m(f(`client`,{isDev:!1}));function _(){h=!0,g=m(f(`client`,{isDev:!0}))}function ee(){return h}var te=class{ready=!1;onReady;constructor(e){this.onReady=e}handleMappingReceived(){this.ready||(this.ready=!0,g.info(`Mapping received from server, client is now ready`),this.onReady?.())}get isReady(){return this.ready}clear(){this.ready=!1}},v={HANDSHAKE:`handshake`,MUTATION:`mutation`,STATE:`state`,LOADING_INDICATOR:`loading_indicator`,CAMERA:`camera`,SNAPSHOT:`snapshot`,MAPPING:`mapping`,AR_ACTIVATE:`ar_activate`,CONFIG:`config`,INTERACTION:`interaction`,ANNOTATION_PLACE_MODE:`annotation_place_mode`,ANNOTATION_PLACED:`annotation_placed`,ANNOTATION_TOGGLE:`annotation_toggle`},ne=new Set(Object.values(v));function re(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.target==`string`?!1:typeof t.type==`string`&&ne.has(t.type)}function ie(e){let t=y(e);return t!==null&&t.type===v.HANDSHAKE}function ae(e){let t=y(e);return t!==null&&t.type===v.MUTATION&&Array.isArray(t.results)}function oe(e){let t=y(e);return t!==null&&t.type===v.SNAPSHOT&&(`data`in t||`error`in t)}function se(e){let t=y(e);return t!==null&&t.type===v.CAMERA&&Array.isArray(t.transforms)}function ce(e){let t=y(e);return t!==null&&t.type===v.MAPPING&&Array.isArray(t.attributes)}function le(e){let t=y(e);return t!==null&&t.type===v.LOADING_INDICATOR&&typeof t.progress==`number`}function ue(e){let t=y(e);return t!==null&&t.type===v.CONFIG&&typeof t.viewerSettings==`object`}function de(e){let t=y(e);return t!==null&&t.type===v.ANNOTATION_PLACED&&typeof t.position==`object`&&t.position!==null}function y(e){return typeof e!=`object`||!e?null:e}var b=class{pending=[];isReady=!1;constructor(e){this.processor=e}enqueue(e){if(this.isReady){this.processor(e);return}this.pending.push(e)}markReady(){if(this.isReady||(this.isReady=!0,this.pending.length===0))return;let e=[...this.pending];this.pending.length=0;for(let t of e)this.processor(t)}get ready(){return this.isReady}get pendingCount(){return this.pending.length}hasPending(e){return this.pending.some(t=>t.type===e)}clear(){this.pending.length=0}},fe=class{handlers=new Map;publisher;consumer;shouldBuffer;listener=null;sourceId;targetOrigin;constructor(e,t){this.getTarget=e,this.sourceId=`vd-${Math.random().toString(36).slice(2,8)}`,this.targetOrigin=t?.targetOrigin??`*`,this.publisher=new b(e=>this.post(e)),this.consumer=new b(e=>this.routeToHandler(e)),this.shouldBuffer=t?.shouldBuffer??null,t?.bufferIncoming!==!0&&this.consumer.markReady()}on(e,t){this.handlers.set(e,t)}off(e){this.handlers.delete(e)}setTargetOrigin(e){this.targetOrigin=e}send(e){this.publisher.enqueue(e)}markReady(){this.publisher.markReady()}markConsumerReady(){this.consumer.markReady()}consumerHasPending(e){return this.consumer.hasPending(e)}start(){this.listener===null&&(this.listener=e=>{let{data:t}=e;if(!re(t)||t._source===this.sourceId)return;let n=t;if(this.shouldBuffer!==null&&!this.shouldBuffer(n)){this.routeToHandler(n);return}this.consumer.enqueue(n)},window.addEventListener(`message`,this.listener))}destroy(){this.listener!==null&&(window.removeEventListener(`message`,this.listener),this.listener=null),this.publisher.clear(),this.consumer.clear(),this.handlers.clear()}get ready(){return this.publisher.ready}get pendingCount(){return this.publisher.pendingCount}post(e){let t=this.getTarget();t!==null&&t.postMessage({...e,_source:this.sourceId},this.targetOrigin)}routeToHandler(e){let t=this.handlers.get(e.type);if(t===void 0)return;let n=t(e);n instanceof Promise&&n.catch(t=>{let n=t instanceof Error?t.message:String(t);console.error(`Virtualdisplay: error handling ${e.type}: ${n}`)})}};new Set([v.CAMERA]);var pe=class{placedCallbacks=[];constructor(e){this.send=e}setEnabled(e){this.send({type:v.ANNOTATION_TOGGLE,enabled:e})}startPlacing(){this.send({type:v.ANNOTATION_PLACE_MODE,enabled:!0})}stopPlacing(){this.send({type:v.ANNOTATION_PLACE_MODE,enabled:!1})}onPlaced(e){this.placedCallbacks.push(e)}handlePlaced(e){for(let t of this.placedCallbacks)t(e)}},me=class{isSelectedValue=!1;constructor(e,t){this.value=e,this.attribute=t}get isSelected(){return this.isSelectedValue}setSelected(e){this.isSelectedValue=e}},x=class{name;defaultValue;values;onSelect;onChangeCallback;constructor(e){this.name=e.name,this.defaultValue=e.defaultValue,this.onSelect=e.onSelect,this.values=this.createValues(e.values)}select(e){if(!this.values.has(e))throw n.valueNotFound(this.name,e);this.onSelect(this.name,e)}getValues(){return Array.from(this.values.values())}getValue(e){return this.values.get(e)}onChange(e){this.onChangeCallback=e}handleResult(e){let t;for(let n of this.values.values()){let r=n.value===e;n.setSelected(r),r&&(t=n)}t!==void 0&&this.onChangeCallback!==void 0&&this.onChangeCallback(t)}createValues(e){let t=new Map;for(let n of e){let e=new me(n,this.name);n===this.defaultValue&&e.setSelected(!0),t.set(n,e)}return t}},he=class{attributes=new Map;constructor(e,t,n){for(let n of e){let e=this.buildOptions(n,t);this.attributes.set(n.name,new x(e))}this.onMutationFailed=n}onMutationFailed;get(e){return this.attributes.get(e)}defaults(){let e=[];for(let t of this.attributes.values())t.defaultValue!==void 0&&e.push({name:t.name,value:t.defaultValue});return e}handleResults(e){for(let t of e){if(!t.success){this.onMutationFailed?.(t.name,t.value);continue}this.get(t.name)?.handleResult(t.value)}}buildOptions(e,t){let n={name:e.name,values:e.values,onSelect:(e,n)=>{t([{name:e,value:n}],!1)}};return e.defaultValue===void 0?n:{...n,defaultValue:e.defaultValue}}},ge=class{registry;pendingCallbacks=[];constructor(e,t){this.send=e,this.onMutationFailed=t}handleMappingReceived(e){g.debug(`Initializing from server mapping`,{attributeCount:e.attributes.length}),this.registry=new he(e.attributes,(e,t)=>this.sendMutation(e,t),this.onMutationFailed),this.replayPendingCallbacks()}handleMutationResult(e){this.registry?.handleResults(e.results)}select(e,t){this.sendMutation([{name:e,value:t}],!1)}getValues(e){return this.registry?.get(e)?.getValues()??[]}getValue(e,t){return this.registry?.get(e)?.getValue(t)}onChange(e,t){if(this.registry===void 0){this.pendingCallbacks.push({name:e,callback:t});return}let n=this.registry.get(e);if(n===void 0){g.warn(`onChange: attribute "${e}" not found — callback will not fire`);return}n.onChange(t)}getAttribute(e){return this.registry?.get(e)}get hasMapping(){return this.registry!==void 0}sendMutation(e,t){let n={type:v.MUTATION,mutations:e,isInitial:t};this.send(n)}replayPendingCallbacks(){for(let{name:e,callback:t}of this.pendingCallbacks){let n=this.registry?.get(e);n===void 0&&g.warn(`onChange: attribute "${e}" not found — buffered callback will not fire`),n?.onChange(t)}this.pendingCallbacks.length=0}},_e=class{commands=[];constructor(e){this.send=e}rotate(e){return this.validateFiniteNumber(e,`rotate`),this.commands.push({action:`rotate`,value:e}),this}tilt(e){return this.validateFiniteNumber(e,`tilt`),this.commands.push({action:`tilt`,value:e}),this}zoom(e){return this.validateFiniteNumber(e,`zoom`),this.commands.push({action:`zoom`,value:e}),this}set(){if(this.commands.length===0)throw n.invalidParameter(`No camera commands to execute. Call rotate(), tilt(), or zoom() before set().`);let e={type:v.CAMERA,commands:this.commands};this.send(e),this.commands=[]}validateFiniteNumber(e,t){if(!Number.isFinite(e))throw n.invalidParameter(`${t}() requires a finite number, got ${String(e)}`)}reset(){let e={type:v.CAMERA,commands:[{action:`reset`}]};this.send(e)}},ve=class{state;limitsState;changeCallbacks=[];constructor(){this.state={rotation:0,tilt:0,zoom:100}}get rotation(){return this.state.rotation}get tilt(){return this.state.tilt}get zoom(){return this.state.zoom}onChange(e){this.changeCallbacks.push(e)}get limits(){return this.limitsState}applyLimits(e){this.limitsState=e;let t={rotation:this.rotation,tilt:this.tilt,zoom:this.zoom};for(let e of this.changeCallbacks)e(t)}handlePositionUpdate(e){this.update(e.transforms)}update(e){let t=!1;for(let n of e)switch(n.type){case`rotation`:this.state.rotation=n.value,t=!0;break;case`tilt`:this.state.tilt=n.value,t=!0;break;case`zoom`:this.state.zoom=n.value,t=!0;break;default:break}if(t){let e={rotation:this.rotation,tilt:this.tilt,zoom:this.zoom};for(let t of this.changeCallbacks)t(e)}}},ye=class{developedCallbacks=new Set;errorCallbacks=new Set;developed=!1;failed=!1;photoData=null;constructor(e){this.filename=e}onDeveloped(e){return this.developed&&this.photoData!==null?(e(this.photoData),this):(this.developedCallbacks.add(e),this)}onError(e){return this.errorCallbacks.add(e),this}getFilename(){return this.filename}develop(e){this.developed||this.failed||(this.photoData=e,this.developed=!0,this.developedCallbacks.forEach(e=>{e(this.photoData)}),this.developedCallbacks.clear(),this.errorCallbacks.clear())}fail(e){this.developed||this.failed||(this.failed=!0,this.errorCallbacks.forEach(t=>{t(e)}),this.developedCallbacks.clear(),this.errorCallbacks.clear())}},S=class{validExtensions=[`.png`];pendingPhotos=new Map;constructor(e){this.send=e}take(e){this.validateFilename(e),g.debug(`Taking snapshot`,{filename:e});let t=new ye(e);return this.pendingPhotos.set(t.getFilename(),t),this.send({type:v.SNAPSHOT,filename:e}),t}handleSnapshotResult(e){let r=this.pendingPhotos.get(e.filename);if(r===void 0){g.warn(`No pending photo found for filename`,{filename:e.filename,pendingFilenames:Array.from(this.pendingPhotos.keys())});return}if(this.pendingPhotos.delete(e.filename),e.error!==void 0){r.fail(new n(e.error,t.SNAPSHOT_FAILED));return}e.data!==void 0&&r.develop({filename:e.filename,data:e.data})}validateFilename(e){if(e===``||typeof e!=`string`)throw new n(`Filename must be a non-empty string`,t.INVALID_PARAMETER);if(!this.validExtensions.some(t=>e.toLowerCase().endsWith(t)))throw new n(`Invalid filename: "${e}". Filename must end with one of: ${this.validExtensions.join(`, `)}`,t.INVALID_PARAMETER);if(e.includes(`..`)||e.includes(`/`)||e.includes(`\\`))throw new n(`Filename cannot contain path separators or ".."`,t.INVALID_PARAMETER)}},be=class{container=null;attach(e){this.container=e}dispatch(e,t,n=!1){let r=new CustomEvent(e,{detail:t,cancelable:n});return this.container?.dispatchEvent(r),r}on(e,t){let n=e=>{let n=e;t({...n.detail,preventDefault:()=>{n.preventDefault()}})};return this.container?.addEventListener(e,n),()=>{this.container?.removeEventListener(e,n)}}},xe={},C=[`en`,`nl`,`de`],w=[`baseLocale`],T=[],E,D;function Se(e){if(T.length===0)return;let t=typeof e==`string`?e:e.href;if(E===t)return D;let n=new URL(t,`http://dummy.com`),r;for(let e of T)if(new xe(e.match,n.href).exec(n.href)){r=e;break}return E=t,D=r,r}function O(e){let t=Se(e);return t&&t.exclude!==!0&&Array.isArray(t.strategy)?t.strategy:w}var k=void 0,A=typeof window>`u`;globalThis.__paraglide=globalThis.__paraglide??{},globalThis.__paraglide.ssr=globalThis.__paraglide.ssr??{};var j=!1,M=()=>{if(k){let e=k?.getStore()?.locale;if(e)return e}let e=w;!A&&typeof window<`u`&&window.location?.href&&(e=O(window.location.href));let t=Ce(e,typeof window<`u`?window.location?.href:void 0);if(t)return j||(j=!0,N(t,{reload:!1})),t;throw Error(`No locale found. Read the docs https://inlang.com/m/gerre34r/library-inlang-paraglideJs/errors#no-locale-found`)};function Ce(e,t){let n;for(let t of e){if(t===`baseLocale`)n=`en`;else if(Ee(t)&&F.has(t)){let e=F.get(t);if(e){let t=e.getLocale();if(t instanceof Promise)continue;if(t!==void 0)return Te(t)}}let e=P(n);if(e)return e}}var we=e=>{e?window.location.href=e:window.location.reload()},N=(e,t)=>{let n={reload:!0,...t},r;try{r=M()}catch{}let i=[],a=w;!A&&typeof window<`u`&&window.location?.href&&(a=O(window.location.href));for(let t of a)if(t===`baseLocale`)continue;else if(Ee(t)&&F.has(t)){let n=F.get(t);if(n){let r=n.setLocale(e);r instanceof Promise&&(r=r.catch(e=>{throw Error(`Custom strategy "${t}" setLocale failed.`,{cause:e})}),i.push(r))}}let o=()=>{!A&&n.reload&&window.location&&e!==r&&we(void 0)};if(i.length)return Promise.all(i).then(()=>{o()});o()};function P(e){if(typeof e!=`string`)return;let t=e.toLowerCase();for(let e of C)if(e.toLowerCase()===t)return e}function Te(e){let t=P(e);if(t)return t;throw Error(`Invalid locale: ${e}. Expected one of: ${C.join(`, `)}`)}var F=new Map;function Ee(e){return typeof e==`string`&&/^custom-[A-Za-z0-9_-]+$/.test(e)}var De=()=>`Activate AR`,Oe=()=>`AR activeren`,ke=()=>`AR aktivieren`,Ae=((e={},t={})=>{let n=t.locale??M();return n===`en`?De(e):n===`nl`?Oe(e):ke(e)}),je=()=>`Scan to view in AR`,Me=()=>`Scan om in AR te bekijken`,Ne=()=>`Scannen für AR-Ansicht`,Pe=((e={},t={})=>{let n=t.locale??M();return n===`en`?je(e):n===`nl`?Me(e):Ne(e)}),Fe=()=>`Use your smartphone camera to scan this QR code`,Ie=()=>`Gebruik de camera van je smartphone om deze QR-code te scannen`,Le=()=>`Verwenden Sie die Kamera Ihres Smartphones, um diesen QR-Code zu scannen`,Re=((e={},t={})=>{let n=t.locale??M();return n===`en`?Fe(e):n===`nl`?Ie(e):Le(e)}),ze=()=>`The 3D model will open in your phone's AR mode`,Be=()=>`Het 3D-model wordt geopend in de AR-modus van je telefoon`,Ve=()=>`Das 3D-Modell wird im AR-Modus Ihres Telefons geöffnet`,He=((e={},t={})=>{let n=t.locale??M();return n===`en`?ze(e):n===`nl`?Be(e):Ve(e)}),Ue=()=>`Close`,We=()=>`Sluiten`,Ge=()=>`Schließen`,Ke=((e={},t={})=>{let n=t.locale??M();return n===`en`?Ue(e):n===`nl`?We(e):Ge(e)}),qe=()=>`Toggle fullscreen`,Je=()=>`Volledig scherm`,Ye=()=>`Vollbild umschalten`,Xe=((e={},t={})=>{let n=t.locale??M();return n===`en`?qe(e):n===`nl`?Je(e):Ye(e)}),Ze=()=>`Downloading`,Qe=()=>`Downloaden`,$e=()=>`Herunterladen`,et=((e={},t={})=>{let n=t.locale??M();return n===`en`?Ze(e):n===`nl`?Qe(e):$e(e)}),tt=()=>`Rendering`,nt=()=>`Renderen`,rt=()=>`Rendern`,it=((e={},t={})=>{let n=t.locale??M();return n===`en`?tt(e):n===`nl`?nt(e):rt(e)}),at=()=>`Screenshot`,ot=()=>`Screenshot`,st=()=>`Screenshot`,ct=((e={},t={})=>{let n=t.locale??M();return n===`en`?at(e):n===`nl`?ot(e):st(e)}),lt=()=>`Reset camera`,ut=()=>`Camera resetten`,dt=()=>`Kamera zurücksetzen`,ft=((e={},t={})=>{let n=t.locale??M();return n===`en`?lt(e):n===`nl`?ut(e):dt(e)}),pt=()=>`Zoom in`,mt=()=>`Inzoomen`,ht=()=>`Hineinzoomen`,gt=((e={},t={})=>{let n=t.locale??M();return n===`en`?pt(e):n===`nl`?mt(e):ht(e)}),_t=()=>`Zoom out`,vt=()=>`Uitzoomen`,yt=()=>`Herauszoomen`,bt=((e={},t={})=>{let n=t.locale??M();return n===`en`?_t(e):n===`nl`?vt(e):yt(e)}),xt=()=>`Rotate left`,St=()=>`Naar links draaien`,Ct=()=>`Nach links drehen`,wt=((e={},t={})=>{let n=t.locale??M();return n===`en`?xt(e):n===`nl`?St(e):Ct(e)}),Tt=()=>`Rotate right`,Et=()=>`Naar rechts draaien`,Dt=()=>`Nach rechts drehen`,Ot=((e={},t={})=>{let n=t.locale??M();return n===`en`?Tt(e):n===`nl`?Et(e):Dt(e)}),kt=()=>`Tilt up`,At=()=>`Omhoog kantelen`,jt=()=>`Nach oben kippen`,Mt=((e={},t={})=>{let n=t.locale??M();return n===`en`?kt(e):n===`nl`?At(e):jt(e)}),Nt=()=>`Tilt down`,Pt=()=>`Omlaag kantelen`,Ft=()=>`Nach unten kippen`,It=((e={},t={})=>{let n=t.locale??M();return n===`en`?Nt(e):n===`nl`?Pt(e):Ft(e)}),Lt={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`},Rt=([e,t,n])=>{let r=document.createElementNS(`http://www.w3.org/2000/svg`,e);return Object.keys(t).forEach(e=>{r.setAttribute(e,String(t[e]))}),n?.length&&n.forEach(e=>{let t=Rt(e);r.appendChild(t)}),r},zt=(e,t={})=>Rt([`svg`,{...Lt,...t},e]),Bt=[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`}],[`path`,{d:`M12 22V12`}]],Vt=[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`}],[`circle`,{cx:`12`,cy:`13`,r:`3`}]],Ht=[[`path`,{d:`m6 9 6 6 6-6`}]],Ut=[[`path`,{d:`m15 18-6-6 6-6`}]],Wt=[[`path`,{d:`m9 18 6-6-6-6`}]],Gt=[[`path`,{d:`m18 15-6-6-6 6`}]],Kt=[[`path`,{d:`M15 3h6v6`}],[`path`,{d:`m21 3-7 7`}],[`path`,{d:`m3 21 7-7`}],[`path`,{d:`M9 21H3v-6`}]],qt=[[`path`,{d:`m14 10 7-7`}],[`path`,{d:`M20 10h-6V4`}],[`path`,{d:`m3 21 7-7`}],[`path`,{d:`M4 14h6v6`}]],Jt=[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`}],[`path`,{d:`M3 3v5h5`}]],Yt=[[`circle`,{cx:`11`,cy:`11`,r:`8`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`}]],Xt=[[`circle`,{cx:`11`,cy:`11`,r:`8`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`}]];function I(e,{size:t=20,strokeWidth:n=1.75}={}){return zt(e,{width:t,height:t,"stroke-width":n})}var L={ar:e=>I(Bt,e),fullscreen:e=>I(Kt,e),exitFullscreen:e=>I(qt,e),screenshot:e=>I(Vt,e),tiltUp:e=>I(Gt,e),tiltDown:e=>I(Ht,e),rotateLeft:e=>I(Ut,e),rotateRight:e=>I(Wt,e),zoomIn:e=>I(Yt,e),zoomOut:e=>I(Xt,e),reset:e=>I(Jt,e)},R=class{element;constructor({variant:e=`default`,size:t=`default`,label:n,icon:r,onClick:i,disabled:a=!1}={}){this.element=document.createElement(`button`),this.element.className=`ui-btn ui-btn--${e} ui-btn--size-${t}`,n!==void 0&&(this.element.setAttribute(`aria-label`,n),this.element.title=n),r===void 0?n!==void 0&&(this.element.textContent=n):this.element.appendChild(r),i&&this.element.addEventListener(`click`,i),this.element.disabled=a}setIcon(e){let t=this.element.querySelector(`svg`);t===null?this.element.appendChild(e):t.replaceWith(e)}},z={brand:{DEFAULT:`#171717`,primary:`#171717`,hover:`#262626`,light:`#f5f5f5`,50:`#fafafa`,100:`#f5f5f5`,200:`#e5e5e5`,300:`#d4d4d4`,400:`#a3a3a3`,500:`#737373`,600:`#525252`,700:`#404040`,800:`#262626`,900:`#171717`,950:`#0a0a0a`},semantic:{success:`#16a34a`,warning:`#ca8a04`,error:`#dc2626`,info:`#0891b2`},neutral:{50:`#fafafa`,100:`#f5f5f5`,200:`#e5e5e5`,300:`#d4d4d4`,400:`#a3a3a3`,500:`#737373`,600:`#525252`,700:`#404040`,800:`#262626`,900:`#171717`,950:`#0a0a0a`},white:`#ffffff`,black:`#000000`},B={px:`1px`,0:`0`,.5:`0.125rem`,1:`0.25rem`,1.5:`0.375rem`,2:`0.5rem`,2.5:`0.625rem`,3:`0.75rem`,3.5:`0.875rem`,4:`1rem`,5:`1.25rem`,6:`1.5rem`,7:`1.75rem`,8:`2rem`,9:`2.25rem`,10:`2.5rem`,12:`3rem`,14:`3.5rem`,16:`4rem`,20:`5rem`,24:`6rem`};B[1],B[2],B[4],B[6],B[8],B[12];var Zt=class{element;constructor(){this.element=document.createElement(`div`),Object.assign(this.element.style,{background:z.white,borderRadius:B[3],padding:B[6],boxShadow:`0 ${B[2]} ${B[8]} oklch(0% 0 0 / 20%)`,maxWidth:`20rem`,width:`100%`})}},Qt=class{card;backdrop;keyHandler=null;constructor(e={}){this.options=e,this.card=new Zt,this.backdrop=this.createBackdrop(),this.backdrop.appendChild(this.card.element)}open(){document.body.appendChild(this.backdrop),this.keyHandler=e=>{e.key===`Escape`&&this.close()},document.addEventListener(`keydown`,this.keyHandler)}close(){this.backdrop.remove(),this.keyHandler!==null&&(document.removeEventListener(`keydown`,this.keyHandler),this.keyHandler=null),this.options.onClose?.()}createBackdrop(){let e=document.createElement(`div`);return Object.assign(e.style,{position:`fixed`,inset:B[0],background:`oklch(0% 0 0 / 50%)`,zIndex:`9999`,display:`flex`,alignItems:`center`,justifyContent:`center`}),e.addEventListener(`click`,t=>{t.target===e&&this.close()}),e}},$t=class{element;selectCallback=null;constructor(e,t,n){this.element=document.createElement(`div`),this.element.className=`ui-toggle-group`;for(let r=0;r<e.length;r++){let i=e[r],a=document.createElement(`button`);a.className=`ui-toggle-group-item`,a.dataset.value=i,a.textContent=n?.[r]??i,a.dataset.state=i===t?`on`:`off`,a.addEventListener(`click`,()=>{this.selectCallback?.(i)}),this.element.appendChild(a)}}setSelected(e){for(let t of this.element.querySelectorAll(`.ui-toggle-group-item`))t.dataset.state=t.dataset.value===e?`on`:`off`}onSelect(e){this.selectCallback=e}},en=class{element;select;constructor(e,t,n,r,i){this.select=document.createElement(`select`),this.select.className=`ui-native-select`,this.select.dataset.name=e;let a=document.createElement(`option`);a.value=``,a.disabled=!0,a.textContent=n,this.select.appendChild(a);let o=!1;for(let e=0;e<t.length;e++){let n=t[e],a=document.createElement(`option`);a.value=n,a.textContent=i?.[e]??n,n===r&&(a.selected=!0,o=!0),this.select.appendChild(a)}o||(a.selected=!0);let s=zt(Ht,{width:16,height:16,"stroke-width":2});s.classList.add(`ui-native-select-icon`),this.element=document.createElement(`div`),this.element.className=`ui-native-select-wrap`,this.element.appendChild(this.select),this.element.appendChild(s)}setSelected(e){this.select.value=e}onSelect(e){this.select.addEventListener(`change`,()=>{e(this.select.value)})}},V={fontFamily:{sans:[`Mona Sans`,`ui-sans-serif`,`system-ui`,`sans-serif`,`Apple Color Emoji`,`Segoe UI Emoji`,`Segoe UI Symbol`,`Noto Color Emoji`],mono:[`JetBrains Mono`,`ui-monospace`,`monospace`]},fontSize:{xs:`0.75rem`,sm:`0.875rem`,base:`1rem`,lg:`1.125rem`,xl:`1.25rem`,"2xl":`1.5rem`,"3xl":`1.875rem`,"4xl":`2.25rem`},fontWeight:{normal:`400`,medium:`500`,semibold:`600`,bold:`700`},lineHeight:{tight:`1.25`,normal:`1.5`,relaxed:`1.75`}},tn=V.fontFamily.sans.join(`, `),nn=class{qrLib=null;dialog=null;async show(t){this.hide(),this.qrLib??=await Promise.resolve().then(()=>e.n(require(`./browser-CDLfpTNV.cjs`).default,1));let n=await this.qrLib.toDataURL(t,{width:256,margin:4,errorCorrectionLevel:`M`,color:{dark:z.black,light:z.white}});this.dialog=new Qt({onClose:()=>{this.dialog=null}}),Object.assign(this.dialog.card.element.style,{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:B[3],fontFamily:tn}),this.dialog.card.element.appendChild(this.createText(Pe(),{fontSize:V.fontSize.base,fontWeight:V.fontWeight.semibold,color:z.neutral[900]})),this.dialog.card.element.appendChild(this.createText(Re(),{fontSize:V.fontSize.sm,color:z.neutral[600]})),this.dialog.card.element.appendChild(this.createQrImage(n)),this.dialog.card.element.appendChild(this.createText(He(),{fontSize:V.fontSize.xs,color:z.neutral[500]}));let r=new R({variant:`outline`,label:Ke(),onClick:()=>{this.hide()}});this.dialog.card.element.appendChild(r.element),this.dialog.open()}hide(){this.dialog?.close(),this.dialog=null}createText(e,t){let n=document.createElement(`p`);return n.textContent=e,Object.assign(n.style,{margin:`0`,textAlign:`center`,...t}),n}createQrImage(e){let t=document.createElement(`img`);return t.src=e,t.alt=`QR code`,Object.assign(t.style,{width:B[24],height:B[24],borderRadius:B[1]}),t}},H=V.fontFamily.sans.join(`, `),rn=`
2
2
  :root {
3
3
  --primary: oklch(5% 0 0);
4
4
  --primary-foreground: oklch(100% 0 0);
@@ -22,7 +22,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
22
22
  gap: 0.5rem;
23
23
  border: 1px solid transparent;
24
24
  border-radius: var(--radius);
25
- font-family: ${X};
25
+ font-family: ${H};
26
26
  font-size: 0.875rem;
27
27
  font-weight: 600;
28
28
  white-space: nowrap;
@@ -79,7 +79,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
79
79
  border-radius: var(--radius);
80
80
  background: var(--background);
81
81
  color: var(--foreground);
82
- font-family: ${X};
82
+ font-family: ${H};
83
83
  font-size: 0.875rem;
84
84
  font-weight: 600;
85
85
  cursor: pointer;
@@ -113,7 +113,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
113
113
  background: var(--background);
114
114
  appearance: none;
115
115
  color: var(--foreground);
116
- font-family: ${X};
116
+ font-family: ${H};
117
117
  font-size: 0.875rem;
118
118
  font-weight: 400;
119
119
  cursor: pointer;
@@ -135,56 +135,139 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
135
135
  color: var(--muted-foreground);
136
136
  pointer-events: none;
137
137
  }
138
- `,Z=!1;function un(){if(Z||typeof document>`u`)return;Z=!0;let e=document.createElement(`style`);e.id=`vd-ui-vanilla`,e.textContent=ln,document.head.appendChild(e)}function dn(e,t){let n=document.createElement(`a`);n.href=`data:image/png;base64,${e}`,n.download=t,n.click()}var fn=class{element;screenshotBtn=null;constructor(e){this.options=e,this.element=document.createElement(`div`),this.element.className=`vd-toolbar`}syncButton(e,t,n){if(t&&e===null){let e=n();return this.element.appendChild(e.element),e}return!t&&e!==null?(e.element.remove(),null):e}applySettings(e){this.screenshotBtn=this.syncButton(this.screenshotBtn,e.screenshot===!0,()=>new K({variant:`outline`,size:`icon`,label:at(),icon:G.screenshot(),onClick:()=>{this.options.snapshotApi.take(`snapshot.png`).onDeveloped(({data:e,filename:t})=>{dn(e,t)})}}))}},pn=class{element;arBtn=null;fullscreenBtn=null;onFullscreenChange;constructor(e){this.options=e,this.element=document.createElement(`div`),this.element.className=`vd-action-bar`,this.onFullscreenChange=()=>{if(this.fullscreenBtn===null)return;let e=document.fullscreenElement!==null;this.fullscreenBtn.setIcon(e?G.exitFullscreen():G.fullscreen())},document.addEventListener(`fullscreenchange`,this.onFullscreenChange)}syncButton(e,t,n){if(t&&e===null){let e=n();return this.element.appendChild(e.element),e}return!t&&e!==null?(e.element.remove(),null):e}applySettings(e){this.arBtn=this.syncButton(this.arBtn,e.ar!==!1&&this.options.onAr!==void 0,()=>new K({variant:`outline`,size:`icon`,label:Oe(),icon:G.ar(),onClick:()=>{this.options.onAr?.()}})),this.fullscreenBtn=this.syncButton(this.fullscreenBtn,e.fullscreen!==!1&&this.options.onFullscreen!==void 0,()=>new K({variant:`outline`,size:`icon`,label:Je(),icon:G.fullscreen(),onClick:()=>{this.options.onFullscreen?.()}}))}destroy(){document.removeEventListener(`fullscreenchange`,this.onFullscreenChange)}},Q=.5,mn=class e{element;constructor(t,n){this.element=Object.assign(document.createElement(`div`),{className:`vd-camera-controls`});let r=n.rotation,i=n.tilt,a=n.zoom,o=0,s=e=>Math.max(n.limits?.minZoom??1,Math.min(n.limits?.maxZoom??1/0,e)),c=e=>{let t=n.limits?.minRotate,r=n.limits?.maxRotate;return t!==void 0||r!==void 0?Math.max(t??-1/0,Math.min(r??1/0,e)):e},l=e=>{let a=n.limits?.minTilt,s=n.limits?.maxTilt;if(a!==void 0||s!==void 0){i=Math.max(a??0,Math.min(s??180,i+e)),t.tilt(i).set();return}let c=i+e;c>180||c<0?(i=c>180?360-c:-c,o=(o+180)%360,t.tilt(i).rotate(r+o).set()):(i=c,t.tilt(i).set())},u=new K({variant:`outline`,size:`icon`,label:_t(),icon:G.zoomOut(),onClick:()=>{a=s(a-10),t.zoom(a).set()}}),d=new K({variant:`outline`,size:`icon`,label:pt(),icon:G.zoomIn(),onClick:()=>{a=s(a+10),t.zoom(a).set()}}),f=new K({variant:`outline`,size:`icon`,label:kt(),icon:G.tiltUp(),onClick:()=>{l(-15)}}),p=new K({variant:`outline`,size:`icon`,label:xt(),icon:G.rotateLeft(),onClick:()=>{r=c(r-15),t.rotate(r+o).set()}}),m=new K({variant:`outline`,size:`icon`,label:lt(),icon:G.reset(),onClick:()=>{o=0,t.reset()}}),h=new K({variant:`outline`,size:`icon`,label:Tt(),icon:G.rotateRight(),onClick:()=>{r=c(r+15),t.rotate(r+o).set()}}),g=new K({variant:`outline`,size:`icon`,label:Nt(),icon:G.tiltDown(),onClick:()=>{l(15)}}),_=e=>{let t=n.limits;t!==void 0&&(u.element.disabled=t.minZoom!==void 0&&e.zoom<=t.minZoom+Q,d.element.disabled=t.maxZoom!==void 0&&e.zoom>=t.maxZoom-Q,f.element.disabled=t.minTilt!==void 0&&e.tilt<=t.minTilt+Q,g.element.disabled=t.maxTilt!==void 0&&e.tilt>=t.maxTilt-Q,p.element.disabled=t.minRotate!==void 0&&e.rotation<=t.minRotate+Q,h.element.disabled=t.maxRotate!==void 0&&e.rotation>=t.maxRotate-Q)};n.onChange(e=>{r=e.rotation-o,i=e.tilt,a=e.zoom,_(e)}),this.element.appendChild(e.buildZoom(u,d)),this.element.appendChild(e.buildDpad(f,p,m,h,g))}static buildZoom(e,t){let n=document.createElement(`div`);return n.className=`vd-zoom`,n.appendChild(e.element),n.appendChild(t.element),n}static buildDpad(e,t,n,r,i){let a=document.createElement(`div`);a.className=`vd-dpad`;for(let[o,s]of[[e,`up`],[t,`left`],[n,`center`],[r,`right`],[i,`down`]])o.element.classList.add(`vd-dpad-${s}`),a.appendChild(o.element);return a}},hn=5;function $(e){let t=e.replace(/([A-Z])/g,` $1`).trim();return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function gn(e,t,n,r,i){let a=document.createElement(`div`);a.className=`vd-attribute`,a.dataset.name=e.name;let o=document.createElement(`span`);o.className=`vd-attribute-label`,o.textContent=$(e.name),a.appendChild(o);let s=e.values.find(n=>t.getValue(e.name,n)?.isSelected===!0),c=e.values.map($),l=e.values.length<=hn?new an(e.values,s,c):new on(e.name,e.values,$(e.name),s,c);return l.onSelect(t=>{n.dispatch(`ui:select`,{attribute:e.name,value:t},!0).defaultPrevented||r(e.name,t)}),i(e.name,t=>{l.setSelected(t.value),n.dispatch(`ui:selected`,{attribute:e.name,value:t.value})}),a.appendChild(l.element),a}var _n=Y.fontFamily.sans.join(`, `),vn=`
138
+
139
+ /* ── Annotation layer ───────────────────────────────────── */
140
+ .vd-annotations-layer {
141
+ position: absolute;
142
+ inset-block-start: 0;
143
+ inset-inline-start: 0;
144
+ inline-size: 100%;
145
+ block-size: 100%;
146
+ pointer-events: none;
147
+ overflow: visible !important; /* override CSS2DRenderer inline style */
148
+ }
149
+
150
+ .vd-annotation-marker {
151
+ display: flex;
152
+ align-items: center;
153
+ justify-content: center;
154
+ inline-size: 1.75rem;
155
+ block-size: 1.75rem;
156
+ border-radius: 50%;
157
+ border: 2px solid oklch(100% 0 0);
158
+ background: var(--primary);
159
+ color: var(--primary-foreground);
160
+ font-family: ${H};
161
+ font-size: 0.8125rem;
162
+ font-weight: 600;
163
+ cursor: pointer;
164
+ pointer-events: auto;
165
+ box-shadow: 0 2px 8px oklch(5% 0 0 / 20%);
166
+ transition: transform 100ms ease;
167
+ position: relative;
168
+ }
169
+ .vd-annotation-marker:hover { transform: scale(1.1); }
170
+
171
+ .vd-annotation-popup {
172
+ position: absolute;
173
+ inset-block-end: calc(100% + 0.5rem);
174
+ inset-inline-start: 50%;
175
+ transform: translateX(-50%);
176
+ background: var(--background);
177
+ color: var(--foreground);
178
+ border: 1px solid var(--border);
179
+ border-radius: var(--radius);
180
+ padding: 0.75rem 1rem;
181
+ max-inline-size: 15rem;
182
+ box-shadow: 0 4px 6px oklch(5% 0 0 / 8%), 0 2px 4px oklch(5% 0 0 / 6%);
183
+ pointer-events: auto;
184
+ white-space: normal;
185
+ }
186
+
187
+ @media (prefers-reduced-motion: no-preference) {
188
+ .vd-annotation-popup {
189
+ animation: vd-popup-in 150ms ease;
190
+ }
191
+ }
192
+
193
+ @keyframes vd-popup-in {
194
+ from { opacity: 0; transform: translateX(-50%) translateY(4px); }
195
+ to { opacity: 1; transform: translateX(-50%) translateY(0); }
196
+ }
197
+
198
+ .vd-annotation-popup-title {
199
+ font-family: ${H};
200
+ font-size: 0.875rem;
201
+ font-weight: 600;
202
+ line-height: 1.25rem;
203
+ }
204
+
205
+ .vd-annotation-popup-description {
206
+ font-family: ${H};
207
+ font-size: 0.8125rem;
208
+ font-weight: 400;
209
+ line-height: 1.125rem;
210
+ color: var(--muted-foreground);
211
+ margin-block-start: 0.25rem;
212
+ }
213
+ `,an=!1;function on(){if(an||typeof document>`u`)return;an=!0;let e=document.createElement(`style`);e.id=`vd-ui-vanilla`,e.textContent=rn,document.head.appendChild(e)}function sn(e){let t=Math.max(0,Math.min(1,e));return t*t*(3-2*t)}function cn(e,t,n,r,i,a){let[o,s,c]=e,l=Math.cos(t),u=Math.sin(t),d=l*o+u*c,f=-u*o+l*c,p=Math.cos(n),m=Math.sin(n),h=p*s-m*f,g=m*s+p*f,_=.55;return[r+d*a*_,i-h*a*_,g]}function ln(e,t,n){e.beginPath(),e.moveTo(t[0],t[1]),e.lineTo(n[0],n[1]),e.strokeStyle=`#000`,e.lineWidth=2,e.stroke()}function un(e,t,n,r,i){let a=t(n),o=t(r);ln(e,a,[a[0]+(o[0]-a[0])*i,a[1]+(o[1]-a[1])*i,a[2]])}var U=[-1,-1,1],W=[1,-1,1],G=[1,-1,-1],K=[-1,-1,-1],q=[-1,1,1],J=[1,1,1],Y=[1,1,-1],X=[-1,1,-1],dn=[[U,W],[W,G],[G,K],[K,U],[U,q],[W,J],[G,Y],[K,X],[q,J],[J,Y],[Y,X],[X,q]],fn=400,pn=`-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif`;function mn(){let e=document.createElement(`div`);Object.assign(e.style,{position:`absolute`,inset:`0`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,background:`#fff`,zIndex:`20`,opacity:`0`,transition:`opacity 0.3s ease-in-out`});let t=document.createElement(`canvas`);Object.assign(t.style,{width:`100%`,height:`100%`,position:`absolute`,inset:`0`});let n=document.createElement(`div`);Object.assign(n.style,{position:`absolute`,top:`56%`,left:`0`,right:`0`,textAlign:`center`,pointerEvents:`none`});let r=document.createElement(`span`);Object.assign(r.style,{fontSize:`13px`,fontWeight:`400`,color:`#000`,fontVariantNumeric:`tabular-nums`,fontFamily:pn});let i=document.createElement(`span`);return Object.assign(i.style,{fontSize:`13px`,color:`#000`,fontFamily:pn}),i.textContent=et(),n.appendChild(r),n.appendChild(i),e.appendChild(t),e.appendChild(n),{overlay:e,canvas:t,pctEl:r,phaseEl:i}}var hn=class{overlay;canvas;ctx;pctEl;phaseEl;animationId=null;showTimerId=null;startTime;hidden=!1;visible=!1;constructor(e,t={}){this.startTime=performance.now();let n=mn();this.overlay=n.overlay,this.canvas=n.canvas,this.pctEl=n.pctEl,this.phaseEl=n.phaseEl,e.appendChild(this.overlay),this.ctx=this.canvas.getContext(`2d`),this.ctx!==null&&(this.sizeCanvas(),this.tick());let r=t.showDelay??fn;this.showTimerId=setTimeout(()=>{this.reveal()},r)}get loadingTexts(){return{downloading:et(),rendering:it()}}updateProgress(e,t){this.hidden||(this.pctEl.textContent=`${Math.round(e)}%`,this.phaseEl.textContent=t===``?``:` \u00B7 ${t}`)}showError(e){if(this.hidden=!1,this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null),this.ctx!==null){let e=Math.min(devicePixelRatio,2),t=this.canvas.width/e,n=this.canvas.height/e;this.ctx.fillStyle=`#fff`,this.ctx.fillRect(0,0,t*e,n*e)}this.pctEl.textContent=``,this.phaseEl.textContent=e,this.phaseEl.style.color=`#b91c1c`,this.reveal()}hide(){if(!this.hidden){if(this.hidden=!0,this.cancelShowTimer(),!this.visible){this.destroy();return}this.overlay.style.opacity=`0`,this.overlay.addEventListener(`transitionend`,()=>{this.destroy()},{once:!0}),setTimeout(()=>{this.destroy()},500)}}destroy(){this.cancelShowTimer(),this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null),this.overlay.remove()}reveal(){this.hidden||this.visible||(this.visible=!0,this.overlay.style.opacity=`1`)}cancelShowTimer(){this.showTimerId!==null&&(clearTimeout(this.showTimerId),this.showTimerId=null)}sizeCanvas(){if(this.ctx===null)return;let e=Math.min(devicePixelRatio,2),t=this.overlay.clientWidth||440,n=this.overlay.clientHeight||360;this.canvas.width=t*e,this.canvas.height=n*e,this.ctx.scale(e,e),this.ctx.lineCap=`round`,this.ctx.lineJoin=`round`}tick=()=>{this.hidden||(this.drawFrame(),this.animationId=requestAnimationFrame(this.tick))};drawFrame(){if(this.ctx===null)return;let e=this.canvas.width/Math.min(devicePixelRatio,2),t=this.canvas.height/Math.min(devicePixelRatio,2),n=(performance.now()-this.startTime)/1e3;this.ctx.fillStyle=`#fff`,this.ctx.fillRect(0,0,e,t);let r=e/2,i=t*.44,a=Math.min(e,t)*.08,o=e=>cn(e,.785,.615,r,i,a),s=n%6/6,c=dn.length,l;l=s<.35?sn(s/.35)*c:s<.55?c:s<.9?(1-sn((s-.55)/.35))*c:0,this.ctx.shadowBlur=5,this.ctx.shadowColor=`rgba(30,30,30,0.08)`;for(let e=0;e<c&&!(e>=l);e++){let t=dn[e];if(t===void 0)continue;let n=Math.min(1,l-e);un(this.ctx,o,t[0],t[1],n)}this.ctx.shadowBlur=0}},gn=class{element;arBtn=null;fullscreenBtn=null;onFullscreenChange;constructor(e){this.options=e,this.element=document.createElement(`div`),Object.assign(this.element.style,{display:`flex`,gap:`0.375rem`}),this.onFullscreenChange=()=>{if(this.fullscreenBtn===null)return;let e=document.fullscreenElement!==null;this.fullscreenBtn.setIcon(e?L.exitFullscreen():L.fullscreen())},document.addEventListener(`fullscreenchange`,this.onFullscreenChange)}syncButton(e,t,n){if(t&&e===null){let e=n();return this.element.appendChild(e.element),e}return!t&&e!==null?(e.element.remove(),null):e}applySettings(e){this.arBtn=this.syncButton(this.arBtn,e.ar!==!1&&this.options.onAr!==void 0,()=>new R({variant:`outline`,size:`icon`,label:Ae(),icon:L.ar(),onClick:()=>{this.options.onAr?.()}})),this.fullscreenBtn=this.syncButton(this.fullscreenBtn,e.fullscreen!==!1&&this.options.onFullscreen!==void 0,()=>new R({variant:`outline`,size:`icon`,label:Xe(),icon:L.fullscreen(),onClick:()=>{this.options.onFullscreen?.()}}))}destroy(){document.removeEventListener(`fullscreenchange`,this.onFullscreenChange)}},Z=.5,_n=class e{element;constructor(t,n){this.element=Object.assign(document.createElement(`div`),{className:`vd-camera-controls`});let r={targetRotation:n.rotation,targetTilt:n.tilt,targetZoom:n.zoom,thetaOffset:0},i=vn(t,n,r);n.onChange(e=>{r.targetRotation=e.rotation-r.thetaOffset,r.targetTilt=e.tilt,r.targetZoom=e.zoom,yn(i,n,e)}),this.element.appendChild(e.buildZoom(i.zoomOut,i.zoomIn)),this.element.appendChild(e.buildDpad(i.tiltUp,i.rotateLeft,i.reset,i.rotateRight,i.tiltDown))}static buildZoom(e,t){let n=document.createElement(`div`);return n.className=`vd-zoom`,n.appendChild(e.element),n.appendChild(t.element),n}static buildDpad(e,t,n,r,i){let a=document.createElement(`div`);a.className=`vd-dpad`;for(let[o,s]of[[e,`up`],[t,`left`],[n,`center`],[r,`right`],[i,`down`]])o.element.classList.add(`vd-dpad-${s}`),a.appendChild(o.element);return a}};function vn(e,t,n){let r=e=>Math.max(t.limits?.minZoom??1,Math.min(t.limits?.maxZoom??1/0,e)),i=e=>{let n=t.limits?.minRotate,r=t.limits?.maxRotate;return n!==void 0||r!==void 0?Math.max(n??-1/0,Math.min(r??1/0,e)):e},a=r=>{let i=t.limits?.minTilt,a=t.limits?.maxTilt;if(i!==void 0||a!==void 0){n.targetTilt=Math.max(i??0,Math.min(a??180,n.targetTilt+r)),e.tilt(n.targetTilt).set();return}let o=n.targetTilt+r;o>180||o<0?(n.targetTilt=o>180?360-o:-o,n.thetaOffset=(n.thetaOffset+180)%360,e.tilt(n.targetTilt).rotate(n.targetRotation+n.thetaOffset).set()):(n.targetTilt=o,e.tilt(n.targetTilt).set())};return{zoomOut:new R({variant:`outline`,size:`icon`,label:bt(),icon:L.zoomOut(),onClick:()=>{n.targetZoom=r(n.targetZoom-10),e.zoom(n.targetZoom).set()}}),zoomIn:new R({variant:`outline`,size:`icon`,label:gt(),icon:L.zoomIn(),onClick:()=>{n.targetZoom=r(n.targetZoom+10),e.zoom(n.targetZoom).set()}}),tiltUp:new R({variant:`outline`,size:`icon`,label:Mt(),icon:L.tiltUp(),onClick:()=>{a(-15)}}),rotateLeft:new R({variant:`outline`,size:`icon`,label:wt(),icon:L.rotateLeft(),onClick:()=>{n.targetRotation=i(n.targetRotation-15),e.rotate(n.targetRotation+n.thetaOffset).set()}}),reset:new R({variant:`outline`,size:`icon`,label:ft(),icon:L.reset(),onClick:()=>{n.thetaOffset=0,e.reset()}}),rotateRight:new R({variant:`outline`,size:`icon`,label:Ot(),icon:L.rotateRight(),onClick:()=>{n.targetRotation=i(n.targetRotation+15),e.rotate(n.targetRotation+n.thetaOffset).set()}}),tiltDown:new R({variant:`outline`,size:`icon`,label:It(),icon:L.tiltDown(),onClick:()=>{a(15)}})}}function yn(e,t,n){let r=t.limits;r!==void 0&&(e.zoomOut.element.disabled=r.minZoom!==void 0&&n.zoom<=r.minZoom+Z,e.zoomIn.element.disabled=r.maxZoom!==void 0&&n.zoom>=r.maxZoom-Z,e.tiltUp.element.disabled=r.minTilt!==void 0&&n.tilt<=r.minTilt+Z,e.tiltDown.element.disabled=r.maxTilt!==void 0&&n.tilt>=r.maxTilt-Z,e.rotateLeft.element.disabled=r.minRotate!==void 0&&n.rotation<=r.minRotate+Z,e.rotateRight.element.disabled=r.maxRotate!==void 0&&n.rotation>=r.maxRotate-Z)}var bn=5;function Q(e){let t=e.replace(/([A-Z])/g,` $1`).trim();return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function xn(e,t,n,r,i){let a=document.createElement(`div`);a.className=`vd-attribute`,a.dataset.name=e.name;let o=document.createElement(`span`);o.className=`vd-attribute-label`,o.textContent=Q(e.name),a.appendChild(o);let s=e.values.find(n=>t.getValue(e.name,n)?.isSelected===!0),c=e.values.map(Q),l=e.values.length<=bn?new $t(e.values,s,c):new en(e.name,e.values,Q(e.name),s,c);return l.onSelect(t=>{n.dispatch(`ui:select`,{attribute:e.name,value:t},!0).defaultPrevented||r(e.name,t)}),i(e.name,t=>{l.setSelected(t.value),n.dispatch(`ui:selected`,{attribute:e.name,value:t.value})}),a.appendChild(l.element),a}var Sn=V.fontFamily.sans.join(`, `),$=`
214
+ position: absolute;
215
+ display: flex;
216
+ z-index: 10;
217
+ `,Cn=`
139
218
  /* Override browser's default black fullscreen backdrop */
140
219
  .vd-container:fullscreen {
141
220
  background: oklch(100% 0 0);
142
221
  }
143
222
 
144
- /* Top-right: screenshot + camera controls */
145
- .vd-toolbar {
146
- position: absolute;
147
- inset-block-start: ${J[3]};
148
- inset-inline-end: ${J[3]};
149
- display: flex;
223
+ /* Layout slots — four corners */
224
+ .vd-slot-top-right {
225
+ ${$}
226
+ inset-block-start: ${B[3]};
227
+ inset-inline-end: ${B[3]};
150
228
  flex-direction: column;
151
229
  align-items: flex-end;
152
- gap: ${J[1.5]};
153
- z-index: 10;
230
+ gap: ${B[1.5]};
154
231
  }
155
232
 
156
- /* Bottom-right: AR + fullscreen */
157
- .vd-action-bar {
158
- position: absolute;
159
- inset-block-end: ${J[3]};
160
- inset-inline-end: ${J[3]};
161
- display: flex;
233
+ .vd-slot-bottom-left {
234
+ ${$}
235
+ inset-block-end: ${B[3]};
236
+ inset-inline-start: ${B[3]};
237
+ flex-direction: column;
238
+ align-items: flex-start;
239
+ gap: ${B[1.5]};
240
+ }
241
+
242
+ .vd-slot-bottom-right {
243
+ ${$}
244
+ inset-block-end: ${B[3]};
245
+ inset-inline-end: ${B[3]};
162
246
  flex-direction: row;
163
- gap: ${J[1.5]};
164
- z-index: 10;
247
+ gap: ${B[1.5]};
165
248
  }
166
249
 
167
- /* Camera controls card inside .vd-toolbar */
250
+ /* Component styles — no positioning */
168
251
  .vd-camera-controls {
169
252
  display: flex;
170
253
  flex-direction: column;
171
- gap: ${J[1]};
172
- background: color-mix(in oklch, ${q.white} 85%, transparent);
254
+ gap: ${B[1]};
255
+ background: color-mix(in oklch, ${z.white} 85%, transparent);
173
256
  backdrop-filter: blur(8px);
174
- border-radius: ${J[2]};
175
- padding: ${J[2]};
257
+ border-radius: ${B[2]};
258
+ padding: ${B[2]};
176
259
  }
177
260
 
178
261
  .vd-zoom {
179
262
  display: flex;
180
- gap: ${J[.5]};
263
+ gap: ${B[.5]};
181
264
  }
182
265
 
183
266
  .vd-dpad {
184
267
  display: grid;
185
- grid-template-columns: repeat(3, ${J[9]});
186
- grid-template-rows: repeat(3, ${J[9]});
187
- gap: ${J[.5]};
268
+ grid-template-columns: repeat(3, ${B[9]});
269
+ grid-template-rows: repeat(3, ${B[9]});
270
+ gap: ${B[.5]};
188
271
  }
189
272
 
190
273
  .vd-dpad-up { grid-column: 2; grid-row: 1; }
@@ -193,33 +276,28 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
193
276
  .vd-dpad-right { grid-column: 3; grid-row: 2; }
194
277
  .vd-dpad-down { grid-column: 2; grid-row: 3; }
195
278
 
196
- /* Bottom-left: attribute selectors */
197
279
  .vd-attributes {
198
- position: absolute;
199
- inset-block-end: ${J[3]};
200
- inset-inline-start: ${J[3]};
201
280
  display: flex;
202
281
  flex-direction: column;
203
- gap: ${J[2]};
204
- background: color-mix(in oklch, ${q.white} 85%, transparent);
282
+ gap: ${B[2]};
283
+ background: color-mix(in oklch, ${z.white} 85%, transparent);
205
284
  backdrop-filter: blur(8px);
206
- border-radius: ${J[2]};
207
- padding: ${J[2]};
208
- font-family: ${_n};
209
- z-index: 10;
285
+ border-radius: ${B[2]};
286
+ padding: ${B[2]};
287
+ font-family: ${Sn};
210
288
  }
211
289
 
212
290
  .vd-attribute {
213
291
  display: flex;
214
292
  flex-direction: column;
215
- gap: ${J[1]};
293
+ gap: ${B[1]};
216
294
  }
217
295
 
218
296
  .vd-attribute-label {
219
- font-size: ${Y.fontSize.xs};
220
- font-weight: ${Y.fontWeight.medium};
221
- color: ${q.neutral[900]};
222
- font-family: ${_n};
297
+ font-size: ${V.fontSize.xs};
298
+ font-weight: ${V.fontWeight.medium};
299
+ color: ${z.neutral[900]};
300
+ font-family: ${Sn};
223
301
  }
224
302
 
225
- `;function yn(){if(un(),document.getElementById(`vd-styles`)!==null)return;let e=document.createElement(`style`);e.id=`vd-styles`,e.textContent=vn,document.head.appendChild(e)}var bn=class{options;settings={};container=null;loading=null;toolbar=null;actionBar=null;cameraControls=null;attributes=null;constructor(e){this.options=e}attach(e){yn(),this.container=e,this.loading=new Vt(e),this.toolbar=new fn({snapshotApi:this.options.snapshotApi}),this.toolbar.applySettings(this.settings),e.appendChild(this.toolbar.element),this.actionBar=new pn({onAr:this.options.onAr,onFullscreen:()=>{document.fullscreenElement===null?this.container?.requestFullscreen():document.exitFullscreen()}}),this.actionBar.applySettings(this.settings),e.appendChild(this.actionBar.element)}onReady(){this.loading?.hide(),this.loading=null,this.cameraControls!==null&&(this.cameraControls.element.style.display=`flex`),this.attributes!==null&&(this.attributes.style.display=`flex`)}updateProgress(e,t){this.loading?.updateProgress(e,t)}showError(e){this.loading?.showError(e)}applyViewerSettings(e){this.settings=e,e.language!==void 0&&A(e.language),this.toolbar?.applySettings(e),this.actionBar?.applySettings(e),this.cameraControls!==null&&(this.cameraControls.element.style.display=e.cameraControls===!0?`flex`:`none`)}renderAttributeControls(e,t){if(!(this.container===null||this.toolbar===null)&&(this.cameraControls?.element.remove(),this.cameraControls=null,this.attributes?.remove(),this.attributes=null,this.settings.cameraControls===!0&&(this.cameraControls=new mn(this.options.cameraApi,this.options.cameraPositionApi),this.cameraControls.element.style.display=`none`,this.toolbar.element.appendChild(this.cameraControls.element)),t.length!==0)){this.attributes=document.createElement(`div`),this.attributes.className=`vd-attributes`,this.attributes.style.display=`none`;for(let n of t)this.attributes.appendChild(gn(n,e,this.options.eventBus,this.options.onSelect,this.options.onSubscribe));this.container.appendChild(this.attributes)}}get viewerSettings(){return this.settings}destroy(){this.loading?.destroy(),this.toolbar?.element.remove(),this.actionBar?.destroy(),this.actionBar?.element.remove(),this.cameraControls?.element.remove(),this.attributes?.remove(),this.container=null}},xn=class{attributes;readyStateTracker;messenger;cameraApi;cameraPositionApi;snapshotApi;eventBus;ui;qrModal;options;iframe;container;readyCallbacks=[];mutationFailedCallbacks=[];constructor(e){this.options=e,this.initializeLogging(),this.messenger=new fe(()=>this.iframe?.contentWindow??null);let t=e=>{this.messenger.send(e)};this.attributes=new pe(t,(e,t)=>{for(let n of this.mutationFailedCallbacks)n({attribute:e,value:t})}),this.snapshotApi=new _e(t),this.cameraApi=new me(t),this.cameraPositionApi=new he,this.eventBus=new ve,this.qrModal=new cn,this.readyStateTracker=new _(()=>{let e=this.readyCallbacks;this.readyCallbacks=[];for(let t of e)t(this);this.ui.onReady()}),this.ui=new bn({snapshotApi:this.snapshotApi,cameraApi:this.cameraApi,cameraPositionApi:this.cameraPositionApi,eventBus:this.eventBus,onSelect:(e,t)=>this.attributes.select(e,t),onSubscribe:(e,t)=>this.attributes.onChange(e,t),onAr:()=>{this.qrModal.show(this.iframe?.src??``)}}),this.registerHandlers(),this.messenger.start(),this.createAndConnectIframe()}registerHandlers(){this.messenger.on(y.HANDSHAKE,e=>{ie(e)&&(m.info(`Server handshake received, flushing publisher queue`),this.messenger.markReady())}),this.messenger.on(y.MUTATION,e=>{ae(e)&&this.attributes.handleMutationResult(e)}),this.messenger.on(y.SNAPSHOT,e=>{oe(e)&&this.snapshotApi.handleSnapshotResult(e)}),this.messenger.on(y.CAMERA,e=>{se(e)&&this.cameraPositionApi.handlePositionUpdate(e)}),this.messenger.on(y.LOADING_INDICATOR,e=>{le(e)&&(e.error===void 0?this.ui.updateProgress(e.progress,e.phase):this.ui.showError(e.error))}),this.messenger.on(y.CONFIG,e=>{ue(e)&&(e.viewerSettings!==void 0&&this.ui.applyViewerSettings(e.viewerSettings),this.cameraPositionApi.applyLimits(e.cameraLimits))}),this.messenger.on(y.MAPPING,e=>{ce(e)&&(this.attributes.handleMappingReceived(e),this.ui.renderAttributeControls(this.attributes,e.attributes),this.readyStateTracker.handleMappingReceived())})}initializeLogging(){this.options.debug===!0&&h(),m.info(`Initializing Virtualdisplay client`,{model:this.options.model})}createAndConnectIframe(){let e=new r(this.options).create();this.container=e.container,this.iframe=e.iframe,this.eventBus.attach(this.container),this.ui.attach(this.container)}select(e,t){this.attributes.select(e,t)}getValues(e){return this.attributes.getValues(e)}getValue(e,t){return this.attributes.getValue(e,t)}onChange(e,t){this.attributes.onChange(e,t)}getAttribute(e){return this.attributes.getAttribute(e)}get isReady(){return this.readyStateTracker.isReady}onReady(e){if(this.readyStateTracker.isReady){e(this);return}this.readyCallbacks.push(e)}onMutationFailed(e){this.mutationFailedCallbacks.push(e)}on(e,t){this.eventBus.on(e,t)}get camera(){return this.cameraApi}get cameraPosition(){return this.cameraPositionApi}get snapshot(){return this.snapshotApi}get viewerSettings(){return this.ui.viewerSettings}destroy(){this.readyStateTracker.clear(),this.readyCallbacks=[],this.messenger.destroy(),this.qrModal.hide(),this.ui.destroy(),this.container?.parentElement!==null&&this.container?.parentElement!==void 0&&this.container.parentElement.removeChild(this.container),this.container=void 0,this.iframe=void 0}};exports.Attribute=ee,exports.AttributeValue=v,exports.Camera=me,exports.ERROR_CODES=t,exports.Photo=ge,exports.Snapshot=_e,exports.VirtualdisplayClient=xn,exports.VirtualdisplayError=n,exports.enableDebugMode=h,exports.isDebugMode=g,Object.defineProperty(exports,`logger`,{enumerable:!0,get:function(){return m}});
303
+ `;function wn(){if(on(),document.getElementById(`vd-styles`)!==null)return;let e=document.createElement(`style`);e.id=`vd-styles`,e.textContent=Cn,document.head.appendChild(e)}function Tn(e,t){let n=document.createElement(`a`);n.href=`data:image/png;base64,${e}`,n.download=t,n.click()}var En=class{options;settings={};container=null;loading=null;slots={topRight:null,bottomLeft:null,bottomRight:null};screenshotBtn=null;actionBar=null;cameraControls=null;attributes=null;constructor(e){this.options=e}attach(e){wn(),this.container=e,this.loading=new hn(e),this.slots.topRight=this.createSlot(e,`vd-slot-top-right`),this.slots.bottomLeft=this.createSlot(e,`vd-slot-bottom-left`),this.slots.bottomRight=this.createSlot(e,`vd-slot-bottom-right`)}onReady(){this.loading?.hide(),this.loading=null,this.mountToolbar(),this.cameraControls!==null&&(this.cameraControls.element.style.display=`flex`),this.attributes!==null&&(this.attributes.style.display=`flex`)}mountToolbar(){this.actionBar!==null||this.slots.bottomRight===null||(this.actionBar=new gn({onAr:this.options.onAr,onFullscreen:()=>{document.fullscreenElement===null?this.container?.requestFullscreen():document.exitFullscreen()}}),this.actionBar.applySettings(this.settings),this.slots.bottomRight.appendChild(this.actionBar.element),this.syncScreenshotButton(),this.placeScreenshotButton())}updateProgress(e,t){this.loading?.updateProgress(e,t)}showError(e){this.loading?.showError(e)}applyViewerSettings(e){this.settings=e,e.language!==void 0&&N(e.language,{reload:!1}),this.syncScreenshotButton(),this.actionBar?.applySettings(e),this.cameraControls!==null&&(this.cameraControls.element.style.display=e.cameraControls===!0?`flex`:`none`),this.placeScreenshotButton()}renderAttributeControls(e,t){if(!(this.container===null||this.slots.topRight===null)&&(this.cameraControls?.element.remove(),this.cameraControls=null,this.attributes?.remove(),this.attributes=null,this.settings.cameraControls===!0&&(this.cameraControls=new _n(this.options.cameraApi,this.options.cameraPositionApi),this.cameraControls.element.style.display=`none`,this.slots.topRight.appendChild(this.cameraControls.element)),this.placeScreenshotButton(),!(t.length===0||this.settings.attributeControls===!1))){this.attributes=document.createElement(`div`),this.attributes.className=`vd-attributes`,this.attributes.style.display=`none`;for(let n of t)this.attributes.appendChild(xn(n,e,this.options.eventBus,this.options.onSelect,this.options.onSubscribe));this.slots.bottomLeft.appendChild(this.attributes)}}get viewerSettings(){return this.settings}destroy(){this.loading?.destroy(),this.screenshotBtn?.element.remove(),this.actionBar?.destroy(),this.actionBar?.element.remove(),this.cameraControls?.element.remove(),this.attributes?.remove();for(let e of Object.values(this.slots))e?.remove();this.container=null}createSlot(e,t){let n=document.createElement(`div`);return n.className=t,e.appendChild(n),n}syncScreenshotButton(){let e=this.settings.screenshot===!0;e&&this.screenshotBtn===null&&(this.screenshotBtn=new R({variant:`outline`,size:`icon`,label:ct(),icon:L.screenshot(),onClick:()=>{this.options.snapshotApi.take(`snapshot.png`).onDeveloped(({data:e,filename:t})=>{Tn(e,t)})}})),!e&&this.screenshotBtn!==null&&(this.screenshotBtn.element.remove(),this.screenshotBtn=null)}placeScreenshotButton(){this.screenshotBtn===null||this.slots.topRight===null||(this.cameraControls===null?this.slots.topRight.appendChild(this.screenshotBtn.element):this.cameraControls.element.appendChild(this.screenshotBtn.element))}},Dn=class{attributes;readyStateTracker;messenger;cameraApi;cameraPositionApi;snapshotApi;annotationsApi;eventBus;ui;qrModal;options;iframe;container;readyCallbacks=[];mutationFailedCallbacks=[];constructor(e){this.options=e,this.initializeLogging(),this.messenger=new fe(()=>this.iframe?.contentWindow??null);let t=e=>{this.messenger.send(e)};this.attributes=new ge(t,(e,t)=>{for(let n of this.mutationFailedCallbacks)n({attribute:e,value:t})}),this.snapshotApi=new S(t),this.annotationsApi=new pe(t),this.cameraApi=new _e(t),this.cameraPositionApi=new ve,this.eventBus=new be,this.qrModal=new nn,this.readyStateTracker=new te(()=>{let e=this.readyCallbacks;this.readyCallbacks=[];for(let t of e)t(this);this.ui.onReady()}),this.ui=new En({snapshotApi:this.snapshotApi,cameraApi:this.cameraApi,cameraPositionApi:this.cameraPositionApi,eventBus:this.eventBus,onSelect:(e,t)=>this.attributes.select(e,t),onSubscribe:(e,t)=>this.attributes.onChange(e,t),onAr:()=>{this.qrModal.show(this.iframe?.src??``)}}),this.registerHandlers(),this.messenger.start(),this.createAndConnectIframe()}registerHandlers(){this.messenger.on(v.HANDSHAKE,e=>{ie(e)&&(g.info(`Server handshake received, flushing publisher queue`),this.messenger.markReady())}),this.messenger.on(v.MUTATION,e=>{ae(e)&&this.attributes.handleMutationResult(e)}),this.messenger.on(v.SNAPSHOT,e=>{oe(e)&&this.snapshotApi.handleSnapshotResult(e)}),this.messenger.on(v.CAMERA,e=>{se(e)&&this.cameraPositionApi.handlePositionUpdate(e)}),this.messenger.on(v.LOADING_INDICATOR,e=>{le(e)&&(e.error===void 0?this.ui.updateProgress(e.progress,e.phase):this.ui.showError(e.error))}),this.messenger.on(v.CONFIG,e=>{ue(e)&&this.handleConfig(e)}),this.messenger.on(v.ANNOTATION_PLACED,e=>{de(e)&&this.annotationsApi.handlePlaced(e.position)}),this.messenger.on(v.MAPPING,e=>{ce(e)&&(this.attributes.handleMappingReceived(e),this.ui.renderAttributeControls(this.attributes,e.attributes),this.readyStateTracker.handleMappingReceived())})}handleConfig(e){let t=e.viewerSettings,n=this.options.viewerSettings;if(t!==void 0||n!==void 0){let e=n===void 0?t:{...t??{},...n};if(n!==void 0&&t!==void 0){let e=Object.entries(n).filter(([e,n])=>t[e]!==n).map(([e,n])=>`${e} (metadata: ${t[e]??`undefined`}, override: ${n})`);e.length>0&&g.warn(`Viewer settings override active: ${e.join(`, `)}`)}this.ui.applyViewerSettings(e),this.annotationsApi.setEnabled(e.annotations!==!1)}this.cameraPositionApi.applyLimits(e.cameraLimits)}initializeLogging(){this.options.debug===!0&&_(),g.info(`Initializing Virtualdisplay client`,{model:this.options.model})}createAndConnectIframe(){let e=new r(this.options).create();this.container=e.container,this.iframe=e.iframe,this.eventBus.attach(this.container),this.ui.attach(this.container);try{let e=new URL(this.iframe.src).origin;this.messenger.setTargetOrigin(e)}catch{}}select(e,t){this.attributes.select(e,t)}getValues(e){return this.attributes.getValues(e)}getValue(e,t){return this.attributes.getValue(e,t)}onChange(e,t){this.attributes.onChange(e,t)}getAttribute(e){return this.attributes.getAttribute(e)}get isReady(){return this.readyStateTracker.isReady}onReady(e){if(this.readyStateTracker.isReady){e(this);return}this.readyCallbacks.push(e)}onMutationFailed(e){this.mutationFailedCallbacks.push(e)}on(e,t){this.eventBus.on(e,t)}get annotations(){return this.annotationsApi}get camera(){return this.cameraApi}get cameraPosition(){return this.cameraPositionApi}get snapshot(){return this.snapshotApi}get viewerSettings(){return this.ui.viewerSettings}destroy(){this.readyStateTracker.clear(),this.readyCallbacks=[],this.messenger.destroy(),this.qrModal.hide(),this.ui.destroy(),this.container?.parentElement!==null&&this.container?.parentElement!==void 0&&this.container.parentElement.removeChild(this.container),this.container=void 0,this.iframe=void 0}};exports.Annotations=pe,exports.Attribute=x,exports.AttributeValue=me,exports.Camera=_e,exports.ERROR_CODES=t,exports.Photo=ye,exports.Snapshot=S,exports.VirtualdisplayClient=Dn,exports.VirtualdisplayError=n,exports.enableDebugMode=_,exports.isDebugMode=ee,Object.defineProperty(exports,`logger`,{enumerable:!0,get:function(){return g}});