@virtualdisplay.io/client 4.0.0-alpha.24 → 4.0.0-alpha.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (function(M,et){typeof exports=="object"&&typeof module<"u"?et(exports):typeof define=="function"&&define.amd?define(["exports"],et):(M=typeof globalThis<"u"?globalThis:M||self,et(M.VirtualdisplayClient={}))})(this,(function(M){"use strict";function et(n,t){for(var e=0;e<t.length;e++){const i=t[e];if(typeof i!="string"&&!Array.isArray(i)){for(const o in i)if(o!=="default"&&!(o in n)){const r=Object.getOwnPropertyDescriptor(i,o);r&&Object.defineProperty(n,o,r.get?r:{enumerable:!0,get:()=>i[o]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}const N={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"},ee={FOCUS:"focus",UNFOCUS:"unfocus"},Cn={FOCUSED:"focused"},Sn={HIDDEN:"hidden"},En=new Set(Object.values(N));function _n(n){if(typeof n!="object"||n===null)return!1;const t=n;return typeof t.target=="string"?!1:typeof t.type=="string"&&En.has(t.type)}function An(n){const t=$(n);return t!==null&&t.type===N.HANDSHAKE}function kn(n){const t=$(n);return t!==null&&t.type===N.SESSION&&typeof t.sessionId=="string"}function Tn(n){const t=$(n);return t!==null&&t.type===N.MUTATION&&Array.isArray(t.results)}function Rn(n){const t=$(n);return t!==null&&t.type===N.SNAPSHOT&&("data"in t||"error"in t)}function In(n){const t=$(n);return t!==null&&t.type===N.CAMERA&&Array.isArray(t.transforms)}function Nn(n){const t=$(n);return t!==null&&t.type===N.MAPPING&&Array.isArray(t.attributes)}function Mn(n){const t=$(n);return t!==null&&t.type===N.LOADING_INDICATOR&&typeof t.progress=="number"}function Pn(n){const t=$(n);return t!==null&&t.type===N.SYNC&&typeof t.connected=="boolean"}function Bn(n){const t=$(n);return t!==null&&t.type===N.CONFIG&&typeof t.viewerSettings=="object"}function Ln(n){const t=$(n);return t!==null&&t.type===N.FOCUS&&typeof t.state=="string"}function On(n){const t=$(n);return t!==null&&t.type===N.PRICING&&typeof t.pricing=="object"&&t.pricing!==null}function $(n){return typeof n!="object"||n===null?null:n}class ne{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 xn{constructor(t,e){this.getTarget=t,this.sourceId=`vd-${Math.random().toString(36).slice(2,8)}`,this.targetOrigin="*",this.isValid=e?.isValid??_n,this.publisher=new ne(i=>this.post(i)),this.consumer=new ne(i=>this.routeToHandler(i)),e?.bufferIncoming!==!0&&this.consumer.markReady()}getTarget;handlers=new Map;publisher;consumer;listener=null;sourceId;targetOrigin;isValid;on(t,e){this.handlers.set(t,e)}setTargetOrigin(t){this.targetOrigin=t}send(t){this.publisher.enqueue(t)}receive(t){this.isValid(t)&&this.consumer.enqueue(t)}markReady(){this.publisher.markReady()}markConsumerReady(){this.consumer.markReady()}consumerHasPending(t){return this.consumer.hasPending(t)}start(){this.listener===null&&(this.listener=t=>{const{data:e}=t;if(!this.isValid(e)||e._source===this.sourceId)return;const i=this.getTarget();if(i!==null&&t.source!==null&&t.source!==i)return;const o=e;this.consumer.enqueue(o)},window.addEventListener("message",this.listener))}destroy(){this.listener!==null&&(window.removeEventListener("message",this.listener),this.listener=null),this.publisher.clear(),this.consumer.clear(),this.handlers.clear()}get ready(){return this.publisher.ready}get pendingCount(){return this.publisher.pendingCount}post(t){const e=this.getTarget();e!==null&&e.postMessage({...t,_source:this.sourceId},this.targetOrigin)}routeToHandler(t){const e=this.handlers.get(t.type);if(e===void 0)return;const i=e(t);i instanceof Promise&&i.catch(o=>{const r=o instanceof Error?o.message:String(o);console.error(`Virtualdisplay: error handling ${t.type}: ${r}`)})}}class ie{constructor(t){this.send=t}send;setEnabled(t){this.send({type:N.ANNOTATION_TOGGLE,enabled:t})}}class oe{constructor(t,e){this.value=t,this.attribute=e}value;attribute;isSelectedValue=!1;get isSelected(){return this.isSelectedValue}setSelected(t){this.isSelectedValue=t}}const q={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 x extends Error{code;constructor(t,e){super(t),this.name="VirtualdisplayError",this.code=e}static valueNotFound(t,e){return new x(`Value "${e}" not found for attribute "${t}"`,q.VALUE_NOT_FOUND)}static parentNotFound(t){return new x(`Parent element not found: ${t}`,q.PARENT_NOT_FOUND)}static invalidParameter(t){return new x(t,q.INVALID_PARAMETER)}}class re{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 x.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 oe(i,this.name);i===this.defaultValue&&o.setSelected(!0),e.set(i,o)}return e}}class zn{attributes=new Map;constructor(t,e,i){for(const o of t){const r=this.buildOptions(o,e);this.attributes.set(o.name,new re(r))}this.onMutationFailed=i}onMutationFailed;get(t){return this.attributes.get(t)}getSelection(){const t={};for(const[e,i]of this.attributes){const o=i.selected;o!==void 0&&(t[e]=o)}return t}handleResults(t){for(const e of t){if(!e.success){this.onMutationFailed?.(e.name,e.value);continue}this.get(e.name)?.handleResult(e.value)}}buildOptions(t,e){const i={name:t.name,values:t.values,onSelect:(o,r)=>{e([{name:o,value:r}],!1)}};return t.defaultValue!==void 0?{...i,defaultValue:t.defaultValue}:i}}const rt=4096,dt=16384,Dn=[1024,256,64],Fn=20,ht=["timestamp","level","msg","service","trace_id","span_id"];function Un(n){const t=new Date(n.timestamp).toLocaleTimeString("en-GB",{hour12:!1}),e=n.level.toUpperCase().padEnd(5),i=n.trace_id?.slice(0,8)??"--------",o=n.msg,r=Object.entries(n).filter(([s])=>!ht.includes(s)).map(([s,a])=>`${s}=${nt(a,rt).line}`).join(" ");return`${t} ${e} [${i}] ${o}${r?" "+r:""}`}function $n(n){for(const o of[rt,...Dn]){const{line:r,truncated:s}=nt(n,o);if(!s){if(r.length<=dt)return r;continue}const{line:a}=nt({...n,log_truncated:!0},o);if(a.length<=dt)return a}const t=Object.keys(n).filter(o=>!ht.includes(o)),e={...Vn(n,ht),log_truncated:!0,log_dropped_count:t.length},i=nt({...e,log_dropped_attrs:t.slice(0,Fn)},rt);return i.line.length<=dt?i.line:nt(e,rt).line}function nt(n,t){const e=[];let i=!1;return{line:JSON.stringify(n,function(s,a){if(typeof a=="string")return a.length>t&&(i=!0),qn(a,t);if(typeof a=="bigint")return a.toString();if(typeof a!="object"||a===null)return a;for(;e.length>0&&e.at(-1)!==this;)e.pop();return e.includes(a)?"[Circular]":(e.push(a),a)}),truncated:i}}function qn(n,t){return n.length<=t?n:`${n.slice(0,t)}...[truncated ${n.length-t} chars]`}function Vn(n,t){const e={};for(const i of t)n[i]!==void 0&&(e[i]=n[i]);return e}function jn(n,t){const e=t?Un(n):$n(n);n.level==="error"?console.error(e):n.level==="warn"?console.warn(e):console.log(e)}function se(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?se(n.cause,t+1):String(n.cause)),e}function Hn(n){const t={};for(const[e,i]of Object.entries(n))t[e]=i instanceof Error?se(i):i;return t}function Gn(){return new Date}function Kn(n){return n.toISOString()}function ae(){return typeof navigator>"u"?"":navigator.userAgent}function Yn(){return typeof navigator>"u"?!1:navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1}function Qn(){return/iPhone|iPad|iPod/i.test(ae())||Yn()}function Jn(){return/Android/i.test(ae())}function Zn(){return Qn()||Jn()}class Wn{constructor(t){this.config=t}config;log(t,e,i={}){const o=this.config.traceProvider?.()??{},r={timestamp:Kn(Gn()),level:t,msg:e,service:this.config.service,...o,...Hn(i)};jn(r,this.config.isDev)}debug(t,e){this.config.isDev&&this.log("debug",t,e)}info(t,e){this.log("info",t,e)}warn(t,e){this.log("warn",t,e)}error(t,e){this.log("error",t,e)}}function le(n,t){const e=t?.isDev!==void 0?t.isDev:typeof process<"u"?process.env.NODE_ENV!=="production":!0;return new Wn({service:n,isDev:e,traceProvider:t?.traceProvider})}function st(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 ce(n){return{debug:(t,e)=>n.debug(t,st(e)),info:(t,e)=>n.info(t,st(e)),warn:(t,e)=>n.warn(t,st(e)),error:(t,e)=>n.error(t,st(e))}}let ue=!1;M.logger=ce(le("client",{isDev:!1}));function de(){ue=!0,M.logger=ce(le("client",{isDev:!0}))}function Xn(){return ue}class ti{constructor(t,e){this.send=t,this.onMutationFailed=e}send;onMutationFailed;registry;pendingCallbacks=[];handleMappingReceived(t){M.logger.debug("Initializing from server mapping",{attributeCount:t.attributes.length}),this.registry=new zn(t.attributes,(e,i)=>this.sendMutation(e,i),this.onMutationFailed),this.replayPendingCallbacks()}handleMutationResult(t){this.registry?.handleResults(t.results)}select(t,e){this.sendMutation([{name:t,value:e}],!1)}getValues(t){return this.registry?.get(t)?.getValues()??[]}getValue(t,e){return this.registry?.get(t)?.getValue(e)}onChange(t,e){if(this.registry===void 0){this.pendingCallbacks.push({name:t,callback:e});return}const i=this.registry.get(t);if(i===void 0){M.logger.warn(`onChange: attribute "${t}" not found — callback will not fire`);return}i.onChange(e)}getAttribute(t){return this.registry?.get(t)}getSelection(){return this.registry?.getSelection()??{}}get hasMapping(){return this.registry!==void 0}sendMutation(t,e){const i={type:N.MUTATION,mutations:t,isInitial:e};this.send(i)}replayPendingCallbacks(){for(const{name:t,callback:e}of this.pendingCallbacks){const i=this.registry?.get(t);i===void 0&&M.logger.warn(`onChange: attribute "${t}" not found — buffered callback will not fire`),i?.onChange(e)}this.pendingCallbacks.length=0}}let he=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 x.invalidParameter("No camera commands to execute. Call rotate(), tilt(), or zoom() before set().");const t={type:N.CAMERA,commands:this.commands};this.send(t),this.commands=[]}validateFiniteNumber(t,e){if(!Number.isFinite(t))throw x.invalidParameter(`${e}() requires a finite number, got ${String(t)}`)}reset(){const t={type:N.CAMERA,commands:[{action:"reset"}]};this.send(t)}};class ei{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 ni(n,t){const e=n.filter(r=>ii(r,t));if(e.length===0)return;const i=Math.max(...e.map(fe)),o=e.filter(r=>fe(r)===i);return o.length===1?o[0]:void 0}function ii(n,t){return Object.entries(n.attributes).every(([e,i])=>t[e]===i)}function fe(n){return Object.keys(n.attributes).length}class ge{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=ni(this.pricing.rules,this.selection);if(!(t===void 0||t.availability===Sn.HIDDEN))return{attributes:{...this.selection},reference:t.reference,price:t.priceCents,currency:this.pricing.currency,availability:t.availability}}}class me{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 x.invalidParameter(`set() requires a non-empty component name, got ${String(t)}`);this.send({type:N.FOCUS,action:ee.FOCUS,component:t})}clear(){this.send({type:N.FOCUS,action:ee.UNFOCUS})}onChange(t){this.changeCallbacks.push(t)}handleStateReceived(t){t.state===Cn.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 pe{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 be=3e4;class ve{constructor(t){this.send=t}send;validExtensions=[".png"];pendingPhotos=new Map;take(t){this.validateFilename(t),M.logger.debug("Taking snapshot",{filename:t});const e=new pe(t),i=setTimeout(()=>{this.pendingPhotos.delete(t),M.logger.warn("Snapshot timed out",{filename:t}),e.fail(new x(`Snapshot timed out: the viewer did not respond within ${be}ms`,q.SNAPSHOT_FAILED))},be);return this.pendingPhotos.set(t,{photo:e,timeout:i}),this.send({type:N.SNAPSHOT,filename:t}),e}handleSnapshotResult(t){const e=this.pendingPhotos.get(t.filename);if(e===void 0){M.logger.warn("No pending photo found for filename",{filename:t.filename,pendingFilenames:Array.from(this.pendingPhotos.keys())});return}clearTimeout(e.timeout),this.pendingPhotos.delete(t.filename);const{photo:i}=e;if(t.error!==void 0){i.fail(new x(t.error,q.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 x("Client destroyed before snapshot completed",q.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 x("Filename must be a non-empty string",q.INVALID_PARAMETER);if(!this.validExtensions.some(i=>t.toLowerCase().endsWith(i)))throw new x(`Invalid filename: "${t}". Filename must end with one of: ${this.validExtensions.join(", ")}`,q.INVALID_PARAMETER);if(t.includes("..")||t.includes("/")||t.includes("\\"))throw new x('Filename cannot contain path separators or ".."',q.INVALID_PARAMETER)}}class oi{container=null;attach(t){this.container=t}dispatch(t,e,i=!1){const o=new CustomEvent(t,{detail:e,cancelable:i});return this.container?.dispatchEvent(o),o}on(t,e){const i=o=>{const r=o,s={...r.detail,preventDefault:()=>{r.preventDefault()}};e(s)};return this.container?.addEventListener(t,i),()=>{this.container?.removeEventListener(t,i)}}}const ri={},si="en",ye=["en","nl","de"],ft=["baseLocale"],we=[],gt=typeof window>"u";globalThis.__paraglide=globalThis.__paraglide??{},globalThis.__paraglide.ssr=globalThis.__paraglide.ssr??{};let Ce=!1,P=()=>{let n=ft;!gt&&typeof window<"u"&&window.location?.href&&(n=Ae(window.location.href));const t=ai(n);if(t)return Ce||(Ce=!0,Se(t,{reload:!1})),t;throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found")};function ai(n,t){let e;for(const i of n){if(i==="baseLocale")e=si;else if(ke(i)&&at.has(i)){const r=at.get(i);if(r){const s=r.getLocale();if(s instanceof Promise)continue;if(s!==void 0)return ui(s)}}const o=mt(e);if(o)return o}}const li=n=>{window.location.reload()};let Se=(n,t)=>{const e={reload:!0,...t};let i;try{i=P()}catch{}const o=[];let r=ft;!gt&&typeof window<"u"&&window.location?.href&&(r=Ae(window.location.href));for(const a of r)if(a!=="baseLocale"&&ke(a)&&at.has(a)){const l=at.get(a);if(l){let c=l.setLocale(n);c instanceof Promise&&(c=c.catch(u=>{throw new Error(`Custom strategy "${a}" setLocale failed.`,{cause:u})}),o.push(c))}}const s=()=>{!gt&&e.reload&&window.location&&n!==i&&li()};if(o.length)return Promise.all(o).then(()=>{s()});s()},ci=()=>typeof window<"u"?window.location.origin:"http://fallback.com";function mt(n){if(typeof n!="string")return;const t=n.toLowerCase();for(const e of ye)if(e.toLowerCase()===t)return e}function ui(n){const t=mt(n);if(t)return t;throw new Error(`Invalid locale: ${n}. Expected one of: ${ye.join(", ")}`)}function di(n){return hi(n)}function hi(n){const t=typeof n=="string"?new URL(n,ci()):new URL(n),e=t.pathname.split("/").filter(Boolean);return e.length>0&&mt(e[0])&&(t.pathname="/"+e.slice(1).join("/")),t}let Ee,_e;function fi(n){if(we.length===0)return;const t=typeof n=="string"?n:n.href;if(Ee===t)return _e;const e=new URL(t,"http://example.com"),i=di(e),o=i.href===e.href?[e]:[e,i];let r;for(const s of o){for(const a of we)if(new ri(a.match,s.href).exec(s.href)){r=a;break}if(r)break}return Ee=t,_e=r,r}function Ae(n){const t=fi(n);return t&&t.exclude!==!0&&Array.isArray(t.strategy)?t.strategy:ft}const at=new Map;function ke(n){return typeof n=="string"&&/^custom-[A-Za-z0-9_-]+$/.test(n)}const gi=()=>"Activate AR",mi=()=>"AR activeren",pi=()=>"AR aktivieren",bi=((n={},t={})=>{const e=t.locale??P();return e==="nl"?mi():e==="de"?pi():gi()}),vi=()=>"Scan to view in AR",yi=()=>"Scan om in AR te bekijken",wi=()=>"Scannen für AR-Ansicht",Ci=((n={},t={})=>{const e=t.locale??P();return e==="nl"?yi():e==="de"?wi():vi()}),Si=()=>"Use your smartphone camera to scan this QR code",Ei=()=>"Gebruik de camera van je smartphone om deze QR-code te scannen",_i=()=>"Verwende die Kamera deines Smartphones, um diesen QR-Code zu scannen",Ai=((n={},t={})=>{const e=t.locale??P();return e==="nl"?Ei():e==="de"?_i():Si()}),ki=()=>"Your phone will open the 3D model in AR mode.",Ti=()=>"Je telefoon opent het 3D-model in AR-modus.",Ri=()=>"Dein Telefon öffnet das 3D-Modell im AR-Modus.",Ii=((n={},t={})=>{const e=t.locale??P();return e==="nl"?Ti():e==="de"?Ri():ki()}),Ni=()=>"Close",Mi=()=>"Sluiten",Pi=()=>"Schließen",Bi=((n={},t={})=>{const e=t.locale??P();return e==="nl"?Mi():e==="de"?Pi():Ni()}),Li=()=>"Fullscreen",Oi=()=>"Volledig scherm",xi=()=>"Vollbild",zi=((n={},t={})=>{const e=t.locale??P();return e==="nl"?Oi():e==="de"?xi():Li()}),Di=()=>"Downloading",Fi=()=>"Downloaden",Ui=()=>"Herunterladen",Te=((n={},t={})=>{const e=t.locale??P();return e==="nl"?Fi():e==="de"?Ui():Di()}),$i=()=>"Rendering",qi=()=>"Renderen",Vi=()=>"Rendern",ji=((n={},t={})=>{const e=t.locale??P();return e==="nl"?qi():e==="de"?Vi():$i()}),Hi=()=>"Screenshot",Gi=()=>"Screenshot",Ki=()=>"Screenshot",Yi=((n={},t={})=>{const e=t.locale??P();return e==="nl"?Gi():e==="de"?Ki():Hi()}),Qi=()=>"Configure",Ji=()=>"Configureren",Zi=()=>"Konfigurieren",Wi=((n={},t={})=>{const e=t.locale??P();return e==="nl"?Ji():e==="de"?Zi():Qi()}),Xi=()=>"Close",to=()=>"Sluiten",eo=()=>"Schließen",no=((n={},t={})=>{const e=t.locale??P();return e==="nl"?to():e==="de"?eo():Xi()}),io=()=>"Reset camera",oo=()=>"Camera resetten",ro=()=>"Kamera zurücksetzen",so=((n={},t={})=>{const e=t.locale??P();return e==="nl"?oo():e==="de"?ro():io()}),ao=()=>"Zoom in",lo=()=>"Inzoomen",co=()=>"Hineinzoomen",uo=((n={},t={})=>{const e=t.locale??P();return e==="nl"?lo():e==="de"?co():ao()}),ho=()=>"Zoom out",fo=()=>"Uitzoomen",go=()=>"Herauszoomen",mo=((n={},t={})=>{const e=t.locale??P();return e==="nl"?fo():e==="de"?go():ho()}),po=()=>"Rotate left",bo=()=>"Naar links draaien",vo=()=>"Nach links drehen",yo=((n={},t={})=>{const e=t.locale??P();return e==="nl"?bo():e==="de"?vo():po()}),wo=()=>"Rotate right",Co=()=>"Naar rechts draaien",So=()=>"Nach rechts drehen",Eo=((n={},t={})=>{const e=t.locale??P();return e==="nl"?Co():e==="de"?So():wo()}),_o=()=>"Tilt up",Ao=()=>"Omhoog kantelen",ko=()=>"Nach oben kippen",To=((n={},t={})=>{const e=t.locale??P();return e==="nl"?Ao():e==="de"?ko():_o()}),Ro=()=>"Tilt down",Io=()=>"Omlaag kantelen",No=()=>"Nach unten kippen",Mo=((n={},t={})=>{const e=t.locale??P();return e==="nl"?Io():e==="de"?No():Ro()}),Po=()=>"Working…",Bo=()=>"Bezig…",Lo=()=>"Läuft…",Oo=((n={},t={})=>{const e=t.locale??P();return e==="nl"?Bo():e==="de"?Lo():Po()}),xo=()=>"Done",zo=()=>"Gelukt",Do=()=>"Fertig",Fo=((n={},t={})=>{const e=t.locale??P();return e==="nl"?zo():e==="de"?Do():xo()}),Uo=()=>"Failed",$o=()=>"Mislukt",qo=()=>"Fehlgeschlagen",Vo=((n={},t={})=>{const e=t.locale??P();return e==="nl"?$o():e==="de"?qo():Uo()});const jo={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 Re=([n,t,e])=>{const i=document.createElementNS("http://www.w3.org/2000/svg",n);return Object.keys(t).forEach(o=>{i.setAttribute(o,String(t[o]))}),e?.length&&e.forEach(o=>{const r=Re(o);i.appendChild(r)}),i},Ie=(n,t={})=>{const i={...jo,...t};return Re(["svg",i,n])};const Ho=[["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 Go=[["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 Ne=[["path",{d:"m6 9 6 6 6-6"}]];const Ko=[["path",{d:"m15 18-6-6 6-6"}]];const Yo=[["path",{d:"m9 18 6-6-6-6"}]];const Qo=[["path",{d:"m18 15-6-6-6 6"}]];const Jo=[["path",{d:"M15 3h6v6"}],["path",{d:"m21 3-7 7"}],["path",{d:"m3 21 7-7"}],["path",{d:"M9 21H3v-6"}]];const Zo=[["path",{d:"m14 10 7-7"}],["path",{d:"M20 10h-6V4"}],["path",{d:"m3 21 7-7"}],["path",{d:"M4 14h6v6"}]];const Wo=[["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 Xo=[["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 tr=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];const er=[["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"}]];const nr=[["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"}]];function F(n,{size:t=20,strokeWidth:e=1.75}={}){return Ie(n,{width:t,height:t,"stroke-width":e})}const z={ar:n=>F(Ho,n),fullscreen:n=>F(Jo,n),exitFullscreen:n=>F(Zo,n),screenshot:n=>F(Go,n),tiltUp:n=>F(Qo,n),tiltDown:n=>F(Ne,n),rotateLeft:n=>F(Ko,n),rotateRight:n=>F(Yo,n),zoomIn:n=>F(nr,n),zoomOut:n=>F(er,n),reset:n=>F(Wo,n),configurator:n=>F(Xo,n),close:n=>F(tr,n)};class D{element;constructor({variant:t="default",size:e="default",label:i,icon:o,onClick:r,disabled:s=!1}={}){this.element=document.createElement("button"),this.element.className=`ui-btn ui-btn--${t} ui-btn--size-${e}`,i!==void 0&&(this.element.setAttribute("aria-label",i),this.element.title=i),o!==void 0?this.element.appendChild(o):i!==void 0&&(this.element.textContent=i),r&&this.element.addEventListener("click",r),this.element.disabled=s}setIcon(t){const e=this.element.querySelector("svg");e!==null?e.replaceWith(t):this.element.appendChild(t)}}const L={semantic:{error:"#dc2626"},neutral:{500:"#737373",600:"#525252",900:"#171717"},white:"#ffffff",black:"#000000"},R={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 ir{element;constructor(){this.element=document.createElement("div"),Object.assign(this.element.style,{background:L.white,borderRadius:R[3],padding:R[6],boxShadow:`0 ${R[2]} ${R[8]} oklch(0% 0 0 / 20%)`,maxWidth:"20rem",width:"100%"})}}class or{constructor(t={}){this.options=t,this.card=new ir,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:R[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 rr{element;selectCallback=null;constructor(t,e,i){this.element=document.createElement("div"),this.element.className="ui-toggle-group";for(let o=0;o<t.length;o++){const r=t[o],s=document.createElement("button");s.className="ui-toggle-group-item",s.dataset.value=r,s.textContent=i?.[o]??r,s.dataset.state=r===e?"on":"off",s.setAttribute("aria-pressed",r===e?"true":"false"),s.addEventListener("click",()=>{this.selectCallback?.(r)}),this.element.appendChild(s)}}setSelected(t){for(const e of this.element.querySelectorAll(".ui-toggle-group-item")){const i=e.dataset.value===t;e.dataset.state=i?"on":"off",e.setAttribute("aria-pressed",i?"true":"false")}}onSelect(t){this.selectCallback=t}}class sr{element;select;constructor(t,e,i,o,r){this.select=document.createElement("select"),this.select.className="ui-native-select",this.select.dataset.name=t,this.select.setAttribute("aria-label",i);const s=document.createElement("option");s.value="",s.disabled=!0,s.textContent=i,this.select.appendChild(s);let a=!1;for(let c=0;c<e.length;c++){const u=e[c],h=document.createElement("option");h.value=u,h.textContent=r?.[c]??u,u===o&&(h.selected=!0,a=!0),this.select.appendChild(h)}a||(s.selected=!0);const l=Ie(Ne,{width:16,height:16,"stroke-width":2});l.classList.add("ui-native-select-icon"),this.element=document.createElement("div"),this.element.className="ui-native-select-wrap",this.element.appendChild(this.select),this.element.appendChild(l)}setSelected(t){this.select.value=t}onSelect(t){this.select.addEventListener("change",()=>{t(this.select.value)})}}const U={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"}},J=U.fontFamily.sans.join(", "),ar=`
1
+ (function(N,et){typeof exports=="object"&&typeof module<"u"?et(exports):typeof define=="function"&&define.amd?define(["exports"],et):(N=typeof globalThis<"u"?globalThis:N||self,et(N.VirtualdisplayClient={}))})(this,(function(N){"use strict";function et(n,t){for(var e=0;e<t.length;e++){const i=t[e];if(typeof i!="string"&&!Array.isArray(i)){for(const o in i)if(o!=="default"&&!(o in n)){const r=Object.getOwnPropertyDescriptor(i,o);r&&Object.defineProperty(n,o,r.get?r:{enumerable:!0,get:()=>i[o]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}const I={HANDSHAKE:"handshake",SESSION:"session",MUTATION:"mutation",STATE:"state",LOADING_INDICATOR:"loading_indicator",CAMERA:"camera",SNAPSHOT:"snapshot",MAPPING:"mapping",AR_ACTIVATE:"ar_activate",FULLSCREEN:"fullscreen",CONFIG:"config",ANNOTATION_TOGGLE:"annotation_toggle",FOCUS:"focus",PRICING:"pricing",QR_SHOWN:"qr_shown",SYNC:"sync",SELECTABLE:"selectable",APP_RESOLVED:"app_resolved"},ee={FOCUS:"focus",UNFOCUS:"unfocus"},En={FOCUSED:"focused"},_n={HIDDEN:"hidden"},An=new Set(Object.values(I));function kn(n){if(typeof n!="object"||n===null)return!1;const t=n;return typeof t.target=="string"?!1:typeof t.type=="string"&&An.has(t.type)}function Tn(n){const t=F(n);return t!==null&&t.type===I.HANDSHAKE}function Rn(n){const t=F(n);return t!==null&&t.type===I.SESSION&&typeof t.sessionId=="string"}function In(n){const t=F(n);return t!==null&&t.type===I.APP_RESOLVED&&typeof t.appType=="string"&&t.appType!==""&&typeof t.name=="string"}function Mn(n){const t=F(n);return t!==null&&t.type===I.MUTATION&&Array.isArray(t.results)}function Nn(n){const t=F(n);return t!==null&&t.type===I.SNAPSHOT&&("data"in t||"error"in t)}function Pn(n){const t=F(n);return t!==null&&t.type===I.CAMERA&&Array.isArray(t.transforms)}function Ln(n){const t=F(n);return t!==null&&t.type===I.MAPPING&&Array.isArray(t.attributes)}function Bn(n){const t=F(n);return t!==null&&t.type===I.LOADING_INDICATOR&&typeof t.progress=="number"}function xn(n){const t=F(n);return t!==null&&t.type===I.SYNC&&typeof t.connected=="boolean"}function On(n){const t=F(n);return t!==null&&t.type===I.SELECTABLE&&Array.isArray(t.attributes)}function zn(n){const t=F(n);return t!==null&&t.type===I.CONFIG&&typeof t.viewerSettings=="object"}function Dn(n){const t=F(n);return t!==null&&t.type===I.FOCUS&&typeof t.state=="string"}function Fn(n){const t=F(n);return t!==null&&t.type===I.PRICING&&typeof t.pricing=="object"&&t.pricing!==null}function F(n){return typeof n!="object"||n===null?null:n}class ne{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 Un{constructor(t,e){this.getTarget=t,this.sourceId=`vd-${Math.random().toString(36).slice(2,8)}`,this.targetOrigin="*",this.isValid=e?.isValid??kn,this.publisher=new ne(i=>this.post(i)),this.consumer=new ne(i=>this.routeToHandler(i)),e?.bufferIncoming!==!0&&this.consumer.markReady()}getTarget;handlers=new Map;publisher;consumer;listener=null;sourceId;targetOrigin;isValid;on(t,e){this.handlers.set(t,e)}setTargetOrigin(t){this.targetOrigin=t}send(t){this.publisher.enqueue(t)}receive(t){this.isValid(t)&&this.consumer.enqueue(t)}markReady(){this.publisher.markReady()}markConsumerReady(){this.consumer.markReady()}consumerHasPending(t){return this.consumer.hasPending(t)}start(){this.listener===null&&(this.listener=t=>{const{data:e}=t;if(!this.isValid(e)||e._source===this.sourceId)return;const i=this.getTarget();if(i!==null&&t.source!==null&&t.source!==i)return;const o=e;this.consumer.enqueue(o)},window.addEventListener("message",this.listener))}destroy(){this.listener!==null&&(window.removeEventListener("message",this.listener),this.listener=null),this.publisher.clear(),this.consumer.clear(),this.handlers.clear()}get ready(){return this.publisher.ready}get pendingCount(){return this.publisher.pendingCount}post(t){const e=this.getTarget();e!==null&&e.postMessage({...t,_source:this.sourceId},this.targetOrigin)}routeToHandler(t){const e=this.handlers.get(t.type);if(e===void 0)return;const i=e(t);i instanceof Promise&&i.catch(o=>{const r=o instanceof Error?o.message:String(o);console.error(`Virtualdisplay: error handling ${t.type}: ${r}`)})}}class ie{constructor(t){this.send=t}send;setEnabled(t){this.send({type:I.ANNOTATION_TOGGLE,enabled:t})}}class oe{constructor(t,e){this.value=t,this.attribute=e}value;attribute;isSelectedValue=!1;get isSelected(){return this.isSelectedValue}setSelected(t){this.isSelectedValue=t}}const $={NO_MAPPING:"NO_MAPPING",ATTRIBUTE_NOT_FOUND:"ATTRIBUTE_NOT_FOUND",VALUE_NOT_FOUND:"VALUE_NOT_FOUND",PARENT_NOT_FOUND:"PARENT_NOT_FOUND",INVALID_PARAMETER:"INVALID_PARAMETER",SNAPSHOT_FAILED:"SNAPSHOT_FAILED"};class O extends Error{code;constructor(t,e){super(t),this.name="VirtualdisplayError",this.code=e}static valueNotFound(t,e){return new O(`Value "${e}" not found for attribute "${t}"`,$.VALUE_NOT_FOUND)}static parentNotFound(t){return new O(`Parent element not found: ${t}`,$.PARENT_NOT_FOUND)}static invalidParameter(t){return new O(t,$.INVALID_PARAMETER)}}class re{name;defaultValue;values;onSelect;onChangeCallback;constructor(t){this.name=t.name,this.defaultValue=t.defaultValue,this.onSelect=t.onSelect,this.values=this.createValues(t.values)}select(t){if(!this.values.has(t))throw O.valueNotFound(this.name,t);this.onSelect(this.name,t)}getValues(){return Array.from(this.values.values())}getValue(t){return this.values.get(t)}get selected(){for(const t of this.values.values())if(t.isSelected)return t.value}onChange(t){this.onChangeCallback=t}handleResult(t){let e;for(const i of this.values.values()){const o=i.value===t;i.setSelected(o),o&&(e=i)}e!==void 0&&this.onChangeCallback!==void 0&&this.onChangeCallback(e)}createValues(t){const e=new Map;for(const i of t){const o=new oe(i,this.name);i===this.defaultValue&&o.setSelected(!0),e.set(i,o)}return e}}class Vn{attributes=new Map;constructor(t,e,i){for(const o of t){const r=this.buildOptions(o,e);this.attributes.set(o.name,new re(r))}this.onMutationFailed=i}onMutationFailed;get(t){return this.attributes.get(t)}getSelection(){const t={};for(const[e,i]of this.attributes){const o=i.selected;o!==void 0&&(t[e]=o)}return t}handleResults(t){for(const e of t){if(!e.success){this.onMutationFailed?.(e.name,e.value);continue}this.get(e.name)?.handleResult(e.value)}}buildOptions(t,e){const i={name:t.name,values:t.values,onSelect:(o,r)=>{e([{name:o,value:r}],!1)}};return t.defaultValue!==void 0?{...i,defaultValue:t.defaultValue}:i}}const rt=4096,dt=16384,$n=[1024,256,64],qn=20,ht=["timestamp","level","msg","service","trace_id","span_id"];function jn(n){const t=new Date(n.timestamp).toLocaleTimeString("en-GB",{hour12:!1}),e=n.level.toUpperCase().padEnd(5),i=n.trace_id?.slice(0,8)??"--------",o=n.msg,r=Object.entries(n).filter(([s])=>!ht.includes(s)).map(([s,a])=>`${s}=${nt(a,rt).line}`).join(" ");return`${t} ${e} [${i}] ${o}${r?" "+r:""}`}function Hn(n){for(const o of[rt,...$n]){const{line:r,truncated:s}=nt(n,o);if(!s){if(r.length<=dt)return r;continue}const{line:a}=nt({...n,log_truncated:!0},o);if(a.length<=dt)return a}const t=Object.keys(n).filter(o=>!ht.includes(o)),e={...Kn(n,ht),log_truncated:!0,log_dropped_count:t.length},i=nt({...e,log_dropped_attrs:t.slice(0,qn)},rt);return i.line.length<=dt?i.line:nt(e,rt).line}function nt(n,t){const e=[];let i=!1;return{line:JSON.stringify(n,function(s,a){if(typeof a=="string")return a.length>t&&(i=!0),Gn(a,t);if(typeof a=="bigint")return a.toString();if(typeof a!="object"||a===null)return a;for(;e.length>0&&e.at(-1)!==this;)e.pop();return e.includes(a)?"[Circular]":(e.push(a),a)}),truncated:i}}function Gn(n,t){return n.length<=t?n:`${n.slice(0,t)}...[truncated ${n.length-t} chars]`}function Kn(n,t){const e={};for(const i of t)n[i]!==void 0&&(e[i]=n[i]);return e}function Yn(n,t){const e=t?jn(n):Hn(n);n.level==="error"?console.error(e):n.level==="warn"?console.warn(e):console.log(e)}function se(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?se(n.cause,t+1):String(n.cause)),e}function Qn(n){const t={};for(const[e,i]of Object.entries(n))t[e]=i instanceof Error?se(i):i;return t}function Jn(){return new Date}function Zn(n){return n.toISOString()}function ae(){return typeof navigator>"u"?"":navigator.userAgent}function Wn(){return typeof navigator>"u"?!1:navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1}function Xn(){return/iPhone|iPad|iPod/i.test(ae())||Wn()}function ti(){return/Android/i.test(ae())}function ei(){return Xn()||ti()}class ni{constructor(t){this.config=t}config;log(t,e,i={}){const o=this.config.traceProvider?.()??{},r={timestamp:Zn(Jn()),level:t,msg:e,service:this.config.service,...o,...Qn(i)};Yn(r,this.config.isDev)}debug(t,e){this.config.isDev&&this.log("debug",t,e)}info(t,e){this.log("info",t,e)}warn(t,e){this.log("warn",t,e)}error(t,e){this.log("error",t,e)}}function le(n,t){const e=t?.isDev!==void 0?t.isDev:typeof process<"u"?process.env.NODE_ENV!=="production":!0;return new ni({service:n,isDev:e,traceProvider:t?.traceProvider})}function st(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 ce(n){return{debug:(t,e)=>n.debug(t,st(e)),info:(t,e)=>n.info(t,st(e)),warn:(t,e)=>n.warn(t,st(e)),error:(t,e)=>n.error(t,st(e))}}let ue=!1;N.logger=ce(le("client",{isDev:!1}));function de(){ue=!0,N.logger=ce(le("client",{isDev:!0}))}function ii(){return ue}class oi{constructor(t,e){this.send=t,this.onMutationFailed=e}send;onMutationFailed;registry;pendingCallbacks=[];handleMappingReceived(t){N.logger.debug("Initializing from server mapping",{attributeCount:t.attributes.length}),this.registry=new Vn(t.attributes,(e,i)=>this.sendMutation(e,i),this.onMutationFailed),this.replayPendingCallbacks()}handleMutationResult(t){this.registry?.handleResults(t.results)}select(t,e){this.sendMutation([{name:t,value:e}],!1)}selectTransient(t,e){this.sendMutation([{name:t,value:e}],!1,!0)}getValues(t){return this.registry?.get(t)?.getValues()??[]}getValue(t,e){return this.registry?.get(t)?.getValue(e)}onChange(t,e){if(this.registry===void 0){this.pendingCallbacks.push({name:t,callback:e});return}const i=this.registry.get(t);if(i===void 0){N.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,i=!1){const o={type:I.MUTATION,mutations:t,isInitial:e,...i&&{transient:!0}};this.send(o)}replayPendingCallbacks(){for(const{name:t,callback:e}of this.pendingCallbacks){const i=this.registry?.get(t);i===void 0&&N.logger.warn(`onChange: attribute "${t}" not found — buffered callback will not fire`),i?.onChange(e)}this.pendingCallbacks.length=0}}class ri{snapshot;callbacks=[];handleSnapshot(t){this.snapshot=t.attributes;for(const e of this.callbacks)e(t.attributes)}onChange(t){this.callbacks.push(t),this.snapshot!==void 0&&t(this.snapshot)}selectableFor(t){return this.snapshot?.find(i=>i.name===t)?.selectable??null}get current(){return this.snapshot??[]}}let he=class{constructor(t){this.send=t}send;commands=[];rotate(t){return this.validateFiniteNumber(t,"rotate"),this.commands.push({action:"rotate",value:t}),this}tilt(t){return this.validateFiniteNumber(t,"tilt"),this.commands.push({action:"tilt",value:t}),this}zoom(t){return this.validateFiniteNumber(t,"zoom"),this.commands.push({action:"zoom",value:t}),this}set(){if(this.commands.length===0)throw O.invalidParameter("No camera commands to execute. Call rotate(), tilt(), or zoom() before set().");const t={type:I.CAMERA,commands:this.commands};this.send(t),this.commands=[]}validateFiniteNumber(t,e){if(!Number.isFinite(t))throw O.invalidParameter(`${e}() requires a finite number, got ${String(t)}`)}reset(){const t={type:I.CAMERA,commands:[{action:"reset"}]};this.send(t)}};class si{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 ai(n,t){const e=n.filter(r=>li(r,t));if(e.length===0)return;const i=Math.max(...e.map(fe)),o=e.filter(r=>fe(r)===i);return o.length===1?o[0]:void 0}function li(n,t){return Object.entries(n.attributes).every(([e,i])=>t[e]===i)}function fe(n){return Object.keys(n.attributes).length}class me{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=ai(this.pricing.rules,this.selection);if(!(t===void 0||t.availability===_n.HIDDEN))return{attributes:{...this.selection},reference:t.reference,price:t.priceCents,currency:this.pricing.currency,availability:t.availability}}}class ge{constructor(t,e){this.send=t,this.dispatch=e}send;dispatch;focused=null;attributes=[];changeCallbacks=[];get current(){return this.focused}set(t){if(typeof t!="string"||t.length===0)throw O.invalidParameter(`set() requires a non-empty component name, got ${String(t)}`);this.send({type:I.FOCUS,action:ee.FOCUS,component:t})}clear(){this.send({type:I.FOCUS,action:ee.UNFOCUS})}onChange(t){this.changeCallbacks.push(t)}handleStateReceived(t){t.state===En.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 pe{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 be=3e4;class ve{constructor(t){this.send=t}send;validExtensions=[".png"];pendingPhotos=new Map;take(t){this.validateFilename(t),N.logger.debug("Taking snapshot",{filename:t});const e=new pe(t),i=setTimeout(()=>{this.pendingPhotos.delete(t),N.logger.warn("Snapshot timed out",{filename:t}),e.fail(new O(`Snapshot timed out: the viewer did not respond within ${be}ms`,$.SNAPSHOT_FAILED))},be);return this.pendingPhotos.set(t,{photo:e,timeout:i}),this.send({type:I.SNAPSHOT,filename:t}),e}handleSnapshotResult(t){const e=this.pendingPhotos.get(t.filename);if(e===void 0){N.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 O(t.error,$.SNAPSHOT_FAILED));return}t.data!==void 0&&i.develop({filename:t.filename,data:t.data})}clear(){if(this.pendingPhotos.size===0)return;const t=new O("Client destroyed before snapshot completed",$.SNAPSHOT_FAILED);for(const{photo:e,timeout:i}of this.pendingPhotos.values())clearTimeout(i),e.fail(t);this.pendingPhotos.clear()}validateFilename(t){if(t===""||typeof t!="string")throw new O("Filename must be a non-empty string",$.INVALID_PARAMETER);if(!this.validExtensions.some(i=>t.toLowerCase().endsWith(i)))throw new O(`Invalid filename: "${t}". Filename must end with one of: ${this.validExtensions.join(", ")}`,$.INVALID_PARAMETER);if(t.includes("..")||t.includes("/")||t.includes("\\"))throw new O('Filename cannot contain path separators or ".."',$.INVALID_PARAMETER)}}class ci{container=null;attach(t){this.container=t}dispatch(t,e,i=!1){const o=new CustomEvent(t,{detail:e,cancelable:i});return this.container?.dispatchEvent(o),o}on(t,e){const i=o=>{const r=o,s={...r.detail,preventDefault:()=>{r.preventDefault()}};e(s)};return this.container?.addEventListener(t,i),()=>{this.container?.removeEventListener(t,i)}}}const ui={},di="en",ye=["en","nl","de"],ft=["baseLocale"],we=[],mt=typeof window>"u";globalThis.__paraglide=globalThis.__paraglide??{},globalThis.__paraglide.ssr=globalThis.__paraglide.ssr??{};let Ce=!1,P=()=>{let n=ft;!mt&&typeof window<"u"&&window.location?.href&&(n=Ae(window.location.href));const t=hi(n);if(t)return Ce||(Ce=!0,Se(t,{reload:!1})),t;throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found")};function hi(n,t){let e;for(const i of n){if(i==="baseLocale")e=di;else if(ke(i)&&at.has(i)){const r=at.get(i);if(r){const s=r.getLocale();if(s instanceof Promise)continue;if(s!==void 0)return gi(s)}}const o=gt(e);if(o)return o}}const fi=n=>{window.location.reload()};let Se=(n,t)=>{const e={reload:!0,...t};let i;try{i=P()}catch{}const o=[];let r=ft;!mt&&typeof window<"u"&&window.location?.href&&(r=Ae(window.location.href));for(const a of r)if(a!=="baseLocale"&&ke(a)&&at.has(a)){const l=at.get(a);if(l){let c=l.setLocale(n);c instanceof Promise&&(c=c.catch(u=>{throw new Error(`Custom strategy "${a}" setLocale failed.`,{cause:u})}),o.push(c))}}const s=()=>{!mt&&e.reload&&window.location&&n!==i&&fi()};if(o.length)return Promise.all(o).then(()=>{s()});s()},mi=()=>typeof window<"u"?window.location.origin:"http://fallback.com";function gt(n){if(typeof n!="string")return;const t=n.toLowerCase();for(const e of ye)if(e.toLowerCase()===t)return e}function gi(n){const t=gt(n);if(t)return t;throw new Error(`Invalid locale: ${n}. Expected one of: ${ye.join(", ")}`)}function pi(n){return bi(n)}function bi(n){const t=typeof n=="string"?new URL(n,mi()):new URL(n),e=t.pathname.split("/").filter(Boolean);return e.length>0&&gt(e[0])&&(t.pathname="/"+e.slice(1).join("/")),t}let Ee,_e;function vi(n){if(we.length===0)return;const t=typeof n=="string"?n:n.href;if(Ee===t)return _e;const e=new URL(t,"http://example.com"),i=pi(e),o=i.href===e.href?[e]:[e,i];let r;for(const s of o){for(const a of we)if(new ui(a.match,s.href).exec(s.href)){r=a;break}if(r)break}return Ee=t,_e=r,r}function Ae(n){const t=vi(n);return t&&t.exclude!==!0&&Array.isArray(t.strategy)?t.strategy:ft}const at=new Map;function ke(n){return typeof n=="string"&&/^custom-[A-Za-z0-9_-]+$/.test(n)}const yi=()=>"Activate AR",wi=()=>"AR activeren",Ci=()=>"AR aktivieren",Si=((n={},t={})=>{const e=t.locale??P();return e==="nl"?wi():e==="de"?Ci():yi()}),Ei=()=>"Scan to view in AR",_i=()=>"Scan om in AR te bekijken",Ai=()=>"Scannen für AR-Ansicht",ki=((n={},t={})=>{const e=t.locale??P();return e==="nl"?_i():e==="de"?Ai():Ei()}),Ti=()=>"Use your smartphone camera to scan this QR code",Ri=()=>"Gebruik de camera van je smartphone om deze QR-code te scannen",Ii=()=>"Verwende die Kamera deines Smartphones, um diesen QR-Code zu scannen",Mi=((n={},t={})=>{const e=t.locale??P();return e==="nl"?Ri():e==="de"?Ii():Ti()}),Ni=()=>"Your phone will open the 3D model in AR mode.",Pi=()=>"Je telefoon opent het 3D-model in AR-modus.",Li=()=>"Dein Telefon öffnet das 3D-Modell im AR-Modus.",Bi=((n={},t={})=>{const e=t.locale??P();return e==="nl"?Pi():e==="de"?Li():Ni()}),xi=()=>"Close",Oi=()=>"Sluiten",zi=()=>"Schließen",Di=((n={},t={})=>{const e=t.locale??P();return e==="nl"?Oi():e==="de"?zi():xi()}),Fi=()=>"Fullscreen",Ui=()=>"Volledig scherm",Vi=()=>"Vollbild",$i=((n={},t={})=>{const e=t.locale??P();return e==="nl"?Ui():e==="de"?Vi():Fi()}),qi=()=>"Downloading",ji=()=>"Downloaden",Hi=()=>"Herunterladen",Te=((n={},t={})=>{const e=t.locale??P();return e==="nl"?ji():e==="de"?Hi():qi()}),Gi=()=>"Rendering",Ki=()=>"Renderen",Yi=()=>"Rendern",Qi=((n={},t={})=>{const e=t.locale??P();return e==="nl"?Ki():e==="de"?Yi():Gi()}),Ji=()=>"Screenshot",Zi=()=>"Screenshot",Wi=()=>"Screenshot",Xi=((n={},t={})=>{const e=t.locale??P();return e==="nl"?Zi():e==="de"?Wi():Ji()}),to=()=>"Configure",eo=()=>"Configureren",no=()=>"Konfigurieren",io=((n={},t={})=>{const e=t.locale??P();return e==="nl"?eo():e==="de"?no():to()}),oo=()=>"Close",ro=()=>"Sluiten",so=()=>"Schließen",ao=((n={},t={})=>{const e=t.locale??P();return e==="nl"?ro():e==="de"?so():oo()}),lo=()=>"Reset camera",co=()=>"Camera resetten",uo=()=>"Kamera zurücksetzen",ho=((n={},t={})=>{const e=t.locale??P();return e==="nl"?co():e==="de"?uo():lo()}),fo=()=>"Zoom in",mo=()=>"Inzoomen",go=()=>"Hineinzoomen",po=((n={},t={})=>{const e=t.locale??P();return e==="nl"?mo():e==="de"?go():fo()}),bo=()=>"Zoom out",vo=()=>"Uitzoomen",yo=()=>"Herauszoomen",wo=((n={},t={})=>{const e=t.locale??P();return e==="nl"?vo():e==="de"?yo():bo()}),Co=()=>"Rotate left",So=()=>"Naar links draaien",Eo=()=>"Nach links drehen",_o=((n={},t={})=>{const e=t.locale??P();return e==="nl"?So():e==="de"?Eo():Co()}),Ao=()=>"Rotate right",ko=()=>"Naar rechts draaien",To=()=>"Nach rechts drehen",Ro=((n={},t={})=>{const e=t.locale??P();return e==="nl"?ko():e==="de"?To():Ao()}),Io=()=>"Tilt up",Mo=()=>"Omhoog kantelen",No=()=>"Nach oben kippen",Po=((n={},t={})=>{const e=t.locale??P();return e==="nl"?Mo():e==="de"?No():Io()}),Lo=()=>"Tilt down",Bo=()=>"Omlaag kantelen",xo=()=>"Nach unten kippen",Oo=((n={},t={})=>{const e=t.locale??P();return e==="nl"?Bo():e==="de"?xo():Lo()}),zo=()=>"Working…",Do=()=>"Bezig…",Fo=()=>"Läuft…",Uo=((n={},t={})=>{const e=t.locale??P();return e==="nl"?Do():e==="de"?Fo():zo()}),Vo=()=>"Done",$o=()=>"Gelukt",qo=()=>"Fertig",jo=((n={},t={})=>{const e=t.locale??P();return e==="nl"?$o():e==="de"?qo():Vo()}),Ho=()=>"Failed",Go=()=>"Mislukt",Ko=()=>"Fehlgeschlagen",Yo=((n={},t={})=>{const e=t.locale??P();return e==="nl"?Go():e==="de"?Ko():Ho()});const Qo={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 Re=([n,t,e])=>{const i=document.createElementNS("http://www.w3.org/2000/svg",n);return Object.keys(t).forEach(o=>{i.setAttribute(o,String(t[o]))}),e?.length&&e.forEach(o=>{const r=Re(o);i.appendChild(r)}),i},Ie=(n,t={})=>{const i={...Qo,...t};return Re(["svg",i,n])};const Jo=[["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 Zo=[["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 Me=[["path",{d:"m6 9 6 6 6-6"}]];const Wo=[["path",{d:"m15 18-6-6 6-6"}]];const Xo=[["path",{d:"m9 18 6-6-6-6"}]];const tr=[["path",{d:"m18 15-6-6-6 6"}]];const er=[["path",{d:"M15 3h6v6"}],["path",{d:"m21 3-7 7"}],["path",{d:"m3 21 7-7"}],["path",{d:"M9 21H3v-6"}]];const nr=[["path",{d:"m14 10 7-7"}],["path",{d:"M20 10h-6V4"}],["path",{d:"m3 21 7-7"}],["path",{d:"M4 14h6v6"}]];const ir=[["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 or=[["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 rr=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];const sr=[["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 ar=[["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 U(n,{size:t=20,strokeWidth:e=1.75}={}){return Ie(n,{width:t,height:t,"stroke-width":e})}const z={ar:n=>U(Jo,n),fullscreen:n=>U(er,n),exitFullscreen:n=>U(nr,n),screenshot:n=>U(Zo,n),tiltUp:n=>U(tr,n),tiltDown:n=>U(Me,n),rotateLeft:n=>U(Wo,n),rotateRight:n=>U(Xo,n),zoomIn:n=>U(sr,n),zoomOut:n=>U(ar,n),reset:n=>U(ir,n),configurator:n=>U(or,n),close:n=>U(rr,n)};class D{element;constructor({variant:t="default",size:e="default",label:i,icon:o,onClick:r,disabled:s=!1}={}){this.element=document.createElement("button"),this.element.className=`ui-btn ui-btn--${t} ui-btn--size-${e}`,i!==void 0&&(this.element.setAttribute("aria-label",i),this.element.title=i),o!==void 0?this.element.appendChild(o):i!==void 0&&(this.element.textContent=i),r&&this.element.addEventListener("click",r),this.element.disabled=s}setIcon(t){const e=this.element.querySelector("svg");e!==null?e.replaceWith(t):this.element.appendChild(t)}}const B={semantic:{error:"#dc2626"},neutral:{500:"#737373",600:"#525252",900:"#171717"},white:"#ffffff",black:"#000000"},R={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 lr{element;constructor(){this.element=document.createElement("div"),Object.assign(this.element.style,{background:B.white,borderRadius:R[3],padding:R[6],boxShadow:`0 ${R[2]} ${R[8]} oklch(0% 0 0 / 20%)`,maxWidth:"20rem",width:"100%"})}}class cr{constructor(t={}){this.options=t,this.card=new lr,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:R[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 ur{element;selectCallback=null;constructor(t,e,i){this.element=document.createElement("div"),this.element.className="ui-toggle-group";for(let o=0;o<t.length;o++){const r=t[o],s=document.createElement("button");s.className="ui-toggle-group-item",s.dataset.value=r,s.textContent=i?.[o]??r,s.dataset.state=r===e?"on":"off",s.setAttribute("aria-pressed",r===e?"true":"false"),s.addEventListener("click",()=>{this.selectCallback?.(r)}),this.element.appendChild(s)}}setSelected(t){for(const e of this.element.querySelectorAll(".ui-toggle-group-item")){const i=e.dataset.value===t;e.dataset.state=i?"on":"off",e.setAttribute("aria-pressed",i?"true":"false")}}onSelect(t){this.selectCallback=t}setEnabled(t){for(const e of this.element.querySelectorAll(".ui-toggle-group-item")){const i=t===null||t.includes(e.dataset.value??"");e.disabled=!i,e.setAttribute("aria-disabled",i?"false":"true")}}}class dr{element;select;constructor(t,e,i,o,r){this.select=document.createElement("select"),this.select.className="ui-native-select",this.select.dataset.name=t,this.select.setAttribute("aria-label",i);const s=document.createElement("option");s.value="",s.disabled=!0,s.textContent=i,this.select.appendChild(s);let a=!1;for(let c=0;c<e.length;c++){const u=e[c],d=document.createElement("option");d.value=u,d.textContent=r?.[c]??u,u===o&&(d.selected=!0,a=!0),this.select.appendChild(d)}a||(s.selected=!0);const l=Ie(Me,{width:16,height:16,"stroke-width":2});l.classList.add("ui-native-select-icon"),this.element=document.createElement("div"),this.element.className="ui-native-select-wrap",this.element.appendChild(this.select),this.element.appendChild(l)}setSelected(t){this.select.value=t}onSelect(t){this.select.addEventListener("change",()=>{t(this.select.value)})}setEnabled(t){for(const e of this.select.options)e.value!==""&&(e.disabled=t!==null&&!t.includes(e.value))}}class hr{element;input;valueText;values;options;selectCallback=null;settleCallback=null;constructor(t,e){if(t.length===0)throw new Error("Virtualdisplay: Slider needs at least one value");this.values=t,this.options=e,this.input=document.createElement("input"),this.input.type="range",this.input.className="ui-slider-input",this.input.min="0",this.input.max=String(t.length-1),this.input.step="1",this.input.setAttribute("aria-label",e.label),this.valueText=document.createElement("span"),this.valueText.className="ui-slider-value",this.valueText.setAttribute("aria-hidden","true");const i=document.createElement("div");i.className="ui-slider-track",i.appendChild(this.input),i.appendChild(this.buildEnds()),this.element=document.createElement("div"),this.element.className="ui-slider",this.element.appendChild(i),this.element.appendChild(this.valueText);const o=e.initialSelected===void 0?0:t.indexOf(e.initialSelected);this.applyIndex(o===-1?0:o),this.listen()}setSelected(t){const e=this.values.indexOf(t);e!==-1&&this.applyIndex(e)}onSelect(t){this.selectCallback=t}onSettle(t){this.settleCallback=t}listen(){this.input.addEventListener("input",()=>{const t=this.values[this.currentIndex];t!==void 0&&(this.applyIndex(this.currentIndex),this.selectCallback?.(t))}),this.input.addEventListener("change",()=>{const t=this.values[this.currentIndex];t!==void 0&&this.settleCallback?.(t)})}get currentIndex(){return Number(this.input.value)}applyIndex(t){this.input.value=String(t);const e=this.displayAt(t);this.valueText.textContent=e,this.input.setAttribute("aria-valuetext",e);const i=this.values.length===1?100:t/(this.values.length-1)*100;this.element.style.setProperty("--ui-slider-pct",`${i}%`)}buildEnds(){const t=document.createElement("div");t.className="ui-slider-ends",t.setAttribute("aria-hidden","true");for(const e of[0,this.values.length-1]){const i=document.createElement("span");i.textContent=this.labelAt(e),t.appendChild(i)}return t}labelAt(t){return this.options.labels?.[t]??this.values[t]??""}displayAt(t){const e=this.labelAt(t);return this.options.unit===void 0?e:`${e} ${this.options.unit}`}}const V={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"}},G=V.fontFamily.sans.join(", "),fr=`
2
2
  :root {
3
3
  --primary: oklch(5% 0 0);
4
4
  --primary-foreground: oklch(100% 0 0);
@@ -22,7 +22,7 @@
22
22
  gap: 0.5rem;
23
23
  border: 1px solid transparent;
24
24
  border-radius: var(--radius);
25
- font-family: ${J};
25
+ font-family: ${G};
26
26
  font-size: 0.875rem;
27
27
  font-weight: 600;
28
28
  white-space: nowrap;
@@ -79,7 +79,7 @@
79
79
  border-radius: var(--radius);
80
80
  background: var(--background);
81
81
  color: var(--foreground);
82
- font-family: ${J};
82
+ font-family: ${G};
83
83
  font-size: 0.875rem;
84
84
  font-weight: 600;
85
85
  cursor: pointer;
@@ -88,6 +88,8 @@
88
88
  box-shadow: 0 1px 2px oklch(5% 0 0 / 8%);
89
89
  }
90
90
  .ui-toggle-group-item:hover { background: var(--accent); border-color: oklch(85% 0 0); }
91
+ .ui-toggle-group-item:disabled { opacity: 0.4; cursor: not-allowed; }
92
+ .ui-toggle-group-item:disabled:hover { background: var(--background); border-color: var(--border); }
91
93
  .ui-toggle-group-item:active { transform: scale(0.98); }
92
94
  .ui-toggle-group-item:focus-visible {
93
95
  outline: none;
@@ -118,7 +120,7 @@
118
120
  background: var(--background);
119
121
  appearance: none;
120
122
  color: var(--foreground);
121
- font-family: ${J};
123
+ font-family: ${G};
122
124
  font-size: 0.875rem;
123
125
  font-weight: 400;
124
126
  cursor: pointer;
@@ -141,6 +143,97 @@
141
143
  pointer-events: none;
142
144
  }
143
145
 
146
+ /* ── Slider ──────────────────────────────────────────────── */
147
+ .ui-slider {
148
+ display: flex;
149
+ align-items: center;
150
+ gap: 0.75rem;
151
+ inline-size: 100%;
152
+ }
153
+
154
+ .ui-slider-track {
155
+ flex: 1;
156
+ min-inline-size: 0;
157
+ }
158
+
159
+ /* Tabular figures keep the readout and layout steady mid-drag. */
160
+ .ui-slider-value {
161
+ font-family: ${G};
162
+ font-size: 0.875rem;
163
+ font-weight: 600;
164
+ color: var(--foreground);
165
+ font-variant-numeric: tabular-nums;
166
+ white-space: nowrap;
167
+ }
168
+
169
+ .ui-slider-ends {
170
+ display: flex;
171
+ justify-content: space-between;
172
+ font-family: ${G};
173
+ font-size: 0.75rem;
174
+ color: var(--muted-foreground);
175
+ font-variant-numeric: tabular-nums;
176
+ }
177
+
178
+ /* 2.75rem tall: the whole input is the touch target (44px). */
179
+ .ui-slider-input {
180
+ appearance: none;
181
+ display: block;
182
+ inline-size: 100%;
183
+ block-size: 2.75rem;
184
+ margin: 0;
185
+ padding: 0;
186
+ background: transparent;
187
+ cursor: pointer;
188
+ }
189
+ .ui-slider-input:focus-visible { outline: none; }
190
+
191
+ /* --ui-slider-pct is set by the component; it fills the track up to the thumb. */
192
+ .ui-slider-input::-webkit-slider-runnable-track {
193
+ block-size: 0.375rem;
194
+ border-radius: 9999px;
195
+ background: linear-gradient(to right, var(--primary) var(--ui-slider-pct, 0%), var(--secondary) var(--ui-slider-pct, 0%));
196
+ }
197
+ .ui-slider-input::-webkit-slider-thumb {
198
+ appearance: none;
199
+ inline-size: 1.25rem;
200
+ block-size: 1.25rem;
201
+ margin-block-start: -0.4375rem; /* centre the 1.25rem thumb on the 0.375rem track */
202
+ border-radius: 50%;
203
+ border: 2px solid var(--primary);
204
+ background: var(--background);
205
+ box-shadow: 0 1px 3px oklch(5% 0 0 / 20%);
206
+ transition: box-shadow 200ms, border-color 200ms;
207
+ }
208
+ .ui-slider-input:focus-visible::-webkit-slider-thumb {
209
+ border-color: var(--ring);
210
+ box-shadow: 0 0 0 3px oklch(5% 0 0 / 12%);
211
+ }
212
+
213
+ .ui-slider-input::-moz-range-track {
214
+ block-size: 0.375rem;
215
+ border-radius: 9999px;
216
+ background: var(--secondary);
217
+ }
218
+ .ui-slider-input::-moz-range-progress {
219
+ block-size: 0.375rem;
220
+ border-radius: 9999px;
221
+ background: var(--primary);
222
+ }
223
+ .ui-slider-input::-moz-range-thumb {
224
+ inline-size: 1.25rem;
225
+ block-size: 1.25rem;
226
+ border-radius: 50%;
227
+ border: 2px solid var(--primary);
228
+ background: var(--background);
229
+ box-shadow: 0 1px 3px oklch(5% 0 0 / 20%);
230
+ transition: box-shadow 200ms, border-color 200ms;
231
+ }
232
+ .ui-slider-input:focus-visible::-moz-range-thumb {
233
+ border-color: var(--ring);
234
+ box-shadow: 0 0 0 3px oklch(5% 0 0 / 12%);
235
+ }
236
+
144
237
  /* ── Annotation layer ───────────────────────────────────── */
145
238
  .vd-annotations-layer {
146
239
  position: absolute;
@@ -166,7 +259,7 @@
166
259
  border: 2px solid oklch(100% 0 0);
167
260
  background: var(--primary);
168
261
  color: var(--primary-foreground);
169
- font-family: ${J};
262
+ font-family: ${G};
170
263
  font-size: 0.8125rem;
171
264
  font-weight: 600;
172
265
  cursor: pointer;
@@ -240,7 +333,7 @@
240
333
  }
241
334
 
242
335
  .vd-annotation-popup-title {
243
- font-family: ${J};
336
+ font-family: ${G};
244
337
  font-size: 0.875rem;
245
338
  font-weight: 600;
246
339
  line-height: 1.25rem;
@@ -249,7 +342,7 @@
249
342
  }
250
343
 
251
344
  .vd-annotation-popup-description {
252
- font-family: ${J};
345
+ font-family: ${G};
253
346
  font-size: 0.8125rem;
254
347
  font-weight: 400;
255
348
  line-height: 1.125rem;
@@ -288,12 +381,12 @@
288
381
  0%, 100% { opacity: 1; }
289
382
  50% { opacity: 0.55; }
290
383
  }
291
- `;let Me=!1;function Pe(){if(Me||typeof document>"u")return;Me=!0;const n=document.createElement("style");n.id="vd-ui-vanilla",n.textContent=ar,document.head.appendChild(n)}const lr=U.fontFamily.sans.join(", ");class cr{qrLib=null;dialog=null;qrSlot=null;show(){this.hide(),Pe(),this.dialog=new or({onClose:()=>{this.dialog=null,this.qrSlot=null}}),Object.assign(this.dialog.card.element.style,{display:"flex",flexDirection:"column",alignItems:"center",gap:R[3],fontFamily:lr}),this.dialog.card.element.appendChild(this.createText(Ci(),{fontSize:U.fontSize.base,fontWeight:U.fontWeight.semibold,color:L.neutral[900]})),this.dialog.card.element.appendChild(this.createText(Ai(),{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(Ii(),{fontSize:U.fontSize.xs,color:L.neutral[500]}));const t=new D({variant:"outline",label:Bi(),onClick:()=>{this.hide()}});this.dialog.card.element.appendChild(t.element),this.dialog.open()}async update(t){this.qrLib??=await Promise.resolve().then(()=>ms);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 Be(n){const t=Math.max(0,Math.min(1,n));return t*t*(3-2*t)}function ur(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),A=d*a-p*f,B=p*a+d*f,S=.55;return[i+h*r*S,o-A*r*S,B]}function dr(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 hr(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]];dr(n,r,a)}const pt=[-1,-1,1],bt=[1,-1,1],vt=[1,-1,-1],yt=[-1,-1,-1],wt=[-1,1,1],Ct=[1,1,1],St=[1,1,-1],Et=[-1,1,-1],Le=[[pt,bt],[bt,vt],[vt,yt],[yt,pt],[pt,wt],[bt,Ct],[vt,St],[yt,Et],[wt,Ct],[Ct,St],[St,Et],[Et,wt]],fr=400,Oe='-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif';function gr(){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:Oe});const o=document.createElement("span");return Object.assign(o.style,{fontSize:"13px",color:"#000",fontFamily:Oe}),o.textContent=Te(),e.appendChild(i),e.appendChild(o),n.appendChild(t),n.appendChild(e),{overlay:n,canvas:t,pctEl:i,phaseEl:o}}class mr{overlay;canvas;ctx;pctEl;phaseEl;animationId=null;showTimerId=null;startTime;hidden=!1;visible=!1;constructor(t,e={}){this.startTime=performance.now();const i=gr();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??fr;this.showTimerId=setTimeout(()=>{this.reveal()},o)}get loadingTexts(){return{downloading:Te(),rendering:ji()}}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=>ur(p,a,l,o,r,s),u=6,h=i%u/u,f=Le.length;let d;h<.35?d=Be(h/.35)*f:h<.55?d=f:h<.9?d=(1-Be((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 A=Le[p];if(A===void 0)continue;const B=Math.min(1,d-p);hr(this.ctx,c,A[0],A[1],B)}this.ctx.shadowBlur=0}}class pr{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 D({variant:"outline",size:"icon",label:bi(),icon:z.ar(),onClick:()=>{this.options.onAr?.()}})),this.fullscreenBtn=this.syncButton(this.fullscreenBtn,t.fullscreen!==!1&&this.options.onFullscreen!==void 0,()=>new D({variant:"outline",size:"icon",label:zi(),icon:z.fullscreen(),onClick:()=>{this.options.onFullscreen?.()}}))}destroy(){document.removeEventListener("fullscreenchange",this.onFullscreenChange)}}const Z=.5;class lt{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=br(t,e,i);e.onChange(r=>{i.targetRotation=r.rotation-i.thetaOffset,i.targetTilt=r.tilt,i.targetZoom=r.zoom,vr(o,e,r)}),this.element.appendChild(lt.buildZoom(o.zoomOut,o.zoomIn)),this.element.appendChild(lt.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 br(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 D({variant:"outline",size:"icon",label:mo(),icon:z.zoomOut(),onClick:()=>{e.targetZoom=i(e.targetZoom-10),n.zoom(e.targetZoom).set()}}),zoomIn:new D({variant:"outline",size:"icon",label:uo(),icon:z.zoomIn(),onClick:()=>{e.targetZoom=i(e.targetZoom+10),n.zoom(e.targetZoom).set()}}),tiltUp:new D({variant:"outline",size:"icon",label:To(),icon:z.tiltUp(),onClick:()=>{r(-15)}}),rotateLeft:new D({variant:"outline",size:"icon",label:yo(),icon:z.rotateLeft(),onClick:()=>{e.targetRotation=o(e.targetRotation-15),n.rotate(e.targetRotation+e.thetaOffset).set()}}),reset:new D({variant:"outline",size:"icon",label:so(),icon:z.reset(),onClick:()=>{e.thetaOffset=0,n.reset()}}),rotateRight:new D({variant:"outline",size:"icon",label:Eo(),icon:z.rotateRight(),onClick:()=>{e.targetRotation=o(e.targetRotation+15),n.rotate(e.targetRotation+e.thetaOffset).set()}}),tiltDown:new D({variant:"outline",size:"icon",label:Mo(),icon:z.tiltDown(),onClick:()=>{r(15)}})}}function vr(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"},yr=5;let wr=0;function _t(n){const t=n.replace(/([A-Z])/g," $1").trim();return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function Cr(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=_t(n.name),s.id=`vd-attribute-label-${wr++}`,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(_t),c=n.values.length<=yr?new rr(n.values,a,l):new sr(n.name,n.values,_t(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 Sr=80,Er=2500;class _r{constructor(t,e=Er){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 D({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=Ar(t.price,t.currency),this.vatEl.textContent=xe(this.configuration.vatDisplay)}renderButton(){const t=this.configuration.submitEnabled;this.button.element.classList.toggle("vd-hidden",!t),t&&this.state==="idle"&&this.setButtonText(xe(this.configuration.buttonLabel))}async handleSubmit(){if(this.state!=="busy"){this.setState("busy",Oo());try{await this.configuration.submit(),this.setState("success",Fo())}catch{this.setState("failed",Vo())}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 xe(n){return(n??"").slice(0,Sr)}function Ar(n,t){try{const e=new Intl.NumberFormat(P(),{style:"currency",currency:t}),i=e.resolvedOptions().maximumFractionDigits??2;return e.format(n/10**i)}catch{return`${t} ${(n/100).toFixed(2)}`}}class ze{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 kr=572;class Tr{constructor(t){this.actionBarSlot=t}actionBarSlot;element=null;body=null;openButton=null;closeButton=null;container=null;observer=null;collapsible=!1;expanded=!0;visible=!1;attach(t,e){this.container=t,e.classList.add("vd-attributes-sidebar"),this.closeButton=new D({variant:"ghost",size:"icon-sm",label:no(),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 D({variant:"outline",size:"icon",label:Wi(),icon:z.configurator({size:18}),onClick:()=>{this.expanded=!0,this.render()}}),this.openButton.element.classList.add("vd-configurator-toggle","vd-hidden"),this.actionBarSlot.appendChild(this.openButton.element),this.observe()}setVisible(t){this.visible=t,this.render()}destroy(){this.observer?.disconnect(),this.observer=null,this.openButton?.element.remove(),this.element?.remove(),this.container?.classList.remove("vd-layout-sidebar-right","vd-layout-sidebar-permanent"),this.container=null}observe(){typeof ResizeObserver>"u"||this.container===null||(this.observer=new ResizeObserver(t=>{const e=t[0]?.contentRect.width??0;this.setCollapsible(e>0&&e<kr)}),this.observer.observe(this.container))}setCollapsible(t){t!==this.collapsible&&(this.collapsible=t,this.expanded=!t,this.render())}render(){if(this.element===null||this.openButton===null||this.closeButton===null||this.container===null)return;const t=this.visible&&this.expanded,e=this.visible&&!this.expanded;this.element.classList.toggle("vd-hidden",!this.visible),this.element.classList.toggle("vd-sidebar-collapsed",e),this.openButton.element.classList.toggle("vd-hidden",!e),this.closeButton.element.style.display=this.collapsible?"":"none",this.container.classList.toggle("vd-layout-sidebar-right",t),this.container.classList.toggle("vd-layout-sidebar-permanent",t&&!this.collapsible)}}class Rr{attach(t,e){}setVisible(t){}destroy(){}}const Ir={"inframe-bottom-left":()=>new ze,"sidebar-right":n=>new Tr(n),hidden:()=>new Rr};function Nr(n,t){return(Ir[n??""]??(()=>new ze))(t)}const At=U.fontFamily.sans.join(", "),kt=`
384
+ `;let Ne=!1;function Pe(){if(Ne||typeof document>"u")return;Ne=!0;const n=document.createElement("style");n.id="vd-ui-vanilla",n.textContent=fr,document.head.appendChild(n)}const mr=V.fontFamily.sans.join(", ");class gr{qrLib=null;dialog=null;qrSlot=null;show(){this.hide(),Pe(),this.dialog=new cr({onClose:()=>{this.dialog=null,this.qrSlot=null}}),Object.assign(this.dialog.card.element.style,{display:"flex",flexDirection:"column",alignItems:"center",gap:R[3],fontFamily:mr}),this.dialog.card.element.appendChild(this.createText(ki(),{fontSize:V.fontSize.base,fontWeight:V.fontWeight.semibold,color:B.neutral[900]})),this.dialog.card.element.appendChild(this.createText(Mi(),{fontSize:V.fontSize.sm,color:B.neutral[600]})),this.qrSlot=this.createQrSlot(),this.dialog.card.element.appendChild(this.qrSlot),this.dialog.card.element.appendChild(this.createText(Bi(),{fontSize:V.fontSize.xs,color:B.neutral[500]}));const t=new D({variant:"outline",label:Di(),onClick:()=>{this.hide()}});this.dialog.card.element.appendChild(t.element),this.dialog.open()}async update(t){this.qrLib??=await Promise.resolve().then(()=>As);const e=await this.qrLib.toDataURL(t,{width:256,margin:4,errorCorrectionLevel:"M",color:{dark:B.black,light:B.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 Le(n){const t=Math.max(0,Math.min(1,n));return t*t*(3-2*t)}function pr(n,t,e,i,o,r){const[s,a,l]=n,c=Math.cos(t),u=Math.sin(t),d=c*s+u*l,f=-u*s+c*l,h=Math.cos(e),p=Math.sin(e),A=h*a-p*f,L=p*a+h*f,S=.55;return[i+d*r*S,o-A*r*S,L]}function br(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 vr(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]];br(n,r,a)}const pt=[-1,-1,1],bt=[1,-1,1],vt=[1,-1,-1],yt=[-1,-1,-1],wt=[-1,1,1],Ct=[1,1,1],St=[1,1,-1],Et=[-1,1,-1],Be=[[pt,bt],[bt,vt],[vt,yt],[yt,pt],[pt,wt],[bt,Ct],[vt,St],[yt,Et],[wt,Ct],[Ct,St],[St,Et],[Et,wt]],yr=400,xe='-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif';function wr(){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:xe});const o=document.createElement("span");return Object.assign(o.style,{fontSize:"13px",color:"#000",fontFamily:xe}),o.textContent=Te(),e.appendChild(i),e.appendChild(o),n.appendChild(t),n.appendChild(e),{overlay:n,canvas:t,pctEl:i,phaseEl:o}}class Cr{overlay;canvas;ctx;pctEl;phaseEl;animationId=null;showTimerId=null;startTime;hidden=!1;visible=!1;constructor(t,e={}){this.startTime=performance.now();const i=wr();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??yr;this.showTimerId=setTimeout(()=>{this.reveal()},o)}get loadingTexts(){return{downloading:Te(),rendering:Qi()}}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=>pr(p,a,l,o,r,s),u=6,d=i%u/u,f=Be.length;let h;d<.35?h=Le(d/.35)*f:d<.55?h=f:d<.9?h=(1-Le((d-.55)/.35))*f:h=0,this.ctx.shadowBlur=5,this.ctx.shadowColor="rgba(30,30,30,0.08)";for(let p=0;p<f&&!(p>=h);p++){const A=Be[p];if(A===void 0)continue;const L=Math.min(1,h-p);vr(this.ctx,c,A[0],A[1],L)}this.ctx.shadowBlur=0}}class Sr{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 D({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 D({variant:"outline",size:"icon",label:$i(),icon:z.fullscreen(),onClick:()=>{this.options.onFullscreen?.()}}))}destroy(){document.removeEventListener("fullscreenchange",this.onFullscreenChange)}}const W=.5;class lt{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=Er(t,e,i);e.onChange(r=>{i.targetRotation=r.rotation-i.thetaOffset,i.targetTilt=r.tilt,i.targetZoom=r.zoom,_r(o,e,r)}),this.element.appendChild(lt.buildZoom(o.zoomOut,o.zoomIn)),this.element.appendChild(lt.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 Er(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 D({variant:"outline",size:"icon",label:wo(),icon:z.zoomOut(),onClick:()=>{e.targetZoom=i(e.targetZoom-10),n.zoom(e.targetZoom).set()}}),zoomIn:new D({variant:"outline",size:"icon",label:po(),icon:z.zoomIn(),onClick:()=>{e.targetZoom=i(e.targetZoom+10),n.zoom(e.targetZoom).set()}}),tiltUp:new D({variant:"outline",size:"icon",label:Po(),icon:z.tiltUp(),onClick:()=>{r(-15)}}),rotateLeft:new D({variant:"outline",size:"icon",label:_o(),icon:z.rotateLeft(),onClick:()=>{e.targetRotation=o(e.targetRotation-15),n.rotate(e.targetRotation+e.thetaOffset).set()}}),reset:new D({variant:"outline",size:"icon",label:ho(),icon:z.reset(),onClick:()=>{e.thetaOffset=0,n.reset()}}),rotateRight:new D({variant:"outline",size:"icon",label:Ro(),icon:z.rotateRight(),onClick:()=>{e.targetRotation=o(e.targetRotation+15),n.rotate(e.targetRotation+e.thetaOffset).set()}}),tiltDown:new D({variant:"outline",size:"icon",label:Oo(),icon:z.tiltDown(),onClick:()=>{r(15)}})}}function _r(n,t,e){const i=t.limits;i!==void 0&&(n.zoomOut.element.disabled=i.minZoom!==void 0&&e.zoom<=i.minZoom+W,n.zoomIn.element.disabled=i.maxZoom!==void 0&&e.zoom>=i.maxZoom-W,n.tiltUp.element.disabled=i.minTilt!==void 0&&e.tilt<=i.minTilt+W,n.tiltDown.element.disabled=i.maxTilt!==void 0&&e.tilt>=i.maxTilt-W,n.rotateLeft.element.disabled=i.minRotate!==void 0&&e.rotation<=i.minRotate+W,n.rotateRight.element.disabled=i.maxRotate!==void 0&&e.rotation>=i.maxRotate-W)}const K={SELECT:"ui:select",SELECTED:"ui:selected",FOCUS_CHANGE:"vd:focus-change",CONFIGURATION_CHANGE:"vd:configuration-change",CONFIGURATION_SUBMIT:"vd:configuration-submit"},Oe={mm:1,cm:10,m:1e3,in:25.4},ze=3;function Ar(n){const t=n.stepMm/Oe[n.displayUnit];for(let e=0;e<=ze;e++){const i=t*10**e;if(Math.abs(i-Math.round(i))<1e-9)return e}return ze}function kr(n,t,e){const i=Ar(t),o=n/Oe[t.displayUnit];return new Intl.NumberFormat(e,{minimumFractionDigits:i,maximumFractionDigits:i}).format(o)}function Tr(n,t,e,i,o,r,s){const a=P(),l=n.values.map(d=>kr(Number(d),t,a)),c=n.values.find(d=>e.getValue(n.name,d)?.isSelected===!0)??n.defaultValue,u=new hr(n.values,{label:n.name,labels:l,unit:t.displayUnit,...c!==void 0&&{initialSelected:c}});return u.onSelect(d=>{o(n.name,d)}),u.onSettle(d=>{i.dispatch(K.SELECT,{attribute:n.name,value:d},!0).defaultPrevented||r(n.name,d)}),s(n.name,d=>{u.setSelected(d.value),i.dispatch(K.SELECTED,{attribute:n.name,value:d.value})}),{element:u.element,setSelectable:()=>{}}}const Rr=5;let Ir=0;function _t(n){const t=n.replace(/([A-Z])/g," $1").trim();return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function Mr(n,t,e,i,o,r){const s=document.createElement("div");s.className="vd-attribute",s.dataset.name=n.name;const a=document.createElement("span");a.className="vd-attribute-label",a.textContent=_t(n.name),a.id=`vd-attribute-label-${Ir++}`,s.appendChild(a),s.setAttribute("role","group"),s.setAttribute("aria-labelledby",a.id);const l=u=>{s.style.display=u?"none":""},c=n.dimension!==void 0?Tr(n,n.dimension,t,e,o,i,r):Nr(n,t,e,i,r);return s.appendChild(c.element),{element:s,setSelectable:c.setSelectable,setHidden:l}}function Nr(n,t,e,i,o){const r=n.values.find(l=>t.getValue(n.name,l)?.isSelected===!0),s=n.values.map(_t),a=n.values.length<=Rr?new ur(n.values,r,s):new dr(n.name,n.values,_t(n.name),r,s);return a.onSelect(l=>{e.dispatch(K.SELECT,{attribute:n.name,value:l},!0).defaultPrevented||i(n.name,l)}),o(n.name,l=>{a.setSelected(l.value),e.dispatch(K.SELECTED,{attribute:n.name,value:l.value})}),{element:a.element,setSelectable:l=>{a.setEnabled(l)}}}const Pr=80,Lr=2500;class Br{constructor(t,e=Lr){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 D({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=xr(t.price,t.currency),this.vatEl.textContent=De(this.configuration.vatDisplay)}renderButton(){const t=this.configuration.submitEnabled;this.button.element.classList.toggle("vd-hidden",!t),t&&this.state==="idle"&&this.setButtonText(De(this.configuration.buttonLabel))}async handleSubmit(){if(this.state!=="busy"){this.setState("busy",Uo());try{await this.configuration.submit(),this.setState("success",jo())}catch{this.setState("failed",Yo())}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 De(n){return(n??"").slice(0,Pr)}function xr(n,t){try{const e=new Intl.NumberFormat(P(),{style:"currency",currency:t}),i=e.resolvedOptions().maximumFractionDigits??2;return e.format(n/10**i)}catch{return`${t} ${(n/100).toFixed(2)}`}}class Fe{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 Or=572;class zr{constructor(t){this.actionBarSlot=t}actionBarSlot;element=null;body=null;openButton=null;closeButton=null;container=null;observer=null;collapsible=!1;expanded=!0;visible=!1;attach(t,e){this.container=t,e.classList.add("vd-attributes-sidebar"),this.closeButton=new D({variant:"ghost",size:"icon-sm",label:ao(),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 D({variant:"outline",size:"icon",label:io(),icon:z.configurator({size:18}),onClick:()=>{this.expanded=!0,this.render()}}),this.openButton.element.classList.add("vd-configurator-toggle","vd-hidden"),this.actionBarSlot.appendChild(this.openButton.element),this.observe()}setVisible(t){this.visible=t,this.render()}destroy(){this.observer?.disconnect(),this.observer=null,this.openButton?.element.remove(),this.element?.remove(),this.container?.classList.remove("vd-layout-sidebar-right","vd-layout-sidebar-permanent"),this.container=null}observe(){typeof ResizeObserver>"u"||this.container===null||(this.observer=new ResizeObserver(t=>{const e=t[0]?.contentRect.width??0;this.setCollapsible(e>0&&e<Or)}),this.observer.observe(this.container))}setCollapsible(t){t!==this.collapsible&&(this.collapsible=t,this.expanded=!t,this.render())}render(){if(this.element===null||this.openButton===null||this.closeButton===null||this.container===null)return;const t=this.visible&&this.expanded,e=this.visible&&!this.expanded;this.element.classList.toggle("vd-hidden",!this.visible),this.element.classList.toggle("vd-sidebar-collapsed",e),this.openButton.element.classList.toggle("vd-hidden",!e),this.closeButton.element.style.display=this.collapsible?"":"none",this.container.classList.toggle("vd-layout-sidebar-right",t),this.container.classList.toggle("vd-layout-sidebar-permanent",t&&!this.collapsible)}}class Dr{attach(t,e){}setVisible(t){}destroy(){}}const Fr={"inframe-bottom-left":()=>new Fe,"sidebar-right":n=>new zr(n),hidden:()=>new Dr};function Ur(n,t){return(Fr[n??""]??(()=>new Fe))(t)}const At=V.fontFamily.sans.join(", "),kt=`
292
385
  position: absolute;
293
386
  display: flex;
294
387
  z-index: 10;
295
388
  transition: inset-inline-end 0.18s ease;
296
- `,Mr=`
389
+ `,Vr=`
297
390
  /* Override browser's default black fullscreen backdrop */
298
391
  .vd-container:fullscreen {
299
392
  background: oklch(100% 0 0);
@@ -331,7 +424,7 @@
331
424
  display: flex;
332
425
  flex-direction: column;
333
426
  gap: ${R[1]};
334
- background: color-mix(in oklch, ${L.white} 85%, transparent);
427
+ background: color-mix(in oklch, ${B.white} 85%, transparent);
335
428
  backdrop-filter: blur(8px);
336
429
  border-radius: ${R[2]};
337
430
  padding: ${R[2]};
@@ -359,12 +452,12 @@
359
452
  display: flex;
360
453
  flex-direction: column;
361
454
  gap: ${R[3]};
362
- background: color-mix(in oklch, ${L.white} 85%, transparent);
455
+ background: color-mix(in oklch, ${B.white} 85%, transparent);
363
456
  backdrop-filter: blur(8px);
364
- border: 1px solid color-mix(in oklch, ${L.neutral[900]} 8%, transparent);
457
+ border: 1px solid color-mix(in oklch, ${B.neutral[900]} 8%, transparent);
365
458
  border-radius: ${R[3]};
366
459
  padding: ${R[3]};
367
- box-shadow: 0 ${R[1]} ${R[4]} color-mix(in oklch, ${L.neutral[900]} 6%, transparent);
460
+ box-shadow: 0 ${R[1]} ${R[4]} color-mix(in oklch, ${B.neutral[900]} 6%, transparent);
368
461
  font-family: ${At};
369
462
  }
370
463
 
@@ -376,9 +469,9 @@
376
469
 
377
470
  /* Micro-label: recedes so the controls lead. */
378
471
  .vd-attribute-label {
379
- font-size: ${U.fontSize.xs};
380
- font-weight: ${U.fontWeight.medium};
381
- color: ${L.neutral[500]};
472
+ font-size: ${V.fontSize.xs};
473
+ font-weight: ${V.fontWeight.medium};
474
+ color: ${B.neutral[500]};
382
475
  text-transform: uppercase;
383
476
  letter-spacing: 0.05em;
384
477
  font-family: ${At};
@@ -417,10 +510,10 @@
417
510
  z-index: 11;
418
511
  display: flex;
419
512
  flex-direction: column;
420
- background: color-mix(in oklch, ${L.white} 90%, transparent);
513
+ background: color-mix(in oklch, ${B.white} 90%, transparent);
421
514
  backdrop-filter: blur(10px);
422
- border-inline-start: 1px solid color-mix(in oklch, ${L.neutral[900]} 8%, transparent);
423
- box-shadow: -${R[1]} 0 ${R[4]} color-mix(in oklch, ${L.neutral[900]} 5%, transparent);
515
+ border-inline-start: 1px solid color-mix(in oklch, ${B.neutral[900]} 8%, transparent);
516
+ box-shadow: -${R[1]} 0 ${R[4]} color-mix(in oklch, ${B.neutral[900]} 5%, transparent);
424
517
  }
425
518
 
426
519
  @media (prefers-reduced-motion: no-preference) {
@@ -462,7 +555,7 @@
462
555
  flex-direction: column;
463
556
  gap: ${R[2]};
464
557
  padding-block-start: ${R[3]};
465
- border-block-start: 1px solid color-mix(in oklch, ${L.neutral[900]} 8%, transparent);
558
+ border-block-start: 1px solid color-mix(in oklch, ${B.neutral[900]} 8%, transparent);
466
559
  font-family: ${At};
467
560
  }
468
561
 
@@ -473,14 +566,14 @@
473
566
  }
474
567
 
475
568
  .vd-price {
476
- font-size: ${U.fontSize.lg};
477
- font-weight: ${U.fontWeight.semibold};
478
- color: ${L.neutral[900]};
569
+ font-size: ${V.fontSize.lg};
570
+ font-weight: ${V.fontWeight.semibold};
571
+ color: ${B.neutral[900]};
479
572
  }
480
573
 
481
574
  .vd-vat {
482
- font-size: ${U.fontSize.xs};
483
- color: ${L.neutral[500]};
575
+ font-size: ${V.fontSize.xs};
576
+ color: ${B.neutral[500]};
484
577
  }
485
578
 
486
579
  .vd-cta {
@@ -490,16 +583,16 @@
490
583
 
491
584
  /* Failed submit is the one place red belongs: a clear, recoverable error state. */
492
585
  .vd-commerce[data-submit="failed"] .vd-cta {
493
- background: ${L.semantic.error};
494
- border-color: ${L.semantic.error};
495
- color: ${L.white};
586
+ background: ${B.semantic.error};
587
+ border-color: ${B.semantic.error};
588
+ color: ${B.white};
496
589
  }
497
590
 
498
- `;function Pr(){if(Pe(),document.getElementById("vd-styles")!==null)return;const n=document.createElement("style");n.id="vd-styles",n.textContent=Mr,document.head.appendChild(n)}function Br(n,t){const e=document.createElement("a");e.href=`data:image/png;base64,${n}`,e.download=t,e.click()}class Lr{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){Pr(),this.container=t,this.loading=new mr(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 pr({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&&Se(t.language,{reload:!1}),this.syncScreenshotButton(),this.actionBar?.applySettings(t),this.cameraControls!==null&&(this.cameraControls.element.style.display=t.cameraControls===!0?"flex":"none"),this.placeScreenshotButton()}renderAttributeControls(t,e){if(!(this.container===null||this.slots.topRight===null||this.slots.bottomRight===null)&&(this.cameraControls?.element.remove(),this.cameraControls=null,this.teardownConfigurator(),this.settings.cameraControls===!0&&(this.cameraControls=new lt(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(Cr(i,t,this.options.eventBus,this.options.onSelect,this.options.onSubscribe));this.commerce=new _r(this.options.configuration),this.attributes.appendChild(this.commerce.element),this.layout=Nr(this.settings.configuratorLayout,this.slots.bottomRight),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 D({variant:"outline",size:"icon",label:Yi(),icon:z.screenshot(),onClick:()=>{this.options.snapshotApi.take("snapshot.png").onDeveloped(({data:e,filename:i})=>{Br(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 Or={};class xr{defaultServer="https://server.virtualdisplay.io";options;serverHost;extraParams;constructor(t,e,i){this.options=t,this.serverHost=e,this.extraParams=i}create(){const t=this.createContainer(),e=this.createIframe();return t.appendChild(e),this.attachToParent(t),{container:t,iframe:e}}createContainer(){const t=document.createElement("div");return t.className="vd-container",Object.assign(t.style,{position:"relative",width:"100%",height:"100%",overflow:"hidden"}),t}createIframe(){const t=document.createElement("iframe");return t.src=this.buildUrl(),t.setAttribute("allow","xr-spatial-tracking; fullscreen"),t}attachToParent(t){this.getParentElement().appendChild(t)}buildUrl(){const t=this.getServerUrl(),e=new URL(t);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);for(const[i,o]of Object.entries(this.extraParams??{}))e.searchParams.set(i,o);return e.toString()}getServerUrl(){if(this.serverHost!==void 0)return this.serverHost;if(Or?.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 zr(n){const{messenger:t}=n;t.on(N.HANDSHAKE,e=>{An(e)&&(M.logger.info("Server handshake received, flushing publisher queue"),t.markReady())}),t.on(N.SESSION,e=>{kn(e)&&n.onSession(e.sessionId)}),t.on(N.MUTATION,e=>{Tn(e)&&(n.attributes.handleMutationResult(e),n.configuration.handleSelectionChanged(n.attributes.getSelection()))}),t.on(N.SNAPSHOT,e=>{Rn(e)&&n.snapshot.handleSnapshotResult(e)}),t.on(N.CAMERA,e=>{In(e)&&n.cameraPosition.handlePositionUpdate(e)}),t.on(N.LOADING_INDICATOR,e=>{Mn(e)&&(e.error!==void 0?n.ui.showError(e.error):n.ui.updateProgress(e.progress,e.phase))}),t.on(N.CONFIG,e=>{Bn(e)&&n.applyConfig(e)}),t.on(N.MAPPING,e=>{Nn(e)&&(n.attributes.handleMappingReceived(e),n.configuration.handleSelectionChanged(n.attributes.getSelection()),n.ui.renderAttributeControls(n.attributes,e.attributes),n.readyStateTracker.handleMappingReceived())}),Dr(n)}function Dr(n){const{messenger:t}=n;t.on(N.FOCUS,e=>{Ln(e)&&n.focus.handleStateReceived(e)}),t.on(N.PRICING,e=>{On(e)&&n.configuration.handlePricingReceived(e.pricing)}),t.on(N.SYNC,e=>{Pn(e)&&n.onSync(e.connected)})}class Fr{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 Ur{attributes;readyStateTracker;messenger;cameraApi;cameraPositionApi;focusApi;configurationApi;snapshotApi;annotationsApi;eventBus;ui;options;serverHost;iframeParams;arActivation;syncTracker;iframe;container;readyCallbacks=[];mutationFailedCallbacks=[];viewerSessionId;constructor(t,e){this.options=t;const i=e??{};this.serverHost=i.serverHost,this.iframeParams=i.iframeParams,this.initializeLogging(),this.messenger=new xn(()=>this.iframe?.contentWindow??null,i.messengerOptions);const o=s=>{this.messenger.send(s)};this.attributes=new ti(o,(s,a)=>{this.notifyMutationFailed(s,a)}),this.snapshotApi=new ve(o),this.annotationsApi=new ie(o),this.cameraApi=new he(o),this.cameraPositionApi=new ei,this.focusApi=new me(o,s=>{this.dispatchFocusChange(s)}),this.configurationApi=new ge(s=>{this.dispatchConfigurationChange(s)},s=>{this.dispatchConfigurationSubmit(s)}),this.eventBus=new oi,this.arActivation=i.createArActivation?.(o),this.syncTracker=i.createSyncTracker?.(),this.readyStateTracker=new Fr(()=>{this.notifyReady()});const r=this.arActivation;this.ui=new Lr({snapshotApi:this.snapshotApi,cameraApi:this.cameraApi,cameraPositionApi:this.cameraPositionApi,eventBus:this.eventBus,configuration:this.configurationApi,onSelect:(s,a)=>this.attributes.select(s,a),onSubscribe:(s,a)=>this.attributes.onChange(s,a),...r!==void 0&&{onAr:()=>{r.activate()}},onFullscreenEnter:()=>{this.trackFullscreen()}}),this.wireIncomingMessages(),i.registerHandlers?.(this.messenger,o),this.messenger.start(),this.createAndConnectIframe()}wireIncomingMessages(){zr({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&&de(),M.logger.info("Initializing Virtualdisplay client",{model:this.options.model})}createAndConnectIframe(){const e=new xr(this.options,this.serverHost,this.iframeParams).create();this.container=e.container,this.iframe=e.iframe,this.eventBus.attach(this.container),this.ui.attach(this.container);try{const i=new URL(this.iframe.src).origin;this.messenger.setTargetOrigin(i)}catch{}}select(t,e){this.attributes.select(t,e)}getValues(t){return this.attributes.getValues(t)}getValue(t,e){return this.attributes.getValue(t,e)}onChange(t,e){this.attributes.onChange(t,e)}getAttribute(t){return this.attributes.getAttribute(t)}get isReady(){return this.readyStateTracker.isReady}onReady(t){if(this.readyStateTracker.isReady){t(this);return}this.readyCallbacks.push(t)}onMutationFailed(t){this.mutationFailedCallbacks.push(t)}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 $r="ar.virtualdisplay.io";function qr(n){const t=new URL(`https://${$r}/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 Vr=1500;class jr{options;qrModal=new cr;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(Zn()){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=qr({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)},Vr);this.pendingTimers.add(e),this.waiters.push(i=>{this.pendingTimers.delete(e),clearTimeout(e),t(i)})})}}class Hr{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 Gr extends Ur{syncStatusTracker;constructor(t){const e=new Hr;super(t,{createArActivation:i=>new jr({license:t.license,model:t.model,send:i}),createSyncTracker:()=>e}),this.syncStatusTracker=e}onSyncChange(t){this.syncStatusTracker.onChange(t)}}function Kr(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var X={},Tt,De;function Yr(){return De||(De=1,Tt=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),Tt}var Rt={},G={},Fe;function Y(){if(Fe)return G;Fe=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 It={},Ue;function Nt(){return Ue||(Ue=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}}})(It)),It}var Mt,$e;function Qr(){if($e)return Mt;$e=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++}},Mt=n,Mt}var Pt,qe;function Jr(){if(qe)return Pt;qe=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]},Pt=n,Pt}var Bt={},Ve;function Zr(){return Ve||(Ve=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}})(Bt)),Bt}var Lt={},je;function Wr(){if(je)return Lt;je=1;const n=Y().getSymbolSize,t=7;return Lt.getPositions=function(i){const o=n(i);return[[0,0],[o-t,0],[0,o-t]]},Lt}var Ot={},He;function Xr(){return He||(He=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}})(Ot)),Ot}var ct={},Ge;function Ke(){if(Ge)return ct;Ge=1;const n=Nt(),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 ct.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}},ct.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}},ct}var xt={},it={},Ye;function ts(){if(Ye)return it;Ye=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]})(),it.log=function(i){if(i<1)throw new Error("log("+i+")");return t[i]},it.exp=function(i){return n[i]},it.mul=function(i,o){return i===0||o===0?0:n[t[i]+t[o]]},it}var Qe;function es(){return Qe||(Qe=1,(function(n){const t=ts();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}})(xt)),xt}var zt,Je;function ns(){if(Je)return zt;Je=1;const n=es();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},zt=t,zt}var Dt={},Ft={},Ut={},Ze;function We(){return Ze||(Ze=1,Ut.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),Ut}var V={},Xe;function tn(){if(Xe)return V;Xe=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
499
- ]))+`;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 en;function Q(){return en||(en=1,(function(n){const t=We(),e=tn();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}}})(Ft)),Ft}var nn;function is(){return nn||(nn=1,(function(n){const t=Y(),e=Ke(),i=Nt(),o=Q(),r=We(),s=7973,a=t.getBCHDigit(s);function l(f,d,p){for(let A=1;A<=40;A++)if(d<=n.getCapacity(A,p,f))return A}function c(f,d){return o.getCharCountIndicator(f,d)+4}function u(f,d){let p=0;return f.forEach(function(A){const B=c(A.mode,d);p+=B+A.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,A){if(!r.isValid(d))throw new Error("Invalid QR Code version");typeof A>"u"&&(A=o.BYTE);const B=t.getSymbolTotalCodewords(d),S=e.getTotalCodewordsCount(d,p),I=(B-S)*8;if(A===o.MIXED)return I;const k=I-c(A,d);switch(A){case o.NUMERIC:return Math.floor(k/10*3);case o.ALPHANUMERIC:return Math.floor(k/11*2);case o.KANJI:return Math.floor(k/13);case o.BYTE:default:return Math.floor(k/8)}},n.getBestVersionForData=function(d,p){let A;const B=i.from(p,i.M);if(Array.isArray(d)){if(d.length>1)return h(d,B);if(d.length===0)return 1;A=d[0]}else A=d;return l(A.mode,A.getLength(),B)},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}})(Dt)),Dt}var $t={},on;function os(){if(on)return $t;on=1;const n=Y(),t=1335,e=21522,i=n.getBCHDigit(t);return $t.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},$t}var qt={},Vt,rn;function rs(){if(rn)return Vt;rn=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))},Vt=t,Vt}var jt,sn;function ss(){if(sn)return jt;sn=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)},jt=e,jt}var Ht,an;function as(){if(an)return Ht;an=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)},Ht=t,Ht}var Gt,ln;function ls(){if(ln)return Gt;ln=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]+`
500
- Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),i.put(r,13)}},Gt=e,Gt}var Kt={exports:{}},cn;function cs(){return cn||(cn=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,A,B;!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,A=s[u],B=typeof s[u]>"u",(B||A>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})(Kt)),Kt.exports}var un;function us(){return un||(un=1,(function(n){const t=Q(),e=rs(),i=ss(),o=as(),r=ls(),s=tn(),a=Y(),l=cs();function c(S){return unescape(encodeURIComponent(S)).length}function u(S,I,k){const E=[];let O;for(;(O=S.exec(k))!==null;)E.push({data:O[0],index:O.index,mode:I,length:O[0].length});return E}function h(S){const I=u(s.NUMERIC,t.NUMERIC,S),k=u(s.ALPHANUMERIC,t.ALPHANUMERIC,S);let E,O;return a.isKanjiModeEnabled()?(E=u(s.BYTE,t.BYTE,S),O=u(s.KANJI,t.KANJI,S)):(E=u(s.BYTE_KANJI,t.BYTE,S),O=[]),I.concat(k,E,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,k){const E=I.length-1>=0?I[I.length-1]:null;return E&&E.mode===k.mode?(I[I.length-1].data+=k.data,I):(I.push(k),I)},[])}function p(S){const I=[];for(let k=0;k<S.length;k++){const E=S[k];switch(E.mode){case t.NUMERIC:I.push([E,{data:E.data,mode:t.ALPHANUMERIC,length:E.length},{data:E.data,mode:t.BYTE,length:E.length}]);break;case t.ALPHANUMERIC:I.push([E,{data:E.data,mode:t.BYTE,length:E.length}]);break;case t.KANJI:I.push([E,{data:E.data,mode:t.BYTE,length:c(E.data)}]);break;case t.BYTE:I.push([{data:E.data,mode:t.BYTE,length:c(E.data)}])}}return I}function A(S,I){const k={},E={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 _=w[g],b=""+m+g;y.push(b),k[b]={node:_,lastCount:0},E[b]={};for(let C=0;C<O.length;C++){const v=O[C];k[v]&&k[v].node.mode===_.mode?(E[v][b]=f(k[v].lastCount+_.length,_.mode)-f(k[v].lastCount,_.mode),k[v].lastCount+=_.length):(k[v]&&(k[v].lastCount=_.length),E[v][b]=f(_.length,_.mode)+4+t.getCharCountIndicator(_.mode,I))}}O=y}for(let m=0;m<O.length;m++)E[O[m]].end=0;return{map:E,table:k}}function B(S,I){let k;const E=t.getBestModeForData(S);if(k=t.from(I,E),k!==t.BYTE&&k.bit<E.bit)throw new Error('"'+S+'" cannot be encoded with mode '+t.toString(k)+`.
501
- Suggested mode is: `+t.toString(E));switch(k===t.KANJI&&!a.isKanjiModeEnabled()&&(k=t.BYTE),k){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(k,E){return typeof E=="string"?k.push(B(E,null)):E.data&&k.push(B(E.data,E.mode)),k},[])},n.fromString=function(I,k){const E=h(I,a.isKanjiModeEnabled()),O=p(E),m=A(O,k),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()))}})(qt)),qt}var dn;function ds(){if(dn)return Rt;dn=1;const n=Y(),t=Nt(),e=Qr(),i=Jr(),o=Zr(),r=Wr(),s=Xr(),a=Ke(),l=ns(),c=is(),u=os(),h=Q(),f=us();function d(m,w){const y=m.size,g=r.getPositions(w);for(let _=0;_<g.length;_++){const b=g[_][0],C=g[_][1];for(let v=-1;v<=7;v++)if(!(b+v<=-1||y<=b+v))for(let T=-1;T<=7;T++)C+T<=-1||y<=C+T||(v>=0&&v<=6&&(T===0||T===6)||T>=0&&T<=6&&(v===0||v===6)||v>=2&&v<=4&&T>=2&&T<=4?m.set(b+v,C+T,!0,!0):m.set(b+v,C+T,!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 A(m,w){const y=o.getPositions(w);for(let g=0;g<y.length;g++){const _=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(_+C,b+v,!0,!0):m.set(_+C,b+v,!1,!0)}}function B(m,w){const y=m.size,g=c.getEncodedBits(w);let _,b,C;for(let v=0;v<18;v++)_=Math.floor(v/3),b=v%3+y-8-3,C=(g>>v&1)===1,m.set(_,b,C,!0),m.set(b,_,C,!0)}function S(m,w,y){const g=m.size,_=u.getEncodedBits(w,y);let b,C;for(b=0;b<15;b++)C=(_>>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,_=y-1,b=7,C=0;for(let v=y-1;v>0;v-=2)for(v===6&&v--;;){for(let T=0;T<2;T++)if(!m.isReserved(_,v-T)){let K=!1;C<w.length&&(K=(w[C]>>>b&1)===1),m.set(_,v-T,K),b--,b===-1&&(C++,b=7)}if(_+=g,_<0||y<=_){_-=g,g=-g;break}}}function k(m,w,y){const g=new e;y.forEach(function(T){g.put(T.mode.bit,4),g.put(T.getLength(),h.getCharCountIndicator(T.mode,m)),T.write(g)});const _=n.getSymbolTotalCodewords(m),b=a.getTotalCodewordsCount(m,w),C=(_-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 T=0;T<v;T++)g.put(T%2?17:236,8);return E(g,m,w)}function E(m,w,y){const g=n.getSymbolTotalCodewords(w),_=a.getTotalCodewordsCount(w,y),b=g-_,C=a.getBlocksCount(w,y),v=g%C,T=C-v,K=Math.floor(g/C),ot=Math.floor(b/C),ps=ot+1,vn=K-ot,bs=new l(vn);let Zt=0;const ut=new Array(C),yn=new Array(C);let Wt=0;const vs=new Uint8Array(m.buffer);for(let tt=0;tt<C;tt++){const te=tt<T?ot:ps;ut[tt]=vs.slice(Zt,Zt+te),yn[tt]=bs.encode(ut[tt]),Zt+=te,Wt=Math.max(Wt,te)}const Xt=new Uint8Array(g);let wn=0,j,H;for(j=0;j<Wt;j++)for(H=0;H<C;H++)j<ut[H].length&&(Xt[wn++]=ut[H][j]);for(j=0;j<vn;j++)for(H=0;H<C;H++)Xt[wn++]=yn[H][j];return Xt}function O(m,w,y,g){let _;if(Array.isArray(m))_=f.fromArray(m);else if(typeof m=="string"){let K=w;if(!K){const ot=f.rawSplit(m);K=c.getBestVersionForData(ot,y)}_=f.fromString(m,K||40)}else throw new Error("Invalid data");const b=c.getBestVersionForData(_,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(`
591
+ `;function $r(){if(Pe(),document.getElementById("vd-styles")!==null)return;const n=document.createElement("style");n.id="vd-styles",n.textContent=Vr,document.head.appendChild(n)}function qr(n,t){const e=document.createElement("a");e.href=`data:image/png;base64,${n}`,e.download=t,e.click()}class jr{options;settings={};container=null;loading=null;slots={topRight:null,bottomRight:null};screenshotBtn=null;actionBar=null;cameraControls=null;attributes=null;groupHandles=new Map;lastSelectable=null;layout=null;commerce=null;constructor(t){this.options=t}attach(t){$r(),this.container=t,this.loading=new Cr(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 Sr({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&&Se(t.language,{reload:!1}),this.syncScreenshotButton(),this.actionBar?.applySettings(t),this.cameraControls!==null&&(this.cameraControls.element.style.display=t.cameraControls===!0?"flex":"none"),this.placeScreenshotButton()}renderAttributeControls(t,e){if(!(this.container===null||this.slots.topRight===null||this.slots.bottomRight===null)&&(this.cameraControls?.element.remove(),this.cameraControls=null,this.teardownConfigurator(),this.settings.cameraControls===!0&&(this.cameraControls=new lt(this.options.cameraApi,this.options.cameraPositionApi),this.cameraControls.element.style.display="none",this.slots.topRight.appendChild(this.cameraControls.element)),this.placeScreenshotButton(),e.length!==0)){this.attributes=document.createElement("div"),this.attributes.className="vd-attributes",this.groupHandles=new Map;for(const i of e){const o=Mr(i,t,this.options.eventBus,this.options.onSelect,this.options.onSelectTransient,this.options.onSubscribe);this.groupHandles.set(i.name,o),this.attributes.appendChild(o.element)}this.commerce=new Br(this.options.configuration),this.attributes.appendChild(this.commerce.element),this.layout=Ur(this.settings.configuratorLayout,this.slots.bottomRight),this.layout.attach(this.container,this.attributes),this.lastSelectable!==null&&this.applySelectable(this.lastSelectable)}}applySelectable(t){this.lastSelectable=t;for(const[e,i]of this.groupHandles){const o=t.find(r=>r.name===e);i.setSelectable(o?.selectable??null),i.setHidden(o?.hidden===!0)}}get viewerSettings(){return this.settings}teardownConfigurator(){this.commerce?.destroy(),this.commerce=null,this.attributes?.remove(),this.attributes=null,this.groupHandles=new Map,this.layout?.destroy(),this.layout=null}destroy(){this.loading?.destroy(),this.screenshotBtn?.element.remove(),this.actionBar?.destroy(),this.actionBar?.element.remove(),this.cameraControls?.element.remove(),this.teardownConfigurator();for(const t of Object.values(this.slots))t?.remove();this.container=null}createSlot(t,e){const i=document.createElement("div");return i.className=e,t.appendChild(i),i}syncScreenshotButton(){const t=this.settings.screenshot===!0;t&&this.screenshotBtn===null&&(this.screenshotBtn=new D({variant:"outline",size:"icon",label:Xi(),icon:z.screenshot(),onClick:()=>{this.options.snapshotApi.take("snapshot.png").onDeveloped(({data:e,filename:i})=>{qr(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 Hr={};class Gr{defaultServer="https://server.virtualdisplay.io";options;serverHost;extraParams;constructor(t,e,i){this.options=t,this.serverHost=e,this.extraParams=i}create(){const t=this.createContainer(),e=this.createIframe();return t.appendChild(e),this.attachToParent(t),{container:t,iframe:e}}createContainer(){const t=document.createElement("div");return t.className="vd-container",Object.assign(t.style,{position:"relative",width:"100%",height:"100%",overflow:"hidden"}),t}createIframe(){const t=document.createElement("iframe");return t.src=this.buildUrl(),t.setAttribute("allow","xr-spatial-tracking; fullscreen"),t}attachToParent(t){this.getParentElement().appendChild(t)}buildUrl(){const t=this.getServerUrl(),e=new URL(t);this.setAddressParams(e),this.options.language!==void 0&&e.searchParams.set("language",this.options.language),this.options.session!==void 0&&e.searchParams.set("session",this.options.session),this.options.debug===!0&&e.searchParams.set("debug","true"),this.options.traceparent!==void 0&&e.searchParams.set("traceparent",this.options.traceparent);for(const[i,o]of Object.entries(this.extraParams??{}))e.searchParams.set(i,o);return e.toString()}setAddressParams(t){if(this.options.app===void 0){t.searchParams.set("license",this.options.license),t.searchParams.set("model",this.options.model);return}t.searchParams.set("app",this.options.app),(this.options.license!==void 0||this.options.model!==void 0)&&N.logger.warn("Both `app` and `license`/`model` were supplied: `app` wins, the pair was ignored")}getServerUrl(){if(this.serverHost!==void 0)return this.serverHost;if(Hr?.VITE_VIRTUALDISPLAY_SERVER_HOST===void 0)return this.defaultServer}getParentElement(){if(typeof this.options.parent!="string")return this.options.parent;const t=document.querySelector(this.options.parent);if(t===null)throw O.parentNotFound(this.options.parent);return t}}function Kr(n){const{messenger:t}=n;t.on(I.HANDSHAKE,e=>{Tn(e)&&(N.logger.info("Server handshake received, flushing publisher queue"),t.markReady())}),t.on(I.SESSION,e=>{Rn(e)&&n.onSession(e.sessionId)}),t.on(I.MUTATION,e=>{Mn(e)&&(n.attributes.handleMutationResult(e),n.configuration.handleSelectionChanged(n.attributes.getSelection()))}),t.on(I.SNAPSHOT,e=>{Nn(e)&&n.snapshot.handleSnapshotResult(e)}),t.on(I.CAMERA,e=>{Pn(e)&&n.cameraPosition.handlePositionUpdate(e)}),t.on(I.LOADING_INDICATOR,e=>{Bn(e)&&(e.error!==void 0?n.ui.showError(e.error):n.ui.updateProgress(e.progress,e.phase))}),t.on(I.CONFIG,e=>{zn(e)&&n.applyConfig(e)}),t.on(I.MAPPING,e=>{Ln(e)&&(n.attributes.handleMappingReceived(e),n.configuration.handleSelectionChanged(n.attributes.getSelection()),n.ui.renderAttributeControls(n.attributes,e.attributes),n.readyStateTracker.handleMappingReceived())}),Yr(n)}function Yr(n){const{messenger:t}=n;t.on(I.FOCUS,e=>{Dn(e)&&n.focus.handleStateReceived(e)}),t.on(I.PRICING,e=>{Fn(e)&&n.configuration.handlePricingReceived(e.pricing)}),t.on(I.SYNC,e=>{xn(e)&&n.onSync(e.connected)}),t.on(I.SELECTABLE,e=>{On(e)&&(n.selectable.handleSnapshot(e),n.ui.applySelectable(e.attributes))}),t.on(I.APP_RESOLVED,e=>{In(e)&&n.onAppResolved(e)})}class Qr{ready=!1;onReady;constructor(t){this.onReady=t}handleMappingReceived(){this.ready||(this.ready=!0,N.logger.info("Mapping received from server, client is now ready"),this.onReady?.())}get isReady(){return this.ready}clear(){this.ready=!1}}class Jr{attributes;selectableState;readyStateTracker;messenger;cameraApi;cameraPositionApi;focusApi;configurationApi;snapshotApi;annotationsApi;eventBus;ui;options;serverHost;iframeParams;arActivation;syncTracker;iframe;container;readyCallbacks=[];mutationFailedCallbacks=[];viewerSessionId;resolvedApp;appResolvedCallbacks=[];constructor(t,e){this.options=t;const i=e??{};this.serverHost=i.serverHost,this.iframeParams=i.iframeParams,this.initializeLogging(),this.messenger=new Un(()=>this.iframe?.contentWindow??null,i.messengerOptions);const o=r=>{this.messenger.send(r)};this.attributes=new oi(o,(r,s)=>{this.notifyMutationFailed(r,s)}),this.selectableState=new ri,this.snapshotApi=new ve(o),this.annotationsApi=new ie(o),this.cameraApi=new he(o),this.cameraPositionApi=new si,this.focusApi=new ge(o,r=>{this.dispatchFocusChange(r)}),this.configurationApi=new me(r=>{this.dispatchConfigurationChange(r)},r=>{this.dispatchConfigurationSubmit(r)}),this.eventBus=new ci,this.arActivation=i.createArActivation?.(o),this.syncTracker=i.createSyncTracker?.(),this.readyStateTracker=new Qr(()=>{this.notifyReady()}),this.ui=this.createStandardInterface(),this.wireIncomingMessages(),i.registerHandlers?.(this.messenger,o),this.messenger.start(),this.createAndConnectIframe()}createStandardInterface(){const t=this.arActivation;return new jr({snapshotApi:this.snapshotApi,cameraApi:this.cameraApi,cameraPositionApi:this.cameraPositionApi,eventBus:this.eventBus,configuration:this.configurationApi,onSelect:(e,i)=>this.attributes.select(e,i),onSelectTransient:(e,i)=>this.attributes.selectTransient(e,i),onSubscribe:(e,i)=>this.attributes.onChange(e,i),...t!==void 0&&{onAr:()=>{t.activate()}},onFullscreenEnter:()=>{this.trackFullscreen()}})}wireIncomingMessages(){Kr({messenger:this.messenger,attributes:this.attributes,selectable:this.selectableState,configuration:this.configurationApi,snapshot:this.snapshotApi,cameraPosition:this.cameraPositionApi,focus:this.focusApi,ui:this.ui,readyStateTracker:this.readyStateTracker,applyConfig:t=>{this.handleConfig(t)},onSession:t=>{this.handleSession(t)},onSync:t=>{this.syncTracker?.handleSync(t)},onAppResolved:t=>{this.handleAppResolved({appType:t.appType,name:t.name,...t.slug!==void 0&&{slug:t.slug},...t.submit!==void 0&&{submit:t.submit}})}})}handleAppResolved(t){this.resolvedApp=t;for(const e of this.appResolvedCallbacks)e(t)}handleSession(t){this.viewerSessionId=t,this.arActivation?.onSession(t)}notifyMutationFailed(t,e){for(const i of this.mutationFailedCallbacks)i({attribute:t,value:e})}notifyReady(){const t=this.readyCallbacks;this.readyCallbacks=[];for(const e of t)e(this);this.ui.onReady()}dispatchFocusChange(t){this.container?.dispatchEvent(new CustomEvent(K.FOCUS_CHANGE,{detail:t,bubbles:!0}))}dispatchConfigurationChange(t){this.container?.dispatchEvent(new CustomEvent(K.CONFIGURATION_CHANGE,{detail:t??null,bubbles:!0}))}dispatchConfigurationSubmit(t){this.container?.dispatchEvent(new CustomEvent(K.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&&N.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:I.FULLSCREEN})}initializeLogging(){this.options.debug===!0&&de(),N.logger.info("Initializing Virtualdisplay client",{...this.options.app===void 0?{model:this.options.model}:{app:this.options.app}})}createAndConnectIframe(){const e=new Gr(this.options,this.serverHost,this.iframeParams).create();this.container=e.container,this.iframe=e.iframe,this.eventBus.attach(this.container),this.ui.attach(this.container);try{const i=new URL(this.iframe.src).origin;this.messenger.setTargetOrigin(i)}catch{}}select(t,e){this.attributes.select(t,e)}getValues(t){return this.attributes.getValues(t)}getValue(t,e){return this.attributes.getValue(t,e)}onChange(t,e){this.attributes.onChange(t,e)}getAttribute(t){return this.attributes.getAttribute(t)}get isReady(){return this.readyStateTracker.isReady}onReady(t){if(this.readyStateTracker.isReady){t(this);return}this.readyCallbacks.push(t)}onMutationFailed(t){this.mutationFailedCallbacks.push(t)}onSelectableChange(t){this.selectableState.onChange(t)}onAppResolved(t){this.appResolvedCallbacks.push(t),this.resolvedApp!==void 0&&t(this.resolvedApp)}getSelectable(t){return this.selectableState.selectableFor(t)}activateAr(){this.arActivation?.activate()}on(t,e){this.eventBus.on(t,e)}get annotations(){return this.annotationsApi}get camera(){return this.cameraApi}get focus(){return this.focusApi}get configuration(){return this.configurationApi}get cameraPosition(){return this.cameraPositionApi}get snapshot(){return this.snapshotApi}get sessionId(){return this.viewerSessionId}get viewerSettings(){return this.ui.viewerSettings}destroy(){this.readyStateTracker.clear(),this.readyCallbacks=[],this.mutationFailedCallbacks.length=0,this.snapshotApi.clear(),this.messenger.destroy(),this.arActivation?.destroy(),this.ui.destroy(),this.container?.parentElement!==null&&this.container?.parentElement!==void 0&&this.container.parentElement.removeChild(this.container),this.container=void 0,this.iframe=void 0}}const Zr="ar.virtualdisplay.io";function Wr(n){const t=new URL(`https://${Zr}/go`);return n.sessionId!==void 0?t.searchParams.set("session",n.sessionId):n.app!==void 0?t.searchParams.set("app",n.app):n.license!==void 0&&n.model!==void 0&&(t.searchParams.set("license",n.license),t.searchParams.set("model",n.model)),t.toString()}const Xr=1500;class ts{options;qrModal=new gr;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(ei()){this.options.send({type:I.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=Wr({sessionId:t,app:this.options.app,license:this.options.license,model:this.options.model}),i=await this.qrModal.update(e);if(this.destroyed){this.qrModal.hide();return}i&&this.options.send({type:I.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)},Xr);this.pendingTimers.add(e),this.waiters.push(i=>{this.pendingTimers.delete(e),clearTimeout(e),t(i)})})}}class es{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 ns extends Jr{syncStatusTracker;constructor(t){const e=new es;super(t,{createArActivation:i=>new ts({app:t.app,license:t.license,model:t.model,send:i}),createSyncTracker:()=>e}),this.syncStatusTracker=e}onSyncChange(t){this.syncStatusTracker.onChange(t)}}function is(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var X={},Tt,Ue;function os(){return Ue||(Ue=1,Tt=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),Tt}var Rt={},Y={},Ve;function J(){if(Ve)return Y;Ve=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 Y.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},Y.getSymbolTotalCodewords=function(i){return t[i]},Y.getBCHDigit=function(e){let i=0;for(;e!==0;)i++,e>>>=1;return i},Y.setToSJISFunction=function(i){if(typeof i!="function")throw new Error('"toSJISFunc" is not a valid function.');n=i},Y.isKanjiModeEnabled=function(){return typeof n<"u"},Y.toSJIS=function(i){return n(i)},Y}var It={},$e;function Mt(){return $e||($e=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}}})(It)),It}var Nt,qe;function rs(){if(qe)return Nt;qe=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++}},Nt=n,Nt}var Pt,je;function ss(){if(je)return Pt;je=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]},Pt=n,Pt}var Lt={},He;function as(){return He||(He=1,(function(n){const t=J().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}})(Lt)),Lt}var Bt={},Ge;function ls(){if(Ge)return Bt;Ge=1;const n=J().getSymbolSize,t=7;return Bt.getPositions=function(i){const o=n(i);return[[0,0],[o-t,0],[0,o-t]]},Bt}var xt={},Ke;function cs(){return Ke||(Ke=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 d=0;d<r;d++){a=l=0,c=u=null;for(let f=0;f<r;f++){let h=o.get(d,f);h===c?a++:(a>=5&&(s+=t.N1+(a-5)),c=h,a=1),h=o.get(f,d),h===u?l++:(l>=5&&(s+=t.N1+(l-5)),u=h,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}})(xt)),xt}var ct={},Ye;function Qe(){if(Ye)return ct;Ye=1;const n=Mt(),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 ct.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}},ct.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}},ct}var Ot={},it={},Je;function us(){if(Je)return it;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]})(),it.log=function(i){if(i<1)throw new Error("log("+i+")");return t[i]},it.exp=function(i){return n[i]},it.mul=function(i,o){return i===0||o===0?0:n[t[i]+t[o]]},it}var Ze;function ds(){return Ze||(Ze=1,(function(n){const t=us();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}})(Ot)),Ot}var zt,We;function hs(){if(We)return zt;We=1;const n=ds();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},zt=t,zt}var Dt={},Ft={},Ut={},Xe;function tn(){return Xe||(Xe=1,Ut.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),Ut}var q={},en;function nn(){if(en)return q;en=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
592
+ ]))+`;q.KANJI=new RegExp(e,"g"),q.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),q.BYTE=new RegExp(i,"g"),q.NUMERIC=new RegExp(n,"g"),q.ALPHANUMERIC=new RegExp(t,"g");const o=new RegExp("^"+e+"$"),r=new RegExp("^"+n+"$"),s=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return q.testKanji=function(l){return o.test(l)},q.testNumeric=function(l){return r.test(l)},q.testAlphanumeric=function(l){return s.test(l)},q}var on;function Z(){return on||(on=1,(function(n){const t=tn(),e=nn();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}}})(Ft)),Ft}var rn;function fs(){return rn||(rn=1,(function(n){const t=J(),e=Qe(),i=Mt(),o=Z(),r=tn(),s=7973,a=t.getBCHDigit(s);function l(f,h,p){for(let A=1;A<=40;A++)if(h<=n.getCapacity(A,p,f))return A}function c(f,h){return o.getCharCountIndicator(f,h)+4}function u(f,h){let p=0;return f.forEach(function(A){const L=c(A.mode,h);p+=L+A.getBitsLength()}),p}function d(f,h){for(let p=1;p<=40;p++)if(u(f,p)<=n.getCapacity(p,h,o.MIXED))return p}n.from=function(h,p){return r.isValid(h)?parseInt(h,10):p},n.getCapacity=function(h,p,A){if(!r.isValid(h))throw new Error("Invalid QR Code version");typeof A>"u"&&(A=o.BYTE);const L=t.getSymbolTotalCodewords(h),S=e.getTotalCodewordsCount(h,p),M=(L-S)*8;if(A===o.MIXED)return M;const k=M-c(A,h);switch(A){case o.NUMERIC:return Math.floor(k/10*3);case o.ALPHANUMERIC:return Math.floor(k/11*2);case o.KANJI:return Math.floor(k/13);case o.BYTE:default:return Math.floor(k/8)}},n.getBestVersionForData=function(h,p){let A;const L=i.from(p,i.M);if(Array.isArray(h)){if(h.length>1)return d(h,L);if(h.length===0)return 1;A=h[0]}else A=h;return l(A.mode,A.getLength(),L)},n.getEncodedBits=function(h){if(!r.isValid(h)||h<7)throw new Error("Invalid QR Code version");let p=h<<12;for(;t.getBCHDigit(p)-a>=0;)p^=s<<t.getBCHDigit(p)-a;return h<<12|p}})(Dt)),Dt}var Vt={},sn;function ms(){if(sn)return Vt;sn=1;const n=J(),t=1335,e=21522,i=n.getBCHDigit(t);return Vt.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},Vt}var $t={},qt,an;function gs(){if(an)return qt;an=1;const n=Z();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))},qt=t,qt}var jt,ln;function ps(){if(ln)return jt;ln=1;const n=Z(),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)},jt=e,jt}var Ht,cn;function bs(){if(cn)return Ht;cn=1;const n=Z();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)},Ht=t,Ht}var Gt,un;function vs(){if(un)return Gt;un=1;const n=Z(),t=J();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]+`
593
+ Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),i.put(r,13)}},Gt=e,Gt}var Kt={exports:{}},dn;function ys(){return dn||(dn=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,d,f,h,p,A,L;!a.empty();){l=a.pop(),c=l.value,d=l.cost,f=e[c]||{};for(u in f)f.hasOwnProperty(u)&&(h=f[u],p=d+h,A=s[u],L=typeof s[u]>"u",(L||A>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})(Kt)),Kt.exports}var hn;function ws(){return hn||(hn=1,(function(n){const t=Z(),e=gs(),i=ps(),o=bs(),r=vs(),s=nn(),a=J(),l=ys();function c(S){return unescape(encodeURIComponent(S)).length}function u(S,M,k){const E=[];let x;for(;(x=S.exec(k))!==null;)E.push({data:x[0],index:x.index,mode:M,length:x[0].length});return E}function d(S){const M=u(s.NUMERIC,t.NUMERIC,S),k=u(s.ALPHANUMERIC,t.ALPHANUMERIC,S);let E,x;return a.isKanjiModeEnabled()?(E=u(s.BYTE,t.BYTE,S),x=u(s.KANJI,t.KANJI,S)):(E=u(s.BYTE_KANJI,t.BYTE,S),x=[]),M.concat(k,E,x).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,M){switch(M){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 h(S){return S.reduce(function(M,k){const E=M.length-1>=0?M[M.length-1]:null;return E&&E.mode===k.mode?(M[M.length-1].data+=k.data,M):(M.push(k),M)},[])}function p(S){const M=[];for(let k=0;k<S.length;k++){const E=S[k];switch(E.mode){case t.NUMERIC:M.push([E,{data:E.data,mode:t.ALPHANUMERIC,length:E.length},{data:E.data,mode:t.BYTE,length:E.length}]);break;case t.ALPHANUMERIC:M.push([E,{data:E.data,mode:t.BYTE,length:E.length}]);break;case t.KANJI:M.push([E,{data:E.data,mode:t.BYTE,length:c(E.data)}]);break;case t.BYTE:M.push([{data:E.data,mode:t.BYTE,length:c(E.data)}])}}return M}function A(S,M){const k={},E={start:{}};let x=["start"];for(let g=0;g<S.length;g++){const w=S[g],y=[];for(let m=0;m<w.length;m++){const _=w[m],b=""+g+m;y.push(b),k[b]={node:_,lastCount:0},E[b]={};for(let C=0;C<x.length;C++){const v=x[C];k[v]&&k[v].node.mode===_.mode?(E[v][b]=f(k[v].lastCount+_.length,_.mode)-f(k[v].lastCount,_.mode),k[v].lastCount+=_.length):(k[v]&&(k[v].lastCount=_.length),E[v][b]=f(_.length,_.mode)+4+t.getCharCountIndicator(_.mode,M))}}x=y}for(let g=0;g<x.length;g++)E[x[g]].end=0;return{map:E,table:k}}function L(S,M){let k;const E=t.getBestModeForData(S);if(k=t.from(M,E),k!==t.BYTE&&k.bit<E.bit)throw new Error('"'+S+'" cannot be encoded with mode '+t.toString(k)+`.
594
+ Suggested mode is: `+t.toString(E));switch(k===t.KANJI&&!a.isKanjiModeEnabled()&&(k=t.BYTE),k){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(M){return M.reduce(function(k,E){return typeof E=="string"?k.push(L(E,null)):E.data&&k.push(L(E.data,E.mode)),k},[])},n.fromString=function(M,k){const E=d(M,a.isKanjiModeEnabled()),x=p(E),g=A(x,k),w=l.find_path(g.map,"start","end"),y=[];for(let m=1;m<w.length-1;m++)y.push(g.table[w[m]].node);return n.fromArray(h(y))},n.rawSplit=function(M){return n.fromArray(d(M,a.isKanjiModeEnabled()))}})($t)),$t}var fn;function Cs(){if(fn)return Rt;fn=1;const n=J(),t=Mt(),e=rs(),i=ss(),o=as(),r=ls(),s=cs(),a=Qe(),l=hs(),c=fs(),u=ms(),d=Z(),f=ws();function h(g,w){const y=g.size,m=r.getPositions(w);for(let _=0;_<m.length;_++){const b=m[_][0],C=m[_][1];for(let v=-1;v<=7;v++)if(!(b+v<=-1||y<=b+v))for(let T=-1;T<=7;T++)C+T<=-1||y<=C+T||(v>=0&&v<=6&&(T===0||T===6)||T>=0&&T<=6&&(v===0||v===6)||v>=2&&v<=4&&T>=2&&T<=4?g.set(b+v,C+T,!0,!0):g.set(b+v,C+T,!1,!0))}}function p(g){const w=g.size;for(let y=8;y<w-8;y++){const m=y%2===0;g.set(y,6,m,!0),g.set(6,y,m,!0)}}function A(g,w){const y=o.getPositions(w);for(let m=0;m<y.length;m++){const _=y[m][0],b=y[m][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?g.set(_+C,b+v,!0,!0):g.set(_+C,b+v,!1,!0)}}function L(g,w){const y=g.size,m=c.getEncodedBits(w);let _,b,C;for(let v=0;v<18;v++)_=Math.floor(v/3),b=v%3+y-8-3,C=(m>>v&1)===1,g.set(_,b,C,!0),g.set(b,_,C,!0)}function S(g,w,y){const m=g.size,_=u.getEncodedBits(w,y);let b,C;for(b=0;b<15;b++)C=(_>>b&1)===1,b<6?g.set(b,8,C,!0):b<8?g.set(b+1,8,C,!0):g.set(m-15+b,8,C,!0),b<8?g.set(8,m-b-1,C,!0):b<9?g.set(8,15-b-1+1,C,!0):g.set(8,15-b-1,C,!0);g.set(m-8,8,1,!0)}function M(g,w){const y=g.size;let m=-1,_=y-1,b=7,C=0;for(let v=y-1;v>0;v-=2)for(v===6&&v--;;){for(let T=0;T<2;T++)if(!g.isReserved(_,v-T)){let Q=!1;C<w.length&&(Q=(w[C]>>>b&1)===1),g.set(_,v-T,Q),b--,b===-1&&(C++,b=7)}if(_+=m,_<0||y<=_){_-=m,m=-m;break}}}function k(g,w,y){const m=new e;y.forEach(function(T){m.put(T.mode.bit,4),m.put(T.getLength(),d.getCharCountIndicator(T.mode,g)),T.write(m)});const _=n.getSymbolTotalCodewords(g),b=a.getTotalCodewordsCount(g,w),C=(_-b)*8;for(m.getLengthInBits()+4<=C&&m.put(0,4);m.getLengthInBits()%8!==0;)m.putBit(0);const v=(C-m.getLengthInBits())/8;for(let T=0;T<v;T++)m.put(T%2?17:236,8);return E(m,g,w)}function E(g,w,y){const m=n.getSymbolTotalCodewords(w),_=a.getTotalCodewordsCount(w,y),b=m-_,C=a.getBlocksCount(w,y),v=m%C,T=C-v,Q=Math.floor(m/C),ot=Math.floor(b/C),ks=ot+1,wn=Q-ot,Ts=new l(wn);let Zt=0;const ut=new Array(C),Cn=new Array(C);let Wt=0;const Rs=new Uint8Array(g.buffer);for(let tt=0;tt<C;tt++){const te=tt<T?ot:ks;ut[tt]=Rs.slice(Zt,Zt+te),Cn[tt]=Ts.encode(ut[tt]),Zt+=te,Wt=Math.max(Wt,te)}const Xt=new Uint8Array(m);let Sn=0,j,H;for(j=0;j<Wt;j++)for(H=0;H<C;H++)j<ut[H].length&&(Xt[Sn++]=ut[H][j]);for(j=0;j<wn;j++)for(H=0;H<C;H++)Xt[Sn++]=Cn[H][j];return Xt}function x(g,w,y,m){let _;if(Array.isArray(g))_=f.fromArray(g);else if(typeof g=="string"){let Q=w;if(!Q){const ot=f.rawSplit(g);Q=c.getBestVersionForData(ot,y)}_=f.fromString(g,Q||40)}else throw new Error("Invalid data");const b=c.getBestVersionForData(_,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(`
502
595
  The chosen QR Code version cannot contain this amount of data.
503
596
  Minimum version required to store current data is: `+b+`.
504
- `);const C=k(w,y,_),v=n.getSymbolSize(w),T=new i(v);return d(T,w),p(T),A(T,w),S(T,y,0),w>=7&&B(T,w),I(T,C),isNaN(g)&&(g=s.getBestMask(T,S.bind(null,T,y))),s.applyMask(g,T),S(T,y,g),{modules:T,version:w,errorCorrectionLevel:y,maskPattern:g,segments:_}}return Rt.create=function(w,y){if(typeof w>"u"||w==="")throw new Error("No input text");let g=t.M,_,b;return typeof y<"u"&&(g=t.from(y.errorCorrectionLevel,t.M),_=c.from(y.version),b=s.from(y.maskPattern),y.toSJISFunc&&n.setToSJISFunction(y.toSJISFunc)),O(w,_,g,b)},Rt}var Yt={},Qt={},hn;function fn(){return hn||(hn=1,(function(n){function t(e){if(typeof e=="number"&&(e=e.toString()),typeof e!="string")throw new Error("Color should be defined as hex string");let i=e.slice().replace("#","").split("");if(i.length<3||i.length===5||i.length>8)throw new Error("Invalid hex color: "+e);(i.length===3||i.length===4)&&(i=Array.prototype.concat.apply([],i.map(function(r){return[r,r]}))),i.length===6&&i.push("F","F");const o=parseInt(i.join(""),16);return{r:o>>24&255,g:o>>16&255,b:o>>8&255,a:o&255,hex:"#"+i.slice(0,6).join("")}}n.getOptions=function(i){i||(i={}),i.color||(i.color={});const o=typeof i.margin>"u"||i.margin===null||i.margin<0?4:i.margin,r=i.width&&i.width>=21?i.width:void 0,s=i.scale||4;return{width:r,scale:r?4:s,margin:o,color:{dark:t(i.color.dark||"#000000ff"),light:t(i.color.light||"#ffffffff")},type:i.type,rendererOpts:i.rendererOpts||{}}},n.getScale=function(i,o){return o.width&&o.width>=i+o.margin*2?o.width/(i+o.margin*2):o.scale},n.getImageWidth=function(i,o){const r=n.getScale(i,o);return Math.floor((i+o.margin*2)*r)},n.qrToImageData=function(i,o,r){const s=o.modules.size,a=o.modules.data,l=n.getScale(s,r),c=Math.floor((s+r.margin*2)*l),u=r.margin*l,h=[r.color.light,r.color.dark];for(let f=0;f<c;f++)for(let d=0;d<c;d++){let p=(f*c+d)*4,A=r.color.light;if(f>=u&&d>=u&&f<c-u&&d<c-u){const B=Math.floor((f-u)/l),S=Math.floor((d-u)/l);A=h[a[B*s+S]?1:0]}i[p++]=A.r,i[p++]=A.g,i[p++]=A.b,i[p]=A.a}}})(Qt)),Qt}var gn;function hs(){return gn||(gn=1,(function(n){const t=fn();function e(o,r,s){o.clearRect(0,0,r.width,r.height),r.style||(r.style={}),r.height=s,r.width=s,r.style.height=s+"px",r.style.width=s+"px"}function i(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}n.render=function(r,s,a){let l=a,c=s;typeof l>"u"&&(!s||!s.getContext)&&(l=s,s=void 0),s||(c=i()),l=t.getOptions(l);const u=t.getImageWidth(r.modules.size,l),h=c.getContext("2d"),f=h.createImageData(u,u);return t.qrToImageData(f.data,r,l),e(h,c,u),h.putImageData(f,0,0),c},n.renderToDataURL=function(r,s,a){let l=a;typeof l>"u"&&(!s||!s.getContext)&&(l=s,s=void 0),l||(l={});const c=n.render(r,s,l),u=l.type||"image/png",h=l.rendererOpts||{};return c.toDataURL(u,h.quality)}})(Yt)),Yt}var Jt={},mn;function fs(){if(mn)return Jt;mn=1;const n=fn();function t(o,r){const s=o.a/255,a=r+'="'+o.hex+'"';return s<1?a+" "+r+'-opacity="'+s.toFixed(2).slice(1)+'"':a}function e(o,r,s){let a=o+r;return typeof s<"u"&&(a+=" "+s),a}function i(o,r,s){let a="",l=0,c=!1,u=0;for(let h=0;h<o.length;h++){const f=Math.floor(h%r),d=Math.floor(h/r);!f&&!c&&(c=!0),o[h]?(u++,h>0&&f>0&&o[h-1]||(a+=c?e("M",f+s,.5+d+s):e("m",l,0),l=0,c=!1),f+1<r&&o[h+1]||(a+=e("h",u),u=0)):l++}return a}return Jt.render=function(r,s,a){const l=n.getOptions(s),c=r.modules.size,u=r.modules.data,h=c+l.margin*2,f=l.color.light.a?"<path "+t(l.color.light,"fill")+' d="M0 0h'+h+"v"+h+'H0z"/>':"",d="<path "+t(l.color.dark,"stroke")+' d="'+i(u,c,l.margin)+'"/>',p='viewBox="0 0 '+h+" "+h+'"',B='<svg xmlns="http://www.w3.org/2000/svg" '+(l.width?'width="'+l.width+'" height="'+l.width+'" ':"")+p+' shape-rendering="crispEdges">'+f+d+`</svg>
505
- `;return typeof a=="function"&&a(null,B),B},Jt}var pn;function gs(){if(pn)return X;pn=1;const n=Yr(),t=ds(),e=hs(),i=fs();function o(r,s,a,l,c){const u=[].slice.call(arguments,1),h=u.length,f=typeof u[h-1]=="function";if(!f&&!n())throw new Error("Callback required as last argument");if(f){if(h<2)throw new Error("Too few arguments provided");h===2?(c=a,a=s,s=l=void 0):h===3&&(s.getContext&&typeof c>"u"?(c=l,l=void 0):(c=l,l=a,a=s,s=void 0))}else{if(h<1)throw new Error("Too few arguments provided");return h===1?(a=s,s=l=void 0):h===2&&!s.getContext&&(l=a,a=s,s=void 0),new Promise(function(d,p){try{const A=t.create(a,l);d(r(A,s,l))}catch(A){p(A)}})}try{const d=t.create(a,l);c(null,r(d,s,l))}catch(d){c(d)}}return X.create=t.create,X.toCanvas=o.bind(null,e.render),X.toDataURL=o.bind(null,e.renderToDataURL),X.toString=o.bind(null,function(r,s,a){return i.render(r,a)}),X}var bn=gs();const ms=et({__proto__:null,default:Kr(bn)},[bn]);M.Annotations=ie,M.Attribute=re,M.AttributeValue=oe,M.Camera=he,M.Configuration=ge,M.ERROR_CODES=q,M.Focus=me,M.Photo=pe,M.Snapshot=ve,M.VD_EVENTS=W,M.VirtualdisplayClient=Gr,M.VirtualdisplayError=x,M.enableDebugMode=de,M.isDebugMode=Xn,Object.defineProperty(M,Symbol.toStringTag,{value:"Module"})}));
597
+ `);const C=k(w,y,_),v=n.getSymbolSize(w),T=new i(v);return h(T,w),p(T),A(T,w),S(T,y,0),w>=7&&L(T,w),M(T,C),isNaN(m)&&(m=s.getBestMask(T,S.bind(null,T,y))),s.applyMask(m,T),S(T,y,m),{modules:T,version:w,errorCorrectionLevel:y,maskPattern:m,segments:_}}return Rt.create=function(w,y){if(typeof w>"u"||w==="")throw new Error("No input text");let m=t.M,_,b;return typeof y<"u"&&(m=t.from(y.errorCorrectionLevel,t.M),_=c.from(y.version),b=s.from(y.maskPattern),y.toSJISFunc&&n.setToSJISFunction(y.toSJISFunc)),x(w,_,m,b)},Rt}var Yt={},Qt={},mn;function gn(){return mn||(mn=1,(function(n){function t(e){if(typeof e=="number"&&(e=e.toString()),typeof e!="string")throw new Error("Color should be defined as hex string");let i=e.slice().replace("#","").split("");if(i.length<3||i.length===5||i.length>8)throw new Error("Invalid hex color: "+e);(i.length===3||i.length===4)&&(i=Array.prototype.concat.apply([],i.map(function(r){return[r,r]}))),i.length===6&&i.push("F","F");const o=parseInt(i.join(""),16);return{r:o>>24&255,g:o>>16&255,b:o>>8&255,a:o&255,hex:"#"+i.slice(0,6).join("")}}n.getOptions=function(i){i||(i={}),i.color||(i.color={});const o=typeof i.margin>"u"||i.margin===null||i.margin<0?4:i.margin,r=i.width&&i.width>=21?i.width:void 0,s=i.scale||4;return{width:r,scale:r?4:s,margin:o,color:{dark:t(i.color.dark||"#000000ff"),light:t(i.color.light||"#ffffffff")},type:i.type,rendererOpts:i.rendererOpts||{}}},n.getScale=function(i,o){return o.width&&o.width>=i+o.margin*2?o.width/(i+o.margin*2):o.scale},n.getImageWidth=function(i,o){const r=n.getScale(i,o);return Math.floor((i+o.margin*2)*r)},n.qrToImageData=function(i,o,r){const s=o.modules.size,a=o.modules.data,l=n.getScale(s,r),c=Math.floor((s+r.margin*2)*l),u=r.margin*l,d=[r.color.light,r.color.dark];for(let f=0;f<c;f++)for(let h=0;h<c;h++){let p=(f*c+h)*4,A=r.color.light;if(f>=u&&h>=u&&f<c-u&&h<c-u){const L=Math.floor((f-u)/l),S=Math.floor((h-u)/l);A=d[a[L*s+S]?1:0]}i[p++]=A.r,i[p++]=A.g,i[p++]=A.b,i[p]=A.a}}})(Qt)),Qt}var pn;function Ss(){return pn||(pn=1,(function(n){const t=gn();function e(o,r,s){o.clearRect(0,0,r.width,r.height),r.style||(r.style={}),r.height=s,r.width=s,r.style.height=s+"px",r.style.width=s+"px"}function i(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}n.render=function(r,s,a){let l=a,c=s;typeof l>"u"&&(!s||!s.getContext)&&(l=s,s=void 0),s||(c=i()),l=t.getOptions(l);const u=t.getImageWidth(r.modules.size,l),d=c.getContext("2d"),f=d.createImageData(u,u);return t.qrToImageData(f.data,r,l),e(d,c,u),d.putImageData(f,0,0),c},n.renderToDataURL=function(r,s,a){let l=a;typeof l>"u"&&(!s||!s.getContext)&&(l=s,s=void 0),l||(l={});const c=n.render(r,s,l),u=l.type||"image/png",d=l.rendererOpts||{};return c.toDataURL(u,d.quality)}})(Yt)),Yt}var Jt={},bn;function Es(){if(bn)return Jt;bn=1;const n=gn();function t(o,r){const s=o.a/255,a=r+'="'+o.hex+'"';return s<1?a+" "+r+'-opacity="'+s.toFixed(2).slice(1)+'"':a}function e(o,r,s){let a=o+r;return typeof s<"u"&&(a+=" "+s),a}function i(o,r,s){let a="",l=0,c=!1,u=0;for(let d=0;d<o.length;d++){const f=Math.floor(d%r),h=Math.floor(d/r);!f&&!c&&(c=!0),o[d]?(u++,d>0&&f>0&&o[d-1]||(a+=c?e("M",f+s,.5+h+s):e("m",l,0),l=0,c=!1),f+1<r&&o[d+1]||(a+=e("h",u),u=0)):l++}return a}return Jt.render=function(r,s,a){const l=n.getOptions(s),c=r.modules.size,u=r.modules.data,d=c+l.margin*2,f=l.color.light.a?"<path "+t(l.color.light,"fill")+' d="M0 0h'+d+"v"+d+'H0z"/>':"",h="<path "+t(l.color.dark,"stroke")+' d="'+i(u,c,l.margin)+'"/>',p='viewBox="0 0 '+d+" "+d+'"',L='<svg xmlns="http://www.w3.org/2000/svg" '+(l.width?'width="'+l.width+'" height="'+l.width+'" ':"")+p+' shape-rendering="crispEdges">'+f+h+`</svg>
598
+ `;return typeof a=="function"&&a(null,L),L},Jt}var vn;function _s(){if(vn)return X;vn=1;const n=os(),t=Cs(),e=Ss(),i=Es();function o(r,s,a,l,c){const u=[].slice.call(arguments,1),d=u.length,f=typeof u[d-1]=="function";if(!f&&!n())throw new Error("Callback required as last argument");if(f){if(d<2)throw new Error("Too few arguments provided");d===2?(c=a,a=s,s=l=void 0):d===3&&(s.getContext&&typeof c>"u"?(c=l,l=void 0):(c=l,l=a,a=s,s=void 0))}else{if(d<1)throw new Error("Too few arguments provided");return d===1?(a=s,s=l=void 0):d===2&&!s.getContext&&(l=a,a=s,s=void 0),new Promise(function(h,p){try{const A=t.create(a,l);h(r(A,s,l))}catch(A){p(A)}})}try{const h=t.create(a,l);c(null,r(h,s,l))}catch(h){c(h)}}return X.create=t.create,X.toCanvas=o.bind(null,e.render),X.toDataURL=o.bind(null,e.renderToDataURL),X.toString=o.bind(null,function(r,s,a){return i.render(r,a)}),X}var yn=_s();const As=et({__proto__:null,default:is(yn)},[yn]);N.Annotations=ie,N.Attribute=re,N.AttributeValue=oe,N.Camera=he,N.Configuration=me,N.ERROR_CODES=$,N.Focus=ge,N.Photo=pe,N.Snapshot=ve,N.VD_EVENTS=K,N.VirtualdisplayClient=ns,N.VirtualdisplayError=O,N.enableDebugMode=de,N.isDebugMode=ii,Object.defineProperty(N,Symbol.toStringTag,{value:"Module"})}));