@virtualdisplay.io/client 4.0.0-alpha.11 → 4.0.0-alpha.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/README.md +1 -1
- package/dist/browser-DfB_An57.cjs +8 -0
- package/dist/browser-ey6Iih3j.js +1540 -0
- package/dist/src/attributes/attribute.d.ts +2 -0
- package/dist/src/attributes/attribute.d.ts.map +1 -1
- package/dist/src/attributes/attributes.d.ts +2 -0
- package/dist/src/attributes/attributes.d.ts.map +1 -1
- package/dist/src/attributes/selections.d.ts +2 -1
- package/dist/src/attributes/selections.d.ts.map +1 -1
- package/dist/src/client/client.d.ts +20 -0
- package/dist/src/client/client.d.ts.map +1 -1
- package/dist/src/client/events.d.ts +22 -0
- package/dist/src/client/events.d.ts.map +1 -0
- package/dist/src/client/types.d.ts +5 -4
- package/dist/src/client/types.d.ts.map +1 -1
- package/dist/src/configuration/configuration.d.ts +113 -0
- package/dist/src/configuration/configuration.d.ts.map +1 -0
- package/dist/src/configuration/index.d.ts +2 -0
- package/dist/src/configuration/index.d.ts.map +1 -0
- package/dist/src/configuration/resolver.d.ts +16 -0
- package/dist/src/configuration/resolver.d.ts.map +1 -0
- package/dist/src/focus/focus.d.ts +43 -0
- package/dist/src/focus/focus.d.ts.map +1 -0
- package/dist/src/focus/index.d.ts +2 -0
- package/dist/src/focus/index.d.ts.map +1 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/snapshot/snapshot.d.ts +6 -0
- package/dist/src/snapshot/snapshot.d.ts.map +1 -1
- package/dist/src/ui/commerce-panel.d.ts +31 -0
- package/dist/src/ui/commerce-panel.d.ts.map +1 -0
- package/dist/src/ui/controls/attribute-group.d.ts.map +1 -1
- package/dist/src/ui/layouts/inframe-layout.d.ts +13 -0
- package/dist/src/ui/layouts/inframe-layout.d.ts.map +1 -0
- package/dist/src/ui/layouts/layout.d.ts +15 -0
- package/dist/src/ui/layouts/layout.d.ts.map +1 -0
- package/dist/src/ui/layouts/null-layout.d.ts +12 -0
- package/dist/src/ui/layouts/null-layout.d.ts.map +1 -0
- package/dist/src/ui/layouts/registry.d.ts +4 -0
- package/dist/src/ui/layouts/registry.d.ts.map +1 -0
- package/dist/src/ui/layouts/sidebar-layout.d.ts +24 -0
- package/dist/src/ui/layouts/sidebar-layout.d.ts.map +1 -0
- package/dist/src/ui/standard-interface.d.ts +6 -0
- package/dist/src/ui/standard-interface.d.ts.map +1 -1
- package/dist/src/ui/styles.d.ts.map +1 -1
- package/dist/virtualdisplay.client.cjs.js +193 -42
- package/dist/virtualdisplay.client.es.js +3099 -1945
- package/dist/virtualdisplay.client.umd.js +198 -47
- package/package.json +1 -1
- package/dist/browser-CDLfpTNV.cjs +0 -8
- package/dist/browser-DxtIwHNu.js +0 -1227
- package/dist/chunk-BcutgqC9.cjs +0 -1
- package/dist/chunk-C_CI6nMA.js +0 -13
|
@@ -1,5 +1,4 @@
|
|
|
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()}function d(){return typeof navigator>`u`?``:navigator.userAgent}function f(){return typeof navigator>`u`?!1:navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1}function p(){return/iPhone|iPad|iPod/i.test(d())||f()}function m(){return/Android/i.test(d())}function h(){return p()||m()}var g=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 _(e,t){return new g({service:e,isDev:t?.isDev===void 0?typeof process<`u`?process.env.NODE_ENV!==`production`:!0:t.isDev,traceProvider:t?.traceProvider})}function v(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 ee(e){return{debug:(t,n)=>e.debug(t,v(n)),info:(t,n)=>e.info(t,v(n)),warn:(t,n)=>e.warn(t,v(n)),error:(t,n)=>e.error(t,v(n))}}var te=!1,y=ee(_(`client`,{isDev:!1}));function ne(){te=!0,y=ee(_(`client`,{isDev:!0}))}function re(){return te}var ie=class{ready=!1;onReady;constructor(e){this.onReady=e}handleMappingReceived(){this.ready||(this.ready=!0,y.info(`Mapping received from server, client is now ready`),this.onReady?.())}get isReady(){return this.ready}clear(){this.ready=!1}},b={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`},ae=new Set(Object.values(b));function oe(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.target==`string`?!1:typeof t.type==`string`&&ae.has(t.type)}function se(e){let t=x(e);return t!==null&&t.type===b.HANDSHAKE}function ce(e){let t=x(e);return t!==null&&t.type===b.MUTATION&&Array.isArray(t.results)}function le(e){let t=x(e);return t!==null&&t.type===b.SNAPSHOT&&(`data`in t||`error`in t)}function ue(e){let t=x(e);return t!==null&&t.type===b.CAMERA&&Array.isArray(t.transforms)}function de(e){let t=x(e);return t!==null&&t.type===b.MAPPING&&Array.isArray(t.attributes)}function fe(e){let t=x(e);return t!==null&&t.type===b.LOADING_INDICATOR&&typeof t.progress==`number`}function pe(e){let t=x(e);return t!==null&&t.type===b.CONFIG&&typeof t.viewerSettings==`object`}function me(e){let t=x(e);return t!==null&&t.type===b.ANNOTATION_PLACED&&typeof t.position==`object`&&t.position!==null}function x(e){return typeof e!=`object`||!e?null:e}var he=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}},ge=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 he(e=>this.post(e)),this.consumer=new he(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(!oe(t)||t._source===this.sourceId)return;let n=this.getTarget();if(n!==null&&e.source!==null&&e.source!==n)return;let r=t;if(this.shouldBuffer!==null&&!this.shouldBuffer(r)){this.routeToHandler(r);return}this.consumer.enqueue(r)},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([b.CAMERA]);var S=class{placedCallbacks=[];constructor(e){this.send=e}setEnabled(e){this.send({type:b.ANNOTATION_TOGGLE,enabled:e})}startPlacing(){this.send({type:b.ANNOTATION_PLACE_MODE,enabled:!0})}stopPlacing(){this.send({type:b.ANNOTATION_PLACE_MODE,enabled:!1})}onPlaced(e){this.placedCallbacks.push(e)}handlePlaced(e){for(let t of this.placedCallbacks)t(e)}},C=class{isSelectedValue=!1;constructor(e,t){this.value=e,this.attribute=t}get isSelected(){return this.isSelectedValue}setSelected(e){this.isSelectedValue=e}},_e=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 C(n,this.name);n===this.defaultValue&&e.setSelected(!0),t.set(n,e)}return t}},ve=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 _e(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}}},ye=class{registry;pendingCallbacks=[];constructor(e,t){this.send=e,this.onMutationFailed=t}handleMappingReceived(e){y.debug(`Initializing from server mapping`,{attributeCount:e.attributes.length}),this.registry=new ve(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){y.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:b.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&&y.warn(`onChange: attribute "${e}" not found — buffered callback will not fire`),n?.onChange(t)}this.pendingCallbacks.length=0}},be=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:b.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:b.CAMERA,commands:[{action:`reset`}]};this.send(e)}},xe=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)}}},Se=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())}},Ce=class{validExtensions=[`.png`];pendingPhotos=new Map;constructor(e){this.send=e}take(e){this.validateFilename(e),y.debug(`Taking snapshot`,{filename:e});let t=new Se(e);return this.pendingPhotos.set(t.getFilename(),t),this.send({type:b.SNAPSHOT,filename:e}),t}handleSnapshotResult(e){let r=this.pendingPhotos.get(e.filename);if(r===void 0){y.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)}},we=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)}}},Te={},Ee=[`en`,`nl`,`de`],w=[`baseLocale`],De=[],Oe,ke;function Ae(e){if(De.length===0)return;let t=typeof e==`string`?e:e.href;if(Oe===t)return ke;let n=new URL(t,`http://dummy.com`),r;for(let e of De)if(new Te(e.match,n.href).exec(n.href)){r=e;break}return Oe=t,ke=r,r}function je(e){let t=Ae(e);return t&&t.exclude!==!0&&Array.isArray(t.strategy)?t.strategy:w}var Me=void 0,T=typeof window>`u`;globalThis.__paraglide=globalThis.__paraglide??{},globalThis.__paraglide.ssr=globalThis.__paraglide.ssr??{};var E=!1,D=()=>{if(Me){let e=Me?.getStore()?.locale;if(e)return e}let e=w;!T&&typeof window<`u`&&window.location?.href&&(e=je(window.location.href));let t=Ne(e,typeof window<`u`?window.location?.href:void 0);if(t)return E||(E=!0,O(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 Ne(e,t){let n;for(let t of e){if(t===`baseLocale`)n=`en`;else if(j(t)&&A.has(t)){let e=A.get(t);if(e){let t=e.getLocale();if(t instanceof Promise)continue;if(t!==void 0)return Fe(t)}}let e=k(n);if(e)return e}}var Pe=e=>{e?window.location.href=e:window.location.reload()},O=(e,t)=>{let n={reload:!0,...t},r;try{r=D()}catch{}let i=[],a=w;!T&&typeof window<`u`&&window.location?.href&&(a=je(window.location.href));for(let t of a)if(t===`baseLocale`)continue;else if(j(t)&&A.has(t)){let n=A.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=()=>{!T&&n.reload&&window.location&&e!==r&&Pe(void 0)};if(i.length)return Promise.all(i).then(()=>{o()});o()};function k(e){if(typeof e!=`string`)return;let t=e.toLowerCase();for(let e of Ee)if(e.toLowerCase()===t)return e}function Fe(e){let t=k(e);if(t)return t;throw Error(`Invalid locale: ${e}. Expected one of: ${Ee.join(`, `)}`)}var A=new Map;function j(e){return typeof e==`string`&&/^custom-[A-Za-z0-9_-]+$/.test(e)}var Ie=()=>`Activate AR`,Le=()=>`AR activeren`,Re=()=>`AR aktivieren`,ze=((e={},t={})=>{let n=t.locale??D();return n===`en`?Ie(e):n===`nl`?Le(e):Re(e)}),Be=()=>`Scan to view in AR`,Ve=()=>`Scan om in AR te bekijken`,He=()=>`Scannen für AR-Ansicht`,Ue=((e={},t={})=>{let n=t.locale??D();return n===`en`?Be(e):n===`nl`?Ve(e):He(e)}),We=()=>`Use your smartphone camera to scan this QR code`,Ge=()=>`Gebruik de camera van je smartphone om deze QR-code te scannen`,Ke=()=>`Verwenden Sie die Kamera Ihres Smartphones, um diesen QR-Code zu scannen`,qe=((e={},t={})=>{let n=t.locale??D();return n===`en`?We(e):n===`nl`?Ge(e):Ke(e)}),Je=()=>`The 3D model will open in your phone's AR mode`,Ye=()=>`Het 3D-model wordt geopend in de AR-modus van je telefoon`,Xe=()=>`Das 3D-Modell wird im AR-Modus Ihres Telefons geöffnet`,Ze=((e={},t={})=>{let n=t.locale??D();return n===`en`?Je(e):n===`nl`?Ye(e):Xe(e)}),Qe=()=>`Close`,$e=()=>`Sluiten`,et=()=>`Schließen`,tt=((e={},t={})=>{let n=t.locale??D();return n===`en`?Qe(e):n===`nl`?$e(e):et(e)}),nt=()=>`Toggle fullscreen`,rt=()=>`Volledig scherm`,it=()=>`Vollbild umschalten`,at=((e={},t={})=>{let n=t.locale??D();return n===`en`?nt(e):n===`nl`?rt(e):it(e)}),ot=()=>`Downloading`,st=()=>`Downloaden`,ct=()=>`Herunterladen`,M=((e={},t={})=>{let n=t.locale??D();return n===`en`?ot(e):n===`nl`?st(e):ct(e)}),lt=()=>`Rendering`,ut=()=>`Renderen`,dt=()=>`Rendern`,ft=((e={},t={})=>{let n=t.locale??D();return n===`en`?lt(e):n===`nl`?ut(e):dt(e)}),pt=()=>`Screenshot`,mt=()=>`Screenshot`,ht=()=>`Screenshot`,gt=((e={},t={})=>{let n=t.locale??D();return n===`en`?pt(e):n===`nl`?mt(e):ht(e)}),_t=()=>`Reset camera`,vt=()=>`Camera resetten`,yt=()=>`Kamera zurücksetzen`,bt=((e={},t={})=>{let n=t.locale??D();return n===`en`?_t(e):n===`nl`?vt(e):yt(e)}),xt=()=>`Zoom in`,St=()=>`Inzoomen`,Ct=()=>`Hineinzoomen`,wt=((e={},t={})=>{let n=t.locale??D();return n===`en`?xt(e):n===`nl`?St(e):Ct(e)}),Tt=()=>`Zoom out`,Et=()=>`Uitzoomen`,Dt=()=>`Herauszoomen`,Ot=((e={},t={})=>{let n=t.locale??D();return n===`en`?Tt(e):n===`nl`?Et(e):Dt(e)}),kt=()=>`Rotate left`,At=()=>`Naar links draaien`,jt=()=>`Nach links drehen`,Mt=((e={},t={})=>{let n=t.locale??D();return n===`en`?kt(e):n===`nl`?At(e):jt(e)}),Nt=()=>`Rotate right`,Pt=()=>`Naar rechts draaien`,Ft=()=>`Nach rechts drehen`,It=((e={},t={})=>{let n=t.locale??D();return n===`en`?Nt(e):n===`nl`?Pt(e):Ft(e)}),Lt=()=>`Tilt up`,Rt=()=>`Omhoog kantelen`,zt=()=>`Nach oben kippen`,Bt=((e={},t={})=>{let n=t.locale??D();return n===`en`?Lt(e):n===`nl`?Rt(e):zt(e)}),Vt=()=>`Tilt down`,Ht=()=>`Omlaag kantelen`,Ut=()=>`Nach unten kippen`,Wt=((e={},t={})=>{let n=t.locale??D();return n===`en`?Vt(e):n===`nl`?Ht(e):Ut(e)}),Gt={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`},N=([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=N(e);r.appendChild(t)}),r},P=(e,t={})=>N([`svg`,{...Gt,...t},e]),Kt=[[`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`}]],qt=[[`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`}]],F=[[`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 I(e,{size:t=20,strokeWidth:n=1.75}={}){return P(e,{width:t,height:t,"stroke-width":n})}var L={ar:e=>I(Kt,e),fullscreen:e=>I(Zt,e),exitFullscreen:e=>I(Qt,e),screenshot:e=>I(qt,e),tiltUp:e=>I(Xt,e),tiltDown:e=>I(F,e),rotateLeft:e=>I(Jt,e),rotateRight:e=>I(Yt,e),zoomIn:e=>I(en,e),zoomOut:e=>I(tn,e),reset:e=>I($t,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 nn=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%`})}},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: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}},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=P(F,{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`}},sn=V.fontFamily.sans.join(`, `),cn=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 rn({onClose:()=>{this.dialog=null}}),Object.assign(this.dialog.card.element.style,{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:B[3],fontFamily:sn}),this.dialog.card.element.appendChild(this.createText(Ue(),{fontSize:V.fontSize.base,fontWeight:V.fontWeight.semibold,color:z.neutral[900]})),this.dialog.card.element.appendChild(this.createText(qe(),{fontSize:V.fontSize.sm,color:z.neutral[600]})),this.dialog.card.element.appendChild(this.createQrImage(n)),this.dialog.card.element.appendChild(this.createText(Ze(),{fontSize:V.fontSize.xs,color:z.neutral[500]}));let r=new R({variant:`outline`,label:tt(),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(`, `),ln=`
|
|
2
|
-
:root {
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _={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"};class f extends Error{code;constructor(t,e){super(t),this.name="VirtualdisplayError",this.code=e}static noMapping(){return new f("No attributes available. Waiting for server metadata.",_.NO_MAPPING)}static attributeNotFound(t){return new f(`Attribute "${t}" not found in mapping`,_.ATTRIBUTE_NOT_FOUND)}static valueNotFound(t,e){return new f(`Value "${e}" not found for attribute "${t}"`,_.VALUE_NOT_FOUND)}static parentNotFound(t){return new f(`Parent element not found: ${t}`,_.PARENT_NOT_FOUND)}static invalidParameter(t){return new f(t,_.INVALID_PARAMETER)}static snapshotFailed(t,e){return new f(`Snapshot failed for "${t}": ${e}`,_.SNAPSHOT_FAILED)}}const Nt={};class It{defaultServer="https://server.virtualdisplay.io";options;constructor(t){this.options=t}create(){const t=this.createContainer(),e=this.createIframe();return t.appendChild(e),this.attachToParent(t),{container:t,iframe:e}}createContainer(){const t=document.createElement("div");return t.className="vd-container",Object.assign(t.style,{position:"relative",width:"100%",height:"100%",overflow:"hidden"}),t}createIframe(){const t=document.createElement("iframe");return t.src=this.buildUrl(),Object.assign(t.style,{width:"100%",height:"100%",border:"none",display:"block"}),t.setAttribute("allow","xr-spatial-tracking; fullscreen"),t}attachToParent(t){this.getParentElement().appendChild(t)}buildUrl(){const t=this.getServerUrl(),e=new URL(t);return e.searchParams.set("license",this.options.license),e.searchParams.set("model",this.options.model),this.options.language!==void 0&&e.searchParams.set("language",this.options.language),this.options.debug===!0&&e.searchParams.set("debug","true"),this.options.traceparent!==void 0&&e.searchParams.set("traceparent",this.options.traceparent),e.toString()}getServerUrl(){if(Nt?.VITE_VIRTUALDISPLAY_SERVER_HOST===void 0)return this.defaultServer}getParentElement(){if(typeof this.options.parent!="string")return this.options.parent;const t=document.querySelector(this.options.parent);if(t===null)throw f.parentNotFound(this.options.parent);return t}}function Lt(n){const t=new Date(n.timestamp).toLocaleTimeString("en-GB",{hour12:!1}),e=n.level.toUpperCase().padEnd(5),i=n.trace_id?.slice(0,8)??"--------",o=n.msg,s=["timestamp","level","msg","service","trace_id","span_id"],r=Object.entries(n).filter(([l])=>!s.includes(l)).map(([l,d])=>`${l}=${JSON.stringify(d)}`).join(" ");return`${t} ${e} [${i}] ${o}${r?" "+r:""}`}function Mt(n){return JSON.stringify(n)}function zt(n,t){const e=t?Lt(n):Mt(n);n.level==="error"?console.error(e):n.level==="warn"?console.warn(e):console.log(e)}function at(n,t=0){const e={name:n.name,message:n.message};n.stack!==void 0&&(e.stack=n.stack);for(const i of Object.getOwnPropertyNames(n)){if(i==="name"||i==="message"||i==="stack"||i==="cause")continue;const o=n[i];o!==void 0&&(e[i]=o)}return n.cause!==void 0&&n.cause!==null&&(e.cause=n.cause instanceof Error&&t<5?at(n.cause,t+1):String(n.cause)),e}function Pt(n){const t={};for(const[e,i]of Object.entries(n))t[e]=i instanceof Error?at(i):i;return t}function Ft(){return new Date}function Dt(n){return n.toISOString()}function lt(){return typeof navigator>"u"?"":navigator.userAgent}function $t(){return typeof navigator>"u"?!1:navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1}function Bt(){return/iPhone|iPad|iPod/i.test(lt())||$t()}function Ut(){return/Android/i.test(lt())}function Vt(){return Bt()||Ut()}class q{constructor(t){this.config=t}config;log(t,e,i={}){const o=this.config.traceProvider?.()??{},s={timestamp:Dt(Ft()),level:t,msg:e,service:this.config.service,...o,...Pt(i)};zt(s,this.config.isDev)}debug(t,e){this.config.isDev&&this.log("debug",t,e)}info(t,e){this.log("info",t,e)}warn(t,e){this.log("warn",t,e)}error(t,e){this.log("error",t,e)}with(t){const e=new q(this.config);return e.log=((i,o,s={})=>{this.log(i,o,{...t,...s})}).bind(this),e}}function ct(n,t){const e=t?.isDev!==void 0?t.isDev:typeof process<"u"?process.env.NODE_ENV!=="production":!0;return new q({service:n,isDev:e,traceProvider:t?.traceProvider})}function O(n){if(n!==void 0)return typeof n=="object"&&n!==null&&!Array.isArray(n)&&!(n instanceof Error)?n:n instanceof Error?{error:n.message}:{value:n}}function ut(n){return{debug:(t,e)=>n.debug(t,O(e)),info:(t,e)=>n.info(t,O(e)),warn:(t,e)=>n.warn(t,O(e)),error:(t,e)=>n.error(t,O(e))}}let dt=!1;exports.logger=ut(ct("client",{isDev:!1}));function ht(){dt=!0,exports.logger=ut(ct("client",{isDev:!0}))}function jt(){return dt}class Ht{ready=!1;onReady;constructor(t){this.onReady=t}handleMappingReceived(){this.ready||(this.ready=!0,exports.logger.info("Mapping received from server, client is now ready"),this.onReady?.())}get isReady(){return this.ready}clear(){this.ready=!1}}const c={HANDSHAKE:"handshake",MUTATION:"mutation",STATE:"state",LOADING_INDICATOR:"loading_indicator",CAMERA:"camera",SNAPSHOT:"snapshot",MAPPING:"mapping",AR_ACTIVATE:"ar_activate",CONFIG:"config",ANNOTATION_PLACE_MODE:"annotation_place_mode",ANNOTATION_PLACED:"annotation_placed",ANNOTATION_TOGGLE:"annotation_toggle",FOCUS:"focus",PRICING:"pricing"},Y={FOCUS:"focus",UNFOCUS:"unfocus"},Gt={FOCUSED:"focused"},qt={HIDDEN:"hidden"},Zt=new Set(Object.values(c));function Wt(n){if(typeof n!="object"||n===null)return!1;const t=n;return typeof t.target=="string"?!1:typeof t.type=="string"&&Zt.has(t.type)}function Yt(n){const t=k(n);return t!==null&&t.type===c.HANDSHAKE}function Xt(n){const t=k(n);return t!==null&&t.type===c.MUTATION&&Array.isArray(t.results)}function Kt(n){const t=k(n);return t!==null&&t.type===c.SNAPSHOT&&("data"in t||"error"in t)}function Qt(n){const t=k(n);return t!==null&&t.type===c.CAMERA&&Array.isArray(t.transforms)}function Jt(n){const t=k(n);return t!==null&&t.type===c.MAPPING&&Array.isArray(t.attributes)}function te(n){const t=k(n);return t!==null&&t.type===c.LOADING_INDICATOR&&typeof t.progress=="number"}function ee(n){const t=k(n);return t!==null&&t.type===c.CONFIG&&typeof t.viewerSettings=="object"}function ne(n){const t=k(n);return t!==null&&t.type===c.ANNOTATION_PLACED&&typeof t.position=="object"&&t.position!==null}function ie(n){const t=k(n);return t!==null&&t.type===c.FOCUS&&typeof t.state=="string"}function oe(n){const t=k(n);return t!==null&&t.type===c.PRICING&&typeof t.pricing=="object"&&t.pricing!==null}function k(n){return typeof n!="object"||n===null?null:n}class X{constructor(t){this.processor=t}processor;pending=[];isReady=!1;enqueue(t){if(this.isReady){this.processor(t);return}this.pending.push(t)}markReady(){if(this.isReady||(this.isReady=!0,this.pending.length===0))return;const t=[...this.pending];this.pending.length=0;for(const e of t)this.processor(e)}get ready(){return this.isReady}get pendingCount(){return this.pending.length}hasPending(t){return this.pending.some(e=>e.type===t)}clear(){this.pending.length=0}}class se{constructor(t,e){this.getTarget=t,this.sourceId=`vd-${Math.random().toString(36).slice(2,8)}`,this.targetOrigin=e?.targetOrigin??"*",this.publisher=new X(i=>this.post(i)),this.consumer=new X(i=>this.routeToHandler(i)),this.shouldBuffer=e?.shouldBuffer??null,e?.bufferIncoming!==!0&&this.consumer.markReady()}getTarget;handlers=new Map;publisher;consumer;shouldBuffer;listener=null;sourceId;targetOrigin;on(t,e){this.handlers.set(t,e)}off(t){this.handlers.delete(t)}setTargetOrigin(t){this.targetOrigin=t}send(t){this.publisher.enqueue(t)}markReady(){this.publisher.markReady()}markConsumerReady(){this.consumer.markReady()}consumerHasPending(t){return this.consumer.hasPending(t)}start(){this.listener===null&&(this.listener=t=>{const{data:e}=t;if(!Wt(e)||e._source===this.sourceId)return;const i=this.getTarget();if(i!==null&&t.source!==null&&t.source!==i)return;const o=e;if(this.shouldBuffer!==null&&!this.shouldBuffer(o)){this.routeToHandler(o);return}this.consumer.enqueue(o)},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(t){const e=this.getTarget();e!==null&&e.postMessage({...t,_source:this.sourceId},this.targetOrigin)}routeToHandler(t){const e=this.handlers.get(t.type);if(e===void 0)return;const i=e(t);i instanceof Promise&&i.catch(o=>{const s=o instanceof Error?o.message:String(o);console.error(`Virtualdisplay: error handling ${t.type}: ${s}`)})}}class mt{constructor(t){this.send=t}send;placedCallbacks=[];setEnabled(t){this.send({type:c.ANNOTATION_TOGGLE,enabled:t})}startPlacing(){this.send({type:c.ANNOTATION_PLACE_MODE,enabled:!0})}stopPlacing(){this.send({type:c.ANNOTATION_PLACE_MODE,enabled:!1})}onPlaced(t){this.placedCallbacks.push(t)}handlePlaced(t){for(const e of this.placedCallbacks)e(t)}}class pt{constructor(t,e){this.value=t,this.attribute=e}value;attribute;isSelectedValue=!1;get isSelected(){return this.isSelectedValue}setSelected(t){this.isSelectedValue=t}}class ft{name;defaultValue;values;onSelect;onChangeCallback;constructor(t){this.name=t.name,this.defaultValue=t.defaultValue,this.onSelect=t.onSelect,this.values=this.createValues(t.values)}select(t){if(!this.values.has(t))throw f.valueNotFound(this.name,t);this.onSelect(this.name,t)}getValues(){return Array.from(this.values.values())}getValue(t){return this.values.get(t)}get selected(){for(const t of this.values.values())if(t.isSelected)return t.value}onChange(t){this.onChangeCallback=t}handleResult(t){let e;for(const i of this.values.values()){const o=i.value===t;i.setSelected(o),o&&(e=i)}e!==void 0&&this.onChangeCallback!==void 0&&this.onChangeCallback(e)}createValues(t){const e=new Map;for(const i of t){const o=new pt(i,this.name);i===this.defaultValue&&o.setSelected(!0),e.set(i,o)}return e}}class re{attributes=new Map;constructor(t,e,i){for(const o of t){const s=this.buildOptions(o,e);this.attributes.set(o.name,new ft(s))}this.onMutationFailed=i}onMutationFailed;get(t){return this.attributes.get(t)}getSelection(){const t={};for(const[e,i]of this.attributes){const o=i.selected;o!==void 0&&(t[e]=o)}return t}handleResults(t){for(const e of t){if(!e.success){this.onMutationFailed?.(e.name,e.value);continue}this.get(e.name)?.handleResult(e.value)}}buildOptions(t,e){const i={name:t.name,values:t.values,onSelect:(o,s)=>{e([{name:o,value:s}],!1)}};return t.defaultValue!==void 0?{...i,defaultValue:t.defaultValue}:i}}class ae{constructor(t,e){this.send=t,this.onMutationFailed=e}send;onMutationFailed;registry;pendingCallbacks=[];handleMappingReceived(t){exports.logger.debug("Initializing from server mapping",{attributeCount:t.attributes.length}),this.registry=new re(t.attributes,(e,i)=>this.sendMutation(e,i),this.onMutationFailed),this.replayPendingCallbacks()}handleMutationResult(t){this.registry?.handleResults(t.results)}select(t,e){this.sendMutation([{name:t,value:e}],!1)}getValues(t){return this.registry?.get(t)?.getValues()??[]}getValue(t,e){return this.registry?.get(t)?.getValue(e)}onChange(t,e){if(this.registry===void 0){this.pendingCallbacks.push({name:t,callback:e});return}const i=this.registry.get(t);if(i===void 0){exports.logger.warn(`onChange: attribute "${t}" not found — callback will not fire`);return}i.onChange(e)}getAttribute(t){return this.registry?.get(t)}getSelection(){return this.registry?.getSelection()??{}}get hasMapping(){return this.registry!==void 0}sendMutation(t,e){const i={type:c.MUTATION,mutations:t,isInitial:e};this.send(i)}replayPendingCallbacks(){for(const{name:t,callback:e}of this.pendingCallbacks){const i=this.registry?.get(t);i===void 0&&exports.logger.warn(`onChange: attribute "${t}" not found — buffered callback will not fire`),i?.onChange(e)}this.pendingCallbacks.length=0}}let gt=class{constructor(t){this.send=t}send;commands=[];rotate(t){return this.validateFiniteNumber(t,"rotate"),this.commands.push({action:"rotate",value:t}),this}tilt(t){return this.validateFiniteNumber(t,"tilt"),this.commands.push({action:"tilt",value:t}),this}zoom(t){return this.validateFiniteNumber(t,"zoom"),this.commands.push({action:"zoom",value:t}),this}set(){if(this.commands.length===0)throw f.invalidParameter("No camera commands to execute. Call rotate(), tilt(), or zoom() before set().");const t={type:c.CAMERA,commands:this.commands};this.send(t),this.commands=[]}validateFiniteNumber(t,e){if(!Number.isFinite(t))throw f.invalidParameter(`${e}() requires a finite number, got ${String(t)}`)}reset(){const t={type:c.CAMERA,commands:[{action:"reset"}]};this.send(t)}};class le{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(t){this.changeCallbacks.push(t)}get limits(){return this.limitsState}applyLimits(t){this.limitsState=t;const e={rotation:this.rotation,tilt:this.tilt,zoom:this.zoom};for(const i of this.changeCallbacks)i(e)}handlePositionUpdate(t){this.update(t.transforms)}update(t){let e=!1;for(const i of t)switch(i.type){case"rotation":this.state.rotation=i.value,e=!0;break;case"tilt":this.state.tilt=i.value,e=!0;break;case"zoom":this.state.zoom=i.value,e=!0;break}if(e){const i={rotation:this.rotation,tilt:this.tilt,zoom:this.zoom};for(const o of this.changeCallbacks)o(i)}}}const T={SELECT:"ui:select",SELECTED:"ui:selected",FOCUS_CHANGE:"vd:focus-change",CONFIGURATION_CHANGE:"vd:configuration-change",CONFIGURATION_SUBMIT:"vd:configuration-submit"};class bt{constructor(t,e){this.send=t,this.dispatch=e}send;dispatch;focused=null;attributes=[];changeCallbacks=[];get current(){return this.focused}set(t){if(typeof t!="string"||t.length===0)throw f.invalidParameter(`set() requires a non-empty component name, got ${String(t)}`);this.send({type:c.FOCUS,action:Y.FOCUS,component:t})}clear(){this.send({type:c.FOCUS,action:Y.UNFOCUS})}onChange(t){this.changeCallbacks.push(t)}handleStateReceived(t){t.state===Gt.FOCUSED&&t.component!==void 0?(this.focused=t.component,this.attributes=t.attributes??[]):(this.focused=null,this.attributes=[]);const e=this.focused!==null?{component:this.focused,attributes:this.attributes}:null;for(const i of this.changeCallbacks)i(e);this.dispatch(e)}}function ce(n,t){const e=n.filter(s=>ue(s,t));if(e.length===0)return;const i=Math.max(...e.map(K)),o=e.filter(s=>K(s)===i);return o.length===1?o[0]:void 0}function ue(n,t){return Object.entries(n.attributes).every(([e,i])=>t[e]===i)}function K(n){return Object.keys(n.attributes).length}class vt{constructor(t,e){this.dispatchChange=t,this.dispatchSubmit=e}dispatchChange;dispatchSubmit;pricing;selection={};resolved;changeCallbacks=[];renderCallbacks=[];submitCallback;submitDefaultLabel;get current(){return this.resolved}get vatDisplay(){return this.pricing?.vatDisplay}get buttonLabel(){const t=this.pricing?.buttonLabel;if(t!=null&&t!=="")return t;if(this.submitDefaultLabel!==void 0&&this.submitDefaultLabel!=="")return this.submitDefaultLabel}get submittable(){return this.submitCallback===void 0?!1:this.pricing===void 0?!0:this.resolved?.availability==="available"}get submitEnabled(){return this.submittable&&this.buttonLabel!==void 0}onChange(t){this.changeCallbacks.push(t)}onSubmit(t,e){this.submitCallback=t,this.submitDefaultLabel=e?.defaultLabel,this.notifyRender()}onRender(t){return this.renderCallbacks.push(t),()=>{const e=this.renderCallbacks.indexOf(t);e!==-1&&this.renderCallbacks.splice(e,1)}}async submit(){if(!this.submittable)return;const t=this.resolved!==void 0?{attributes:this.resolved.attributes,reference:this.resolved.reference}:{attributes:{...this.selection},reference:""};this.dispatchSubmit(t),await this.submitCallback?.(t)}handlePricingReceived(t){this.pricing=t,this.recompute()}handleSelectionChanged(t){this.selection=t,this.recompute()}recompute(){this.resolved=this.resolve();for(const t of this.changeCallbacks)t(this.resolved);this.dispatchChange(this.resolved),this.notifyRender()}notifyRender(){for(const t of this.renderCallbacks)t()}resolve(){if(this.pricing===void 0)return;const t=ce(this.pricing.rules,this.selection);if(!(t===void 0||t.availability===qt.HIDDEN))return{attributes:{...this.selection},reference:t.reference,price:t.priceCents,currency:this.pricing.currency,availability:t.availability}}}class yt{constructor(t){this.filename=t}filename;developedCallbacks=new Set;errorCallbacks=new Set;developed=!1;failed=!1;photoData=null;onDeveloped(t){return this.developed&&this.photoData!==null?(t(this.photoData),this):(this.developedCallbacks.add(t),this)}onError(t){return this.errorCallbacks.add(t),this}getFilename(){return this.filename}develop(t){this.developed||this.failed||(this.photoData=t,this.developed=!0,this.developedCallbacks.forEach(e=>{e(this.photoData)}),this.developedCallbacks.clear(),this.errorCallbacks.clear())}fail(t){this.developed||this.failed||(this.failed=!0,this.errorCallbacks.forEach(e=>{e(t)}),this.developedCallbacks.clear(),this.errorCallbacks.clear())}}class _t{constructor(t){this.send=t}send;validExtensions=[".png"];pendingPhotos=new Map;take(t){this.validateFilename(t),exports.logger.debug("Taking snapshot",{filename:t});const e=new yt(t);return this.pendingPhotos.set(e.getFilename(),e),this.send({type:c.SNAPSHOT,filename:t}),e}handleSnapshotResult(t){const e=this.pendingPhotos.get(t.filename);if(e===void 0){exports.logger.warn("No pending photo found for filename",{filename:t.filename,pendingFilenames:Array.from(this.pendingPhotos.keys())});return}if(this.pendingPhotos.delete(t.filename),t.error!==void 0){e.fail(new f(t.error,_.SNAPSHOT_FAILED));return}t.data!==void 0&&e.develop({filename:t.filename,data:t.data})}clear(){if(this.pendingPhotos.size===0)return;const t=new f("Client destroyed before snapshot completed",_.SNAPSHOT_FAILED);for(const e of this.pendingPhotos.values())e.fail(t);this.pendingPhotos.clear()}validateFilename(t){if(t===""||typeof t!="string")throw new f("Filename must be a non-empty string",_.INVALID_PARAMETER);if(!this.validExtensions.some(i=>t.toLowerCase().endsWith(i)))throw new f(`Invalid filename: "${t}". Filename must end with one of: ${this.validExtensions.join(", ")}`,_.INVALID_PARAMETER);if(t.includes("..")||t.includes("/")||t.includes("\\"))throw new f('Filename cannot contain path separators or ".."',_.INVALID_PARAMETER)}}class de{container=null;attach(t){this.container=t}dispatch(t,e,i=!1){const o=new CustomEvent(t,{detail:e,cancelable:i});return this.container?.dispatchEvent(o),o}on(t,e){const i=o=>{const s=o,r={...s.detail,preventDefault:()=>{s.preventDefault()}};e(r)};return this.container?.addEventListener(t,i),()=>{this.container?.removeEventListener(t,i)}}}const he={},me="en",Ct=["en","nl","de"],Z=["baseLocale"],Q=[];let J,tt;function pe(n){if(Q.length===0)return;const t=typeof n=="string"?n:n.href;if(J===t)return tt;const e=new URL(t,"http://dummy.com");let i;for(const o of Q)if(new he(o.match,e.href).exec(e.href)){i=o;break}return J=t,tt=i,i}function wt(n){const t=pe(n);return t&&t.exclude!==!0&&Array.isArray(t.strategy)?t.strategy:Z}const G=typeof window>"u";globalThis.__paraglide=globalThis.__paraglide??{};globalThis.__paraglide.ssr=globalThis.__paraglide.ssr??{};let et=!1,h=()=>{let n=Z;!G&&typeof window<"u"&&window.location?.href&&(n=wt(window.location.href));const t=fe(n);if(t)return et||(et=!0,kt(t,{reload:!1})),t;throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found")};function fe(n,t){let e;for(const i of n){if(i==="baseLocale")e=me;else if(At(i)&&N.has(i)){const s=N.get(i);if(s){const r=s.getLocale();if(r instanceof Promise)continue;if(r!==void 0)return be(r)}}const o=St(e);if(o)return o}}const ge=n=>{window.location.reload()};let kt=(n,t)=>{const e={reload:!0,...t};let i;try{i=h()}catch{}const o=[];let s=Z;!G&&typeof window<"u"&&window.location?.href&&(s=wt(window.location.href));for(const l of s)if(l!=="baseLocale"&&At(l)&&N.has(l)){const d=N.get(l);if(d){let u=d.setLocale(n);u instanceof Promise&&(u=u.catch(p=>{throw new Error(`Custom strategy "${l}" setLocale failed.`,{cause:p})}),o.push(u))}}const r=()=>{!G&&e.reload&&window.location&&n!==i&&ge()};if(o.length)return Promise.all(o).then(()=>{r()});r()};function St(n){if(typeof n!="string")return;const t=n.toLowerCase();for(const e of Ct)if(e.toLowerCase()===t)return e}function be(n){const t=St(n);if(t)return t;throw new Error(`Invalid locale: ${n}. Expected one of: ${Ct.join(", ")}`)}const N=new Map;function At(n){return typeof n=="string"&&/^custom-[A-Za-z0-9_-]+$/.test(n)}const ve=()=>"Activate AR",ye=()=>"AR activeren",_e=()=>"AR aktivieren",Ce=((n={},t={})=>{const e=t.locale??h();return e==="en"?ve():e==="nl"?ye():_e()}),we=()=>"Scan to view in AR",ke=()=>"Scan om in AR te bekijken",Se=()=>"Scannen für AR-Ansicht",Ae=((n={},t={})=>{const e=t.locale??h();return e==="en"?we():e==="nl"?ke():Se()}),Ee=()=>"Use your smartphone camera to scan this QR code",xe=()=>"Gebruik de camera van je smartphone om deze QR-code te scannen",Te=()=>"Verwenden Sie die Kamera Ihres Smartphones, um diesen QR-Code zu scannen",Re=((n={},t={})=>{const e=t.locale??h();return e==="en"?Ee():e==="nl"?xe():Te()}),Oe=()=>"Your phone will open the 3D model in AR mode.",Ne=()=>"Je telefoon opent het 3D-model in AR-modus.",Ie=()=>"Das 3D-Modell wird im AR-Modus Ihres Telefons geöffnet",Le=((n={},t={})=>{const e=t.locale??h();return e==="en"?Oe():e==="nl"?Ne():Ie()}),Me=()=>"Close",ze=()=>"Sluiten",Pe=()=>"Schließen",Fe=((n={},t={})=>{const e=t.locale??h();return e==="en"?Me():e==="nl"?ze():Pe()}),De=()=>"Fullscreen",$e=()=>"Volledig scherm",Be=()=>"Vollbild",Ue=((n={},t={})=>{const e=t.locale??h();return e==="en"?De():e==="nl"?$e():Be()}),Ve=()=>"Downloading",je=()=>"Downloaden",He=()=>"Herunterladen",Et=((n={},t={})=>{const e=t.locale??h();return e==="en"?Ve():e==="nl"?je():He()}),Ge=()=>"Rendering",qe=()=>"Renderen",Ze=()=>"Rendern",We=((n={},t={})=>{const e=t.locale??h();return e==="en"?Ge():e==="nl"?qe():Ze()}),Ye=()=>"Screenshot",Xe=()=>"Screenshot",Ke=()=>"Screenshot",Qe=((n={},t={})=>{const e=t.locale??h();return e==="en"?Ye():e==="nl"?Xe():Ke()}),Je=()=>"Configure",tn=()=>"Configureer",en=()=>"Konfigurieren",nn=((n={},t={})=>{const e=t.locale??h();return e==="en"?Je():e==="nl"?tn():en()}),on=()=>"Close",sn=()=>"Sluiten",rn=()=>"Schließen",an=((n={},t={})=>{const e=t.locale??h();return e==="en"?on():e==="nl"?sn():rn()}),ln=()=>"Reset camera",cn=()=>"Camera resetten",un=()=>"Kamera zurücksetzen",dn=((n={},t={})=>{const e=t.locale??h();return e==="en"?ln():e==="nl"?cn():un()}),hn=()=>"Zoom in",mn=()=>"Inzoomen",pn=()=>"Hineinzoomen",fn=((n={},t={})=>{const e=t.locale??h();return e==="en"?hn():e==="nl"?mn():pn()}),gn=()=>"Zoom out",bn=()=>"Uitzoomen",vn=()=>"Herauszoomen",yn=((n={},t={})=>{const e=t.locale??h();return e==="en"?gn():e==="nl"?bn():vn()}),_n=()=>"Rotate left",Cn=()=>"Naar links draaien",wn=()=>"Nach links drehen",kn=((n={},t={})=>{const e=t.locale??h();return e==="en"?_n():e==="nl"?Cn():wn()}),Sn=()=>"Rotate right",An=()=>"Naar rechts draaien",En=()=>"Nach rechts drehen",xn=((n={},t={})=>{const e=t.locale??h();return e==="en"?Sn():e==="nl"?An():En()}),Tn=()=>"Tilt up",Rn=()=>"Omhoog kantelen",On=()=>"Nach oben kippen",Nn=((n={},t={})=>{const e=t.locale??h();return e==="en"?Tn():e==="nl"?Rn():On()}),In=()=>"Tilt down",Ln=()=>"Omlaag kantelen",Mn=()=>"Nach unten kippen",zn=((n={},t={})=>{const e=t.locale??h();return e==="en"?In():e==="nl"?Ln():Mn()}),Pn=()=>"Working…",Fn=()=>"Bezig…",Dn=()=>"Läuft…",$n=((n={},t={})=>{const e=t.locale??h();return e==="en"?Pn():e==="nl"?Fn():Dn()}),Bn=()=>"Done",Un=()=>"Gelukt",Vn=()=>"Fertig",jn=((n={},t={})=>{const e=t.locale??h();return e==="en"?Bn():e==="nl"?Un():Vn()}),Hn=()=>"Failed",Gn=()=>"Mislukt",qn=()=>"Fehlgeschlagen",Zn=((n={},t={})=>{const e=t.locale??h();return e==="en"?Hn():e==="nl"?Gn():qn()});const Wn={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"};const xt=([n,t,e])=>{const i=document.createElementNS("http://www.w3.org/2000/svg",n);return Object.keys(t).forEach(o=>{i.setAttribute(o,String(t[o]))}),e?.length&&e.forEach(o=>{const s=xt(o);i.appendChild(s)}),i},Tt=(n,t={})=>{const i={...Wn,...t};return xt(["svg",i,n])};const Yn=[["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"}]];const Xn=[["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"}]];const Rt=[["path",{d:"m6 9 6 6 6-6"}]];const Kn=[["path",{d:"m15 18-6-6 6-6"}]];const Qn=[["path",{d:"m9 18 6-6-6-6"}]];const Jn=[["path",{d:"m18 15-6-6-6 6"}]];const ti=[["path",{d:"M15 3h6v6"}],["path",{d:"m21 3-7 7"}],["path",{d:"m3 21 7-7"}],["path",{d:"M9 21H3v-6"}]];const ei=[["path",{d:"m14 10 7-7"}],["path",{d:"M20 10h-6V4"}],["path",{d:"m3 21 7-7"}],["path",{d:"M4 14h6v6"}]];const ni=[["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"}]];const ii=[["path",{d:"M10 5H3"}],["path",{d:"M12 19H3"}],["path",{d:"M14 3v4"}],["path",{d:"M16 17v4"}],["path",{d:"M21 12h-9"}],["path",{d:"M21 19h-5"}],["path",{d:"M21 5h-7"}],["path",{d:"M8 10v4"}],["path",{d:"M8 12H3"}]];const oi=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];const si=[["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"}]];const ri=[["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 y(n,{size:t=20,strokeWidth:e=1.75}={}){return Tt(n,{width:t,height:t,"stroke-width":e})}const g={ar:n=>y(Yn,n),fullscreen:n=>y(ti,n),exitFullscreen:n=>y(ei,n),screenshot:n=>y(Xn,n),tiltUp:n=>y(Jn,n),tiltDown:n=>y(Rt,n),rotateLeft:n=>y(Kn,n),rotateRight:n=>y(Qn,n),zoomIn:n=>y(si,n),zoomOut:n=>y(ri,n),reset:n=>y(ni,n),configurator:n=>y(ii,n),close:n=>y(oi,n)};class b{element;constructor({variant:t="default",size:e="default",label:i,icon:o,onClick:s,disabled:r=!1}={}){this.element=document.createElement("button"),this.element.className=`ui-btn ui-btn--${t} ui-btn--size-${e}`,i!==void 0&&(this.element.setAttribute("aria-label",i),this.element.title=i),o!==void 0?this.element.appendChild(o):i!==void 0&&(this.element.textContent=i),s&&this.element.addEventListener("click",s),this.element.disabled=r}setIcon(t){const e=this.element.querySelector("svg");e!==null?e.replaceWith(t):this.element.appendChild(t)}}const m={semantic:{error:"#dc2626"},neutral:{500:"#737373",600:"#525252",900:"#171717"},white:"#ffffff",black:"#000000"},a={0:"0",.5:"0.125rem",1:"0.25rem",1.5:"0.375rem",2:"0.5rem",3:"0.75rem",4:"1rem",5:"1.25rem",6:"1.5rem",8:"2rem",9:"2.25rem",24:"6rem"};class ai{element;constructor(){this.element=document.createElement("div"),Object.assign(this.element.style,{background:m.white,borderRadius:a[3],padding:a[6],boxShadow:`0 ${a[2]} ${a[8]} oklch(0% 0 0 / 20%)`,maxWidth:"20rem",width:"100%"})}}class li{constructor(t={}){this.options=t,this.card=new ai,this.backdrop=this.createBackdrop(),this.backdrop.appendChild(this.card.element)}options;card;backdrop;keyHandler=null;open(){document.body.appendChild(this.backdrop),this.keyHandler=t=>{t.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(){const t=document.createElement("div");return Object.assign(t.style,{position:"fixed",inset:a[0],background:"oklch(0% 0 0 / 50%)",zIndex:"9999",display:"flex",alignItems:"center",justifyContent:"center"}),t.addEventListener("click",e=>{e.target===t&&this.close()}),t}}class ci{element;selectCallback=null;constructor(t,e,i){this.element=document.createElement("div"),this.element.className="ui-toggle-group";for(let o=0;o<t.length;o++){const s=t[o],r=document.createElement("button");r.className="ui-toggle-group-item",r.dataset.value=s,r.textContent=i?.[o]??s,r.dataset.state=s===e?"on":"off",r.setAttribute("aria-pressed",s===e?"true":"false"),r.addEventListener("click",()=>{this.selectCallback?.(s)}),this.element.appendChild(r)}}setSelected(t){for(const e of this.element.querySelectorAll(".ui-toggle-group-item")){const i=e.dataset.value===t;e.dataset.state=i?"on":"off",e.setAttribute("aria-pressed",i?"true":"false")}}onSelect(t){this.selectCallback=t}}class ui{element;select;constructor(t,e,i,o,s){this.select=document.createElement("select"),this.select.className="ui-native-select",this.select.dataset.name=t,this.select.setAttribute("aria-label",i);const r=document.createElement("option");r.value="",r.disabled=!0,r.textContent=i,this.select.appendChild(r);let l=!1;for(let u=0;u<e.length;u++){const p=e[u],v=document.createElement("option");v.value=p,v.textContent=s?.[u]??p,p===o&&(v.selected=!0,l=!0),this.select.appendChild(v)}l||(r.selected=!0);const d=Tt(Rt,{width:16,height:16,"stroke-width":2});d.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(d)}setSelected(t){this.select.value=t}onSelect(t){this.select.addEventListener("change",()=>{t(this.select.value)})}}const C={fontFamily:{sans:["Mona Sans","ui-sans-serif","system-ui","sans-serif","Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"]},fontSize:{xs:"0.75rem",sm:"0.875rem",base:"1rem",lg:"1.125rem"},fontWeight:{medium:"500",semibold:"600"}},di=C.fontFamily.sans.join(", ");class hi{qrLib=null;dialog=null;async show(t){this.hide(),this.qrLib??=await Promise.resolve().then(()=>require("./browser-DfB_An57.cjs")).then(o=>o.browser);const e=await this.qrLib.toDataURL(t,{width:256,margin:4,errorCorrectionLevel:"M",color:{dark:m.black,light:m.white}});this.dialog=new li({onClose:()=>{this.dialog=null}}),Object.assign(this.dialog.card.element.style,{display:"flex",flexDirection:"column",alignItems:"center",gap:a[3],fontFamily:di}),this.dialog.card.element.appendChild(this.createText(Ae(),{fontSize:C.fontSize.base,fontWeight:C.fontWeight.semibold,color:m.neutral[900]})),this.dialog.card.element.appendChild(this.createText(Re(),{fontSize:C.fontSize.sm,color:m.neutral[600]})),this.dialog.card.element.appendChild(this.createQrImage(e)),this.dialog.card.element.appendChild(this.createText(Le(),{fontSize:C.fontSize.xs,color:m.neutral[500]}));const i=new b({variant:"outline",label:Fe(),onClick:()=>{this.hide()}});this.dialog.card.element.appendChild(i.element),this.dialog.open()}hide(){this.dialog?.close(),this.dialog=null}createText(t,e){const i=document.createElement("p");return i.textContent=t,Object.assign(i.style,{margin:"0",textAlign:"center",...e}),i}createQrImage(t){const e=document.createElement("img");return e.src=t,e.alt="QR code",Object.assign(e.style,{width:a[24],height:a[24],borderRadius:a[1]}),e}}const E=C.fontFamily.sans.join(", "),mi=`
|
|
3
2
|
--primary: oklch(5% 0 0);
|
|
4
3
|
--primary-foreground: oklch(100% 0 0);
|
|
5
4
|
--secondary: oklch(92% 0 0);
|
|
@@ -12,7 +11,8 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
12
11
|
--accent: oklch(92% 0 0);
|
|
13
12
|
--accent-foreground: oklch(5% 0 0);
|
|
14
13
|
--muted-foreground: oklch(44% 0 0);
|
|
15
|
-
|
|
14
|
+
`,pi=`
|
|
15
|
+
:root { ${mi} }
|
|
16
16
|
|
|
17
17
|
/* ── Button ──────────────────────────────────────────────── */
|
|
18
18
|
.ui-btn {
|
|
@@ -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: ${
|
|
25
|
+
font-family: ${E};
|
|
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: ${
|
|
82
|
+
font-family: ${E};
|
|
83
83
|
font-size: 0.875rem;
|
|
84
84
|
font-weight: 600;
|
|
85
85
|
cursor: pointer;
|
|
@@ -89,6 +89,11 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
89
89
|
}
|
|
90
90
|
.ui-toggle-group-item:hover { background: var(--accent); border-color: oklch(85% 0 0); }
|
|
91
91
|
.ui-toggle-group-item:active { transform: scale(0.98); }
|
|
92
|
+
.ui-toggle-group-item:focus-visible {
|
|
93
|
+
outline: none;
|
|
94
|
+
border-color: var(--ring);
|
|
95
|
+
box-shadow: 0 0 0 3px oklch(5% 0 0 / 12%);
|
|
96
|
+
}
|
|
92
97
|
.ui-toggle-group-item[data-state="on"] {
|
|
93
98
|
background: var(--primary);
|
|
94
99
|
color: var(--primary-foreground);
|
|
@@ -113,7 +118,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
113
118
|
background: var(--background);
|
|
114
119
|
appearance: none;
|
|
115
120
|
color: var(--foreground);
|
|
116
|
-
font-family: ${
|
|
121
|
+
font-family: ${E};
|
|
117
122
|
font-size: 0.875rem;
|
|
118
123
|
font-weight: 400;
|
|
119
124
|
cursor: pointer;
|
|
@@ -147,6 +152,10 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
147
152
|
overflow: visible !important; /* override CSS2DRenderer inline style */
|
|
148
153
|
}
|
|
149
154
|
|
|
155
|
+
.vd-annotation-anchor {
|
|
156
|
+
position: relative;
|
|
157
|
+
}
|
|
158
|
+
|
|
150
159
|
.vd-annotation-marker {
|
|
151
160
|
display: flex;
|
|
152
161
|
align-items: center;
|
|
@@ -157,7 +166,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
157
166
|
border: 2px solid oklch(100% 0 0);
|
|
158
167
|
background: var(--primary);
|
|
159
168
|
color: var(--primary-foreground);
|
|
160
|
-
font-family: ${
|
|
169
|
+
font-family: ${E};
|
|
161
170
|
font-size: 0.8125rem;
|
|
162
171
|
font-weight: 600;
|
|
163
172
|
cursor: pointer;
|
|
@@ -167,6 +176,10 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
167
176
|
position: relative;
|
|
168
177
|
}
|
|
169
178
|
.vd-annotation-marker:hover { transform: scale(1.1); }
|
|
179
|
+
.vd-annotation-marker:focus-visible {
|
|
180
|
+
outline: 2px solid var(--ring);
|
|
181
|
+
outline-offset: 2px;
|
|
182
|
+
}
|
|
170
183
|
|
|
171
184
|
.vd-annotation-popup {
|
|
172
185
|
position: absolute;
|
|
@@ -183,6 +196,37 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
183
196
|
pointer-events: auto;
|
|
184
197
|
white-space: normal;
|
|
185
198
|
}
|
|
199
|
+
.vd-annotation-popup:focus { outline: none; }
|
|
200
|
+
|
|
201
|
+
.vd-annotation-popup-close {
|
|
202
|
+
position: absolute;
|
|
203
|
+
inset-block-start: 0.375rem;
|
|
204
|
+
inset-inline-end: 0.375rem;
|
|
205
|
+
display: flex;
|
|
206
|
+
align-items: center;
|
|
207
|
+
justify-content: center;
|
|
208
|
+
inline-size: 1.25rem;
|
|
209
|
+
block-size: 1.25rem;
|
|
210
|
+
padding: 0;
|
|
211
|
+
border: none;
|
|
212
|
+
border-radius: calc(var(--radius) - 4px);
|
|
213
|
+
background: transparent;
|
|
214
|
+
color: var(--muted-foreground);
|
|
215
|
+
cursor: pointer;
|
|
216
|
+
pointer-events: auto;
|
|
217
|
+
}
|
|
218
|
+
.vd-annotation-popup-close:hover {
|
|
219
|
+
color: var(--foreground);
|
|
220
|
+
background: var(--secondary);
|
|
221
|
+
}
|
|
222
|
+
.vd-annotation-popup-close:focus-visible {
|
|
223
|
+
outline: 2px solid var(--ring);
|
|
224
|
+
outline-offset: 1px;
|
|
225
|
+
}
|
|
226
|
+
.vd-annotation-popup-close svg {
|
|
227
|
+
inline-size: 0.875rem;
|
|
228
|
+
block-size: 0.875rem;
|
|
229
|
+
}
|
|
186
230
|
|
|
187
231
|
@media (prefers-reduced-motion: no-preference) {
|
|
188
232
|
.vd-annotation-popup {
|
|
@@ -196,25 +240,28 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
196
240
|
}
|
|
197
241
|
|
|
198
242
|
.vd-annotation-popup-title {
|
|
199
|
-
font-family: ${
|
|
243
|
+
font-family: ${E};
|
|
200
244
|
font-size: 0.875rem;
|
|
201
245
|
font-weight: 600;
|
|
202
246
|
line-height: 1.25rem;
|
|
247
|
+
/* Keep the title clear of the absolutely positioned close button. */
|
|
248
|
+
padding-inline-end: 1.5rem;
|
|
203
249
|
}
|
|
204
250
|
|
|
205
251
|
.vd-annotation-popup-description {
|
|
206
|
-
font-family: ${
|
|
252
|
+
font-family: ${E};
|
|
207
253
|
font-size: 0.8125rem;
|
|
208
254
|
font-weight: 400;
|
|
209
255
|
line-height: 1.125rem;
|
|
210
256
|
color: var(--muted-foreground);
|
|
211
257
|
margin-block-start: 0.25rem;
|
|
212
258
|
}
|
|
213
|
-
`,un=!1;function dn(){if(un||typeof document>`u`)return;un=!0;let e=document.createElement(`style`);e.id=`vd-ui-vanilla`,e.textContent=ln,document.head.appendChild(e)}function fn(e){let t=Math.max(0,Math.min(1,e));return t*t*(3-2*t)}function pn(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 mn(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 hn(e,t,n,r,i){let a=t(n),o=t(r);mn(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],gn=[[U,W],[W,G],[G,K],[K,U],[U,q],[W,J],[G,Y],[K,X],[q,J],[J,Y],[Y,X],[X,q]],_n=400,vn=`-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif`;function yn(){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:vn});let i=document.createElement(`span`);return Object.assign(i.style,{fontSize:`13px`,color:`#000`,fontFamily:vn}),i.textContent=M(),n.appendChild(r),n.appendChild(i),e.appendChild(t),e.appendChild(n),{overlay:e,canvas:t,pctEl:r,phaseEl:i}}var bn=class{overlay;canvas;ctx;pctEl;phaseEl;animationId=null;showTimerId=null;startTime;hidden=!1;visible=!1;constructor(e,t={}){this.startTime=performance.now();let n=yn();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??_n;this.showTimerId=setTimeout(()=>{this.reveal()},r)}get loadingTexts(){return{downloading:M(),rendering:ft()}}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=>pn(e,.785,.615,r,i,a),s=n%6/6,c=gn.length,l;l=s<.35?fn(s/.35)*c:s<.55?c:s<.9?(1-fn((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=gn[e];if(t===void 0)continue;let n=Math.min(1,l-e);hn(this.ctx,o,t[0],t[1],n)}this.ctx.shadowBlur=0}},xn=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=()=>{this.setFullscreenIcon(document.fullscreenElement!==null)},document.addEventListener(`fullscreenchange`,this.onFullscreenChange)}setFullscreenIcon(e){this.fullscreenBtn!==null&&this.fullscreenBtn.setIcon(e?L.exitFullscreen():L.fullscreen())}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:ze(),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:at(),icon:L.fullscreen(),onClick:()=>{this.options.onFullscreen?.()}}))}destroy(){document.removeEventListener(`fullscreenchange`,this.onFullscreenChange)}},Z=.5,Sn=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=Cn(t,n,r);n.onChange(e=>{r.targetRotation=e.rotation-r.thetaOffset,r.targetTilt=e.tilt,r.targetZoom=e.zoom,wn(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 Cn(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:Ot(),icon:L.zoomOut(),onClick:()=>{n.targetZoom=r(n.targetZoom-10),e.zoom(n.targetZoom).set()}}),zoomIn:new R({variant:`outline`,size:`icon`,label:wt(),icon:L.zoomIn(),onClick:()=>{n.targetZoom=r(n.targetZoom+10),e.zoom(n.targetZoom).set()}}),tiltUp:new R({variant:`outline`,size:`icon`,label:Bt(),icon:L.tiltUp(),onClick:()=>{a(-15)}}),rotateLeft:new R({variant:`outline`,size:`icon`,label:Mt(),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:bt(),icon:L.reset(),onClick:()=>{n.thetaOffset=0,e.reset()}}),rotateRight:new R({variant:`outline`,size:`icon`,label:It(),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:Wt(),icon:L.tiltDown(),onClick:()=>{a(15)}})}}function wn(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 Tn=5;function Q(e){let t=e.replace(/([A-Z])/g,` $1`).trim();return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function En(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<=Tn?new an(e.values,s,c):new on(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 Dn=V.fontFamily.sans.join(`, `),$=`
|
|
259
|
+
`;let nt=!1;function fi(){if(nt||typeof document>"u")return;nt=!0;const n=document.createElement("style");n.id="vd-ui-vanilla",n.textContent=pi,document.head.appendChild(n)}function it(n){const t=Math.max(0,Math.min(1,n));return t*t*(3-2*t)}function gi(n,t,e,i,o,s){const[r,l,d]=n,u=Math.cos(t),p=Math.sin(t),v=u*r+p*d,A=-p*r+u*d,S=Math.cos(e),w=Math.sin(e),R=S*l-w*A,L=w*l+S*A,W=.55;return[i+v*s*W,o-R*s*W,L]}function bi(n,t,e){n.beginPath(),n.moveTo(t[0],t[1]),n.lineTo(e[0],e[1]),n.strokeStyle="#000",n.lineWidth=2,n.stroke()}function vi(n,t,e,i,o){const s=t(e),r=t(i),l=[s[0]+(r[0]-s[0])*o,s[1]+(r[1]-s[1])*o,s[2]];bi(n,s,l)}const M=[-1,-1,1],z=[1,-1,1],P=[1,-1,-1],F=[-1,-1,-1],D=[-1,1,1],$=[1,1,1],B=[1,1,-1],U=[-1,1,-1],ot=[[M,z],[z,P],[P,F],[F,M],[M,D],[z,$],[P,B],[F,U],[D,$],[$,B],[B,U],[U,D]],yi=400,st='-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif';function _i(){const n=document.createElement("div");Object.assign(n.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"});const t=document.createElement("canvas");Object.assign(t.style,{width:"100%",height:"100%",position:"absolute",inset:"0"});const e=document.createElement("div");Object.assign(e.style,{position:"absolute",top:"56%",left:"0",right:"0",textAlign:"center",pointerEvents:"none"});const i=document.createElement("span");Object.assign(i.style,{fontSize:"13px",fontWeight:"400",color:"#000",fontVariantNumeric:"tabular-nums",fontFamily:st});const o=document.createElement("span");return Object.assign(o.style,{fontSize:"13px",color:"#000",fontFamily:st}),o.textContent=Et(),e.appendChild(i),e.appendChild(o),n.appendChild(t),n.appendChild(e),{overlay:n,canvas:t,pctEl:i,phaseEl:o}}class Ci{overlay;canvas;ctx;pctEl;phaseEl;animationId=null;showTimerId=null;startTime;hidden=!1;visible=!1;constructor(t,e={}){this.startTime=performance.now();const i=_i();this.overlay=i.overlay,this.canvas=i.canvas,this.pctEl=i.pctEl,this.phaseEl=i.phaseEl,t.appendChild(this.overlay),this.ctx=this.canvas.getContext("2d"),this.ctx!==null&&(this.sizeCanvas(),this.tick());const o=e.showDelay??yi;this.showTimerId=setTimeout(()=>{this.reveal()},o)}get loadingTexts(){return{downloading:Et(),rendering:We()}}updateProgress(t,e){this.hidden||(this.pctEl.textContent=`${Math.round(t)}%`,this.phaseEl.textContent=e!==""?` · ${e}`:"")}showError(t){if(this.hidden=!1,this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null),this.ctx!==null){const e=Math.min(devicePixelRatio,2),i=this.canvas.width/e,o=this.canvas.height/e;this.ctx.fillStyle="#fff",this.ctx.fillRect(0,0,i*e,o*e)}this.pctEl.textContent="",this.phaseEl.textContent=t,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;const t=Math.min(devicePixelRatio,2),e=this.overlay.clientWidth||440,i=this.overlay.clientHeight||360;this.canvas.width=e*t,this.canvas.height=i*t,this.ctx.scale(t,t),this.ctx.lineCap="round",this.ctx.lineJoin="round"}tick=()=>{this.hidden||(this.drawFrame(),this.animationId=requestAnimationFrame(this.tick))};drawFrame(){if(this.ctx===null)return;const t=this.canvas.width/Math.min(devicePixelRatio,2),e=this.canvas.height/Math.min(devicePixelRatio,2),i=(performance.now()-this.startTime)/1e3;this.ctx.fillStyle="#fff",this.ctx.fillRect(0,0,t,e);const o=t/2,s=e*.44,r=Math.min(t,e)*.08,l=.785,d=.615,u=w=>gi(w,l,d,o,s,r),p=6,v=i%p/p,A=ot.length;let S;v<.35?S=it(v/.35)*A:v<.55?S=A:v<.9?S=(1-it((v-.55)/.35))*A:S=0,this.ctx.shadowBlur=5,this.ctx.shadowColor="rgba(30,30,30,0.08)";for(let w=0;w<A&&!(w>=S);w++){const R=ot[w];if(R===void 0)continue;const L=Math.min(1,S-w);vi(this.ctx,u,R[0],R[1],L)}this.ctx.shadowBlur=0}}class wi{constructor(t){this.options=t,this.element=document.createElement("div"),Object.assign(this.element.style,{display:"flex",gap:"0.375rem"}),this.onFullscreenChange=()=>{this.setFullscreenIcon(document.fullscreenElement!==null)},document.addEventListener("fullscreenchange",this.onFullscreenChange)}options;element;arBtn=null;fullscreenBtn=null;onFullscreenChange;setFullscreenIcon(t){this.fullscreenBtn!==null&&this.fullscreenBtn.setIcon(t?g.exitFullscreen():g.fullscreen())}syncButton(t,e,i){if(e&&t===null){const o=i();return this.element.appendChild(o.element),o}return!e&&t!==null?(t.element.remove(),null):t}applySettings(t){this.arBtn=this.syncButton(this.arBtn,t.ar!==!1&&this.options.onAr!==void 0,()=>new b({variant:"outline",size:"icon",label:Ce(),icon:g.ar(),onClick:()=>{this.options.onAr?.()}})),this.fullscreenBtn=this.syncButton(this.fullscreenBtn,t.fullscreen!==!1&&this.options.onFullscreen!==void 0,()=>new b({variant:"outline",size:"icon",label:Ue(),icon:g.fullscreen(),onClick:()=>{this.options.onFullscreen?.()}}))}destroy(){document.removeEventListener("fullscreenchange",this.onFullscreenChange)}}const x=.5;class I{element;constructor(t,e){this.element=Object.assign(document.createElement("div"),{className:"vd-camera-controls"});const i={targetRotation:e.rotation,targetTilt:e.tilt,targetZoom:e.zoom,thetaOffset:0},o=ki(t,e,i);e.onChange(s=>{i.targetRotation=s.rotation-i.thetaOffset,i.targetTilt=s.tilt,i.targetZoom=s.zoom,Si(o,e,s)}),this.element.appendChild(I.buildZoom(o.zoomOut,o.zoomIn)),this.element.appendChild(I.buildDpad(o.tiltUp,o.rotateLeft,o.reset,o.rotateRight,o.tiltDown))}static buildZoom(t,e){const i=document.createElement("div");return i.className="vd-zoom",i.appendChild(t.element),i.appendChild(e.element),i}static buildDpad(t,e,i,o,s){const r=document.createElement("div");r.className="vd-dpad";for(const[l,d]of[[t,"up"],[e,"left"],[i,"center"],[o,"right"],[s,"down"]])l.element.classList.add(`vd-dpad-${d}`),r.appendChild(l.element);return r}}function ki(n,t,e){const i=r=>Math.max(t.limits?.minZoom??1,Math.min(t.limits?.maxZoom??1/0,r)),o=r=>{const l=t.limits?.minRotate,d=t.limits?.maxRotate;return l!==void 0||d!==void 0?Math.max(l??-1/0,Math.min(d??1/0,r)):r},s=r=>{const l=t.limits?.minTilt,d=t.limits?.maxTilt;if(l!==void 0||d!==void 0){e.targetTilt=Math.max(l??0,Math.min(d??180,e.targetTilt+r)),n.tilt(e.targetTilt).set();return}const u=e.targetTilt+r;u>180||u<0?(e.targetTilt=u>180?360-u:-u,e.thetaOffset=(e.thetaOffset+180)%360,n.tilt(e.targetTilt).rotate(e.targetRotation+e.thetaOffset).set()):(e.targetTilt=u,n.tilt(e.targetTilt).set())};return{zoomOut:new b({variant:"outline",size:"icon",label:yn(),icon:g.zoomOut(),onClick:()=>{e.targetZoom=i(e.targetZoom-10),n.zoom(e.targetZoom).set()}}),zoomIn:new b({variant:"outline",size:"icon",label:fn(),icon:g.zoomIn(),onClick:()=>{e.targetZoom=i(e.targetZoom+10),n.zoom(e.targetZoom).set()}}),tiltUp:new b({variant:"outline",size:"icon",label:Nn(),icon:g.tiltUp(),onClick:()=>{s(-15)}}),rotateLeft:new b({variant:"outline",size:"icon",label:kn(),icon:g.rotateLeft(),onClick:()=>{e.targetRotation=o(e.targetRotation-15),n.rotate(e.targetRotation+e.thetaOffset).set()}}),reset:new b({variant:"outline",size:"icon",label:dn(),icon:g.reset(),onClick:()=>{e.thetaOffset=0,n.reset()}}),rotateRight:new b({variant:"outline",size:"icon",label:xn(),icon:g.rotateRight(),onClick:()=>{e.targetRotation=o(e.targetRotation+15),n.rotate(e.targetRotation+e.thetaOffset).set()}}),tiltDown:new b({variant:"outline",size:"icon",label:zn(),icon:g.tiltDown(),onClick:()=>{s(15)}})}}function Si(n,t,e){const i=t.limits;i!==void 0&&(n.zoomOut.element.disabled=i.minZoom!==void 0&&e.zoom<=i.minZoom+x,n.zoomIn.element.disabled=i.maxZoom!==void 0&&e.zoom>=i.maxZoom-x,n.tiltUp.element.disabled=i.minTilt!==void 0&&e.tilt<=i.minTilt+x,n.tiltDown.element.disabled=i.maxTilt!==void 0&&e.tilt>=i.maxTilt-x,n.rotateLeft.element.disabled=i.minRotate!==void 0&&e.rotation<=i.minRotate+x,n.rotateRight.element.disabled=i.maxRotate!==void 0&&e.rotation>=i.maxRotate-x)}const Ai=5;let Ei=0;function V(n){const t=n.replace(/([A-Z])/g," $1").trim();return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function xi(n,t,e,i,o){const s=document.createElement("div");s.className="vd-attribute",s.dataset.name=n.name;const r=document.createElement("span");r.className="vd-attribute-label",r.textContent=V(n.name),r.id=`vd-attribute-label-${Ei++}`,s.appendChild(r),s.setAttribute("role","group"),s.setAttribute("aria-labelledby",r.id);const l=n.values.find(p=>t.getValue(n.name,p)?.isSelected===!0),d=n.values.map(V),u=n.values.length<=Ai?new ci(n.values,l,d):new ui(n.name,n.values,V(n.name),l,d);return u.onSelect(p=>{e.dispatch(T.SELECT,{attribute:n.name,value:p},!0).defaultPrevented||i(n.name,p)}),o(n.name,p=>{u.setSelected(p.value),e.dispatch(T.SELECTED,{attribute:n.name,value:p.value})}),s.appendChild(u.element),s}const Ti=80,Ri=2500;class Oi{constructor(t,e=Ri){this.configuration=t,this.resetMs=e,this.element=document.createElement("div"),this.element.className="vd-commerce vd-hidden";const i=document.createElement("div");i.className="vd-commerce-price",this.priceEl=document.createElement("span"),this.priceEl.className="vd-price",this.vatEl=document.createElement("span"),this.vatEl.className="vd-vat",i.append(this.priceEl,this.vatEl),this.button=new b({variant:"default",onClick:()=>{this.handleSubmit()}}),this.button.element.classList.add("vd-cta","vd-hidden"),this.element.append(i,this.button.element),this.unsubscribe=this.configuration.onRender(()=>{this.update()}),this.update()}configuration;resetMs;element;priceEl;vatEl;button;unsubscribe;state="idle";resetTimer;update(){this.renderPrice(this.configuration.current),this.renderButton();const t=this.configuration.current!==void 0||this.configuration.submitEnabled;this.element.classList.toggle("vd-hidden",!t)}destroy(){this.unsubscribe(),this.resetTimer!==void 0&&clearTimeout(this.resetTimer),this.element.remove()}renderPrice(t){if(t===void 0){this.priceEl.textContent="",this.vatEl.textContent="";return}this.priceEl.textContent=Ni(t.price,t.currency),this.vatEl.textContent=rt(this.configuration.vatDisplay)}renderButton(){const t=this.configuration.submitEnabled;this.button.element.classList.toggle("vd-hidden",!t),t&&this.state==="idle"&&this.setButtonText(rt(this.configuration.buttonLabel))}async handleSubmit(){if(this.state!=="busy"){this.setState("busy",$n());try{await this.configuration.submit(),this.setState("success",jn())}catch{this.setState("failed",Zn())}this.scheduleReset()}}scheduleReset(){this.resetTimer!==void 0&&clearTimeout(this.resetTimer),this.resetTimer=setTimeout(()=>{this.state="idle",this.update()},this.resetMs)}setState(t,e){this.state=t,this.element.dataset.submit=t,this.button.element.disabled=t==="busy",this.setButtonText(e)}setButtonText(t){this.button.element.textContent=t,this.button.element.setAttribute("aria-label",t)}}function rt(n){return(n??"").slice(0,Ti)}function Ni(n,t){try{const e=new Intl.NumberFormat(h(),{style:"currency",currency:t}),i=e.resolvedOptions().maximumFractionDigits??2;return e.format(n/10**i)}catch{return`${t} ${(n/100).toFixed(2)}`}}class Ot{slot=null;panel=null;attach(t,e){this.panel=e,e.style.display="none",this.slot=document.createElement("div"),this.slot.className="vd-slot-bottom-left",this.slot.appendChild(e),t.appendChild(this.slot)}setVisible(t){this.panel!==null&&(this.panel.style.display=t?"flex":"none")}destroy(){this.slot?.remove(),this.slot=null,this.panel=null}}const Ii=572;class Li{element=null;body=null;openButton=null;closeButton=null;container=null;observer=null;collapsible=!1;expanded=!0;visible=!1;attach(t,e){this.container=t,e.classList.add("vd-attributes-sidebar"),this.closeButton=new b({variant:"ghost",size:"icon-sm",label:an(),icon:g.close({size:18}),onClick:()=>{this.expanded=!1,this.render()}});const i=document.createElement("div");i.className="vd-sidebar-header",i.appendChild(this.closeButton.element),this.body=document.createElement("div"),this.body.className="vd-sidebar-body",this.body.appendChild(e),this.element=document.createElement("div"),this.element.className="vd-sidebar vd-hidden",this.element.append(i,this.body),t.appendChild(this.element),this.openButton=new b({variant:"outline",size:"default",label:nn(),icon:g.configurator({size:18}),onClick:()=>{this.expanded=!0,this.render()}}),this.openButton.element.classList.add("vd-configurator-toggle","vd-hidden"),t.appendChild(this.openButton.element),this.observe()}setVisible(t){this.visible=t,this.render()}destroy(){this.observer?.disconnect(),this.observer=null,this.openButton?.element.remove(),this.element?.remove(),this.container?.classList.remove("vd-layout-sidebar-right"),this.container=null}observe(){typeof ResizeObserver>"u"||this.container===null||(this.observer=new ResizeObserver(t=>{const e=t[0]?.contentRect.width??0;this.setCollapsible(e>0&&e<Ii)}),this.observer.observe(this.container))}setCollapsible(t){t!==this.collapsible&&(this.collapsible=t,this.expanded=!t,this.render())}render(){if(this.element===null||this.openButton===null||this.closeButton===null||this.container===null)return;const t=this.visible&&this.expanded;this.element.classList.toggle("vd-hidden",!this.visible),this.element.classList.toggle("vd-sidebar-collapsed",this.visible&&!this.expanded),this.openButton.element.classList.toggle("vd-hidden",!(this.visible&&!this.expanded)),this.closeButton.element.style.display=this.collapsible?"":"none",this.container.classList.toggle("vd-layout-sidebar-right",t)}}class Mi{attach(t,e){}setVisible(t){}destroy(){}}const zi={"inframe-bottom-left":()=>new Ot,"sidebar-right":()=>new Li,hidden:()=>new Mi};function Pi(n){return(zi[n??""]??(()=>new Ot))()}const j=C.fontFamily.sans.join(", "),H=`
|
|
214
260
|
position: absolute;
|
|
215
261
|
display: flex;
|
|
216
262
|
z-index: 10;
|
|
217
|
-
|
|
263
|
+
transition: inset-inline-end 0.18s ease;
|
|
264
|
+
`,Fi=`
|
|
218
265
|
/* Override browser's default black fullscreen backdrop */
|
|
219
266
|
.vd-container:fullscreen {
|
|
220
267
|
background: oklch(100% 0 0);
|
|
@@ -222,52 +269,52 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
222
269
|
|
|
223
270
|
/* Layout slots — four corners */
|
|
224
271
|
.vd-slot-top-right {
|
|
225
|
-
${
|
|
226
|
-
inset-block-start: ${
|
|
227
|
-
inset-inline-end: ${
|
|
272
|
+
${H}
|
|
273
|
+
inset-block-start: ${a[3]};
|
|
274
|
+
inset-inline-end: ${a[3]};
|
|
228
275
|
flex-direction: column;
|
|
229
276
|
align-items: flex-end;
|
|
230
|
-
gap: ${
|
|
277
|
+
gap: ${a[1.5]};
|
|
231
278
|
}
|
|
232
279
|
|
|
233
280
|
.vd-slot-bottom-left {
|
|
234
|
-
${
|
|
235
|
-
inset-block-end: ${
|
|
236
|
-
inset-inline-start: ${
|
|
281
|
+
${H}
|
|
282
|
+
inset-block-end: ${a[3]};
|
|
283
|
+
inset-inline-start: ${a[3]};
|
|
237
284
|
flex-direction: column;
|
|
238
285
|
align-items: flex-start;
|
|
239
|
-
gap: ${
|
|
286
|
+
gap: ${a[1.5]};
|
|
240
287
|
}
|
|
241
288
|
|
|
242
289
|
.vd-slot-bottom-right {
|
|
243
|
-
${
|
|
244
|
-
inset-block-end: ${
|
|
245
|
-
inset-inline-end: ${
|
|
290
|
+
${H}
|
|
291
|
+
inset-block-end: ${a[3]};
|
|
292
|
+
inset-inline-end: ${a[3]};
|
|
246
293
|
flex-direction: row;
|
|
247
|
-
gap: ${
|
|
294
|
+
gap: ${a[1.5]};
|
|
248
295
|
}
|
|
249
296
|
|
|
250
297
|
/* Component styles — no positioning */
|
|
251
298
|
.vd-camera-controls {
|
|
252
299
|
display: flex;
|
|
253
300
|
flex-direction: column;
|
|
254
|
-
gap: ${
|
|
255
|
-
background: color-mix(in oklch, ${
|
|
301
|
+
gap: ${a[1]};
|
|
302
|
+
background: color-mix(in oklch, ${m.white} 85%, transparent);
|
|
256
303
|
backdrop-filter: blur(8px);
|
|
257
|
-
border-radius: ${
|
|
258
|
-
padding: ${
|
|
304
|
+
border-radius: ${a[2]};
|
|
305
|
+
padding: ${a[2]};
|
|
259
306
|
}
|
|
260
307
|
|
|
261
308
|
.vd-zoom {
|
|
262
309
|
display: flex;
|
|
263
|
-
gap: ${
|
|
310
|
+
gap: ${a[.5]};
|
|
264
311
|
}
|
|
265
312
|
|
|
266
313
|
.vd-dpad {
|
|
267
314
|
display: grid;
|
|
268
|
-
grid-template-columns: repeat(3, ${
|
|
269
|
-
grid-template-rows: repeat(3, ${
|
|
270
|
-
gap: ${
|
|
315
|
+
grid-template-columns: repeat(3, ${a[9]});
|
|
316
|
+
grid-template-rows: repeat(3, ${a[9]});
|
|
317
|
+
gap: ${a[.5]};
|
|
271
318
|
}
|
|
272
319
|
|
|
273
320
|
.vd-dpad-up { grid-column: 2; grid-row: 1; }
|
|
@@ -279,25 +326,129 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
279
326
|
.vd-attributes {
|
|
280
327
|
display: flex;
|
|
281
328
|
flex-direction: column;
|
|
282
|
-
gap: ${
|
|
283
|
-
background: color-mix(in oklch, ${
|
|
329
|
+
gap: ${a[3]};
|
|
330
|
+
background: color-mix(in oklch, ${m.white} 85%, transparent);
|
|
284
331
|
backdrop-filter: blur(8px);
|
|
285
|
-
border
|
|
286
|
-
|
|
287
|
-
|
|
332
|
+
border: 1px solid color-mix(in oklch, ${m.neutral[900]} 8%, transparent);
|
|
333
|
+
border-radius: ${a[3]};
|
|
334
|
+
padding: ${a[3]};
|
|
335
|
+
box-shadow: 0 ${a[1]} ${a[4]} color-mix(in oklch, ${m.neutral[900]} 6%, transparent);
|
|
336
|
+
font-family: ${j};
|
|
288
337
|
}
|
|
289
338
|
|
|
290
339
|
.vd-attribute {
|
|
291
340
|
display: flex;
|
|
292
341
|
flex-direction: column;
|
|
293
|
-
gap: ${
|
|
342
|
+
gap: ${a[1.5]};
|
|
294
343
|
}
|
|
295
344
|
|
|
345
|
+
/* Micro-label: recedes so the controls lead. */
|
|
296
346
|
.vd-attribute-label {
|
|
297
|
-
font-size: ${
|
|
298
|
-
font-weight: ${
|
|
299
|
-
color: ${
|
|
300
|
-
|
|
347
|
+
font-size: ${C.fontSize.xs};
|
|
348
|
+
font-weight: ${C.fontWeight.medium};
|
|
349
|
+
color: ${m.neutral[500]};
|
|
350
|
+
text-transform: uppercase;
|
|
351
|
+
letter-spacing: 0.05em;
|
|
352
|
+
font-family: ${j};
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/* sidebar-right layout — a docked, full-height right panel */
|
|
356
|
+
.vd-container { --vd-sidebar-width: 300px; }
|
|
357
|
+
|
|
358
|
+
.vd-hidden { display: none !important; }
|
|
359
|
+
|
|
360
|
+
.vd-sidebar {
|
|
361
|
+
position: absolute;
|
|
362
|
+
inset-block: 0;
|
|
363
|
+
inset-inline-end: 0;
|
|
364
|
+
inline-size: var(--vd-sidebar-width);
|
|
365
|
+
z-index: 11;
|
|
366
|
+
display: flex;
|
|
367
|
+
flex-direction: column;
|
|
368
|
+
background: color-mix(in oklch, ${m.white} 90%, transparent);
|
|
369
|
+
backdrop-filter: blur(10px);
|
|
370
|
+
border-inline-start: 1px solid color-mix(in oklch, ${m.neutral[900]} 8%, transparent);
|
|
371
|
+
box-shadow: -${a[1]} 0 ${a[4]} color-mix(in oklch, ${m.neutral[900]} 5%, transparent);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
375
|
+
.vd-sidebar { transition: transform 0.18s ease; }
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
.vd-sidebar-collapsed { transform: translateX(100%); }
|
|
379
|
+
|
|
380
|
+
.vd-sidebar-header {
|
|
381
|
+
display: flex;
|
|
382
|
+
justify-content: flex-end;
|
|
383
|
+
padding: ${a[1.5]} ${a[1.5]} 0;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
.vd-sidebar-body {
|
|
387
|
+
flex: 1;
|
|
388
|
+
overflow-y: auto;
|
|
389
|
+
padding: ${a[4]};
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/* attributes inside the sidebar: flat and full-width — the panel provides the frosting */
|
|
393
|
+
.vd-attributes.vd-attributes-sidebar {
|
|
394
|
+
background: transparent;
|
|
395
|
+
backdrop-filter: none;
|
|
396
|
+
border: none;
|
|
397
|
+
border-radius: 0;
|
|
398
|
+
padding: 0;
|
|
399
|
+
box-shadow: none;
|
|
400
|
+
gap: ${a[5]};
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/* floating toggle, shown when the sidebar is collapsed on narrow embeds */
|
|
404
|
+
.vd-configurator-toggle {
|
|
405
|
+
position: absolute;
|
|
406
|
+
inset-block-end: ${a[3]};
|
|
407
|
+
inset-inline-end: ${a[3]};
|
|
408
|
+
z-index: 12;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/* while the panel is open, keep the corner controls clear of it */
|
|
412
|
+
.vd-layout-sidebar-right .vd-slot-top-right { inset-inline-end: calc(var(--vd-sidebar-width) + ${a[3]}); }
|
|
413
|
+
.vd-layout-sidebar-right .vd-slot-bottom-right { inset-inline-end: calc(var(--vd-sidebar-width) + ${a[3]}); }
|
|
414
|
+
|
|
415
|
+
/* Price + CTA — sit under the attribute controls, separated by a hairline */
|
|
416
|
+
.vd-commerce {
|
|
417
|
+
display: flex;
|
|
418
|
+
flex-direction: column;
|
|
419
|
+
gap: ${a[2]};
|
|
420
|
+
padding-block-start: ${a[3]};
|
|
421
|
+
border-block-start: 1px solid color-mix(in oklch, ${m.neutral[900]} 8%, transparent);
|
|
422
|
+
font-family: ${j};
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
.vd-commerce-price {
|
|
426
|
+
display: flex;
|
|
427
|
+
align-items: baseline;
|
|
428
|
+
gap: ${a[1.5]};
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
.vd-price {
|
|
432
|
+
font-size: ${C.fontSize.lg};
|
|
433
|
+
font-weight: ${C.fontWeight.semibold};
|
|
434
|
+
color: ${m.neutral[900]};
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
.vd-vat {
|
|
438
|
+
font-size: ${C.fontSize.xs};
|
|
439
|
+
color: ${m.neutral[500]};
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
.vd-cta {
|
|
443
|
+
inline-size: 100%;
|
|
444
|
+
justify-content: center;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/* Failed submit is the one place red belongs: a clear, recoverable error state. */
|
|
448
|
+
.vd-commerce[data-submit="failed"] .vd-cta {
|
|
449
|
+
background: ${m.semantic.error};
|
|
450
|
+
border-color: ${m.semantic.error};
|
|
451
|
+
color: ${m.white};
|
|
301
452
|
}
|
|
302
453
|
|
|
303
|
-
`;function
|
|
454
|
+
`;function Di(){if(fi(),document.getElementById("vd-styles")!==null)return;const n=document.createElement("style");n.id="vd-styles",n.textContent=Fi,document.head.appendChild(n)}function $i(n,t){const e=document.createElement("a");e.href=`data:image/png;base64,${n}`,e.download=t,e.click()}class Bi{options;settings={};container=null;loading=null;slots={topRight:null,bottomRight:null};screenshotBtn=null;actionBar=null;cameraControls=null;attributes=null;layout=null;commerce=null;constructor(t){this.options=t}attach(t){Di(),this.container=t,this.loading=new Ci(t),this.slots.topRight=this.createSlot(t,"vd-slot-top-right"),this.slots.bottomRight=this.createSlot(t,"vd-slot-bottom-right")}onReady(){this.loading?.hide(),this.loading=null,this.mountToolbar(),this.cameraControls!==null&&(this.cameraControls.element.style.display="flex"),this.layout?.setVisible(!0)}mountToolbar(){if(this.actionBar!==null||this.slots.bottomRight===null||this.container===null)return;const t=typeof this.container.requestFullscreen=="function";this.actionBar=new wi({onAr:this.options.onAr,onFullscreen:t?()=>{this.toggleFullscreen()}:void 0}),this.actionBar.applySettings(this.settings),this.slots.bottomRight.appendChild(this.actionBar.element),this.syncScreenshotButton(),this.placeScreenshotButton()}toggleFullscreen(){this.container!==null&&(document.fullscreenElement!==null?document.exitFullscreen():this.container.requestFullscreen())}updateProgress(t,e){this.loading?.updateProgress(t,e)}showError(t){this.loading?.showError(t)}applyViewerSettings(t){this.settings=t,t.language!==void 0&&kt(t.language,{reload:!1}),this.syncScreenshotButton(),this.actionBar?.applySettings(t),this.cameraControls!==null&&(this.cameraControls.element.style.display=t.cameraControls===!0?"flex":"none"),this.placeScreenshotButton()}renderAttributeControls(t,e){if(!(this.container===null||this.slots.topRight===null)&&(this.cameraControls?.element.remove(),this.cameraControls=null,this.teardownConfigurator(),this.settings.cameraControls===!0&&(this.cameraControls=new I(this.options.cameraApi,this.options.cameraPositionApi),this.cameraControls.element.style.display="none",this.slots.topRight.appendChild(this.cameraControls.element)),this.placeScreenshotButton(),e.length!==0)){this.attributes=document.createElement("div"),this.attributes.className="vd-attributes";for(const i of e)this.attributes.appendChild(xi(i,t,this.options.eventBus,this.options.onSelect,this.options.onSubscribe));this.commerce=new Oi(this.options.configuration),this.attributes.appendChild(this.commerce.element),this.layout=Pi(this.settings.configuratorLayout),this.layout.attach(this.container,this.attributes)}}get viewerSettings(){return this.settings}teardownConfigurator(){this.commerce?.destroy(),this.commerce=null,this.attributes?.remove(),this.attributes=null,this.layout?.destroy(),this.layout=null}destroy(){this.loading?.destroy(),this.screenshotBtn?.element.remove(),this.actionBar?.destroy(),this.actionBar?.element.remove(),this.cameraControls?.element.remove(),this.teardownConfigurator();for(const t of Object.values(this.slots))t?.remove();this.container=null}createSlot(t,e){const i=document.createElement("div");return i.className=e,t.appendChild(i),i}syncScreenshotButton(){const t=this.settings.screenshot===!0;t&&this.screenshotBtn===null&&(this.screenshotBtn=new b({variant:"outline",size:"icon",label:Qe(),icon:g.screenshot(),onClick:()=>{this.options.snapshotApi.take("snapshot.png").onDeveloped(({data:e,filename:i})=>{$i(e,i)})}})),!t&&this.screenshotBtn!==null&&(this.screenshotBtn.element.remove(),this.screenshotBtn=null)}placeScreenshotButton(){this.screenshotBtn===null||this.slots.topRight===null||(this.cameraControls!==null?this.cameraControls.element.appendChild(this.screenshotBtn.element):this.slots.topRight.appendChild(this.screenshotBtn.element))}}class Ui{attributes;readyStateTracker;messenger;cameraApi;cameraPositionApi;focusApi;configurationApi;snapshotApi;annotationsApi;eventBus;ui;qrModal;options;iframe;container;readyCallbacks=[];mutationFailedCallbacks=[];constructor(t){this.options=t,this.initializeLogging(),this.messenger=new se(()=>this.iframe?.contentWindow??null);const e=i=>{this.messenger.send(i)};this.attributes=new ae(e,(i,o)=>{for(const s of this.mutationFailedCallbacks)s({attribute:i,value:o})}),this.snapshotApi=new _t(e),this.annotationsApi=new mt(e),this.cameraApi=new gt(e),this.cameraPositionApi=new le,this.focusApi=new bt(e,i=>{this.dispatchFocusChange(i)}),this.configurationApi=new vt(i=>{this.dispatchConfigurationChange(i)},i=>{this.dispatchConfigurationSubmit(i)}),this.eventBus=new de,this.qrModal=new hi,this.readyStateTracker=new Ht(()=>{const i=this.readyCallbacks;this.readyCallbacks=[];for(const o of i)o(this);this.ui.onReady()}),this.ui=new Bi({snapshotApi:this.snapshotApi,cameraApi:this.cameraApi,cameraPositionApi:this.cameraPositionApi,eventBus:this.eventBus,configuration:this.configurationApi,onSelect:(i,o)=>this.attributes.select(i,o),onSubscribe:(i,o)=>this.attributes.onChange(i,o),onAr:()=>{this.activateAr()}}),this.registerHandlers(),this.messenger.start(),this.createAndConnectIframe()}registerHandlers(){this.messenger.on(c.HANDSHAKE,t=>{Yt(t)&&(exports.logger.info("Server handshake received, flushing publisher queue"),this.messenger.markReady())}),this.messenger.on(c.MUTATION,t=>{Xt(t)&&(this.attributes.handleMutationResult(t),this.configurationApi.handleSelectionChanged(this.attributes.getSelection()))}),this.messenger.on(c.SNAPSHOT,t=>{Kt(t)&&this.snapshotApi.handleSnapshotResult(t)}),this.messenger.on(c.CAMERA,t=>{Qt(t)&&this.cameraPositionApi.handlePositionUpdate(t)}),this.messenger.on(c.LOADING_INDICATOR,t=>{te(t)&&(t.error!==void 0?this.ui.showError(t.error):this.ui.updateProgress(t.progress,t.phase))}),this.messenger.on(c.CONFIG,t=>{ee(t)&&this.handleConfig(t)}),this.messenger.on(c.ANNOTATION_PLACED,t=>{ne(t)&&this.annotationsApi.handlePlaced(t.position)}),this.messenger.on(c.MAPPING,t=>{Jt(t)&&(this.attributes.handleMappingReceived(t),this.configurationApi.handleSelectionChanged(this.attributes.getSelection()),this.ui.renderAttributeControls(this.attributes,t.attributes),this.readyStateTracker.handleMappingReceived())}),this.registerFacadeStateHandlers()}registerFacadeStateHandlers(){this.messenger.on(c.FOCUS,t=>{ie(t)&&this.focusApi.handleStateReceived(t)}),this.messenger.on(c.PRICING,t=>{oe(t)&&this.configurationApi.handlePricingReceived(t.pricing)})}dispatchFocusChange(t){this.container?.dispatchEvent(new CustomEvent(T.FOCUS_CHANGE,{detail:t,bubbles:!0}))}dispatchConfigurationChange(t){this.container?.dispatchEvent(new CustomEvent(T.CONFIGURATION_CHANGE,{detail:t??null,bubbles:!0}))}dispatchConfigurationSubmit(t){this.container?.dispatchEvent(new CustomEvent(T.CONFIGURATION_SUBMIT,{detail:t,bubbles:!0}))}handleConfig(t){const e=t.viewerSettings,i=this.options.viewerSettings;if(e!==void 0||i!==void 0){const o=i!==void 0?{...e??{},...i}:e;if(i!==void 0&&e!==void 0){const s=Object.entries(i).filter(([r,l])=>e[r]!==l).map(([r,l])=>`${r} (metadata: ${e[r]??"undefined"}, override: ${l})`);s.length>0&&exports.logger.warn(`Viewer settings override active: ${s.join(", ")}`)}this.ui.applyViewerSettings(o),this.annotationsApi.setEnabled(o.annotations!==!1)}this.cameraPositionApi.applyLimits(t.cameraLimits)}activateAr(){if(Vt()){this.messenger.send({type:c.AR_ACTIVATE});return}this.qrModal.show(this.iframe?.src??"")}initializeLogging(){this.options.debug===!0&&ht(),exports.logger.info("Initializing Virtualdisplay client",{model:this.options.model})}createAndConnectIframe(){const e=new It(this.options).create();this.container=e.container,this.iframe=e.iframe,this.eventBus.attach(this.container),this.ui.attach(this.container);try{const i=new URL(this.iframe.src).origin;this.messenger.setTargetOrigin(i)}catch{}}select(t,e){this.attributes.select(t,e)}getValues(t){return this.attributes.getValues(t)}getValue(t,e){return this.attributes.getValue(t,e)}onChange(t,e){this.attributes.onChange(t,e)}getAttribute(t){return this.attributes.getAttribute(t)}get isReady(){return this.readyStateTracker.isReady}onReady(t){if(this.readyStateTracker.isReady){t(this);return}this.readyCallbacks.push(t)}onMutationFailed(t){this.mutationFailedCallbacks.push(t)}on(t,e){this.eventBus.on(t,e)}get annotations(){return this.annotationsApi}get camera(){return this.cameraApi}get focus(){return this.focusApi}get configuration(){return this.configurationApi}get cameraPosition(){return this.cameraPositionApi}get snapshot(){return this.snapshotApi}get viewerSettings(){return this.ui.viewerSettings}destroy(){this.readyStateTracker.clear(),this.readyCallbacks=[],this.mutationFailedCallbacks.length=0,this.snapshotApi.clear(),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=mt;exports.Attribute=ft;exports.AttributeValue=pt;exports.Camera=gt;exports.Configuration=vt;exports.ERROR_CODES=_;exports.Focus=bt;exports.Photo=yt;exports.Snapshot=_t;exports.VD_EVENTS=T;exports.VirtualdisplayClient=Ui;exports.VirtualdisplayError=f;exports.enableDebugMode=ht;exports.isDebugMode=jt;
|