@virtualdisplay.io/client 4.0.0-alpha.21 → 4.0.0-alpha.22
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
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 4.0.0-alpha.22
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
Fix the 3D model rendering behind the docked sidebar panel instead of next to it. On wide embeds the viewer now narrows to leave room for the panel, instead of the panel floating over part of the model.
|
|
8
|
+
|
|
3
9
|
## 4.0.0-alpha.21
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c={HANDSHAKE:"handshake",SESSION:"session",MUTATION:"mutation",STATE:"state",LOADING_INDICATOR:"loading_indicator",CAMERA:"camera",SNAPSHOT:"snapshot",MAPPING:"mapping",AR_ACTIVATE:"ar_activate",FULLSCREEN:"fullscreen",CONFIG:"config",ANNOTATION_TOGGLE:"annotation_toggle",FOCUS:"focus",PRICING:"pricing",QR_SHOWN:"qr_shown",SYNC:"sync"},W={FOCUS:"focus",UNFOCUS:"unfocus"},Nt={FOCUSED:"focused"},Mt={HIDDEN:"hidden"},Lt=new Set(Object.values(c));function zt(n){if(typeof n!="object"||n===null)return!1;const t=n;return typeof t.target=="string"?!1:typeof t.type=="string"&&Lt.has(t.type)}function Pt(n){const t=_(n);return t!==null&&t.type===c.HANDSHAKE}function Ft(n){const t=_(n);return t!==null&&t.type===c.SESSION&&typeof t.sessionId=="string"}function $t(n){const t=_(n);return t!==null&&t.type===c.MUTATION&&Array.isArray(t.results)}function Dt(n){const t=_(n);return t!==null&&t.type===c.SNAPSHOT&&("data"in t||"error"in t)}function Bt(n){const t=_(n);return t!==null&&t.type===c.CAMERA&&Array.isArray(t.transforms)}function Ut(n){const t=_(n);return t!==null&&t.type===c.MAPPING&&Array.isArray(t.attributes)}function Vt(n){const t=_(n);return t!==null&&t.type===c.LOADING_INDICATOR&&typeof t.progress=="number"}function jt(n){const t=_(n);return t!==null&&t.type===c.SYNC&&typeof t.connected=="boolean"}function Ht(n){const t=_(n);return t!==null&&t.type===c.CONFIG&&typeof t.viewerSettings=="object"}function qt(n){const t=_(n);return t!==null&&t.type===c.FOCUS&&typeof t.state=="string"}function Gt(n){const t=_(n);return t!==null&&t.type===c.PRICING&&typeof t.pricing=="object"&&t.pricing!==null}function _(n){return typeof n!="object"||n===null?null:n}class Q{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 Zt{constructor(t,e){this.getTarget=t,this.sourceId=`vd-${Math.random().toString(36).slice(2,8)}`,this.targetOrigin=e?.targetOrigin??"*",this.isValid=e?.isValid??zt,this.publisher=new Q(i=>this.post(i)),this.consumer=new Q(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;isValid;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)}receive(t){if(this.isValid(t)){if(this.shouldBuffer!==null&&!this.shouldBuffer(t)){this.routeToHandler(t);return}this.consumer.enqueue(t)}}markReady(){this.publisher.markReady()}markConsumerReady(){this.consumer.markReady()}consumerHasPending(t){return this.consumer.hasPending(t)}start(){this.listener===null&&(this.listener=t=>{const{data:e}=t;if(!this.isValid(e)||e._source===this.sourceId)return;const i=this.getTarget();if(i!==null&&t.source!==null&&t.source!==i)return;const o=e;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 at{constructor(t){this.send=t}send;setEnabled(t){this.send({type:c.ANNOTATION_TOGGLE,enabled:t})}}class lt{constructor(t,e){this.value=t,this.attribute=e}value;attribute;isSelectedValue=!1;get isSelected(){return this.isSelectedValue}setSelected(t){this.isSelectedValue=t}}const S={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 valueNotFound(t,e){return new f(`Value "${e}" not found for attribute "${t}"`,S.VALUE_NOT_FOUND)}static parentNotFound(t){return new f(`Parent element not found: ${t}`,S.PARENT_NOT_FOUND)}static invalidParameter(t){return new f(t,S.INVALID_PARAMETER)}}class ct{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 lt(i,this.name);i===this.defaultValue&&o.setSelected(!0),e.set(i,o)}return e}}class Wt{attributes=new Map;constructor(t,e,i){for(const o of t){const s=this.buildOptions(o,e);this.attributes.set(o.name,new ct(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}}function Qt(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 Yt(n){return JSON.stringify(n)}function Kt(n,t){const e=t?Qt(n):Yt(n);n.level==="error"?console.error(e):n.level==="warn"?console.warn(e):console.log(e)}function ut(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?ut(n.cause,t+1):String(n.cause)),e}function Xt(n){const t={};for(const[e,i]of Object.entries(n))t[e]=i instanceof Error?ut(i):i;return t}function Jt(){return new Date}function te(n){return n.toISOString()}function dt(){return typeof navigator>"u"?"":navigator.userAgent}function ee(){return typeof navigator>"u"?!1:navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1}function ne(){return/iPhone|iPad|iPod/i.test(dt())||ee()}function ie(){return/Android/i.test(dt())}function oe(){return ne()||ie()}class se{constructor(t){this.config=t}config;log(t,e,i={}){const o=this.config.traceProvider?.()??{},s={timestamp:te(Jt()),level:t,msg:e,service:this.config.service,...o,...Xt(i)};Kt(s,this.config.isDev)}debug(t,e){this.config.isDev&&this.log("debug",t,e)}info(t,e){this.log("info",t,e)}warn(t,e){this.log("warn",t,e)}error(t,e){this.log("error",t,e)}}function ht(n,t){const e=t?.isDev!==void 0?t.isDev:typeof process<"u"?process.env.NODE_ENV!=="production":!0;return new se({service:n,isDev:e,traceProvider:t?.traceProvider})}function I(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 mt(n){return{debug:(t,e)=>n.debug(t,I(e)),info:(t,e)=>n.info(t,I(e)),warn:(t,e)=>n.warn(t,I(e)),error:(t,e)=>n.error(t,I(e))}}let pt=!1;exports.logger=mt(ht("client",{isDev:!1}));function ft(){pt=!0,exports.logger=mt(ht("client",{isDev:!0}))}function re(){return pt}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 Wt(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)}}}function ce(n,t){const e=n.filter(s=>ue(s,t));if(e.length===0)return;const i=Math.max(...e.map(Y)),o=e.filter(s=>Y(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 Y(n){return Object.keys(n.attributes).length}class bt{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===Mt.HIDDEN))return{attributes:{...this.selection},reference:t.reference,price:t.priceCents,currency:this.pricing.currency,availability:t.availability}}}class vt{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:W.FOCUS,component:t})}clear(){this.send({type:c.FOCUS,action:W.UNFOCUS})}onChange(t){this.changeCallbacks.push(t)}handleStateReceived(t){t.state===Nt.FOCUSED&&t.component!==void 0?(this.focused=t.component,this.attributes=t.attributes??[]):(this.focused=null,this.attributes=[]);const e=this.focused!==null?{component:this.focused,attributes:this.attributes}:null;for(const i of this.changeCallbacks)i(e);this.dispatch(e)}}class 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())}}const K=3e4;class wt{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),i=setTimeout(()=>{this.pendingPhotos.delete(t),exports.logger.warn("Snapshot timed out",{filename:t}),e.fail(new f(`Snapshot timed out: the viewer did not respond within ${K}ms`,S.SNAPSHOT_FAILED))},K);return this.pendingPhotos.set(t,{photo:e,timeout:i}),this.send({type:c.SNAPSHOT,filename:t}),e}handleSnapshotResult(t){const e=this.pendingPhotos.get(t.filename);if(e===void 0){exports.logger.warn("No pending photo found for filename",{filename:t.filename,pendingFilenames:Array.from(this.pendingPhotos.keys())});return}clearTimeout(e.timeout),this.pendingPhotos.delete(t.filename);const{photo:i}=e;if(t.error!==void 0){i.fail(new f(t.error,S.SNAPSHOT_FAILED));return}t.data!==void 0&&i.develop({filename:t.filename,data:t.data})}clear(){if(this.pendingPhotos.size===0)return;const t=new f("Client destroyed before snapshot completed",S.SNAPSHOT_FAILED);for(const{photo:e,timeout:i}of this.pendingPhotos.values())clearTimeout(i),e.fail(t);this.pendingPhotos.clear()}validateFilename(t){if(t===""||typeof t!="string")throw new f("Filename must be a non-empty string",S.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(", ")}`,S.INVALID_PARAMETER);if(t.includes("..")||t.includes("/")||t.includes("\\"))throw new f('Filename cannot contain path separators or ".."',S.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",_t=["en","nl","de"],G=["baseLocale"],X=[];let J,tt;function pe(n){if(X.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 X)if(new he(o.match,e.href).exec(e.href)){i=o;break}return J=t,tt=i,i}function Ct(n){const t=pe(n);return t&&t.exclude!==!0&&Array.isArray(t.strategy)?t.strategy:G}const q=typeof window>"u";globalThis.__paraglide=globalThis.__paraglide??{};globalThis.__paraglide.ssr=globalThis.__paraglide.ssr??{};let et=!1,h=()=>{let n=G;!q&&typeof window<"u"&&window.location?.href&&(n=Ct(window.location.href));const t=fe(n);if(t)return et||(et=!0,St(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)&&O.has(i)){const s=O.get(i);if(s){const r=s.getLocale();if(r instanceof Promise)continue;if(r!==void 0)return be(r)}}const o=kt(e);if(o)return o}}const ge=n=>{window.location.reload()};let St=(n,t)=>{const e={reload:!0,...t};let i;try{i=h()}catch{}const o=[];let s=G;!q&&typeof window<"u"&&window.location?.href&&(s=Ct(window.location.href));for(const l of s)if(l!=="baseLocale"&&At(l)&&O.has(l)){const d=O.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=()=>{!q&&e.reload&&window.location&&n!==i&&ge()};if(o.length)return Promise.all(o).then(()=>{r()});r()};function kt(n){if(typeof n!="string")return;const t=n.toLowerCase();for(const e of _t)if(e.toLowerCase()===t)return e}function be(n){const t=kt(n);if(t)return t;throw new Error(`Invalid locale: ${n}. Expected one of: ${_t.join(", ")}`)}const O=new Map;function At(n){return typeof n=="string"&&/^custom-[A-Za-z0-9_-]+$/.test(n)}const ve=()=>"Activate AR",ye=()=>"AR activeren",we=()=>"AR aktivieren",_e=((n={},t={})=>{const e=t.locale??h();return e==="en"?ve():e==="nl"?ye():we()}),Ce=()=>"Scan to view in AR",Se=()=>"Scan om in AR te bekijken",ke=()=>"Scannen für AR-Ansicht",Ae=((n={},t={})=>{const e=t.locale??h();return e==="en"?Ce():e==="nl"?Se():ke()}),Ee=()=>"Use your smartphone camera to scan this QR code",xe=()=>"Gebruik de camera van je smartphone om deze QR-code te scannen",Te=()=>"Verwende die Kamera deines Smartphones, um diesen QR-Code zu scannen",Re=((n={},t={})=>{const e=t.locale??h();return e==="en"?Ee():e==="nl"?xe():Te()}),Ie=()=>"Your phone will open the 3D model in AR mode.",Oe=()=>"Je telefoon opent het 3D-model in AR-modus.",Ne=()=>"Dein Telefon öffnet das 3D-Modell im AR-Modus.",Me=((n={},t={})=>{const e=t.locale??h();return e==="en"?Ie():e==="nl"?Oe():Ne()}),Le=()=>"Close",ze=()=>"Sluiten",Pe=()=>"Schließen",Fe=((n={},t={})=>{const e=t.locale??h();return e==="en"?Le():e==="nl"?ze():Pe()}),$e=()=>"Fullscreen",De=()=>"Volledig scherm",Be=()=>"Vollbild",Ue=((n={},t={})=>{const e=t.locale??h();return e==="en"?$e():e==="nl"?De():Be()}),Ve=()=>"Downloading",je=()=>"Downloaden",He=()=>"Herunterladen",Et=((n={},t={})=>{const e=t.locale??h();return e==="en"?Ve():e==="nl"?je():He()}),qe=()=>"Rendering",Ge=()=>"Renderen",Ze=()=>"Rendern",We=((n={},t={})=>{const e=t.locale??h();return e==="en"?qe():e==="nl"?Ge():Ze()}),Qe=()=>"Screenshot",Ye=()=>"Screenshot",Ke=()=>"Screenshot",Xe=((n={},t={})=>{const e=t.locale??h();return e==="en"?Qe():e==="nl"?Ye():Ke()}),Je=()=>"Configure",tn=()=>"Configureren",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()}),wn=()=>"Rotate left",_n=()=>"Naar links draaien",Cn=()=>"Nach links drehen",Sn=((n={},t={})=>{const e=t.locale??h();return e==="en"?wn():e==="nl"?_n():Cn()}),kn=()=>"Rotate right",An=()=>"Naar rechts draaien",En=()=>"Nach rechts drehen",xn=((n={},t={})=>{const e=t.locale??h();return e==="en"?kn():e==="nl"?An():En()}),Tn=()=>"Tilt up",Rn=()=>"Omhoog kantelen",In=()=>"Nach oben kippen",On=((n={},t={})=>{const e=t.locale??h();return e==="en"?Tn():e==="nl"?Rn():In()}),Nn=()=>"Tilt down",Mn=()=>"Omlaag kantelen",Ln=()=>"Nach unten kippen",zn=((n={},t={})=>{const e=t.locale??h();return e==="en"?Nn():e==="nl"?Mn():Ln()}),Pn=()=>"Working…",Fn=()=>"Bezig…",$n=()=>"Läuft…",Dn=((n={},t={})=>{const e=t.locale??h();return e==="en"?Pn():e==="nl"?Fn():$n()}),Bn=()=>"Done",Un=()=>"Gelukt",Vn=()=>"Fertig",jn=((n={},t={})=>{const e=t.locale??h();return e==="en"?Bn():e==="nl"?Un():Vn()}),Hn=()=>"Failed",qn=()=>"Mislukt",Gn=()=>"Fehlgeschlagen",Zn=((n={},t={})=>{const e=t.locale??h();return e==="en"?Hn():e==="nl"?qn():Gn()});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 Qn=[["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 Yn=[["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 Xn=[["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(Qn,n),fullscreen:n=>y(ti,n),exitFullscreen:n=>y(ei,n),screenshot:n=>y(Yn,n),tiltUp:n=>y(Jn,n),tiltDown:n=>y(Rt,n),rotateLeft:n=>y(Kn,n),rotateRight:n=>y(Xn,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"};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 w={fontFamily:{sans:["Mona Sans","ui-sans-serif","system-ui","sans-serif","Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"]},fontSize:{xs:"0.75rem",sm:"0.875rem",base:"1rem",lg:"1.125rem"},fontWeight:{medium:"500",semibold:"600"}},E=w.fontFamily.sans.join(", "),di=`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c={HANDSHAKE:"handshake",SESSION:"session",MUTATION:"mutation",STATE:"state",LOADING_INDICATOR:"loading_indicator",CAMERA:"camera",SNAPSHOT:"snapshot",MAPPING:"mapping",AR_ACTIVATE:"ar_activate",FULLSCREEN:"fullscreen",CONFIG:"config",ANNOTATION_TOGGLE:"annotation_toggle",FOCUS:"focus",PRICING:"pricing",QR_SHOWN:"qr_shown",SYNC:"sync"},W={FOCUS:"focus",UNFOCUS:"unfocus"},Nt={FOCUSED:"focused"},Mt={HIDDEN:"hidden"},Lt=new Set(Object.values(c));function zt(n){if(typeof n!="object"||n===null)return!1;const t=n;return typeof t.target=="string"?!1:typeof t.type=="string"&&Lt.has(t.type)}function Pt(n){const t=_(n);return t!==null&&t.type===c.HANDSHAKE}function Ft(n){const t=_(n);return t!==null&&t.type===c.SESSION&&typeof t.sessionId=="string"}function $t(n){const t=_(n);return t!==null&&t.type===c.MUTATION&&Array.isArray(t.results)}function Dt(n){const t=_(n);return t!==null&&t.type===c.SNAPSHOT&&("data"in t||"error"in t)}function Bt(n){const t=_(n);return t!==null&&t.type===c.CAMERA&&Array.isArray(t.transforms)}function Ut(n){const t=_(n);return t!==null&&t.type===c.MAPPING&&Array.isArray(t.attributes)}function Vt(n){const t=_(n);return t!==null&&t.type===c.LOADING_INDICATOR&&typeof t.progress=="number"}function jt(n){const t=_(n);return t!==null&&t.type===c.SYNC&&typeof t.connected=="boolean"}function Ht(n){const t=_(n);return t!==null&&t.type===c.CONFIG&&typeof t.viewerSettings=="object"}function qt(n){const t=_(n);return t!==null&&t.type===c.FOCUS&&typeof t.state=="string"}function Gt(n){const t=_(n);return t!==null&&t.type===c.PRICING&&typeof t.pricing=="object"&&t.pricing!==null}function _(n){return typeof n!="object"||n===null?null:n}class Q{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 Zt{constructor(t,e){this.getTarget=t,this.sourceId=`vd-${Math.random().toString(36).slice(2,8)}`,this.targetOrigin=e?.targetOrigin??"*",this.isValid=e?.isValid??zt,this.publisher=new Q(i=>this.post(i)),this.consumer=new Q(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;isValid;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)}receive(t){if(this.isValid(t)){if(this.shouldBuffer!==null&&!this.shouldBuffer(t)){this.routeToHandler(t);return}this.consumer.enqueue(t)}}markReady(){this.publisher.markReady()}markConsumerReady(){this.consumer.markReady()}consumerHasPending(t){return this.consumer.hasPending(t)}start(){this.listener===null&&(this.listener=t=>{const{data:e}=t;if(!this.isValid(e)||e._source===this.sourceId)return;const i=this.getTarget();if(i!==null&&t.source!==null&&t.source!==i)return;const o=e;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 at{constructor(t){this.send=t}send;setEnabled(t){this.send({type:c.ANNOTATION_TOGGLE,enabled:t})}}class lt{constructor(t,e){this.value=t,this.attribute=e}value;attribute;isSelectedValue=!1;get isSelected(){return this.isSelectedValue}setSelected(t){this.isSelectedValue=t}}const S={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 valueNotFound(t,e){return new f(`Value "${e}" not found for attribute "${t}"`,S.VALUE_NOT_FOUND)}static parentNotFound(t){return new f(`Parent element not found: ${t}`,S.PARENT_NOT_FOUND)}static invalidParameter(t){return new f(t,S.INVALID_PARAMETER)}}class ct{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 lt(i,this.name);i===this.defaultValue&&o.setSelected(!0),e.set(i,o)}return e}}class Wt{attributes=new Map;constructor(t,e,i){for(const o of t){const s=this.buildOptions(o,e);this.attributes.set(o.name,new ct(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}}function Qt(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,u])=>`${l}=${JSON.stringify(u)}`).join(" ");return`${t} ${e} [${i}] ${o}${r?" "+r:""}`}function Yt(n){return JSON.stringify(n)}function Kt(n,t){const e=t?Qt(n):Yt(n);n.level==="error"?console.error(e):n.level==="warn"?console.warn(e):console.log(e)}function dt(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?dt(n.cause,t+1):String(n.cause)),e}function Xt(n){const t={};for(const[e,i]of Object.entries(n))t[e]=i instanceof Error?dt(i):i;return t}function Jt(){return new Date}function te(n){return n.toISOString()}function ut(){return typeof navigator>"u"?"":navigator.userAgent}function ee(){return typeof navigator>"u"?!1:navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1}function ne(){return/iPhone|iPad|iPod/i.test(ut())||ee()}function ie(){return/Android/i.test(ut())}function oe(){return ne()||ie()}class se{constructor(t){this.config=t}config;log(t,e,i={}){const o=this.config.traceProvider?.()??{},s={timestamp:te(Jt()),level:t,msg:e,service:this.config.service,...o,...Xt(i)};Kt(s,this.config.isDev)}debug(t,e){this.config.isDev&&this.log("debug",t,e)}info(t,e){this.log("info",t,e)}warn(t,e){this.log("warn",t,e)}error(t,e){this.log("error",t,e)}}function ht(n,t){const e=t?.isDev!==void 0?t.isDev:typeof process<"u"?process.env.NODE_ENV!=="production":!0;return new se({service:n,isDev:e,traceProvider:t?.traceProvider})}function I(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 mt(n){return{debug:(t,e)=>n.debug(t,I(e)),info:(t,e)=>n.info(t,I(e)),warn:(t,e)=>n.warn(t,I(e)),error:(t,e)=>n.error(t,I(e))}}let pt=!1;exports.logger=mt(ht("client",{isDev:!1}));function ft(){pt=!0,exports.logger=mt(ht("client",{isDev:!0}))}function re(){return pt}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 Wt(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)}}}function ce(n,t){const e=n.filter(s=>de(s,t));if(e.length===0)return;const i=Math.max(...e.map(Y)),o=e.filter(s=>Y(s)===i);return o.length===1?o[0]:void 0}function de(n,t){return Object.entries(n.attributes).every(([e,i])=>t[e]===i)}function Y(n){return Object.keys(n.attributes).length}class bt{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===Mt.HIDDEN))return{attributes:{...this.selection},reference:t.reference,price:t.priceCents,currency:this.pricing.currency,availability:t.availability}}}class vt{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:W.FOCUS,component:t})}clear(){this.send({type:c.FOCUS,action:W.UNFOCUS})}onChange(t){this.changeCallbacks.push(t)}handleStateReceived(t){t.state===Nt.FOCUSED&&t.component!==void 0?(this.focused=t.component,this.attributes=t.attributes??[]):(this.focused=null,this.attributes=[]);const e=this.focused!==null?{component:this.focused,attributes:this.attributes}:null;for(const i of this.changeCallbacks)i(e);this.dispatch(e)}}class 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())}}const K=3e4;class wt{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),i=setTimeout(()=>{this.pendingPhotos.delete(t),exports.logger.warn("Snapshot timed out",{filename:t}),e.fail(new f(`Snapshot timed out: the viewer did not respond within ${K}ms`,S.SNAPSHOT_FAILED))},K);return this.pendingPhotos.set(t,{photo:e,timeout:i}),this.send({type:c.SNAPSHOT,filename:t}),e}handleSnapshotResult(t){const e=this.pendingPhotos.get(t.filename);if(e===void 0){exports.logger.warn("No pending photo found for filename",{filename:t.filename,pendingFilenames:Array.from(this.pendingPhotos.keys())});return}clearTimeout(e.timeout),this.pendingPhotos.delete(t.filename);const{photo:i}=e;if(t.error!==void 0){i.fail(new f(t.error,S.SNAPSHOT_FAILED));return}t.data!==void 0&&i.develop({filename:t.filename,data:t.data})}clear(){if(this.pendingPhotos.size===0)return;const t=new f("Client destroyed before snapshot completed",S.SNAPSHOT_FAILED);for(const{photo:e,timeout:i}of this.pendingPhotos.values())clearTimeout(i),e.fail(t);this.pendingPhotos.clear()}validateFilename(t){if(t===""||typeof t!="string")throw new f("Filename must be a non-empty string",S.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(", ")}`,S.INVALID_PARAMETER);if(t.includes("..")||t.includes("/")||t.includes("\\"))throw new f('Filename cannot contain path separators or ".."',S.INVALID_PARAMETER)}}class ue{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",_t=["en","nl","de"],G=["baseLocale"],X=[];let J,tt;function pe(n){if(X.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 X)if(new he(o.match,e.href).exec(e.href)){i=o;break}return J=t,tt=i,i}function Ct(n){const t=pe(n);return t&&t.exclude!==!0&&Array.isArray(t.strategy)?t.strategy:G}const q=typeof window>"u";globalThis.__paraglide=globalThis.__paraglide??{};globalThis.__paraglide.ssr=globalThis.__paraglide.ssr??{};let et=!1,h=()=>{let n=G;!q&&typeof window<"u"&&window.location?.href&&(n=Ct(window.location.href));const t=fe(n);if(t)return et||(et=!0,St(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)&&O.has(i)){const s=O.get(i);if(s){const r=s.getLocale();if(r instanceof Promise)continue;if(r!==void 0)return be(r)}}const o=kt(e);if(o)return o}}const ge=n=>{window.location.reload()};let St=(n,t)=>{const e={reload:!0,...t};let i;try{i=h()}catch{}const o=[];let s=G;!q&&typeof window<"u"&&window.location?.href&&(s=Ct(window.location.href));for(const l of s)if(l!=="baseLocale"&&At(l)&&O.has(l)){const u=O.get(l);if(u){let d=u.setLocale(n);d instanceof Promise&&(d=d.catch(p=>{throw new Error(`Custom strategy "${l}" setLocale failed.`,{cause:p})}),o.push(d))}}const r=()=>{!q&&e.reload&&window.location&&n!==i&&ge()};if(o.length)return Promise.all(o).then(()=>{r()});r()};function kt(n){if(typeof n!="string")return;const t=n.toLowerCase();for(const e of _t)if(e.toLowerCase()===t)return e}function be(n){const t=kt(n);if(t)return t;throw new Error(`Invalid locale: ${n}. Expected one of: ${_t.join(", ")}`)}const O=new Map;function At(n){return typeof n=="string"&&/^custom-[A-Za-z0-9_-]+$/.test(n)}const ve=()=>"Activate AR",ye=()=>"AR activeren",we=()=>"AR aktivieren",_e=((n={},t={})=>{const e=t.locale??h();return e==="en"?ve():e==="nl"?ye():we()}),Ce=()=>"Scan to view in AR",Se=()=>"Scan om in AR te bekijken",ke=()=>"Scannen für AR-Ansicht",Ae=((n={},t={})=>{const e=t.locale??h();return e==="en"?Ce():e==="nl"?Se():ke()}),Ee=()=>"Use your smartphone camera to scan this QR code",xe=()=>"Gebruik de camera van je smartphone om deze QR-code te scannen",Te=()=>"Verwende die Kamera deines Smartphones, um diesen QR-Code zu scannen",Re=((n={},t={})=>{const e=t.locale??h();return e==="en"?Ee():e==="nl"?xe():Te()}),Ie=()=>"Your phone will open the 3D model in AR mode.",Oe=()=>"Je telefoon opent het 3D-model in AR-modus.",Ne=()=>"Dein Telefon öffnet das 3D-Modell im AR-Modus.",Me=((n={},t={})=>{const e=t.locale??h();return e==="en"?Ie():e==="nl"?Oe():Ne()}),Le=()=>"Close",ze=()=>"Sluiten",Pe=()=>"Schließen",Fe=((n={},t={})=>{const e=t.locale??h();return e==="en"?Le():e==="nl"?ze():Pe()}),$e=()=>"Fullscreen",De=()=>"Volledig scherm",Be=()=>"Vollbild",Ue=((n={},t={})=>{const e=t.locale??h();return e==="en"?$e():e==="nl"?De():Be()}),Ve=()=>"Downloading",je=()=>"Downloaden",He=()=>"Herunterladen",Et=((n={},t={})=>{const e=t.locale??h();return e==="en"?Ve():e==="nl"?je():He()}),qe=()=>"Rendering",Ge=()=>"Renderen",Ze=()=>"Rendern",We=((n={},t={})=>{const e=t.locale??h();return e==="en"?qe():e==="nl"?Ge():Ze()}),Qe=()=>"Screenshot",Ye=()=>"Screenshot",Ke=()=>"Screenshot",Xe=((n={},t={})=>{const e=t.locale??h();return e==="en"?Qe():e==="nl"?Ye():Ke()}),Je=()=>"Configure",tn=()=>"Configureren",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",dn=()=>"Kamera zurücksetzen",un=((n={},t={})=>{const e=t.locale??h();return e==="en"?ln():e==="nl"?cn():dn()}),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()}),wn=()=>"Rotate left",_n=()=>"Naar links draaien",Cn=()=>"Nach links drehen",Sn=((n={},t={})=>{const e=t.locale??h();return e==="en"?wn():e==="nl"?_n():Cn()}),kn=()=>"Rotate right",An=()=>"Naar rechts draaien",En=()=>"Nach rechts drehen",xn=((n={},t={})=>{const e=t.locale??h();return e==="en"?kn():e==="nl"?An():En()}),Tn=()=>"Tilt up",Rn=()=>"Omhoog kantelen",In=()=>"Nach oben kippen",On=((n={},t={})=>{const e=t.locale??h();return e==="en"?Tn():e==="nl"?Rn():In()}),Nn=()=>"Tilt down",Mn=()=>"Omlaag kantelen",Ln=()=>"Nach unten kippen",zn=((n={},t={})=>{const e=t.locale??h();return e==="en"?Nn():e==="nl"?Mn():Ln()}),Pn=()=>"Working…",Fn=()=>"Bezig…",$n=()=>"Läuft…",Dn=((n={},t={})=>{const e=t.locale??h();return e==="en"?Pn():e==="nl"?Fn():$n()}),Bn=()=>"Done",Un=()=>"Gelukt",Vn=()=>"Fertig",jn=((n={},t={})=>{const e=t.locale??h();return e==="en"?Bn():e==="nl"?Un():Vn()}),Hn=()=>"Failed",qn=()=>"Mislukt",Gn=()=>"Fehlgeschlagen",Zn=((n={},t={})=>{const e=t.locale??h();return e==="en"?Hn():e==="nl"?qn():Gn()});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 Qn=[["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 Yn=[["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 Xn=[["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(Qn,n),fullscreen:n=>y(ti,n),exitFullscreen:n=>y(ei,n),screenshot:n=>y(Yn,n),tiltUp:n=>y(Jn,n),tiltDown:n=>y(Rt,n),rotateLeft:n=>y(Kn,n),rotateRight:n=>y(Xn,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"};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 di{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 d=0;d<e.length;d++){const p=e[d],v=document.createElement("option");v.value=p,v.textContent=s?.[d]??p,p===o&&(v.selected=!0,l=!0),this.select.appendChild(v)}l||(r.selected=!0);const u=Tt(Rt,{width:16,height:16,"stroke-width":2});u.classList.add("ui-native-select-icon"),this.element=document.createElement("div"),this.element.className="ui-native-select-wrap",this.element.appendChild(this.select),this.element.appendChild(u)}setSelected(t){this.select.value=t}onSelect(t){this.select.addEventListener("change",()=>{t(this.select.value)})}}const w={fontFamily:{sans:["Mona Sans","ui-sans-serif","system-ui","sans-serif","Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"]},fontSize:{xs:"0.75rem",sm:"0.875rem",base:"1rem",lg:"1.125rem"},fontWeight:{medium:"500",semibold:"600"}},E=w.fontFamily.sans.join(", "),ui=`
|
|
2
2
|
--primary: oklch(5% 0 0);
|
|
3
3
|
--primary-foreground: oklch(100% 0 0);
|
|
4
4
|
--secondary: oklch(92% 0 0);
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
--accent-foreground: oklch(5% 0 0);
|
|
13
13
|
--muted-foreground: oklch(44% 0 0);
|
|
14
14
|
`,hi=`
|
|
15
|
-
:root { ${
|
|
15
|
+
:root { ${ui} }
|
|
16
16
|
|
|
17
17
|
/* ── Button ──────────────────────────────────────────────── */
|
|
18
18
|
.ui-btn {
|
|
@@ -288,7 +288,7 @@
|
|
|
288
288
|
0%, 100% { opacity: 1; }
|
|
289
289
|
50% { opacity: 0.55; }
|
|
290
290
|
}
|
|
291
|
-
`;let nt=!1;function It(){if(nt||typeof document>"u")return;nt=!0;const n=document.createElement("style");n.id="vd-ui-vanilla",n.textContent=hi,document.head.appendChild(n)}const mi=w.fontFamily.sans.join(", ");class pi{qrLib=null;dialog=null;qrSlot=null;show(){this.hide(),It(),this.dialog=new li({onClose:()=>{this.dialog=null,this.qrSlot=null}}),Object.assign(this.dialog.card.element.style,{display:"flex",flexDirection:"column",alignItems:"center",gap:a[3],fontFamily:mi}),this.dialog.card.element.appendChild(this.createText(Ae(),{fontSize:w.fontSize.base,fontWeight:w.fontWeight.semibold,color:m.neutral[900]})),this.dialog.card.element.appendChild(this.createText(Re(),{fontSize:w.fontSize.sm,color:m.neutral[600]})),this.qrSlot=this.createQrSlot(),this.dialog.card.element.appendChild(this.qrSlot),this.dialog.card.element.appendChild(this.createText(Me(),{fontSize:w.fontSize.xs,color:m.neutral[500]}));const t=new b({variant:"outline",label:Fe(),onClick:()=>{this.hide()}});this.dialog.card.element.appendChild(t.element),this.dialog.open()}async update(t){this.qrLib??=await Promise.resolve().then(()=>require("./browser-DfB_An57.cjs")).then(i=>i.browser);const e=await this.qrLib.toDataURL(t,{width:256,margin:4,errorCorrectionLevel:"M",color:{dark:m.black,light:m.white}});return this.qrSlot===null?!1:(this.qrSlot.classList.remove("ui-qr-slot--loading"),this.qrSlot.replaceChildren(this.createQrImage(e)),!0)}hide(){this.dialog?.close(),this.dialog=null,this.qrSlot=null}createText(t,e){const i=document.createElement("p");return i.textContent=t,Object.assign(i.style,{margin:"0",textAlign:"center",...e}),i}createQrSlot(){const t=document.createElement("div");return t.className="ui-qr-slot ui-qr-slot--loading",t}createQrImage(t){const e=document.createElement("img");return e.src=t,e.alt="QR code",e}}function it(n){const t=Math.max(0,Math.min(1,n));return t*t*(3-2*t)}function fi(n,t,e,i,o,s){const[r,l,d]=n,u=Math.cos(t),p=Math.sin(t),v=u*r+p*d,A=-p*r+u*d,k=Math.cos(e),C=Math.sin(e),R=k*l-C*A,M=C*l+k*A,Z=.55;return[i+v*s*Z,o-R*s*Z,M]}function gi(n,t,e){n.beginPath(),n.moveTo(t[0],t[1]),n.lineTo(e[0],e[1]),n.strokeStyle="#000",n.lineWidth=2,n.stroke()}function bi(n,t,e,i,o){const s=t(e),r=t(i),l=[s[0]+(r[0]-s[0])*o,s[1]+(r[1]-s[1])*o,s[2]];gi(n,s,l)}const L=[-1,-1,1],z=[1,-1,1],P=[1,-1,-1],F=[-1,-1,-1],$=[-1,1,1],D=[1,1,1],B=[1,1,-1],U=[-1,1,-1],ot=[[L,z],[z,P],[P,F],[F,L],[L,$],[z,D],[P,B],[F,U],[$,D],[D,B],[B,U],[U,$]],vi=400,st='-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif';function yi(){const n=document.createElement("div");Object.assign(n.style,{position:"absolute",inset:"0",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",background:"#fff",zIndex:"20",opacity:"0",transition:"opacity 0.3s ease-in-out"});const t=document.createElement("canvas");Object.assign(t.style,{width:"100%",height:"100%",position:"absolute",inset:"0"});const e=document.createElement("div");Object.assign(e.style,{position:"absolute",top:"56%",left:"0",right:"0",textAlign:"center",pointerEvents:"none"});const i=document.createElement("span");Object.assign(i.style,{fontSize:"13px",fontWeight:"400",color:"#000",fontVariantNumeric:"tabular-nums",fontFamily:st});const o=document.createElement("span");return Object.assign(o.style,{fontSize:"13px",color:"#000",fontFamily:st}),o.textContent=Et(),e.appendChild(i),e.appendChild(o),n.appendChild(t),n.appendChild(e),{overlay:n,canvas:t,pctEl:i,phaseEl:o}}class wi{overlay;canvas;ctx;pctEl;phaseEl;animationId=null;showTimerId=null;startTime;hidden=!1;visible=!1;constructor(t,e={}){this.startTime=performance.now();const i=yi();this.overlay=i.overlay,this.canvas=i.canvas,this.pctEl=i.pctEl,this.phaseEl=i.phaseEl,t.appendChild(this.overlay),this.ctx=this.canvas.getContext("2d"),this.ctx!==null&&(this.sizeCanvas(),this.tick());const o=e.showDelay??vi;this.showTimerId=setTimeout(()=>{this.reveal()},o)}get loadingTexts(){return{downloading:Et(),rendering:We()}}updateProgress(t,e){this.hidden||(this.pctEl.textContent=`${Math.round(t)}%`,this.phaseEl.textContent=e!==""?` · ${e}`:"")}showError(t){if(this.hidden=!1,this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null),this.ctx!==null){const e=Math.min(devicePixelRatio,2),i=this.canvas.width/e,o=this.canvas.height/e;this.ctx.fillStyle="#fff",this.ctx.fillRect(0,0,i*e,o*e)}this.pctEl.textContent="",this.phaseEl.textContent=t,this.phaseEl.style.color="#b91c1c",this.reveal()}hide(){if(!this.hidden){if(this.hidden=!0,this.cancelShowTimer(),!this.visible){this.destroy();return}this.overlay.style.opacity="0",this.overlay.addEventListener("transitionend",()=>{this.destroy()},{once:!0}),setTimeout(()=>{this.destroy()},500)}}destroy(){this.cancelShowTimer(),this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null),this.overlay.remove()}reveal(){this.hidden||this.visible||(this.visible=!0,this.overlay.style.opacity="1")}cancelShowTimer(){this.showTimerId!==null&&(clearTimeout(this.showTimerId),this.showTimerId=null)}sizeCanvas(){if(this.ctx===null)return;const t=Math.min(devicePixelRatio,2),e=this.overlay.clientWidth||440,i=this.overlay.clientHeight||360;this.canvas.width=e*t,this.canvas.height=i*t,this.ctx.scale(t,t),this.ctx.lineCap="round",this.ctx.lineJoin="round"}tick=()=>{this.hidden||(this.drawFrame(),this.animationId=requestAnimationFrame(this.tick))};drawFrame(){if(this.ctx===null)return;const t=this.canvas.width/Math.min(devicePixelRatio,2),e=this.canvas.height/Math.min(devicePixelRatio,2),i=(performance.now()-this.startTime)/1e3;this.ctx.fillStyle="#fff",this.ctx.fillRect(0,0,t,e);const o=t/2,s=e*.44,r=Math.min(t,e)*.08,l=.785,d=.615,u=C=>fi(C,l,d,o,s,r),p=6,v=i%p/p,A=ot.length;let k;v<.35?k=it(v/.35)*A:v<.55?k=A:v<.9?k=(1-it((v-.55)/.35))*A:k=0,this.ctx.shadowBlur=5,this.ctx.shadowColor="rgba(30,30,30,0.08)";for(let C=0;C<A&&!(C>=k);C++){const R=ot[C];if(R===void 0)continue;const M=Math.min(1,k-C);bi(this.ctx,u,R[0],R[1],M)}this.ctx.shadowBlur=0}}class _i{constructor(t){this.options=t,this.element=document.createElement("div"),Object.assign(this.element.style,{display:"flex",gap:"0.375rem"}),this.onFullscreenChange=()=>{this.setFullscreenIcon(document.fullscreenElement!==null)},document.addEventListener("fullscreenchange",this.onFullscreenChange)}options;element;arBtn=null;fullscreenBtn=null;onFullscreenChange;setFullscreenIcon(t){this.fullscreenBtn!==null&&this.fullscreenBtn.setIcon(t?g.exitFullscreen():g.fullscreen())}syncButton(t,e,i){if(e&&t===null){const o=i();return this.element.appendChild(o.element),o}return!e&&t!==null?(t.element.remove(),null):t}applySettings(t){this.arBtn=this.syncButton(this.arBtn,t.ar!==!1&&this.options.onAr!==void 0,()=>new b({variant:"outline",size:"icon",label:_e(),icon:g.ar(),onClick:()=>{this.options.onAr?.()}})),this.fullscreenBtn=this.syncButton(this.fullscreenBtn,t.fullscreen!==!1&&this.options.onFullscreen!==void 0,()=>new b({variant:"outline",size:"icon",label:Ue(),icon:g.fullscreen(),onClick:()=>{this.options.onFullscreen?.()}}))}destroy(){document.removeEventListener("fullscreenchange",this.onFullscreenChange)}}const x=.5;class N{element;constructor(t,e){this.element=Object.assign(document.createElement("div"),{className:"vd-camera-controls"});const i={targetRotation:e.rotation,targetTilt:e.tilt,targetZoom:e.zoom,thetaOffset:0},o=Ci(t,e,i);e.onChange(s=>{i.targetRotation=s.rotation-i.thetaOffset,i.targetTilt=s.tilt,i.targetZoom=s.zoom,Si(o,e,s)}),this.element.appendChild(N.buildZoom(o.zoomOut,o.zoomIn)),this.element.appendChild(N.buildDpad(o.tiltUp,o.rotateLeft,o.reset,o.rotateRight,o.tiltDown))}static buildZoom(t,e){const i=document.createElement("div");return i.className="vd-zoom",i.appendChild(t.element),i.appendChild(e.element),i}static buildDpad(t,e,i,o,s){const r=document.createElement("div");r.className="vd-dpad";for(const[l,d]of[[t,"up"],[e,"left"],[i,"center"],[o,"right"],[s,"down"]])l.element.classList.add(`vd-dpad-${d}`),r.appendChild(l.element);return r}}function Ci(n,t,e){const i=r=>Math.max(t.limits?.minZoom??1,Math.min(t.limits?.maxZoom??1/0,r)),o=r=>{const l=t.limits?.minRotate,d=t.limits?.maxRotate;return l!==void 0||d!==void 0?Math.max(l??-1/0,Math.min(d??1/0,r)):r},s=r=>{const l=t.limits?.minTilt,d=t.limits?.maxTilt;if(l!==void 0||d!==void 0){e.targetTilt=Math.max(l??0,Math.min(d??180,e.targetTilt+r)),n.tilt(e.targetTilt).set();return}const u=e.targetTilt+r;u>180||u<0?(e.targetTilt=u>180?360-u:-u,e.thetaOffset=(e.thetaOffset+180)%360,n.tilt(e.targetTilt).rotate(e.targetRotation+e.thetaOffset).set()):(e.targetTilt=u,n.tilt(e.targetTilt).set())};return{zoomOut:new b({variant:"outline",size:"icon",label:yn(),icon:g.zoomOut(),onClick:()=>{e.targetZoom=i(e.targetZoom-10),n.zoom(e.targetZoom).set()}}),zoomIn:new b({variant:"outline",size:"icon",label:fn(),icon:g.zoomIn(),onClick:()=>{e.targetZoom=i(e.targetZoom+10),n.zoom(e.targetZoom).set()}}),tiltUp:new b({variant:"outline",size:"icon",label:On(),icon:g.tiltUp(),onClick:()=>{s(-15)}}),rotateLeft:new b({variant:"outline",size:"icon",label:Sn(),icon:g.rotateLeft(),onClick:()=>{e.targetRotation=o(e.targetRotation-15),n.rotate(e.targetRotation+e.thetaOffset).set()}}),reset:new b({variant:"outline",size:"icon",label:dn(),icon:g.reset(),onClick:()=>{e.thetaOffset=0,n.reset()}}),rotateRight:new b({variant:"outline",size:"icon",label:xn(),icon:g.rotateRight(),onClick:()=>{e.targetRotation=o(e.targetRotation+15),n.rotate(e.targetRotation+e.thetaOffset).set()}}),tiltDown:new b({variant:"outline",size:"icon",label:zn(),icon:g.tiltDown(),onClick:()=>{s(15)}})}}function Si(n,t,e){const i=t.limits;i!==void 0&&(n.zoomOut.element.disabled=i.minZoom!==void 0&&e.zoom<=i.minZoom+x,n.zoomIn.element.disabled=i.maxZoom!==void 0&&e.zoom>=i.maxZoom-x,n.tiltUp.element.disabled=i.minTilt!==void 0&&e.tilt<=i.minTilt+x,n.tiltDown.element.disabled=i.maxTilt!==void 0&&e.tilt>=i.maxTilt-x,n.rotateLeft.element.disabled=i.minRotate!==void 0&&e.rotation<=i.minRotate+x,n.rotateRight.element.disabled=i.maxRotate!==void 0&&e.rotation>=i.maxRotate-x)}const T={SELECT:"ui:select",SELECTED:"ui:selected",FOCUS_CHANGE:"vd:focus-change",CONFIGURATION_CHANGE:"vd:configuration-change",CONFIGURATION_SUBMIT:"vd:configuration-submit"},ki=5;let Ai=0;function V(n){const t=n.replace(/([A-Z])/g," $1").trim();return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function Ei(n,t,e,i,o){const s=document.createElement("div");s.className="vd-attribute",s.dataset.name=n.name;const r=document.createElement("span");r.className="vd-attribute-label",r.textContent=V(n.name),r.id=`vd-attribute-label-${Ai++}`,s.appendChild(r),s.setAttribute("role","group"),s.setAttribute("aria-labelledby",r.id);const l=n.values.find(p=>t.getValue(n.name,p)?.isSelected===!0),d=n.values.map(V),u=n.values.length<=ki?new ci(n.values,l,d):new ui(n.name,n.values,V(n.name),l,d);return u.onSelect(p=>{e.dispatch(T.SELECT,{attribute:n.name,value:p},!0).defaultPrevented||i(n.name,p)}),o(n.name,p=>{u.setSelected(p.value),e.dispatch(T.SELECTED,{attribute:n.name,value:p.value})}),s.appendChild(u.element),s}const xi=80,Ti=2500;class Ri{constructor(t,e=Ti){this.configuration=t,this.resetMs=e,this.element=document.createElement("div"),this.element.className="vd-commerce vd-hidden";const i=document.createElement("div");i.className="vd-commerce-price",this.priceEl=document.createElement("span"),this.priceEl.className="vd-price",this.vatEl=document.createElement("span"),this.vatEl.className="vd-vat",i.append(this.priceEl,this.vatEl),this.button=new b({variant:"default",onClick:()=>{this.handleSubmit()}}),this.button.element.classList.add("vd-cta","vd-hidden"),this.element.append(i,this.button.element),this.unsubscribe=this.configuration.onRender(()=>{this.update()}),this.update()}configuration;resetMs;element;priceEl;vatEl;button;unsubscribe;state="idle";resetTimer;update(){this.renderPrice(this.configuration.current),this.renderButton();const t=this.configuration.current!==void 0||this.configuration.submitEnabled;this.element.classList.toggle("vd-hidden",!t)}destroy(){this.unsubscribe(),this.resetTimer!==void 0&&clearTimeout(this.resetTimer),this.element.remove()}renderPrice(t){if(t===void 0){this.priceEl.textContent="",this.vatEl.textContent="";return}this.priceEl.textContent=Ii(t.price,t.currency),this.vatEl.textContent=rt(this.configuration.vatDisplay)}renderButton(){const t=this.configuration.submitEnabled;this.button.element.classList.toggle("vd-hidden",!t),t&&this.state==="idle"&&this.setButtonText(rt(this.configuration.buttonLabel))}async handleSubmit(){if(this.state!=="busy"){this.setState("busy",Dn());try{await this.configuration.submit(),this.setState("success",jn())}catch{this.setState("failed",Zn())}this.scheduleReset()}}scheduleReset(){this.resetTimer!==void 0&&clearTimeout(this.resetTimer),this.resetTimer=setTimeout(()=>{this.state="idle",this.update()},this.resetMs)}setState(t,e){this.state=t,this.element.dataset.submit=t,this.button.element.disabled=t==="busy",this.setButtonText(e)}setButtonText(t){this.button.element.textContent=t,this.button.element.setAttribute("aria-label",t)}}function rt(n){return(n??"").slice(0,xi)}function Ii(n,t){try{const e=new Intl.NumberFormat(h(),{style:"currency",currency:t}),i=e.resolvedOptions().maximumFractionDigits??2;return e.format(n/10**i)}catch{return`${t} ${(n/100).toFixed(2)}`}}class Ot{slot=null;panel=null;attach(t,e){this.panel=e,e.style.display="none",this.slot=document.createElement("div"),this.slot.className="vd-slot-bottom-left",this.slot.appendChild(e),t.appendChild(this.slot)}setVisible(t){this.panel!==null&&(this.panel.style.display=t?"flex":"none")}destroy(){this.slot?.remove(),this.slot=null,this.panel=null}}const Oi=572;class Ni{element=null;body=null;openButton=null;closeButton=null;container=null;observer=null;collapsible=!1;expanded=!0;visible=!1;attach(t,e){this.container=t,e.classList.add("vd-attributes-sidebar"),this.closeButton=new b({variant:"ghost",size:"icon-sm",label:an(),icon:g.close({size:18}),onClick:()=>{this.expanded=!1,this.render()}});const i=document.createElement("div");i.className="vd-sidebar-header",i.appendChild(this.closeButton.element),this.body=document.createElement("div"),this.body.className="vd-sidebar-body",this.body.appendChild(e),this.element=document.createElement("div"),this.element.className="vd-sidebar vd-hidden",this.element.append(i,this.body),t.appendChild(this.element),this.openButton=new b({variant:"outline",size:"default",label:nn(),icon:g.configurator({size:18}),onClick:()=>{this.expanded=!0,this.render()}}),this.openButton.element.classList.add("vd-configurator-toggle","vd-hidden"),t.appendChild(this.openButton.element),this.observe()}setVisible(t){this.visible=t,this.render()}destroy(){this.observer?.disconnect(),this.observer=null,this.openButton?.element.remove(),this.element?.remove(),this.container?.classList.remove("vd-layout-sidebar-right","vd-layout-sidebar-collapsed"),this.container=null}observe(){typeof ResizeObserver>"u"||this.container===null||(this.observer=new ResizeObserver(t=>{const e=t[0]?.contentRect.width??0;this.setCollapsible(e>0&&e<Oi)}),this.observer.observe(this.container))}setCollapsible(t){t!==this.collapsible&&(this.collapsible=t,this.expanded=!t,this.render())}render(){if(this.element===null||this.openButton===null||this.closeButton===null||this.container===null)return;const t=this.visible&&this.expanded,e=this.visible&&!this.expanded;this.element.classList.toggle("vd-hidden",!this.visible),this.element.classList.toggle("vd-sidebar-collapsed",e),this.openButton.element.classList.toggle("vd-hidden",!e),this.closeButton.element.style.display=this.collapsible?"":"none",this.container.classList.toggle("vd-layout-sidebar-right",t),this.container.classList.toggle("vd-layout-sidebar-collapsed",e)}}class Mi{attach(t,e){}setVisible(t){}destroy(){}}const Li={"inframe-bottom-left":()=>new Ot,"sidebar-right":()=>new Ni,hidden:()=>new Mi};function zi(n){return(Li[n??""]??(()=>new Ot))()}const j=w.fontFamily.sans.join(", "),H=`
|
|
291
|
+
`;let nt=!1;function It(){if(nt||typeof document>"u")return;nt=!0;const n=document.createElement("style");n.id="vd-ui-vanilla",n.textContent=hi,document.head.appendChild(n)}const mi=w.fontFamily.sans.join(", ");class pi{qrLib=null;dialog=null;qrSlot=null;show(){this.hide(),It(),this.dialog=new li({onClose:()=>{this.dialog=null,this.qrSlot=null}}),Object.assign(this.dialog.card.element.style,{display:"flex",flexDirection:"column",alignItems:"center",gap:a[3],fontFamily:mi}),this.dialog.card.element.appendChild(this.createText(Ae(),{fontSize:w.fontSize.base,fontWeight:w.fontWeight.semibold,color:m.neutral[900]})),this.dialog.card.element.appendChild(this.createText(Re(),{fontSize:w.fontSize.sm,color:m.neutral[600]})),this.qrSlot=this.createQrSlot(),this.dialog.card.element.appendChild(this.qrSlot),this.dialog.card.element.appendChild(this.createText(Me(),{fontSize:w.fontSize.xs,color:m.neutral[500]}));const t=new b({variant:"outline",label:Fe(),onClick:()=>{this.hide()}});this.dialog.card.element.appendChild(t.element),this.dialog.open()}async update(t){this.qrLib??=await Promise.resolve().then(()=>require("./browser-DfB_An57.cjs")).then(i=>i.browser);const e=await this.qrLib.toDataURL(t,{width:256,margin:4,errorCorrectionLevel:"M",color:{dark:m.black,light:m.white}});return this.qrSlot===null?!1:(this.qrSlot.classList.remove("ui-qr-slot--loading"),this.qrSlot.replaceChildren(this.createQrImage(e)),!0)}hide(){this.dialog?.close(),this.dialog=null,this.qrSlot=null}createText(t,e){const i=document.createElement("p");return i.textContent=t,Object.assign(i.style,{margin:"0",textAlign:"center",...e}),i}createQrSlot(){const t=document.createElement("div");return t.className="ui-qr-slot ui-qr-slot--loading",t}createQrImage(t){const e=document.createElement("img");return e.src=t,e.alt="QR code",e}}function it(n){const t=Math.max(0,Math.min(1,n));return t*t*(3-2*t)}function fi(n,t,e,i,o,s){const[r,l,u]=n,d=Math.cos(t),p=Math.sin(t),v=d*r+p*u,A=-p*r+d*u,k=Math.cos(e),C=Math.sin(e),R=k*l-C*A,M=C*l+k*A,Z=.55;return[i+v*s*Z,o-R*s*Z,M]}function gi(n,t,e){n.beginPath(),n.moveTo(t[0],t[1]),n.lineTo(e[0],e[1]),n.strokeStyle="#000",n.lineWidth=2,n.stroke()}function bi(n,t,e,i,o){const s=t(e),r=t(i),l=[s[0]+(r[0]-s[0])*o,s[1]+(r[1]-s[1])*o,s[2]];gi(n,s,l)}const L=[-1,-1,1],z=[1,-1,1],P=[1,-1,-1],F=[-1,-1,-1],$=[-1,1,1],D=[1,1,1],B=[1,1,-1],U=[-1,1,-1],ot=[[L,z],[z,P],[P,F],[F,L],[L,$],[z,D],[P,B],[F,U],[$,D],[D,B],[B,U],[U,$]],vi=400,st='-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif';function yi(){const n=document.createElement("div");Object.assign(n.style,{position:"absolute",inset:"0",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",background:"#fff",zIndex:"20",opacity:"0",transition:"opacity 0.3s ease-in-out"});const t=document.createElement("canvas");Object.assign(t.style,{width:"100%",height:"100%",position:"absolute",inset:"0"});const e=document.createElement("div");Object.assign(e.style,{position:"absolute",top:"56%",left:"0",right:"0",textAlign:"center",pointerEvents:"none"});const i=document.createElement("span");Object.assign(i.style,{fontSize:"13px",fontWeight:"400",color:"#000",fontVariantNumeric:"tabular-nums",fontFamily:st});const o=document.createElement("span");return Object.assign(o.style,{fontSize:"13px",color:"#000",fontFamily:st}),o.textContent=Et(),e.appendChild(i),e.appendChild(o),n.appendChild(t),n.appendChild(e),{overlay:n,canvas:t,pctEl:i,phaseEl:o}}class wi{overlay;canvas;ctx;pctEl;phaseEl;animationId=null;showTimerId=null;startTime;hidden=!1;visible=!1;constructor(t,e={}){this.startTime=performance.now();const i=yi();this.overlay=i.overlay,this.canvas=i.canvas,this.pctEl=i.pctEl,this.phaseEl=i.phaseEl,t.appendChild(this.overlay),this.ctx=this.canvas.getContext("2d"),this.ctx!==null&&(this.sizeCanvas(),this.tick());const o=e.showDelay??vi;this.showTimerId=setTimeout(()=>{this.reveal()},o)}get loadingTexts(){return{downloading:Et(),rendering:We()}}updateProgress(t,e){this.hidden||(this.pctEl.textContent=`${Math.round(t)}%`,this.phaseEl.textContent=e!==""?` · ${e}`:"")}showError(t){if(this.hidden=!1,this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null),this.ctx!==null){const e=Math.min(devicePixelRatio,2),i=this.canvas.width/e,o=this.canvas.height/e;this.ctx.fillStyle="#fff",this.ctx.fillRect(0,0,i*e,o*e)}this.pctEl.textContent="",this.phaseEl.textContent=t,this.phaseEl.style.color="#b91c1c",this.reveal()}hide(){if(!this.hidden){if(this.hidden=!0,this.cancelShowTimer(),!this.visible){this.destroy();return}this.overlay.style.opacity="0",this.overlay.addEventListener("transitionend",()=>{this.destroy()},{once:!0}),setTimeout(()=>{this.destroy()},500)}}destroy(){this.cancelShowTimer(),this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null),this.overlay.remove()}reveal(){this.hidden||this.visible||(this.visible=!0,this.overlay.style.opacity="1")}cancelShowTimer(){this.showTimerId!==null&&(clearTimeout(this.showTimerId),this.showTimerId=null)}sizeCanvas(){if(this.ctx===null)return;const t=Math.min(devicePixelRatio,2),e=this.overlay.clientWidth||440,i=this.overlay.clientHeight||360;this.canvas.width=e*t,this.canvas.height=i*t,this.ctx.scale(t,t),this.ctx.lineCap="round",this.ctx.lineJoin="round"}tick=()=>{this.hidden||(this.drawFrame(),this.animationId=requestAnimationFrame(this.tick))};drawFrame(){if(this.ctx===null)return;const t=this.canvas.width/Math.min(devicePixelRatio,2),e=this.canvas.height/Math.min(devicePixelRatio,2),i=(performance.now()-this.startTime)/1e3;this.ctx.fillStyle="#fff",this.ctx.fillRect(0,0,t,e);const o=t/2,s=e*.44,r=Math.min(t,e)*.08,l=.785,u=.615,d=C=>fi(C,l,u,o,s,r),p=6,v=i%p/p,A=ot.length;let k;v<.35?k=it(v/.35)*A:v<.55?k=A:v<.9?k=(1-it((v-.55)/.35))*A:k=0,this.ctx.shadowBlur=5,this.ctx.shadowColor="rgba(30,30,30,0.08)";for(let C=0;C<A&&!(C>=k);C++){const R=ot[C];if(R===void 0)continue;const M=Math.min(1,k-C);bi(this.ctx,d,R[0],R[1],M)}this.ctx.shadowBlur=0}}class _i{constructor(t){this.options=t,this.element=document.createElement("div"),Object.assign(this.element.style,{display:"flex",gap:"0.375rem"}),this.onFullscreenChange=()=>{this.setFullscreenIcon(document.fullscreenElement!==null)},document.addEventListener("fullscreenchange",this.onFullscreenChange)}options;element;arBtn=null;fullscreenBtn=null;onFullscreenChange;setFullscreenIcon(t){this.fullscreenBtn!==null&&this.fullscreenBtn.setIcon(t?g.exitFullscreen():g.fullscreen())}syncButton(t,e,i){if(e&&t===null){const o=i();return this.element.appendChild(o.element),o}return!e&&t!==null?(t.element.remove(),null):t}applySettings(t){this.arBtn=this.syncButton(this.arBtn,t.ar!==!1&&this.options.onAr!==void 0,()=>new b({variant:"outline",size:"icon",label:_e(),icon:g.ar(),onClick:()=>{this.options.onAr?.()}})),this.fullscreenBtn=this.syncButton(this.fullscreenBtn,t.fullscreen!==!1&&this.options.onFullscreen!==void 0,()=>new b({variant:"outline",size:"icon",label:Ue(),icon:g.fullscreen(),onClick:()=>{this.options.onFullscreen?.()}}))}destroy(){document.removeEventListener("fullscreenchange",this.onFullscreenChange)}}const x=.5;class N{element;constructor(t,e){this.element=Object.assign(document.createElement("div"),{className:"vd-camera-controls"});const i={targetRotation:e.rotation,targetTilt:e.tilt,targetZoom:e.zoom,thetaOffset:0},o=Ci(t,e,i);e.onChange(s=>{i.targetRotation=s.rotation-i.thetaOffset,i.targetTilt=s.tilt,i.targetZoom=s.zoom,Si(o,e,s)}),this.element.appendChild(N.buildZoom(o.zoomOut,o.zoomIn)),this.element.appendChild(N.buildDpad(o.tiltUp,o.rotateLeft,o.reset,o.rotateRight,o.tiltDown))}static buildZoom(t,e){const i=document.createElement("div");return i.className="vd-zoom",i.appendChild(t.element),i.appendChild(e.element),i}static buildDpad(t,e,i,o,s){const r=document.createElement("div");r.className="vd-dpad";for(const[l,u]of[[t,"up"],[e,"left"],[i,"center"],[o,"right"],[s,"down"]])l.element.classList.add(`vd-dpad-${u}`),r.appendChild(l.element);return r}}function Ci(n,t,e){const i=r=>Math.max(t.limits?.minZoom??1,Math.min(t.limits?.maxZoom??1/0,r)),o=r=>{const l=t.limits?.minRotate,u=t.limits?.maxRotate;return l!==void 0||u!==void 0?Math.max(l??-1/0,Math.min(u??1/0,r)):r},s=r=>{const l=t.limits?.minTilt,u=t.limits?.maxTilt;if(l!==void 0||u!==void 0){e.targetTilt=Math.max(l??0,Math.min(u??180,e.targetTilt+r)),n.tilt(e.targetTilt).set();return}const d=e.targetTilt+r;d>180||d<0?(e.targetTilt=d>180?360-d:-d,e.thetaOffset=(e.thetaOffset+180)%360,n.tilt(e.targetTilt).rotate(e.targetRotation+e.thetaOffset).set()):(e.targetTilt=d,n.tilt(e.targetTilt).set())};return{zoomOut:new b({variant:"outline",size:"icon",label:yn(),icon:g.zoomOut(),onClick:()=>{e.targetZoom=i(e.targetZoom-10),n.zoom(e.targetZoom).set()}}),zoomIn:new b({variant:"outline",size:"icon",label:fn(),icon:g.zoomIn(),onClick:()=>{e.targetZoom=i(e.targetZoom+10),n.zoom(e.targetZoom).set()}}),tiltUp:new b({variant:"outline",size:"icon",label:On(),icon:g.tiltUp(),onClick:()=>{s(-15)}}),rotateLeft:new b({variant:"outline",size:"icon",label:Sn(),icon:g.rotateLeft(),onClick:()=>{e.targetRotation=o(e.targetRotation-15),n.rotate(e.targetRotation+e.thetaOffset).set()}}),reset:new b({variant:"outline",size:"icon",label:un(),icon:g.reset(),onClick:()=>{e.thetaOffset=0,n.reset()}}),rotateRight:new b({variant:"outline",size:"icon",label:xn(),icon:g.rotateRight(),onClick:()=>{e.targetRotation=o(e.targetRotation+15),n.rotate(e.targetRotation+e.thetaOffset).set()}}),tiltDown:new b({variant:"outline",size:"icon",label:zn(),icon:g.tiltDown(),onClick:()=>{s(15)}})}}function Si(n,t,e){const i=t.limits;i!==void 0&&(n.zoomOut.element.disabled=i.minZoom!==void 0&&e.zoom<=i.minZoom+x,n.zoomIn.element.disabled=i.maxZoom!==void 0&&e.zoom>=i.maxZoom-x,n.tiltUp.element.disabled=i.minTilt!==void 0&&e.tilt<=i.minTilt+x,n.tiltDown.element.disabled=i.maxTilt!==void 0&&e.tilt>=i.maxTilt-x,n.rotateLeft.element.disabled=i.minRotate!==void 0&&e.rotation<=i.minRotate+x,n.rotateRight.element.disabled=i.maxRotate!==void 0&&e.rotation>=i.maxRotate-x)}const T={SELECT:"ui:select",SELECTED:"ui:selected",FOCUS_CHANGE:"vd:focus-change",CONFIGURATION_CHANGE:"vd:configuration-change",CONFIGURATION_SUBMIT:"vd:configuration-submit"},ki=5;let Ai=0;function V(n){const t=n.replace(/([A-Z])/g," $1").trim();return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function Ei(n,t,e,i,o){const s=document.createElement("div");s.className="vd-attribute",s.dataset.name=n.name;const r=document.createElement("span");r.className="vd-attribute-label",r.textContent=V(n.name),r.id=`vd-attribute-label-${Ai++}`,s.appendChild(r),s.setAttribute("role","group"),s.setAttribute("aria-labelledby",r.id);const l=n.values.find(p=>t.getValue(n.name,p)?.isSelected===!0),u=n.values.map(V),d=n.values.length<=ki?new ci(n.values,l,u):new di(n.name,n.values,V(n.name),l,u);return d.onSelect(p=>{e.dispatch(T.SELECT,{attribute:n.name,value:p},!0).defaultPrevented||i(n.name,p)}),o(n.name,p=>{d.setSelected(p.value),e.dispatch(T.SELECTED,{attribute:n.name,value:p.value})}),s.appendChild(d.element),s}const xi=80,Ti=2500;class Ri{constructor(t,e=Ti){this.configuration=t,this.resetMs=e,this.element=document.createElement("div"),this.element.className="vd-commerce vd-hidden";const i=document.createElement("div");i.className="vd-commerce-price",this.priceEl=document.createElement("span"),this.priceEl.className="vd-price",this.vatEl=document.createElement("span"),this.vatEl.className="vd-vat",i.append(this.priceEl,this.vatEl),this.button=new b({variant:"default",onClick:()=>{this.handleSubmit()}}),this.button.element.classList.add("vd-cta","vd-hidden"),this.element.append(i,this.button.element),this.unsubscribe=this.configuration.onRender(()=>{this.update()}),this.update()}configuration;resetMs;element;priceEl;vatEl;button;unsubscribe;state="idle";resetTimer;update(){this.renderPrice(this.configuration.current),this.renderButton();const t=this.configuration.current!==void 0||this.configuration.submitEnabled;this.element.classList.toggle("vd-hidden",!t)}destroy(){this.unsubscribe(),this.resetTimer!==void 0&&clearTimeout(this.resetTimer),this.element.remove()}renderPrice(t){if(t===void 0){this.priceEl.textContent="",this.vatEl.textContent="";return}this.priceEl.textContent=Ii(t.price,t.currency),this.vatEl.textContent=rt(this.configuration.vatDisplay)}renderButton(){const t=this.configuration.submitEnabled;this.button.element.classList.toggle("vd-hidden",!t),t&&this.state==="idle"&&this.setButtonText(rt(this.configuration.buttonLabel))}async handleSubmit(){if(this.state!=="busy"){this.setState("busy",Dn());try{await this.configuration.submit(),this.setState("success",jn())}catch{this.setState("failed",Zn())}this.scheduleReset()}}scheduleReset(){this.resetTimer!==void 0&&clearTimeout(this.resetTimer),this.resetTimer=setTimeout(()=>{this.state="idle",this.update()},this.resetMs)}setState(t,e){this.state=t,this.element.dataset.submit=t,this.button.element.disabled=t==="busy",this.setButtonText(e)}setButtonText(t){this.button.element.textContent=t,this.button.element.setAttribute("aria-label",t)}}function rt(n){return(n??"").slice(0,xi)}function Ii(n,t){try{const e=new Intl.NumberFormat(h(),{style:"currency",currency:t}),i=e.resolvedOptions().maximumFractionDigits??2;return e.format(n/10**i)}catch{return`${t} ${(n/100).toFixed(2)}`}}class Ot{slot=null;panel=null;attach(t,e){this.panel=e,e.style.display="none",this.slot=document.createElement("div"),this.slot.className="vd-slot-bottom-left",this.slot.appendChild(e),t.appendChild(this.slot)}setVisible(t){this.panel!==null&&(this.panel.style.display=t?"flex":"none")}destroy(){this.slot?.remove(),this.slot=null,this.panel=null}}const Oi=572;class Ni{element=null;body=null;openButton=null;closeButton=null;container=null;observer=null;collapsible=!1;expanded=!0;visible=!1;attach(t,e){this.container=t,e.classList.add("vd-attributes-sidebar"),this.closeButton=new b({variant:"ghost",size:"icon-sm",label:an(),icon:g.close({size:18}),onClick:()=>{this.expanded=!1,this.render()}});const i=document.createElement("div");i.className="vd-sidebar-header",i.appendChild(this.closeButton.element),this.body=document.createElement("div"),this.body.className="vd-sidebar-body",this.body.appendChild(e),this.element=document.createElement("div"),this.element.className="vd-sidebar vd-hidden",this.element.append(i,this.body),t.appendChild(this.element),this.openButton=new b({variant:"outline",size:"default",label:nn(),icon:g.configurator({size:18}),onClick:()=>{this.expanded=!0,this.render()}}),this.openButton.element.classList.add("vd-configurator-toggle","vd-hidden"),t.appendChild(this.openButton.element),this.observe()}setVisible(t){this.visible=t,this.render()}destroy(){this.observer?.disconnect(),this.observer=null,this.openButton?.element.remove(),this.element?.remove(),this.container?.classList.remove("vd-layout-sidebar-right","vd-layout-sidebar-collapsed","vd-layout-sidebar-permanent"),this.container=null}observe(){typeof ResizeObserver>"u"||this.container===null||(this.observer=new ResizeObserver(t=>{const e=t[0]?.contentRect.width??0;this.setCollapsible(e>0&&e<Oi)}),this.observer.observe(this.container))}setCollapsible(t){t!==this.collapsible&&(this.collapsible=t,this.expanded=!t,this.render())}render(){if(this.element===null||this.openButton===null||this.closeButton===null||this.container===null)return;const t=this.visible&&this.expanded,e=this.visible&&!this.expanded;this.element.classList.toggle("vd-hidden",!this.visible),this.element.classList.toggle("vd-sidebar-collapsed",e),this.openButton.element.classList.toggle("vd-hidden",!e),this.closeButton.element.style.display=this.collapsible?"":"none",this.container.classList.toggle("vd-layout-sidebar-right",t),this.container.classList.toggle("vd-layout-sidebar-collapsed",e),this.container.classList.toggle("vd-layout-sidebar-permanent",t&&!this.collapsible)}}class Mi{attach(t,e){}setVisible(t){}destroy(){}}const Li={"inframe-bottom-left":()=>new Ot,"sidebar-right":()=>new Ni,hidden:()=>new Mi};function zi(n){return(Li[n??""]??(()=>new Ot))()}const j=w.fontFamily.sans.join(", "),H=`
|
|
292
292
|
position: absolute;
|
|
293
293
|
display: flex;
|
|
294
294
|
z-index: 10;
|
|
@@ -387,6 +387,21 @@
|
|
|
387
387
|
/* sidebar-right layout — a docked, full-height right panel */
|
|
388
388
|
.vd-container { --vd-sidebar-width: 300px; }
|
|
389
389
|
|
|
390
|
+
.vd-container > iframe {
|
|
391
|
+
width: 100%;
|
|
392
|
+
height: 100%;
|
|
393
|
+
border: none;
|
|
394
|
+
display: block;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/* Permanently docked panel (wide embeds, not collapsible): the viewer fills the
|
|
398
|
+
remaining width instead of the panel floating over it. On narrow embeds the
|
|
399
|
+
panel is a temporary tap-to-reveal overlay instead (vd-layout-sidebar-right
|
|
400
|
+
without -permanent), where covering part of the model briefly is expected. */
|
|
401
|
+
.vd-container.vd-layout-sidebar-permanent > iframe {
|
|
402
|
+
width: calc(100% - var(--vd-sidebar-width));
|
|
403
|
+
}
|
|
404
|
+
|
|
390
405
|
.vd-hidden { display: none !important; }
|
|
391
406
|
|
|
392
407
|
.vd-sidebar {
|
|
@@ -490,4 +505,4 @@
|
|
|
490
505
|
color: ${m.white};
|
|
491
506
|
}
|
|
492
507
|
|
|
493
|
-
`;function Fi(){if(It(),document.getElementById("vd-styles")!==null)return;const n=document.createElement("style");n.id="vd-styles",n.textContent=Pi,document.head.appendChild(n)}function $i(n,t){const e=document.createElement("a");e.href=`data:image/png;base64,${n}`,e.download=t,e.click()}class Di{options;settings={};container=null;loading=null;slots={topRight:null,bottomRight:null};screenshotBtn=null;actionBar=null;cameraControls=null;attributes=null;layout=null;commerce=null;constructor(t){this.options=t}attach(t){Fi(),this.container=t,this.loading=new wi(t),this.slots.topRight=this.createSlot(t,"vd-slot-top-right"),this.slots.bottomRight=this.createSlot(t,"vd-slot-bottom-right")}onReady(){this.loading?.hide(),this.loading=null,this.mountToolbar(),this.cameraControls!==null&&(this.cameraControls.element.style.display="flex"),this.layout?.setVisible(!0)}mountToolbar(){if(this.actionBar!==null||this.slots.bottomRight===null||this.container===null)return;const t=typeof this.container.requestFullscreen=="function";this.actionBar=new _i({onAr:this.options.onAr,onFullscreen:t?()=>{this.toggleFullscreen()}:void 0}),this.actionBar.applySettings(this.settings),this.slots.bottomRight.appendChild(this.actionBar.element),this.syncScreenshotButton(),this.placeScreenshotButton()}toggleFullscreen(){this.container!==null&&(document.fullscreenElement!==null?document.exitFullscreen():(this.options.onFullscreenEnter?.(),this.container.requestFullscreen()))}updateProgress(t,e){this.loading?.updateProgress(t,e)}showError(t){this.loading?.showError(t)}applyViewerSettings(t){this.settings=t,t.language!==void 0&&St(t.language,{reload:!1}),this.syncScreenshotButton(),this.actionBar?.applySettings(t),this.cameraControls!==null&&(this.cameraControls.element.style.display=t.cameraControls===!0?"flex":"none"),this.placeScreenshotButton()}renderAttributeControls(t,e){if(!(this.container===null||this.slots.topRight===null)&&(this.cameraControls?.element.remove(),this.cameraControls=null,this.teardownConfigurator(),this.settings.cameraControls===!0&&(this.cameraControls=new N(this.options.cameraApi,this.options.cameraPositionApi),this.cameraControls.element.style.display="none",this.slots.topRight.appendChild(this.cameraControls.element)),this.placeScreenshotButton(),e.length!==0)){this.attributes=document.createElement("div"),this.attributes.className="vd-attributes";for(const i of e)this.attributes.appendChild(Ei(i,t,this.options.eventBus,this.options.onSelect,this.options.onSubscribe));this.commerce=new Ri(this.options.configuration),this.attributes.appendChild(this.commerce.element),this.layout=zi(this.settings.configuratorLayout),this.layout.attach(this.container,this.attributes)}}get viewerSettings(){return this.settings}teardownConfigurator(){this.commerce?.destroy(),this.commerce=null,this.attributes?.remove(),this.attributes=null,this.layout?.destroy(),this.layout=null}destroy(){this.loading?.destroy(),this.screenshotBtn?.element.remove(),this.actionBar?.destroy(),this.actionBar?.element.remove(),this.cameraControls?.element.remove(),this.teardownConfigurator();for(const t of Object.values(this.slots))t?.remove();this.container=null}createSlot(t,e){const i=document.createElement("div");return i.className=e,t.appendChild(i),i}syncScreenshotButton(){const t=this.settings.screenshot===!0;t&&this.screenshotBtn===null&&(this.screenshotBtn=new b({variant:"outline",size:"icon",label:Xe(),icon:g.screenshot(),onClick:()=>{this.options.snapshotApi.take("snapshot.png").onDeveloped(({data:e,filename:i})=>{$i(e,i)})}})),!t&&this.screenshotBtn!==null&&(this.screenshotBtn.element.remove(),this.screenshotBtn=null)}placeScreenshotButton(){this.screenshotBtn===null||this.slots.topRight===null||(this.cameraControls!==null?this.cameraControls.element.appendChild(this.screenshotBtn.element):this.slots.topRight.appendChild(this.screenshotBtn.element))}}const Bi={};class Ui{defaultServer="https://server.virtualdisplay.io";options;serverHost;constructor(t,e){this.options=t,this.serverHost=e}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.session!==void 0&&e.searchParams.set("session",this.options.session),this.options.debug===!0&&e.searchParams.set("debug","true"),this.options.traceparent!==void 0&&e.searchParams.set("traceparent",this.options.traceparent),e.toString()}getServerUrl(){if(this.serverHost!==void 0)return this.serverHost;if(Bi?.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 Vi(n){const{messenger:t}=n;t.on(c.HANDSHAKE,e=>{Pt(e)&&(exports.logger.info("Server handshake received, flushing publisher queue"),t.markReady())}),t.on(c.SESSION,e=>{Ft(e)&&n.onSession(e.sessionId)}),t.on(c.MUTATION,e=>{$t(e)&&(n.attributes.handleMutationResult(e),n.configuration.handleSelectionChanged(n.attributes.getSelection()))}),t.on(c.SNAPSHOT,e=>{Dt(e)&&n.snapshot.handleSnapshotResult(e)}),t.on(c.CAMERA,e=>{Bt(e)&&n.cameraPosition.handlePositionUpdate(e)}),t.on(c.LOADING_INDICATOR,e=>{Vt(e)&&(e.error!==void 0?n.ui.showError(e.error):n.ui.updateProgress(e.progress,e.phase))}),t.on(c.CONFIG,e=>{Ht(e)&&n.applyConfig(e)}),t.on(c.MAPPING,e=>{Ut(e)&&(n.attributes.handleMappingReceived(e),n.configuration.handleSelectionChanged(n.attributes.getSelection()),n.ui.renderAttributeControls(n.attributes,e.attributes),n.readyStateTracker.handleMappingReceived())}),ji(n)}function ji(n){const{messenger:t}=n;t.on(c.FOCUS,e=>{qt(e)&&n.focus.handleStateReceived(e)}),t.on(c.PRICING,e=>{Gt(e)&&n.configuration.handlePricingReceived(e.pricing)}),t.on(c.SYNC,e=>{jt(e)&&n.onSync(e.connected)})}class Hi{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}}class qi{attributes;readyStateTracker;messenger;cameraApi;cameraPositionApi;focusApi;configurationApi;snapshotApi;annotationsApi;eventBus;ui;options;serverHost;arActivation;syncTracker;iframe;container;readyCallbacks=[];mutationFailedCallbacks=[];viewerSessionId;constructor(t,e){this.options=t,this.serverHost=e?.serverHost,this.initializeLogging(),this.messenger=new Zt(()=>this.iframe?.contentWindow??null,e?.messengerOptions);const i=s=>{this.messenger.send(s)};this.attributes=new ae(i,(s,r)=>{this.notifyMutationFailed(s,r)}),this.snapshotApi=new wt(i),this.annotationsApi=new at(i),this.cameraApi=new gt(i),this.cameraPositionApi=new le,this.focusApi=new vt(i,s=>{this.dispatchFocusChange(s)}),this.configurationApi=new bt(s=>{this.dispatchConfigurationChange(s)},s=>{this.dispatchConfigurationSubmit(s)}),this.eventBus=new de,this.arActivation=e?.createArActivation?.(i),this.syncTracker=e?.createSyncTracker?.(),this.readyStateTracker=new Hi(()=>{this.notifyReady()});const o=this.arActivation;this.ui=new Di({snapshotApi:this.snapshotApi,cameraApi:this.cameraApi,cameraPositionApi:this.cameraPositionApi,eventBus:this.eventBus,configuration:this.configurationApi,onSelect:(s,r)=>this.attributes.select(s,r),onSubscribe:(s,r)=>this.attributes.onChange(s,r),...o!==void 0&&{onAr:()=>{o.activate()}},onFullscreenEnter:()=>{this.trackFullscreen()}}),this.wireIncomingMessages(),e?.registerHandlers?.(this.messenger,i),this.messenger.start(),this.createAndConnectIframe()}wireIncomingMessages(){Vi({messenger:this.messenger,attributes:this.attributes,configuration:this.configurationApi,snapshot:this.snapshotApi,cameraPosition:this.cameraPositionApi,focus:this.focusApi,ui:this.ui,readyStateTracker:this.readyStateTracker,applyConfig:t=>{this.handleConfig(t)},onSession:t=>{this.handleSession(t)},onSync:t=>{this.syncTracker?.handleSync(t)}})}handleSession(t){this.viewerSessionId=t,this.arActivation?.onSession(t)}notifyMutationFailed(t,e){for(const i of this.mutationFailedCallbacks)i({attribute:t,value:e})}notifyReady(){const t=this.readyCallbacks;this.readyCallbacks=[];for(const e of t)e(this);this.ui.onReady()}dispatchFocusChange(t){this.container?.dispatchEvent(new CustomEvent(T.FOCUS_CHANGE,{detail:t,bubbles:!0}))}dispatchConfigurationChange(t){this.container?.dispatchEvent(new CustomEvent(T.CONFIGURATION_CHANGE,{detail:t??null,bubbles:!0}))}dispatchConfigurationSubmit(t){this.container?.dispatchEvent(new CustomEvent(T.CONFIGURATION_SUBMIT,{detail:t,bubbles:!0}))}handleConfig(t){const e=t.viewerSettings,i=this.options.viewerSettings;if(e!==void 0||i!==void 0){const o=i!==void 0?{...e??{},...i}:e;if(i!==void 0&&e!==void 0){const s=Object.entries(i).filter(([r,l])=>e[r]!==l).map(([r,l])=>`${r} (metadata: ${e[r]??"undefined"}, override: ${l})`);s.length>0&&exports.logger.warn(`Viewer settings override active: ${s.join(", ")}`)}this.ui.applyViewerSettings(o),this.annotationsApi.setEnabled(o.annotations!==!1)}this.cameraPositionApi.applyLimits(t.cameraLimits)}trackFullscreen(){this.messenger.send({type:c.FULLSCREEN})}initializeLogging(){this.options.debug===!0&&ft(),exports.logger.info("Initializing Virtualdisplay client",{model:this.options.model})}createAndConnectIframe(){const e=new Ui(this.options,this.serverHost).create();this.container=e.container,this.iframe=e.iframe,this.eventBus.attach(this.container),this.ui.attach(this.container);try{const i=new URL(this.iframe.src).origin;this.messenger.setTargetOrigin(i)}catch{}}select(t,e){this.attributes.select(t,e)}getValues(t){return this.attributes.getValues(t)}getValue(t,e){return this.attributes.getValue(t,e)}onChange(t,e){this.attributes.onChange(t,e)}getAttribute(t){return this.attributes.getAttribute(t)}get isReady(){return this.readyStateTracker.isReady}onReady(t){if(this.readyStateTracker.isReady){t(this);return}this.readyCallbacks.push(t)}onMutationFailed(t){this.mutationFailedCallbacks.push(t)}activateAr(){this.arActivation?.activate()}on(t,e){this.eventBus.on(t,e)}get annotations(){return this.annotationsApi}get camera(){return this.cameraApi}get focus(){return this.focusApi}get configuration(){return this.configurationApi}get cameraPosition(){return this.cameraPositionApi}get snapshot(){return this.snapshotApi}get sessionId(){return this.viewerSessionId}get viewerSettings(){return this.ui.viewerSettings}destroy(){this.readyStateTracker.clear(),this.readyCallbacks=[],this.mutationFailedCallbacks.length=0,this.snapshotApi.clear(),this.messenger.destroy(),this.arActivation?.destroy(),this.ui.destroy(),this.container?.parentElement!==null&&this.container?.parentElement!==void 0&&this.container.parentElement.removeChild(this.container),this.container=void 0,this.iframe=void 0}}const Gi="ar.virtualdisplay.io";function Zi(n){const t=new URL(`https://${Gi}/go`);return n.sessionId!==void 0?t.searchParams.set("session",n.sessionId):(t.searchParams.set("license",n.license),t.searchParams.set("model",n.model)),t.toString()}const Wi=1500;class Qi{options;qrModal=new pi;sessionId;waiters=[];pendingTimers=new Set;destroyed=!1;constructor(t){this.options=t}onSession(t){this.sessionId=t;const e=this.waiters;this.waiters=[];for(const i of e)i(t)}activate(){if(oe()){this.options.send({type:c.AR_ACTIVATE});return}this.showQrCode()}destroy(){this.destroyed=!0;for(const t of this.pendingTimers)clearTimeout(t);this.pendingTimers.clear(),this.waiters=[],this.qrModal.hide()}async showQrCode(){this.qrModal.show();const t=await this.waitForSessionId();if(this.destroyed)return;const e=Zi({sessionId:t,license:this.options.license,model:this.options.model}),i=await this.qrModal.update(e);if(this.destroyed){this.qrModal.hide();return}i&&this.options.send({type:c.QR_SHOWN})}waitForSessionId(){return this.sessionId!==void 0?Promise.resolve(this.sessionId):new Promise(t=>{const e=setTimeout(()=>{this.pendingTimers.delete(e),t(void 0)},Wi);this.pendingTimers.add(e),this.waiters.push(i=>{this.pendingTimers.delete(e),clearTimeout(e),t(i)})})}}class Yi{callbacks=[];lastKnown;handleSync(t){this.lastKnown=t;for(const e of this.callbacks)e(t)}onChange(t){this.callbacks.push(t),this.lastKnown!==void 0&&t(this.lastKnown)}}class Ki extends qi{syncStatusTracker;constructor(t){const e=new Yi;super(t,{createArActivation:i=>new Qi({license:t.license,model:t.model,send:i}),createSyncTracker:()=>e}),this.syncStatusTracker=e}onSyncChange(t){this.syncStatusTracker.onChange(t)}}exports.Annotations=at;exports.Attribute=ct;exports.AttributeValue=lt;exports.Camera=gt;exports.Configuration=bt;exports.ERROR_CODES=S;exports.Focus=vt;exports.Photo=yt;exports.Snapshot=wt;exports.VD_EVENTS=T;exports.VirtualdisplayClient=Ki;exports.VirtualdisplayError=f;exports.enableDebugMode=ft;exports.isDebugMode=re;
|
|
508
|
+
`;function Fi(){if(It(),document.getElementById("vd-styles")!==null)return;const n=document.createElement("style");n.id="vd-styles",n.textContent=Pi,document.head.appendChild(n)}function $i(n,t){const e=document.createElement("a");e.href=`data:image/png;base64,${n}`,e.download=t,e.click()}class Di{options;settings={};container=null;loading=null;slots={topRight:null,bottomRight:null};screenshotBtn=null;actionBar=null;cameraControls=null;attributes=null;layout=null;commerce=null;constructor(t){this.options=t}attach(t){Fi(),this.container=t,this.loading=new wi(t),this.slots.topRight=this.createSlot(t,"vd-slot-top-right"),this.slots.bottomRight=this.createSlot(t,"vd-slot-bottom-right")}onReady(){this.loading?.hide(),this.loading=null,this.mountToolbar(),this.cameraControls!==null&&(this.cameraControls.element.style.display="flex"),this.layout?.setVisible(!0)}mountToolbar(){if(this.actionBar!==null||this.slots.bottomRight===null||this.container===null)return;const t=typeof this.container.requestFullscreen=="function";this.actionBar=new _i({onAr:this.options.onAr,onFullscreen:t?()=>{this.toggleFullscreen()}:void 0}),this.actionBar.applySettings(this.settings),this.slots.bottomRight.appendChild(this.actionBar.element),this.syncScreenshotButton(),this.placeScreenshotButton()}toggleFullscreen(){this.container!==null&&(document.fullscreenElement!==null?document.exitFullscreen():(this.options.onFullscreenEnter?.(),this.container.requestFullscreen()))}updateProgress(t,e){this.loading?.updateProgress(t,e)}showError(t){this.loading?.showError(t)}applyViewerSettings(t){this.settings=t,t.language!==void 0&&St(t.language,{reload:!1}),this.syncScreenshotButton(),this.actionBar?.applySettings(t),this.cameraControls!==null&&(this.cameraControls.element.style.display=t.cameraControls===!0?"flex":"none"),this.placeScreenshotButton()}renderAttributeControls(t,e){if(!(this.container===null||this.slots.topRight===null)&&(this.cameraControls?.element.remove(),this.cameraControls=null,this.teardownConfigurator(),this.settings.cameraControls===!0&&(this.cameraControls=new N(this.options.cameraApi,this.options.cameraPositionApi),this.cameraControls.element.style.display="none",this.slots.topRight.appendChild(this.cameraControls.element)),this.placeScreenshotButton(),e.length!==0)){this.attributes=document.createElement("div"),this.attributes.className="vd-attributes";for(const i of e)this.attributes.appendChild(Ei(i,t,this.options.eventBus,this.options.onSelect,this.options.onSubscribe));this.commerce=new Ri(this.options.configuration),this.attributes.appendChild(this.commerce.element),this.layout=zi(this.settings.configuratorLayout),this.layout.attach(this.container,this.attributes)}}get viewerSettings(){return this.settings}teardownConfigurator(){this.commerce?.destroy(),this.commerce=null,this.attributes?.remove(),this.attributes=null,this.layout?.destroy(),this.layout=null}destroy(){this.loading?.destroy(),this.screenshotBtn?.element.remove(),this.actionBar?.destroy(),this.actionBar?.element.remove(),this.cameraControls?.element.remove(),this.teardownConfigurator();for(const t of Object.values(this.slots))t?.remove();this.container=null}createSlot(t,e){const i=document.createElement("div");return i.className=e,t.appendChild(i),i}syncScreenshotButton(){const t=this.settings.screenshot===!0;t&&this.screenshotBtn===null&&(this.screenshotBtn=new b({variant:"outline",size:"icon",label:Xe(),icon:g.screenshot(),onClick:()=>{this.options.snapshotApi.take("snapshot.png").onDeveloped(({data:e,filename:i})=>{$i(e,i)})}})),!t&&this.screenshotBtn!==null&&(this.screenshotBtn.element.remove(),this.screenshotBtn=null)}placeScreenshotButton(){this.screenshotBtn===null||this.slots.topRight===null||(this.cameraControls!==null?this.cameraControls.element.appendChild(this.screenshotBtn.element):this.slots.topRight.appendChild(this.screenshotBtn.element))}}const Bi={};class Ui{defaultServer="https://server.virtualdisplay.io";options;serverHost;constructor(t,e){this.options=t,this.serverHost=e}create(){const t=this.createContainer(),e=this.createIframe();return t.appendChild(e),this.attachToParent(t),{container:t,iframe:e}}createContainer(){const t=document.createElement("div");return t.className="vd-container",Object.assign(t.style,{position:"relative",width:"100%",height:"100%",overflow:"hidden"}),t}createIframe(){const t=document.createElement("iframe");return t.src=this.buildUrl(),t.setAttribute("allow","xr-spatial-tracking; fullscreen"),t}attachToParent(t){this.getParentElement().appendChild(t)}buildUrl(){const t=this.getServerUrl(),e=new URL(t);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.session!==void 0&&e.searchParams.set("session",this.options.session),this.options.debug===!0&&e.searchParams.set("debug","true"),this.options.traceparent!==void 0&&e.searchParams.set("traceparent",this.options.traceparent),e.toString()}getServerUrl(){if(this.serverHost!==void 0)return this.serverHost;if(Bi?.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 Vi(n){const{messenger:t}=n;t.on(c.HANDSHAKE,e=>{Pt(e)&&(exports.logger.info("Server handshake received, flushing publisher queue"),t.markReady())}),t.on(c.SESSION,e=>{Ft(e)&&n.onSession(e.sessionId)}),t.on(c.MUTATION,e=>{$t(e)&&(n.attributes.handleMutationResult(e),n.configuration.handleSelectionChanged(n.attributes.getSelection()))}),t.on(c.SNAPSHOT,e=>{Dt(e)&&n.snapshot.handleSnapshotResult(e)}),t.on(c.CAMERA,e=>{Bt(e)&&n.cameraPosition.handlePositionUpdate(e)}),t.on(c.LOADING_INDICATOR,e=>{Vt(e)&&(e.error!==void 0?n.ui.showError(e.error):n.ui.updateProgress(e.progress,e.phase))}),t.on(c.CONFIG,e=>{Ht(e)&&n.applyConfig(e)}),t.on(c.MAPPING,e=>{Ut(e)&&(n.attributes.handleMappingReceived(e),n.configuration.handleSelectionChanged(n.attributes.getSelection()),n.ui.renderAttributeControls(n.attributes,e.attributes),n.readyStateTracker.handleMappingReceived())}),ji(n)}function ji(n){const{messenger:t}=n;t.on(c.FOCUS,e=>{qt(e)&&n.focus.handleStateReceived(e)}),t.on(c.PRICING,e=>{Gt(e)&&n.configuration.handlePricingReceived(e.pricing)}),t.on(c.SYNC,e=>{jt(e)&&n.onSync(e.connected)})}class Hi{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}}class qi{attributes;readyStateTracker;messenger;cameraApi;cameraPositionApi;focusApi;configurationApi;snapshotApi;annotationsApi;eventBus;ui;options;serverHost;arActivation;syncTracker;iframe;container;readyCallbacks=[];mutationFailedCallbacks=[];viewerSessionId;constructor(t,e){this.options=t,this.serverHost=e?.serverHost,this.initializeLogging(),this.messenger=new Zt(()=>this.iframe?.contentWindow??null,e?.messengerOptions);const i=s=>{this.messenger.send(s)};this.attributes=new ae(i,(s,r)=>{this.notifyMutationFailed(s,r)}),this.snapshotApi=new wt(i),this.annotationsApi=new at(i),this.cameraApi=new gt(i),this.cameraPositionApi=new le,this.focusApi=new vt(i,s=>{this.dispatchFocusChange(s)}),this.configurationApi=new bt(s=>{this.dispatchConfigurationChange(s)},s=>{this.dispatchConfigurationSubmit(s)}),this.eventBus=new ue,this.arActivation=e?.createArActivation?.(i),this.syncTracker=e?.createSyncTracker?.(),this.readyStateTracker=new Hi(()=>{this.notifyReady()});const o=this.arActivation;this.ui=new Di({snapshotApi:this.snapshotApi,cameraApi:this.cameraApi,cameraPositionApi:this.cameraPositionApi,eventBus:this.eventBus,configuration:this.configurationApi,onSelect:(s,r)=>this.attributes.select(s,r),onSubscribe:(s,r)=>this.attributes.onChange(s,r),...o!==void 0&&{onAr:()=>{o.activate()}},onFullscreenEnter:()=>{this.trackFullscreen()}}),this.wireIncomingMessages(),e?.registerHandlers?.(this.messenger,i),this.messenger.start(),this.createAndConnectIframe()}wireIncomingMessages(){Vi({messenger:this.messenger,attributes:this.attributes,configuration:this.configurationApi,snapshot:this.snapshotApi,cameraPosition:this.cameraPositionApi,focus:this.focusApi,ui:this.ui,readyStateTracker:this.readyStateTracker,applyConfig:t=>{this.handleConfig(t)},onSession:t=>{this.handleSession(t)},onSync:t=>{this.syncTracker?.handleSync(t)}})}handleSession(t){this.viewerSessionId=t,this.arActivation?.onSession(t)}notifyMutationFailed(t,e){for(const i of this.mutationFailedCallbacks)i({attribute:t,value:e})}notifyReady(){const t=this.readyCallbacks;this.readyCallbacks=[];for(const e of t)e(this);this.ui.onReady()}dispatchFocusChange(t){this.container?.dispatchEvent(new CustomEvent(T.FOCUS_CHANGE,{detail:t,bubbles:!0}))}dispatchConfigurationChange(t){this.container?.dispatchEvent(new CustomEvent(T.CONFIGURATION_CHANGE,{detail:t??null,bubbles:!0}))}dispatchConfigurationSubmit(t){this.container?.dispatchEvent(new CustomEvent(T.CONFIGURATION_SUBMIT,{detail:t,bubbles:!0}))}handleConfig(t){const e=t.viewerSettings,i=this.options.viewerSettings;if(e!==void 0||i!==void 0){const o=i!==void 0?{...e??{},...i}:e;if(i!==void 0&&e!==void 0){const s=Object.entries(i).filter(([r,l])=>e[r]!==l).map(([r,l])=>`${r} (metadata: ${e[r]??"undefined"}, override: ${l})`);s.length>0&&exports.logger.warn(`Viewer settings override active: ${s.join(", ")}`)}this.ui.applyViewerSettings(o),this.annotationsApi.setEnabled(o.annotations!==!1)}this.cameraPositionApi.applyLimits(t.cameraLimits)}trackFullscreen(){this.messenger.send({type:c.FULLSCREEN})}initializeLogging(){this.options.debug===!0&&ft(),exports.logger.info("Initializing Virtualdisplay client",{model:this.options.model})}createAndConnectIframe(){const e=new Ui(this.options,this.serverHost).create();this.container=e.container,this.iframe=e.iframe,this.eventBus.attach(this.container),this.ui.attach(this.container);try{const i=new URL(this.iframe.src).origin;this.messenger.setTargetOrigin(i)}catch{}}select(t,e){this.attributes.select(t,e)}getValues(t){return this.attributes.getValues(t)}getValue(t,e){return this.attributes.getValue(t,e)}onChange(t,e){this.attributes.onChange(t,e)}getAttribute(t){return this.attributes.getAttribute(t)}get isReady(){return this.readyStateTracker.isReady}onReady(t){if(this.readyStateTracker.isReady){t(this);return}this.readyCallbacks.push(t)}onMutationFailed(t){this.mutationFailedCallbacks.push(t)}activateAr(){this.arActivation?.activate()}on(t,e){this.eventBus.on(t,e)}get annotations(){return this.annotationsApi}get camera(){return this.cameraApi}get focus(){return this.focusApi}get configuration(){return this.configurationApi}get cameraPosition(){return this.cameraPositionApi}get snapshot(){return this.snapshotApi}get sessionId(){return this.viewerSessionId}get viewerSettings(){return this.ui.viewerSettings}destroy(){this.readyStateTracker.clear(),this.readyCallbacks=[],this.mutationFailedCallbacks.length=0,this.snapshotApi.clear(),this.messenger.destroy(),this.arActivation?.destroy(),this.ui.destroy(),this.container?.parentElement!==null&&this.container?.parentElement!==void 0&&this.container.parentElement.removeChild(this.container),this.container=void 0,this.iframe=void 0}}const Gi="ar.virtualdisplay.io";function Zi(n){const t=new URL(`https://${Gi}/go`);return n.sessionId!==void 0?t.searchParams.set("session",n.sessionId):(t.searchParams.set("license",n.license),t.searchParams.set("model",n.model)),t.toString()}const Wi=1500;class Qi{options;qrModal=new pi;sessionId;waiters=[];pendingTimers=new Set;destroyed=!1;constructor(t){this.options=t}onSession(t){this.sessionId=t;const e=this.waiters;this.waiters=[];for(const i of e)i(t)}activate(){if(oe()){this.options.send({type:c.AR_ACTIVATE});return}this.showQrCode()}destroy(){this.destroyed=!0;for(const t of this.pendingTimers)clearTimeout(t);this.pendingTimers.clear(),this.waiters=[],this.qrModal.hide()}async showQrCode(){this.qrModal.show();const t=await this.waitForSessionId();if(this.destroyed)return;const e=Zi({sessionId:t,license:this.options.license,model:this.options.model}),i=await this.qrModal.update(e);if(this.destroyed){this.qrModal.hide();return}i&&this.options.send({type:c.QR_SHOWN})}waitForSessionId(){return this.sessionId!==void 0?Promise.resolve(this.sessionId):new Promise(t=>{const e=setTimeout(()=>{this.pendingTimers.delete(e),t(void 0)},Wi);this.pendingTimers.add(e),this.waiters.push(i=>{this.pendingTimers.delete(e),clearTimeout(e),t(i)})})}}class Yi{callbacks=[];lastKnown;handleSync(t){this.lastKnown=t;for(const e of this.callbacks)e(t)}onChange(t){this.callbacks.push(t),this.lastKnown!==void 0&&t(this.lastKnown)}}class Ki extends qi{syncStatusTracker;constructor(t){const e=new Yi;super(t,{createArActivation:i=>new Qi({license:t.license,model:t.model,send:i}),createSyncTracker:()=>e}),this.syncStatusTracker=e}onSyncChange(t){this.syncStatusTracker.onChange(t)}}exports.Annotations=at;exports.Attribute=ct;exports.AttributeValue=lt;exports.Camera=gt;exports.Configuration=bt;exports.ERROR_CODES=S;exports.Focus=vt;exports.Photo=yt;exports.Snapshot=wt;exports.VD_EVENTS=T;exports.VirtualdisplayClient=Ki;exports.VirtualdisplayError=f;exports.enableDebugMode=ft;exports.isDebugMode=re;
|
|
@@ -408,7 +408,7 @@ class jt {
|
|
|
408
408
|
}
|
|
409
409
|
}
|
|
410
410
|
function Ht(n) {
|
|
411
|
-
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,
|
|
411
|
+
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, u]) => `${l}=${JSON.stringify(u)}`).join(" ");
|
|
412
412
|
return `${t} ${e} [${i}] ${o}${r ? " " + r : ""}`;
|
|
413
413
|
}
|
|
414
414
|
function qt(n) {
|
|
@@ -503,7 +503,7 @@ class te {
|
|
|
503
503
|
this.log("error", t, e);
|
|
504
504
|
}
|
|
505
505
|
}
|
|
506
|
-
function
|
|
506
|
+
function dt(n, t) {
|
|
507
507
|
const e = t?.isDev !== void 0 ? t.isDev : typeof process < "u" ? process.env.NODE_ENV !== "production" : !0;
|
|
508
508
|
return new te({ service: n, isDev: e, traceProvider: t?.traceProvider });
|
|
509
509
|
}
|
|
@@ -511,7 +511,7 @@ function O(n) {
|
|
|
511
511
|
if (n !== void 0)
|
|
512
512
|
return typeof n == "object" && n !== null && !Array.isArray(n) && !(n instanceof Error) ? n : n instanceof Error ? { error: n.message } : { value: n };
|
|
513
513
|
}
|
|
514
|
-
function
|
|
514
|
+
function ut(n) {
|
|
515
515
|
return {
|
|
516
516
|
debug: (t, e) => n.debug(t, O(e)),
|
|
517
517
|
info: (t, e) => n.info(t, O(e)),
|
|
@@ -519,9 +519,9 @@ function dt(n) {
|
|
|
519
519
|
error: (t, e) => n.error(t, O(e))
|
|
520
520
|
};
|
|
521
521
|
}
|
|
522
|
-
let ht = !1, _ = dt(
|
|
522
|
+
let ht = !1, _ = ut(dt("client", { isDev: !1 }));
|
|
523
523
|
function ee() {
|
|
524
|
-
ht = !0, _ = dt(
|
|
524
|
+
ht = !0, _ = ut(dt("client", { isDev: !0 }));
|
|
525
525
|
}
|
|
526
526
|
function Ki() {
|
|
527
527
|
return ht;
|
|
@@ -988,7 +988,7 @@ class ce {
|
|
|
988
988
|
}
|
|
989
989
|
}
|
|
990
990
|
const X = 3e4;
|
|
991
|
-
class
|
|
991
|
+
class de {
|
|
992
992
|
constructor(t) {
|
|
993
993
|
this.send = t;
|
|
994
994
|
}
|
|
@@ -1075,7 +1075,7 @@ class ue {
|
|
|
1075
1075
|
);
|
|
1076
1076
|
}
|
|
1077
1077
|
}
|
|
1078
|
-
class
|
|
1078
|
+
class ue {
|
|
1079
1079
|
container = null;
|
|
1080
1080
|
attach(t) {
|
|
1081
1081
|
this.container = t;
|
|
@@ -1173,14 +1173,14 @@ let ft = (n, t) => {
|
|
|
1173
1173
|
!G && typeof window < "u" && window.location?.href && (s = pt(window.location.href));
|
|
1174
1174
|
for (const l of s)
|
|
1175
1175
|
if (l !== "baseLocale" && bt(l) && N.has(l)) {
|
|
1176
|
-
const
|
|
1177
|
-
if (
|
|
1178
|
-
let
|
|
1179
|
-
|
|
1176
|
+
const u = N.get(l);
|
|
1177
|
+
if (u) {
|
|
1178
|
+
let d = u.setLocale(n);
|
|
1179
|
+
d instanceof Promise && (d = d.catch((p) => {
|
|
1180
1180
|
throw new Error(`Custom strategy "${l}" setLocale failed.`, {
|
|
1181
1181
|
cause: p
|
|
1182
1182
|
});
|
|
1183
|
-
}), o.push(
|
|
1183
|
+
}), o.push(d));
|
|
1184
1184
|
}
|
|
1185
1185
|
}
|
|
1186
1186
|
const r = () => {
|
|
@@ -1486,17 +1486,17 @@ const ve = (
|
|
|
1486
1486
|
/** @type {LocalizedString} */
|
|
1487
1487
|
"Camera resetten"
|
|
1488
1488
|
)
|
|
1489
|
-
),
|
|
1489
|
+
), dn = (
|
|
1490
1490
|
/** @type {(inputs: Controls_Camera_ResetInputs) => LocalizedString} */
|
|
1491
1491
|
() => (
|
|
1492
1492
|
/** @type {LocalizedString} */
|
|
1493
1493
|
"Kamera zurücksetzen"
|
|
1494
1494
|
)
|
|
1495
|
-
),
|
|
1495
|
+
), un = (
|
|
1496
1496
|
/** @type {((inputs?: Controls_Camera_ResetInputs, options?: { locale?: "en" | "nl" | "de" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Controls_Camera_ResetInputs, { locale?: "en" | "nl" | "de" }, {}>} */
|
|
1497
1497
|
((n = {}, t = {}) => {
|
|
1498
1498
|
const e = t.locale ?? h();
|
|
1499
|
-
return e === "en" ? ln() : e === "nl" ? cn() :
|
|
1499
|
+
return e === "en" ? ln() : e === "nl" ? cn() : dn();
|
|
1500
1500
|
})
|
|
1501
1501
|
), hn = (
|
|
1502
1502
|
/** @type {(inputs: Controls_Camera_Zoomin1Inputs) => LocalizedString} */
|
|
@@ -1934,7 +1934,7 @@ class ci {
|
|
|
1934
1934
|
this.selectCallback = t;
|
|
1935
1935
|
}
|
|
1936
1936
|
}
|
|
1937
|
-
class
|
|
1937
|
+
class di {
|
|
1938
1938
|
element;
|
|
1939
1939
|
select;
|
|
1940
1940
|
constructor(t, e, i, o, s) {
|
|
@@ -1942,13 +1942,13 @@ class ui {
|
|
|
1942
1942
|
const r = document.createElement("option");
|
|
1943
1943
|
r.value = "", r.disabled = !0, r.textContent = i, this.select.appendChild(r);
|
|
1944
1944
|
let l = !1;
|
|
1945
|
-
for (let
|
|
1946
|
-
const p = e[
|
|
1947
|
-
v.value = p, v.textContent = s?.[
|
|
1945
|
+
for (let d = 0; d < e.length; d++) {
|
|
1946
|
+
const p = e[d], v = document.createElement("option");
|
|
1947
|
+
v.value = p, v.textContent = s?.[d] ?? p, p === o && (v.selected = !0, l = !0), this.select.appendChild(v);
|
|
1948
1948
|
}
|
|
1949
1949
|
l || (r.selected = !0);
|
|
1950
|
-
const
|
|
1951
|
-
|
|
1950
|
+
const u = wt(_t, { width: 16, height: 16, "stroke-width": 2 });
|
|
1951
|
+
u.classList.add("ui-native-select-icon"), this.element = document.createElement("div"), this.element.className = "ui-native-select-wrap", this.element.appendChild(this.select), this.element.appendChild(u);
|
|
1952
1952
|
}
|
|
1953
1953
|
setSelected(t) {
|
|
1954
1954
|
this.select.value = t;
|
|
@@ -1976,7 +1976,7 @@ const w = {
|
|
|
1976
1976
|
medium: "500",
|
|
1977
1977
|
semibold: "600"
|
|
1978
1978
|
}
|
|
1979
|
-
}, x = w.fontFamily.sans.join(", "),
|
|
1979
|
+
}, x = w.fontFamily.sans.join(", "), ui = `
|
|
1980
1980
|
--primary: oklch(5% 0 0);
|
|
1981
1981
|
--primary-foreground: oklch(100% 0 0);
|
|
1982
1982
|
--secondary: oklch(92% 0 0);
|
|
@@ -1990,7 +1990,7 @@ const w = {
|
|
|
1990
1990
|
--accent-foreground: oklch(5% 0 0);
|
|
1991
1991
|
--muted-foreground: oklch(44% 0 0);
|
|
1992
1992
|
`, hi = `
|
|
1993
|
-
:root { ${
|
|
1993
|
+
:root { ${ui} }
|
|
1994
1994
|
|
|
1995
1995
|
/* ── Button ──────────────────────────────────────────────── */
|
|
1996
1996
|
.ui-btn {
|
|
@@ -2346,7 +2346,7 @@ function ot(n) {
|
|
|
2346
2346
|
return t * t * (3 - 2 * t);
|
|
2347
2347
|
}
|
|
2348
2348
|
function fi(n, t, e, i, o, s) {
|
|
2349
|
-
const [r, l,
|
|
2349
|
+
const [r, l, u] = n, d = Math.cos(t), p = Math.sin(t), v = d * r + p * u, E = -p * r + d * u, k = Math.cos(e), S = Math.sin(e), R = k * l - S * E, M = S * l + k * E, W = 0.55;
|
|
2350
2350
|
return [i + v * s * W, o - R * s * W, M];
|
|
2351
2351
|
}
|
|
2352
2352
|
function gi(n, t, e) {
|
|
@@ -2495,7 +2495,7 @@ class wi {
|
|
|
2495
2495
|
return;
|
|
2496
2496
|
const t = this.canvas.width / Math.min(devicePixelRatio, 2), e = this.canvas.height / Math.min(devicePixelRatio, 2), i = (performance.now() - this.startTime) / 1e3;
|
|
2497
2497
|
this.ctx.fillStyle = "#fff", this.ctx.fillRect(0, 0, t, e);
|
|
2498
|
-
const o = t / 2, s = e * 0.44, r = Math.min(t, e) * 0.08, l = 0.785,
|
|
2498
|
+
const o = t / 2, s = e * 0.44, r = Math.min(t, e) * 0.08, l = 0.785, u = 0.615, d = (S) => fi(S, l, u, o, s, r), p = 6, v = i % p / p, E = st.length;
|
|
2499
2499
|
let k;
|
|
2500
2500
|
v < 0.35 ? k = ot(v / 0.35) * E : v < 0.55 ? k = E : v < 0.9 ? k = (1 - ot((v - 0.55) / 0.35)) * E : k = 0, this.ctx.shadowBlur = 5, this.ctx.shadowColor = "rgba(30,30,30,0.08)";
|
|
2501
2501
|
for (let S = 0; S < E && !(S >= k); S++) {
|
|
@@ -2503,7 +2503,7 @@ class wi {
|
|
|
2503
2503
|
if (R === void 0)
|
|
2504
2504
|
continue;
|
|
2505
2505
|
const M = Math.min(1, k - S);
|
|
2506
|
-
bi(this.ctx,
|
|
2506
|
+
bi(this.ctx, d, R[0], R[1], M);
|
|
2507
2507
|
}
|
|
2508
2508
|
this.ctx.shadowBlur = 0;
|
|
2509
2509
|
}
|
|
@@ -2574,29 +2574,29 @@ class L {
|
|
|
2574
2574
|
static buildDpad(t, e, i, o, s) {
|
|
2575
2575
|
const r = document.createElement("div");
|
|
2576
2576
|
r.className = "vd-dpad";
|
|
2577
|
-
for (const [l,
|
|
2577
|
+
for (const [l, u] of [
|
|
2578
2578
|
[t, "up"],
|
|
2579
2579
|
[e, "left"],
|
|
2580
2580
|
[i, "center"],
|
|
2581
2581
|
[o, "right"],
|
|
2582
2582
|
[s, "down"]
|
|
2583
2583
|
])
|
|
2584
|
-
l.element.classList.add(`vd-dpad-${
|
|
2584
|
+
l.element.classList.add(`vd-dpad-${u}`), r.appendChild(l.element);
|
|
2585
2585
|
return r;
|
|
2586
2586
|
}
|
|
2587
2587
|
}
|
|
2588
2588
|
function Ci(n, t, e) {
|
|
2589
2589
|
const i = (r) => Math.max(t.limits?.minZoom ?? 1, Math.min(t.limits?.maxZoom ?? 1 / 0, r)), o = (r) => {
|
|
2590
|
-
const l = t.limits?.minRotate,
|
|
2591
|
-
return l !== void 0 ||
|
|
2590
|
+
const l = t.limits?.minRotate, u = t.limits?.maxRotate;
|
|
2591
|
+
return l !== void 0 || u !== void 0 ? Math.max(l ?? -1 / 0, Math.min(u ?? 1 / 0, r)) : r;
|
|
2592
2592
|
}, s = (r) => {
|
|
2593
|
-
const l = t.limits?.minTilt,
|
|
2594
|
-
if (l !== void 0 ||
|
|
2595
|
-
e.targetTilt = Math.max(l ?? 0, Math.min(
|
|
2593
|
+
const l = t.limits?.minTilt, u = t.limits?.maxTilt;
|
|
2594
|
+
if (l !== void 0 || u !== void 0) {
|
|
2595
|
+
e.targetTilt = Math.max(l ?? 0, Math.min(u ?? 180, e.targetTilt + r)), n.tilt(e.targetTilt).set();
|
|
2596
2596
|
return;
|
|
2597
2597
|
}
|
|
2598
|
-
const
|
|
2599
|
-
|
|
2598
|
+
const d = e.targetTilt + r;
|
|
2599
|
+
d > 180 || d < 0 ? (e.targetTilt = d > 180 ? 360 - d : -d, e.thetaOffset = (e.thetaOffset + 180) % 360, n.tilt(e.targetTilt).rotate(e.targetRotation + e.thetaOffset).set()) : (e.targetTilt = d, n.tilt(e.targetTilt).set());
|
|
2600
2600
|
};
|
|
2601
2601
|
return {
|
|
2602
2602
|
zoomOut: new b({ variant: "outline", size: "icon", label: yn(), icon: g.zoomOut(), onClick: () => {
|
|
@@ -2611,7 +2611,7 @@ function Ci(n, t, e) {
|
|
|
2611
2611
|
rotateLeft: new b({ variant: "outline", size: "icon", label: Sn(), icon: g.rotateLeft(), onClick: () => {
|
|
2612
2612
|
e.targetRotation = o(e.targetRotation - 15), n.rotate(e.targetRotation + e.thetaOffset).set();
|
|
2613
2613
|
} }),
|
|
2614
|
-
reset: new b({ variant: "outline", size: "icon", label:
|
|
2614
|
+
reset: new b({ variant: "outline", size: "icon", label: un(), icon: g.reset(), onClick: () => {
|
|
2615
2615
|
e.thetaOffset = 0, n.reset();
|
|
2616
2616
|
} }),
|
|
2617
2617
|
rotateRight: new b({ variant: "outline", size: "icon", label: xn(), icon: g.rotateRight(), onClick: () => {
|
|
@@ -2648,12 +2648,12 @@ function Ei(n, t, e, i, o) {
|
|
|
2648
2648
|
s.className = "vd-attribute", s.dataset.name = n.name;
|
|
2649
2649
|
const r = document.createElement("span");
|
|
2650
2650
|
r.className = "vd-attribute-label", r.textContent = j(n.name), r.id = `vd-attribute-label-${Ai++}`, s.appendChild(r), s.setAttribute("role", "group"), s.setAttribute("aria-labelledby", r.id);
|
|
2651
|
-
const l = n.values.find((p) => t.getValue(n.name, p)?.isSelected === !0),
|
|
2652
|
-
return
|
|
2651
|
+
const l = n.values.find((p) => t.getValue(n.name, p)?.isSelected === !0), u = n.values.map(j), d = n.values.length <= ki ? new ci(n.values, l, u) : new di(n.name, n.values, j(n.name), l, u);
|
|
2652
|
+
return d.onSelect((p) => {
|
|
2653
2653
|
e.dispatch(I.SELECT, { attribute: n.name, value: p }, !0).defaultPrevented || i(n.name, p);
|
|
2654
2654
|
}), o(n.name, (p) => {
|
|
2655
|
-
|
|
2656
|
-
}), s.appendChild(
|
|
2655
|
+
d.setSelected(p.value), e.dispatch(I.SELECTED, { attribute: n.name, value: p.value });
|
|
2656
|
+
}), s.appendChild(d.element), s;
|
|
2657
2657
|
}
|
|
2658
2658
|
const xi = 80, Ti = 2500;
|
|
2659
2659
|
class Ri {
|
|
@@ -2778,7 +2778,11 @@ class Ni {
|
|
|
2778
2778
|
this.visible = t, this.render();
|
|
2779
2779
|
}
|
|
2780
2780
|
destroy() {
|
|
2781
|
-
this.observer?.disconnect(), this.observer = null, this.openButton?.element.remove(), this.element?.remove(), this.container?.classList.remove(
|
|
2781
|
+
this.observer?.disconnect(), this.observer = null, this.openButton?.element.remove(), this.element?.remove(), this.container?.classList.remove(
|
|
2782
|
+
"vd-layout-sidebar-right",
|
|
2783
|
+
"vd-layout-sidebar-collapsed",
|
|
2784
|
+
"vd-layout-sidebar-permanent"
|
|
2785
|
+
), this.container = null;
|
|
2782
2786
|
}
|
|
2783
2787
|
observe() {
|
|
2784
2788
|
typeof ResizeObserver > "u" || this.container === null || (this.observer = new ResizeObserver((t) => {
|
|
@@ -2793,7 +2797,7 @@ class Ni {
|
|
|
2793
2797
|
if (this.element === null || this.openButton === null || this.closeButton === null || this.container === null)
|
|
2794
2798
|
return;
|
|
2795
2799
|
const t = this.visible && this.expanded, e = this.visible && !this.expanded;
|
|
2796
|
-
this.element.classList.toggle("vd-hidden", !this.visible), this.element.classList.toggle("vd-sidebar-collapsed", e), this.openButton.element.classList.toggle("vd-hidden", !e), this.closeButton.element.style.display = this.collapsible ? "" : "none", this.container.classList.toggle("vd-layout-sidebar-right", t), this.container.classList.toggle("vd-layout-sidebar-collapsed", e);
|
|
2800
|
+
this.element.classList.toggle("vd-hidden", !this.visible), this.element.classList.toggle("vd-sidebar-collapsed", e), this.openButton.element.classList.toggle("vd-hidden", !e), this.closeButton.element.style.display = this.collapsible ? "" : "none", this.container.classList.toggle("vd-layout-sidebar-right", t), this.container.classList.toggle("vd-layout-sidebar-collapsed", e), this.container.classList.toggle("vd-layout-sidebar-permanent", t && !this.collapsible);
|
|
2797
2801
|
}
|
|
2798
2802
|
}
|
|
2799
2803
|
class Li {
|
|
@@ -2911,6 +2915,21 @@ const H = w.fontFamily.sans.join(", "), q = `
|
|
|
2911
2915
|
/* sidebar-right layout — a docked, full-height right panel */
|
|
2912
2916
|
.vd-container { --vd-sidebar-width: 300px; }
|
|
2913
2917
|
|
|
2918
|
+
.vd-container > iframe {
|
|
2919
|
+
width: 100%;
|
|
2920
|
+
height: 100%;
|
|
2921
|
+
border: none;
|
|
2922
|
+
display: block;
|
|
2923
|
+
}
|
|
2924
|
+
|
|
2925
|
+
/* Permanently docked panel (wide embeds, not collapsible): the viewer fills the
|
|
2926
|
+
remaining width instead of the panel floating over it. On narrow embeds the
|
|
2927
|
+
panel is a temporary tap-to-reveal overlay instead (vd-layout-sidebar-right
|
|
2928
|
+
without -permanent), where covering part of the model briefly is expected. */
|
|
2929
|
+
.vd-container.vd-layout-sidebar-permanent > iframe {
|
|
2930
|
+
width: calc(100% - var(--vd-sidebar-width));
|
|
2931
|
+
}
|
|
2932
|
+
|
|
2914
2933
|
.vd-hidden { display: none !important; }
|
|
2915
2934
|
|
|
2916
2935
|
.vd-sidebar {
|
|
@@ -3144,12 +3163,7 @@ class Ui {
|
|
|
3144
3163
|
}
|
|
3145
3164
|
createIframe() {
|
|
3146
3165
|
const t = document.createElement("iframe");
|
|
3147
|
-
return t.src = this.buildUrl(),
|
|
3148
|
-
width: "100%",
|
|
3149
|
-
height: "100%",
|
|
3150
|
-
border: "none",
|
|
3151
|
-
display: "block"
|
|
3152
|
-
}), t.setAttribute("allow", "xr-spatial-tracking; fullscreen"), t;
|
|
3166
|
+
return t.src = this.buildUrl(), t.setAttribute("allow", "xr-spatial-tracking; fullscreen"), t;
|
|
3153
3167
|
}
|
|
3154
3168
|
attachToParent(t) {
|
|
3155
3169
|
this.getParentElement().appendChild(t);
|
|
@@ -3253,7 +3267,7 @@ class qi {
|
|
|
3253
3267
|
};
|
|
3254
3268
|
this.attributes = new ne(i, (s, r) => {
|
|
3255
3269
|
this.notifyMutationFailed(s, r);
|
|
3256
|
-
}), this.snapshotApi = new
|
|
3270
|
+
}), this.snapshotApi = new de(i), this.annotationsApi = new Bt(i), this.cameraApi = new ie(i), this.cameraPositionApi = new oe(), this.focusApi = new le(i, (s) => {
|
|
3257
3271
|
this.dispatchFocusChange(s);
|
|
3258
3272
|
}), this.configurationApi = new ae(
|
|
3259
3273
|
(s) => {
|
|
@@ -3262,7 +3276,7 @@ class qi {
|
|
|
3262
3276
|
(s) => {
|
|
3263
3277
|
this.dispatchConfigurationSubmit(s);
|
|
3264
3278
|
}
|
|
3265
|
-
), this.eventBus = new
|
|
3279
|
+
), this.eventBus = new ue(), this.arActivation = e?.createArActivation?.(i), this.syncTracker = e?.createSyncTracker?.(), this.readyStateTracker = new Hi(() => {
|
|
3266
3280
|
this.notifyReady();
|
|
3267
3281
|
});
|
|
3268
3282
|
const o = this.arActivation;
|
|
@@ -3564,7 +3578,7 @@ export {
|
|
|
3564
3578
|
A as ERROR_CODES,
|
|
3565
3579
|
le as Focus,
|
|
3566
3580
|
ce as Photo,
|
|
3567
|
-
|
|
3581
|
+
de as Snapshot,
|
|
3568
3582
|
I as VD_EVENTS,
|
|
3569
3583
|
Ji as VirtualdisplayClient,
|
|
3570
3584
|
f as VirtualdisplayError,
|
|
@@ -288,7 +288,7 @@
|
|
|
288
288
|
0%, 100% { opacity: 1; }
|
|
289
289
|
50% { opacity: 0.55; }
|
|
290
290
|
}
|
|
291
|
-
`;let Te=!1;function Re(){if(Te||typeof document>"u")return;Te=!0;const n=document.createElement("style");n.id="vd-ui-vanilla",n.textContent=Jo,document.head.appendChild(n)}const Zo=U.fontFamily.sans.join(", ");class Wo{qrLib=null;dialog=null;qrSlot=null;show(){this.hide(),Re(),this.dialog=new Ko({onClose:()=>{this.dialog=null,this.qrSlot=null}}),Object.assign(this.dialog.card.element.style,{display:"flex",flexDirection:"column",alignItems:"center",gap:E[3],fontFamily:Zo}),this.dialog.card.element.appendChild(this.createText(ui(),{fontSize:U.fontSize.base,fontWeight:U.fontWeight.semibold,color:L.neutral[900]})),this.dialog.card.element.appendChild(this.createText(gi(),{fontSize:U.fontSize.sm,color:L.neutral[600]})),this.qrSlot=this.createQrSlot(),this.dialog.card.element.appendChild(this.qrSlot),this.dialog.card.element.appendChild(this.createText(vi(),{fontSize:U.fontSize.xs,color:L.neutral[500]}));const t=new F({variant:"outline",label:Si(),onClick:()=>{this.hide()}});this.dialog.card.element.appendChild(t.element),this.dialog.open()}async update(t){this.qrLib??=await Promise.resolve().then(()=>os);const e=await this.qrLib.toDataURL(t,{width:256,margin:4,errorCorrectionLevel:"M",color:{dark:L.black,light:L.white}});return this.qrSlot===null?!1:(this.qrSlot.classList.remove("ui-qr-slot--loading"),this.qrSlot.replaceChildren(this.createQrImage(e)),!0)}hide(){this.dialog?.close(),this.dialog=null,this.qrSlot=null}createText(t,e){const i=document.createElement("p");return i.textContent=t,Object.assign(i.style,{margin:"0",textAlign:"center",...e}),i}createQrSlot(){const t=document.createElement("div");return t.className="ui-qr-slot ui-qr-slot--loading",t}createQrImage(t){const e=document.createElement("img");return e.src=t,e.alt="QR code",e}}function Ie(n){const t=Math.max(0,Math.min(1,n));return t*t*(3-2*t)}function Xo(n,t,e,i,o,r){const[s,a,l]=n,c=Math.cos(t),u=Math.sin(t),h=c*s+u*l,f=-u*s+c*l,d=Math.cos(e),p=Math.sin(e),k=d*a-p*f,P=p*a+d*f,S=.55;return[i+h*r*S,o-k*r*S,P]}function tr(n,t,e){n.beginPath(),n.moveTo(t[0],t[1]),n.lineTo(e[0],e[1]),n.strokeStyle="#000",n.lineWidth=2,n.stroke()}function er(n,t,e,i,o){const r=t(e),s=t(i),a=[r[0]+(s[0]-r[0])*o,r[1]+(s[1]-r[1])*o,r[2]];tr(n,r,a)}const dt=[-1,-1,1],ht=[1,-1,1],ft=[1,-1,-1],gt=[-1,-1,-1],mt=[-1,1,1],pt=[1,1,1],bt=[1,1,-1],vt=[-1,1,-1],Ne=[[dt,ht],[ht,ft],[ft,gt],[gt,dt],[dt,mt],[ht,pt],[ft,bt],[gt,vt],[mt,pt],[pt,bt],[bt,vt],[vt,mt]],nr=400,Me='-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif';function ir(){const n=document.createElement("div");Object.assign(n.style,{position:"absolute",inset:"0",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",background:"#fff",zIndex:"20",opacity:"0",transition:"opacity 0.3s ease-in-out"});const t=document.createElement("canvas");Object.assign(t.style,{width:"100%",height:"100%",position:"absolute",inset:"0"});const e=document.createElement("div");Object.assign(e.style,{position:"absolute",top:"56%",left:"0",right:"0",textAlign:"center",pointerEvents:"none"});const i=document.createElement("span");Object.assign(i.style,{fontSize:"13px",fontWeight:"400",color:"#000",fontVariantNumeric:"tabular-nums",fontFamily:Me});const o=document.createElement("span");return Object.assign(o.style,{fontSize:"13px",color:"#000",fontFamily:Me}),o.textContent=Ee(),e.appendChild(i),e.appendChild(o),n.appendChild(t),n.appendChild(e),{overlay:n,canvas:t,pctEl:i,phaseEl:o}}class or{overlay;canvas;ctx;pctEl;phaseEl;animationId=null;showTimerId=null;startTime;hidden=!1;visible=!1;constructor(t,e={}){this.startTime=performance.now();const i=ir();this.overlay=i.overlay,this.canvas=i.canvas,this.pctEl=i.pctEl,this.phaseEl=i.phaseEl,t.appendChild(this.overlay),this.ctx=this.canvas.getContext("2d"),this.ctx!==null&&(this.sizeCanvas(),this.tick());const o=e.showDelay??nr;this.showTimerId=setTimeout(()=>{this.reveal()},o)}get loadingTexts(){return{downloading:Ee(),rendering:Pi()}}updateProgress(t,e){this.hidden||(this.pctEl.textContent=`${Math.round(t)}%`,this.phaseEl.textContent=e!==""?` · ${e}`:"")}showError(t){if(this.hidden=!1,this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null),this.ctx!==null){const e=Math.min(devicePixelRatio,2),i=this.canvas.width/e,o=this.canvas.height/e;this.ctx.fillStyle="#fff",this.ctx.fillRect(0,0,i*e,o*e)}this.pctEl.textContent="",this.phaseEl.textContent=t,this.phaseEl.style.color="#b91c1c",this.reveal()}hide(){if(!this.hidden){if(this.hidden=!0,this.cancelShowTimer(),!this.visible){this.destroy();return}this.overlay.style.opacity="0",this.overlay.addEventListener("transitionend",()=>{this.destroy()},{once:!0}),setTimeout(()=>{this.destroy()},500)}}destroy(){this.cancelShowTimer(),this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null),this.overlay.remove()}reveal(){this.hidden||this.visible||(this.visible=!0,this.overlay.style.opacity="1")}cancelShowTimer(){this.showTimerId!==null&&(clearTimeout(this.showTimerId),this.showTimerId=null)}sizeCanvas(){if(this.ctx===null)return;const t=Math.min(devicePixelRatio,2),e=this.overlay.clientWidth||440,i=this.overlay.clientHeight||360;this.canvas.width=e*t,this.canvas.height=i*t,this.ctx.scale(t,t),this.ctx.lineCap="round",this.ctx.lineJoin="round"}tick=()=>{this.hidden||(this.drawFrame(),this.animationId=requestAnimationFrame(this.tick))};drawFrame(){if(this.ctx===null)return;const t=this.canvas.width/Math.min(devicePixelRatio,2),e=this.canvas.height/Math.min(devicePixelRatio,2),i=(performance.now()-this.startTime)/1e3;this.ctx.fillStyle="#fff",this.ctx.fillRect(0,0,t,e);const o=t/2,r=e*.44,s=Math.min(t,e)*.08,a=.785,l=.615,c=p=>Xo(p,a,l,o,r,s),u=6,h=i%u/u,f=Ne.length;let d;h<.35?d=Ie(h/.35)*f:h<.55?d=f:h<.9?d=(1-Ie((h-.55)/.35))*f:d=0,this.ctx.shadowBlur=5,this.ctx.shadowColor="rgba(30,30,30,0.08)";for(let p=0;p<f&&!(p>=d);p++){const k=Ne[p];if(k===void 0)continue;const P=Math.min(1,d-p);er(this.ctx,c,k[0],k[1],P)}this.ctx.shadowBlur=0}}class rr{constructor(t){this.options=t,this.element=document.createElement("div"),Object.assign(this.element.style,{display:"flex",gap:"0.375rem"}),this.onFullscreenChange=()=>{this.setFullscreenIcon(document.fullscreenElement!==null)},document.addEventListener("fullscreenchange",this.onFullscreenChange)}options;element;arBtn=null;fullscreenBtn=null;onFullscreenChange;setFullscreenIcon(t){this.fullscreenBtn!==null&&this.fullscreenBtn.setIcon(t?z.exitFullscreen():z.fullscreen())}syncButton(t,e,i){if(e&&t===null){const o=i();return this.element.appendChild(o.element),o}return!e&&t!==null?(t.element.remove(),null):t}applySettings(t){this.arBtn=this.syncButton(this.arBtn,t.ar!==!1&&this.options.onAr!==void 0,()=>new F({variant:"outline",size:"icon",label:si(),icon:z.ar(),onClick:()=>{this.options.onAr?.()}})),this.fullscreenBtn=this.syncButton(this.fullscreenBtn,t.fullscreen!==!1&&this.options.onFullscreen!==void 0,()=>new F({variant:"outline",size:"icon",label:ki(),icon:z.fullscreen(),onClick:()=>{this.options.onFullscreen?.()}}))}destroy(){document.removeEventListener("fullscreenchange",this.onFullscreenChange)}}const Z=.5;class st{element;constructor(t,e){this.element=Object.assign(document.createElement("div"),{className:"vd-camera-controls"});const i={targetRotation:e.rotation,targetTilt:e.tilt,targetZoom:e.zoom,thetaOffset:0},o=sr(t,e,i);e.onChange(r=>{i.targetRotation=r.rotation-i.thetaOffset,i.targetTilt=r.tilt,i.targetZoom=r.zoom,ar(o,e,r)}),this.element.appendChild(st.buildZoom(o.zoomOut,o.zoomIn)),this.element.appendChild(st.buildDpad(o.tiltUp,o.rotateLeft,o.reset,o.rotateRight,o.tiltDown))}static buildZoom(t,e){const i=document.createElement("div");return i.className="vd-zoom",i.appendChild(t.element),i.appendChild(e.element),i}static buildDpad(t,e,i,o,r){const s=document.createElement("div");s.className="vd-dpad";for(const[a,l]of[[t,"up"],[e,"left"],[i,"center"],[o,"right"],[r,"down"]])a.element.classList.add(`vd-dpad-${l}`),s.appendChild(a.element);return s}}function sr(n,t,e){const i=s=>Math.max(t.limits?.minZoom??1,Math.min(t.limits?.maxZoom??1/0,s)),o=s=>{const a=t.limits?.minRotate,l=t.limits?.maxRotate;return a!==void 0||l!==void 0?Math.max(a??-1/0,Math.min(l??1/0,s)):s},r=s=>{const a=t.limits?.minTilt,l=t.limits?.maxTilt;if(a!==void 0||l!==void 0){e.targetTilt=Math.max(a??0,Math.min(l??180,e.targetTilt+s)),n.tilt(e.targetTilt).set();return}const c=e.targetTilt+s;c>180||c<0?(e.targetTilt=c>180?360-c:-c,e.thetaOffset=(e.thetaOffset+180)%360,n.tilt(e.targetTilt).rotate(e.targetRotation+e.thetaOffset).set()):(e.targetTilt=c,n.tilt(e.targetTilt).set())};return{zoomOut:new F({variant:"outline",size:"icon",label:io(),icon:z.zoomOut(),onClick:()=>{e.targetZoom=i(e.targetZoom-10),n.zoom(e.targetZoom).set()}}),zoomIn:new F({variant:"outline",size:"icon",label:Xi(),icon:z.zoomIn(),onClick:()=>{e.targetZoom=i(e.targetZoom+10),n.zoom(e.targetZoom).set()}}),tiltUp:new F({variant:"outline",size:"icon",label:po(),icon:z.tiltUp(),onClick:()=>{r(-15)}}),rotateLeft:new F({variant:"outline",size:"icon",label:ao(),icon:z.rotateLeft(),onClick:()=>{e.targetRotation=o(e.targetRotation-15),n.rotate(e.targetRotation+e.thetaOffset).set()}}),reset:new F({variant:"outline",size:"icon",label:Qi(),icon:z.reset(),onClick:()=>{e.thetaOffset=0,n.reset()}}),rotateRight:new F({variant:"outline",size:"icon",label:ho(),icon:z.rotateRight(),onClick:()=>{e.targetRotation=o(e.targetRotation+15),n.rotate(e.targetRotation+e.thetaOffset).set()}}),tiltDown:new F({variant:"outline",size:"icon",label:wo(),icon:z.tiltDown(),onClick:()=>{r(15)}})}}function ar(n,t,e){const i=t.limits;i!==void 0&&(n.zoomOut.element.disabled=i.minZoom!==void 0&&e.zoom<=i.minZoom+Z,n.zoomIn.element.disabled=i.maxZoom!==void 0&&e.zoom>=i.maxZoom-Z,n.tiltUp.element.disabled=i.minTilt!==void 0&&e.tilt<=i.minTilt+Z,n.tiltDown.element.disabled=i.maxTilt!==void 0&&e.tilt>=i.maxTilt-Z,n.rotateLeft.element.disabled=i.minRotate!==void 0&&e.rotation<=i.minRotate+Z,n.rotateRight.element.disabled=i.maxRotate!==void 0&&e.rotation>=i.maxRotate-Z)}const W={SELECT:"ui:select",SELECTED:"ui:selected",FOCUS_CHANGE:"vd:focus-change",CONFIGURATION_CHANGE:"vd:configuration-change",CONFIGURATION_SUBMIT:"vd:configuration-submit"},lr=5;let cr=0;function yt(n){const t=n.replace(/([A-Z])/g," $1").trim();return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function ur(n,t,e,i,o){const r=document.createElement("div");r.className="vd-attribute",r.dataset.name=n.name;const s=document.createElement("span");s.className="vd-attribute-label",s.textContent=yt(n.name),s.id=`vd-attribute-label-${cr++}`,r.appendChild(s),r.setAttribute("role","group"),r.setAttribute("aria-labelledby",s.id);const a=n.values.find(u=>t.getValue(n.name,u)?.isSelected===!0),l=n.values.map(yt),c=n.values.length<=lr?new Yo(n.values,a,l):new Qo(n.name,n.values,yt(n.name),a,l);return c.onSelect(u=>{e.dispatch(W.SELECT,{attribute:n.name,value:u},!0).defaultPrevented||i(n.name,u)}),o(n.name,u=>{c.setSelected(u.value),e.dispatch(W.SELECTED,{attribute:n.name,value:u.value})}),r.appendChild(c.element),r}const dr=80,hr=2500;class fr{constructor(t,e=hr){this.configuration=t,this.resetMs=e,this.element=document.createElement("div"),this.element.className="vd-commerce vd-hidden";const i=document.createElement("div");i.className="vd-commerce-price",this.priceEl=document.createElement("span"),this.priceEl.className="vd-price",this.vatEl=document.createElement("span"),this.vatEl.className="vd-vat",i.append(this.priceEl,this.vatEl),this.button=new F({variant:"default",onClick:()=>{this.handleSubmit()}}),this.button.element.classList.add("vd-cta","vd-hidden"),this.element.append(i,this.button.element),this.unsubscribe=this.configuration.onRender(()=>{this.update()}),this.update()}configuration;resetMs;element;priceEl;vatEl;button;unsubscribe;state="idle";resetTimer;update(){this.renderPrice(this.configuration.current),this.renderButton();const t=this.configuration.current!==void 0||this.configuration.submitEnabled;this.element.classList.toggle("vd-hidden",!t)}destroy(){this.unsubscribe(),this.resetTimer!==void 0&&clearTimeout(this.resetTimer),this.element.remove()}renderPrice(t){if(t===void 0){this.priceEl.textContent="",this.vatEl.textContent="";return}this.priceEl.textContent=gr(t.price,t.currency),this.vatEl.textContent=Be(this.configuration.vatDisplay)}renderButton(){const t=this.configuration.submitEnabled;this.button.element.classList.toggle("vd-hidden",!t),t&&this.state==="idle"&&this.setButtonText(Be(this.configuration.buttonLabel))}async handleSubmit(){if(this.state!=="busy"){this.setState("busy",_o());try{await this.configuration.submit(),this.setState("success",Ro())}catch{this.setState("failed",Bo())}this.scheduleReset()}}scheduleReset(){this.resetTimer!==void 0&&clearTimeout(this.resetTimer),this.resetTimer=setTimeout(()=>{this.state="idle",this.update()},this.resetMs)}setState(t,e){this.state=t,this.element.dataset.submit=t,this.button.element.disabled=t==="busy",this.setButtonText(e)}setButtonText(t){this.button.element.textContent=t,this.button.element.setAttribute("aria-label",t)}}function Be(n){return(n??"").slice(0,dr)}function gr(n,t){try{const e=new Intl.NumberFormat(B(),{style:"currency",currency:t}),i=e.resolvedOptions().maximumFractionDigits??2;return e.format(n/10**i)}catch{return`${t} ${(n/100).toFixed(2)}`}}class Pe{slot=null;panel=null;attach(t,e){this.panel=e,e.style.display="none",this.slot=document.createElement("div"),this.slot.className="vd-slot-bottom-left",this.slot.appendChild(e),t.appendChild(this.slot)}setVisible(t){this.panel!==null&&(this.panel.style.display=t?"flex":"none")}destroy(){this.slot?.remove(),this.slot=null,this.panel=null}}const mr=572;class pr{element=null;body=null;openButton=null;closeButton=null;container=null;observer=null;collapsible=!1;expanded=!0;visible=!1;attach(t,e){this.container=t,e.classList.add("vd-attributes-sidebar"),this.closeButton=new F({variant:"ghost",size:"icon-sm",label:Hi(),icon:z.close({size:18}),onClick:()=>{this.expanded=!1,this.render()}});const i=document.createElement("div");i.className="vd-sidebar-header",i.appendChild(this.closeButton.element),this.body=document.createElement("div"),this.body.className="vd-sidebar-body",this.body.appendChild(e),this.element=document.createElement("div"),this.element.className="vd-sidebar vd-hidden",this.element.append(i,this.body),t.appendChild(this.element),this.openButton=new F({variant:"outline",size:"default",label:$i(),icon:z.configurator({size:18}),onClick:()=>{this.expanded=!0,this.render()}}),this.openButton.element.classList.add("vd-configurator-toggle","vd-hidden"),t.appendChild(this.openButton.element),this.observe()}setVisible(t){this.visible=t,this.render()}destroy(){this.observer?.disconnect(),this.observer=null,this.openButton?.element.remove(),this.element?.remove(),this.container?.classList.remove("vd-layout-sidebar-right","vd-layout-sidebar-collapsed"),this.container=null}observe(){typeof ResizeObserver>"u"||this.container===null||(this.observer=new ResizeObserver(t=>{const e=t[0]?.contentRect.width??0;this.setCollapsible(e>0&&e<mr)}),this.observer.observe(this.container))}setCollapsible(t){t!==this.collapsible&&(this.collapsible=t,this.expanded=!t,this.render())}render(){if(this.element===null||this.openButton===null||this.closeButton===null||this.container===null)return;const t=this.visible&&this.expanded,e=this.visible&&!this.expanded;this.element.classList.toggle("vd-hidden",!this.visible),this.element.classList.toggle("vd-sidebar-collapsed",e),this.openButton.element.classList.toggle("vd-hidden",!e),this.closeButton.element.style.display=this.collapsible?"":"none",this.container.classList.toggle("vd-layout-sidebar-right",t),this.container.classList.toggle("vd-layout-sidebar-collapsed",e)}}class br{attach(t,e){}setVisible(t){}destroy(){}}const vr={"inframe-bottom-left":()=>new Pe,"sidebar-right":()=>new pr,hidden:()=>new br};function yr(n){return(vr[n??""]??(()=>new Pe))()}const wt=U.fontFamily.sans.join(", "),Ct=`
|
|
291
|
+
`;let Te=!1;function Re(){if(Te||typeof document>"u")return;Te=!0;const n=document.createElement("style");n.id="vd-ui-vanilla",n.textContent=Jo,document.head.appendChild(n)}const Zo=U.fontFamily.sans.join(", ");class Wo{qrLib=null;dialog=null;qrSlot=null;show(){this.hide(),Re(),this.dialog=new Ko({onClose:()=>{this.dialog=null,this.qrSlot=null}}),Object.assign(this.dialog.card.element.style,{display:"flex",flexDirection:"column",alignItems:"center",gap:E[3],fontFamily:Zo}),this.dialog.card.element.appendChild(this.createText(ui(),{fontSize:U.fontSize.base,fontWeight:U.fontWeight.semibold,color:L.neutral[900]})),this.dialog.card.element.appendChild(this.createText(gi(),{fontSize:U.fontSize.sm,color:L.neutral[600]})),this.qrSlot=this.createQrSlot(),this.dialog.card.element.appendChild(this.qrSlot),this.dialog.card.element.appendChild(this.createText(vi(),{fontSize:U.fontSize.xs,color:L.neutral[500]}));const t=new F({variant:"outline",label:Si(),onClick:()=>{this.hide()}});this.dialog.card.element.appendChild(t.element),this.dialog.open()}async update(t){this.qrLib??=await Promise.resolve().then(()=>os);const e=await this.qrLib.toDataURL(t,{width:256,margin:4,errorCorrectionLevel:"M",color:{dark:L.black,light:L.white}});return this.qrSlot===null?!1:(this.qrSlot.classList.remove("ui-qr-slot--loading"),this.qrSlot.replaceChildren(this.createQrImage(e)),!0)}hide(){this.dialog?.close(),this.dialog=null,this.qrSlot=null}createText(t,e){const i=document.createElement("p");return i.textContent=t,Object.assign(i.style,{margin:"0",textAlign:"center",...e}),i}createQrSlot(){const t=document.createElement("div");return t.className="ui-qr-slot ui-qr-slot--loading",t}createQrImage(t){const e=document.createElement("img");return e.src=t,e.alt="QR code",e}}function Ie(n){const t=Math.max(0,Math.min(1,n));return t*t*(3-2*t)}function Xo(n,t,e,i,o,r){const[s,a,l]=n,c=Math.cos(t),u=Math.sin(t),h=c*s+u*l,f=-u*s+c*l,d=Math.cos(e),p=Math.sin(e),k=d*a-p*f,P=p*a+d*f,S=.55;return[i+h*r*S,o-k*r*S,P]}function tr(n,t,e){n.beginPath(),n.moveTo(t[0],t[1]),n.lineTo(e[0],e[1]),n.strokeStyle="#000",n.lineWidth=2,n.stroke()}function er(n,t,e,i,o){const r=t(e),s=t(i),a=[r[0]+(s[0]-r[0])*o,r[1]+(s[1]-r[1])*o,r[2]];tr(n,r,a)}const dt=[-1,-1,1],ht=[1,-1,1],ft=[1,-1,-1],gt=[-1,-1,-1],mt=[-1,1,1],pt=[1,1,1],bt=[1,1,-1],vt=[-1,1,-1],Ne=[[dt,ht],[ht,ft],[ft,gt],[gt,dt],[dt,mt],[ht,pt],[ft,bt],[gt,vt],[mt,pt],[pt,bt],[bt,vt],[vt,mt]],nr=400,Me='-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif';function ir(){const n=document.createElement("div");Object.assign(n.style,{position:"absolute",inset:"0",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",background:"#fff",zIndex:"20",opacity:"0",transition:"opacity 0.3s ease-in-out"});const t=document.createElement("canvas");Object.assign(t.style,{width:"100%",height:"100%",position:"absolute",inset:"0"});const e=document.createElement("div");Object.assign(e.style,{position:"absolute",top:"56%",left:"0",right:"0",textAlign:"center",pointerEvents:"none"});const i=document.createElement("span");Object.assign(i.style,{fontSize:"13px",fontWeight:"400",color:"#000",fontVariantNumeric:"tabular-nums",fontFamily:Me});const o=document.createElement("span");return Object.assign(o.style,{fontSize:"13px",color:"#000",fontFamily:Me}),o.textContent=Ee(),e.appendChild(i),e.appendChild(o),n.appendChild(t),n.appendChild(e),{overlay:n,canvas:t,pctEl:i,phaseEl:o}}class or{overlay;canvas;ctx;pctEl;phaseEl;animationId=null;showTimerId=null;startTime;hidden=!1;visible=!1;constructor(t,e={}){this.startTime=performance.now();const i=ir();this.overlay=i.overlay,this.canvas=i.canvas,this.pctEl=i.pctEl,this.phaseEl=i.phaseEl,t.appendChild(this.overlay),this.ctx=this.canvas.getContext("2d"),this.ctx!==null&&(this.sizeCanvas(),this.tick());const o=e.showDelay??nr;this.showTimerId=setTimeout(()=>{this.reveal()},o)}get loadingTexts(){return{downloading:Ee(),rendering:Pi()}}updateProgress(t,e){this.hidden||(this.pctEl.textContent=`${Math.round(t)}%`,this.phaseEl.textContent=e!==""?` · ${e}`:"")}showError(t){if(this.hidden=!1,this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null),this.ctx!==null){const e=Math.min(devicePixelRatio,2),i=this.canvas.width/e,o=this.canvas.height/e;this.ctx.fillStyle="#fff",this.ctx.fillRect(0,0,i*e,o*e)}this.pctEl.textContent="",this.phaseEl.textContent=t,this.phaseEl.style.color="#b91c1c",this.reveal()}hide(){if(!this.hidden){if(this.hidden=!0,this.cancelShowTimer(),!this.visible){this.destroy();return}this.overlay.style.opacity="0",this.overlay.addEventListener("transitionend",()=>{this.destroy()},{once:!0}),setTimeout(()=>{this.destroy()},500)}}destroy(){this.cancelShowTimer(),this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null),this.overlay.remove()}reveal(){this.hidden||this.visible||(this.visible=!0,this.overlay.style.opacity="1")}cancelShowTimer(){this.showTimerId!==null&&(clearTimeout(this.showTimerId),this.showTimerId=null)}sizeCanvas(){if(this.ctx===null)return;const t=Math.min(devicePixelRatio,2),e=this.overlay.clientWidth||440,i=this.overlay.clientHeight||360;this.canvas.width=e*t,this.canvas.height=i*t,this.ctx.scale(t,t),this.ctx.lineCap="round",this.ctx.lineJoin="round"}tick=()=>{this.hidden||(this.drawFrame(),this.animationId=requestAnimationFrame(this.tick))};drawFrame(){if(this.ctx===null)return;const t=this.canvas.width/Math.min(devicePixelRatio,2),e=this.canvas.height/Math.min(devicePixelRatio,2),i=(performance.now()-this.startTime)/1e3;this.ctx.fillStyle="#fff",this.ctx.fillRect(0,0,t,e);const o=t/2,r=e*.44,s=Math.min(t,e)*.08,a=.785,l=.615,c=p=>Xo(p,a,l,o,r,s),u=6,h=i%u/u,f=Ne.length;let d;h<.35?d=Ie(h/.35)*f:h<.55?d=f:h<.9?d=(1-Ie((h-.55)/.35))*f:d=0,this.ctx.shadowBlur=5,this.ctx.shadowColor="rgba(30,30,30,0.08)";for(let p=0;p<f&&!(p>=d);p++){const k=Ne[p];if(k===void 0)continue;const P=Math.min(1,d-p);er(this.ctx,c,k[0],k[1],P)}this.ctx.shadowBlur=0}}class rr{constructor(t){this.options=t,this.element=document.createElement("div"),Object.assign(this.element.style,{display:"flex",gap:"0.375rem"}),this.onFullscreenChange=()=>{this.setFullscreenIcon(document.fullscreenElement!==null)},document.addEventListener("fullscreenchange",this.onFullscreenChange)}options;element;arBtn=null;fullscreenBtn=null;onFullscreenChange;setFullscreenIcon(t){this.fullscreenBtn!==null&&this.fullscreenBtn.setIcon(t?z.exitFullscreen():z.fullscreen())}syncButton(t,e,i){if(e&&t===null){const o=i();return this.element.appendChild(o.element),o}return!e&&t!==null?(t.element.remove(),null):t}applySettings(t){this.arBtn=this.syncButton(this.arBtn,t.ar!==!1&&this.options.onAr!==void 0,()=>new F({variant:"outline",size:"icon",label:si(),icon:z.ar(),onClick:()=>{this.options.onAr?.()}})),this.fullscreenBtn=this.syncButton(this.fullscreenBtn,t.fullscreen!==!1&&this.options.onFullscreen!==void 0,()=>new F({variant:"outline",size:"icon",label:ki(),icon:z.fullscreen(),onClick:()=>{this.options.onFullscreen?.()}}))}destroy(){document.removeEventListener("fullscreenchange",this.onFullscreenChange)}}const Z=.5;class st{element;constructor(t,e){this.element=Object.assign(document.createElement("div"),{className:"vd-camera-controls"});const i={targetRotation:e.rotation,targetTilt:e.tilt,targetZoom:e.zoom,thetaOffset:0},o=sr(t,e,i);e.onChange(r=>{i.targetRotation=r.rotation-i.thetaOffset,i.targetTilt=r.tilt,i.targetZoom=r.zoom,ar(o,e,r)}),this.element.appendChild(st.buildZoom(o.zoomOut,o.zoomIn)),this.element.appendChild(st.buildDpad(o.tiltUp,o.rotateLeft,o.reset,o.rotateRight,o.tiltDown))}static buildZoom(t,e){const i=document.createElement("div");return i.className="vd-zoom",i.appendChild(t.element),i.appendChild(e.element),i}static buildDpad(t,e,i,o,r){const s=document.createElement("div");s.className="vd-dpad";for(const[a,l]of[[t,"up"],[e,"left"],[i,"center"],[o,"right"],[r,"down"]])a.element.classList.add(`vd-dpad-${l}`),s.appendChild(a.element);return s}}function sr(n,t,e){const i=s=>Math.max(t.limits?.minZoom??1,Math.min(t.limits?.maxZoom??1/0,s)),o=s=>{const a=t.limits?.minRotate,l=t.limits?.maxRotate;return a!==void 0||l!==void 0?Math.max(a??-1/0,Math.min(l??1/0,s)):s},r=s=>{const a=t.limits?.minTilt,l=t.limits?.maxTilt;if(a!==void 0||l!==void 0){e.targetTilt=Math.max(a??0,Math.min(l??180,e.targetTilt+s)),n.tilt(e.targetTilt).set();return}const c=e.targetTilt+s;c>180||c<0?(e.targetTilt=c>180?360-c:-c,e.thetaOffset=(e.thetaOffset+180)%360,n.tilt(e.targetTilt).rotate(e.targetRotation+e.thetaOffset).set()):(e.targetTilt=c,n.tilt(e.targetTilt).set())};return{zoomOut:new F({variant:"outline",size:"icon",label:io(),icon:z.zoomOut(),onClick:()=>{e.targetZoom=i(e.targetZoom-10),n.zoom(e.targetZoom).set()}}),zoomIn:new F({variant:"outline",size:"icon",label:Xi(),icon:z.zoomIn(),onClick:()=>{e.targetZoom=i(e.targetZoom+10),n.zoom(e.targetZoom).set()}}),tiltUp:new F({variant:"outline",size:"icon",label:po(),icon:z.tiltUp(),onClick:()=>{r(-15)}}),rotateLeft:new F({variant:"outline",size:"icon",label:ao(),icon:z.rotateLeft(),onClick:()=>{e.targetRotation=o(e.targetRotation-15),n.rotate(e.targetRotation+e.thetaOffset).set()}}),reset:new F({variant:"outline",size:"icon",label:Qi(),icon:z.reset(),onClick:()=>{e.thetaOffset=0,n.reset()}}),rotateRight:new F({variant:"outline",size:"icon",label:ho(),icon:z.rotateRight(),onClick:()=>{e.targetRotation=o(e.targetRotation+15),n.rotate(e.targetRotation+e.thetaOffset).set()}}),tiltDown:new F({variant:"outline",size:"icon",label:wo(),icon:z.tiltDown(),onClick:()=>{r(15)}})}}function ar(n,t,e){const i=t.limits;i!==void 0&&(n.zoomOut.element.disabled=i.minZoom!==void 0&&e.zoom<=i.minZoom+Z,n.zoomIn.element.disabled=i.maxZoom!==void 0&&e.zoom>=i.maxZoom-Z,n.tiltUp.element.disabled=i.minTilt!==void 0&&e.tilt<=i.minTilt+Z,n.tiltDown.element.disabled=i.maxTilt!==void 0&&e.tilt>=i.maxTilt-Z,n.rotateLeft.element.disabled=i.minRotate!==void 0&&e.rotation<=i.minRotate+Z,n.rotateRight.element.disabled=i.maxRotate!==void 0&&e.rotation>=i.maxRotate-Z)}const W={SELECT:"ui:select",SELECTED:"ui:selected",FOCUS_CHANGE:"vd:focus-change",CONFIGURATION_CHANGE:"vd:configuration-change",CONFIGURATION_SUBMIT:"vd:configuration-submit"},lr=5;let cr=0;function yt(n){const t=n.replace(/([A-Z])/g," $1").trim();return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function ur(n,t,e,i,o){const r=document.createElement("div");r.className="vd-attribute",r.dataset.name=n.name;const s=document.createElement("span");s.className="vd-attribute-label",s.textContent=yt(n.name),s.id=`vd-attribute-label-${cr++}`,r.appendChild(s),r.setAttribute("role","group"),r.setAttribute("aria-labelledby",s.id);const a=n.values.find(u=>t.getValue(n.name,u)?.isSelected===!0),l=n.values.map(yt),c=n.values.length<=lr?new Yo(n.values,a,l):new Qo(n.name,n.values,yt(n.name),a,l);return c.onSelect(u=>{e.dispatch(W.SELECT,{attribute:n.name,value:u},!0).defaultPrevented||i(n.name,u)}),o(n.name,u=>{c.setSelected(u.value),e.dispatch(W.SELECTED,{attribute:n.name,value:u.value})}),r.appendChild(c.element),r}const dr=80,hr=2500;class fr{constructor(t,e=hr){this.configuration=t,this.resetMs=e,this.element=document.createElement("div"),this.element.className="vd-commerce vd-hidden";const i=document.createElement("div");i.className="vd-commerce-price",this.priceEl=document.createElement("span"),this.priceEl.className="vd-price",this.vatEl=document.createElement("span"),this.vatEl.className="vd-vat",i.append(this.priceEl,this.vatEl),this.button=new F({variant:"default",onClick:()=>{this.handleSubmit()}}),this.button.element.classList.add("vd-cta","vd-hidden"),this.element.append(i,this.button.element),this.unsubscribe=this.configuration.onRender(()=>{this.update()}),this.update()}configuration;resetMs;element;priceEl;vatEl;button;unsubscribe;state="idle";resetTimer;update(){this.renderPrice(this.configuration.current),this.renderButton();const t=this.configuration.current!==void 0||this.configuration.submitEnabled;this.element.classList.toggle("vd-hidden",!t)}destroy(){this.unsubscribe(),this.resetTimer!==void 0&&clearTimeout(this.resetTimer),this.element.remove()}renderPrice(t){if(t===void 0){this.priceEl.textContent="",this.vatEl.textContent="";return}this.priceEl.textContent=gr(t.price,t.currency),this.vatEl.textContent=Be(this.configuration.vatDisplay)}renderButton(){const t=this.configuration.submitEnabled;this.button.element.classList.toggle("vd-hidden",!t),t&&this.state==="idle"&&this.setButtonText(Be(this.configuration.buttonLabel))}async handleSubmit(){if(this.state!=="busy"){this.setState("busy",_o());try{await this.configuration.submit(),this.setState("success",Ro())}catch{this.setState("failed",Bo())}this.scheduleReset()}}scheduleReset(){this.resetTimer!==void 0&&clearTimeout(this.resetTimer),this.resetTimer=setTimeout(()=>{this.state="idle",this.update()},this.resetMs)}setState(t,e){this.state=t,this.element.dataset.submit=t,this.button.element.disabled=t==="busy",this.setButtonText(e)}setButtonText(t){this.button.element.textContent=t,this.button.element.setAttribute("aria-label",t)}}function Be(n){return(n??"").slice(0,dr)}function gr(n,t){try{const e=new Intl.NumberFormat(B(),{style:"currency",currency:t}),i=e.resolvedOptions().maximumFractionDigits??2;return e.format(n/10**i)}catch{return`${t} ${(n/100).toFixed(2)}`}}class Pe{slot=null;panel=null;attach(t,e){this.panel=e,e.style.display="none",this.slot=document.createElement("div"),this.slot.className="vd-slot-bottom-left",this.slot.appendChild(e),t.appendChild(this.slot)}setVisible(t){this.panel!==null&&(this.panel.style.display=t?"flex":"none")}destroy(){this.slot?.remove(),this.slot=null,this.panel=null}}const mr=572;class pr{element=null;body=null;openButton=null;closeButton=null;container=null;observer=null;collapsible=!1;expanded=!0;visible=!1;attach(t,e){this.container=t,e.classList.add("vd-attributes-sidebar"),this.closeButton=new F({variant:"ghost",size:"icon-sm",label:Hi(),icon:z.close({size:18}),onClick:()=>{this.expanded=!1,this.render()}});const i=document.createElement("div");i.className="vd-sidebar-header",i.appendChild(this.closeButton.element),this.body=document.createElement("div"),this.body.className="vd-sidebar-body",this.body.appendChild(e),this.element=document.createElement("div"),this.element.className="vd-sidebar vd-hidden",this.element.append(i,this.body),t.appendChild(this.element),this.openButton=new F({variant:"outline",size:"default",label:$i(),icon:z.configurator({size:18}),onClick:()=>{this.expanded=!0,this.render()}}),this.openButton.element.classList.add("vd-configurator-toggle","vd-hidden"),t.appendChild(this.openButton.element),this.observe()}setVisible(t){this.visible=t,this.render()}destroy(){this.observer?.disconnect(),this.observer=null,this.openButton?.element.remove(),this.element?.remove(),this.container?.classList.remove("vd-layout-sidebar-right","vd-layout-sidebar-collapsed","vd-layout-sidebar-permanent"),this.container=null}observe(){typeof ResizeObserver>"u"||this.container===null||(this.observer=new ResizeObserver(t=>{const e=t[0]?.contentRect.width??0;this.setCollapsible(e>0&&e<mr)}),this.observer.observe(this.container))}setCollapsible(t){t!==this.collapsible&&(this.collapsible=t,this.expanded=!t,this.render())}render(){if(this.element===null||this.openButton===null||this.closeButton===null||this.container===null)return;const t=this.visible&&this.expanded,e=this.visible&&!this.expanded;this.element.classList.toggle("vd-hidden",!this.visible),this.element.classList.toggle("vd-sidebar-collapsed",e),this.openButton.element.classList.toggle("vd-hidden",!e),this.closeButton.element.style.display=this.collapsible?"":"none",this.container.classList.toggle("vd-layout-sidebar-right",t),this.container.classList.toggle("vd-layout-sidebar-collapsed",e),this.container.classList.toggle("vd-layout-sidebar-permanent",t&&!this.collapsible)}}class br{attach(t,e){}setVisible(t){}destroy(){}}const vr={"inframe-bottom-left":()=>new Pe,"sidebar-right":()=>new pr,hidden:()=>new br};function yr(n){return(vr[n??""]??(()=>new Pe))()}const wt=U.fontFamily.sans.join(", "),Ct=`
|
|
292
292
|
position: absolute;
|
|
293
293
|
display: flex;
|
|
294
294
|
z-index: 10;
|
|
@@ -387,6 +387,21 @@
|
|
|
387
387
|
/* sidebar-right layout — a docked, full-height right panel */
|
|
388
388
|
.vd-container { --vd-sidebar-width: 300px; }
|
|
389
389
|
|
|
390
|
+
.vd-container > iframe {
|
|
391
|
+
width: 100%;
|
|
392
|
+
height: 100%;
|
|
393
|
+
border: none;
|
|
394
|
+
display: block;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/* Permanently docked panel (wide embeds, not collapsible): the viewer fills the
|
|
398
|
+
remaining width instead of the panel floating over it. On narrow embeds the
|
|
399
|
+
panel is a temporary tap-to-reveal overlay instead (vd-layout-sidebar-right
|
|
400
|
+
without -permanent), where covering part of the model briefly is expected. */
|
|
401
|
+
.vd-container.vd-layout-sidebar-permanent > iframe {
|
|
402
|
+
width: calc(100% - var(--vd-sidebar-width));
|
|
403
|
+
}
|
|
404
|
+
|
|
390
405
|
.vd-hidden { display: none !important; }
|
|
391
406
|
|
|
392
407
|
.vd-sidebar {
|
|
@@ -490,7 +505,7 @@
|
|
|
490
505
|
color: ${L.white};
|
|
491
506
|
}
|
|
492
507
|
|
|
493
|
-
`;function Cr(){if(Re(),document.getElementById("vd-styles")!==null)return;const n=document.createElement("style");n.id="vd-styles",n.textContent=wr,document.head.appendChild(n)}function Sr(n,t){const e=document.createElement("a");e.href=`data:image/png;base64,${n}`,e.download=t,e.click()}class Er{options;settings={};container=null;loading=null;slots={topRight:null,bottomRight:null};screenshotBtn=null;actionBar=null;cameraControls=null;attributes=null;layout=null;commerce=null;constructor(t){this.options=t}attach(t){Cr(),this.container=t,this.loading=new or(t),this.slots.topRight=this.createSlot(t,"vd-slot-top-right"),this.slots.bottomRight=this.createSlot(t,"vd-slot-bottom-right")}onReady(){this.loading?.hide(),this.loading=null,this.mountToolbar(),this.cameraControls!==null&&(this.cameraControls.element.style.display="flex"),this.layout?.setVisible(!0)}mountToolbar(){if(this.actionBar!==null||this.slots.bottomRight===null||this.container===null)return;const t=typeof this.container.requestFullscreen=="function";this.actionBar=new rr({onAr:this.options.onAr,onFullscreen:t?()=>{this.toggleFullscreen()}:void 0}),this.actionBar.applySettings(this.settings),this.slots.bottomRight.appendChild(this.actionBar.element),this.syncScreenshotButton(),this.placeScreenshotButton()}toggleFullscreen(){this.container!==null&&(document.fullscreenElement!==null?document.exitFullscreen():(this.options.onFullscreenEnter?.(),this.container.requestFullscreen()))}updateProgress(t,e){this.loading?.updateProgress(t,e)}showError(t){this.loading?.showError(t)}applyViewerSettings(t){this.settings=t,t.language!==void 0&&we(t.language,{reload:!1}),this.syncScreenshotButton(),this.actionBar?.applySettings(t),this.cameraControls!==null&&(this.cameraControls.element.style.display=t.cameraControls===!0?"flex":"none"),this.placeScreenshotButton()}renderAttributeControls(t,e){if(!(this.container===null||this.slots.topRight===null)&&(this.cameraControls?.element.remove(),this.cameraControls=null,this.teardownConfigurator(),this.settings.cameraControls===!0&&(this.cameraControls=new st(this.options.cameraApi,this.options.cameraPositionApi),this.cameraControls.element.style.display="none",this.slots.topRight.appendChild(this.cameraControls.element)),this.placeScreenshotButton(),e.length!==0)){this.attributes=document.createElement("div"),this.attributes.className="vd-attributes";for(const i of e)this.attributes.appendChild(ur(i,t,this.options.eventBus,this.options.onSelect,this.options.onSubscribe));this.commerce=new fr(this.options.configuration),this.attributes.appendChild(this.commerce.element),this.layout=yr(this.settings.configuratorLayout),this.layout.attach(this.container,this.attributes)}}get viewerSettings(){return this.settings}teardownConfigurator(){this.commerce?.destroy(),this.commerce=null,this.attributes?.remove(),this.attributes=null,this.layout?.destroy(),this.layout=null}destroy(){this.loading?.destroy(),this.screenshotBtn?.element.remove(),this.actionBar?.destroy(),this.actionBar?.element.remove(),this.cameraControls?.element.remove(),this.teardownConfigurator();for(const t of Object.values(this.slots))t?.remove();this.container=null}createSlot(t,e){const i=document.createElement("div");return i.className=e,t.appendChild(i),i}syncScreenshotButton(){const t=this.settings.screenshot===!0;t&&this.screenshotBtn===null&&(this.screenshotBtn=new F({variant:"outline",size:"icon",label:zi(),icon:z.screenshot(),onClick:()=>{this.options.snapshotApi.take("snapshot.png").onDeveloped(({data:e,filename:i})=>{Sr(e,i)})}})),!t&&this.screenshotBtn!==null&&(this.screenshotBtn.element.remove(),this.screenshotBtn=null)}placeScreenshotButton(){this.screenshotBtn===null||this.slots.topRight===null||(this.cameraControls!==null?this.cameraControls.element.appendChild(this.screenshotBtn.element):this.slots.topRight.appendChild(this.screenshotBtn.element))}}const _r={};class Ar{defaultServer="https://server.virtualdisplay.io";options;serverHost;constructor(t,e){this.options=t,this.serverHost=e}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.session!==void 0&&e.searchParams.set("session",this.options.session),this.options.debug===!0&&e.searchParams.set("debug","true"),this.options.traceparent!==void 0&&e.searchParams.set("traceparent",this.options.traceparent),e.toString()}getServerUrl(){if(this.serverHost!==void 0)return this.serverHost;if(_r?.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 x.parentNotFound(this.options.parent);return t}}function kr(n){const{messenger:t}=n;t.on(N.HANDSHAKE,e=>{Cn(e)&&(M.logger.info("Server handshake received, flushing publisher queue"),t.markReady())}),t.on(N.SESSION,e=>{Sn(e)&&n.onSession(e.sessionId)}),t.on(N.MUTATION,e=>{En(e)&&(n.attributes.handleMutationResult(e),n.configuration.handleSelectionChanged(n.attributes.getSelection()))}),t.on(N.SNAPSHOT,e=>{_n(e)&&n.snapshot.handleSnapshotResult(e)}),t.on(N.CAMERA,e=>{An(e)&&n.cameraPosition.handlePositionUpdate(e)}),t.on(N.LOADING_INDICATOR,e=>{Tn(e)&&(e.error!==void 0?n.ui.showError(e.error):n.ui.updateProgress(e.progress,e.phase))}),t.on(N.CONFIG,e=>{In(e)&&n.applyConfig(e)}),t.on(N.MAPPING,e=>{kn(e)&&(n.attributes.handleMappingReceived(e),n.configuration.handleSelectionChanged(n.attributes.getSelection()),n.ui.renderAttributeControls(n.attributes,e.attributes),n.readyStateTracker.handleMappingReceived())}),Tr(n)}function Tr(n){const{messenger:t}=n;t.on(N.FOCUS,e=>{Nn(e)&&n.focus.handleStateReceived(e)}),t.on(N.PRICING,e=>{Mn(e)&&n.configuration.handlePricingReceived(e.pricing)}),t.on(N.SYNC,e=>{Rn(e)&&n.onSync(e.connected)})}class Rr{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}}class Ir{attributes;readyStateTracker;messenger;cameraApi;cameraPositionApi;focusApi;configurationApi;snapshotApi;annotationsApi;eventBus;ui;options;serverHost;arActivation;syncTracker;iframe;container;readyCallbacks=[];mutationFailedCallbacks=[];viewerSessionId;constructor(t,e){this.options=t,this.serverHost=e?.serverHost,this.initializeLogging(),this.messenger=new Bn(()=>this.iframe?.contentWindow??null,e?.messengerOptions);const i=r=>{this.messenger.send(r)};this.attributes=new Gn(i,(r,s)=>{this.notifyMutationFailed(r,s)}),this.snapshotApi=new fe(i),this.annotationsApi=new Wt(i),this.cameraApi=new ae(i),this.cameraPositionApi=new Kn,this.focusApi=new ue(i,r=>{this.dispatchFocusChange(r)}),this.configurationApi=new ce(r=>{this.dispatchConfigurationChange(r)},r=>{this.dispatchConfigurationSubmit(r)}),this.eventBus=new Jn,this.arActivation=e?.createArActivation?.(i),this.syncTracker=e?.createSyncTracker?.(),this.readyStateTracker=new Rr(()=>{this.notifyReady()});const o=this.arActivation;this.ui=new Er({snapshotApi:this.snapshotApi,cameraApi:this.cameraApi,cameraPositionApi:this.cameraPositionApi,eventBus:this.eventBus,configuration:this.configurationApi,onSelect:(r,s)=>this.attributes.select(r,s),onSubscribe:(r,s)=>this.attributes.onChange(r,s),...o!==void 0&&{onAr:()=>{o.activate()}},onFullscreenEnter:()=>{this.trackFullscreen()}}),this.wireIncomingMessages(),e?.registerHandlers?.(this.messenger,i),this.messenger.start(),this.createAndConnectIframe()}wireIncomingMessages(){kr({messenger:this.messenger,attributes:this.attributes,configuration:this.configurationApi,snapshot:this.snapshotApi,cameraPosition:this.cameraPositionApi,focus:this.focusApi,ui:this.ui,readyStateTracker:this.readyStateTracker,applyConfig:t=>{this.handleConfig(t)},onSession:t=>{this.handleSession(t)},onSync:t=>{this.syncTracker?.handleSync(t)}})}handleSession(t){this.viewerSessionId=t,this.arActivation?.onSession(t)}notifyMutationFailed(t,e){for(const i of this.mutationFailedCallbacks)i({attribute:t,value:e})}notifyReady(){const t=this.readyCallbacks;this.readyCallbacks=[];for(const e of t)e(this);this.ui.onReady()}dispatchFocusChange(t){this.container?.dispatchEvent(new CustomEvent(W.FOCUS_CHANGE,{detail:t,bubbles:!0}))}dispatchConfigurationChange(t){this.container?.dispatchEvent(new CustomEvent(W.CONFIGURATION_CHANGE,{detail:t??null,bubbles:!0}))}dispatchConfigurationSubmit(t){this.container?.dispatchEvent(new CustomEvent(W.CONFIGURATION_SUBMIT,{detail:t,bubbles:!0}))}handleConfig(t){const e=t.viewerSettings,i=this.options.viewerSettings;if(e!==void 0||i!==void 0){const o=i!==void 0?{...e??{},...i}:e;if(i!==void 0&&e!==void 0){const r=Object.entries(i).filter(([s,a])=>e[s]!==a).map(([s,a])=>`${s} (metadata: ${e[s]??"undefined"}, override: ${a})`);r.length>0&&M.logger.warn(`Viewer settings override active: ${r.join(", ")}`)}this.ui.applyViewerSettings(o),this.annotationsApi.setEnabled(o.annotations!==!1)}this.cameraPositionApi.applyLimits(t.cameraLimits)}trackFullscreen(){this.messenger.send({type:N.FULLSCREEN})}initializeLogging(){this.options.debug===!0&&se(),M.logger.info("Initializing Virtualdisplay client",{model:this.options.model})}createAndConnectIframe(){const e=new Ar(this.options,this.serverHost).create();this.container=e.container,this.iframe=e.iframe,this.eventBus.attach(this.container),this.ui.attach(this.container);try{const i=new URL(this.iframe.src).origin;this.messenger.setTargetOrigin(i)}catch{}}select(t,e){this.attributes.select(t,e)}getValues(t){return this.attributes.getValues(t)}getValue(t,e){return this.attributes.getValue(t,e)}onChange(t,e){this.attributes.onChange(t,e)}getAttribute(t){return this.attributes.getAttribute(t)}get isReady(){return this.readyStateTracker.isReady}onReady(t){if(this.readyStateTracker.isReady){t(this);return}this.readyCallbacks.push(t)}onMutationFailed(t){this.mutationFailedCallbacks.push(t)}activateAr(){this.arActivation?.activate()}on(t,e){this.eventBus.on(t,e)}get annotations(){return this.annotationsApi}get camera(){return this.cameraApi}get focus(){return this.focusApi}get configuration(){return this.configurationApi}get cameraPosition(){return this.cameraPositionApi}get snapshot(){return this.snapshotApi}get sessionId(){return this.viewerSessionId}get viewerSettings(){return this.ui.viewerSettings}destroy(){this.readyStateTracker.clear(),this.readyCallbacks=[],this.mutationFailedCallbacks.length=0,this.snapshotApi.clear(),this.messenger.destroy(),this.arActivation?.destroy(),this.ui.destroy(),this.container?.parentElement!==null&&this.container?.parentElement!==void 0&&this.container.parentElement.removeChild(this.container),this.container=void 0,this.iframe=void 0}}const Nr="ar.virtualdisplay.io";function Mr(n){const t=new URL(`https://${Nr}/go`);return n.sessionId!==void 0?t.searchParams.set("session",n.sessionId):(t.searchParams.set("license",n.license),t.searchParams.set("model",n.model)),t.toString()}const Br=1500;class Pr{options;qrModal=new Wo;sessionId;waiters=[];pendingTimers=new Set;destroyed=!1;constructor(t){this.options=t}onSession(t){this.sessionId=t;const e=this.waiters;this.waiters=[];for(const i of e)i(t)}activate(){if(Vn()){this.options.send({type:N.AR_ACTIVATE});return}this.showQrCode()}destroy(){this.destroyed=!0;for(const t of this.pendingTimers)clearTimeout(t);this.pendingTimers.clear(),this.waiters=[],this.qrModal.hide()}async showQrCode(){this.qrModal.show();const t=await this.waitForSessionId();if(this.destroyed)return;const e=Mr({sessionId:t,license:this.options.license,model:this.options.model}),i=await this.qrModal.update(e);if(this.destroyed){this.qrModal.hide();return}i&&this.options.send({type:N.QR_SHOWN})}waitForSessionId(){return this.sessionId!==void 0?Promise.resolve(this.sessionId):new Promise(t=>{const e=setTimeout(()=>{this.pendingTimers.delete(e),t(void 0)},Br);this.pendingTimers.add(e),this.waiters.push(i=>{this.pendingTimers.delete(e),clearTimeout(e),t(i)})})}}class Lr{callbacks=[];lastKnown;handleSync(t){this.lastKnown=t;for(const e of this.callbacks)e(t)}onChange(t){this.callbacks.push(t),this.lastKnown!==void 0&&t(this.lastKnown)}}class Or extends Ir{syncStatusTracker;constructor(t){const e=new Lr;super(t,{createArActivation:i=>new Pr({license:t.license,model:t.model,send:i}),createSyncTracker:()=>e}),this.syncStatusTracker=e}onSyncChange(t){this.syncStatusTracker.onChange(t)}}function xr(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var X={},St,Le;function zr(){return Le||(Le=1,St=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),St}var Et={},G={},Oe;function Y(){if(Oe)return G;Oe=1;let n;const t=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return G.getSymbolSize=function(i){if(!i)throw new Error('"version" cannot be null or undefined');if(i<1||i>40)throw new Error('"version" should be in range from 1 to 40');return i*4+17},G.getSymbolTotalCodewords=function(i){return t[i]},G.getBCHDigit=function(e){let i=0;for(;e!==0;)i++,e>>>=1;return i},G.setToSJISFunction=function(i){if(typeof i!="function")throw new Error('"toSJISFunc" is not a valid function.');n=i},G.isKanjiModeEnabled=function(){return typeof n<"u"},G.toSJIS=function(i){return n(i)},G}var _t={},xe;function At(){return xe||(xe=1,(function(n){n.L={bit:1},n.M={bit:0},n.Q={bit:3},n.H={bit:2};function t(e){if(typeof e!="string")throw new Error("Param is not a string");switch(e.toLowerCase()){case"l":case"low":return n.L;case"m":case"medium":return n.M;case"q":case"quartile":return n.Q;case"h":case"high":return n.H;default:throw new Error("Unknown EC Level: "+e)}}n.isValid=function(i){return i&&typeof i.bit<"u"&&i.bit>=0&&i.bit<4},n.from=function(i,o){if(n.isValid(i))return i;try{return t(i)}catch{return o}}})(_t)),_t}var kt,ze;function Fr(){if(ze)return kt;ze=1;function n(){this.buffer=[],this.length=0}return n.prototype={get:function(t){const e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(let i=0;i<e;i++)this.putBit((t>>>e-i-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}},kt=n,kt}var Tt,Fe;function Dr(){if(Fe)return Tt;Fe=1;function n(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}return n.prototype.set=function(t,e,i,o){const r=t*this.size+e;this.data[r]=i,o&&(this.reservedBit[r]=!0)},n.prototype.get=function(t,e){return this.data[t*this.size+e]},n.prototype.xor=function(t,e,i){this.data[t*this.size+e]^=i},n.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]},Tt=n,Tt}var Rt={},De;function Ur(){return De||(De=1,(function(n){const t=Y().getSymbolSize;n.getRowColCoords=function(i){if(i===1)return[];const o=Math.floor(i/7)+2,r=t(i),s=r===145?26:Math.ceil((r-13)/(2*o-2))*2,a=[r-7];for(let l=1;l<o-1;l++)a[l]=a[l-1]-s;return a.push(6),a.reverse()},n.getPositions=function(i){const o=[],r=n.getRowColCoords(i),s=r.length;for(let a=0;a<s;a++)for(let l=0;l<s;l++)a===0&&l===0||a===0&&l===s-1||a===s-1&&l===0||o.push([r[a],r[l]]);return o}})(Rt)),Rt}var It={},Ue;function $r(){if(Ue)return It;Ue=1;const n=Y().getSymbolSize,t=7;return It.getPositions=function(i){const o=n(i);return[[0,0],[o-t,0],[0,o-t]]},It}var Nt={},$e;function qr(){return $e||($e=1,(function(n){n.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t={N1:3,N2:3,N3:40,N4:10};n.isValid=function(o){return o!=null&&o!==""&&!isNaN(o)&&o>=0&&o<=7},n.from=function(o){return n.isValid(o)?parseInt(o,10):void 0},n.getPenaltyN1=function(o){const r=o.size;let s=0,a=0,l=0,c=null,u=null;for(let h=0;h<r;h++){a=l=0,c=u=null;for(let f=0;f<r;f++){let d=o.get(h,f);d===c?a++:(a>=5&&(s+=t.N1+(a-5)),c=d,a=1),d=o.get(f,h),d===u?l++:(l>=5&&(s+=t.N1+(l-5)),u=d,l=1)}a>=5&&(s+=t.N1+(a-5)),l>=5&&(s+=t.N1+(l-5))}return s},n.getPenaltyN2=function(o){const r=o.size;let s=0;for(let a=0;a<r-1;a++)for(let l=0;l<r-1;l++){const c=o.get(a,l)+o.get(a,l+1)+o.get(a+1,l)+o.get(a+1,l+1);(c===4||c===0)&&s++}return s*t.N2},n.getPenaltyN3=function(o){const r=o.size;let s=0,a=0,l=0;for(let c=0;c<r;c++){a=l=0;for(let u=0;u<r;u++)a=a<<1&2047|o.get(c,u),u>=10&&(a===1488||a===93)&&s++,l=l<<1&2047|o.get(u,c),u>=10&&(l===1488||l===93)&&s++}return s*t.N3},n.getPenaltyN4=function(o){let r=0;const s=o.data.length;for(let l=0;l<s;l++)r+=o.data[l];return Math.abs(Math.ceil(r*100/s/5)-10)*t.N4};function e(i,o,r){switch(i){case n.Patterns.PATTERN000:return(o+r)%2===0;case n.Patterns.PATTERN001:return o%2===0;case n.Patterns.PATTERN010:return r%3===0;case n.Patterns.PATTERN011:return(o+r)%3===0;case n.Patterns.PATTERN100:return(Math.floor(o/2)+Math.floor(r/3))%2===0;case n.Patterns.PATTERN101:return o*r%2+o*r%3===0;case n.Patterns.PATTERN110:return(o*r%2+o*r%3)%2===0;case n.Patterns.PATTERN111:return(o*r%3+(o+r)%2)%2===0;default:throw new Error("bad maskPattern:"+i)}}n.applyMask=function(o,r){const s=r.size;for(let a=0;a<s;a++)for(let l=0;l<s;l++)r.isReserved(l,a)||r.xor(l,a,e(o,l,a))},n.getBestMask=function(o,r){const s=Object.keys(n.Patterns).length;let a=0,l=1/0;for(let c=0;c<s;c++){r(c),n.applyMask(c,o);const u=n.getPenaltyN1(o)+n.getPenaltyN2(o)+n.getPenaltyN3(o)+n.getPenaltyN4(o);n.applyMask(c,o),u<l&&(l=u,a=c)}return a}})(Nt)),Nt}var at={},qe;function Ve(){if(qe)return at;qe=1;const n=At(),t=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],e=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return at.getBlocksCount=function(o,r){switch(r){case n.L:return t[(o-1)*4+0];case n.M:return t[(o-1)*4+1];case n.Q:return t[(o-1)*4+2];case n.H:return t[(o-1)*4+3];default:return}},at.getTotalCodewordsCount=function(o,r){switch(r){case n.L:return e[(o-1)*4+0];case n.M:return e[(o-1)*4+1];case n.Q:return e[(o-1)*4+2];case n.H:return e[(o-1)*4+3];default:return}},at}var Mt={},nt={},je;function Vr(){if(je)return nt;je=1;const n=new Uint8Array(512),t=new Uint8Array(256);return(function(){let i=1;for(let o=0;o<255;o++)n[o]=i,t[i]=o,i<<=1,i&256&&(i^=285);for(let o=255;o<512;o++)n[o]=n[o-255]})(),nt.log=function(i){if(i<1)throw new Error("log("+i+")");return t[i]},nt.exp=function(i){return n[i]},nt.mul=function(i,o){return i===0||o===0?0:n[t[i]+t[o]]},nt}var He;function jr(){return He||(He=1,(function(n){const t=Vr();n.mul=function(i,o){const r=new Uint8Array(i.length+o.length-1);for(let s=0;s<i.length;s++)for(let a=0;a<o.length;a++)r[s+a]^=t.mul(i[s],o[a]);return r},n.mod=function(i,o){let r=new Uint8Array(i);for(;r.length-o.length>=0;){const s=r[0];for(let l=0;l<o.length;l++)r[l]^=t.mul(o[l],s);let a=0;for(;a<r.length&&r[a]===0;)a++;r=r.slice(a)}return r},n.generateECPolynomial=function(i){let o=new Uint8Array([1]);for(let r=0;r<i;r++)o=n.mul(o,new Uint8Array([1,t.exp(r)]));return o}})(Mt)),Mt}var Bt,Ge;function Hr(){if(Ge)return Bt;Ge=1;const n=jr();function t(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}return t.prototype.initialize=function(i){this.degree=i,this.genPoly=n.generateECPolynomial(this.degree)},t.prototype.encode=function(i){if(!this.genPoly)throw new Error("Encoder not initialized");const o=new Uint8Array(i.length+this.degree);o.set(i);const r=n.mod(o,this.genPoly),s=this.degree-r.length;if(s>0){const a=new Uint8Array(this.degree);return a.set(r,s),a}return r},Bt=t,Bt}var Pt={},Lt={},Ot={},Ke;function Ye(){return Ke||(Ke=1,Ot.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),Ot}var V={},Qe;function Je(){if(Qe)return V;Qe=1;const n="[0-9]+",t="[A-Z $%*+\\-./:]+";let e="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";e=e.replace(/u/g,"\\u");const i="(?:(?![A-Z0-9 $%*+\\-./:]|"+e+`)(?:.|[\r
|
|
508
|
+
`;function Cr(){if(Re(),document.getElementById("vd-styles")!==null)return;const n=document.createElement("style");n.id="vd-styles",n.textContent=wr,document.head.appendChild(n)}function Sr(n,t){const e=document.createElement("a");e.href=`data:image/png;base64,${n}`,e.download=t,e.click()}class Er{options;settings={};container=null;loading=null;slots={topRight:null,bottomRight:null};screenshotBtn=null;actionBar=null;cameraControls=null;attributes=null;layout=null;commerce=null;constructor(t){this.options=t}attach(t){Cr(),this.container=t,this.loading=new or(t),this.slots.topRight=this.createSlot(t,"vd-slot-top-right"),this.slots.bottomRight=this.createSlot(t,"vd-slot-bottom-right")}onReady(){this.loading?.hide(),this.loading=null,this.mountToolbar(),this.cameraControls!==null&&(this.cameraControls.element.style.display="flex"),this.layout?.setVisible(!0)}mountToolbar(){if(this.actionBar!==null||this.slots.bottomRight===null||this.container===null)return;const t=typeof this.container.requestFullscreen=="function";this.actionBar=new rr({onAr:this.options.onAr,onFullscreen:t?()=>{this.toggleFullscreen()}:void 0}),this.actionBar.applySettings(this.settings),this.slots.bottomRight.appendChild(this.actionBar.element),this.syncScreenshotButton(),this.placeScreenshotButton()}toggleFullscreen(){this.container!==null&&(document.fullscreenElement!==null?document.exitFullscreen():(this.options.onFullscreenEnter?.(),this.container.requestFullscreen()))}updateProgress(t,e){this.loading?.updateProgress(t,e)}showError(t){this.loading?.showError(t)}applyViewerSettings(t){this.settings=t,t.language!==void 0&&we(t.language,{reload:!1}),this.syncScreenshotButton(),this.actionBar?.applySettings(t),this.cameraControls!==null&&(this.cameraControls.element.style.display=t.cameraControls===!0?"flex":"none"),this.placeScreenshotButton()}renderAttributeControls(t,e){if(!(this.container===null||this.slots.topRight===null)&&(this.cameraControls?.element.remove(),this.cameraControls=null,this.teardownConfigurator(),this.settings.cameraControls===!0&&(this.cameraControls=new st(this.options.cameraApi,this.options.cameraPositionApi),this.cameraControls.element.style.display="none",this.slots.topRight.appendChild(this.cameraControls.element)),this.placeScreenshotButton(),e.length!==0)){this.attributes=document.createElement("div"),this.attributes.className="vd-attributes";for(const i of e)this.attributes.appendChild(ur(i,t,this.options.eventBus,this.options.onSelect,this.options.onSubscribe));this.commerce=new fr(this.options.configuration),this.attributes.appendChild(this.commerce.element),this.layout=yr(this.settings.configuratorLayout),this.layout.attach(this.container,this.attributes)}}get viewerSettings(){return this.settings}teardownConfigurator(){this.commerce?.destroy(),this.commerce=null,this.attributes?.remove(),this.attributes=null,this.layout?.destroy(),this.layout=null}destroy(){this.loading?.destroy(),this.screenshotBtn?.element.remove(),this.actionBar?.destroy(),this.actionBar?.element.remove(),this.cameraControls?.element.remove(),this.teardownConfigurator();for(const t of Object.values(this.slots))t?.remove();this.container=null}createSlot(t,e){const i=document.createElement("div");return i.className=e,t.appendChild(i),i}syncScreenshotButton(){const t=this.settings.screenshot===!0;t&&this.screenshotBtn===null&&(this.screenshotBtn=new F({variant:"outline",size:"icon",label:zi(),icon:z.screenshot(),onClick:()=>{this.options.snapshotApi.take("snapshot.png").onDeveloped(({data:e,filename:i})=>{Sr(e,i)})}})),!t&&this.screenshotBtn!==null&&(this.screenshotBtn.element.remove(),this.screenshotBtn=null)}placeScreenshotButton(){this.screenshotBtn===null||this.slots.topRight===null||(this.cameraControls!==null?this.cameraControls.element.appendChild(this.screenshotBtn.element):this.slots.topRight.appendChild(this.screenshotBtn.element))}}const _r={};class Ar{defaultServer="https://server.virtualdisplay.io";options;serverHost;constructor(t,e){this.options=t,this.serverHost=e}create(){const t=this.createContainer(),e=this.createIframe();return t.appendChild(e),this.attachToParent(t),{container:t,iframe:e}}createContainer(){const t=document.createElement("div");return t.className="vd-container",Object.assign(t.style,{position:"relative",width:"100%",height:"100%",overflow:"hidden"}),t}createIframe(){const t=document.createElement("iframe");return t.src=this.buildUrl(),t.setAttribute("allow","xr-spatial-tracking; fullscreen"),t}attachToParent(t){this.getParentElement().appendChild(t)}buildUrl(){const t=this.getServerUrl(),e=new URL(t);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.session!==void 0&&e.searchParams.set("session",this.options.session),this.options.debug===!0&&e.searchParams.set("debug","true"),this.options.traceparent!==void 0&&e.searchParams.set("traceparent",this.options.traceparent),e.toString()}getServerUrl(){if(this.serverHost!==void 0)return this.serverHost;if(_r?.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 x.parentNotFound(this.options.parent);return t}}function kr(n){const{messenger:t}=n;t.on(N.HANDSHAKE,e=>{Cn(e)&&(M.logger.info("Server handshake received, flushing publisher queue"),t.markReady())}),t.on(N.SESSION,e=>{Sn(e)&&n.onSession(e.sessionId)}),t.on(N.MUTATION,e=>{En(e)&&(n.attributes.handleMutationResult(e),n.configuration.handleSelectionChanged(n.attributes.getSelection()))}),t.on(N.SNAPSHOT,e=>{_n(e)&&n.snapshot.handleSnapshotResult(e)}),t.on(N.CAMERA,e=>{An(e)&&n.cameraPosition.handlePositionUpdate(e)}),t.on(N.LOADING_INDICATOR,e=>{Tn(e)&&(e.error!==void 0?n.ui.showError(e.error):n.ui.updateProgress(e.progress,e.phase))}),t.on(N.CONFIG,e=>{In(e)&&n.applyConfig(e)}),t.on(N.MAPPING,e=>{kn(e)&&(n.attributes.handleMappingReceived(e),n.configuration.handleSelectionChanged(n.attributes.getSelection()),n.ui.renderAttributeControls(n.attributes,e.attributes),n.readyStateTracker.handleMappingReceived())}),Tr(n)}function Tr(n){const{messenger:t}=n;t.on(N.FOCUS,e=>{Nn(e)&&n.focus.handleStateReceived(e)}),t.on(N.PRICING,e=>{Mn(e)&&n.configuration.handlePricingReceived(e.pricing)}),t.on(N.SYNC,e=>{Rn(e)&&n.onSync(e.connected)})}class Rr{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}}class Ir{attributes;readyStateTracker;messenger;cameraApi;cameraPositionApi;focusApi;configurationApi;snapshotApi;annotationsApi;eventBus;ui;options;serverHost;arActivation;syncTracker;iframe;container;readyCallbacks=[];mutationFailedCallbacks=[];viewerSessionId;constructor(t,e){this.options=t,this.serverHost=e?.serverHost,this.initializeLogging(),this.messenger=new Bn(()=>this.iframe?.contentWindow??null,e?.messengerOptions);const i=r=>{this.messenger.send(r)};this.attributes=new Gn(i,(r,s)=>{this.notifyMutationFailed(r,s)}),this.snapshotApi=new fe(i),this.annotationsApi=new Wt(i),this.cameraApi=new ae(i),this.cameraPositionApi=new Kn,this.focusApi=new ue(i,r=>{this.dispatchFocusChange(r)}),this.configurationApi=new ce(r=>{this.dispatchConfigurationChange(r)},r=>{this.dispatchConfigurationSubmit(r)}),this.eventBus=new Jn,this.arActivation=e?.createArActivation?.(i),this.syncTracker=e?.createSyncTracker?.(),this.readyStateTracker=new Rr(()=>{this.notifyReady()});const o=this.arActivation;this.ui=new Er({snapshotApi:this.snapshotApi,cameraApi:this.cameraApi,cameraPositionApi:this.cameraPositionApi,eventBus:this.eventBus,configuration:this.configurationApi,onSelect:(r,s)=>this.attributes.select(r,s),onSubscribe:(r,s)=>this.attributes.onChange(r,s),...o!==void 0&&{onAr:()=>{o.activate()}},onFullscreenEnter:()=>{this.trackFullscreen()}}),this.wireIncomingMessages(),e?.registerHandlers?.(this.messenger,i),this.messenger.start(),this.createAndConnectIframe()}wireIncomingMessages(){kr({messenger:this.messenger,attributes:this.attributes,configuration:this.configurationApi,snapshot:this.snapshotApi,cameraPosition:this.cameraPositionApi,focus:this.focusApi,ui:this.ui,readyStateTracker:this.readyStateTracker,applyConfig:t=>{this.handleConfig(t)},onSession:t=>{this.handleSession(t)},onSync:t=>{this.syncTracker?.handleSync(t)}})}handleSession(t){this.viewerSessionId=t,this.arActivation?.onSession(t)}notifyMutationFailed(t,e){for(const i of this.mutationFailedCallbacks)i({attribute:t,value:e})}notifyReady(){const t=this.readyCallbacks;this.readyCallbacks=[];for(const e of t)e(this);this.ui.onReady()}dispatchFocusChange(t){this.container?.dispatchEvent(new CustomEvent(W.FOCUS_CHANGE,{detail:t,bubbles:!0}))}dispatchConfigurationChange(t){this.container?.dispatchEvent(new CustomEvent(W.CONFIGURATION_CHANGE,{detail:t??null,bubbles:!0}))}dispatchConfigurationSubmit(t){this.container?.dispatchEvent(new CustomEvent(W.CONFIGURATION_SUBMIT,{detail:t,bubbles:!0}))}handleConfig(t){const e=t.viewerSettings,i=this.options.viewerSettings;if(e!==void 0||i!==void 0){const o=i!==void 0?{...e??{},...i}:e;if(i!==void 0&&e!==void 0){const r=Object.entries(i).filter(([s,a])=>e[s]!==a).map(([s,a])=>`${s} (metadata: ${e[s]??"undefined"}, override: ${a})`);r.length>0&&M.logger.warn(`Viewer settings override active: ${r.join(", ")}`)}this.ui.applyViewerSettings(o),this.annotationsApi.setEnabled(o.annotations!==!1)}this.cameraPositionApi.applyLimits(t.cameraLimits)}trackFullscreen(){this.messenger.send({type:N.FULLSCREEN})}initializeLogging(){this.options.debug===!0&&se(),M.logger.info("Initializing Virtualdisplay client",{model:this.options.model})}createAndConnectIframe(){const e=new Ar(this.options,this.serverHost).create();this.container=e.container,this.iframe=e.iframe,this.eventBus.attach(this.container),this.ui.attach(this.container);try{const i=new URL(this.iframe.src).origin;this.messenger.setTargetOrigin(i)}catch{}}select(t,e){this.attributes.select(t,e)}getValues(t){return this.attributes.getValues(t)}getValue(t,e){return this.attributes.getValue(t,e)}onChange(t,e){this.attributes.onChange(t,e)}getAttribute(t){return this.attributes.getAttribute(t)}get isReady(){return this.readyStateTracker.isReady}onReady(t){if(this.readyStateTracker.isReady){t(this);return}this.readyCallbacks.push(t)}onMutationFailed(t){this.mutationFailedCallbacks.push(t)}activateAr(){this.arActivation?.activate()}on(t,e){this.eventBus.on(t,e)}get annotations(){return this.annotationsApi}get camera(){return this.cameraApi}get focus(){return this.focusApi}get configuration(){return this.configurationApi}get cameraPosition(){return this.cameraPositionApi}get snapshot(){return this.snapshotApi}get sessionId(){return this.viewerSessionId}get viewerSettings(){return this.ui.viewerSettings}destroy(){this.readyStateTracker.clear(),this.readyCallbacks=[],this.mutationFailedCallbacks.length=0,this.snapshotApi.clear(),this.messenger.destroy(),this.arActivation?.destroy(),this.ui.destroy(),this.container?.parentElement!==null&&this.container?.parentElement!==void 0&&this.container.parentElement.removeChild(this.container),this.container=void 0,this.iframe=void 0}}const Nr="ar.virtualdisplay.io";function Mr(n){const t=new URL(`https://${Nr}/go`);return n.sessionId!==void 0?t.searchParams.set("session",n.sessionId):(t.searchParams.set("license",n.license),t.searchParams.set("model",n.model)),t.toString()}const Br=1500;class Pr{options;qrModal=new Wo;sessionId;waiters=[];pendingTimers=new Set;destroyed=!1;constructor(t){this.options=t}onSession(t){this.sessionId=t;const e=this.waiters;this.waiters=[];for(const i of e)i(t)}activate(){if(Vn()){this.options.send({type:N.AR_ACTIVATE});return}this.showQrCode()}destroy(){this.destroyed=!0;for(const t of this.pendingTimers)clearTimeout(t);this.pendingTimers.clear(),this.waiters=[],this.qrModal.hide()}async showQrCode(){this.qrModal.show();const t=await this.waitForSessionId();if(this.destroyed)return;const e=Mr({sessionId:t,license:this.options.license,model:this.options.model}),i=await this.qrModal.update(e);if(this.destroyed){this.qrModal.hide();return}i&&this.options.send({type:N.QR_SHOWN})}waitForSessionId(){return this.sessionId!==void 0?Promise.resolve(this.sessionId):new Promise(t=>{const e=setTimeout(()=>{this.pendingTimers.delete(e),t(void 0)},Br);this.pendingTimers.add(e),this.waiters.push(i=>{this.pendingTimers.delete(e),clearTimeout(e),t(i)})})}}class Lr{callbacks=[];lastKnown;handleSync(t){this.lastKnown=t;for(const e of this.callbacks)e(t)}onChange(t){this.callbacks.push(t),this.lastKnown!==void 0&&t(this.lastKnown)}}class Or extends Ir{syncStatusTracker;constructor(t){const e=new Lr;super(t,{createArActivation:i=>new Pr({license:t.license,model:t.model,send:i}),createSyncTracker:()=>e}),this.syncStatusTracker=e}onSyncChange(t){this.syncStatusTracker.onChange(t)}}function xr(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var X={},St,Le;function zr(){return Le||(Le=1,St=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),St}var Et={},G={},Oe;function Y(){if(Oe)return G;Oe=1;let n;const t=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return G.getSymbolSize=function(i){if(!i)throw new Error('"version" cannot be null or undefined');if(i<1||i>40)throw new Error('"version" should be in range from 1 to 40');return i*4+17},G.getSymbolTotalCodewords=function(i){return t[i]},G.getBCHDigit=function(e){let i=0;for(;e!==0;)i++,e>>>=1;return i},G.setToSJISFunction=function(i){if(typeof i!="function")throw new Error('"toSJISFunc" is not a valid function.');n=i},G.isKanjiModeEnabled=function(){return typeof n<"u"},G.toSJIS=function(i){return n(i)},G}var _t={},xe;function At(){return xe||(xe=1,(function(n){n.L={bit:1},n.M={bit:0},n.Q={bit:3},n.H={bit:2};function t(e){if(typeof e!="string")throw new Error("Param is not a string");switch(e.toLowerCase()){case"l":case"low":return n.L;case"m":case"medium":return n.M;case"q":case"quartile":return n.Q;case"h":case"high":return n.H;default:throw new Error("Unknown EC Level: "+e)}}n.isValid=function(i){return i&&typeof i.bit<"u"&&i.bit>=0&&i.bit<4},n.from=function(i,o){if(n.isValid(i))return i;try{return t(i)}catch{return o}}})(_t)),_t}var kt,ze;function Fr(){if(ze)return kt;ze=1;function n(){this.buffer=[],this.length=0}return n.prototype={get:function(t){const e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(let i=0;i<e;i++)this.putBit((t>>>e-i-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}},kt=n,kt}var Tt,Fe;function Dr(){if(Fe)return Tt;Fe=1;function n(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}return n.prototype.set=function(t,e,i,o){const r=t*this.size+e;this.data[r]=i,o&&(this.reservedBit[r]=!0)},n.prototype.get=function(t,e){return this.data[t*this.size+e]},n.prototype.xor=function(t,e,i){this.data[t*this.size+e]^=i},n.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]},Tt=n,Tt}var Rt={},De;function Ur(){return De||(De=1,(function(n){const t=Y().getSymbolSize;n.getRowColCoords=function(i){if(i===1)return[];const o=Math.floor(i/7)+2,r=t(i),s=r===145?26:Math.ceil((r-13)/(2*o-2))*2,a=[r-7];for(let l=1;l<o-1;l++)a[l]=a[l-1]-s;return a.push(6),a.reverse()},n.getPositions=function(i){const o=[],r=n.getRowColCoords(i),s=r.length;for(let a=0;a<s;a++)for(let l=0;l<s;l++)a===0&&l===0||a===0&&l===s-1||a===s-1&&l===0||o.push([r[a],r[l]]);return o}})(Rt)),Rt}var It={},Ue;function $r(){if(Ue)return It;Ue=1;const n=Y().getSymbolSize,t=7;return It.getPositions=function(i){const o=n(i);return[[0,0],[o-t,0],[0,o-t]]},It}var Nt={},$e;function qr(){return $e||($e=1,(function(n){n.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t={N1:3,N2:3,N3:40,N4:10};n.isValid=function(o){return o!=null&&o!==""&&!isNaN(o)&&o>=0&&o<=7},n.from=function(o){return n.isValid(o)?parseInt(o,10):void 0},n.getPenaltyN1=function(o){const r=o.size;let s=0,a=0,l=0,c=null,u=null;for(let h=0;h<r;h++){a=l=0,c=u=null;for(let f=0;f<r;f++){let d=o.get(h,f);d===c?a++:(a>=5&&(s+=t.N1+(a-5)),c=d,a=1),d=o.get(f,h),d===u?l++:(l>=5&&(s+=t.N1+(l-5)),u=d,l=1)}a>=5&&(s+=t.N1+(a-5)),l>=5&&(s+=t.N1+(l-5))}return s},n.getPenaltyN2=function(o){const r=o.size;let s=0;for(let a=0;a<r-1;a++)for(let l=0;l<r-1;l++){const c=o.get(a,l)+o.get(a,l+1)+o.get(a+1,l)+o.get(a+1,l+1);(c===4||c===0)&&s++}return s*t.N2},n.getPenaltyN3=function(o){const r=o.size;let s=0,a=0,l=0;for(let c=0;c<r;c++){a=l=0;for(let u=0;u<r;u++)a=a<<1&2047|o.get(c,u),u>=10&&(a===1488||a===93)&&s++,l=l<<1&2047|o.get(u,c),u>=10&&(l===1488||l===93)&&s++}return s*t.N3},n.getPenaltyN4=function(o){let r=0;const s=o.data.length;for(let l=0;l<s;l++)r+=o.data[l];return Math.abs(Math.ceil(r*100/s/5)-10)*t.N4};function e(i,o,r){switch(i){case n.Patterns.PATTERN000:return(o+r)%2===0;case n.Patterns.PATTERN001:return o%2===0;case n.Patterns.PATTERN010:return r%3===0;case n.Patterns.PATTERN011:return(o+r)%3===0;case n.Patterns.PATTERN100:return(Math.floor(o/2)+Math.floor(r/3))%2===0;case n.Patterns.PATTERN101:return o*r%2+o*r%3===0;case n.Patterns.PATTERN110:return(o*r%2+o*r%3)%2===0;case n.Patterns.PATTERN111:return(o*r%3+(o+r)%2)%2===0;default:throw new Error("bad maskPattern:"+i)}}n.applyMask=function(o,r){const s=r.size;for(let a=0;a<s;a++)for(let l=0;l<s;l++)r.isReserved(l,a)||r.xor(l,a,e(o,l,a))},n.getBestMask=function(o,r){const s=Object.keys(n.Patterns).length;let a=0,l=1/0;for(let c=0;c<s;c++){r(c),n.applyMask(c,o);const u=n.getPenaltyN1(o)+n.getPenaltyN2(o)+n.getPenaltyN3(o)+n.getPenaltyN4(o);n.applyMask(c,o),u<l&&(l=u,a=c)}return a}})(Nt)),Nt}var at={},qe;function Ve(){if(qe)return at;qe=1;const n=At(),t=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],e=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return at.getBlocksCount=function(o,r){switch(r){case n.L:return t[(o-1)*4+0];case n.M:return t[(o-1)*4+1];case n.Q:return t[(o-1)*4+2];case n.H:return t[(o-1)*4+3];default:return}},at.getTotalCodewordsCount=function(o,r){switch(r){case n.L:return e[(o-1)*4+0];case n.M:return e[(o-1)*4+1];case n.Q:return e[(o-1)*4+2];case n.H:return e[(o-1)*4+3];default:return}},at}var Mt={},nt={},je;function Vr(){if(je)return nt;je=1;const n=new Uint8Array(512),t=new Uint8Array(256);return(function(){let i=1;for(let o=0;o<255;o++)n[o]=i,t[i]=o,i<<=1,i&256&&(i^=285);for(let o=255;o<512;o++)n[o]=n[o-255]})(),nt.log=function(i){if(i<1)throw new Error("log("+i+")");return t[i]},nt.exp=function(i){return n[i]},nt.mul=function(i,o){return i===0||o===0?0:n[t[i]+t[o]]},nt}var He;function jr(){return He||(He=1,(function(n){const t=Vr();n.mul=function(i,o){const r=new Uint8Array(i.length+o.length-1);for(let s=0;s<i.length;s++)for(let a=0;a<o.length;a++)r[s+a]^=t.mul(i[s],o[a]);return r},n.mod=function(i,o){let r=new Uint8Array(i);for(;r.length-o.length>=0;){const s=r[0];for(let l=0;l<o.length;l++)r[l]^=t.mul(o[l],s);let a=0;for(;a<r.length&&r[a]===0;)a++;r=r.slice(a)}return r},n.generateECPolynomial=function(i){let o=new Uint8Array([1]);for(let r=0;r<i;r++)o=n.mul(o,new Uint8Array([1,t.exp(r)]));return o}})(Mt)),Mt}var Bt,Ge;function Hr(){if(Ge)return Bt;Ge=1;const n=jr();function t(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}return t.prototype.initialize=function(i){this.degree=i,this.genPoly=n.generateECPolynomial(this.degree)},t.prototype.encode=function(i){if(!this.genPoly)throw new Error("Encoder not initialized");const o=new Uint8Array(i.length+this.degree);o.set(i);const r=n.mod(o,this.genPoly),s=this.degree-r.length;if(s>0){const a=new Uint8Array(this.degree);return a.set(r,s),a}return r},Bt=t,Bt}var Pt={},Lt={},Ot={},Ke;function Ye(){return Ke||(Ke=1,Ot.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),Ot}var V={},Qe;function Je(){if(Qe)return V;Qe=1;const n="[0-9]+",t="[A-Z $%*+\\-./:]+";let e="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";e=e.replace(/u/g,"\\u");const i="(?:(?![A-Z0-9 $%*+\\-./:]|"+e+`)(?:.|[\r
|
|
494
509
|
]))+`;V.KANJI=new RegExp(e,"g"),V.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),V.BYTE=new RegExp(i,"g"),V.NUMERIC=new RegExp(n,"g"),V.ALPHANUMERIC=new RegExp(t,"g");const o=new RegExp("^"+e+"$"),r=new RegExp("^"+n+"$"),s=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return V.testKanji=function(l){return o.test(l)},V.testNumeric=function(l){return r.test(l)},V.testAlphanumeric=function(l){return s.test(l)},V}var Ze;function Q(){return Ze||(Ze=1,(function(n){const t=Ye(),e=Je();n.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},n.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},n.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},n.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},n.MIXED={bit:-1},n.getCharCountIndicator=function(r,s){if(!r.ccBits)throw new Error("Invalid mode: "+r);if(!t.isValid(s))throw new Error("Invalid version: "+s);return s>=1&&s<10?r.ccBits[0]:s<27?r.ccBits[1]:r.ccBits[2]},n.getBestModeForData=function(r){return e.testNumeric(r)?n.NUMERIC:e.testAlphanumeric(r)?n.ALPHANUMERIC:e.testKanji(r)?n.KANJI:n.BYTE},n.toString=function(r){if(r&&r.id)return r.id;throw new Error("Invalid mode")},n.isValid=function(r){return r&&r.bit&&r.ccBits};function i(o){if(typeof o!="string")throw new Error("Param is not a string");switch(o.toLowerCase()){case"numeric":return n.NUMERIC;case"alphanumeric":return n.ALPHANUMERIC;case"kanji":return n.KANJI;case"byte":return n.BYTE;default:throw new Error("Unknown mode: "+o)}}n.from=function(r,s){if(n.isValid(r))return r;try{return i(r)}catch{return s}}})(Lt)),Lt}var We;function Gr(){return We||(We=1,(function(n){const t=Y(),e=Ve(),i=At(),o=Q(),r=Ye(),s=7973,a=t.getBCHDigit(s);function l(f,d,p){for(let k=1;k<=40;k++)if(d<=n.getCapacity(k,p,f))return k}function c(f,d){return o.getCharCountIndicator(f,d)+4}function u(f,d){let p=0;return f.forEach(function(k){const P=c(k.mode,d);p+=P+k.getBitsLength()}),p}function h(f,d){for(let p=1;p<=40;p++)if(u(f,p)<=n.getCapacity(p,d,o.MIXED))return p}n.from=function(d,p){return r.isValid(d)?parseInt(d,10):p},n.getCapacity=function(d,p,k){if(!r.isValid(d))throw new Error("Invalid QR Code version");typeof k>"u"&&(k=o.BYTE);const P=t.getSymbolTotalCodewords(d),S=e.getTotalCodewordsCount(d,p),I=(P-S)*8;if(k===o.MIXED)return I;const T=I-c(k,d);switch(k){case o.NUMERIC:return Math.floor(T/10*3);case o.ALPHANUMERIC:return Math.floor(T/11*2);case o.KANJI:return Math.floor(T/13);case o.BYTE:default:return Math.floor(T/8)}},n.getBestVersionForData=function(d,p){let k;const P=i.from(p,i.M);if(Array.isArray(d)){if(d.length>1)return h(d,P);if(d.length===0)return 1;k=d[0]}else k=d;return l(k.mode,k.getLength(),P)},n.getEncodedBits=function(d){if(!r.isValid(d)||d<7)throw new Error("Invalid QR Code version");let p=d<<12;for(;t.getBCHDigit(p)-a>=0;)p^=s<<t.getBCHDigit(p)-a;return d<<12|p}})(Pt)),Pt}var xt={},Xe;function Kr(){if(Xe)return xt;Xe=1;const n=Y(),t=1335,e=21522,i=n.getBCHDigit(t);return xt.getEncodedBits=function(r,s){const a=r.bit<<3|s;let l=a<<10;for(;n.getBCHDigit(l)-i>=0;)l^=t<<n.getBCHDigit(l)-i;return(a<<10|l)^e},xt}var zt={},Ft,tn;function Yr(){if(tn)return Ft;tn=1;const n=Q();function t(e){this.mode=n.NUMERIC,this.data=e.toString()}return t.getBitsLength=function(i){return 10*Math.floor(i/3)+(i%3?i%3*3+1:0)},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(i){let o,r,s;for(o=0;o+3<=this.data.length;o+=3)r=this.data.substr(o,3),s=parseInt(r,10),i.put(s,10);const a=this.data.length-o;a>0&&(r=this.data.substr(o),s=parseInt(r,10),i.put(s,a*3+1))},Ft=t,Ft}var Dt,en;function Qr(){if(en)return Dt;en=1;const n=Q(),t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function e(i){this.mode=n.ALPHANUMERIC,this.data=i}return e.getBitsLength=function(o){return 11*Math.floor(o/2)+6*(o%2)},e.prototype.getLength=function(){return this.data.length},e.prototype.getBitsLength=function(){return e.getBitsLength(this.data.length)},e.prototype.write=function(o){let r;for(r=0;r+2<=this.data.length;r+=2){let s=t.indexOf(this.data[r])*45;s+=t.indexOf(this.data[r+1]),o.put(s,11)}this.data.length%2&&o.put(t.indexOf(this.data[r]),6)},Dt=e,Dt}var Ut,nn;function Jr(){if(nn)return Ut;nn=1;const n=Q();function t(e){this.mode=n.BYTE,typeof e=="string"?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}return t.getBitsLength=function(i){return i*8},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(e){for(let i=0,o=this.data.length;i<o;i++)e.put(this.data[i],8)},Ut=t,Ut}var $t,on;function Zr(){if(on)return $t;on=1;const n=Q(),t=Y();function e(i){this.mode=n.KANJI,this.data=i}return e.getBitsLength=function(o){return o*13},e.prototype.getLength=function(){return this.data.length},e.prototype.getBitsLength=function(){return e.getBitsLength(this.data.length)},e.prototype.write=function(i){let o;for(o=0;o<this.data.length;o++){let r=t.toSJIS(this.data[o]);if(r>=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[o]+`
|
|
495
510
|
Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),i.put(r,13)}},$t=e,$t}var qt={exports:{}},rn;function Wr(){return rn||(rn=1,(function(n){var t={single_source_shortest_paths:function(e,i,o){var r={},s={};s[i]=0;var a=t.PriorityQueue.make();a.push(i,0);for(var l,c,u,h,f,d,p,k,P;!a.empty();){l=a.pop(),c=l.value,h=l.cost,f=e[c]||{};for(u in f)f.hasOwnProperty(u)&&(d=f[u],p=h+d,k=s[u],P=typeof s[u]>"u",(P||k>p)&&(s[u]=p,a.push(u,p),r[u]=c))}if(typeof o<"u"&&typeof s[o]>"u"){var S=["Could not find a path from ",i," to ",o,"."].join("");throw new Error(S)}return r},extract_shortest_path_from_predecessor_list:function(e,i){for(var o=[],r=i;r;)o.push(r),e[r],r=e[r];return o.reverse(),o},find_path:function(e,i,o){var r=t.single_source_shortest_paths(e,i,o);return t.extract_shortest_path_from_predecessor_list(r,o)},PriorityQueue:{make:function(e){var i=t.PriorityQueue,o={},r;e=e||{};for(r in i)i.hasOwnProperty(r)&&(o[r]=i[r]);return o.queue=[],o.sorter=e.sorter||i.default_sorter,o},default_sorter:function(e,i){return e.cost-i.cost},push:function(e,i){var o={value:e,cost:i};this.queue.push(o),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};n.exports=t})(qt)),qt.exports}var sn;function Xr(){return sn||(sn=1,(function(n){const t=Q(),e=Yr(),i=Qr(),o=Jr(),r=Zr(),s=Je(),a=Y(),l=Wr();function c(S){return unescape(encodeURIComponent(S)).length}function u(S,I,T){const _=[];let O;for(;(O=S.exec(T))!==null;)_.push({data:O[0],index:O.index,mode:I,length:O[0].length});return _}function h(S){const I=u(s.NUMERIC,t.NUMERIC,S),T=u(s.ALPHANUMERIC,t.ALPHANUMERIC,S);let _,O;return a.isKanjiModeEnabled()?(_=u(s.BYTE,t.BYTE,S),O=u(s.KANJI,t.KANJI,S)):(_=u(s.BYTE_KANJI,t.BYTE,S),O=[]),I.concat(T,_,O).sort(function(w,y){return w.index-y.index}).map(function(w){return{data:w.data,mode:w.mode,length:w.length}})}function f(S,I){switch(I){case t.NUMERIC:return e.getBitsLength(S);case t.ALPHANUMERIC:return i.getBitsLength(S);case t.KANJI:return r.getBitsLength(S);case t.BYTE:return o.getBitsLength(S)}}function d(S){return S.reduce(function(I,T){const _=I.length-1>=0?I[I.length-1]:null;return _&&_.mode===T.mode?(I[I.length-1].data+=T.data,I):(I.push(T),I)},[])}function p(S){const I=[];for(let T=0;T<S.length;T++){const _=S[T];switch(_.mode){case t.NUMERIC:I.push([_,{data:_.data,mode:t.ALPHANUMERIC,length:_.length},{data:_.data,mode:t.BYTE,length:_.length}]);break;case t.ALPHANUMERIC:I.push([_,{data:_.data,mode:t.BYTE,length:_.length}]);break;case t.KANJI:I.push([_,{data:_.data,mode:t.BYTE,length:c(_.data)}]);break;case t.BYTE:I.push([{data:_.data,mode:t.BYTE,length:c(_.data)}])}}return I}function k(S,I){const T={},_={start:{}};let O=["start"];for(let m=0;m<S.length;m++){const w=S[m],y=[];for(let g=0;g<w.length;g++){const A=w[g],b=""+m+g;y.push(b),T[b]={node:A,lastCount:0},_[b]={};for(let C=0;C<O.length;C++){const v=O[C];T[v]&&T[v].node.mode===A.mode?(_[v][b]=f(T[v].lastCount+A.length,A.mode)-f(T[v].lastCount,A.mode),T[v].lastCount+=A.length):(T[v]&&(T[v].lastCount=A.length),_[v][b]=f(A.length,A.mode)+4+t.getCharCountIndicator(A.mode,I))}}O=y}for(let m=0;m<O.length;m++)_[O[m]].end=0;return{map:_,table:T}}function P(S,I){let T;const _=t.getBestModeForData(S);if(T=t.from(I,_),T!==t.BYTE&&T.bit<_.bit)throw new Error('"'+S+'" cannot be encoded with mode '+t.toString(T)+`.
|
|
496
511
|
Suggested mode is: `+t.toString(_));switch(T===t.KANJI&&!a.isKanjiModeEnabled()&&(T=t.BYTE),T){case t.NUMERIC:return new e(S);case t.ALPHANUMERIC:return new i(S);case t.KANJI:return new r(S);case t.BYTE:return new o(S)}}n.fromArray=function(I){return I.reduce(function(T,_){return typeof _=="string"?T.push(P(_,null)):_.data&&T.push(P(_.data,_.mode)),T},[])},n.fromString=function(I,T){const _=h(I,a.isKanjiModeEnabled()),O=p(_),m=k(O,T),w=l.find_path(m.map,"start","end"),y=[];for(let g=1;g<w.length-1;g++)y.push(m.table[w[g]].node);return n.fromArray(d(y))},n.rawSplit=function(I){return n.fromArray(h(I,a.isKanjiModeEnabled()))}})(zt)),zt}var an;function ts(){if(an)return Et;an=1;const n=Y(),t=At(),e=Fr(),i=Dr(),o=Ur(),r=$r(),s=qr(),a=Ve(),l=Hr(),c=Gr(),u=Kr(),h=Q(),f=Xr();function d(m,w){const y=m.size,g=r.getPositions(w);for(let A=0;A<g.length;A++){const b=g[A][0],C=g[A][1];for(let v=-1;v<=7;v++)if(!(b+v<=-1||y<=b+v))for(let R=-1;R<=7;R++)C+R<=-1||y<=C+R||(v>=0&&v<=6&&(R===0||R===6)||R>=0&&R<=6&&(v===0||v===6)||v>=2&&v<=4&&R>=2&&R<=4?m.set(b+v,C+R,!0,!0):m.set(b+v,C+R,!1,!0))}}function p(m){const w=m.size;for(let y=8;y<w-8;y++){const g=y%2===0;m.set(y,6,g,!0),m.set(6,y,g,!0)}}function k(m,w){const y=o.getPositions(w);for(let g=0;g<y.length;g++){const A=y[g][0],b=y[g][1];for(let C=-2;C<=2;C++)for(let v=-2;v<=2;v++)C===-2||C===2||v===-2||v===2||C===0&&v===0?m.set(A+C,b+v,!0,!0):m.set(A+C,b+v,!1,!0)}}function P(m,w){const y=m.size,g=c.getEncodedBits(w);let A,b,C;for(let v=0;v<18;v++)A=Math.floor(v/3),b=v%3+y-8-3,C=(g>>v&1)===1,m.set(A,b,C,!0),m.set(b,A,C,!0)}function S(m,w,y){const g=m.size,A=u.getEncodedBits(w,y);let b,C;for(b=0;b<15;b++)C=(A>>b&1)===1,b<6?m.set(b,8,C,!0):b<8?m.set(b+1,8,C,!0):m.set(g-15+b,8,C,!0),b<8?m.set(8,g-b-1,C,!0):b<9?m.set(8,15-b-1+1,C,!0):m.set(8,15-b-1,C,!0);m.set(g-8,8,1,!0)}function I(m,w){const y=m.size;let g=-1,A=y-1,b=7,C=0;for(let v=y-1;v>0;v-=2)for(v===6&&v--;;){for(let R=0;R<2;R++)if(!m.isReserved(A,v-R)){let K=!1;C<w.length&&(K=(w[C]>>>b&1)===1),m.set(A,v-R,K),b--,b===-1&&(C++,b=7)}if(A+=g,A<0||y<=A){A-=g,g=-g;break}}}function T(m,w,y){const g=new e;y.forEach(function(R){g.put(R.mode.bit,4),g.put(R.getLength(),h.getCharCountIndicator(R.mode,m)),R.write(g)});const A=n.getSymbolTotalCodewords(m),b=a.getTotalCodewordsCount(m,w),C=(A-b)*8;for(g.getLengthInBits()+4<=C&&g.put(0,4);g.getLengthInBits()%8!==0;)g.putBit(0);const v=(C-g.getLengthInBits())/8;for(let R=0;R<v;R++)g.put(R%2?17:236,8);return _(g,m,w)}function _(m,w,y){const g=n.getSymbolTotalCodewords(w),A=a.getTotalCodewordsCount(w,y),b=g-A,C=a.getBlocksCount(w,y),v=g%C,R=C-v,K=Math.floor(g/C),it=Math.floor(b/C),rs=it+1,gn=K-it,ss=new l(gn);let Gt=0;const lt=new Array(C),mn=new Array(C);let Kt=0;const as=new Uint8Array(m.buffer);for(let tt=0;tt<C;tt++){const Qt=tt<R?it:rs;lt[tt]=as.slice(Gt,Gt+Qt),mn[tt]=ss.encode(lt[tt]),Gt+=Qt,Kt=Math.max(Kt,Qt)}const Yt=new Uint8Array(g);let pn=0,j,H;for(j=0;j<Kt;j++)for(H=0;H<C;H++)j<lt[H].length&&(Yt[pn++]=lt[H][j]);for(j=0;j<gn;j++)for(H=0;H<C;H++)Yt[pn++]=mn[H][j];return Yt}function O(m,w,y,g){let A;if(Array.isArray(m))A=f.fromArray(m);else if(typeof m=="string"){let K=w;if(!K){const it=f.rawSplit(m);K=c.getBestVersionForData(it,y)}A=f.fromString(m,K||40)}else throw new Error("Invalid data");const b=c.getBestVersionForData(A,y);if(!b)throw new Error("The amount of data is too big to be stored in a QR Code");if(!w)w=b;else if(w<b)throw new Error(`
|
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.22",
|
|
5
5
|
"author": "Virtualdisplay <support@virtualdisplay.io>",
|
|
6
6
|
"homepage": "https://virtualdisplay.io",
|
|
7
7
|
"license": "MIT",
|