@virtualdisplay.io/client 4.0.0-alpha.13 → 4.0.0-alpha.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/src/client/iframe-builder.d.ts.map +1 -1
- package/dist/src/client/options.d.ts +0 -5
- package/dist/src/client/options.d.ts.map +1 -1
- package/dist/virtualdisplay.client.cjs.js +1 -1
- package/dist/virtualdisplay.client.es.js +1 -1
- package/dist/virtualdisplay.client.umd.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iframe-builder.d.ts","sourceRoot":"","sources":["../../../src/client/iframe-builder.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,WAAW,CAAC;IACvB,MAAM,EAAE,iBAAiB,CAAC;CAC3B;AAED;;;;;GAKG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAsC;IAEpE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAgB;gBAE5B,OAAO,EAAE,aAAa;IAIlC;;OAEG;IACI,MAAM,IAAI,YAAY;IAS7B,OAAO,CAAC,eAAe;IAcvB,OAAO,CAAC,YAAY;IAgBpB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,QAAQ;
|
|
1
|
+
{"version":3,"file":"iframe-builder.d.ts","sourceRoot":"","sources":["../../../src/client/iframe-builder.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,WAAW,CAAC;IACvB,MAAM,EAAE,iBAAiB,CAAC;CAC3B;AAED;;;;;GAKG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAsC;IAEpE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAgB;gBAE5B,OAAO,EAAE,aAAa;IAIlC;;OAEG;IACI,MAAM,IAAI,YAAY;IAS7B,OAAO,CAAC,eAAe;IAcvB,OAAO,CAAC,YAAY;IAgBpB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,QAAQ;IAsBhB,OAAO,CAAC,YAAY;IAQpB,OAAO,CAAC,gBAAgB;CAYzB"}
|
|
@@ -10,11 +10,6 @@ export interface ClientOptions {
|
|
|
10
10
|
readonly language?: string;
|
|
11
11
|
/** W3C traceparent string to propagate to the viewer iframe for end-to-end tracing. */
|
|
12
12
|
readonly traceparent?: string;
|
|
13
|
-
/**
|
|
14
|
-
* Force the viewer's GLB cache on (`true`) or off (`false`). Omit to use the
|
|
15
|
-
* viewer's own default. Mainly for testing and dogfooding the cache via the embed.
|
|
16
|
-
*/
|
|
17
|
-
readonly cache?: boolean;
|
|
18
13
|
/**
|
|
19
14
|
* Override viewer settings from metadata. Omitted fields use the metadata value.
|
|
20
15
|
* A warning is logged when an override differs from the metadata value.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/client/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAAC;IACtC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,uFAAuF;IACvF,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/client/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAAC;IACtC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,uFAAuF;IACvF,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;CACnD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _={NO_MAPPING:"NO_MAPPING",ATTRIBUTE_NOT_FOUND:"ATTRIBUTE_NOT_FOUND",VALUE_NOT_FOUND:"VALUE_NOT_FOUND",PARENT_NOT_FOUND:"PARENT_NOT_FOUND",INVALID_PARAMETER:"INVALID_PARAMETER",SNAPSHOT_FAILED:"SNAPSHOT_FAILED"};class f extends Error{code;constructor(t,e){super(t),this.name="VirtualdisplayError",this.code=e}static noMapping(){return new f("No attributes available. Waiting for server metadata.",_.NO_MAPPING)}static attributeNotFound(t){return new f(`Attribute "${t}" not found in mapping`,_.ATTRIBUTE_NOT_FOUND)}static valueNotFound(t,e){return new f(`Value "${e}" not found for attribute "${t}"`,_.VALUE_NOT_FOUND)}static parentNotFound(t){return new f(`Parent element not found: ${t}`,_.PARENT_NOT_FOUND)}static invalidParameter(t){return new f(t,_.INVALID_PARAMETER)}static snapshotFailed(t,e){return new f(`Snapshot failed for "${t}": ${e}`,_.SNAPSHOT_FAILED)}}const Nt={};class It{defaultServer="https://server.virtualdisplay.io";options;constructor(t){this.options=t}create(){const t=this.createContainer(),e=this.createIframe();return t.appendChild(e),this.attachToParent(t),{container:t,iframe:e}}createContainer(){const t=document.createElement("div");return t.className="vd-container",Object.assign(t.style,{position:"relative",width:"100%",height:"100%",overflow:"hidden"}),t}createIframe(){const t=document.createElement("iframe");return t.src=this.buildUrl(),Object.assign(t.style,{width:"100%",height:"100%",border:"none",display:"block"}),t.setAttribute("allow","xr-spatial-tracking; fullscreen"),t}attachToParent(t){this.getParentElement().appendChild(t)}buildUrl(){const t=this.getServerUrl(),e=new URL(t);return e.searchParams.set("license",this.options.license),e.searchParams.set("model",this.options.model),this.options.language!==void 0&&e.searchParams.set("language",this.options.language),this.options.debug===!0&&e.searchParams.set("debug","true"),this.options.traceparent!==void 0&&e.searchParams.set("traceparent",this.options.traceparent),this.options.cache!==void 0&&e.searchParams.set("cache",this.options.cache?"true":"false"),e.toString()}getServerUrl(){if(Nt?.VITE_VIRTUALDISPLAY_SERVER_HOST===void 0)return this.defaultServer}getParentElement(){if(typeof this.options.parent!="string")return this.options.parent;const t=document.querySelector(this.options.parent);if(t===null)throw f.parentNotFound(this.options.parent);return t}}function Lt(n){const t=new Date(n.timestamp).toLocaleTimeString("en-GB",{hour12:!1}),e=n.level.toUpperCase().padEnd(5),i=n.trace_id?.slice(0,8)??"--------",o=n.msg,s=["timestamp","level","msg","service","trace_id","span_id"],r=Object.entries(n).filter(([l])=>!s.includes(l)).map(([l,d])=>`${l}=${JSON.stringify(d)}`).join(" ");return`${t} ${e} [${i}] ${o}${r?" "+r:""}`}function Mt(n){return JSON.stringify(n)}function zt(n,t){const e=t?Lt(n):Mt(n);n.level==="error"?console.error(e):n.level==="warn"?console.warn(e):console.log(e)}function at(n,t=0){const e={name:n.name,message:n.message};n.stack!==void 0&&(e.stack=n.stack);for(const i of Object.getOwnPropertyNames(n)){if(i==="name"||i==="message"||i==="stack"||i==="cause")continue;const o=n[i];o!==void 0&&(e[i]=o)}return n.cause!==void 0&&n.cause!==null&&(e.cause=n.cause instanceof Error&&t<5?at(n.cause,t+1):String(n.cause)),e}function Pt(n){const t={};for(const[e,i]of Object.entries(n))t[e]=i instanceof Error?at(i):i;return t}function Ft(){return new Date}function Dt(n){return n.toISOString()}function lt(){return typeof navigator>"u"?"":navigator.userAgent}function $t(){return typeof navigator>"u"?!1:navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1}function Bt(){return/iPhone|iPad|iPod/i.test(lt())||$t()}function Ut(){return/Android/i.test(lt())}function Vt(){return Bt()||Ut()}class q{constructor(t){this.config=t}config;log(t,e,i={}){const o=this.config.traceProvider?.()??{},s={timestamp:Dt(Ft()),level:t,msg:e,service:this.config.service,...o,...Pt(i)};zt(s,this.config.isDev)}debug(t,e){this.config.isDev&&this.log("debug",t,e)}info(t,e){this.log("info",t,e)}warn(t,e){this.log("warn",t,e)}error(t,e){this.log("error",t,e)}with(t){const e=new q(this.config);return e.log=((i,o,s={})=>{this.log(i,o,{...t,...s})}).bind(this),e}}function ct(n,t){const e=t?.isDev!==void 0?t.isDev:typeof process<"u"?process.env.NODE_ENV!=="production":!0;return new q({service:n,isDev:e,traceProvider:t?.traceProvider})}function O(n){if(n!==void 0)return typeof n=="object"&&n!==null&&!Array.isArray(n)&&!(n instanceof Error)?n:n instanceof Error?{error:n.message}:{value:n}}function ut(n){return{debug:(t,e)=>n.debug(t,O(e)),info:(t,e)=>n.info(t,O(e)),warn:(t,e)=>n.warn(t,O(e)),error:(t,e)=>n.error(t,O(e))}}let dt=!1;exports.logger=ut(ct("client",{isDev:!1}));function ht(){dt=!0,exports.logger=ut(ct("client",{isDev:!0}))}function jt(){return dt}class Ht{ready=!1;onReady;constructor(t){this.onReady=t}handleMappingReceived(){this.ready||(this.ready=!0,exports.logger.info("Mapping received from server, client is now ready"),this.onReady?.())}get isReady(){return this.ready}clear(){this.ready=!1}}const c={HANDSHAKE:"handshake",MUTATION:"mutation",STATE:"state",LOADING_INDICATOR:"loading_indicator",CAMERA:"camera",SNAPSHOT:"snapshot",MAPPING:"mapping",AR_ACTIVATE:"ar_activate",CONFIG:"config",ANNOTATION_PLACE_MODE:"annotation_place_mode",ANNOTATION_PLACED:"annotation_placed",ANNOTATION_TOGGLE:"annotation_toggle",FOCUS:"focus",PRICING:"pricing"},Y={FOCUS:"focus",UNFOCUS:"unfocus"},Gt={FOCUSED:"focused"},qt={HIDDEN:"hidden"},Zt=new Set(Object.values(c));function Wt(n){if(typeof n!="object"||n===null)return!1;const t=n;return typeof t.target=="string"?!1:typeof t.type=="string"&&Zt.has(t.type)}function Yt(n){const t=k(n);return t!==null&&t.type===c.HANDSHAKE}function Xt(n){const t=k(n);return t!==null&&t.type===c.MUTATION&&Array.isArray(t.results)}function Kt(n){const t=k(n);return t!==null&&t.type===c.SNAPSHOT&&("data"in t||"error"in t)}function Qt(n){const t=k(n);return t!==null&&t.type===c.CAMERA&&Array.isArray(t.transforms)}function Jt(n){const t=k(n);return t!==null&&t.type===c.MAPPING&&Array.isArray(t.attributes)}function te(n){const t=k(n);return t!==null&&t.type===c.LOADING_INDICATOR&&typeof t.progress=="number"}function ee(n){const t=k(n);return t!==null&&t.type===c.CONFIG&&typeof t.viewerSettings=="object"}function ne(n){const t=k(n);return t!==null&&t.type===c.ANNOTATION_PLACED&&typeof t.position=="object"&&t.position!==null}function ie(n){const t=k(n);return t!==null&&t.type===c.FOCUS&&typeof t.state=="string"}function oe(n){const t=k(n);return t!==null&&t.type===c.PRICING&&typeof t.pricing=="object"&&t.pricing!==null}function k(n){return typeof n!="object"||n===null?null:n}class X{constructor(t){this.processor=t}processor;pending=[];isReady=!1;enqueue(t){if(this.isReady){this.processor(t);return}this.pending.push(t)}markReady(){if(this.isReady||(this.isReady=!0,this.pending.length===0))return;const t=[...this.pending];this.pending.length=0;for(const e of t)this.processor(e)}get ready(){return this.isReady}get pendingCount(){return this.pending.length}hasPending(t){return this.pending.some(e=>e.type===t)}clear(){this.pending.length=0}}class se{constructor(t,e){this.getTarget=t,this.sourceId=`vd-${Math.random().toString(36).slice(2,8)}`,this.targetOrigin=e?.targetOrigin??"*",this.publisher=new X(i=>this.post(i)),this.consumer=new X(i=>this.routeToHandler(i)),this.shouldBuffer=e?.shouldBuffer??null,e?.bufferIncoming!==!0&&this.consumer.markReady()}getTarget;handlers=new Map;publisher;consumer;shouldBuffer;listener=null;sourceId;targetOrigin;on(t,e){this.handlers.set(t,e)}off(t){this.handlers.delete(t)}setTargetOrigin(t){this.targetOrigin=t}send(t){this.publisher.enqueue(t)}markReady(){this.publisher.markReady()}markConsumerReady(){this.consumer.markReady()}consumerHasPending(t){return this.consumer.hasPending(t)}start(){this.listener===null&&(this.listener=t=>{const{data:e}=t;if(!Wt(e)||e._source===this.sourceId)return;const i=this.getTarget();if(i!==null&&t.source!==null&&t.source!==i)return;const o=e;if(this.shouldBuffer!==null&&!this.shouldBuffer(o)){this.routeToHandler(o);return}this.consumer.enqueue(o)},window.addEventListener("message",this.listener))}destroy(){this.listener!==null&&(window.removeEventListener("message",this.listener),this.listener=null),this.publisher.clear(),this.consumer.clear(),this.handlers.clear()}get ready(){return this.publisher.ready}get pendingCount(){return this.publisher.pendingCount}post(t){const e=this.getTarget();e!==null&&e.postMessage({...t,_source:this.sourceId},this.targetOrigin)}routeToHandler(t){const e=this.handlers.get(t.type);if(e===void 0)return;const i=e(t);i instanceof Promise&&i.catch(o=>{const s=o instanceof Error?o.message:String(o);console.error(`Virtualdisplay: error handling ${t.type}: ${s}`)})}}class mt{constructor(t){this.send=t}send;placedCallbacks=[];setEnabled(t){this.send({type:c.ANNOTATION_TOGGLE,enabled:t})}startPlacing(){this.send({type:c.ANNOTATION_PLACE_MODE,enabled:!0})}stopPlacing(){this.send({type:c.ANNOTATION_PLACE_MODE,enabled:!1})}onPlaced(t){this.placedCallbacks.push(t)}handlePlaced(t){for(const e of this.placedCallbacks)e(t)}}class pt{constructor(t,e){this.value=t,this.attribute=e}value;attribute;isSelectedValue=!1;get isSelected(){return this.isSelectedValue}setSelected(t){this.isSelectedValue=t}}class ft{name;defaultValue;values;onSelect;onChangeCallback;constructor(t){this.name=t.name,this.defaultValue=t.defaultValue,this.onSelect=t.onSelect,this.values=this.createValues(t.values)}select(t){if(!this.values.has(t))throw f.valueNotFound(this.name,t);this.onSelect(this.name,t)}getValues(){return Array.from(this.values.values())}getValue(t){return this.values.get(t)}get selected(){for(const t of this.values.values())if(t.isSelected)return t.value}onChange(t){this.onChangeCallback=t}handleResult(t){let e;for(const i of this.values.values()){const o=i.value===t;i.setSelected(o),o&&(e=i)}e!==void 0&&this.onChangeCallback!==void 0&&this.onChangeCallback(e)}createValues(t){const e=new Map;for(const i of t){const o=new pt(i,this.name);i===this.defaultValue&&o.setSelected(!0),e.set(i,o)}return e}}class re{attributes=new Map;constructor(t,e,i){for(const o of t){const s=this.buildOptions(o,e);this.attributes.set(o.name,new ft(s))}this.onMutationFailed=i}onMutationFailed;get(t){return this.attributes.get(t)}getSelection(){const t={};for(const[e,i]of this.attributes){const o=i.selected;o!==void 0&&(t[e]=o)}return t}handleResults(t){for(const e of t){if(!e.success){this.onMutationFailed?.(e.name,e.value);continue}this.get(e.name)?.handleResult(e.value)}}buildOptions(t,e){const i={name:t.name,values:t.values,onSelect:(o,s)=>{e([{name:o,value:s}],!1)}};return t.defaultValue!==void 0?{...i,defaultValue:t.defaultValue}:i}}class ae{constructor(t,e){this.send=t,this.onMutationFailed=e}send;onMutationFailed;registry;pendingCallbacks=[];handleMappingReceived(t){exports.logger.debug("Initializing from server mapping",{attributeCount:t.attributes.length}),this.registry=new re(t.attributes,(e,i)=>this.sendMutation(e,i),this.onMutationFailed),this.replayPendingCallbacks()}handleMutationResult(t){this.registry?.handleResults(t.results)}select(t,e){this.sendMutation([{name:t,value:e}],!1)}getValues(t){return this.registry?.get(t)?.getValues()??[]}getValue(t,e){return this.registry?.get(t)?.getValue(e)}onChange(t,e){if(this.registry===void 0){this.pendingCallbacks.push({name:t,callback:e});return}const i=this.registry.get(t);if(i===void 0){exports.logger.warn(`onChange: attribute "${t}" not found — callback will not fire`);return}i.onChange(e)}getAttribute(t){return this.registry?.get(t)}getSelection(){return this.registry?.getSelection()??{}}get hasMapping(){return this.registry!==void 0}sendMutation(t,e){const i={type:c.MUTATION,mutations:t,isInitial:e};this.send(i)}replayPendingCallbacks(){for(const{name:t,callback:e}of this.pendingCallbacks){const i=this.registry?.get(t);i===void 0&&exports.logger.warn(`onChange: attribute "${t}" not found — buffered callback will not fire`),i?.onChange(e)}this.pendingCallbacks.length=0}}let gt=class{constructor(t){this.send=t}send;commands=[];rotate(t){return this.validateFiniteNumber(t,"rotate"),this.commands.push({action:"rotate",value:t}),this}tilt(t){return this.validateFiniteNumber(t,"tilt"),this.commands.push({action:"tilt",value:t}),this}zoom(t){return this.validateFiniteNumber(t,"zoom"),this.commands.push({action:"zoom",value:t}),this}set(){if(this.commands.length===0)throw f.invalidParameter("No camera commands to execute. Call rotate(), tilt(), or zoom() before set().");const t={type:c.CAMERA,commands:this.commands};this.send(t),this.commands=[]}validateFiniteNumber(t,e){if(!Number.isFinite(t))throw f.invalidParameter(`${e}() requires a finite number, got ${String(t)}`)}reset(){const t={type:c.CAMERA,commands:[{action:"reset"}]};this.send(t)}};class le{state;limitsState;changeCallbacks=[];constructor(){this.state={rotation:0,tilt:0,zoom:100}}get rotation(){return this.state.rotation}get tilt(){return this.state.tilt}get zoom(){return this.state.zoom}onChange(t){this.changeCallbacks.push(t)}get limits(){return this.limitsState}applyLimits(t){this.limitsState=t;const e={rotation:this.rotation,tilt:this.tilt,zoom:this.zoom};for(const i of this.changeCallbacks)i(e)}handlePositionUpdate(t){this.update(t.transforms)}update(t){let e=!1;for(const i of t)switch(i.type){case"rotation":this.state.rotation=i.value,e=!0;break;case"tilt":this.state.tilt=i.value,e=!0;break;case"zoom":this.state.zoom=i.value,e=!0;break}if(e){const i={rotation:this.rotation,tilt:this.tilt,zoom:this.zoom};for(const o of this.changeCallbacks)o(i)}}}const T={SELECT:"ui:select",SELECTED:"ui:selected",FOCUS_CHANGE:"vd:focus-change",CONFIGURATION_CHANGE:"vd:configuration-change",CONFIGURATION_SUBMIT:"vd:configuration-submit"};class bt{constructor(t,e){this.send=t,this.dispatch=e}send;dispatch;focused=null;attributes=[];changeCallbacks=[];get current(){return this.focused}set(t){if(typeof t!="string"||t.length===0)throw f.invalidParameter(`set() requires a non-empty component name, got ${String(t)}`);this.send({type:c.FOCUS,action:Y.FOCUS,component:t})}clear(){this.send({type:c.FOCUS,action:Y.UNFOCUS})}onChange(t){this.changeCallbacks.push(t)}handleStateReceived(t){t.state===Gt.FOCUSED&&t.component!==void 0?(this.focused=t.component,this.attributes=t.attributes??[]):(this.focused=null,this.attributes=[]);const e=this.focused!==null?{component:this.focused,attributes:this.attributes}:null;for(const i of this.changeCallbacks)i(e);this.dispatch(e)}}function ce(n,t){const e=n.filter(s=>ue(s,t));if(e.length===0)return;const i=Math.max(...e.map(K)),o=e.filter(s=>K(s)===i);return o.length===1?o[0]:void 0}function ue(n,t){return Object.entries(n.attributes).every(([e,i])=>t[e]===i)}function K(n){return Object.keys(n.attributes).length}class vt{constructor(t,e){this.dispatchChange=t,this.dispatchSubmit=e}dispatchChange;dispatchSubmit;pricing;selection={};resolved;changeCallbacks=[];renderCallbacks=[];submitCallback;submitDefaultLabel;get current(){return this.resolved}get vatDisplay(){return this.pricing?.vatDisplay}get buttonLabel(){const t=this.pricing?.buttonLabel;if(t!=null&&t!=="")return t;if(this.submitDefaultLabel!==void 0&&this.submitDefaultLabel!=="")return this.submitDefaultLabel}get submittable(){return this.submitCallback===void 0?!1:this.pricing===void 0?!0:this.resolved?.availability==="available"}get submitEnabled(){return this.submittable&&this.buttonLabel!==void 0}onChange(t){this.changeCallbacks.push(t)}onSubmit(t,e){this.submitCallback=t,this.submitDefaultLabel=e?.defaultLabel,this.notifyRender()}onRender(t){return this.renderCallbacks.push(t),()=>{const e=this.renderCallbacks.indexOf(t);e!==-1&&this.renderCallbacks.splice(e,1)}}async submit(){if(!this.submittable)return;const t=this.resolved!==void 0?{attributes:this.resolved.attributes,reference:this.resolved.reference}:{attributes:{...this.selection},reference:""};this.dispatchSubmit(t),await this.submitCallback?.(t)}handlePricingReceived(t){this.pricing=t,this.recompute()}handleSelectionChanged(t){this.selection=t,this.recompute()}recompute(){this.resolved=this.resolve();for(const t of this.changeCallbacks)t(this.resolved);this.dispatchChange(this.resolved),this.notifyRender()}notifyRender(){for(const t of this.renderCallbacks)t()}resolve(){if(this.pricing===void 0)return;const t=ce(this.pricing.rules,this.selection);if(!(t===void 0||t.availability===qt.HIDDEN))return{attributes:{...this.selection},reference:t.reference,price:t.priceCents,currency:this.pricing.currency,availability:t.availability}}}class yt{constructor(t){this.filename=t}filename;developedCallbacks=new Set;errorCallbacks=new Set;developed=!1;failed=!1;photoData=null;onDeveloped(t){return this.developed&&this.photoData!==null?(t(this.photoData),this):(this.developedCallbacks.add(t),this)}onError(t){return this.errorCallbacks.add(t),this}getFilename(){return this.filename}develop(t){this.developed||this.failed||(this.photoData=t,this.developed=!0,this.developedCallbacks.forEach(e=>{e(this.photoData)}),this.developedCallbacks.clear(),this.errorCallbacks.clear())}fail(t){this.developed||this.failed||(this.failed=!0,this.errorCallbacks.forEach(e=>{e(t)}),this.developedCallbacks.clear(),this.errorCallbacks.clear())}}class _t{constructor(t){this.send=t}send;validExtensions=[".png"];pendingPhotos=new Map;take(t){this.validateFilename(t),exports.logger.debug("Taking snapshot",{filename:t});const e=new yt(t);return this.pendingPhotos.set(e.getFilename(),e),this.send({type:c.SNAPSHOT,filename:t}),e}handleSnapshotResult(t){const e=this.pendingPhotos.get(t.filename);if(e===void 0){exports.logger.warn("No pending photo found for filename",{filename:t.filename,pendingFilenames:Array.from(this.pendingPhotos.keys())});return}if(this.pendingPhotos.delete(t.filename),t.error!==void 0){e.fail(new f(t.error,_.SNAPSHOT_FAILED));return}t.data!==void 0&&e.develop({filename:t.filename,data:t.data})}clear(){if(this.pendingPhotos.size===0)return;const t=new f("Client destroyed before snapshot completed",_.SNAPSHOT_FAILED);for(const e of this.pendingPhotos.values())e.fail(t);this.pendingPhotos.clear()}validateFilename(t){if(t===""||typeof t!="string")throw new f("Filename must be a non-empty string",_.INVALID_PARAMETER);if(!this.validExtensions.some(i=>t.toLowerCase().endsWith(i)))throw new f(`Invalid filename: "${t}". Filename must end with one of: ${this.validExtensions.join(", ")}`,_.INVALID_PARAMETER);if(t.includes("..")||t.includes("/")||t.includes("\\"))throw new f('Filename cannot contain path separators or ".."',_.INVALID_PARAMETER)}}class de{container=null;attach(t){this.container=t}dispatch(t,e,i=!1){const o=new CustomEvent(t,{detail:e,cancelable:i});return this.container?.dispatchEvent(o),o}on(t,e){const i=o=>{const s=o,r={...s.detail,preventDefault:()=>{s.preventDefault()}};e(r)};return this.container?.addEventListener(t,i),()=>{this.container?.removeEventListener(t,i)}}}const he={},me="en",Ct=["en","nl","de"],Z=["baseLocale"],Q=[];let J,tt;function pe(n){if(Q.length===0)return;const t=typeof n=="string"?n:n.href;if(J===t)return tt;const e=new URL(t,"http://dummy.com");let i;for(const o of Q)if(new he(o.match,e.href).exec(e.href)){i=o;break}return J=t,tt=i,i}function wt(n){const t=pe(n);return t&&t.exclude!==!0&&Array.isArray(t.strategy)?t.strategy:Z}const G=typeof window>"u";globalThis.__paraglide=globalThis.__paraglide??{};globalThis.__paraglide.ssr=globalThis.__paraglide.ssr??{};let et=!1,h=()=>{let n=Z;!G&&typeof window<"u"&&window.location?.href&&(n=wt(window.location.href));const t=fe(n);if(t)return et||(et=!0,kt(t,{reload:!1})),t;throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found")};function fe(n,t){let e;for(const i of n){if(i==="baseLocale")e=me;else if(At(i)&&N.has(i)){const s=N.get(i);if(s){const r=s.getLocale();if(r instanceof Promise)continue;if(r!==void 0)return be(r)}}const o=St(e);if(o)return o}}const ge=n=>{window.location.reload()};let kt=(n,t)=>{const e={reload:!0,...t};let i;try{i=h()}catch{}const o=[];let s=Z;!G&&typeof window<"u"&&window.location?.href&&(s=wt(window.location.href));for(const l of s)if(l!=="baseLocale"&&At(l)&&N.has(l)){const d=N.get(l);if(d){let u=d.setLocale(n);u instanceof Promise&&(u=u.catch(p=>{throw new Error(`Custom strategy "${l}" setLocale failed.`,{cause:p})}),o.push(u))}}const r=()=>{!G&&e.reload&&window.location&&n!==i&&ge()};if(o.length)return Promise.all(o).then(()=>{r()});r()};function St(n){if(typeof n!="string")return;const t=n.toLowerCase();for(const e of Ct)if(e.toLowerCase()===t)return e}function be(n){const t=St(n);if(t)return t;throw new Error(`Invalid locale: ${n}. Expected one of: ${Ct.join(", ")}`)}const N=new Map;function At(n){return typeof n=="string"&&/^custom-[A-Za-z0-9_-]+$/.test(n)}const ve=()=>"Activate AR",ye=()=>"AR activeren",_e=()=>"AR aktivieren",Ce=((n={},t={})=>{const e=t.locale??h();return e==="en"?ve():e==="nl"?ye():_e()}),we=()=>"Scan to view in AR",ke=()=>"Scan om in AR te bekijken",Se=()=>"Scannen für AR-Ansicht",Ae=((n={},t={})=>{const e=t.locale??h();return e==="en"?we():e==="nl"?ke():Se()}),Ee=()=>"Use your smartphone camera to scan this QR code",xe=()=>"Gebruik de camera van je smartphone om deze QR-code te scannen",Te=()=>"Verwenden Sie die Kamera Ihres Smartphones, um diesen QR-Code zu scannen",Re=((n={},t={})=>{const e=t.locale??h();return e==="en"?Ee():e==="nl"?xe():Te()}),Oe=()=>"Your phone will open the 3D model in AR mode.",Ne=()=>"Je telefoon opent het 3D-model in AR-modus.",Ie=()=>"Das 3D-Modell wird im AR-Modus Ihres Telefons geöffnet",Le=((n={},t={})=>{const e=t.locale??h();return e==="en"?Oe():e==="nl"?Ne():Ie()}),Me=()=>"Close",ze=()=>"Sluiten",Pe=()=>"Schließen",Fe=((n={},t={})=>{const e=t.locale??h();return e==="en"?Me():e==="nl"?ze():Pe()}),De=()=>"Fullscreen",$e=()=>"Volledig scherm",Be=()=>"Vollbild",Ue=((n={},t={})=>{const e=t.locale??h();return e==="en"?De():e==="nl"?$e():Be()}),Ve=()=>"Downloading",je=()=>"Downloaden",He=()=>"Herunterladen",Et=((n={},t={})=>{const e=t.locale??h();return e==="en"?Ve():e==="nl"?je():He()}),Ge=()=>"Rendering",qe=()=>"Renderen",Ze=()=>"Rendern",We=((n={},t={})=>{const e=t.locale??h();return e==="en"?Ge():e==="nl"?qe():Ze()}),Ye=()=>"Screenshot",Xe=()=>"Screenshot",Ke=()=>"Screenshot",Qe=((n={},t={})=>{const e=t.locale??h();return e==="en"?Ye():e==="nl"?Xe():Ke()}),Je=()=>"Configure",tn=()=>"Configureer",en=()=>"Konfigurieren",nn=((n={},t={})=>{const e=t.locale??h();return e==="en"?Je():e==="nl"?tn():en()}),on=()=>"Close",sn=()=>"Sluiten",rn=()=>"Schließen",an=((n={},t={})=>{const e=t.locale??h();return e==="en"?on():e==="nl"?sn():rn()}),ln=()=>"Reset camera",cn=()=>"Camera resetten",un=()=>"Kamera zurücksetzen",dn=((n={},t={})=>{const e=t.locale??h();return e==="en"?ln():e==="nl"?cn():un()}),hn=()=>"Zoom in",mn=()=>"Inzoomen",pn=()=>"Hineinzoomen",fn=((n={},t={})=>{const e=t.locale??h();return e==="en"?hn():e==="nl"?mn():pn()}),gn=()=>"Zoom out",bn=()=>"Uitzoomen",vn=()=>"Herauszoomen",yn=((n={},t={})=>{const e=t.locale??h();return e==="en"?gn():e==="nl"?bn():vn()}),_n=()=>"Rotate left",Cn=()=>"Naar links draaien",wn=()=>"Nach links drehen",kn=((n={},t={})=>{const e=t.locale??h();return e==="en"?_n():e==="nl"?Cn():wn()}),Sn=()=>"Rotate right",An=()=>"Naar rechts draaien",En=()=>"Nach rechts drehen",xn=((n={},t={})=>{const e=t.locale??h();return e==="en"?Sn():e==="nl"?An():En()}),Tn=()=>"Tilt up",Rn=()=>"Omhoog kantelen",On=()=>"Nach oben kippen",Nn=((n={},t={})=>{const e=t.locale??h();return e==="en"?Tn():e==="nl"?Rn():On()}),In=()=>"Tilt down",Ln=()=>"Omlaag kantelen",Mn=()=>"Nach unten kippen",zn=((n={},t={})=>{const e=t.locale??h();return e==="en"?In():e==="nl"?Ln():Mn()}),Pn=()=>"Working…",Fn=()=>"Bezig…",Dn=()=>"Läuft…",$n=((n={},t={})=>{const e=t.locale??h();return e==="en"?Pn():e==="nl"?Fn():Dn()}),Bn=()=>"Done",Un=()=>"Gelukt",Vn=()=>"Fertig",jn=((n={},t={})=>{const e=t.locale??h();return e==="en"?Bn():e==="nl"?Un():Vn()}),Hn=()=>"Failed",Gn=()=>"Mislukt",qn=()=>"Fehlgeschlagen",Zn=((n={},t={})=>{const e=t.locale??h();return e==="en"?Hn():e==="nl"?Gn():qn()});const Wn={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};const xt=([n,t,e])=>{const i=document.createElementNS("http://www.w3.org/2000/svg",n);return Object.keys(t).forEach(o=>{i.setAttribute(o,String(t[o]))}),e?.length&&e.forEach(o=>{const s=xt(o);i.appendChild(s)}),i},Tt=(n,t={})=>{const i={...Wn,...t};return xt(["svg",i,n])};const Yn=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"}],["path",{d:"m3.3 7 8.7 5 8.7-5"}],["path",{d:"M12 22V12"}]];const Xn=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z"}],["circle",{cx:"12",cy:"13",r:"3"}]];const Rt=[["path",{d:"m6 9 6 6 6-6"}]];const Kn=[["path",{d:"m15 18-6-6 6-6"}]];const Qn=[["path",{d:"m9 18 6-6-6-6"}]];const Jn=[["path",{d:"m18 15-6-6-6 6"}]];const ti=[["path",{d:"M15 3h6v6"}],["path",{d:"m21 3-7 7"}],["path",{d:"m3 21 7-7"}],["path",{d:"M9 21H3v-6"}]];const ei=[["path",{d:"m14 10 7-7"}],["path",{d:"M20 10h-6V4"}],["path",{d:"m3 21 7-7"}],["path",{d:"M4 14h6v6"}]];const ni=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}],["path",{d:"M3 3v5h5"}]];const ii=[["path",{d:"M10 5H3"}],["path",{d:"M12 19H3"}],["path",{d:"M14 3v4"}],["path",{d:"M16 17v4"}],["path",{d:"M21 12h-9"}],["path",{d:"M21 19h-5"}],["path",{d:"M21 5h-7"}],["path",{d:"M8 10v4"}],["path",{d:"M8 12H3"}]];const oi=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];const si=[["circle",{cx:"11",cy:"11",r:"8"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11"}]];const ri=[["circle",{cx:"11",cy:"11",r:"8"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11"}]];function y(n,{size:t=20,strokeWidth:e=1.75}={}){return Tt(n,{width:t,height:t,"stroke-width":e})}const g={ar:n=>y(Yn,n),fullscreen:n=>y(ti,n),exitFullscreen:n=>y(ei,n),screenshot:n=>y(Xn,n),tiltUp:n=>y(Jn,n),tiltDown:n=>y(Rt,n),rotateLeft:n=>y(Kn,n),rotateRight:n=>y(Qn,n),zoomIn:n=>y(si,n),zoomOut:n=>y(ri,n),reset:n=>y(ni,n),configurator:n=>y(ii,n),close:n=>y(oi,n)};class b{element;constructor({variant:t="default",size:e="default",label:i,icon:o,onClick:s,disabled:r=!1}={}){this.element=document.createElement("button"),this.element.className=`ui-btn ui-btn--${t} ui-btn--size-${e}`,i!==void 0&&(this.element.setAttribute("aria-label",i),this.element.title=i),o!==void 0?this.element.appendChild(o):i!==void 0&&(this.element.textContent=i),s&&this.element.addEventListener("click",s),this.element.disabled=r}setIcon(t){const e=this.element.querySelector("svg");e!==null?e.replaceWith(t):this.element.appendChild(t)}}const m={semantic:{error:"#dc2626"},neutral:{500:"#737373",600:"#525252",900:"#171717"},white:"#ffffff",black:"#000000"},a={0:"0",.5:"0.125rem",1:"0.25rem",1.5:"0.375rem",2:"0.5rem",3:"0.75rem",4:"1rem",5:"1.25rem",6:"1.5rem",8:"2rem",9:"2.25rem",24:"6rem"};class ai{element;constructor(){this.element=document.createElement("div"),Object.assign(this.element.style,{background:m.white,borderRadius:a[3],padding:a[6],boxShadow:`0 ${a[2]} ${a[8]} oklch(0% 0 0 / 20%)`,maxWidth:"20rem",width:"100%"})}}class li{constructor(t={}){this.options=t,this.card=new ai,this.backdrop=this.createBackdrop(),this.backdrop.appendChild(this.card.element)}options;card;backdrop;keyHandler=null;open(){document.body.appendChild(this.backdrop),this.keyHandler=t=>{t.key==="Escape"&&this.close()},document.addEventListener("keydown",this.keyHandler)}close(){this.backdrop.remove(),this.keyHandler!==null&&(document.removeEventListener("keydown",this.keyHandler),this.keyHandler=null),this.options.onClose?.()}createBackdrop(){const t=document.createElement("div");return Object.assign(t.style,{position:"fixed",inset:a[0],background:"oklch(0% 0 0 / 50%)",zIndex:"9999",display:"flex",alignItems:"center",justifyContent:"center"}),t.addEventListener("click",e=>{e.target===t&&this.close()}),t}}class ci{element;selectCallback=null;constructor(t,e,i){this.element=document.createElement("div"),this.element.className="ui-toggle-group";for(let o=0;o<t.length;o++){const s=t[o],r=document.createElement("button");r.className="ui-toggle-group-item",r.dataset.value=s,r.textContent=i?.[o]??s,r.dataset.state=s===e?"on":"off",r.setAttribute("aria-pressed",s===e?"true":"false"),r.addEventListener("click",()=>{this.selectCallback?.(s)}),this.element.appendChild(r)}}setSelected(t){for(const e of this.element.querySelectorAll(".ui-toggle-group-item")){const i=e.dataset.value===t;e.dataset.state=i?"on":"off",e.setAttribute("aria-pressed",i?"true":"false")}}onSelect(t){this.selectCallback=t}}class ui{element;select;constructor(t,e,i,o,s){this.select=document.createElement("select"),this.select.className="ui-native-select",this.select.dataset.name=t,this.select.setAttribute("aria-label",i);const r=document.createElement("option");r.value="",r.disabled=!0,r.textContent=i,this.select.appendChild(r);let l=!1;for(let u=0;u<e.length;u++){const p=e[u],v=document.createElement("option");v.value=p,v.textContent=s?.[u]??p,p===o&&(v.selected=!0,l=!0),this.select.appendChild(v)}l||(r.selected=!0);const d=Tt(Rt,{width:16,height:16,"stroke-width":2});d.classList.add("ui-native-select-icon"),this.element=document.createElement("div"),this.element.className="ui-native-select-wrap",this.element.appendChild(this.select),this.element.appendChild(d)}setSelected(t){this.select.value=t}onSelect(t){this.select.addEventListener("change",()=>{t(this.select.value)})}}const C={fontFamily:{sans:["Mona Sans","ui-sans-serif","system-ui","sans-serif","Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"]},fontSize:{xs:"0.75rem",sm:"0.875rem",base:"1rem",lg:"1.125rem"},fontWeight:{medium:"500",semibold:"600"}},di=C.fontFamily.sans.join(", ");class hi{qrLib=null;dialog=null;async show(t){this.hide(),this.qrLib??=await Promise.resolve().then(()=>require("./browser-DfB_An57.cjs")).then(o=>o.browser);const e=await this.qrLib.toDataURL(t,{width:256,margin:4,errorCorrectionLevel:"M",color:{dark:m.black,light:m.white}});this.dialog=new li({onClose:()=>{this.dialog=null}}),Object.assign(this.dialog.card.element.style,{display:"flex",flexDirection:"column",alignItems:"center",gap:a[3],fontFamily:di}),this.dialog.card.element.appendChild(this.createText(Ae(),{fontSize:C.fontSize.base,fontWeight:C.fontWeight.semibold,color:m.neutral[900]})),this.dialog.card.element.appendChild(this.createText(Re(),{fontSize:C.fontSize.sm,color:m.neutral[600]})),this.dialog.card.element.appendChild(this.createQrImage(e)),this.dialog.card.element.appendChild(this.createText(Le(),{fontSize:C.fontSize.xs,color:m.neutral[500]}));const i=new b({variant:"outline",label:Fe(),onClick:()=>{this.hide()}});this.dialog.card.element.appendChild(i.element),this.dialog.open()}hide(){this.dialog?.close(),this.dialog=null}createText(t,e){const i=document.createElement("p");return i.textContent=t,Object.assign(i.style,{margin:"0",textAlign:"center",...e}),i}createQrImage(t){const e=document.createElement("img");return e.src=t,e.alt="QR code",Object.assign(e.style,{width:a[24],height:a[24],borderRadius:a[1]}),e}}const E=C.fontFamily.sans.join(", "),mi=`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _={NO_MAPPING:"NO_MAPPING",ATTRIBUTE_NOT_FOUND:"ATTRIBUTE_NOT_FOUND",VALUE_NOT_FOUND:"VALUE_NOT_FOUND",PARENT_NOT_FOUND:"PARENT_NOT_FOUND",INVALID_PARAMETER:"INVALID_PARAMETER",SNAPSHOT_FAILED:"SNAPSHOT_FAILED"};class f extends Error{code;constructor(t,e){super(t),this.name="VirtualdisplayError",this.code=e}static noMapping(){return new f("No attributes available. Waiting for server metadata.",_.NO_MAPPING)}static attributeNotFound(t){return new f(`Attribute "${t}" not found in mapping`,_.ATTRIBUTE_NOT_FOUND)}static valueNotFound(t,e){return new f(`Value "${e}" not found for attribute "${t}"`,_.VALUE_NOT_FOUND)}static parentNotFound(t){return new f(`Parent element not found: ${t}`,_.PARENT_NOT_FOUND)}static invalidParameter(t){return new f(t,_.INVALID_PARAMETER)}static snapshotFailed(t,e){return new f(`Snapshot failed for "${t}": ${e}`,_.SNAPSHOT_FAILED)}}const Nt={};class It{defaultServer="https://server.virtualdisplay.io";options;constructor(t){this.options=t}create(){const t=this.createContainer(),e=this.createIframe();return t.appendChild(e),this.attachToParent(t),{container:t,iframe:e}}createContainer(){const t=document.createElement("div");return t.className="vd-container",Object.assign(t.style,{position:"relative",width:"100%",height:"100%",overflow:"hidden"}),t}createIframe(){const t=document.createElement("iframe");return t.src=this.buildUrl(),Object.assign(t.style,{width:"100%",height:"100%",border:"none",display:"block"}),t.setAttribute("allow","xr-spatial-tracking; fullscreen"),t}attachToParent(t){this.getParentElement().appendChild(t)}buildUrl(){const t=this.getServerUrl(),e=new URL(t);return e.searchParams.set("license",this.options.license),e.searchParams.set("model",this.options.model),this.options.language!==void 0&&e.searchParams.set("language",this.options.language),this.options.debug===!0&&e.searchParams.set("debug","true"),this.options.traceparent!==void 0&&e.searchParams.set("traceparent",this.options.traceparent),e.toString()}getServerUrl(){if(Nt?.VITE_VIRTUALDISPLAY_SERVER_HOST===void 0)return this.defaultServer}getParentElement(){if(typeof this.options.parent!="string")return this.options.parent;const t=document.querySelector(this.options.parent);if(t===null)throw f.parentNotFound(this.options.parent);return t}}function Lt(n){const t=new Date(n.timestamp).toLocaleTimeString("en-GB",{hour12:!1}),e=n.level.toUpperCase().padEnd(5),i=n.trace_id?.slice(0,8)??"--------",o=n.msg,s=["timestamp","level","msg","service","trace_id","span_id"],r=Object.entries(n).filter(([l])=>!s.includes(l)).map(([l,d])=>`${l}=${JSON.stringify(d)}`).join(" ");return`${t} ${e} [${i}] ${o}${r?" "+r:""}`}function Mt(n){return JSON.stringify(n)}function zt(n,t){const e=t?Lt(n):Mt(n);n.level==="error"?console.error(e):n.level==="warn"?console.warn(e):console.log(e)}function at(n,t=0){const e={name:n.name,message:n.message};n.stack!==void 0&&(e.stack=n.stack);for(const i of Object.getOwnPropertyNames(n)){if(i==="name"||i==="message"||i==="stack"||i==="cause")continue;const o=n[i];o!==void 0&&(e[i]=o)}return n.cause!==void 0&&n.cause!==null&&(e.cause=n.cause instanceof Error&&t<5?at(n.cause,t+1):String(n.cause)),e}function Pt(n){const t={};for(const[e,i]of Object.entries(n))t[e]=i instanceof Error?at(i):i;return t}function Ft(){return new Date}function Dt(n){return n.toISOString()}function lt(){return typeof navigator>"u"?"":navigator.userAgent}function $t(){return typeof navigator>"u"?!1:navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1}function Bt(){return/iPhone|iPad|iPod/i.test(lt())||$t()}function Ut(){return/Android/i.test(lt())}function Vt(){return Bt()||Ut()}class q{constructor(t){this.config=t}config;log(t,e,i={}){const o=this.config.traceProvider?.()??{},s={timestamp:Dt(Ft()),level:t,msg:e,service:this.config.service,...o,...Pt(i)};zt(s,this.config.isDev)}debug(t,e){this.config.isDev&&this.log("debug",t,e)}info(t,e){this.log("info",t,e)}warn(t,e){this.log("warn",t,e)}error(t,e){this.log("error",t,e)}with(t){const e=new q(this.config);return e.log=((i,o,s={})=>{this.log(i,o,{...t,...s})}).bind(this),e}}function ct(n,t){const e=t?.isDev!==void 0?t.isDev:typeof process<"u"?process.env.NODE_ENV!=="production":!0;return new q({service:n,isDev:e,traceProvider:t?.traceProvider})}function O(n){if(n!==void 0)return typeof n=="object"&&n!==null&&!Array.isArray(n)&&!(n instanceof Error)?n:n instanceof Error?{error:n.message}:{value:n}}function ut(n){return{debug:(t,e)=>n.debug(t,O(e)),info:(t,e)=>n.info(t,O(e)),warn:(t,e)=>n.warn(t,O(e)),error:(t,e)=>n.error(t,O(e))}}let dt=!1;exports.logger=ut(ct("client",{isDev:!1}));function ht(){dt=!0,exports.logger=ut(ct("client",{isDev:!0}))}function jt(){return dt}class Ht{ready=!1;onReady;constructor(t){this.onReady=t}handleMappingReceived(){this.ready||(this.ready=!0,exports.logger.info("Mapping received from server, client is now ready"),this.onReady?.())}get isReady(){return this.ready}clear(){this.ready=!1}}const c={HANDSHAKE:"handshake",MUTATION:"mutation",STATE:"state",LOADING_INDICATOR:"loading_indicator",CAMERA:"camera",SNAPSHOT:"snapshot",MAPPING:"mapping",AR_ACTIVATE:"ar_activate",CONFIG:"config",ANNOTATION_PLACE_MODE:"annotation_place_mode",ANNOTATION_PLACED:"annotation_placed",ANNOTATION_TOGGLE:"annotation_toggle",FOCUS:"focus",PRICING:"pricing"},Y={FOCUS:"focus",UNFOCUS:"unfocus"},Gt={FOCUSED:"focused"},qt={HIDDEN:"hidden"},Zt=new Set(Object.values(c));function Wt(n){if(typeof n!="object"||n===null)return!1;const t=n;return typeof t.target=="string"?!1:typeof t.type=="string"&&Zt.has(t.type)}function Yt(n){const t=k(n);return t!==null&&t.type===c.HANDSHAKE}function Xt(n){const t=k(n);return t!==null&&t.type===c.MUTATION&&Array.isArray(t.results)}function Kt(n){const t=k(n);return t!==null&&t.type===c.SNAPSHOT&&("data"in t||"error"in t)}function Qt(n){const t=k(n);return t!==null&&t.type===c.CAMERA&&Array.isArray(t.transforms)}function Jt(n){const t=k(n);return t!==null&&t.type===c.MAPPING&&Array.isArray(t.attributes)}function te(n){const t=k(n);return t!==null&&t.type===c.LOADING_INDICATOR&&typeof t.progress=="number"}function ee(n){const t=k(n);return t!==null&&t.type===c.CONFIG&&typeof t.viewerSettings=="object"}function ne(n){const t=k(n);return t!==null&&t.type===c.ANNOTATION_PLACED&&typeof t.position=="object"&&t.position!==null}function ie(n){const t=k(n);return t!==null&&t.type===c.FOCUS&&typeof t.state=="string"}function oe(n){const t=k(n);return t!==null&&t.type===c.PRICING&&typeof t.pricing=="object"&&t.pricing!==null}function k(n){return typeof n!="object"||n===null?null:n}class X{constructor(t){this.processor=t}processor;pending=[];isReady=!1;enqueue(t){if(this.isReady){this.processor(t);return}this.pending.push(t)}markReady(){if(this.isReady||(this.isReady=!0,this.pending.length===0))return;const t=[...this.pending];this.pending.length=0;for(const e of t)this.processor(e)}get ready(){return this.isReady}get pendingCount(){return this.pending.length}hasPending(t){return this.pending.some(e=>e.type===t)}clear(){this.pending.length=0}}class se{constructor(t,e){this.getTarget=t,this.sourceId=`vd-${Math.random().toString(36).slice(2,8)}`,this.targetOrigin=e?.targetOrigin??"*",this.publisher=new X(i=>this.post(i)),this.consumer=new X(i=>this.routeToHandler(i)),this.shouldBuffer=e?.shouldBuffer??null,e?.bufferIncoming!==!0&&this.consumer.markReady()}getTarget;handlers=new Map;publisher;consumer;shouldBuffer;listener=null;sourceId;targetOrigin;on(t,e){this.handlers.set(t,e)}off(t){this.handlers.delete(t)}setTargetOrigin(t){this.targetOrigin=t}send(t){this.publisher.enqueue(t)}markReady(){this.publisher.markReady()}markConsumerReady(){this.consumer.markReady()}consumerHasPending(t){return this.consumer.hasPending(t)}start(){this.listener===null&&(this.listener=t=>{const{data:e}=t;if(!Wt(e)||e._source===this.sourceId)return;const i=this.getTarget();if(i!==null&&t.source!==null&&t.source!==i)return;const o=e;if(this.shouldBuffer!==null&&!this.shouldBuffer(o)){this.routeToHandler(o);return}this.consumer.enqueue(o)},window.addEventListener("message",this.listener))}destroy(){this.listener!==null&&(window.removeEventListener("message",this.listener),this.listener=null),this.publisher.clear(),this.consumer.clear(),this.handlers.clear()}get ready(){return this.publisher.ready}get pendingCount(){return this.publisher.pendingCount}post(t){const e=this.getTarget();e!==null&&e.postMessage({...t,_source:this.sourceId},this.targetOrigin)}routeToHandler(t){const e=this.handlers.get(t.type);if(e===void 0)return;const i=e(t);i instanceof Promise&&i.catch(o=>{const s=o instanceof Error?o.message:String(o);console.error(`Virtualdisplay: error handling ${t.type}: ${s}`)})}}class mt{constructor(t){this.send=t}send;placedCallbacks=[];setEnabled(t){this.send({type:c.ANNOTATION_TOGGLE,enabled:t})}startPlacing(){this.send({type:c.ANNOTATION_PLACE_MODE,enabled:!0})}stopPlacing(){this.send({type:c.ANNOTATION_PLACE_MODE,enabled:!1})}onPlaced(t){this.placedCallbacks.push(t)}handlePlaced(t){for(const e of this.placedCallbacks)e(t)}}class pt{constructor(t,e){this.value=t,this.attribute=e}value;attribute;isSelectedValue=!1;get isSelected(){return this.isSelectedValue}setSelected(t){this.isSelectedValue=t}}class ft{name;defaultValue;values;onSelect;onChangeCallback;constructor(t){this.name=t.name,this.defaultValue=t.defaultValue,this.onSelect=t.onSelect,this.values=this.createValues(t.values)}select(t){if(!this.values.has(t))throw f.valueNotFound(this.name,t);this.onSelect(this.name,t)}getValues(){return Array.from(this.values.values())}getValue(t){return this.values.get(t)}get selected(){for(const t of this.values.values())if(t.isSelected)return t.value}onChange(t){this.onChangeCallback=t}handleResult(t){let e;for(const i of this.values.values()){const o=i.value===t;i.setSelected(o),o&&(e=i)}e!==void 0&&this.onChangeCallback!==void 0&&this.onChangeCallback(e)}createValues(t){const e=new Map;for(const i of t){const o=new pt(i,this.name);i===this.defaultValue&&o.setSelected(!0),e.set(i,o)}return e}}class re{attributes=new Map;constructor(t,e,i){for(const o of t){const s=this.buildOptions(o,e);this.attributes.set(o.name,new ft(s))}this.onMutationFailed=i}onMutationFailed;get(t){return this.attributes.get(t)}getSelection(){const t={};for(const[e,i]of this.attributes){const o=i.selected;o!==void 0&&(t[e]=o)}return t}handleResults(t){for(const e of t){if(!e.success){this.onMutationFailed?.(e.name,e.value);continue}this.get(e.name)?.handleResult(e.value)}}buildOptions(t,e){const i={name:t.name,values:t.values,onSelect:(o,s)=>{e([{name:o,value:s}],!1)}};return t.defaultValue!==void 0?{...i,defaultValue:t.defaultValue}:i}}class ae{constructor(t,e){this.send=t,this.onMutationFailed=e}send;onMutationFailed;registry;pendingCallbacks=[];handleMappingReceived(t){exports.logger.debug("Initializing from server mapping",{attributeCount:t.attributes.length}),this.registry=new re(t.attributes,(e,i)=>this.sendMutation(e,i),this.onMutationFailed),this.replayPendingCallbacks()}handleMutationResult(t){this.registry?.handleResults(t.results)}select(t,e){this.sendMutation([{name:t,value:e}],!1)}getValues(t){return this.registry?.get(t)?.getValues()??[]}getValue(t,e){return this.registry?.get(t)?.getValue(e)}onChange(t,e){if(this.registry===void 0){this.pendingCallbacks.push({name:t,callback:e});return}const i=this.registry.get(t);if(i===void 0){exports.logger.warn(`onChange: attribute "${t}" not found — callback will not fire`);return}i.onChange(e)}getAttribute(t){return this.registry?.get(t)}getSelection(){return this.registry?.getSelection()??{}}get hasMapping(){return this.registry!==void 0}sendMutation(t,e){const i={type:c.MUTATION,mutations:t,isInitial:e};this.send(i)}replayPendingCallbacks(){for(const{name:t,callback:e}of this.pendingCallbacks){const i=this.registry?.get(t);i===void 0&&exports.logger.warn(`onChange: attribute "${t}" not found — buffered callback will not fire`),i?.onChange(e)}this.pendingCallbacks.length=0}}let gt=class{constructor(t){this.send=t}send;commands=[];rotate(t){return this.validateFiniteNumber(t,"rotate"),this.commands.push({action:"rotate",value:t}),this}tilt(t){return this.validateFiniteNumber(t,"tilt"),this.commands.push({action:"tilt",value:t}),this}zoom(t){return this.validateFiniteNumber(t,"zoom"),this.commands.push({action:"zoom",value:t}),this}set(){if(this.commands.length===0)throw f.invalidParameter("No camera commands to execute. Call rotate(), tilt(), or zoom() before set().");const t={type:c.CAMERA,commands:this.commands};this.send(t),this.commands=[]}validateFiniteNumber(t,e){if(!Number.isFinite(t))throw f.invalidParameter(`${e}() requires a finite number, got ${String(t)}`)}reset(){const t={type:c.CAMERA,commands:[{action:"reset"}]};this.send(t)}};class le{state;limitsState;changeCallbacks=[];constructor(){this.state={rotation:0,tilt:0,zoom:100}}get rotation(){return this.state.rotation}get tilt(){return this.state.tilt}get zoom(){return this.state.zoom}onChange(t){this.changeCallbacks.push(t)}get limits(){return this.limitsState}applyLimits(t){this.limitsState=t;const e={rotation:this.rotation,tilt:this.tilt,zoom:this.zoom};for(const i of this.changeCallbacks)i(e)}handlePositionUpdate(t){this.update(t.transforms)}update(t){let e=!1;for(const i of t)switch(i.type){case"rotation":this.state.rotation=i.value,e=!0;break;case"tilt":this.state.tilt=i.value,e=!0;break;case"zoom":this.state.zoom=i.value,e=!0;break}if(e){const i={rotation:this.rotation,tilt:this.tilt,zoom:this.zoom};for(const o of this.changeCallbacks)o(i)}}}const T={SELECT:"ui:select",SELECTED:"ui:selected",FOCUS_CHANGE:"vd:focus-change",CONFIGURATION_CHANGE:"vd:configuration-change",CONFIGURATION_SUBMIT:"vd:configuration-submit"};class bt{constructor(t,e){this.send=t,this.dispatch=e}send;dispatch;focused=null;attributes=[];changeCallbacks=[];get current(){return this.focused}set(t){if(typeof t!="string"||t.length===0)throw f.invalidParameter(`set() requires a non-empty component name, got ${String(t)}`);this.send({type:c.FOCUS,action:Y.FOCUS,component:t})}clear(){this.send({type:c.FOCUS,action:Y.UNFOCUS})}onChange(t){this.changeCallbacks.push(t)}handleStateReceived(t){t.state===Gt.FOCUSED&&t.component!==void 0?(this.focused=t.component,this.attributes=t.attributes??[]):(this.focused=null,this.attributes=[]);const e=this.focused!==null?{component:this.focused,attributes:this.attributes}:null;for(const i of this.changeCallbacks)i(e);this.dispatch(e)}}function ce(n,t){const e=n.filter(s=>ue(s,t));if(e.length===0)return;const i=Math.max(...e.map(K)),o=e.filter(s=>K(s)===i);return o.length===1?o[0]:void 0}function ue(n,t){return Object.entries(n.attributes).every(([e,i])=>t[e]===i)}function K(n){return Object.keys(n.attributes).length}class vt{constructor(t,e){this.dispatchChange=t,this.dispatchSubmit=e}dispatchChange;dispatchSubmit;pricing;selection={};resolved;changeCallbacks=[];renderCallbacks=[];submitCallback;submitDefaultLabel;get current(){return this.resolved}get vatDisplay(){return this.pricing?.vatDisplay}get buttonLabel(){const t=this.pricing?.buttonLabel;if(t!=null&&t!=="")return t;if(this.submitDefaultLabel!==void 0&&this.submitDefaultLabel!=="")return this.submitDefaultLabel}get submittable(){return this.submitCallback===void 0?!1:this.pricing===void 0?!0:this.resolved?.availability==="available"}get submitEnabled(){return this.submittable&&this.buttonLabel!==void 0}onChange(t){this.changeCallbacks.push(t)}onSubmit(t,e){this.submitCallback=t,this.submitDefaultLabel=e?.defaultLabel,this.notifyRender()}onRender(t){return this.renderCallbacks.push(t),()=>{const e=this.renderCallbacks.indexOf(t);e!==-1&&this.renderCallbacks.splice(e,1)}}async submit(){if(!this.submittable)return;const t=this.resolved!==void 0?{attributes:this.resolved.attributes,reference:this.resolved.reference}:{attributes:{...this.selection},reference:""};this.dispatchSubmit(t),await this.submitCallback?.(t)}handlePricingReceived(t){this.pricing=t,this.recompute()}handleSelectionChanged(t){this.selection=t,this.recompute()}recompute(){this.resolved=this.resolve();for(const t of this.changeCallbacks)t(this.resolved);this.dispatchChange(this.resolved),this.notifyRender()}notifyRender(){for(const t of this.renderCallbacks)t()}resolve(){if(this.pricing===void 0)return;const t=ce(this.pricing.rules,this.selection);if(!(t===void 0||t.availability===qt.HIDDEN))return{attributes:{...this.selection},reference:t.reference,price:t.priceCents,currency:this.pricing.currency,availability:t.availability}}}class yt{constructor(t){this.filename=t}filename;developedCallbacks=new Set;errorCallbacks=new Set;developed=!1;failed=!1;photoData=null;onDeveloped(t){return this.developed&&this.photoData!==null?(t(this.photoData),this):(this.developedCallbacks.add(t),this)}onError(t){return this.errorCallbacks.add(t),this}getFilename(){return this.filename}develop(t){this.developed||this.failed||(this.photoData=t,this.developed=!0,this.developedCallbacks.forEach(e=>{e(this.photoData)}),this.developedCallbacks.clear(),this.errorCallbacks.clear())}fail(t){this.developed||this.failed||(this.failed=!0,this.errorCallbacks.forEach(e=>{e(t)}),this.developedCallbacks.clear(),this.errorCallbacks.clear())}}class _t{constructor(t){this.send=t}send;validExtensions=[".png"];pendingPhotos=new Map;take(t){this.validateFilename(t),exports.logger.debug("Taking snapshot",{filename:t});const e=new yt(t);return this.pendingPhotos.set(e.getFilename(),e),this.send({type:c.SNAPSHOT,filename:t}),e}handleSnapshotResult(t){const e=this.pendingPhotos.get(t.filename);if(e===void 0){exports.logger.warn("No pending photo found for filename",{filename:t.filename,pendingFilenames:Array.from(this.pendingPhotos.keys())});return}if(this.pendingPhotos.delete(t.filename),t.error!==void 0){e.fail(new f(t.error,_.SNAPSHOT_FAILED));return}t.data!==void 0&&e.develop({filename:t.filename,data:t.data})}clear(){if(this.pendingPhotos.size===0)return;const t=new f("Client destroyed before snapshot completed",_.SNAPSHOT_FAILED);for(const e of this.pendingPhotos.values())e.fail(t);this.pendingPhotos.clear()}validateFilename(t){if(t===""||typeof t!="string")throw new f("Filename must be a non-empty string",_.INVALID_PARAMETER);if(!this.validExtensions.some(i=>t.toLowerCase().endsWith(i)))throw new f(`Invalid filename: "${t}". Filename must end with one of: ${this.validExtensions.join(", ")}`,_.INVALID_PARAMETER);if(t.includes("..")||t.includes("/")||t.includes("\\"))throw new f('Filename cannot contain path separators or ".."',_.INVALID_PARAMETER)}}class de{container=null;attach(t){this.container=t}dispatch(t,e,i=!1){const o=new CustomEvent(t,{detail:e,cancelable:i});return this.container?.dispatchEvent(o),o}on(t,e){const i=o=>{const s=o,r={...s.detail,preventDefault:()=>{s.preventDefault()}};e(r)};return this.container?.addEventListener(t,i),()=>{this.container?.removeEventListener(t,i)}}}const he={},me="en",Ct=["en","nl","de"],Z=["baseLocale"],Q=[];let J,tt;function pe(n){if(Q.length===0)return;const t=typeof n=="string"?n:n.href;if(J===t)return tt;const e=new URL(t,"http://dummy.com");let i;for(const o of Q)if(new he(o.match,e.href).exec(e.href)){i=o;break}return J=t,tt=i,i}function wt(n){const t=pe(n);return t&&t.exclude!==!0&&Array.isArray(t.strategy)?t.strategy:Z}const G=typeof window>"u";globalThis.__paraglide=globalThis.__paraglide??{};globalThis.__paraglide.ssr=globalThis.__paraglide.ssr??{};let et=!1,h=()=>{let n=Z;!G&&typeof window<"u"&&window.location?.href&&(n=wt(window.location.href));const t=fe(n);if(t)return et||(et=!0,kt(t,{reload:!1})),t;throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found")};function fe(n,t){let e;for(const i of n){if(i==="baseLocale")e=me;else if(At(i)&&N.has(i)){const s=N.get(i);if(s){const r=s.getLocale();if(r instanceof Promise)continue;if(r!==void 0)return be(r)}}const o=St(e);if(o)return o}}const ge=n=>{window.location.reload()};let kt=(n,t)=>{const e={reload:!0,...t};let i;try{i=h()}catch{}const o=[];let s=Z;!G&&typeof window<"u"&&window.location?.href&&(s=wt(window.location.href));for(const l of s)if(l!=="baseLocale"&&At(l)&&N.has(l)){const d=N.get(l);if(d){let u=d.setLocale(n);u instanceof Promise&&(u=u.catch(p=>{throw new Error(`Custom strategy "${l}" setLocale failed.`,{cause:p})}),o.push(u))}}const r=()=>{!G&&e.reload&&window.location&&n!==i&&ge()};if(o.length)return Promise.all(o).then(()=>{r()});r()};function St(n){if(typeof n!="string")return;const t=n.toLowerCase();for(const e of Ct)if(e.toLowerCase()===t)return e}function be(n){const t=St(n);if(t)return t;throw new Error(`Invalid locale: ${n}. Expected one of: ${Ct.join(", ")}`)}const N=new Map;function At(n){return typeof n=="string"&&/^custom-[A-Za-z0-9_-]+$/.test(n)}const ve=()=>"Activate AR",ye=()=>"AR activeren",_e=()=>"AR aktivieren",Ce=((n={},t={})=>{const e=t.locale??h();return e==="en"?ve():e==="nl"?ye():_e()}),we=()=>"Scan to view in AR",ke=()=>"Scan om in AR te bekijken",Se=()=>"Scannen für AR-Ansicht",Ae=((n={},t={})=>{const e=t.locale??h();return e==="en"?we():e==="nl"?ke():Se()}),Ee=()=>"Use your smartphone camera to scan this QR code",xe=()=>"Gebruik de camera van je smartphone om deze QR-code te scannen",Te=()=>"Verwenden Sie die Kamera Ihres Smartphones, um diesen QR-Code zu scannen",Re=((n={},t={})=>{const e=t.locale??h();return e==="en"?Ee():e==="nl"?xe():Te()}),Oe=()=>"Your phone will open the 3D model in AR mode.",Ne=()=>"Je telefoon opent het 3D-model in AR-modus.",Ie=()=>"Das 3D-Modell wird im AR-Modus Ihres Telefons geöffnet",Le=((n={},t={})=>{const e=t.locale??h();return e==="en"?Oe():e==="nl"?Ne():Ie()}),Me=()=>"Close",ze=()=>"Sluiten",Pe=()=>"Schließen",Fe=((n={},t={})=>{const e=t.locale??h();return e==="en"?Me():e==="nl"?ze():Pe()}),De=()=>"Fullscreen",$e=()=>"Volledig scherm",Be=()=>"Vollbild",Ue=((n={},t={})=>{const e=t.locale??h();return e==="en"?De():e==="nl"?$e():Be()}),Ve=()=>"Downloading",je=()=>"Downloaden",He=()=>"Herunterladen",Et=((n={},t={})=>{const e=t.locale??h();return e==="en"?Ve():e==="nl"?je():He()}),Ge=()=>"Rendering",qe=()=>"Renderen",Ze=()=>"Rendern",We=((n={},t={})=>{const e=t.locale??h();return e==="en"?Ge():e==="nl"?qe():Ze()}),Ye=()=>"Screenshot",Xe=()=>"Screenshot",Ke=()=>"Screenshot",Qe=((n={},t={})=>{const e=t.locale??h();return e==="en"?Ye():e==="nl"?Xe():Ke()}),Je=()=>"Configure",tn=()=>"Configureer",en=()=>"Konfigurieren",nn=((n={},t={})=>{const e=t.locale??h();return e==="en"?Je():e==="nl"?tn():en()}),on=()=>"Close",sn=()=>"Sluiten",rn=()=>"Schließen",an=((n={},t={})=>{const e=t.locale??h();return e==="en"?on():e==="nl"?sn():rn()}),ln=()=>"Reset camera",cn=()=>"Camera resetten",un=()=>"Kamera zurücksetzen",dn=((n={},t={})=>{const e=t.locale??h();return e==="en"?ln():e==="nl"?cn():un()}),hn=()=>"Zoom in",mn=()=>"Inzoomen",pn=()=>"Hineinzoomen",fn=((n={},t={})=>{const e=t.locale??h();return e==="en"?hn():e==="nl"?mn():pn()}),gn=()=>"Zoom out",bn=()=>"Uitzoomen",vn=()=>"Herauszoomen",yn=((n={},t={})=>{const e=t.locale??h();return e==="en"?gn():e==="nl"?bn():vn()}),_n=()=>"Rotate left",Cn=()=>"Naar links draaien",wn=()=>"Nach links drehen",kn=((n={},t={})=>{const e=t.locale??h();return e==="en"?_n():e==="nl"?Cn():wn()}),Sn=()=>"Rotate right",An=()=>"Naar rechts draaien",En=()=>"Nach rechts drehen",xn=((n={},t={})=>{const e=t.locale??h();return e==="en"?Sn():e==="nl"?An():En()}),Tn=()=>"Tilt up",Rn=()=>"Omhoog kantelen",On=()=>"Nach oben kippen",Nn=((n={},t={})=>{const e=t.locale??h();return e==="en"?Tn():e==="nl"?Rn():On()}),In=()=>"Tilt down",Ln=()=>"Omlaag kantelen",Mn=()=>"Nach unten kippen",zn=((n={},t={})=>{const e=t.locale??h();return e==="en"?In():e==="nl"?Ln():Mn()}),Pn=()=>"Working…",Fn=()=>"Bezig…",Dn=()=>"Läuft…",$n=((n={},t={})=>{const e=t.locale??h();return e==="en"?Pn():e==="nl"?Fn():Dn()}),Bn=()=>"Done",Un=()=>"Gelukt",Vn=()=>"Fertig",jn=((n={},t={})=>{const e=t.locale??h();return e==="en"?Bn():e==="nl"?Un():Vn()}),Hn=()=>"Failed",Gn=()=>"Mislukt",qn=()=>"Fehlgeschlagen",Zn=((n={},t={})=>{const e=t.locale??h();return e==="en"?Hn():e==="nl"?Gn():qn()});const Wn={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};const xt=([n,t,e])=>{const i=document.createElementNS("http://www.w3.org/2000/svg",n);return Object.keys(t).forEach(o=>{i.setAttribute(o,String(t[o]))}),e?.length&&e.forEach(o=>{const s=xt(o);i.appendChild(s)}),i},Tt=(n,t={})=>{const i={...Wn,...t};return xt(["svg",i,n])};const Yn=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"}],["path",{d:"m3.3 7 8.7 5 8.7-5"}],["path",{d:"M12 22V12"}]];const Xn=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z"}],["circle",{cx:"12",cy:"13",r:"3"}]];const Rt=[["path",{d:"m6 9 6 6 6-6"}]];const Kn=[["path",{d:"m15 18-6-6 6-6"}]];const Qn=[["path",{d:"m9 18 6-6-6-6"}]];const Jn=[["path",{d:"m18 15-6-6-6 6"}]];const ti=[["path",{d:"M15 3h6v6"}],["path",{d:"m21 3-7 7"}],["path",{d:"m3 21 7-7"}],["path",{d:"M9 21H3v-6"}]];const ei=[["path",{d:"m14 10 7-7"}],["path",{d:"M20 10h-6V4"}],["path",{d:"m3 21 7-7"}],["path",{d:"M4 14h6v6"}]];const ni=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}],["path",{d:"M3 3v5h5"}]];const ii=[["path",{d:"M10 5H3"}],["path",{d:"M12 19H3"}],["path",{d:"M14 3v4"}],["path",{d:"M16 17v4"}],["path",{d:"M21 12h-9"}],["path",{d:"M21 19h-5"}],["path",{d:"M21 5h-7"}],["path",{d:"M8 10v4"}],["path",{d:"M8 12H3"}]];const oi=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];const si=[["circle",{cx:"11",cy:"11",r:"8"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11"}]];const ri=[["circle",{cx:"11",cy:"11",r:"8"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11"}]];function y(n,{size:t=20,strokeWidth:e=1.75}={}){return Tt(n,{width:t,height:t,"stroke-width":e})}const g={ar:n=>y(Yn,n),fullscreen:n=>y(ti,n),exitFullscreen:n=>y(ei,n),screenshot:n=>y(Xn,n),tiltUp:n=>y(Jn,n),tiltDown:n=>y(Rt,n),rotateLeft:n=>y(Kn,n),rotateRight:n=>y(Qn,n),zoomIn:n=>y(si,n),zoomOut:n=>y(ri,n),reset:n=>y(ni,n),configurator:n=>y(ii,n),close:n=>y(oi,n)};class b{element;constructor({variant:t="default",size:e="default",label:i,icon:o,onClick:s,disabled:r=!1}={}){this.element=document.createElement("button"),this.element.className=`ui-btn ui-btn--${t} ui-btn--size-${e}`,i!==void 0&&(this.element.setAttribute("aria-label",i),this.element.title=i),o!==void 0?this.element.appendChild(o):i!==void 0&&(this.element.textContent=i),s&&this.element.addEventListener("click",s),this.element.disabled=r}setIcon(t){const e=this.element.querySelector("svg");e!==null?e.replaceWith(t):this.element.appendChild(t)}}const m={semantic:{error:"#dc2626"},neutral:{500:"#737373",600:"#525252",900:"#171717"},white:"#ffffff",black:"#000000"},a={0:"0",.5:"0.125rem",1:"0.25rem",1.5:"0.375rem",2:"0.5rem",3:"0.75rem",4:"1rem",5:"1.25rem",6:"1.5rem",8:"2rem",9:"2.25rem",24:"6rem"};class ai{element;constructor(){this.element=document.createElement("div"),Object.assign(this.element.style,{background:m.white,borderRadius:a[3],padding:a[6],boxShadow:`0 ${a[2]} ${a[8]} oklch(0% 0 0 / 20%)`,maxWidth:"20rem",width:"100%"})}}class li{constructor(t={}){this.options=t,this.card=new ai,this.backdrop=this.createBackdrop(),this.backdrop.appendChild(this.card.element)}options;card;backdrop;keyHandler=null;open(){document.body.appendChild(this.backdrop),this.keyHandler=t=>{t.key==="Escape"&&this.close()},document.addEventListener("keydown",this.keyHandler)}close(){this.backdrop.remove(),this.keyHandler!==null&&(document.removeEventListener("keydown",this.keyHandler),this.keyHandler=null),this.options.onClose?.()}createBackdrop(){const t=document.createElement("div");return Object.assign(t.style,{position:"fixed",inset:a[0],background:"oklch(0% 0 0 / 50%)",zIndex:"9999",display:"flex",alignItems:"center",justifyContent:"center"}),t.addEventListener("click",e=>{e.target===t&&this.close()}),t}}class ci{element;selectCallback=null;constructor(t,e,i){this.element=document.createElement("div"),this.element.className="ui-toggle-group";for(let o=0;o<t.length;o++){const s=t[o],r=document.createElement("button");r.className="ui-toggle-group-item",r.dataset.value=s,r.textContent=i?.[o]??s,r.dataset.state=s===e?"on":"off",r.setAttribute("aria-pressed",s===e?"true":"false"),r.addEventListener("click",()=>{this.selectCallback?.(s)}),this.element.appendChild(r)}}setSelected(t){for(const e of this.element.querySelectorAll(".ui-toggle-group-item")){const i=e.dataset.value===t;e.dataset.state=i?"on":"off",e.setAttribute("aria-pressed",i?"true":"false")}}onSelect(t){this.selectCallback=t}}class ui{element;select;constructor(t,e,i,o,s){this.select=document.createElement("select"),this.select.className="ui-native-select",this.select.dataset.name=t,this.select.setAttribute("aria-label",i);const r=document.createElement("option");r.value="",r.disabled=!0,r.textContent=i,this.select.appendChild(r);let l=!1;for(let u=0;u<e.length;u++){const p=e[u],v=document.createElement("option");v.value=p,v.textContent=s?.[u]??p,p===o&&(v.selected=!0,l=!0),this.select.appendChild(v)}l||(r.selected=!0);const d=Tt(Rt,{width:16,height:16,"stroke-width":2});d.classList.add("ui-native-select-icon"),this.element=document.createElement("div"),this.element.className="ui-native-select-wrap",this.element.appendChild(this.select),this.element.appendChild(d)}setSelected(t){this.select.value=t}onSelect(t){this.select.addEventListener("change",()=>{t(this.select.value)})}}const C={fontFamily:{sans:["Mona Sans","ui-sans-serif","system-ui","sans-serif","Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"]},fontSize:{xs:"0.75rem",sm:"0.875rem",base:"1rem",lg:"1.125rem"},fontWeight:{medium:"500",semibold:"600"}},di=C.fontFamily.sans.join(", ");class hi{qrLib=null;dialog=null;async show(t){this.hide(),this.qrLib??=await Promise.resolve().then(()=>require("./browser-DfB_An57.cjs")).then(o=>o.browser);const e=await this.qrLib.toDataURL(t,{width:256,margin:4,errorCorrectionLevel:"M",color:{dark:m.black,light:m.white}});this.dialog=new li({onClose:()=>{this.dialog=null}}),Object.assign(this.dialog.card.element.style,{display:"flex",flexDirection:"column",alignItems:"center",gap:a[3],fontFamily:di}),this.dialog.card.element.appendChild(this.createText(Ae(),{fontSize:C.fontSize.base,fontWeight:C.fontWeight.semibold,color:m.neutral[900]})),this.dialog.card.element.appendChild(this.createText(Re(),{fontSize:C.fontSize.sm,color:m.neutral[600]})),this.dialog.card.element.appendChild(this.createQrImage(e)),this.dialog.card.element.appendChild(this.createText(Le(),{fontSize:C.fontSize.xs,color:m.neutral[500]}));const i=new b({variant:"outline",label:Fe(),onClick:()=>{this.hide()}});this.dialog.card.element.appendChild(i.element),this.dialog.open()}hide(){this.dialog?.close(),this.dialog=null}createText(t,e){const i=document.createElement("p");return i.textContent=t,Object.assign(i.style,{margin:"0",textAlign:"center",...e}),i}createQrImage(t){const e=document.createElement("img");return e.src=t,e.alt="QR code",Object.assign(e.style,{width:a[24],height:a[24],borderRadius:a[1]}),e}}const E=C.fontFamily.sans.join(", "),mi=`
|
|
2
2
|
--primary: oklch(5% 0 0);
|
|
3
3
|
--primary-foreground: oklch(100% 0 0);
|
|
4
4
|
--secondary: oklch(92% 0 0);
|
|
@@ -82,7 +82,7 @@ class St {
|
|
|
82
82
|
}
|
|
83
83
|
buildUrl() {
|
|
84
84
|
const t = this.getServerUrl(), e = new URL(t);
|
|
85
|
-
return e.searchParams.set("license", this.options.license), e.searchParams.set("model", this.options.model), this.options.language !== void 0 && e.searchParams.set("language", this.options.language), this.options.debug === !0 && e.searchParams.set("debug", "true"), this.options.traceparent !== void 0 && e.searchParams.set("traceparent", this.options.traceparent),
|
|
85
|
+
return e.searchParams.set("license", this.options.license), e.searchParams.set("model", this.options.model), this.options.language !== void 0 && e.searchParams.set("language", this.options.language), this.options.debug === !0 && e.searchParams.set("debug", "true"), this.options.traceparent !== void 0 && e.searchParams.set("traceparent", this.options.traceparent), e.toString();
|
|
86
86
|
}
|
|
87
87
|
getServerUrl() {
|
|
88
88
|
if (kt?.VITE_VIRTUALDISPLAY_SERVER_HOST === void 0)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(M,et){typeof exports=="object"&&typeof module<"u"?et(exports):typeof define=="function"&&define.amd?define(["exports"],et):(M=typeof globalThis<"u"?globalThis:M||self,et(M.VirtualdisplayClient={}))})(this,(function(M){"use strict";function et(n,t){for(var e=0;e<t.length;e++){const i=t[e];if(typeof i!="string"&&!Array.isArray(i)){for(const o in i)if(o!=="default"&&!(o in n)){const r=Object.getOwnPropertyDescriptor(i,o);r&&Object.defineProperty(n,o,r.get?r:{enumerable:!0,get:()=>i[o]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}const U={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 O extends Error{code;constructor(t,e){super(t),this.name="VirtualdisplayError",this.code=e}static noMapping(){return new O("No attributes available. Waiting for server metadata.",U.NO_MAPPING)}static attributeNotFound(t){return new O(`Attribute "${t}" not found in mapping`,U.ATTRIBUTE_NOT_FOUND)}static valueNotFound(t,e){return new O(`Value "${e}" not found for attribute "${t}"`,U.VALUE_NOT_FOUND)}static parentNotFound(t){return new O(`Parent element not found: ${t}`,U.PARENT_NOT_FOUND)}static invalidParameter(t){return new O(t,U.INVALID_PARAMETER)}static snapshotFailed(t,e){return new O(`Snapshot failed for "${t}": ${e}`,U.SNAPSHOT_FAILED)}}const pn={};class bn{defaultServer="https://server.virtualdisplay.io";options;constructor(t){this.options=t}create(){const t=this.createContainer(),e=this.createIframe();return t.appendChild(e),this.attachToParent(t),{container:t,iframe:e}}createContainer(){const t=document.createElement("div");return t.className="vd-container",Object.assign(t.style,{position:"relative",width:"100%",height:"100%",overflow:"hidden"}),t}createIframe(){const t=document.createElement("iframe");return t.src=this.buildUrl(),Object.assign(t.style,{width:"100%",height:"100%",border:"none",display:"block"}),t.setAttribute("allow","xr-spatial-tracking; fullscreen"),t}attachToParent(t){this.getParentElement().appendChild(t)}buildUrl(){const t=this.getServerUrl(),e=new URL(t);return e.searchParams.set("license",this.options.license),e.searchParams.set("model",this.options.model),this.options.language!==void 0&&e.searchParams.set("language",this.options.language),this.options.debug===!0&&e.searchParams.set("debug","true"),this.options.traceparent!==void 0&&e.searchParams.set("traceparent",this.options.traceparent),this.options.cache!==void 0&&e.searchParams.set("cache",this.options.cache?"true":"false"),e.toString()}getServerUrl(){if(pn?.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 O.parentNotFound(this.options.parent);return t}}function vn(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,r=["timestamp","level","msg","service","trace_id","span_id"],s=Object.entries(n).filter(([a])=>!r.includes(a)).map(([a,l])=>`${a}=${JSON.stringify(l)}`).join(" ");return`${t} ${e} [${i}] ${o}${s?" "+s:""}`}function yn(n){return JSON.stringify(n)}function wn(n,t){const e=t?vn(n):yn(n);n.level==="error"?console.error(e):n.level==="warn"?console.warn(e):console.log(e)}function Wt(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?Wt(n.cause,t+1):String(n.cause)),e}function Cn(n){const t={};for(const[e,i]of Object.entries(n))t[e]=i instanceof Error?Wt(i):i;return t}function En(){return new Date}function _n(n){return n.toISOString()}function Qt(){return typeof navigator>"u"?"":navigator.userAgent}function An(){return typeof navigator>"u"?!1:navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1}function Sn(){return/iPhone|iPad|iPod/i.test(Qt())||An()}function kn(){return/Android/i.test(Qt())}function Tn(){return Sn()||kn()}class ct{constructor(t){this.config=t}config;log(t,e,i={}){const o=this.config.traceProvider?.()??{},r={timestamp:_n(En()),level:t,msg:e,service:this.config.service,...o,...Cn(i)};wn(r,this.config.isDev)}debug(t,e){this.config.isDev&&this.log("debug",t,e)}info(t,e){this.log("info",t,e)}warn(t,e){this.log("warn",t,e)}error(t,e){this.log("error",t,e)}with(t){const e=new ct(this.config);return e.log=((i,o,r={})=>{this.log(i,o,{...t,...r})}).bind(this),e}}function Xt(n,t){const e=t?.isDev!==void 0?t.isDev:typeof process<"u"?process.env.NODE_ENV!=="production":!0;return new ct({service:n,isDev:e,traceProvider:t?.traceProvider})}function ot(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 te(n){return{debug:(t,e)=>n.debug(t,ot(e)),info:(t,e)=>n.info(t,ot(e)),warn:(t,e)=>n.warn(t,ot(e)),error:(t,e)=>n.error(t,ot(e))}}let ee=!1;M.logger=te(Xt("client",{isDev:!1}));function ne(){ee=!0,M.logger=te(Xt("client",{isDev:!0}))}function Rn(){return ee}class Nn{ready=!1;onReady;constructor(t){this.onReady=t}handleMappingReceived(){this.ready||(this.ready=!0,M.logger.info("Mapping received from server, client is now ready"),this.onReady?.())}get isReady(){return this.ready}clear(){this.ready=!1}}const I={HANDSHAKE:"handshake",MUTATION:"mutation",STATE:"state",LOADING_INDICATOR:"loading_indicator",CAMERA:"camera",SNAPSHOT:"snapshot",MAPPING:"mapping",AR_ACTIVATE:"ar_activate",CONFIG:"config",ANNOTATION_PLACE_MODE:"annotation_place_mode",ANNOTATION_PLACED:"annotation_placed",ANNOTATION_TOGGLE:"annotation_toggle",FOCUS:"focus",PRICING:"pricing"},ie={FOCUS:"focus",UNFOCUS:"unfocus"},In={FOCUSED:"focused"},Mn={HIDDEN:"hidden"},Pn=new Set(Object.values(I));function Bn(n){if(typeof n!="object"||n===null)return!1;const t=n;return typeof t.target=="string"?!1:typeof t.type=="string"&&Pn.has(t.type)}function Ln(n){const t=V(n);return t!==null&&t.type===I.HANDSHAKE}function On(n){const t=V(n);return t!==null&&t.type===I.MUTATION&&Array.isArray(t.results)}function xn(n){const t=V(n);return t!==null&&t.type===I.SNAPSHOT&&("data"in t||"error"in t)}function Dn(n){const t=V(n);return t!==null&&t.type===I.CAMERA&&Array.isArray(t.transforms)}function zn(n){const t=V(n);return t!==null&&t.type===I.MAPPING&&Array.isArray(t.attributes)}function Fn(n){const t=V(n);return t!==null&&t.type===I.LOADING_INDICATOR&&typeof t.progress=="number"}function Un(n){const t=V(n);return t!==null&&t.type===I.CONFIG&&typeof t.viewerSettings=="object"}function $n(n){const t=V(n);return t!==null&&t.type===I.ANNOTATION_PLACED&&typeof t.position=="object"&&t.position!==null}function Vn(n){const t=V(n);return t!==null&&t.type===I.FOCUS&&typeof t.state=="string"}function qn(n){const t=V(n);return t!==null&&t.type===I.PRICING&&typeof t.pricing=="object"&&t.pricing!==null}function V(n){return typeof n!="object"||n===null?null:n}class oe{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 jn{constructor(t,e){this.getTarget=t,this.sourceId=`vd-${Math.random().toString(36).slice(2,8)}`,this.targetOrigin=e?.targetOrigin??"*",this.publisher=new oe(i=>this.post(i)),this.consumer=new oe(i=>this.routeToHandler(i)),this.shouldBuffer=e?.shouldBuffer??null,e?.bufferIncoming!==!0&&this.consumer.markReady()}getTarget;handlers=new Map;publisher;consumer;shouldBuffer;listener=null;sourceId;targetOrigin;on(t,e){this.handlers.set(t,e)}off(t){this.handlers.delete(t)}setTargetOrigin(t){this.targetOrigin=t}send(t){this.publisher.enqueue(t)}markReady(){this.publisher.markReady()}markConsumerReady(){this.consumer.markReady()}consumerHasPending(t){return this.consumer.hasPending(t)}start(){this.listener===null&&(this.listener=t=>{const{data:e}=t;if(!Bn(e)||e._source===this.sourceId)return;const i=this.getTarget();if(i!==null&&t.source!==null&&t.source!==i)return;const o=e;if(this.shouldBuffer!==null&&!this.shouldBuffer(o)){this.routeToHandler(o);return}this.consumer.enqueue(o)},window.addEventListener("message",this.listener))}destroy(){this.listener!==null&&(window.removeEventListener("message",this.listener),this.listener=null),this.publisher.clear(),this.consumer.clear(),this.handlers.clear()}get ready(){return this.publisher.ready}get pendingCount(){return this.publisher.pendingCount}post(t){const e=this.getTarget();e!==null&&e.postMessage({...t,_source:this.sourceId},this.targetOrigin)}routeToHandler(t){const e=this.handlers.get(t.type);if(e===void 0)return;const i=e(t);i instanceof Promise&&i.catch(o=>{const r=o instanceof Error?o.message:String(o);console.error(`Virtualdisplay: error handling ${t.type}: ${r}`)})}}class re{constructor(t){this.send=t}send;placedCallbacks=[];setEnabled(t){this.send({type:I.ANNOTATION_TOGGLE,enabled:t})}startPlacing(){this.send({type:I.ANNOTATION_PLACE_MODE,enabled:!0})}stopPlacing(){this.send({type:I.ANNOTATION_PLACE_MODE,enabled:!1})}onPlaced(t){this.placedCallbacks.push(t)}handlePlaced(t){for(const e of this.placedCallbacks)e(t)}}class se{constructor(t,e){this.value=t,this.attribute=e}value;attribute;isSelectedValue=!1;get isSelected(){return this.isSelectedValue}setSelected(t){this.isSelectedValue=t}}class ae{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 O.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 se(i,this.name);i===this.defaultValue&&o.setSelected(!0),e.set(i,o)}return e}}class Hn{attributes=new Map;constructor(t,e,i){for(const o of t){const r=this.buildOptions(o,e);this.attributes.set(o.name,new ae(r))}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,r)=>{e([{name:o,value:r}],!1)}};return t.defaultValue!==void 0?{...i,defaultValue:t.defaultValue}:i}}class Gn{constructor(t,e){this.send=t,this.onMutationFailed=e}send;onMutationFailed;registry;pendingCallbacks=[];handleMappingReceived(t){M.logger.debug("Initializing from server mapping",{attributeCount:t.attributes.length}),this.registry=new Hn(t.attributes,(e,i)=>this.sendMutation(e,i),this.onMutationFailed),this.replayPendingCallbacks()}handleMutationResult(t){this.registry?.handleResults(t.results)}select(t,e){this.sendMutation([{name:t,value:e}],!1)}getValues(t){return this.registry?.get(t)?.getValues()??[]}getValue(t,e){return this.registry?.get(t)?.getValue(e)}onChange(t,e){if(this.registry===void 0){this.pendingCallbacks.push({name:t,callback:e});return}const i=this.registry.get(t);if(i===void 0){M.logger.warn(`onChange: attribute "${t}" not found — callback will not fire`);return}i.onChange(e)}getAttribute(t){return this.registry?.get(t)}getSelection(){return this.registry?.getSelection()??{}}get hasMapping(){return this.registry!==void 0}sendMutation(t,e){const i={type:I.MUTATION,mutations:t,isInitial:e};this.send(i)}replayPendingCallbacks(){for(const{name:t,callback:e}of this.pendingCallbacks){const i=this.registry?.get(t);i===void 0&&M.logger.warn(`onChange: attribute "${t}" not found — buffered callback will not fire`),i?.onChange(e)}this.pendingCallbacks.length=0}}let le=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 O.invalidParameter("No camera commands to execute. Call rotate(), tilt(), or zoom() before set().");const t={type:I.CAMERA,commands:this.commands};this.send(t),this.commands=[]}validateFiniteNumber(t,e){if(!Number.isFinite(t))throw O.invalidParameter(`${e}() requires a finite number, got ${String(t)}`)}reset(){const t={type:I.CAMERA,commands:[{action:"reset"}]};this.send(t)}};class Kn{state;limitsState;changeCallbacks=[];constructor(){this.state={rotation:0,tilt:0,zoom:100}}get rotation(){return this.state.rotation}get tilt(){return this.state.tilt}get zoom(){return this.state.zoom}onChange(t){this.changeCallbacks.push(t)}get limits(){return this.limitsState}applyLimits(t){this.limitsState=t;const e={rotation:this.rotation,tilt:this.tilt,zoom:this.zoom};for(const i of this.changeCallbacks)i(e)}handlePositionUpdate(t){this.update(t.transforms)}update(t){let e=!1;for(const i of t)switch(i.type){case"rotation":this.state.rotation=i.value,e=!0;break;case"tilt":this.state.tilt=i.value,e=!0;break;case"zoom":this.state.zoom=i.value,e=!0;break}if(e){const i={rotation:this.rotation,tilt:this.tilt,zoom:this.zoom};for(const o of this.changeCallbacks)o(i)}}}const Z={SELECT:"ui:select",SELECTED:"ui:selected",FOCUS_CHANGE:"vd:focus-change",CONFIGURATION_CHANGE:"vd:configuration-change",CONFIGURATION_SUBMIT:"vd:configuration-submit"};class ce{constructor(t,e){this.send=t,this.dispatch=e}send;dispatch;focused=null;attributes=[];changeCallbacks=[];get current(){return this.focused}set(t){if(typeof t!="string"||t.length===0)throw O.invalidParameter(`set() requires a non-empty component name, got ${String(t)}`);this.send({type:I.FOCUS,action:ie.FOCUS,component:t})}clear(){this.send({type:I.FOCUS,action:ie.UNFOCUS})}onChange(t){this.changeCallbacks.push(t)}handleStateReceived(t){t.state===In.FOCUSED&&t.component!==void 0?(this.focused=t.component,this.attributes=t.attributes??[]):(this.focused=null,this.attributes=[]);const e=this.focused!==null?{component:this.focused,attributes:this.attributes}:null;for(const i of this.changeCallbacks)i(e);this.dispatch(e)}}function Yn(n,t){const e=n.filter(r=>Jn(r,t));if(e.length===0)return;const i=Math.max(...e.map(ue)),o=e.filter(r=>ue(r)===i);return o.length===1?o[0]:void 0}function Jn(n,t){return Object.entries(n.attributes).every(([e,i])=>t[e]===i)}function ue(n){return Object.keys(n.attributes).length}class de{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=Yn(this.pricing.rules,this.selection);if(!(t===void 0||t.availability===Mn.HIDDEN))return{attributes:{...this.selection},reference:t.reference,price:t.priceCents,currency:this.pricing.currency,availability:t.availability}}}class he{constructor(t){this.filename=t}filename;developedCallbacks=new Set;errorCallbacks=new Set;developed=!1;failed=!1;photoData=null;onDeveloped(t){return this.developed&&this.photoData!==null?(t(this.photoData),this):(this.developedCallbacks.add(t),this)}onError(t){return this.errorCallbacks.add(t),this}getFilename(){return this.filename}develop(t){this.developed||this.failed||(this.photoData=t,this.developed=!0,this.developedCallbacks.forEach(e=>{e(this.photoData)}),this.developedCallbacks.clear(),this.errorCallbacks.clear())}fail(t){this.developed||this.failed||(this.failed=!0,this.errorCallbacks.forEach(e=>{e(t)}),this.developedCallbacks.clear(),this.errorCallbacks.clear())}}class fe{constructor(t){this.send=t}send;validExtensions=[".png"];pendingPhotos=new Map;take(t){this.validateFilename(t),M.logger.debug("Taking snapshot",{filename:t});const e=new he(t);return this.pendingPhotos.set(e.getFilename(),e),this.send({type:I.SNAPSHOT,filename:t}),e}handleSnapshotResult(t){const e=this.pendingPhotos.get(t.filename);if(e===void 0){M.logger.warn("No pending photo found for filename",{filename:t.filename,pendingFilenames:Array.from(this.pendingPhotos.keys())});return}if(this.pendingPhotos.delete(t.filename),t.error!==void 0){e.fail(new O(t.error,U.SNAPSHOT_FAILED));return}t.data!==void 0&&e.develop({filename:t.filename,data:t.data})}clear(){if(this.pendingPhotos.size===0)return;const t=new O("Client destroyed before snapshot completed",U.SNAPSHOT_FAILED);for(const e of this.pendingPhotos.values())e.fail(t);this.pendingPhotos.clear()}validateFilename(t){if(t===""||typeof t!="string")throw new O("Filename must be a non-empty string",U.INVALID_PARAMETER);if(!this.validExtensions.some(i=>t.toLowerCase().endsWith(i)))throw new O(`Invalid filename: "${t}". Filename must end with one of: ${this.validExtensions.join(", ")}`,U.INVALID_PARAMETER);if(t.includes("..")||t.includes("/")||t.includes("\\"))throw new O('Filename cannot contain path separators or ".."',U.INVALID_PARAMETER)}}class Zn{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 r=o,s={...r.detail,preventDefault:()=>{r.preventDefault()}};e(s)};return this.container?.addEventListener(t,i),()=>{this.container?.removeEventListener(t,i)}}}const Wn={},Qn="en",ge=["en","nl","de"],ut=["baseLocale"],me=[];let pe,be;function Xn(n){if(me.length===0)return;const t=typeof n=="string"?n:n.href;if(pe===t)return be;const e=new URL(t,"http://dummy.com");let i;for(const o of me)if(new Wn(o.match,e.href).exec(e.href)){i=o;break}return pe=t,be=i,i}function ve(n){const t=Xn(n);return t&&t.exclude!==!0&&Array.isArray(t.strategy)?t.strategy:ut}const dt=typeof window>"u";globalThis.__paraglide=globalThis.__paraglide??{},globalThis.__paraglide.ssr=globalThis.__paraglide.ssr??{};let ye=!1,P=()=>{let n=ut;!dt&&typeof window<"u"&&window.location?.href&&(n=ve(window.location.href));const t=ti(n);if(t)return ye||(ye=!0,we(t,{reload:!1})),t;throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found")};function ti(n,t){let e;for(const i of n){if(i==="baseLocale")e=Qn;else if(Ee(i)&&rt.has(i)){const r=rt.get(i);if(r){const s=r.getLocale();if(s instanceof Promise)continue;if(s!==void 0)return ni(s)}}const o=Ce(e);if(o)return o}}const ei=n=>{window.location.reload()};let we=(n,t)=>{const e={reload:!0,...t};let i;try{i=P()}catch{}const o=[];let r=ut;!dt&&typeof window<"u"&&window.location?.href&&(r=ve(window.location.href));for(const a of r)if(a!=="baseLocale"&&Ee(a)&&rt.has(a)){const l=rt.get(a);if(l){let c=l.setLocale(n);c instanceof Promise&&(c=c.catch(u=>{throw new Error(`Custom strategy "${a}" setLocale failed.`,{cause:u})}),o.push(c))}}const s=()=>{!dt&&e.reload&&window.location&&n!==i&&ei()};if(o.length)return Promise.all(o).then(()=>{s()});s()};function Ce(n){if(typeof n!="string")return;const t=n.toLowerCase();for(const e of ge)if(e.toLowerCase()===t)return e}function ni(n){const t=Ce(n);if(t)return t;throw new Error(`Invalid locale: ${n}. Expected one of: ${ge.join(", ")}`)}const rt=new Map;function Ee(n){return typeof n=="string"&&/^custom-[A-Za-z0-9_-]+$/.test(n)}const ii=()=>"Activate AR",oi=()=>"AR activeren",ri=()=>"AR aktivieren",si=((n={},t={})=>{const e=t.locale??P();return e==="en"?ii():e==="nl"?oi():ri()}),ai=()=>"Scan to view in AR",li=()=>"Scan om in AR te bekijken",ci=()=>"Scannen für AR-Ansicht",ui=((n={},t={})=>{const e=t.locale??P();return e==="en"?ai():e==="nl"?li():ci()}),di=()=>"Use your smartphone camera to scan this QR code",hi=()=>"Gebruik de camera van je smartphone om deze QR-code te scannen",fi=()=>"Verwenden Sie die Kamera Ihres Smartphones, um diesen QR-Code zu scannen",gi=((n={},t={})=>{const e=t.locale??P();return e==="en"?di():e==="nl"?hi():fi()}),mi=()=>"Your phone will open the 3D model in AR mode.",pi=()=>"Je telefoon opent het 3D-model in AR-modus.",bi=()=>"Das 3D-Modell wird im AR-Modus Ihres Telefons geöffnet",vi=((n={},t={})=>{const e=t.locale??P();return e==="en"?mi():e==="nl"?pi():bi()}),yi=()=>"Close",wi=()=>"Sluiten",Ci=()=>"Schließen",Ei=((n={},t={})=>{const e=t.locale??P();return e==="en"?yi():e==="nl"?wi():Ci()}),_i=()=>"Fullscreen",Ai=()=>"Volledig scherm",Si=()=>"Vollbild",ki=((n={},t={})=>{const e=t.locale??P();return e==="en"?_i():e==="nl"?Ai():Si()}),Ti=()=>"Downloading",Ri=()=>"Downloaden",Ni=()=>"Herunterladen",_e=((n={},t={})=>{const e=t.locale??P();return e==="en"?Ti():e==="nl"?Ri():Ni()}),Ii=()=>"Rendering",Mi=()=>"Renderen",Pi=()=>"Rendern",Bi=((n={},t={})=>{const e=t.locale??P();return e==="en"?Ii():e==="nl"?Mi():Pi()}),Li=()=>"Screenshot",Oi=()=>"Screenshot",xi=()=>"Screenshot",Di=((n={},t={})=>{const e=t.locale??P();return e==="en"?Li():e==="nl"?Oi():xi()}),zi=()=>"Configure",Fi=()=>"Configureer",Ui=()=>"Konfigurieren",$i=((n={},t={})=>{const e=t.locale??P();return e==="en"?zi():e==="nl"?Fi():Ui()}),Vi=()=>"Close",qi=()=>"Sluiten",ji=()=>"Schließen",Hi=((n={},t={})=>{const e=t.locale??P();return e==="en"?Vi():e==="nl"?qi():ji()}),Gi=()=>"Reset camera",Ki=()=>"Camera resetten",Yi=()=>"Kamera zurücksetzen",Ji=((n={},t={})=>{const e=t.locale??P();return e==="en"?Gi():e==="nl"?Ki():Yi()}),Zi=()=>"Zoom in",Wi=()=>"Inzoomen",Qi=()=>"Hineinzoomen",Xi=((n={},t={})=>{const e=t.locale??P();return e==="en"?Zi():e==="nl"?Wi():Qi()}),to=()=>"Zoom out",eo=()=>"Uitzoomen",no=()=>"Herauszoomen",io=((n={},t={})=>{const e=t.locale??P();return e==="en"?to():e==="nl"?eo():no()}),oo=()=>"Rotate left",ro=()=>"Naar links draaien",so=()=>"Nach links drehen",ao=((n={},t={})=>{const e=t.locale??P();return e==="en"?oo():e==="nl"?ro():so()}),lo=()=>"Rotate right",co=()=>"Naar rechts draaien",uo=()=>"Nach rechts drehen",ho=((n={},t={})=>{const e=t.locale??P();return e==="en"?lo():e==="nl"?co():uo()}),fo=()=>"Tilt up",go=()=>"Omhoog kantelen",mo=()=>"Nach oben kippen",po=((n={},t={})=>{const e=t.locale??P();return e==="en"?fo():e==="nl"?go():mo()}),bo=()=>"Tilt down",vo=()=>"Omlaag kantelen",yo=()=>"Nach unten kippen",wo=((n={},t={})=>{const e=t.locale??P();return e==="en"?bo():e==="nl"?vo():yo()}),Co=()=>"Working…",Eo=()=>"Bezig…",_o=()=>"Läuft…",Ao=((n={},t={})=>{const e=t.locale??P();return e==="en"?Co():e==="nl"?Eo():_o()}),So=()=>"Done",ko=()=>"Gelukt",To=()=>"Fertig",Ro=((n={},t={})=>{const e=t.locale??P();return e==="en"?So():e==="nl"?ko():To()}),No=()=>"Failed",Io=()=>"Mislukt",Mo=()=>"Fehlgeschlagen",Po=((n={},t={})=>{const e=t.locale??P();return e==="en"?No():e==="nl"?Io():Mo()});const Bo={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 Ae=([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 r=Ae(o);i.appendChild(r)}),i},Se=(n,t={})=>{const i={...Bo,...t};return Ae(["svg",i,n])};const Lo=[["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 Oo=[["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 ke=[["path",{d:"m6 9 6 6 6-6"}]];const xo=[["path",{d:"m15 18-6-6 6-6"}]];const Do=[["path",{d:"m9 18 6-6-6-6"}]];const zo=[["path",{d:"m18 15-6-6-6 6"}]];const Fo=[["path",{d:"M15 3h6v6"}],["path",{d:"m21 3-7 7"}],["path",{d:"m3 21 7-7"}],["path",{d:"M9 21H3v-6"}]];const Uo=[["path",{d:"m14 10 7-7"}],["path",{d:"M20 10h-6V4"}],["path",{d:"m3 21 7-7"}],["path",{d:"M4 14h6v6"}]];const $o=[["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 Vo=[["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 qo=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];const jo=[["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 Ho=[["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 F(n,{size:t=20,strokeWidth:e=1.75}={}){return Se(n,{width:t,height:t,"stroke-width":e})}const D={ar:n=>F(Lo,n),fullscreen:n=>F(Fo,n),exitFullscreen:n=>F(Uo,n),screenshot:n=>F(Oo,n),tiltUp:n=>F(zo,n),tiltDown:n=>F(ke,n),rotateLeft:n=>F(xo,n),rotateRight:n=>F(Do,n),zoomIn:n=>F(jo,n),zoomOut:n=>F(Ho,n),reset:n=>F($o,n),configurator:n=>F(Vo,n),close:n=>F(qo,n)};class z{element;constructor({variant:t="default",size:e="default",label:i,icon:o,onClick:r,disabled:s=!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),r&&this.element.addEventListener("click",r),this.element.disabled=s}setIcon(t){const e=this.element.querySelector("svg");e!==null?e.replaceWith(t):this.element.appendChild(t)}}const L={semantic:{error:"#dc2626"},neutral:{500:"#737373",600:"#525252",900:"#171717"},white:"#ffffff",black:"#000000"},_={0:"0",.5:"0.125rem",1:"0.25rem",1.5:"0.375rem",2:"0.5rem",3:"0.75rem",4:"1rem",5:"1.25rem",6:"1.5rem",8:"2rem",9:"2.25rem",24:"6rem"};class Go{element;constructor(){this.element=document.createElement("div"),Object.assign(this.element.style,{background:L.white,borderRadius:_[3],padding:_[6],boxShadow:`0 ${_[2]} ${_[8]} oklch(0% 0 0 / 20%)`,maxWidth:"20rem",width:"100%"})}}class Ko{constructor(t={}){this.options=t,this.card=new Go,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:_[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 Yo{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 r=t[o],s=document.createElement("button");s.className="ui-toggle-group-item",s.dataset.value=r,s.textContent=i?.[o]??r,s.dataset.state=r===e?"on":"off",s.setAttribute("aria-pressed",r===e?"true":"false"),s.addEventListener("click",()=>{this.selectCallback?.(r)}),this.element.appendChild(s)}}setSelected(t){for(const e of this.element.querySelectorAll(".ui-toggle-group-item")){const i=e.dataset.value===t;e.dataset.state=i?"on":"off",e.setAttribute("aria-pressed",i?"true":"false")}}onSelect(t){this.selectCallback=t}}class Jo{element;select;constructor(t,e,i,o,r){this.select=document.createElement("select"),this.select.className="ui-native-select",this.select.dataset.name=t,this.select.setAttribute("aria-label",i);const s=document.createElement("option");s.value="",s.disabled=!0,s.textContent=i,this.select.appendChild(s);let a=!1;for(let c=0;c<e.length;c++){const u=e[c],h=document.createElement("option");h.value=u,h.textContent=r?.[c]??u,u===o&&(h.selected=!0,a=!0),this.select.appendChild(h)}a||(s.selected=!0);const l=Se(ke,{width:16,height:16,"stroke-width":2});l.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(l)}setSelected(t){this.select.value=t}onSelect(t){this.select.addEventListener("change",()=>{t(this.select.value)})}}const $={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"}},Zo=$.fontFamily.sans.join(", ");class Wo{qrLib=null;dialog=null;async show(t){this.hide(),this.qrLib??=await Promise.resolve().then(()=>Yr);const e=await this.qrLib.toDataURL(t,{width:256,margin:4,errorCorrectionLevel:"M",color:{dark:L.black,light:L.white}});this.dialog=new Ko({onClose:()=>{this.dialog=null}}),Object.assign(this.dialog.card.element.style,{display:"flex",flexDirection:"column",alignItems:"center",gap:_[3],fontFamily:Zo}),this.dialog.card.element.appendChild(this.createText(ui(),{fontSize:$.fontSize.base,fontWeight:$.fontWeight.semibold,color:L.neutral[900]})),this.dialog.card.element.appendChild(this.createText(gi(),{fontSize:$.fontSize.sm,color:L.neutral[600]})),this.dialog.card.element.appendChild(this.createQrImage(e)),this.dialog.card.element.appendChild(this.createText(vi(),{fontSize:$.fontSize.xs,color:L.neutral[500]}));const i=new z({variant:"outline",label:Ei(),onClick:()=>{this.hide()}});this.dialog.card.element.appendChild(i.element),this.dialog.open()}hide(){this.dialog?.close(),this.dialog=null}createText(t,e){const i=document.createElement("p");return i.textContent=t,Object.assign(i.style,{margin:"0",textAlign:"center",...e}),i}createQrImage(t){const e=document.createElement("img");return e.src=t,e.alt="QR code",Object.assign(e.style,{width:_[24],height:_[24],borderRadius:_[1]}),e}}const W=$.fontFamily.sans.join(", "),Qo=`
|
|
1
|
+
(function(M,et){typeof exports=="object"&&typeof module<"u"?et(exports):typeof define=="function"&&define.amd?define(["exports"],et):(M=typeof globalThis<"u"?globalThis:M||self,et(M.VirtualdisplayClient={}))})(this,(function(M){"use strict";function et(n,t){for(var e=0;e<t.length;e++){const i=t[e];if(typeof i!="string"&&!Array.isArray(i)){for(const o in i)if(o!=="default"&&!(o in n)){const r=Object.getOwnPropertyDescriptor(i,o);r&&Object.defineProperty(n,o,r.get?r:{enumerable:!0,get:()=>i[o]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}const U={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 O extends Error{code;constructor(t,e){super(t),this.name="VirtualdisplayError",this.code=e}static noMapping(){return new O("No attributes available. Waiting for server metadata.",U.NO_MAPPING)}static attributeNotFound(t){return new O(`Attribute "${t}" not found in mapping`,U.ATTRIBUTE_NOT_FOUND)}static valueNotFound(t,e){return new O(`Value "${e}" not found for attribute "${t}"`,U.VALUE_NOT_FOUND)}static parentNotFound(t){return new O(`Parent element not found: ${t}`,U.PARENT_NOT_FOUND)}static invalidParameter(t){return new O(t,U.INVALID_PARAMETER)}static snapshotFailed(t,e){return new O(`Snapshot failed for "${t}": ${e}`,U.SNAPSHOT_FAILED)}}const pn={};class bn{defaultServer="https://server.virtualdisplay.io";options;constructor(t){this.options=t}create(){const t=this.createContainer(),e=this.createIframe();return t.appendChild(e),this.attachToParent(t),{container:t,iframe:e}}createContainer(){const t=document.createElement("div");return t.className="vd-container",Object.assign(t.style,{position:"relative",width:"100%",height:"100%",overflow:"hidden"}),t}createIframe(){const t=document.createElement("iframe");return t.src=this.buildUrl(),Object.assign(t.style,{width:"100%",height:"100%",border:"none",display:"block"}),t.setAttribute("allow","xr-spatial-tracking; fullscreen"),t}attachToParent(t){this.getParentElement().appendChild(t)}buildUrl(){const t=this.getServerUrl(),e=new URL(t);return e.searchParams.set("license",this.options.license),e.searchParams.set("model",this.options.model),this.options.language!==void 0&&e.searchParams.set("language",this.options.language),this.options.debug===!0&&e.searchParams.set("debug","true"),this.options.traceparent!==void 0&&e.searchParams.set("traceparent",this.options.traceparent),e.toString()}getServerUrl(){if(pn?.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 O.parentNotFound(this.options.parent);return t}}function vn(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,r=["timestamp","level","msg","service","trace_id","span_id"],s=Object.entries(n).filter(([a])=>!r.includes(a)).map(([a,l])=>`${a}=${JSON.stringify(l)}`).join(" ");return`${t} ${e} [${i}] ${o}${s?" "+s:""}`}function yn(n){return JSON.stringify(n)}function wn(n,t){const e=t?vn(n):yn(n);n.level==="error"?console.error(e):n.level==="warn"?console.warn(e):console.log(e)}function Wt(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?Wt(n.cause,t+1):String(n.cause)),e}function Cn(n){const t={};for(const[e,i]of Object.entries(n))t[e]=i instanceof Error?Wt(i):i;return t}function En(){return new Date}function _n(n){return n.toISOString()}function Qt(){return typeof navigator>"u"?"":navigator.userAgent}function An(){return typeof navigator>"u"?!1:navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1}function Sn(){return/iPhone|iPad|iPod/i.test(Qt())||An()}function kn(){return/Android/i.test(Qt())}function Tn(){return Sn()||kn()}class ct{constructor(t){this.config=t}config;log(t,e,i={}){const o=this.config.traceProvider?.()??{},r={timestamp:_n(En()),level:t,msg:e,service:this.config.service,...o,...Cn(i)};wn(r,this.config.isDev)}debug(t,e){this.config.isDev&&this.log("debug",t,e)}info(t,e){this.log("info",t,e)}warn(t,e){this.log("warn",t,e)}error(t,e){this.log("error",t,e)}with(t){const e=new ct(this.config);return e.log=((i,o,r={})=>{this.log(i,o,{...t,...r})}).bind(this),e}}function Xt(n,t){const e=t?.isDev!==void 0?t.isDev:typeof process<"u"?process.env.NODE_ENV!=="production":!0;return new ct({service:n,isDev:e,traceProvider:t?.traceProvider})}function ot(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 te(n){return{debug:(t,e)=>n.debug(t,ot(e)),info:(t,e)=>n.info(t,ot(e)),warn:(t,e)=>n.warn(t,ot(e)),error:(t,e)=>n.error(t,ot(e))}}let ee=!1;M.logger=te(Xt("client",{isDev:!1}));function ne(){ee=!0,M.logger=te(Xt("client",{isDev:!0}))}function Rn(){return ee}class Nn{ready=!1;onReady;constructor(t){this.onReady=t}handleMappingReceived(){this.ready||(this.ready=!0,M.logger.info("Mapping received from server, client is now ready"),this.onReady?.())}get isReady(){return this.ready}clear(){this.ready=!1}}const I={HANDSHAKE:"handshake",MUTATION:"mutation",STATE:"state",LOADING_INDICATOR:"loading_indicator",CAMERA:"camera",SNAPSHOT:"snapshot",MAPPING:"mapping",AR_ACTIVATE:"ar_activate",CONFIG:"config",ANNOTATION_PLACE_MODE:"annotation_place_mode",ANNOTATION_PLACED:"annotation_placed",ANNOTATION_TOGGLE:"annotation_toggle",FOCUS:"focus",PRICING:"pricing"},ie={FOCUS:"focus",UNFOCUS:"unfocus"},In={FOCUSED:"focused"},Mn={HIDDEN:"hidden"},Pn=new Set(Object.values(I));function Bn(n){if(typeof n!="object"||n===null)return!1;const t=n;return typeof t.target=="string"?!1:typeof t.type=="string"&&Pn.has(t.type)}function Ln(n){const t=V(n);return t!==null&&t.type===I.HANDSHAKE}function On(n){const t=V(n);return t!==null&&t.type===I.MUTATION&&Array.isArray(t.results)}function xn(n){const t=V(n);return t!==null&&t.type===I.SNAPSHOT&&("data"in t||"error"in t)}function Dn(n){const t=V(n);return t!==null&&t.type===I.CAMERA&&Array.isArray(t.transforms)}function zn(n){const t=V(n);return t!==null&&t.type===I.MAPPING&&Array.isArray(t.attributes)}function Fn(n){const t=V(n);return t!==null&&t.type===I.LOADING_INDICATOR&&typeof t.progress=="number"}function Un(n){const t=V(n);return t!==null&&t.type===I.CONFIG&&typeof t.viewerSettings=="object"}function $n(n){const t=V(n);return t!==null&&t.type===I.ANNOTATION_PLACED&&typeof t.position=="object"&&t.position!==null}function Vn(n){const t=V(n);return t!==null&&t.type===I.FOCUS&&typeof t.state=="string"}function qn(n){const t=V(n);return t!==null&&t.type===I.PRICING&&typeof t.pricing=="object"&&t.pricing!==null}function V(n){return typeof n!="object"||n===null?null:n}class oe{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 jn{constructor(t,e){this.getTarget=t,this.sourceId=`vd-${Math.random().toString(36).slice(2,8)}`,this.targetOrigin=e?.targetOrigin??"*",this.publisher=new oe(i=>this.post(i)),this.consumer=new oe(i=>this.routeToHandler(i)),this.shouldBuffer=e?.shouldBuffer??null,e?.bufferIncoming!==!0&&this.consumer.markReady()}getTarget;handlers=new Map;publisher;consumer;shouldBuffer;listener=null;sourceId;targetOrigin;on(t,e){this.handlers.set(t,e)}off(t){this.handlers.delete(t)}setTargetOrigin(t){this.targetOrigin=t}send(t){this.publisher.enqueue(t)}markReady(){this.publisher.markReady()}markConsumerReady(){this.consumer.markReady()}consumerHasPending(t){return this.consumer.hasPending(t)}start(){this.listener===null&&(this.listener=t=>{const{data:e}=t;if(!Bn(e)||e._source===this.sourceId)return;const i=this.getTarget();if(i!==null&&t.source!==null&&t.source!==i)return;const o=e;if(this.shouldBuffer!==null&&!this.shouldBuffer(o)){this.routeToHandler(o);return}this.consumer.enqueue(o)},window.addEventListener("message",this.listener))}destroy(){this.listener!==null&&(window.removeEventListener("message",this.listener),this.listener=null),this.publisher.clear(),this.consumer.clear(),this.handlers.clear()}get ready(){return this.publisher.ready}get pendingCount(){return this.publisher.pendingCount}post(t){const e=this.getTarget();e!==null&&e.postMessage({...t,_source:this.sourceId},this.targetOrigin)}routeToHandler(t){const e=this.handlers.get(t.type);if(e===void 0)return;const i=e(t);i instanceof Promise&&i.catch(o=>{const r=o instanceof Error?o.message:String(o);console.error(`Virtualdisplay: error handling ${t.type}: ${r}`)})}}class re{constructor(t){this.send=t}send;placedCallbacks=[];setEnabled(t){this.send({type:I.ANNOTATION_TOGGLE,enabled:t})}startPlacing(){this.send({type:I.ANNOTATION_PLACE_MODE,enabled:!0})}stopPlacing(){this.send({type:I.ANNOTATION_PLACE_MODE,enabled:!1})}onPlaced(t){this.placedCallbacks.push(t)}handlePlaced(t){for(const e of this.placedCallbacks)e(t)}}class se{constructor(t,e){this.value=t,this.attribute=e}value;attribute;isSelectedValue=!1;get isSelected(){return this.isSelectedValue}setSelected(t){this.isSelectedValue=t}}class ae{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 O.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 se(i,this.name);i===this.defaultValue&&o.setSelected(!0),e.set(i,o)}return e}}class Hn{attributes=new Map;constructor(t,e,i){for(const o of t){const r=this.buildOptions(o,e);this.attributes.set(o.name,new ae(r))}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,r)=>{e([{name:o,value:r}],!1)}};return t.defaultValue!==void 0?{...i,defaultValue:t.defaultValue}:i}}class Gn{constructor(t,e){this.send=t,this.onMutationFailed=e}send;onMutationFailed;registry;pendingCallbacks=[];handleMappingReceived(t){M.logger.debug("Initializing from server mapping",{attributeCount:t.attributes.length}),this.registry=new Hn(t.attributes,(e,i)=>this.sendMutation(e,i),this.onMutationFailed),this.replayPendingCallbacks()}handleMutationResult(t){this.registry?.handleResults(t.results)}select(t,e){this.sendMutation([{name:t,value:e}],!1)}getValues(t){return this.registry?.get(t)?.getValues()??[]}getValue(t,e){return this.registry?.get(t)?.getValue(e)}onChange(t,e){if(this.registry===void 0){this.pendingCallbacks.push({name:t,callback:e});return}const i=this.registry.get(t);if(i===void 0){M.logger.warn(`onChange: attribute "${t}" not found — callback will not fire`);return}i.onChange(e)}getAttribute(t){return this.registry?.get(t)}getSelection(){return this.registry?.getSelection()??{}}get hasMapping(){return this.registry!==void 0}sendMutation(t,e){const i={type:I.MUTATION,mutations:t,isInitial:e};this.send(i)}replayPendingCallbacks(){for(const{name:t,callback:e}of this.pendingCallbacks){const i=this.registry?.get(t);i===void 0&&M.logger.warn(`onChange: attribute "${t}" not found — buffered callback will not fire`),i?.onChange(e)}this.pendingCallbacks.length=0}}let le=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 O.invalidParameter("No camera commands to execute. Call rotate(), tilt(), or zoom() before set().");const t={type:I.CAMERA,commands:this.commands};this.send(t),this.commands=[]}validateFiniteNumber(t,e){if(!Number.isFinite(t))throw O.invalidParameter(`${e}() requires a finite number, got ${String(t)}`)}reset(){const t={type:I.CAMERA,commands:[{action:"reset"}]};this.send(t)}};class Kn{state;limitsState;changeCallbacks=[];constructor(){this.state={rotation:0,tilt:0,zoom:100}}get rotation(){return this.state.rotation}get tilt(){return this.state.tilt}get zoom(){return this.state.zoom}onChange(t){this.changeCallbacks.push(t)}get limits(){return this.limitsState}applyLimits(t){this.limitsState=t;const e={rotation:this.rotation,tilt:this.tilt,zoom:this.zoom};for(const i of this.changeCallbacks)i(e)}handlePositionUpdate(t){this.update(t.transforms)}update(t){let e=!1;for(const i of t)switch(i.type){case"rotation":this.state.rotation=i.value,e=!0;break;case"tilt":this.state.tilt=i.value,e=!0;break;case"zoom":this.state.zoom=i.value,e=!0;break}if(e){const i={rotation:this.rotation,tilt:this.tilt,zoom:this.zoom};for(const o of this.changeCallbacks)o(i)}}}const Z={SELECT:"ui:select",SELECTED:"ui:selected",FOCUS_CHANGE:"vd:focus-change",CONFIGURATION_CHANGE:"vd:configuration-change",CONFIGURATION_SUBMIT:"vd:configuration-submit"};class ce{constructor(t,e){this.send=t,this.dispatch=e}send;dispatch;focused=null;attributes=[];changeCallbacks=[];get current(){return this.focused}set(t){if(typeof t!="string"||t.length===0)throw O.invalidParameter(`set() requires a non-empty component name, got ${String(t)}`);this.send({type:I.FOCUS,action:ie.FOCUS,component:t})}clear(){this.send({type:I.FOCUS,action:ie.UNFOCUS})}onChange(t){this.changeCallbacks.push(t)}handleStateReceived(t){t.state===In.FOCUSED&&t.component!==void 0?(this.focused=t.component,this.attributes=t.attributes??[]):(this.focused=null,this.attributes=[]);const e=this.focused!==null?{component:this.focused,attributes:this.attributes}:null;for(const i of this.changeCallbacks)i(e);this.dispatch(e)}}function Yn(n,t){const e=n.filter(r=>Jn(r,t));if(e.length===0)return;const i=Math.max(...e.map(ue)),o=e.filter(r=>ue(r)===i);return o.length===1?o[0]:void 0}function Jn(n,t){return Object.entries(n.attributes).every(([e,i])=>t[e]===i)}function ue(n){return Object.keys(n.attributes).length}class de{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=Yn(this.pricing.rules,this.selection);if(!(t===void 0||t.availability===Mn.HIDDEN))return{attributes:{...this.selection},reference:t.reference,price:t.priceCents,currency:this.pricing.currency,availability:t.availability}}}class he{constructor(t){this.filename=t}filename;developedCallbacks=new Set;errorCallbacks=new Set;developed=!1;failed=!1;photoData=null;onDeveloped(t){return this.developed&&this.photoData!==null?(t(this.photoData),this):(this.developedCallbacks.add(t),this)}onError(t){return this.errorCallbacks.add(t),this}getFilename(){return this.filename}develop(t){this.developed||this.failed||(this.photoData=t,this.developed=!0,this.developedCallbacks.forEach(e=>{e(this.photoData)}),this.developedCallbacks.clear(),this.errorCallbacks.clear())}fail(t){this.developed||this.failed||(this.failed=!0,this.errorCallbacks.forEach(e=>{e(t)}),this.developedCallbacks.clear(),this.errorCallbacks.clear())}}class fe{constructor(t){this.send=t}send;validExtensions=[".png"];pendingPhotos=new Map;take(t){this.validateFilename(t),M.logger.debug("Taking snapshot",{filename:t});const e=new he(t);return this.pendingPhotos.set(e.getFilename(),e),this.send({type:I.SNAPSHOT,filename:t}),e}handleSnapshotResult(t){const e=this.pendingPhotos.get(t.filename);if(e===void 0){M.logger.warn("No pending photo found for filename",{filename:t.filename,pendingFilenames:Array.from(this.pendingPhotos.keys())});return}if(this.pendingPhotos.delete(t.filename),t.error!==void 0){e.fail(new O(t.error,U.SNAPSHOT_FAILED));return}t.data!==void 0&&e.develop({filename:t.filename,data:t.data})}clear(){if(this.pendingPhotos.size===0)return;const t=new O("Client destroyed before snapshot completed",U.SNAPSHOT_FAILED);for(const e of this.pendingPhotos.values())e.fail(t);this.pendingPhotos.clear()}validateFilename(t){if(t===""||typeof t!="string")throw new O("Filename must be a non-empty string",U.INVALID_PARAMETER);if(!this.validExtensions.some(i=>t.toLowerCase().endsWith(i)))throw new O(`Invalid filename: "${t}". Filename must end with one of: ${this.validExtensions.join(", ")}`,U.INVALID_PARAMETER);if(t.includes("..")||t.includes("/")||t.includes("\\"))throw new O('Filename cannot contain path separators or ".."',U.INVALID_PARAMETER)}}class Zn{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 r=o,s={...r.detail,preventDefault:()=>{r.preventDefault()}};e(s)};return this.container?.addEventListener(t,i),()=>{this.container?.removeEventListener(t,i)}}}const Wn={},Qn="en",ge=["en","nl","de"],ut=["baseLocale"],me=[];let pe,be;function Xn(n){if(me.length===0)return;const t=typeof n=="string"?n:n.href;if(pe===t)return be;const e=new URL(t,"http://dummy.com");let i;for(const o of me)if(new Wn(o.match,e.href).exec(e.href)){i=o;break}return pe=t,be=i,i}function ve(n){const t=Xn(n);return t&&t.exclude!==!0&&Array.isArray(t.strategy)?t.strategy:ut}const dt=typeof window>"u";globalThis.__paraglide=globalThis.__paraglide??{},globalThis.__paraglide.ssr=globalThis.__paraglide.ssr??{};let ye=!1,P=()=>{let n=ut;!dt&&typeof window<"u"&&window.location?.href&&(n=ve(window.location.href));const t=ti(n);if(t)return ye||(ye=!0,we(t,{reload:!1})),t;throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found")};function ti(n,t){let e;for(const i of n){if(i==="baseLocale")e=Qn;else if(Ee(i)&&rt.has(i)){const r=rt.get(i);if(r){const s=r.getLocale();if(s instanceof Promise)continue;if(s!==void 0)return ni(s)}}const o=Ce(e);if(o)return o}}const ei=n=>{window.location.reload()};let we=(n,t)=>{const e={reload:!0,...t};let i;try{i=P()}catch{}const o=[];let r=ut;!dt&&typeof window<"u"&&window.location?.href&&(r=ve(window.location.href));for(const a of r)if(a!=="baseLocale"&&Ee(a)&&rt.has(a)){const l=rt.get(a);if(l){let c=l.setLocale(n);c instanceof Promise&&(c=c.catch(u=>{throw new Error(`Custom strategy "${a}" setLocale failed.`,{cause:u})}),o.push(c))}}const s=()=>{!dt&&e.reload&&window.location&&n!==i&&ei()};if(o.length)return Promise.all(o).then(()=>{s()});s()};function Ce(n){if(typeof n!="string")return;const t=n.toLowerCase();for(const e of ge)if(e.toLowerCase()===t)return e}function ni(n){const t=Ce(n);if(t)return t;throw new Error(`Invalid locale: ${n}. Expected one of: ${ge.join(", ")}`)}const rt=new Map;function Ee(n){return typeof n=="string"&&/^custom-[A-Za-z0-9_-]+$/.test(n)}const ii=()=>"Activate AR",oi=()=>"AR activeren",ri=()=>"AR aktivieren",si=((n={},t={})=>{const e=t.locale??P();return e==="en"?ii():e==="nl"?oi():ri()}),ai=()=>"Scan to view in AR",li=()=>"Scan om in AR te bekijken",ci=()=>"Scannen für AR-Ansicht",ui=((n={},t={})=>{const e=t.locale??P();return e==="en"?ai():e==="nl"?li():ci()}),di=()=>"Use your smartphone camera to scan this QR code",hi=()=>"Gebruik de camera van je smartphone om deze QR-code te scannen",fi=()=>"Verwenden Sie die Kamera Ihres Smartphones, um diesen QR-Code zu scannen",gi=((n={},t={})=>{const e=t.locale??P();return e==="en"?di():e==="nl"?hi():fi()}),mi=()=>"Your phone will open the 3D model in AR mode.",pi=()=>"Je telefoon opent het 3D-model in AR-modus.",bi=()=>"Das 3D-Modell wird im AR-Modus Ihres Telefons geöffnet",vi=((n={},t={})=>{const e=t.locale??P();return e==="en"?mi():e==="nl"?pi():bi()}),yi=()=>"Close",wi=()=>"Sluiten",Ci=()=>"Schließen",Ei=((n={},t={})=>{const e=t.locale??P();return e==="en"?yi():e==="nl"?wi():Ci()}),_i=()=>"Fullscreen",Ai=()=>"Volledig scherm",Si=()=>"Vollbild",ki=((n={},t={})=>{const e=t.locale??P();return e==="en"?_i():e==="nl"?Ai():Si()}),Ti=()=>"Downloading",Ri=()=>"Downloaden",Ni=()=>"Herunterladen",_e=((n={},t={})=>{const e=t.locale??P();return e==="en"?Ti():e==="nl"?Ri():Ni()}),Ii=()=>"Rendering",Mi=()=>"Renderen",Pi=()=>"Rendern",Bi=((n={},t={})=>{const e=t.locale??P();return e==="en"?Ii():e==="nl"?Mi():Pi()}),Li=()=>"Screenshot",Oi=()=>"Screenshot",xi=()=>"Screenshot",Di=((n={},t={})=>{const e=t.locale??P();return e==="en"?Li():e==="nl"?Oi():xi()}),zi=()=>"Configure",Fi=()=>"Configureer",Ui=()=>"Konfigurieren",$i=((n={},t={})=>{const e=t.locale??P();return e==="en"?zi():e==="nl"?Fi():Ui()}),Vi=()=>"Close",qi=()=>"Sluiten",ji=()=>"Schließen",Hi=((n={},t={})=>{const e=t.locale??P();return e==="en"?Vi():e==="nl"?qi():ji()}),Gi=()=>"Reset camera",Ki=()=>"Camera resetten",Yi=()=>"Kamera zurücksetzen",Ji=((n={},t={})=>{const e=t.locale??P();return e==="en"?Gi():e==="nl"?Ki():Yi()}),Zi=()=>"Zoom in",Wi=()=>"Inzoomen",Qi=()=>"Hineinzoomen",Xi=((n={},t={})=>{const e=t.locale??P();return e==="en"?Zi():e==="nl"?Wi():Qi()}),to=()=>"Zoom out",eo=()=>"Uitzoomen",no=()=>"Herauszoomen",io=((n={},t={})=>{const e=t.locale??P();return e==="en"?to():e==="nl"?eo():no()}),oo=()=>"Rotate left",ro=()=>"Naar links draaien",so=()=>"Nach links drehen",ao=((n={},t={})=>{const e=t.locale??P();return e==="en"?oo():e==="nl"?ro():so()}),lo=()=>"Rotate right",co=()=>"Naar rechts draaien",uo=()=>"Nach rechts drehen",ho=((n={},t={})=>{const e=t.locale??P();return e==="en"?lo():e==="nl"?co():uo()}),fo=()=>"Tilt up",go=()=>"Omhoog kantelen",mo=()=>"Nach oben kippen",po=((n={},t={})=>{const e=t.locale??P();return e==="en"?fo():e==="nl"?go():mo()}),bo=()=>"Tilt down",vo=()=>"Omlaag kantelen",yo=()=>"Nach unten kippen",wo=((n={},t={})=>{const e=t.locale??P();return e==="en"?bo():e==="nl"?vo():yo()}),Co=()=>"Working…",Eo=()=>"Bezig…",_o=()=>"Läuft…",Ao=((n={},t={})=>{const e=t.locale??P();return e==="en"?Co():e==="nl"?Eo():_o()}),So=()=>"Done",ko=()=>"Gelukt",To=()=>"Fertig",Ro=((n={},t={})=>{const e=t.locale??P();return e==="en"?So():e==="nl"?ko():To()}),No=()=>"Failed",Io=()=>"Mislukt",Mo=()=>"Fehlgeschlagen",Po=((n={},t={})=>{const e=t.locale??P();return e==="en"?No():e==="nl"?Io():Mo()});const Bo={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 Ae=([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 r=Ae(o);i.appendChild(r)}),i},Se=(n,t={})=>{const i={...Bo,...t};return Ae(["svg",i,n])};const Lo=[["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 Oo=[["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 ke=[["path",{d:"m6 9 6 6 6-6"}]];const xo=[["path",{d:"m15 18-6-6 6-6"}]];const Do=[["path",{d:"m9 18 6-6-6-6"}]];const zo=[["path",{d:"m18 15-6-6-6 6"}]];const Fo=[["path",{d:"M15 3h6v6"}],["path",{d:"m21 3-7 7"}],["path",{d:"m3 21 7-7"}],["path",{d:"M9 21H3v-6"}]];const Uo=[["path",{d:"m14 10 7-7"}],["path",{d:"M20 10h-6V4"}],["path",{d:"m3 21 7-7"}],["path",{d:"M4 14h6v6"}]];const $o=[["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 Vo=[["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 qo=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];const jo=[["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 Ho=[["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 F(n,{size:t=20,strokeWidth:e=1.75}={}){return Se(n,{width:t,height:t,"stroke-width":e})}const D={ar:n=>F(Lo,n),fullscreen:n=>F(Fo,n),exitFullscreen:n=>F(Uo,n),screenshot:n=>F(Oo,n),tiltUp:n=>F(zo,n),tiltDown:n=>F(ke,n),rotateLeft:n=>F(xo,n),rotateRight:n=>F(Do,n),zoomIn:n=>F(jo,n),zoomOut:n=>F(Ho,n),reset:n=>F($o,n),configurator:n=>F(Vo,n),close:n=>F(qo,n)};class z{element;constructor({variant:t="default",size:e="default",label:i,icon:o,onClick:r,disabled:s=!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),r&&this.element.addEventListener("click",r),this.element.disabled=s}setIcon(t){const e=this.element.querySelector("svg");e!==null?e.replaceWith(t):this.element.appendChild(t)}}const L={semantic:{error:"#dc2626"},neutral:{500:"#737373",600:"#525252",900:"#171717"},white:"#ffffff",black:"#000000"},_={0:"0",.5:"0.125rem",1:"0.25rem",1.5:"0.375rem",2:"0.5rem",3:"0.75rem",4:"1rem",5:"1.25rem",6:"1.5rem",8:"2rem",9:"2.25rem",24:"6rem"};class Go{element;constructor(){this.element=document.createElement("div"),Object.assign(this.element.style,{background:L.white,borderRadius:_[3],padding:_[6],boxShadow:`0 ${_[2]} ${_[8]} oklch(0% 0 0 / 20%)`,maxWidth:"20rem",width:"100%"})}}class Ko{constructor(t={}){this.options=t,this.card=new Go,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:_[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 Yo{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 r=t[o],s=document.createElement("button");s.className="ui-toggle-group-item",s.dataset.value=r,s.textContent=i?.[o]??r,s.dataset.state=r===e?"on":"off",s.setAttribute("aria-pressed",r===e?"true":"false"),s.addEventListener("click",()=>{this.selectCallback?.(r)}),this.element.appendChild(s)}}setSelected(t){for(const e of this.element.querySelectorAll(".ui-toggle-group-item")){const i=e.dataset.value===t;e.dataset.state=i?"on":"off",e.setAttribute("aria-pressed",i?"true":"false")}}onSelect(t){this.selectCallback=t}}class Jo{element;select;constructor(t,e,i,o,r){this.select=document.createElement("select"),this.select.className="ui-native-select",this.select.dataset.name=t,this.select.setAttribute("aria-label",i);const s=document.createElement("option");s.value="",s.disabled=!0,s.textContent=i,this.select.appendChild(s);let a=!1;for(let c=0;c<e.length;c++){const u=e[c],h=document.createElement("option");h.value=u,h.textContent=r?.[c]??u,u===o&&(h.selected=!0,a=!0),this.select.appendChild(h)}a||(s.selected=!0);const l=Se(ke,{width:16,height:16,"stroke-width":2});l.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(l)}setSelected(t){this.select.value=t}onSelect(t){this.select.addEventListener("change",()=>{t(this.select.value)})}}const $={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"}},Zo=$.fontFamily.sans.join(", ");class Wo{qrLib=null;dialog=null;async show(t){this.hide(),this.qrLib??=await Promise.resolve().then(()=>Yr);const e=await this.qrLib.toDataURL(t,{width:256,margin:4,errorCorrectionLevel:"M",color:{dark:L.black,light:L.white}});this.dialog=new Ko({onClose:()=>{this.dialog=null}}),Object.assign(this.dialog.card.element.style,{display:"flex",flexDirection:"column",alignItems:"center",gap:_[3],fontFamily:Zo}),this.dialog.card.element.appendChild(this.createText(ui(),{fontSize:$.fontSize.base,fontWeight:$.fontWeight.semibold,color:L.neutral[900]})),this.dialog.card.element.appendChild(this.createText(gi(),{fontSize:$.fontSize.sm,color:L.neutral[600]})),this.dialog.card.element.appendChild(this.createQrImage(e)),this.dialog.card.element.appendChild(this.createText(vi(),{fontSize:$.fontSize.xs,color:L.neutral[500]}));const i=new z({variant:"outline",label:Ei(),onClick:()=>{this.hide()}});this.dialog.card.element.appendChild(i.element),this.dialog.open()}hide(){this.dialog?.close(),this.dialog=null}createText(t,e){const i=document.createElement("p");return i.textContent=t,Object.assign(i.style,{margin:"0",textAlign:"center",...e}),i}createQrImage(t){const e=document.createElement("img");return e.src=t,e.alt="QR code",Object.assign(e.style,{width:_[24],height:_[24],borderRadius:_[1]}),e}}const W=$.fontFamily.sans.join(", "),Qo=`
|
|
2
2
|
:root {
|
|
3
3
|
--primary: oklch(5% 0 0);
|
|
4
4
|
--primary-foreground: oklch(100% 0 0);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@virtualdisplay.io/client",
|
|
3
3
|
"description": "TypeScript-first 3D model integration library with iframe-based architecture",
|
|
4
|
-
"version": "4.0.0-alpha.
|
|
4
|
+
"version": "4.0.0-alpha.14",
|
|
5
5
|
"author": "Virtualdisplay <support@virtualdisplay.io>",
|
|
6
6
|
"homepage": "https://virtualdisplay.io",
|
|
7
7
|
"license": "MIT",
|