@virtualdisplay.io/client 4.0.0-alpha.28 → 4.0.0-alpha.29
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 +10 -0
- package/dist/index.d.ts +151 -380
- package/dist/virtualdisplay.client.cjs.js +25 -10
- package/dist/virtualdisplay.client.es.js +215 -207
- package/dist/virtualdisplay.client.umd.js +18 -3
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c={HANDSHAKE:"handshake",SESSION:"session",MUTATION:"mutation",STATE:"state",LOADING_INDICATOR:"loading_indicator",CAMERA:"camera",SNAPSHOT:"snapshot",MAPPING:"mapping",AR_ACTIVATE:"ar_activate",FULLSCREEN:"fullscreen",CONFIG:"config",ANNOTATION_TOGGLE:"annotation_toggle",FOCUS:"focus",PRICING:"pricing",QR_SHOWN:"qr_shown",SYNC:"sync",SELECTABLE:"selectable",APP_RESOLVED:"app_resolved"},O="main",tt={FOCUS:"focus",UNFOCUS:"unfocus"},Dt={FOCUSED:"focused"},$t={HIDDEN:"hidden"},Bt=new Set(Object.values(c));function Ut(n){if(typeof n!="object"||n===null)return!1;const t=n;return typeof t.target=="string"?!1:typeof t.type=="string"&&Bt.has(t.type)}function Vt(n){const t=S(n);return t!==null&&t.type===c.HANDSHAKE}function jt(n){const t=S(n);return t!==null&&t.type===c.SESSION&&typeof t.sessionId=="string"}function Ht(n){const t=S(n);return t!==null&&t.type===c.APP_RESOLVED&&typeof t.appType=="string"&&t.appType!==""&&typeof t.name=="string"}function qt(n){const t=S(n);return t!==null&&t.type===c.MUTATION&&typeof t.instance=="string"&&t.instance!==""&&Array.isArray(t.results)}function Gt(n){const t=S(n);return t!==null&&t.type===c.SNAPSHOT&&("data"in t||"error"in t)}function Zt(n){const t=S(n);return t!==null&&t.type===c.CAMERA&&Array.isArray(t.transforms)}function Wt(n){const t=S(n);return t!==null&&t.type===c.MAPPING&&typeof t.instance=="string"&&t.instance!==""&&Array.isArray(t.attributes)}function Yt(n){const t=S(n);return t!==null&&t.type===c.LOADING_INDICATOR&&typeof t.progress=="number"}function Qt(n){const t=S(n);return t!==null&&t.type===c.SYNC&&typeof t.connected=="boolean"}function Kt(n){const t=S(n);return t!==null&&t.type===c.SELECTABLE&&typeof t.instance=="string"&&t.instance!==""&&Array.isArray(t.attributes)}function Xt(n){const t=S(n);return t!==null&&t.type===c.CONFIG&&typeof t.viewerSettings=="object"}function Jt(n){const t=S(n);return t!==null&&t.type===c.FOCUS&&typeof t.instance=="string"&&t.instance!==""&&typeof t.state=="string"}function te(n){const t=S(n);return t!==null&&t.type===c.PRICING&&typeof t.instance=="string"&&t.instance!==""&&typeof t.pricing=="object"&&t.pricing!==null}function S(n){return typeof n!="object"||n===null?null:n}class et{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 ee{constructor(t,e){this.getTarget=t,this.sourceId=`vd-${Math.random().toString(36).slice(2,8)}`,this.targetOrigin="*",this.isValid=e?.isValid??Ut,this.publisher=new et(i=>this.post(i)),this.consumer=new et(i=>this.routeToHandler(i)),e?.bufferIncoming!==!0&&this.consumer.markReady()}getTarget;handlers=new Map;publisher;consumer;listener=null;sourceId;targetOrigin;isValid;on(t,e){this.handlers.set(t,e)}setTargetOrigin(t){this.targetOrigin=t}send(t){this.publisher.enqueue(t)}receive(t){this.isValid(t)&&this.consumer.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(!this.isValid(e)||e._source===this.sourceId)return;const i=this.getTarget();if(i!==null&&t.source!==null&&t.source!==i)return;const o=e;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()}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,e){this.send=t,this.instance=e}send;instance;setEnabled(t){this.send({type:c.ANNOTATION_TOGGLE,instance:this.instance,enabled:t})}}class ft{constructor(t,e){this.value=t,this.attribute=e}value;attribute;isSelectedValue=!1;get isSelected(){return this.isSelectedValue}setSelected(t){this.isSelectedValue=t}}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 b extends Error{code;constructor(t,e){super(t),this.name="VirtualdisplayError",this.code=e}static valueNotFound(t,e){return new b(`Value "${e}" not found for attribute "${t}"`,_.VALUE_NOT_FOUND)}static parentNotFound(t){return new b(`Parent element not found: ${t}`,_.PARENT_NOT_FOUND)}static invalidParameter(t){return new b(t,_.INVALID_PARAMETER)}}class gt{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 b.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 ft(i,this.name);i===this.defaultValue&&o.setSelected(!0),e.set(i,o)}return e}}class ne{attributes=new Map;constructor(t,e,i){for(const o of t){const s=this.buildOptions(o,e);this.attributes.set(o.name,new gt(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}}const L=4096,F=16384,ie=[1024,256,64],oe=20,W=["timestamp","level","msg","service","trace_id","span_id"];function se(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=Object.entries(n).filter(([r])=>!W.includes(r)).map(([r,a])=>`${r}=${I(a,L).line}`).join(" ");return`${t} ${e} [${i}] ${o}${s?" "+s:""}`}function re(n){for(const o of[L,...ie]){const{line:s,truncated:r}=I(n,o);if(!r){if(s.length<=F)return s;continue}const{line:a}=I({...n,log_truncated:!0},o);if(a.length<=F)return a}const t=Object.keys(n).filter(o=>!W.includes(o)),e={...le(n,W),log_truncated:!0,log_dropped_count:t.length},i=I({...e,log_dropped_attrs:t.slice(0,oe)},L);return i.line.length<=F?i.line:I(e,L).line}function I(n,t){const e=[];let i=!1;return{line:JSON.stringify(n,function(r,a){if(typeof a=="string")return a.length>t&&(i=!0),ae(a,t);if(typeof a=="bigint")return a.toString();if(typeof a!="object"||a===null)return a;for(;e.length>0&&e.at(-1)!==this;)e.pop();return e.includes(a)?"[Circular]":(e.push(a),a)}),truncated:i}}function ae(n,t){return n.length<=t?n:`${n.slice(0,t)}...[truncated ${n.length-t} chars]`}function le(n,t){const e={};for(const i of t)n[i]!==void 0&&(e[i]=n[i]);return e}function ce(n,t){const e=t?se(n):re(n);n.level==="error"?console.error(e):n.level==="warn"?console.warn(e):console.log(e)}function bt(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?bt(n.cause,t+1):String(n.cause)),e}function ue(n){const t={};for(const[e,i]of Object.entries(n))t[e]=i instanceof Error?bt(i):i;return t}function de(){return new Date}function he(n){return n.toISOString()}function vt(){return typeof navigator>"u"?"":navigator.userAgent}function pe(){return typeof navigator>"u"?!1:navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1}function me(){return/iPhone|iPad|iPod/i.test(vt())||pe()}function fe(){return/Android/i.test(vt())}function ge(){return me()||fe()}class be{constructor(t){this.config=t}config;log(t,e,i={}){const o=this.config.traceProvider?.()??{},s={timestamp:he(de()),level:t,msg:e,service:this.config.service,...o,...ue(i)};ce(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)}}function yt(n,t){const e=t?.isDev!==void 0?t.isDev:typeof process<"u"?process.env.NODE_ENV!=="production":!0;return new be({service:n,isDev:e,traceProvider:t?.traceProvider})}function M(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 St(n){return{debug:(t,e)=>n.debug(t,M(e)),info:(t,e)=>n.info(t,M(e)),warn:(t,e)=>n.warn(t,M(e)),error:(t,e)=>n.error(t,M(e))}}let wt=!1;exports.logger=St(yt("client",{isDev:!1}));function Ct(){wt=!0,exports.logger=St(yt("client",{isDev:!0}))}function ve(){return wt}class ye{constructor(t,e,i){this.send=t,this.instance=e,this.onMutationFailed=i}send;instance;onMutationFailed;registry;pendingCallbacks=[];handleMappingReceived(t){exports.logger.debug("Initializing from server mapping",{attributeCount:t.attributes.length}),this.registry=new ne(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)}selectTransient(t,e){this.sendMutation([{name:t,value:e}],!1,!0)}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()??{}}sendMutation(t,e,i=!1){const o={type:c.MUTATION,instance:this.instance,mutations:t,isInitial:e,...i&&{transient:!0}};this.send(o)}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}}class Se{snapshot;callbacks=[];handleSnapshot(t){this.snapshot=t.attributes;for(const e of this.callbacks)e(t.attributes)}onChange(t){this.callbacks.push(t),this.snapshot!==void 0&&t(this.snapshot)}selectableFor(t){return this.snapshot?.find(i=>i.name===t)?.selectable??null}get current(){return this.snapshot??[]}}let _t=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 b.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 b.invalidParameter(`${e}() requires a finite number, got ${String(t)}`)}reset(){const t={type:c.CAMERA,commands:[{action:"reset"}]};this.send(t)}};class we{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)}}}function Ce(n,t){const e=n.filter(s=>_e(s,t));if(e.length===0)return;const i=Math.max(...e.map(nt)),o=e.filter(s=>nt(s)===i);return o.length===1?o[0]:void 0}function _e(n,t){return Object.entries(n.attributes).every(([e,i])=>t[e]===i)}function nt(n){return Object.keys(n.attributes).length}class kt{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===$t.HIDDEN))return{attributes:{...this.selection},reference:t.reference,price:t.priceCents,currency:this.pricing.currency,availability:t.availability}}}class At{constructor(t,e,i){this.send=t,this.dispatch=e,this.instance=i}send;dispatch;instance;focused=null;attributes=[];changeCallbacks=[];get current(){return this.focused}set(t){if(typeof t!="string"||t.length===0)throw b.invalidParameter(`set() requires a non-empty component name, got ${String(t)}`);this.send({type:c.FOCUS,instance:this.instance,action:tt.FOCUS,component:t})}clear(){this.send({type:c.FOCUS,instance:this.instance,action:tt.UNFOCUS})}onChange(t){this.changeCallbacks.push(t)}handleStateReceived(t){t.state===Dt.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)}}class Et{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())}}const it=3e4;class xt{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 Et(t),i=setTimeout(()=>{this.pendingPhotos.delete(t),exports.logger.warn("Snapshot timed out",{filename:t}),e.fail(new b(`Snapshot timed out: the viewer did not respond within ${it}ms`,_.SNAPSHOT_FAILED))},it);return this.pendingPhotos.set(t,{photo:e,timeout:i}),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}clearTimeout(e.timeout),this.pendingPhotos.delete(t.filename);const{photo:i}=e;if(t.error!==void 0){i.fail(new b(t.error,_.SNAPSHOT_FAILED));return}t.data!==void 0&&i.develop({filename:t.filename,data:t.data})}clear(){if(this.pendingPhotos.size===0)return;const t=new b("Client destroyed before snapshot completed",_.SNAPSHOT_FAILED);for(const{photo:e,timeout:i}of this.pendingPhotos.values())clearTimeout(i),e.fail(t);this.pendingPhotos.clear()}validateFilename(t){if(t===""||typeof t!="string")throw new b("Filename must be a non-empty string",_.INVALID_PARAMETER);if(!this.validExtensions.some(i=>t.toLowerCase().endsWith(i)))throw new b(`Invalid filename: "${t}". Filename must end with one of: ${this.validExtensions.join(", ")}`,_.INVALID_PARAMETER);if(t.includes("..")||t.includes("/")||t.includes("\\"))throw new b('Filename cannot contain path separators or ".."',_.INVALID_PARAMETER)}}class ke{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 Ae={},Ee="en",Tt=["en","nl","de"],K=["baseLocale"],ot=[],Y=typeof window>"u";globalThis.__paraglide=globalThis.__paraglide??{};globalThis.__paraglide.ssr=globalThis.__paraglide.ssr??{};let st=!1,p=()=>{let n=K;!Y&&typeof window<"u"&&window.location?.href&&(n=It(window.location.href));const t=xe(n);if(t)return st||(st=!0,Rt(t,{reload:!1})),t;throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found")};function xe(n,t){let e;for(const i of n){if(i==="baseLocale")e=Ee;else if(Ot(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 Ie(r)}}const o=X(e);if(o)return o}}const Te=n=>{window.location.reload()};let Rt=(n,t)=>{const e={reload:!0,...t};let i;try{i=p()}catch{}const o=[];let s=K;!Y&&typeof window<"u"&&window.location?.href&&(s=It(window.location.href));for(const a of s)if(a!=="baseLocale"&&Ot(a)&&N.has(a)){const u=N.get(a);if(u){let d=u.setLocale(n);d instanceof Promise&&(d=d.catch(f=>{throw new Error(`Custom strategy "${a}" setLocale failed.`,{cause:f})}),o.push(d))}}const r=()=>{!Y&&e.reload&&window.location&&n!==i&&Te()};if(o.length)return Promise.all(o).then(()=>{r()});r()},Re=()=>typeof window<"u"?window.location.origin:"http://fallback.com";function X(n){if(typeof n!="string")return;const t=n.toLowerCase();for(const e of Tt)if(e.toLowerCase()===t)return e}function Ie(n){const t=X(n);if(t)return t;throw new Error(`Invalid locale: ${n}. Expected one of: ${Tt.join(", ")}`)}function Oe(n){return Me(n)}function Me(n){const t=typeof n=="string"?new URL(n,Re()):new URL(n),e=t.pathname.split("/").filter(Boolean);return e.length>0&&X(e[0])&&(t.pathname="/"+e.slice(1).join("/")),t}let rt,at;function Le(n){if(ot.length===0)return;const t=typeof n=="string"?n:n.href;if(rt===t)return at;const e=new URL(t,"http://example.com"),i=Oe(e),o=i.href===e.href?[e]:[e,i];let s;for(const r of o){for(const a of ot)if(new Ae(a.match,r.href).exec(r.href)){s=a;break}if(s)break}return rt=t,at=s,s}function It(n){const t=Le(n);return t&&t.exclude!==!0&&Array.isArray(t.strategy)?t.strategy:K}const N=new Map;function Ot(n){return typeof n=="string"&&/^custom-[A-Za-z0-9_-]+$/.test(n)}const Ne=()=>"Activate AR",ze=()=>"AR activeren",Pe=()=>"AR aktivieren",Fe=((n={},t={})=>{const e=t.locale??p();return e==="nl"?ze():e==="de"?Pe():Ne()}),De=()=>"Scan to view in AR",$e=()=>"Scan om in AR te bekijken",Be=()=>"Scannen für AR-Ansicht",Ue=((n={},t={})=>{const e=t.locale??p();return e==="nl"?$e():e==="de"?Be():De()}),Ve=()=>"Use your smartphone camera to scan this QR code",je=()=>"Gebruik de camera van je smartphone om deze QR-code te scannen",He=()=>"Verwende die Kamera deines Smartphones, um diesen QR-Code zu scannen",qe=((n={},t={})=>{const e=t.locale??p();return e==="nl"?je():e==="de"?He():Ve()}),Ge=()=>"Your phone will open the 3D model in AR mode.",Ze=()=>"Je telefoon opent het 3D-model in AR-modus.",We=()=>"Dein Telefon öffnet das 3D-Modell im AR-Modus.",Ye=((n={},t={})=>{const e=t.locale??p();return e==="nl"?Ze():e==="de"?We():Ge()}),Qe=()=>"Close",Ke=()=>"Sluiten",Xe=()=>"Schließen",Je=((n={},t={})=>{const e=t.locale??p();return e==="nl"?Ke():e==="de"?Xe():Qe()}),tn=()=>"Annotations",en=()=>"Annotaties",nn=()=>"Anmerkungen",on=((n={},t={})=>{const e=t.locale??p();return e==="nl"?en():e==="de"?nn():tn()}),sn=()=>"Fullscreen",rn=()=>"Volledig scherm",an=()=>"Vollbild",ln=((n={},t={})=>{const e=t.locale??p();return e==="nl"?rn():e==="de"?an():sn()}),cn=()=>"Downloading",un=()=>"Downloaden",dn=()=>"Herunterladen",hn=((n={},t={})=>{const e=t.locale??p();return e==="nl"?un():e==="de"?dn():cn()}),pn=()=>"Screenshot",mn=()=>"Screenshot",fn=()=>"Screenshot",gn=((n={},t={})=>{const e=t.locale??p();return e==="nl"?mn():e==="de"?fn():pn()}),bn=()=>"Configure",vn=()=>"Configureren",yn=()=>"Konfigurieren",Sn=((n={},t={})=>{const e=t.locale??p();return e==="nl"?vn():e==="de"?yn():bn()}),wn=()=>"Close",Cn=()=>"Sluiten",_n=()=>"Schließen",kn=((n={},t={})=>{const e=t.locale??p();return e==="nl"?Cn():e==="de"?_n():wn()}),An=()=>"Reset camera",En=()=>"Camera resetten",xn=()=>"Kamera zurücksetzen",Tn=((n={},t={})=>{const e=t.locale??p();return e==="nl"?En():e==="de"?xn():An()}),Rn=()=>"Zoom in",In=()=>"Inzoomen",On=()=>"Hineinzoomen",Mn=((n={},t={})=>{const e=t.locale??p();return e==="nl"?In():e==="de"?On():Rn()}),Ln=()=>"Zoom out",Nn=()=>"Uitzoomen",zn=()=>"Herauszoomen",Pn=((n={},t={})=>{const e=t.locale??p();return e==="nl"?Nn():e==="de"?zn():Ln()}),Fn=()=>"Rotate left",Dn=()=>"Naar links draaien",$n=()=>"Nach links drehen",Bn=((n={},t={})=>{const e=t.locale??p();return e==="nl"?Dn():e==="de"?$n():Fn()}),Un=()=>"Rotate right",Vn=()=>"Naar rechts draaien",jn=()=>"Nach rechts drehen",Hn=((n={},t={})=>{const e=t.locale??p();return e==="nl"?Vn():e==="de"?jn():Un()}),qn=()=>"Tilt up",Gn=()=>"Omhoog kantelen",Zn=()=>"Nach oben kippen",Wn=((n={},t={})=>{const e=t.locale??p();return e==="nl"?Gn():e==="de"?Zn():qn()}),Yn=()=>"Tilt down",Qn=()=>"Omlaag kantelen",Kn=()=>"Nach unten kippen",Xn=((n={},t={})=>{const e=t.locale??p();return e==="nl"?Qn():e==="de"?Kn():Yn()}),Jn=()=>"Working…",ti=()=>"Bezig…",ei=()=>"Läuft…",ni=((n={},t={})=>{const e=t.locale??p();return e==="nl"?ti():e==="de"?ei():Jn()}),ii=()=>"Done",oi=()=>"Gelukt",si=()=>"Fertig",ri=((n={},t={})=>{const e=t.locale??p();return e==="nl"?oi():e==="de"?si():ii()}),ai=()=>"Failed",li=()=>"Mislukt",ci=()=>"Fehlgeschlagen",ui=((n={},t={})=>{const e=t.locale??p();return e==="nl"?li():e==="de"?ci():ai()});const di={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 Mt=([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=Mt(o);i.appendChild(s)}),i},Lt=(n,t={})=>{const i={...di,...t};return Mt(["svg",i,n])};const hi=[["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 pi=[["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 Nt=[["path",{d:"m6 9 6 6 6-6"}]];const mi=[["path",{d:"m15 18-6-6 6-6"}]];const fi=[["path",{d:"m9 18 6-6-6-6"}]];const gi=[["path",{d:"m18 15-6-6-6 6"}]];const bi=[["path",{d:"M12.75 7.09a3 3 0 0 1 2.16 2.16"}],["path",{d:"M17.072 17.072c-1.634 2.17-3.527 3.912-4.471 4.727a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 1.432-4.568"}],["path",{d:"m2 2 20 20"}],["path",{d:"M8.475 2.818A8 8 0 0 1 20 10c0 1.183-.31 2.377-.81 3.533"}],["path",{d:"M9.13 9.13a3 3 0 0 0 3.74 3.74"}]];const vi=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0"}],["circle",{cx:"12",cy:"10",r:"3"}]];const yi=[["path",{d:"M15 3h6v6"}],["path",{d:"m21 3-7 7"}],["path",{d:"m3 21 7-7"}],["path",{d:"M9 21H3v-6"}]];const Si=[["path",{d:"m14 10 7-7"}],["path",{d:"M20 10h-6V4"}],["path",{d:"m3 21 7-7"}],["path",{d:"M4 14h6v6"}]];const wi=[["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 Ci=[["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 _i=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];const ki=[["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 Ai=[["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 v(n,{size:t=20,strokeWidth:e=1.75}={}){return Lt(n,{width:t,height:t,"stroke-width":e})}const g={ar:n=>v(hi,n),annotations:n=>v(vi,n),annotationsOff:n=>v(bi,n),fullscreen:n=>v(yi,n),exitFullscreen:n=>v(Si,n),screenshot:n=>v(pi,n),tiltUp:n=>v(gi,n),tiltDown:n=>v(Nt,n),rotateLeft:n=>v(mi,n),rotateRight:n=>v(fi,n),zoomIn:n=>v(ki,n),zoomOut:n=>v(Ai,n),reset:n=>v(wi,n),configurator:n=>v(Ci,n),close:n=>v(_i,n)};class y{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"},l={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"};class Ei{element;constructor(){this.element=document.createElement("div"),Object.assign(this.element.style,{background:m.white,borderRadius:l[3],padding:l[6],boxShadow:`0 ${l[2]} ${l[8]} oklch(0% 0 0 / 20%)`,maxWidth:"20rem",width:"100%"})}}class xi{constructor(t={}){this.options=t,this.card=new Ei,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:l[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 Ti{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}setEnabled(t){for(const e of this.element.querySelectorAll(".ui-toggle-group-item")){const i=t===null||t.includes(e.dataset.value??"");e.disabled=!i,e.setAttribute("aria-disabled",i?"false":"true")}}}class Ri{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 a=!1;for(let d=0;d<e.length;d++){const f=e[d],h=document.createElement("option");h.value=f,h.textContent=s?.[d]??f,f===o&&(h.selected=!0,a=!0),this.select.appendChild(h)}a||(r.selected=!0);const u=Lt(Nt,{width:16,height:16,"stroke-width":2});u.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(u)}setSelected(t){this.select.value=t}onSelect(t){this.select.addEventListener("change",()=>{t(this.select.value)})}setEnabled(t){for(const e of this.select.options)e.value!==""&&(e.disabled=t!==null&&!t.includes(e.value))}}class Ii{element;input;valueText;values;options;selectCallback=null;settleCallback=null;constructor(t,e){if(t.length===0)throw new Error("Virtualdisplay: Slider needs at least one value");this.values=t,this.options=e,this.input=document.createElement("input"),this.input.type="range",this.input.className="ui-slider-input",this.input.min="0",this.input.max=String(t.length-1),this.input.step="1",this.input.setAttribute("aria-label",e.label),this.valueText=document.createElement("span"),this.valueText.className="ui-slider-value",this.valueText.setAttribute("aria-hidden","true");const i=document.createElement("div");i.className="ui-slider-track",i.appendChild(this.input),i.appendChild(this.buildEnds()),this.element=document.createElement("div"),this.element.className="ui-slider",this.element.appendChild(i),this.element.appendChild(this.valueText);const o=e.initialSelected===void 0?0:t.indexOf(e.initialSelected);this.applyIndex(o===-1?0:o),this.listen()}setSelected(t){const e=this.values.indexOf(t);e!==-1&&this.applyIndex(e)}onSelect(t){this.selectCallback=t}onSettle(t){this.settleCallback=t}listen(){this.input.addEventListener("input",()=>{const t=this.values[this.currentIndex];t!==void 0&&(this.applyIndex(this.currentIndex),this.selectCallback?.(t))}),this.input.addEventListener("change",()=>{const t=this.values[this.currentIndex];t!==void 0&&this.settleCallback?.(t)})}get currentIndex(){return Number(this.input.value)}applyIndex(t){this.input.value=String(t);const e=this.displayAt(t);this.valueText.textContent=e,this.input.setAttribute("aria-valuetext",e);const i=this.values.length===1?100:t/(this.values.length-1)*100;this.element.style.setProperty("--ui-slider-pct",`${i}%`)}buildEnds(){const t=document.createElement("div");t.className="ui-slider-ends",t.setAttribute("aria-hidden","true");for(const e of[0,this.values.length-1]){const i=document.createElement("span");i.textContent=this.labelAt(e),t.appendChild(i)}return t}labelAt(t){return this.options.labels?.[t]??this.values[t]??""}displayAt(t){const e=this.labelAt(t);return this.options.unit===void 0?e:`${e} ${this.options.unit}`}}const w={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"}},E=w.fontFamily.sans.join(", "),Oi=`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c={HANDSHAKE:"handshake",SESSION:"session",MUTATION:"mutation",STATE:"state",LOADING_INDICATOR:"loading_indicator",CAMERA:"camera",SNAPSHOT:"snapshot",MAPPING:"mapping",AR_ACTIVATE:"ar_activate",FULLSCREEN:"fullscreen",CONFIG:"config",ANNOTATION_TOGGLE:"annotation_toggle",FOCUS:"focus",PRICING:"pricing",QR_SHOWN:"qr_shown",SYNC:"sync",SELECTABLE:"selectable",APP_RESOLVED:"app_resolved"},O="main",tt={FOCUS:"focus",UNFOCUS:"unfocus"},Dt={FOCUSED:"focused"},$t={HIDDEN:"hidden"},Bt=new Set(Object.values(c));function Ut(n){if(typeof n!="object"||n===null)return!1;const t=n;return typeof t.target=="string"?!1:typeof t.type=="string"&&Bt.has(t.type)}function Vt(n){const t=w(n);return t!==null&&t.type===c.HANDSHAKE}function jt(n){const t=w(n);return t!==null&&t.type===c.SESSION&&typeof t.sessionId=="string"}function Ht(n){const t=w(n);return t!==null&&t.type===c.APP_RESOLVED&&typeof t.appType=="string"&&t.appType!==""&&typeof t.name=="string"}function qt(n){const t=w(n);return t!==null&&t.type===c.MUTATION&&typeof t.instance=="string"&&t.instance!==""&&Array.isArray(t.results)}function Gt(n){const t=w(n);return t!==null&&t.type===c.SNAPSHOT&&("data"in t||"error"in t)}function Zt(n){const t=w(n);return t!==null&&t.type===c.CAMERA&&Array.isArray(t.transforms)}function Wt(n){const t=w(n);return t!==null&&t.type===c.MAPPING&&typeof t.instance=="string"&&t.instance!==""&&Array.isArray(t.attributes)}function Qt(n){const t=w(n);return t!==null&&t.type===c.LOADING_INDICATOR&&typeof t.progress=="number"}function Yt(n){const t=w(n);return t!==null&&t.type===c.SYNC&&typeof t.connected=="boolean"}function Kt(n){const t=w(n);return t!==null&&t.type===c.SELECTABLE&&typeof t.instance=="string"&&t.instance!==""&&Array.isArray(t.attributes)}function Xt(n){const t=w(n);return t!==null&&t.type===c.CONFIG&&typeof t.viewerSettings=="object"}function Jt(n){const t=w(n);return t!==null&&t.type===c.FOCUS&&typeof t.instance=="string"&&t.instance!==""&&typeof t.state=="string"}function te(n){const t=w(n);return t!==null&&t.type===c.PRICING&&typeof t.instance=="string"&&t.instance!==""&&typeof t.pricing=="object"&&t.pricing!==null}function w(n){return typeof n!="object"||n===null?null:n}class et{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 ee{constructor(t,e){this.getTarget=t,this.sourceId=`vd-${Math.random().toString(36).slice(2,8)}`,this.targetOrigin="*",this.isValid=e?.isValid??Ut,this.publisher=new et(i=>this.post(i)),this.consumer=new et(i=>this.routeToHandler(i)),e?.bufferIncoming!==!0&&this.consumer.markReady()}getTarget;handlers=new Map;publisher;consumer;listener=null;sourceId;targetOrigin;isValid;on(t,e){this.handlers.set(t,e)}setTargetOrigin(t){this.targetOrigin=t}send(t){this.publisher.enqueue(t)}receive(t){this.isValid(t)&&this.consumer.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(!this.isValid(e)||e._source===this.sourceId)return;const i=this.getTarget();if(i!==null&&t.source!==null&&t.source!==i)return;const o=e;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()}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,e){this.send=t,this.instance=e}send;instance;setEnabled(t){this.send({type:c.ANNOTATION_TOGGLE,instance:this.instance,enabled:t})}}class ft{constructor(t,e){this.value=t,this.attribute=e}value;attribute;isSelectedValue=!1;get isSelected(){return this.isSelectedValue}setSelected(t){this.isSelectedValue=t}}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 b extends Error{code;constructor(t,e){super(t),this.name="VirtualdisplayError",this.code=e}static valueNotFound(t,e){return new b(`Value "${e}" not found for attribute "${t}"`,_.VALUE_NOT_FOUND)}static parentNotFound(t){return new b(`Parent element not found: ${t}`,_.PARENT_NOT_FOUND)}static invalidParameter(t){return new b(t,_.INVALID_PARAMETER)}}class gt{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 b.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 ft(i,this.name);i===this.defaultValue&&o.setSelected(!0),e.set(i,o)}return e}}class ne{attributes=new Map;constructor(t,e,i){for(const o of t){const s=this.buildOptions(o,e);this.attributes.set(o.name,new gt(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}}const L=4096,F=16384,ie=[1024,256,64],oe=20,W=["timestamp","level","msg","service","trace_id","span_id"];function se(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=Object.entries(n).filter(([r])=>!W.includes(r)).map(([r,a])=>`${r}=${I(a,L).line}`).join(" ");return`${t} ${e} [${i}] ${o}${s?" "+s:""}`}function re(n){for(const o of[L,...ie]){const{line:s,truncated:r}=I(n,o);if(!r){if(s.length<=F)return s;continue}const{line:a}=I({...n,log_truncated:!0},o);if(a.length<=F)return a}const t=Object.keys(n).filter(o=>!W.includes(o)),e={...le(n,W),log_truncated:!0,log_dropped_count:t.length},i=I({...e,log_dropped_attrs:t.slice(0,oe)},L);return i.line.length<=F?i.line:I(e,L).line}function I(n,t){const e=[];let i=!1;return{line:JSON.stringify(n,function(r,a){if(typeof a=="string")return a.length>t&&(i=!0),ae(a,t);if(typeof a=="bigint")return a.toString();if(typeof a!="object"||a===null)return a;for(;e.length>0&&e.at(-1)!==this;)e.pop();return e.includes(a)?"[Circular]":(e.push(a),a)}),truncated:i}}function ae(n,t){return n.length<=t?n:`${n.slice(0,t)}...[truncated ${n.length-t} chars]`}function le(n,t){const e={};for(const i of t)n[i]!==void 0&&(e[i]=n[i]);return e}function ce(n,t){const e=t?se(n):re(n);n.level==="error"?console.error(e):n.level==="warn"?console.warn(e):console.log(e)}function bt(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?bt(n.cause,t+1):String(n.cause)),e}function ue(n){const t={};for(const[e,i]of Object.entries(n))t[e]=i instanceof Error?bt(i):i;return t}function de(){return new Date}function he(n){return n.toISOString()}function vt(){return typeof navigator>"u"?"":navigator.userAgent}function pe(){return typeof navigator>"u"?!1:navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1}function me(){return/iPhone|iPad|iPod/i.test(vt())||pe()}function fe(){return/Android/i.test(vt())}function ge(){return me()||fe()}class be{constructor(t){this.config=t}config;log(t,e,i={}){const o=this.config.traceProvider?.()??{},s={timestamp:he(de()),level:t,msg:e,service:this.config.service,...o,...ue(i)};ce(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)}}function yt(n,t){const e=t?.isDev!==void 0?t.isDev:typeof process<"u"?process.env.NODE_ENV!=="production":!0;return new be({service:n,isDev:e,traceProvider:t?.traceProvider})}function M(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 wt(n){return{debug:(t,e)=>n.debug(t,M(e)),info:(t,e)=>n.info(t,M(e)),warn:(t,e)=>n.warn(t,M(e)),error:(t,e)=>n.error(t,M(e))}}let St=!1;exports.logger=wt(yt("client",{isDev:!1}));function Ct(){St=!0,exports.logger=wt(yt("client",{isDev:!0}))}function ve(){return St}class ye{constructor(t,e,i){this.send=t,this.instance=e,this.onMutationFailed=i}send;instance;onMutationFailed;registry;pendingCallbacks=[];handleMappingReceived(t){exports.logger.debug("Initializing from server mapping",{attributeCount:t.attributes.length}),this.registry=new ne(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)}selectTransient(t,e){this.sendMutation([{name:t,value:e}],!1,!0)}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()??{}}sendMutation(t,e,i=!1){const o={type:c.MUTATION,instance:this.instance,mutations:t,isInitial:e,...i&&{transient:!0}};this.send(o)}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}}class we{snapshot;callbacks=[];handleSnapshot(t){this.snapshot=t.attributes;for(const e of this.callbacks)e(t.attributes)}onChange(t){this.callbacks.push(t),this.snapshot!==void 0&&t(this.snapshot)}selectableFor(t){return this.snapshot?.find(i=>i.name===t)?.selectable??null}get current(){return this.snapshot??[]}}let _t=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 b.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 b.invalidParameter(`${e}() requires a finite number, got ${String(t)}`)}reset(){const t={type:c.CAMERA,commands:[{action:"reset"}]};this.send(t)}};class Se{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)}}}function Ce(n,t){const e=n.filter(s=>_e(s,t));if(e.length===0)return;const i=Math.max(...e.map(nt)),o=e.filter(s=>nt(s)===i);return o.length===1?o[0]:void 0}function _e(n,t){return Object.entries(n.attributes).every(([e,i])=>t[e]===i)}function nt(n){return Object.keys(n.attributes).length}class kt{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===$t.HIDDEN))return{attributes:{...this.selection},reference:t.reference,price:t.priceCents,currency:this.pricing.currency,availability:t.availability}}}class At{constructor(t,e,i){this.send=t,this.dispatch=e,this.instance=i}send;dispatch;instance;focused=null;attributes=[];changeCallbacks=[];get current(){return this.focused}set(t){if(typeof t!="string"||t.length===0)throw b.invalidParameter(`set() requires a non-empty component name, got ${String(t)}`);this.send({type:c.FOCUS,instance:this.instance,action:tt.FOCUS,component:t})}clear(){this.send({type:c.FOCUS,instance:this.instance,action:tt.UNFOCUS})}onChange(t){this.changeCallbacks.push(t)}handleStateReceived(t){t.state===Dt.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)}}class Et{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())}}const it=3e4;class xt{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 Et(t),i=setTimeout(()=>{this.pendingPhotos.delete(t),exports.logger.warn("Snapshot timed out",{filename:t}),e.fail(new b(`Snapshot timed out: the viewer did not respond within ${it}ms`,_.SNAPSHOT_FAILED))},it);return this.pendingPhotos.set(t,{photo:e,timeout:i}),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}clearTimeout(e.timeout),this.pendingPhotos.delete(t.filename);const{photo:i}=e;if(t.error!==void 0){i.fail(new b(t.error,_.SNAPSHOT_FAILED));return}t.data!==void 0&&i.develop({filename:t.filename,data:t.data})}clear(){if(this.pendingPhotos.size===0)return;const t=new b("Client destroyed before snapshot completed",_.SNAPSHOT_FAILED);for(const{photo:e,timeout:i}of this.pendingPhotos.values())clearTimeout(i),e.fail(t);this.pendingPhotos.clear()}validateFilename(t){if(t===""||typeof t!="string")throw new b("Filename must be a non-empty string",_.INVALID_PARAMETER);if(!this.validExtensions.some(i=>t.toLowerCase().endsWith(i)))throw new b(`Invalid filename: "${t}". Filename must end with one of: ${this.validExtensions.join(", ")}`,_.INVALID_PARAMETER);if(t.includes("..")||t.includes("/")||t.includes("\\"))throw new b('Filename cannot contain path separators or ".."',_.INVALID_PARAMETER)}}class ke{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 Ae={},Ee="en",Tt=["en","nl","de"],K=["baseLocale"],ot=[],Q=typeof window>"u";globalThis.__paraglide=globalThis.__paraglide??{};globalThis.__paraglide.ssr=globalThis.__paraglide.ssr??{};let st=!1,p=()=>{let n=K;!Q&&typeof window<"u"&&window.location?.href&&(n=It(window.location.href));const t=xe(n);if(t)return st||(st=!0,Rt(t,{reload:!1})),t;throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found")};function xe(n,t){let e;for(const i of n){if(i==="baseLocale")e=Ee;else if(Ot(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 Ie(r)}}const o=X(e);if(o)return o}}const Te=n=>{window.location.reload()};let Rt=(n,t)=>{const e={reload:!0,...t};let i;try{i=p()}catch{}const o=[];let s=K;!Q&&typeof window<"u"&&window.location?.href&&(s=It(window.location.href));for(const a of s)if(a!=="baseLocale"&&Ot(a)&&N.has(a)){const u=N.get(a);if(u){let d=u.setLocale(n);d instanceof Promise&&(d=d.catch(f=>{throw new Error(`Custom strategy "${a}" setLocale failed.`,{cause:f})}),o.push(d))}}const r=()=>{!Q&&e.reload&&window.location&&n!==i&&Te()};if(o.length)return Promise.all(o).then(()=>{r()});r()},Re=()=>typeof window<"u"?window.location.origin:"http://fallback.com";function X(n){if(typeof n!="string")return;const t=n.toLowerCase();for(const e of Tt)if(e.toLowerCase()===t)return e}function Ie(n){const t=X(n);if(t)return t;throw new Error(`Invalid locale: ${n}. Expected one of: ${Tt.join(", ")}`)}function Oe(n){return Me(n)}function Me(n){const t=typeof n=="string"?new URL(n,Re()):new URL(n),e=t.pathname.split("/").filter(Boolean);return e.length>0&&X(e[0])&&(t.pathname="/"+e.slice(1).join("/")),t}let rt,at;function Le(n){if(ot.length===0)return;const t=typeof n=="string"?n:n.href;if(rt===t)return at;const e=new URL(t,"http://example.com"),i=Oe(e),o=i.href===e.href?[e]:[e,i];let s;for(const r of o){for(const a of ot)if(new Ae(a.match,r.href).exec(r.href)){s=a;break}if(s)break}return rt=t,at=s,s}function It(n){const t=Le(n);return t&&t.exclude!==!0&&Array.isArray(t.strategy)?t.strategy:K}const N=new Map;function Ot(n){return typeof n=="string"&&/^custom-[A-Za-z0-9_-]+$/.test(n)}const Ne=()=>"Activate AR",ze=()=>"AR activeren",Pe=()=>"AR aktivieren",Fe=((n={},t={})=>{const e=t.locale??p();return e==="nl"?ze():e==="de"?Pe():Ne()}),De=()=>"Scan to view in AR",$e=()=>"Scan om in AR te bekijken",Be=()=>"Scannen für AR-Ansicht",Ue=((n={},t={})=>{const e=t.locale??p();return e==="nl"?$e():e==="de"?Be():De()}),Ve=()=>"Use your smartphone camera to scan this QR code",je=()=>"Gebruik de camera van je smartphone om deze QR-code te scannen",He=()=>"Verwende die Kamera deines Smartphones, um diesen QR-Code zu scannen",qe=((n={},t={})=>{const e=t.locale??p();return e==="nl"?je():e==="de"?He():Ve()}),Ge=()=>"Your phone will open the 3D model in AR mode.",Ze=()=>"Je telefoon opent het 3D-model in AR-modus.",We=()=>"Dein Telefon öffnet das 3D-Modell im AR-Modus.",Qe=((n={},t={})=>{const e=t.locale??p();return e==="nl"?Ze():e==="de"?We():Ge()}),Ye=()=>"Close",Ke=()=>"Sluiten",Xe=()=>"Schließen",Je=((n={},t={})=>{const e=t.locale??p();return e==="nl"?Ke():e==="de"?Xe():Ye()}),tn=()=>"Annotations",en=()=>"Annotaties",nn=()=>"Anmerkungen",on=((n={},t={})=>{const e=t.locale??p();return e==="nl"?en():e==="de"?nn():tn()}),sn=()=>"Fullscreen",rn=()=>"Volledig scherm",an=()=>"Vollbild",ln=((n={},t={})=>{const e=t.locale??p();return e==="nl"?rn():e==="de"?an():sn()}),cn=()=>"Downloading",un=()=>"Downloaden",dn=()=>"Herunterladen",hn=((n={},t={})=>{const e=t.locale??p();return e==="nl"?un():e==="de"?dn():cn()}),pn=()=>"Screenshot",mn=()=>"Screenshot",fn=()=>"Screenshot",gn=((n={},t={})=>{const e=t.locale??p();return e==="nl"?mn():e==="de"?fn():pn()}),bn=()=>"Configure",vn=()=>"Configureren",yn=()=>"Konfigurieren",wn=((n={},t={})=>{const e=t.locale??p();return e==="nl"?vn():e==="de"?yn():bn()}),Sn=()=>"Close",Cn=()=>"Sluiten",_n=()=>"Schließen",kn=((n={},t={})=>{const e=t.locale??p();return e==="nl"?Cn():e==="de"?_n():Sn()}),An=()=>"Reset camera",En=()=>"Camera resetten",xn=()=>"Kamera zurücksetzen",Tn=((n={},t={})=>{const e=t.locale??p();return e==="nl"?En():e==="de"?xn():An()}),Rn=()=>"Zoom in",In=()=>"Inzoomen",On=()=>"Hineinzoomen",Mn=((n={},t={})=>{const e=t.locale??p();return e==="nl"?In():e==="de"?On():Rn()}),Ln=()=>"Zoom out",Nn=()=>"Uitzoomen",zn=()=>"Herauszoomen",Pn=((n={},t={})=>{const e=t.locale??p();return e==="nl"?Nn():e==="de"?zn():Ln()}),Fn=()=>"Rotate left",Dn=()=>"Naar links draaien",$n=()=>"Nach links drehen",Bn=((n={},t={})=>{const e=t.locale??p();return e==="nl"?Dn():e==="de"?$n():Fn()}),Un=()=>"Rotate right",Vn=()=>"Naar rechts draaien",jn=()=>"Nach rechts drehen",Hn=((n={},t={})=>{const e=t.locale??p();return e==="nl"?Vn():e==="de"?jn():Un()}),qn=()=>"Tilt up",Gn=()=>"Omhoog kantelen",Zn=()=>"Nach oben kippen",Wn=((n={},t={})=>{const e=t.locale??p();return e==="nl"?Gn():e==="de"?Zn():qn()}),Qn=()=>"Tilt down",Yn=()=>"Omlaag kantelen",Kn=()=>"Nach unten kippen",Xn=((n={},t={})=>{const e=t.locale??p();return e==="nl"?Yn():e==="de"?Kn():Qn()}),Jn=()=>"Working…",ti=()=>"Bezig…",ei=()=>"Läuft…",ni=((n={},t={})=>{const e=t.locale??p();return e==="nl"?ti():e==="de"?ei():Jn()}),ii=()=>"Done",oi=()=>"Gelukt",si=()=>"Fertig",ri=((n={},t={})=>{const e=t.locale??p();return e==="nl"?oi():e==="de"?si():ii()}),ai=()=>"Failed",li=()=>"Mislukt",ci=()=>"Fehlgeschlagen",ui=((n={},t={})=>{const e=t.locale??p();return e==="nl"?li():e==="de"?ci():ai()});const di={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 Mt=([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=Mt(o);i.appendChild(s)}),i},Lt=(n,t={})=>{const i={...di,...t};return Mt(["svg",i,n])};const hi=[["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 pi=[["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 Nt=[["path",{d:"m6 9 6 6 6-6"}]];const mi=[["path",{d:"m15 18-6-6 6-6"}]];const fi=[["path",{d:"m9 18 6-6-6-6"}]];const gi=[["path",{d:"m18 15-6-6-6 6"}]];const bi=[["path",{d:"M12.75 7.09a3 3 0 0 1 2.16 2.16"}],["path",{d:"M17.072 17.072c-1.634 2.17-3.527 3.912-4.471 4.727a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 1.432-4.568"}],["path",{d:"m2 2 20 20"}],["path",{d:"M8.475 2.818A8 8 0 0 1 20 10c0 1.183-.31 2.377-.81 3.533"}],["path",{d:"M9.13 9.13a3 3 0 0 0 3.74 3.74"}]];const vi=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0"}],["circle",{cx:"12",cy:"10",r:"3"}]];const yi=[["path",{d:"M15 3h6v6"}],["path",{d:"m21 3-7 7"}],["path",{d:"m3 21 7-7"}],["path",{d:"M9 21H3v-6"}]];const wi=[["path",{d:"m14 10 7-7"}],["path",{d:"M20 10h-6V4"}],["path",{d:"m3 21 7-7"}],["path",{d:"M4 14h6v6"}]];const Si=[["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 Ci=[["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 _i=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];const ki=[["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 Ai=[["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 v(n,{size:t=20,strokeWidth:e=1.75}={}){return Lt(n,{width:t,height:t,"stroke-width":e})}const g={ar:n=>v(hi,n),annotations:n=>v(vi,n),annotationsOff:n=>v(bi,n),fullscreen:n=>v(yi,n),exitFullscreen:n=>v(wi,n),screenshot:n=>v(pi,n),tiltUp:n=>v(gi,n),tiltDown:n=>v(Nt,n),rotateLeft:n=>v(mi,n),rotateRight:n=>v(fi,n),zoomIn:n=>v(ki,n),zoomOut:n=>v(Ai,n),reset:n=>v(Si,n),configurator:n=>v(Ci,n),close:n=>v(_i,n)};class y{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"},l={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"};class Ei{element;constructor(){this.element=document.createElement("div"),Object.assign(this.element.style,{background:m.white,borderRadius:l[3],padding:l[6],boxShadow:`0 ${l[2]} ${l[8]} oklch(0% 0 0 / 20%)`,maxWidth:"20rem",width:"100%"})}}class xi{constructor(t={}){this.options=t,this.card=new Ei,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:l[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 Ti{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}setEnabled(t){for(const e of this.element.querySelectorAll(".ui-toggle-group-item")){const i=t===null||t.includes(e.dataset.value??"");e.disabled=!i,e.setAttribute("aria-disabled",i?"false":"true")}}}class Ri{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 a=!1;for(let d=0;d<e.length;d++){const f=e[d],h=document.createElement("option");h.value=f,h.textContent=s?.[d]??f,f===o&&(h.selected=!0,a=!0),this.select.appendChild(h)}a||(r.selected=!0);const u=Lt(Nt,{width:16,height:16,"stroke-width":2});u.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(u)}setSelected(t){this.select.value=t}onSelect(t){this.select.addEventListener("change",()=>{t(this.select.value)})}setEnabled(t){for(const e of this.select.options)e.value!==""&&(e.disabled=t!==null&&!t.includes(e.value))}}class Ii{element;input;valueText;values;options;selectCallback=null;settleCallback=null;constructor(t,e){if(t.length===0)throw new Error("Virtualdisplay: Slider needs at least one value");this.values=t,this.options=e,this.input=document.createElement("input"),this.input.type="range",this.input.className="ui-slider-input",this.input.min="0",this.input.max=String(t.length-1),this.input.step="1",this.input.setAttribute("aria-label",e.label),this.valueText=document.createElement("span"),this.valueText.className="ui-slider-value",this.valueText.setAttribute("aria-hidden","true");const i=document.createElement("div");i.className="ui-slider-track",i.appendChild(this.input),i.appendChild(this.buildEnds()),this.element=document.createElement("div"),this.element.className="ui-slider",this.element.appendChild(i),this.element.appendChild(this.valueText);const o=e.initialSelected===void 0?0:t.indexOf(e.initialSelected);this.applyIndex(o===-1?0:o),this.listen()}setSelected(t){const e=this.values.indexOf(t);e!==-1&&this.applyIndex(e)}onSelect(t){this.selectCallback=t}onSettle(t){this.settleCallback=t}listen(){this.input.addEventListener("input",()=>{const t=this.values[this.currentIndex];t!==void 0&&(this.applyIndex(this.currentIndex),this.selectCallback?.(t))}),this.input.addEventListener("change",()=>{const t=this.values[this.currentIndex];t!==void 0&&this.settleCallback?.(t)})}get currentIndex(){return Number(this.input.value)}applyIndex(t){this.input.value=String(t);const e=this.displayAt(t);this.valueText.textContent=e,this.input.setAttribute("aria-valuetext",e);const i=this.values.length===1?100:t/(this.values.length-1)*100;this.element.style.setProperty("--ui-slider-pct",`${i}%`)}buildEnds(){const t=document.createElement("div");t.className="ui-slider-ends",t.setAttribute("aria-hidden","true");for(const e of[0,this.values.length-1]){const i=document.createElement("span");i.textContent=this.labelAt(e),t.appendChild(i)}return t}labelAt(t){return this.options.labels?.[t]??this.values[t]??""}displayAt(t){const e=this.labelAt(t);return this.options.unit===void 0?e:`${e} ${this.options.unit}`}}const S={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"}},E=S.fontFamily.sans.join(", "),Oi=`
|
|
2
2
|
--primary: oklch(5% 0 0);
|
|
3
3
|
--primary-foreground: oklch(100% 0 0);
|
|
4
4
|
--secondary: oklch(92% 0 0);
|
|
@@ -284,6 +284,11 @@
|
|
|
284
284
|
border: 1px solid var(--border);
|
|
285
285
|
border-radius: var(--radius);
|
|
286
286
|
padding: 0.75rem 1rem;
|
|
287
|
+
/* The popup is absolutely positioned inside the ~28px marker anchor, so
|
|
288
|
+
without an explicit width it shrink-to-fits against that anchor and
|
|
289
|
+
collapses to one word per line. max-content sizes it by its own text,
|
|
290
|
+
capped below. */
|
|
291
|
+
inline-size: max-content;
|
|
287
292
|
max-inline-size: 15rem;
|
|
288
293
|
box-shadow: 0 4px 6px oklch(5% 0 0 / 8%), 0 2px 4px oklch(5% 0 0 / 6%);
|
|
289
294
|
pointer-events: auto;
|
|
@@ -291,6 +296,13 @@
|
|
|
291
296
|
}
|
|
292
297
|
.vd-annotation-popup:focus { outline: none; }
|
|
293
298
|
|
|
299
|
+
/* Flipped below the marker when the popup would clip the container's top
|
|
300
|
+
edge; the layer positions it at open time and on the render cadence. */
|
|
301
|
+
.vd-annotation-popup--below {
|
|
302
|
+
inset-block-end: auto;
|
|
303
|
+
inset-block-start: calc(100% + 0.5rem);
|
|
304
|
+
}
|
|
305
|
+
|
|
294
306
|
.vd-annotation-popup-close {
|
|
295
307
|
position: absolute;
|
|
296
308
|
inset-block-start: 0.375rem;
|
|
@@ -327,9 +339,12 @@
|
|
|
327
339
|
}
|
|
328
340
|
}
|
|
329
341
|
|
|
342
|
+
/* Opacity only: the layer sets the popup's transform inline to clamp it
|
|
343
|
+
inside the container, and a keyframe animating transform would override
|
|
344
|
+
that for its duration and make the popup jump at the end. */
|
|
330
345
|
@keyframes vd-popup-in {
|
|
331
|
-
from { opacity: 0;
|
|
332
|
-
to { opacity: 1;
|
|
346
|
+
from { opacity: 0; }
|
|
347
|
+
to { opacity: 1; }
|
|
333
348
|
}
|
|
334
349
|
|
|
335
350
|
.vd-annotation-popup-title {
|
|
@@ -381,7 +396,7 @@
|
|
|
381
396
|
0%, 100% { opacity: 1; }
|
|
382
397
|
50% { opacity: 0.55; }
|
|
383
398
|
}
|
|
384
|
-
`;let lt=!1;function zt(){if(lt||typeof document>"u")return;lt=!0;const n=document.createElement("style");n.id="vd-ui-vanilla",n.textContent=Mi,document.head.appendChild(n)}const Li=w.fontFamily.sans.join(", ");class Ni{qrLib=null;dialog=null;qrSlot=null;show(){this.hide(),zt(),this.dialog=new xi({onClose:()=>{this.dialog=null,this.qrSlot=null}}),Object.assign(this.dialog.card.element.style,{display:"flex",flexDirection:"column",alignItems:"center",gap:l[3],fontFamily:Li}),this.dialog.card.element.appendChild(this.createText(Ue(),{fontSize:w.fontSize.base,fontWeight:w.fontWeight.semibold,color:m.neutral[900]})),this.dialog.card.element.appendChild(this.createText(qe(),{fontSize:w.fontSize.sm,color:m.neutral[600]})),this.qrSlot=this.createQrSlot(),this.dialog.card.element.appendChild(this.qrSlot),this.dialog.card.element.appendChild(this.createText(Ye(),{fontSize:w.fontSize.xs,color:m.neutral[500]}));const t=new y({variant:"outline",label:Je(),onClick:()=>{this.hide()}});this.dialog.card.element.appendChild(t.element),this.dialog.open()}async update(t){this.qrLib??=await Promise.resolve().then(()=>require("./browser-DfB_An57.cjs")).then(i=>i.browser);const e=await this.qrLib.toDataURL(t,{width:256,margin:4,errorCorrectionLevel:"M",color:{dark:m.black,light:m.white}});return this.qrSlot===null?!1:(this.qrSlot.classList.remove("ui-qr-slot--loading"),this.qrSlot.replaceChildren(this.createQrImage(e)),!0)}hide(){this.dialog?.close(),this.dialog=null,this.qrSlot=null}createText(t,e){const i=document.createElement("p");return i.textContent=t,Object.assign(i.style,{margin:"0",textAlign:"center",...e}),i}createQrSlot(){const t=document.createElement("div");return t.className="ui-qr-slot ui-qr-slot--loading",t}createQrImage(t){const e=document.createElement("img");return e.src=t,e.alt="QR code",e}}function ct(n){const t=Math.max(0,Math.min(1,n));return t*t*(3-2*t)}function zi(n,t,e,i,o,s){const[r,a,u]=n,d=Math.cos(t),f=Math.sin(t),h=d*r+f*u,A=-f*r+d*u,k=Math.cos(e),C=Math.sin(e),R=k*a-C*A,P=C*a+k*A,J=.55;return[i+h*s*J,o-R*s*J,P]}function Pi(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 Fi(n,t,e,i,o){const s=t(e),r=t(i),a=[s[0]+(r[0]-s[0])*o,s[1]+(r[1]-s[1])*o,s[2]];Pi(n,s,a)}const D=[-1,-1,1],$=[1,-1,1],B=[1,-1,-1],U=[-1,-1,-1],V=[-1,1,1],j=[1,1,1],H=[1,1,-1],q=[-1,1,-1],ut=[[D,$],[$,B],[B,U],[U,D],[D,V],[$,j],[B,H],[U,q],[V,j],[j,H],[H,q],[q,V]],Di=400,dt='-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:dt});const o=document.createElement("span");return Object.assign(o.style,{fontSize:"13px",color:"#000",fontFamily:dt}),o.textContent=hn(),e.appendChild(i),e.appendChild(o),n.appendChild(t),n.appendChild(e),{overlay:n,canvas:t,pctEl:i,phaseEl:o}}class Bi{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??Di;this.showTimerId=setTimeout(()=>{this.reveal()},o)}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,a=.785,u=.615,d=C=>zi(C,a,u,o,s,r),f=6,h=i%f/f,A=ut.length;let k;h<.35?k=ct(h/.35)*A:h<.55?k=A:h<.9?k=(1-ct((h-.55)/.35))*A:k=0,this.ctx.shadowBlur=5,this.ctx.shadowColor="rgba(30,30,30,0.08)";for(let C=0;C<A&&!(C>=k);C++){const R=ut[C];if(R===void 0)continue;const P=Math.min(1,k-C);Fi(this.ctx,d,R[0],R[1],P)}this.ctx.shadowBlur=0}}class Ui{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;annotationsBtn=null;annotationsShown=!1;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 y({variant:"outline",size:"icon",label:Fe(),icon:g.ar(),onClick:()=>{this.options.onAr?.()}})),this.fullscreenBtn=this.syncButton(this.fullscreenBtn,t.fullscreen!==!1&&this.options.onFullscreen!==void 0,()=>new y({variant:"outline",size:"icon",label:ln(),icon:g.fullscreen(),onClick:()=>{this.options.onFullscreen?.()}}));const e=t.annotations==="toggle-shown"||t.annotations==="toggle-hidden";this.annotationsBtn=this.syncButton(this.annotationsBtn,e&&this.options.onAnnotationsToggle!==void 0,()=>{this.annotationsShown=t.annotations==="toggle-shown";const i=new y({variant:"outline",size:"icon",label:on(),icon:this.annotationsShown?g.annotations():g.annotationsOff(),onClick:()=>{this.flipAnnotations()}});return i.element.setAttribute("aria-pressed",String(this.annotationsShown)),i})}flipAnnotations(){this.annotationsShown=!this.annotationsShown,this.annotationsBtn?.element.setAttribute("aria-pressed",String(this.annotationsShown)),this.annotationsBtn?.setIcon(this.annotationsShown?g.annotations():g.annotationsOff()),this.options.onAnnotationsToggle?.(this.annotationsShown)}destroy(){document.removeEventListener("fullscreenchange",this.onFullscreenChange)}}const T=.5;class z{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=Vi(t,e,i);e.onChange(s=>{i.targetRotation=s.rotation-i.thetaOffset,i.targetTilt=s.tilt,i.targetZoom=s.zoom,ji(o,e,s)}),this.element.appendChild(z.buildZoom(o.zoomOut,o.zoomIn)),this.element.appendChild(z.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[a,u]of[[t,"up"],[e,"left"],[i,"center"],[o,"right"],[s,"down"]])a.element.classList.add(`vd-dpad-${u}`),r.appendChild(a.element);return r}}function Vi(n,t,e){const i=r=>Math.max(t.limits?.minZoom??1,Math.min(t.limits?.maxZoom??1/0,r)),o=r=>{const a=t.limits?.minRotate,u=t.limits?.maxRotate;return a!==void 0||u!==void 0?Math.max(a??-1/0,Math.min(u??1/0,r)):r},s=r=>{const a=t.limits?.minTilt,u=t.limits?.maxTilt;if(a!==void 0||u!==void 0){e.targetTilt=Math.max(a??0,Math.min(u??180,e.targetTilt+r)),n.tilt(e.targetTilt).set();return}const d=e.targetTilt+r;d>180||d<0?(e.targetTilt=d>180?360-d:-d,e.thetaOffset=(e.thetaOffset+180)%360,n.tilt(e.targetTilt).rotate(e.targetRotation+e.thetaOffset).set()):(e.targetTilt=d,n.tilt(e.targetTilt).set())};return{zoomOut:new y({variant:"outline",size:"icon",label:Pn(),icon:g.zoomOut(),onClick:()=>{e.targetZoom=i(e.targetZoom-10),n.zoom(e.targetZoom).set()}}),zoomIn:new y({variant:"outline",size:"icon",label:Mn(),icon:g.zoomIn(),onClick:()=>{e.targetZoom=i(e.targetZoom+10),n.zoom(e.targetZoom).set()}}),tiltUp:new y({variant:"outline",size:"icon",label:Wn(),icon:g.tiltUp(),onClick:()=>{s(-15)}}),rotateLeft:new y({variant:"outline",size:"icon",label:Bn(),icon:g.rotateLeft(),onClick:()=>{e.targetRotation=o(e.targetRotation-15),n.rotate(e.targetRotation+e.thetaOffset).set()}}),reset:new y({variant:"outline",size:"icon",label:Tn(),icon:g.reset(),onClick:()=>{e.thetaOffset=0,n.reset()}}),rotateRight:new y({variant:"outline",size:"icon",label:Hn(),icon:g.rotateRight(),onClick:()=>{e.targetRotation=o(e.targetRotation+15),n.rotate(e.targetRotation+e.thetaOffset).set()}}),tiltDown:new y({variant:"outline",size:"icon",label:Xn(),icon:g.tiltDown(),onClick:()=>{s(15)}})}}function ji(n,t,e){const i=t.limits;i!==void 0&&(n.zoomOut.element.disabled=i.minZoom!==void 0&&e.zoom<=i.minZoom+T,n.zoomIn.element.disabled=i.maxZoom!==void 0&&e.zoom>=i.maxZoom-T,n.tiltUp.element.disabled=i.minTilt!==void 0&&e.tilt<=i.minTilt+T,n.tiltDown.element.disabled=i.maxTilt!==void 0&&e.tilt>=i.maxTilt-T,n.rotateLeft.element.disabled=i.minRotate!==void 0&&e.rotation<=i.minRotate+T,n.rotateRight.element.disabled=i.maxRotate!==void 0&&e.rotation>=i.maxRotate-T)}const x={SELECT:"ui:select",SELECTED:"ui:selected",FOCUS_CHANGE:"vd:focus-change",CONFIGURATION_CHANGE:"vd:configuration-change",CONFIGURATION_SUBMIT:"vd:configuration-submit"},Pt={mm:1,cm:10,m:1e3,in:25.4},ht=3;function Hi(n){const t=n.stepMm/Pt[n.displayUnit];for(let e=0;e<=ht;e++){const i=t*10**e;if(Math.abs(i-Math.round(i))<1e-9)return e}return ht}function qi(n,t,e){const i=Hi(t),o=n/Pt[t.displayUnit];return new Intl.NumberFormat(e,{minimumFractionDigits:i,maximumFractionDigits:i}).format(o)}function Gi(n,t,e,i,o,s,r){const a=p(),u=n.values.map(h=>qi(Number(h),t,a)),d=n.values.find(h=>e.getValue(n.name,h)?.isSelected===!0)??n.defaultValue,f=new Ii(n.values,{label:n.name,labels:u,unit:t.displayUnit,...d!==void 0&&{initialSelected:d}});return f.onSelect(h=>{o(n.name,h)}),f.onSettle(h=>{i.dispatch(x.SELECT,{attribute:n.name,value:h},!0).defaultPrevented||s(n.name,h)}),r(n.name,h=>{f.setSelected(h.value),i.dispatch(x.SELECTED,{attribute:n.name,value:h.value})}),{element:f.element,setSelectable:()=>{}}}const Zi=5;let Wi=0;function Q(n){const t=n.replace(/([A-Z])/g," $1").trim();return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function Yi(n,t,e,i,o,s){const r=document.createElement("div");r.className="vd-attribute",r.dataset.name=n.name;const a=document.createElement("span");a.className="vd-attribute-label",a.textContent=Q(n.name),a.id=`vd-attribute-label-${Wi++}`,r.appendChild(a),r.setAttribute("role","group"),r.setAttribute("aria-labelledby",a.id);const u=f=>{r.style.display=f?"none":""},d=n.dimension!==void 0?Gi(n,n.dimension,t,e,o,i,s):Qi(n,t,e,i,s);return r.appendChild(d.element),{element:r,setSelectable:d.setSelectable,setHidden:u}}function Qi(n,t,e,i,o){const s=n.values.find(u=>t.getValue(n.name,u)?.isSelected===!0),r=n.values.map(Q),a=n.values.length<=Zi?new Ti(n.values,s,r):new Ri(n.name,n.values,Q(n.name),s,r);return a.onSelect(u=>{e.dispatch(x.SELECT,{attribute:n.name,value:u},!0).defaultPrevented||i(n.name,u)}),o(n.name,u=>{a.setSelected(u.value),e.dispatch(x.SELECTED,{attribute:n.name,value:u.value})}),{element:a.element,setSelectable:u=>{a.setEnabled(u)}}}const Ki=80,Xi=2500;class Ji{constructor(t,e=Xi){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 y({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=to(t.price,t.currency),this.vatEl.textContent=pt(this.configuration.vatDisplay)}renderButton(){const t=this.configuration.submitEnabled;this.button.element.classList.toggle("vd-hidden",!t),t&&this.state==="idle"&&this.setButtonText(pt(this.configuration.buttonLabel))}async handleSubmit(){if(this.state!=="busy"){this.setState("busy",ni());try{await this.configuration.submit(),this.setState("success",ri())}catch{this.setState("failed",ui())}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 pt(n){return(n??"").slice(0,Ki)}function to(n,t){try{const e=new Intl.NumberFormat(p(),{style:"currency",currency:t}),i=e.resolvedOptions().maximumFractionDigits??2;return e.format(n/10**i)}catch{return`${t} ${(n/100).toFixed(2)}`}}class Ft{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 eo=572;class no{constructor(t){this.actionBarSlot=t}actionBarSlot;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 y({variant:"ghost",size:"icon-sm",label:kn(),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 y({variant:"outline",size:"icon",label:Sn(),icon:g.configurator({size:18}),onClick:()=>{this.expanded=!0,this.render()}}),this.openButton.element.classList.add("vd-configurator-toggle","vd-hidden"),this.actionBarSlot.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","vd-layout-sidebar-permanent"),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<eo)}),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,e=this.visible&&!this.expanded;this.element.classList.toggle("vd-hidden",!this.visible),this.element.classList.toggle("vd-sidebar-collapsed",e),this.openButton.element.classList.toggle("vd-hidden",!e),this.closeButton.element.style.display=this.collapsible?"":"none",this.container.classList.toggle("vd-layout-sidebar-right",t),this.container.classList.toggle("vd-layout-sidebar-permanent",t&&!this.collapsible)}}class io{attach(t,e){}setVisible(t){}destroy(){}}const oo={"inframe-bottom-left":()=>new Ft,"sidebar-right":n=>new no(n),hidden:()=>new io};function so(n,t){return(oo[n??""]??(()=>new Ft))(t)}const G=w.fontFamily.sans.join(", "),Z=`
|
|
399
|
+
`;let lt=!1;function zt(){if(lt||typeof document>"u")return;lt=!0;const n=document.createElement("style");n.id="vd-ui-vanilla",n.textContent=Mi,document.head.appendChild(n)}const Li=S.fontFamily.sans.join(", ");class Ni{qrLib=null;dialog=null;qrSlot=null;show(){this.hide(),zt(),this.dialog=new xi({onClose:()=>{this.dialog=null,this.qrSlot=null}}),Object.assign(this.dialog.card.element.style,{display:"flex",flexDirection:"column",alignItems:"center",gap:l[3],fontFamily:Li}),this.dialog.card.element.appendChild(this.createText(Ue(),{fontSize:S.fontSize.base,fontWeight:S.fontWeight.semibold,color:m.neutral[900]})),this.dialog.card.element.appendChild(this.createText(qe(),{fontSize:S.fontSize.sm,color:m.neutral[600]})),this.qrSlot=this.createQrSlot(),this.dialog.card.element.appendChild(this.qrSlot),this.dialog.card.element.appendChild(this.createText(Qe(),{fontSize:S.fontSize.xs,color:m.neutral[500]}));const t=new y({variant:"outline",label:Je(),onClick:()=>{this.hide()}});this.dialog.card.element.appendChild(t.element),this.dialog.open()}async update(t){this.qrLib??=await Promise.resolve().then(()=>require("./browser-DfB_An57.cjs")).then(i=>i.browser);const e=await this.qrLib.toDataURL(t,{width:256,margin:4,errorCorrectionLevel:"M",color:{dark:m.black,light:m.white}});return this.qrSlot===null?!1:(this.qrSlot.classList.remove("ui-qr-slot--loading"),this.qrSlot.replaceChildren(this.createQrImage(e)),!0)}hide(){this.dialog?.close(),this.dialog=null,this.qrSlot=null}createText(t,e){const i=document.createElement("p");return i.textContent=t,Object.assign(i.style,{margin:"0",textAlign:"center",...e}),i}createQrSlot(){const t=document.createElement("div");return t.className="ui-qr-slot ui-qr-slot--loading",t}createQrImage(t){const e=document.createElement("img");return e.src=t,e.alt="QR code",e}}function ct(n){const t=Math.max(0,Math.min(1,n));return t*t*(3-2*t)}function zi(n,t,e,i,o,s){const[r,a,u]=n,d=Math.cos(t),f=Math.sin(t),h=d*r+f*u,A=-f*r+d*u,k=Math.cos(e),C=Math.sin(e),R=k*a-C*A,P=C*a+k*A,J=.55;return[i+h*s*J,o-R*s*J,P]}function Pi(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 Fi(n,t,e,i,o){const s=t(e),r=t(i),a=[s[0]+(r[0]-s[0])*o,s[1]+(r[1]-s[1])*o,s[2]];Pi(n,s,a)}const D=[-1,-1,1],$=[1,-1,1],B=[1,-1,-1],U=[-1,-1,-1],V=[-1,1,1],j=[1,1,1],H=[1,1,-1],q=[-1,1,-1],ut=[[D,$],[$,B],[B,U],[U,D],[D,V],[$,j],[B,H],[U,q],[V,j],[j,H],[H,q],[q,V]],Di=400,dt='-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:dt});const o=document.createElement("span");return Object.assign(o.style,{fontSize:"13px",color:"#000",fontFamily:dt}),o.textContent=hn(),e.appendChild(i),e.appendChild(o),n.appendChild(t),n.appendChild(e),{overlay:n,canvas:t,pctEl:i,phaseEl:o}}class Bi{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??Di;this.showTimerId=setTimeout(()=>{this.reveal()},o)}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,a=.785,u=.615,d=C=>zi(C,a,u,o,s,r),f=6,h=i%f/f,A=ut.length;let k;h<.35?k=ct(h/.35)*A:h<.55?k=A:h<.9?k=(1-ct((h-.55)/.35))*A:k=0,this.ctx.shadowBlur=5,this.ctx.shadowColor="rgba(30,30,30,0.08)";for(let C=0;C<A&&!(C>=k);C++){const R=ut[C];if(R===void 0)continue;const P=Math.min(1,k-C);Fi(this.ctx,d,R[0],R[1],P)}this.ctx.shadowBlur=0}}class Ui{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;annotationsBtn=null;annotationsShown=!1;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 y({variant:"outline",size:"icon",label:Fe(),icon:g.ar(),onClick:()=>{this.options.onAr?.()}})),this.fullscreenBtn=this.syncButton(this.fullscreenBtn,t.fullscreen!==!1&&this.options.onFullscreen!==void 0,()=>new y({variant:"outline",size:"icon",label:ln(),icon:g.fullscreen(),onClick:()=>{this.options.onFullscreen?.()}}));const e=t.annotations==="toggle-shown"||t.annotations==="toggle-hidden";this.annotationsBtn=this.syncButton(this.annotationsBtn,e&&this.options.onAnnotationsToggle!==void 0,()=>{this.annotationsShown=t.annotations==="toggle-shown";const i=new y({variant:"outline",size:"icon",label:on(),icon:this.annotationsShown?g.annotations():g.annotationsOff(),onClick:()=>{this.flipAnnotations()}});return i.element.setAttribute("aria-pressed",String(this.annotationsShown)),i})}flipAnnotations(){this.annotationsShown=!this.annotationsShown,this.annotationsBtn?.element.setAttribute("aria-pressed",String(this.annotationsShown)),this.annotationsBtn?.setIcon(this.annotationsShown?g.annotations():g.annotationsOff()),this.options.onAnnotationsToggle?.(this.annotationsShown)}destroy(){document.removeEventListener("fullscreenchange",this.onFullscreenChange)}}const T=.5;class z{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=Vi(t,e,i);e.onChange(s=>{i.targetRotation=s.rotation-i.thetaOffset,i.targetTilt=s.tilt,i.targetZoom=s.zoom,ji(o,e,s)}),this.element.appendChild(z.buildZoom(o.zoomOut,o.zoomIn)),this.element.appendChild(z.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[a,u]of[[t,"up"],[e,"left"],[i,"center"],[o,"right"],[s,"down"]])a.element.classList.add(`vd-dpad-${u}`),r.appendChild(a.element);return r}}function Vi(n,t,e){const i=r=>Math.max(t.limits?.minZoom??1,Math.min(t.limits?.maxZoom??1/0,r)),o=r=>{const a=t.limits?.minRotate,u=t.limits?.maxRotate;return a!==void 0||u!==void 0?Math.max(a??-1/0,Math.min(u??1/0,r)):r},s=r=>{const a=t.limits?.minTilt,u=t.limits?.maxTilt;if(a!==void 0||u!==void 0){e.targetTilt=Math.max(a??0,Math.min(u??180,e.targetTilt+r)),n.tilt(e.targetTilt).set();return}const d=e.targetTilt+r;d>180||d<0?(e.targetTilt=d>180?360-d:-d,e.thetaOffset=(e.thetaOffset+180)%360,n.tilt(e.targetTilt).rotate(e.targetRotation+e.thetaOffset).set()):(e.targetTilt=d,n.tilt(e.targetTilt).set())};return{zoomOut:new y({variant:"outline",size:"icon",label:Pn(),icon:g.zoomOut(),onClick:()=>{e.targetZoom=i(e.targetZoom-10),n.zoom(e.targetZoom).set()}}),zoomIn:new y({variant:"outline",size:"icon",label:Mn(),icon:g.zoomIn(),onClick:()=>{e.targetZoom=i(e.targetZoom+10),n.zoom(e.targetZoom).set()}}),tiltUp:new y({variant:"outline",size:"icon",label:Wn(),icon:g.tiltUp(),onClick:()=>{s(-15)}}),rotateLeft:new y({variant:"outline",size:"icon",label:Bn(),icon:g.rotateLeft(),onClick:()=>{e.targetRotation=o(e.targetRotation-15),n.rotate(e.targetRotation+e.thetaOffset).set()}}),reset:new y({variant:"outline",size:"icon",label:Tn(),icon:g.reset(),onClick:()=>{e.thetaOffset=0,n.reset()}}),rotateRight:new y({variant:"outline",size:"icon",label:Hn(),icon:g.rotateRight(),onClick:()=>{e.targetRotation=o(e.targetRotation+15),n.rotate(e.targetRotation+e.thetaOffset).set()}}),tiltDown:new y({variant:"outline",size:"icon",label:Xn(),icon:g.tiltDown(),onClick:()=>{s(15)}})}}function ji(n,t,e){const i=t.limits;i!==void 0&&(n.zoomOut.element.disabled=i.minZoom!==void 0&&e.zoom<=i.minZoom+T,n.zoomIn.element.disabled=i.maxZoom!==void 0&&e.zoom>=i.maxZoom-T,n.tiltUp.element.disabled=i.minTilt!==void 0&&e.tilt<=i.minTilt+T,n.tiltDown.element.disabled=i.maxTilt!==void 0&&e.tilt>=i.maxTilt-T,n.rotateLeft.element.disabled=i.minRotate!==void 0&&e.rotation<=i.minRotate+T,n.rotateRight.element.disabled=i.maxRotate!==void 0&&e.rotation>=i.maxRotate-T)}const x={SELECT:"vd:select",SELECTED:"vd:selected",FOCUS_CHANGE:"vd:focus-change",CONFIGURATION_CHANGE:"vd:configuration-change",CONFIGURATION_SUBMIT:"vd:configuration-submit"},Pt={mm:1,cm:10,m:1e3,in:25.4},ht=3;function Hi(n){const t=n.stepMm/Pt[n.displayUnit];for(let e=0;e<=ht;e++){const i=t*10**e;if(Math.abs(i-Math.round(i))<1e-9)return e}return ht}function qi(n,t,e){const i=Hi(t),o=n/Pt[t.displayUnit];return new Intl.NumberFormat(e,{minimumFractionDigits:i,maximumFractionDigits:i}).format(o)}function Gi(n,t,e,i,o,s,r){const a=p(),u=n.values.map(h=>qi(Number(h),t,a)),d=n.values.find(h=>e.getValue(n.name,h)?.isSelected===!0)??n.defaultValue,f=new Ii(n.values,{label:n.name,labels:u,unit:t.displayUnit,...d!==void 0&&{initialSelected:d}});return f.onSelect(h=>{o(n.name,h)}),f.onSettle(h=>{i.dispatch(x.SELECT,{attribute:n.name,value:h},!0).defaultPrevented||s(n.name,h)}),r(n.name,h=>{f.setSelected(h.value),i.dispatch(x.SELECTED,{attribute:n.name,value:h.value})}),{element:f.element,setSelectable:()=>{}}}const Zi=5;let Wi=0;function Y(n){const t=n.replace(/([A-Z])/g," $1").trim();return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function Qi(n,t,e,i,o,s){const r=document.createElement("div");r.className="vd-attribute",r.dataset.name=n.name;const a=document.createElement("span");a.className="vd-attribute-label",a.textContent=Y(n.name),a.id=`vd-attribute-label-${Wi++}`,r.appendChild(a),r.setAttribute("role","group"),r.setAttribute("aria-labelledby",a.id);const u=f=>{r.style.display=f?"none":""},d=n.dimension!==void 0?Gi(n,n.dimension,t,e,o,i,s):Yi(n,t,e,i,s);return r.appendChild(d.element),{element:r,setSelectable:d.setSelectable,setHidden:u}}function Yi(n,t,e,i,o){const s=n.values.find(u=>t.getValue(n.name,u)?.isSelected===!0),r=n.values.map(Y),a=n.values.length<=Zi?new Ti(n.values,s,r):new Ri(n.name,n.values,Y(n.name),s,r);return a.onSelect(u=>{e.dispatch(x.SELECT,{attribute:n.name,value:u},!0).defaultPrevented||i(n.name,u)}),o(n.name,u=>{a.setSelected(u.value),e.dispatch(x.SELECTED,{attribute:n.name,value:u.value})}),{element:a.element,setSelectable:u=>{a.setEnabled(u)}}}const Ki=80,Xi=2500;class Ji{constructor(t,e=Xi){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 y({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=to(t.price,t.currency),this.vatEl.textContent=pt(this.configuration.vatDisplay)}renderButton(){const t=this.configuration.submitEnabled;this.button.element.classList.toggle("vd-hidden",!t),t&&this.state==="idle"&&this.setButtonText(pt(this.configuration.buttonLabel))}async handleSubmit(){if(this.state!=="busy"){this.setState("busy",ni());try{await this.configuration.submit(),this.setState("success",ri())}catch{this.setState("failed",ui())}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 pt(n){return(n??"").slice(0,Ki)}function to(n,t){try{const e=new Intl.NumberFormat(p(),{style:"currency",currency:t}),i=e.resolvedOptions().maximumFractionDigits??2;return e.format(n/10**i)}catch{return`${t} ${(n/100).toFixed(2)}`}}class Ft{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 eo=572;class no{constructor(t){this.actionBarSlot=t}actionBarSlot;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 y({variant:"ghost",size:"icon-sm",label:kn(),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 y({variant:"outline",size:"icon",label:wn(),icon:g.configurator({size:18}),onClick:()=>{this.expanded=!0,this.render()}}),this.openButton.element.classList.add("vd-configurator-toggle","vd-hidden"),this.actionBarSlot.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","vd-layout-sidebar-permanent"),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<eo)}),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,e=this.visible&&!this.expanded;this.element.classList.toggle("vd-hidden",!this.visible),this.element.classList.toggle("vd-sidebar-collapsed",e),this.openButton.element.classList.toggle("vd-hidden",!e),this.closeButton.element.style.display=this.collapsible?"":"none",this.container.classList.toggle("vd-layout-sidebar-right",t),this.container.classList.toggle("vd-layout-sidebar-permanent",t&&!this.collapsible)}}class io{attach(t,e){}setVisible(t){}destroy(){}}const oo={"inframe-bottom-left":()=>new Ft,"sidebar-right":n=>new no(n),hidden:()=>new io};function so(n,t){return(oo[n??""]??(()=>new Ft))(t)}const G=S.fontFamily.sans.join(", "),Z=`
|
|
385
400
|
position: absolute;
|
|
386
401
|
display: flex;
|
|
387
402
|
z-index: 10;
|
|
@@ -469,8 +484,8 @@
|
|
|
469
484
|
|
|
470
485
|
/* Micro-label: recedes so the controls lead. */
|
|
471
486
|
.vd-attribute-label {
|
|
472
|
-
font-size: ${
|
|
473
|
-
font-weight: ${
|
|
487
|
+
font-size: ${S.fontSize.xs};
|
|
488
|
+
font-weight: ${S.fontWeight.medium};
|
|
474
489
|
color: ${m.neutral[500]};
|
|
475
490
|
text-transform: uppercase;
|
|
476
491
|
letter-spacing: 0.05em;
|
|
@@ -566,13 +581,13 @@
|
|
|
566
581
|
}
|
|
567
582
|
|
|
568
583
|
.vd-price {
|
|
569
|
-
font-size: ${
|
|
570
|
-
font-weight: ${
|
|
584
|
+
font-size: ${S.fontSize.lg};
|
|
585
|
+
font-weight: ${S.fontWeight.semibold};
|
|
571
586
|
color: ${m.neutral[900]};
|
|
572
587
|
}
|
|
573
588
|
|
|
574
589
|
.vd-vat {
|
|
575
|
-
font-size: ${
|
|
590
|
+
font-size: ${S.fontSize.xs};
|
|
576
591
|
color: ${m.neutral[500]};
|
|
577
592
|
}
|
|
578
593
|
|
|
@@ -588,4 +603,4 @@
|
|
|
588
603
|
color: ${m.white};
|
|
589
604
|
}
|
|
590
605
|
|
|
591
|
-
`;function ao(){if(zt(),document.getElementById("vd-styles")!==null)return;const n=document.createElement("style");n.id="vd-styles",n.textContent=ro,document.head.appendChild(n)}function lo(n,t){const e=document.createElement("a");e.href=`data:image/png;base64,${n}`,e.download=t,e.click()}class co{options;settings={};container=null;loading=null;slots={topRight:null,bottomRight:null};screenshotBtn=null;actionBar=null;cameraControls=null;attributes=null;groupHandles=new Map;lastSelectable=null;layout=null;commerce=null;constructor(t){this.options=t}attach(t){ao(),this.container=t,this.loading=new Bi(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 Ui({onAr:this.options.onAr,onFullscreen:t?()=>{this.toggleFullscreen()}:void 0,onAnnotationsToggle:this.options.onAnnotationsToggle}),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.options.onFullscreenEnter?.(),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&&Rt(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.slots.bottomRight===null)&&(this.cameraControls?.element.remove(),this.cameraControls=null,this.teardownConfigurator(),this.settings.cameraControls===!0&&(this.cameraControls=new z(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",this.groupHandles=new Map;for(const i of e){const o=Yi(i,t,this.options.eventBus,this.options.onSelect,this.options.onSelectTransient,this.options.onSubscribe);this.groupHandles.set(i.name,o),this.attributes.appendChild(o.element)}this.commerce=new Ji(this.options.configuration),this.attributes.appendChild(this.commerce.element),this.layout=so(this.settings.configuratorLayout,this.slots.bottomRight),this.layout.attach(this.container,this.attributes),this.lastSelectable!==null&&this.applySelectable(this.lastSelectable)}}applySelectable(t){this.lastSelectable=t;for(const[e,i]of this.groupHandles){const o=t.find(s=>s.name===e);i.setSelectable(o?.selectable??null),i.setHidden(o?.hidden===!0)}}get viewerSettings(){return this.settings}teardownConfigurator(){this.commerce?.destroy(),this.commerce=null,this.attributes?.remove(),this.attributes=null,this.groupHandles=new Map,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 y({variant:"outline",size:"icon",label:gn(),icon:g.screenshot(),onClick:()=>{this.options.snapshotApi.take("snapshot.png").onDeveloped(({data:e,filename:i})=>{lo(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))}}const uo={};class ho{defaultServer="https://server.virtualdisplay.io";options;serverHost;extraParams;constructor(t,e,i){this.options=t,this.serverHost=e,this.extraParams=i}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(),t.setAttribute("allow","xr-spatial-tracking; fullscreen"),t}attachToParent(t){this.getParentElement().appendChild(t)}buildUrl(){const t=this.getServerUrl(),e=new URL(t);this.setAddressParams(e),this.options.language!==void 0&&e.searchParams.set("language",this.options.language),this.options.session!==void 0&&e.searchParams.set("session",this.options.session),this.options.debug===!0&&e.searchParams.set("debug","true"),this.options.traceparent!==void 0&&e.searchParams.set("traceparent",this.options.traceparent);for(const[i,o]of Object.entries(this.extraParams??{}))e.searchParams.set(i,o);return e.toString()}setAddressParams(t){if(this.options.app===void 0){t.searchParams.set("license",this.options.license),t.searchParams.set("model",this.options.model);return}t.searchParams.set("app",this.options.app),(this.options.license!==void 0||this.options.model!==void 0)&&exports.logger.warn("Both `app` and `license`/`model` were supplied: `app` wins, the pair was ignored")}getServerUrl(){if(this.serverHost!==void 0)return this.serverHost;if(uo?.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 b.parentNotFound(this.options.parent);return t}}function po(n){const{messenger:t}=n;t.on(c.HANDSHAKE,e=>{Vt(e)&&(exports.logger.info("Server handshake received, flushing publisher queue"),t.markReady())}),t.on(c.SESSION,e=>{jt(e)&&n.onSession(e.sessionId)}),t.on(c.MUTATION,e=>{qt(e)&&(n.attributes.handleMutationResult(e),n.configuration.handleSelectionChanged(n.attributes.getSelection()))}),t.on(c.SNAPSHOT,e=>{Gt(e)&&n.snapshot.handleSnapshotResult(e)}),t.on(c.CAMERA,e=>{Zt(e)&&n.cameraPosition.handlePositionUpdate(e)}),t.on(c.LOADING_INDICATOR,e=>{Yt(e)&&(e.error!==void 0?n.ui.showError(e.error):n.ui.updateProgress(e.progress,e.phase))}),t.on(c.CONFIG,e=>{Xt(e)&&n.applyConfig(e)}),t.on(c.MAPPING,e=>{Wt(e)&&(n.attributes.handleMappingReceived(e),n.configuration.handleSelectionChanged(n.attributes.getSelection()),n.ui.renderAttributeControls(n.attributes,e.attributes),n.readyStateTracker.handleMappingReceived())}),mo(n)}function mo(n){const{messenger:t}=n;t.on(c.FOCUS,e=>{Jt(e)&&n.focus.handleStateReceived(e)}),t.on(c.PRICING,e=>{te(e)&&n.configuration.handlePricingReceived(e.pricing)}),t.on(c.SYNC,e=>{Qt(e)&&n.onSync(e.connected)}),t.on(c.SELECTABLE,e=>{Kt(e)&&(n.selectable.handleSnapshot(e),n.ui.applySelectable(e.attributes))}),t.on(c.APP_RESOLVED,e=>{Ht(e)&&n.onAppResolved(e)})}class fo{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}}function go(n){if(n===void 0)return;const{annotations:t,...e}=n;return t===void 0?e:t===!0?{...e,annotations:"show"}:t===!1?{...e,annotations:"hide"}:{...e,annotations:t}}class bo{attributes;selectableState;readyStateTracker;messenger;cameraApi;cameraPositionApi;focusApi;configurationApi;snapshotApi;annotationsApi;eventBus;ui;options;serverHost;iframeParams;arActivation;syncTracker;iframe;container;readyCallbacks=[];mutationFailedCallbacks=[];viewerSessionId;resolvedApp;appResolvedCallbacks=[];constructor(t,e){this.options=t;const i=e??{};this.serverHost=i.serverHost,this.iframeParams=i.iframeParams,this.initializeLogging(),this.messenger=new ee(()=>this.iframe?.contentWindow??null,i.messengerOptions);const o=s=>{this.messenger.send(s)};this.attributes=new ye(o,O,(s,r)=>{this.notifyMutationFailed(s,r)}),this.selectableState=new Se,this.snapshotApi=new xt(o),this.annotationsApi=new mt(o,O),this.cameraApi=new _t(o),this.cameraPositionApi=new we,this.focusApi=new At(o,s=>{this.dispatchFocusChange(s)},O),this.configurationApi=new kt(s=>{this.dispatchConfigurationChange(s)},s=>{this.dispatchConfigurationSubmit(s)}),this.eventBus=new ke,this.arActivation=i.createArActivation?.(o),this.syncTracker=i.createSyncTracker?.(),this.readyStateTracker=new fo(()=>{this.notifyReady()}),this.ui=this.createStandardInterface(),this.wireIncomingMessages(),i.registerHandlers?.(this.messenger,o),this.messenger.start(),this.createAndConnectIframe()}createStandardInterface(){const t=this.arActivation;return new co({snapshotApi:this.snapshotApi,cameraApi:this.cameraApi,cameraPositionApi:this.cameraPositionApi,eventBus:this.eventBus,configuration:this.configurationApi,onSelect:(e,i)=>this.attributes.select(e,i),onSelectTransient:(e,i)=>this.attributes.selectTransient(e,i),onSubscribe:(e,i)=>this.attributes.onChange(e,i),...t!==void 0&&{onAr:()=>{t.activate()}},onFullscreenEnter:()=>{this.trackFullscreen()},onAnnotationsToggle:e=>{this.sendControlAnnotationToggle(e)}})}sendControlAnnotationToggle(t){this.messenger.send({type:c.ANNOTATION_TOGGLE,instance:O,enabled:t,origin:"control"})}wireIncomingMessages(){po({messenger:this.messenger,attributes:this.attributes,selectable:this.selectableState,configuration:this.configurationApi,snapshot:this.snapshotApi,cameraPosition:this.cameraPositionApi,focus:this.focusApi,ui:this.ui,readyStateTracker:this.readyStateTracker,applyConfig:t=>{this.handleConfig(t)},onSession:t=>{this.handleSession(t)},onSync:t=>{this.syncTracker?.handleSync(t)},onAppResolved:t=>{this.handleAppResolved({appType:t.appType,name:t.name,...t.slug!==void 0&&{slug:t.slug},...t.submit!==void 0&&{submit:t.submit}})}})}handleAppResolved(t){this.resolvedApp=t;for(const e of this.appResolvedCallbacks)e(t)}handleSession(t){this.viewerSessionId=t,this.arActivation?.onSession(t)}notifyMutationFailed(t,e){for(const i of this.mutationFailedCallbacks)i({attribute:t,value:e})}notifyReady(){const t=this.readyCallbacks;this.readyCallbacks=[];for(const e of t)e(this);this.ui.onReady()}dispatchFocusChange(t){this.container?.dispatchEvent(new CustomEvent(x.FOCUS_CHANGE,{detail:t,bubbles:!0}))}dispatchConfigurationChange(t){this.container?.dispatchEvent(new CustomEvent(x.CONFIGURATION_CHANGE,{detail:t??null,bubbles:!0}))}dispatchConfigurationSubmit(t){this.container?.dispatchEvent(new CustomEvent(x.CONFIGURATION_SUBMIT,{detail:t,bubbles:!0}))}handleConfig(t){const e=t.viewerSettings,i=go(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,a])=>e[r]!==a).map(([r,a])=>`${r} (metadata: ${e[r]??"undefined"}, override: ${a})`);s.length>0&&exports.logger.warn(`Viewer settings override active: ${s.join(", ")}`)}this.ui.applyViewerSettings(o),this.echoAnnotationsDifference(e?.annotations,o.annotations)}this.cameraPositionApi.applyLimits(t.cameraLimits)}echoAnnotationsDifference(t,e){e===void 0||e===t||this.annotationsApi.setEnabled(e==="show"||e==="toggle-shown")}trackFullscreen(){this.messenger.send({type:c.FULLSCREEN})}initializeLogging(){this.options.debug===!0&&Ct(),exports.logger.info("Initializing Virtualdisplay client",{...this.options.app===void 0?{model:this.options.model}:{app:this.options.app}})}createAndConnectIframe(){const e=new ho(this.options,this.serverHost,this.iframeParams).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)}onSelectableChange(t){this.selectableState.onChange(t)}onAppResolved(t){this.appResolvedCallbacks.push(t),this.resolvedApp!==void 0&&t(this.resolvedApp)}getSelectable(t){return this.selectableState.selectableFor(t)}activateAr(){this.arActivation?.activate()}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 sessionId(){return this.viewerSessionId}get viewerSettings(){return this.ui.viewerSettings}destroy(){this.readyStateTracker.clear(),this.readyCallbacks=[],this.mutationFailedCallbacks.length=0,this.snapshotApi.clear(),this.messenger.destroy(),this.arActivation?.destroy(),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}}const vo="ar.virtualdisplay.io";function yo(n){const t=new URL(`https://${vo}/go`);return n.sessionId!==void 0?t.searchParams.set("session",n.sessionId):n.app!==void 0?t.searchParams.set("app",n.app):n.license!==void 0&&n.model!==void 0&&(t.searchParams.set("license",n.license),t.searchParams.set("model",n.model)),t.toString()}const So=1500;class wo{options;qrModal=new Ni;sessionId;waiters=[];pendingTimers=new Set;destroyed=!1;constructor(t){this.options=t}onSession(t){this.sessionId=t;const e=this.waiters;this.waiters=[];for(const i of e)i(t)}activate(){if(ge()){this.options.send({type:c.AR_ACTIVATE});return}this.showQrCode()}destroy(){this.destroyed=!0;for(const t of this.pendingTimers)clearTimeout(t);this.pendingTimers.clear(),this.waiters=[],this.qrModal.hide()}async showQrCode(){this.qrModal.show();const t=await this.waitForSessionId();if(this.destroyed)return;const e=yo({sessionId:t,app:this.options.app,license:this.options.license,model:this.options.model}),i=await this.qrModal.update(e);if(this.destroyed){this.qrModal.hide();return}i&&this.options.send({type:c.QR_SHOWN})}waitForSessionId(){return this.sessionId!==void 0?Promise.resolve(this.sessionId):new Promise(t=>{const e=setTimeout(()=>{this.pendingTimers.delete(e),t(void 0)},So);this.pendingTimers.add(e),this.waiters.push(i=>{this.pendingTimers.delete(e),clearTimeout(e),t(i)})})}}class Co{callbacks=[];lastKnown;handleSync(t){this.lastKnown=t;for(const e of this.callbacks)e(t)}onChange(t){this.callbacks.push(t),this.lastKnown!==void 0&&t(this.lastKnown)}}class _o extends bo{syncStatusTracker;constructor(t){const e=new Co;super(t,{createArActivation:i=>new wo({app:t.app,license:t.license,model:t.model,send:i}),createSyncTracker:()=>e}),this.syncStatusTracker=e}onSyncChange(t){this.syncStatusTracker.onChange(t)}}exports.Annotations=mt;exports.Attribute=gt;exports.AttributeValue=ft;exports.Camera=_t;exports.Configuration=kt;exports.ERROR_CODES=_;exports.Focus=At;exports.Photo=Et;exports.Snapshot=xt;exports.VD_EVENTS=x;exports.VirtualdisplayClient=_o;exports.VirtualdisplayError=b;exports.enableDebugMode=Ct;exports.isDebugMode=ve;
|
|
606
|
+
`;function ao(){if(zt(),document.getElementById("vd-styles")!==null)return;const n=document.createElement("style");n.id="vd-styles",n.textContent=ro,document.head.appendChild(n)}function lo(n,t){const e=document.createElement("a");e.href=`data:image/png;base64,${n}`,e.download=t,e.click()}class co{options;settings={};container=null;loading=null;slots={topRight:null,bottomRight:null};screenshotBtn=null;actionBar=null;cameraControls=null;attributes=null;groupHandles=new Map;lastSelectable=null;layout=null;commerce=null;constructor(t){this.options=t}attach(t){ao(),this.container=t,this.loading=new Bi(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 Ui({onAr:this.options.onAr,onFullscreen:t?()=>{this.toggleFullscreen()}:void 0,onAnnotationsToggle:this.options.onAnnotationsToggle}),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.options.onFullscreenEnter?.(),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&&Rt(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.slots.bottomRight===null)&&(this.cameraControls?.element.remove(),this.cameraControls=null,this.teardownConfigurator(),this.settings.cameraControls===!0&&(this.cameraControls=new z(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",this.groupHandles=new Map;for(const i of e){const o=Qi(i,t,this.options.eventBus,this.options.onSelect,this.options.onSelectTransient,this.options.onSubscribe);this.groupHandles.set(i.name,o),this.attributes.appendChild(o.element)}this.commerce=new Ji(this.options.configuration),this.attributes.appendChild(this.commerce.element),this.layout=so(this.settings.configuratorLayout,this.slots.bottomRight),this.layout.attach(this.container,this.attributes),this.lastSelectable!==null&&this.applySelectable(this.lastSelectable)}}applySelectable(t){this.lastSelectable=t;for(const[e,i]of this.groupHandles){const o=t.find(s=>s.name===e);i.setSelectable(o?.selectable??null),i.setHidden(o?.hidden===!0)}}get viewerSettings(){return this.settings}teardownConfigurator(){this.commerce?.destroy(),this.commerce=null,this.attributes?.remove(),this.attributes=null,this.groupHandles=new Map,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 y({variant:"outline",size:"icon",label:gn(),icon:g.screenshot(),onClick:()=>{this.options.snapshotApi.take("snapshot.png").onDeveloped(({data:e,filename:i})=>{lo(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))}}const uo={};class ho{defaultServer="https://server.virtualdisplay.io";options;serverHost;extraParams;constructor(t,e,i){this.options=t,this.serverHost=e,this.extraParams=i}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(),t.setAttribute("allow","xr-spatial-tracking; fullscreen"),t}attachToParent(t){this.getParentElement().appendChild(t)}buildUrl(){const t=this.getServerUrl(),e=new URL(t);this.setAddressParams(e),this.options.language!==void 0&&e.searchParams.set("language",this.options.language),this.options.session!==void 0&&e.searchParams.set("session",this.options.session),this.options.debug===!0&&e.searchParams.set("debug","true"),this.options.traceparent!==void 0&&e.searchParams.set("traceparent",this.options.traceparent);for(const[i,o]of Object.entries(this.extraParams??{}))e.searchParams.set(i,o);return e.toString()}setAddressParams(t){if(this.options.app===void 0){t.searchParams.set("license",this.options.license),t.searchParams.set("model",this.options.model);return}t.searchParams.set("app",this.options.app),(this.options.license!==void 0||this.options.model!==void 0)&&exports.logger.warn("Both `app` and `license`/`model` were supplied: `app` wins, the pair was ignored")}getServerUrl(){if(this.serverHost!==void 0)return this.serverHost;if(uo?.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 b.parentNotFound(this.options.parent);return t}}function po(n){const{messenger:t}=n;t.on(c.HANDSHAKE,e=>{Vt(e)&&(exports.logger.info("Server handshake received, flushing publisher queue"),t.markReady())}),t.on(c.SESSION,e=>{jt(e)&&n.onSession(e.sessionId)}),t.on(c.MUTATION,e=>{qt(e)&&(n.attributes.handleMutationResult(e),n.configuration.handleSelectionChanged(n.attributes.getSelection()))}),t.on(c.SNAPSHOT,e=>{Gt(e)&&n.snapshot.handleSnapshotResult(e)}),t.on(c.CAMERA,e=>{Zt(e)&&n.cameraPosition.handlePositionUpdate(e)}),t.on(c.LOADING_INDICATOR,e=>{Qt(e)&&(e.error!==void 0?n.ui.showError(e.error):n.ui.updateProgress(e.progress,e.phase))}),t.on(c.CONFIG,e=>{Xt(e)&&n.applyConfig(e)}),t.on(c.MAPPING,e=>{Wt(e)&&(n.attributes.handleMappingReceived(e),n.configuration.handleSelectionChanged(n.attributes.getSelection()),n.ui.renderAttributeControls(n.attributes,e.attributes),n.readyStateTracker.handleMappingReceived())}),mo(n)}function mo(n){const{messenger:t}=n;t.on(c.FOCUS,e=>{Jt(e)&&n.focus.handleStateReceived(e)}),t.on(c.PRICING,e=>{te(e)&&n.configuration.handlePricingReceived(e.pricing)}),t.on(c.SYNC,e=>{Yt(e)&&n.onSync(e.connected)}),t.on(c.SELECTABLE,e=>{Kt(e)&&(n.selectable.handleSnapshot(e),n.ui.applySelectable(e.attributes))}),t.on(c.APP_RESOLVED,e=>{Ht(e)&&n.onAppResolved(e)})}class fo{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}}function go(n){if(n===void 0)return;const{annotations:t,...e}=n;return t===void 0?e:t===!0?{...e,annotations:"show"}:t===!1?{...e,annotations:"hide"}:{...e,annotations:t}}class bo{attributes;selectableState;readyStateTracker;messenger;cameraApi;cameraPositionApi;focusApi;configurationApi;snapshotApi;annotationsApi;eventBus;ui;options;serverHost;iframeParams;arActivation;syncTracker;iframe;container;readyCallbacks=[];mutationFailedCallbacks=[];viewerSessionId;resolvedApp;appResolvedCallbacks=[];constructor(t,e){this.options=t;const i=e??{};this.serverHost=i.serverHost,this.iframeParams=i.iframeParams,this.initializeLogging(),this.messenger=new ee(()=>this.iframe?.contentWindow??null,i.messengerOptions);const o=s=>{this.messenger.send(s)};this.attributes=new ye(o,O,(s,r)=>{this.notifyMutationFailed(s,r)}),this.selectableState=new we,this.snapshotApi=new xt(o),this.annotationsApi=new mt(o,O),this.cameraApi=new _t(o),this.cameraPositionApi=new Se,this.focusApi=new At(o,s=>{this.dispatchFocusChange(s)},O),this.configurationApi=new kt(s=>{this.dispatchConfigurationChange(s)},s=>{this.dispatchConfigurationSubmit(s)}),this.eventBus=new ke,this.arActivation=i.createArActivation?.(o),this.syncTracker=i.createSyncTracker?.(),this.readyStateTracker=new fo(()=>{this.notifyReady()}),this.ui=this.createStandardInterface(),this.wireIncomingMessages(),i.registerHandlers?.(this.messenger,o),this.messenger.start(),this.createAndConnectIframe()}createStandardInterface(){const t=this.arActivation;return new co({snapshotApi:this.snapshotApi,cameraApi:this.cameraApi,cameraPositionApi:this.cameraPositionApi,eventBus:this.eventBus,configuration:this.configurationApi,onSelect:(e,i)=>this.attributes.select(e,i),onSelectTransient:(e,i)=>this.attributes.selectTransient(e,i),onSubscribe:(e,i)=>this.attributes.onChange(e,i),...t!==void 0&&{onAr:()=>{t.activate()}},onFullscreenEnter:()=>{this.trackFullscreen()},onAnnotationsToggle:e=>{this.sendControlAnnotationToggle(e)}})}sendControlAnnotationToggle(t){this.messenger.send({type:c.ANNOTATION_TOGGLE,instance:O,enabled:t,origin:"control"})}wireIncomingMessages(){po({messenger:this.messenger,attributes:this.attributes,selectable:this.selectableState,configuration:this.configurationApi,snapshot:this.snapshotApi,cameraPosition:this.cameraPositionApi,focus:this.focusApi,ui:this.ui,readyStateTracker:this.readyStateTracker,applyConfig:t=>{this.handleConfig(t)},onSession:t=>{this.handleSession(t)},onSync:t=>{this.syncTracker?.handleSync(t)},onAppResolved:t=>{this.handleAppResolved({appType:t.appType,name:t.name,...t.slug!==void 0&&{slug:t.slug},...t.submit!==void 0&&{submit:t.submit}})}})}handleAppResolved(t){this.resolvedApp=t;for(const e of this.appResolvedCallbacks)e(t)}handleSession(t){this.viewerSessionId=t,this.arActivation?.onSession(t)}notifyMutationFailed(t,e){for(const i of this.mutationFailedCallbacks)i({attribute:t,value:e})}notifyReady(){const t=this.readyCallbacks;this.readyCallbacks=[];for(const e of t)e(this);this.ui.onReady()}dispatchFocusChange(t){this.container?.dispatchEvent(new CustomEvent(x.FOCUS_CHANGE,{detail:t,bubbles:!0}))}dispatchConfigurationChange(t){this.container?.dispatchEvent(new CustomEvent(x.CONFIGURATION_CHANGE,{detail:t??null,bubbles:!0}))}dispatchConfigurationSubmit(t){this.container?.dispatchEvent(new CustomEvent(x.CONFIGURATION_SUBMIT,{detail:t,bubbles:!0}))}handleConfig(t){const e=t.viewerSettings,i=go(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,a])=>e[r]!==a).map(([r,a])=>`${r} (metadata: ${e[r]??"undefined"}, override: ${a})`);s.length>0&&exports.logger.warn(`Viewer settings override active: ${s.join(", ")}`)}this.ui.applyViewerSettings(o),this.echoAnnotationsDifference(e?.annotations,o.annotations)}this.cameraPositionApi.applyLimits(t.cameraLimits)}echoAnnotationsDifference(t,e){e===void 0||e===t||this.annotationsApi.setEnabled(e==="show"||e==="toggle-shown")}trackFullscreen(){this.messenger.send({type:c.FULLSCREEN})}initializeLogging(){this.options.debug===!0&&Ct(),exports.logger.info("Initializing Virtualdisplay client",{...this.options.app===void 0?{model:this.options.model}:{app:this.options.app}})}createAndConnectIframe(){const e=new ho(this.options,this.serverHost,this.iframeParams).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)}onSelectableChange(t){this.selectableState.onChange(t)}onAppResolved(t){this.appResolvedCallbacks.push(t),this.resolvedApp!==void 0&&t(this.resolvedApp)}getSelectable(t){return this.selectableState.selectableFor(t)}activateAr(){this.arActivation?.activate()}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 sessionId(){return this.viewerSessionId}get viewerSettings(){return this.ui.viewerSettings}destroy(){this.readyStateTracker.clear(),this.readyCallbacks=[],this.mutationFailedCallbacks.length=0,this.snapshotApi.clear(),this.messenger.destroy(),this.arActivation?.destroy(),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}}const vo="ar.virtualdisplay.io";function yo(n){const t=new URL(`https://${vo}/go`);return n.sessionId!==void 0?t.searchParams.set("session",n.sessionId):n.app!==void 0?t.searchParams.set("app",n.app):n.license!==void 0&&n.model!==void 0&&(t.searchParams.set("license",n.license),t.searchParams.set("model",n.model)),t.toString()}const wo=1500;class So{options;qrModal=new Ni;sessionId;waiters=[];pendingTimers=new Set;destroyed=!1;constructor(t){this.options=t}onSession(t){this.sessionId=t;const e=this.waiters;this.waiters=[];for(const i of e)i(t)}activate(){if(ge()){this.options.send({type:c.AR_ACTIVATE});return}this.showQrCode()}destroy(){this.destroyed=!0;for(const t of this.pendingTimers)clearTimeout(t);this.pendingTimers.clear(),this.waiters=[],this.qrModal.hide()}async showQrCode(){this.qrModal.show();const t=await this.waitForSessionId();if(this.destroyed)return;const e=yo({sessionId:t,app:this.options.app,license:this.options.license,model:this.options.model}),i=await this.qrModal.update(e);if(this.destroyed){this.qrModal.hide();return}i&&this.options.send({type:c.QR_SHOWN})}waitForSessionId(){return this.sessionId!==void 0?Promise.resolve(this.sessionId):new Promise(t=>{const e=setTimeout(()=>{this.pendingTimers.delete(e),t(void 0)},wo);this.pendingTimers.add(e),this.waiters.push(i=>{this.pendingTimers.delete(e),clearTimeout(e),t(i)})})}}class Co{callbacks=[];lastKnown;handleSync(t){this.lastKnown=t;for(const e of this.callbacks)e(t)}onChange(t){this.callbacks.push(t),this.lastKnown!==void 0&&t(this.lastKnown)}}class _o extends bo{syncStatusTracker;constructor(t){const e=new Co;super(t,{createArActivation:i=>new So({app:t.app,license:t.license,model:t.model,send:i}),createSyncTracker:()=>e}),this.syncStatusTracker=e}onSyncChange(t){this.syncStatusTracker.onChange(t)}}exports.Annotations=mt;exports.Attribute=gt;exports.AttributeValue=ft;exports.Camera=_t;exports.Configuration=kt;exports.ERROR_CODES=_;exports.Focus=At;exports.Photo=Et;exports.Snapshot=xt;exports.VD_EVENTS=x;exports.VirtualdisplayClient=_o;exports.VirtualdisplayError=b;exports.enableDebugMode=Ct;exports.isDebugMode=ve;
|