@virtualdisplay.io/client 4.0.0-alpha.14 → 4.0.0-alpha.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/index.d.ts +1064 -0
- package/dist/virtualdisplay.client.cjs.js +11 -11
- package/dist/virtualdisplay.client.es.js +352 -362
- package/dist/virtualdisplay.client.umd.js +14 -14
- package/package.json +3 -3
- package/dist/src/annotations/annotations.d.ts +0 -20
- package/dist/src/annotations/annotations.d.ts.map +0 -1
- package/dist/src/annotations/index.d.ts +0 -2
- package/dist/src/annotations/index.d.ts.map +0 -1
- package/dist/src/attributes/attribute.d.ts +0 -40
- package/dist/src/attributes/attribute.d.ts.map +0 -1
- package/dist/src/attributes/attributes.d.ts +0 -45
- package/dist/src/attributes/attributes.d.ts.map +0 -1
- package/dist/src/attributes/selections.d.ts +0 -17
- package/dist/src/attributes/selections.d.ts.map +0 -1
- package/dist/src/attributes/value.d.ts +0 -13
- package/dist/src/attributes/value.d.ts.map +0 -1
- package/dist/src/camera/camera.d.ts +0 -40
- package/dist/src/camera/camera.d.ts.map +0 -1
- package/dist/src/camera/index.d.ts +0 -4
- package/dist/src/camera/index.d.ts.map +0 -1
- package/dist/src/camera/position.d.ts +0 -56
- package/dist/src/camera/position.d.ts.map +0 -1
- package/dist/src/client/client.d.ts +0 -71
- package/dist/src/client/client.d.ts.map +0 -1
- package/dist/src/client/error.d.ts +0 -26
- package/dist/src/client/error.d.ts.map +0 -1
- package/dist/src/client/events.d.ts +0 -22
- package/dist/src/client/events.d.ts.map +0 -1
- package/dist/src/client/iframe-builder.d.ts +0 -27
- package/dist/src/client/iframe-builder.d.ts.map +0 -1
- package/dist/src/client/options.d.ts +0 -19
- package/dist/src/client/options.d.ts.map +0 -1
- package/dist/src/client/ready-state-tracker.d.ts +0 -13
- package/dist/src/client/ready-state-tracker.d.ts.map +0 -1
- package/dist/src/client/types.d.ts +0 -20
- package/dist/src/client/types.d.ts.map +0 -1
- package/dist/src/configuration/configuration.d.ts +0 -113
- package/dist/src/configuration/configuration.d.ts.map +0 -1
- package/dist/src/configuration/index.d.ts +0 -2
- package/dist/src/configuration/index.d.ts.map +0 -1
- package/dist/src/configuration/resolver.d.ts +0 -16
- package/dist/src/configuration/resolver.d.ts.map +0 -1
- package/dist/src/focus/focus.d.ts +0 -43
- package/dist/src/focus/focus.d.ts.map +0 -1
- package/dist/src/focus/index.d.ts +0 -2
- package/dist/src/focus/index.d.ts.map +0 -1
- package/dist/src/index.d.ts +0 -16
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/snapshot/index.d.ts +0 -3
- package/dist/src/snapshot/index.d.ts.map +0 -1
- package/dist/src/snapshot/photo.d.ts +0 -47
- package/dist/src/snapshot/photo.d.ts.map +0 -1
- package/dist/src/snapshot/snapshot.d.ts +0 -36
- package/dist/src/snapshot/snapshot.d.ts.map +0 -1
- package/dist/src/ui/action-bar.d.ts +0 -18
- package/dist/src/ui/action-bar.d.ts.map +0 -1
- package/dist/src/ui/camera-controls.d.ts +0 -8
- package/dist/src/ui/camera-controls.d.ts.map +0 -1
- package/dist/src/ui/commerce-panel.d.ts +0 -31
- package/dist/src/ui/commerce-panel.d.ts.map +0 -1
- package/dist/src/ui/controls/attribute-group.d.ts +0 -6
- package/dist/src/ui/controls/attribute-group.d.ts.map +0 -1
- package/dist/src/ui/event-bus.d.ts +0 -12
- package/dist/src/ui/event-bus.d.ts.map +0 -1
- package/dist/src/ui/layouts/inframe-layout.d.ts +0 -13
- package/dist/src/ui/layouts/inframe-layout.d.ts.map +0 -1
- package/dist/src/ui/layouts/layout.d.ts +0 -15
- package/dist/src/ui/layouts/layout.d.ts.map +0 -1
- package/dist/src/ui/layouts/null-layout.d.ts +0 -12
- package/dist/src/ui/layouts/null-layout.d.ts.map +0 -1
- package/dist/src/ui/layouts/registry.d.ts +0 -4
- package/dist/src/ui/layouts/registry.d.ts.map +0 -1
- package/dist/src/ui/layouts/sidebar-layout.d.ts +0 -24
- package/dist/src/ui/layouts/sidebar-layout.d.ts.map +0 -1
- package/dist/src/ui/loading.d.ts +0 -43
- package/dist/src/ui/loading.d.ts.map +0 -1
- package/dist/src/ui/standard-interface.d.ts +0 -47
- package/dist/src/ui/standard-interface.d.ts.map +0 -1
- package/dist/src/ui/styles.d.ts +0 -3
- package/dist/src/ui/styles.d.ts.map +0 -1
- package/dist/src/utils/logger.d.ts +0 -11
- package/dist/src/utils/logger.d.ts.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const A = {
|
|
2
2
|
NO_MAPPING: "NO_MAPPING",
|
|
3
3
|
ATTRIBUTE_NOT_FOUND: "ATTRIBUTE_NOT_FOUND",
|
|
4
4
|
VALUE_NOT_FOUND: "VALUE_NOT_FOUND",
|
|
@@ -11,42 +11,24 @@ class f extends Error {
|
|
|
11
11
|
constructor(t, e) {
|
|
12
12
|
super(t), this.name = "VirtualdisplayError", this.code = e;
|
|
13
13
|
}
|
|
14
|
-
static noMapping() {
|
|
15
|
-
return new f(
|
|
16
|
-
"No attributes available. Waiting for server metadata.",
|
|
17
|
-
C.NO_MAPPING
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
static attributeNotFound(t) {
|
|
21
|
-
return new f(
|
|
22
|
-
`Attribute "${t}" not found in mapping`,
|
|
23
|
-
C.ATTRIBUTE_NOT_FOUND
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
14
|
static valueNotFound(t, e) {
|
|
27
15
|
return new f(
|
|
28
16
|
`Value "${e}" not found for attribute "${t}"`,
|
|
29
|
-
|
|
17
|
+
A.VALUE_NOT_FOUND
|
|
30
18
|
);
|
|
31
19
|
}
|
|
32
20
|
static parentNotFound(t) {
|
|
33
21
|
return new f(
|
|
34
22
|
`Parent element not found: ${t}`,
|
|
35
|
-
|
|
23
|
+
A.PARENT_NOT_FOUND
|
|
36
24
|
);
|
|
37
25
|
}
|
|
38
26
|
static invalidParameter(t) {
|
|
39
|
-
return new f(t,
|
|
40
|
-
}
|
|
41
|
-
static snapshotFailed(t, e) {
|
|
42
|
-
return new f(
|
|
43
|
-
`Snapshot failed for "${t}": ${e}`,
|
|
44
|
-
C.SNAPSHOT_FAILED
|
|
45
|
-
);
|
|
27
|
+
return new f(t, A.INVALID_PARAMETER);
|
|
46
28
|
}
|
|
47
29
|
}
|
|
48
|
-
const
|
|
49
|
-
class
|
|
30
|
+
const St = {};
|
|
31
|
+
class At {
|
|
50
32
|
defaultServer = "https://server.virtualdisplay.io";
|
|
51
33
|
options;
|
|
52
34
|
constructor(t) {
|
|
@@ -85,7 +67,7 @@ class St {
|
|
|
85
67
|
return e.searchParams.set("license", this.options.license), e.searchParams.set("model", this.options.model), this.options.language !== void 0 && e.searchParams.set("language", this.options.language), this.options.debug === !0 && e.searchParams.set("debug", "true"), this.options.traceparent !== void 0 && e.searchParams.set("traceparent", this.options.traceparent), e.toString();
|
|
86
68
|
}
|
|
87
69
|
getServerUrl() {
|
|
88
|
-
if (
|
|
70
|
+
if (St?.VITE_VIRTUALDISPLAY_SERVER_HOST === void 0)
|
|
89
71
|
return this.defaultServer;
|
|
90
72
|
}
|
|
91
73
|
getParentElement() {
|
|
@@ -97,18 +79,18 @@ class St {
|
|
|
97
79
|
return t;
|
|
98
80
|
}
|
|
99
81
|
}
|
|
100
|
-
function
|
|
82
|
+
function Et(n) {
|
|
101
83
|
const t = new Date(n.timestamp).toLocaleTimeString("en-GB", { hour12: !1 }), e = n.level.toUpperCase().padEnd(5), i = n.trace_id?.slice(0, 8) ?? "--------", o = n.msg, s = ["timestamp", "level", "msg", "service", "trace_id", "span_id"], r = Object.entries(n).filter(([l]) => !s.includes(l)).map(([l, d]) => `${l}=${JSON.stringify(d)}`).join(" ");
|
|
102
84
|
return `${t} ${e} [${i}] ${o}${r ? " " + r : ""}`;
|
|
103
85
|
}
|
|
104
|
-
function
|
|
86
|
+
function xt(n) {
|
|
105
87
|
return JSON.stringify(n);
|
|
106
88
|
}
|
|
107
|
-
function
|
|
108
|
-
const e = t ?
|
|
89
|
+
function Tt(n, t) {
|
|
90
|
+
const e = t ? Et(n) : xt(n);
|
|
109
91
|
n.level === "error" ? console.error(e) : n.level === "warn" ? console.warn(e) : console.log(e);
|
|
110
92
|
}
|
|
111
|
-
function
|
|
93
|
+
function ct(n, t = 0) {
|
|
112
94
|
const e = {
|
|
113
95
|
name: n.name,
|
|
114
96
|
message: n.message
|
|
@@ -120,34 +102,34 @@ function lt(n, t = 0) {
|
|
|
120
102
|
const o = n[i];
|
|
121
103
|
o !== void 0 && (e[i] = o);
|
|
122
104
|
}
|
|
123
|
-
return n.cause !== void 0 && n.cause !== null && (e.cause = n.cause instanceof Error && t < 5 ?
|
|
105
|
+
return n.cause !== void 0 && n.cause !== null && (e.cause = n.cause instanceof Error && t < 5 ? ct(n.cause, t + 1) : String(n.cause)), e;
|
|
124
106
|
}
|
|
125
|
-
function
|
|
107
|
+
function Rt(n) {
|
|
126
108
|
const t = {};
|
|
127
109
|
for (const [e, i] of Object.entries(n))
|
|
128
|
-
t[e] = i instanceof Error ?
|
|
110
|
+
t[e] = i instanceof Error ? ct(i) : i;
|
|
129
111
|
return t;
|
|
130
112
|
}
|
|
131
|
-
function
|
|
113
|
+
function Ot() {
|
|
132
114
|
return /* @__PURE__ */ new Date();
|
|
133
115
|
}
|
|
134
116
|
function Nt(n) {
|
|
135
117
|
return n.toISOString();
|
|
136
118
|
}
|
|
137
|
-
function
|
|
119
|
+
function ut() {
|
|
138
120
|
return typeof navigator > "u" ? "" : navigator.userAgent;
|
|
139
121
|
}
|
|
140
|
-
function Ot() {
|
|
141
|
-
return typeof navigator > "u" ? !1 : navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
|
|
142
|
-
}
|
|
143
122
|
function It() {
|
|
144
|
-
return
|
|
123
|
+
return typeof navigator > "u" ? !1 : navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
|
|
145
124
|
}
|
|
146
125
|
function Lt() {
|
|
147
|
-
return /
|
|
126
|
+
return /iPhone|iPad|iPod/i.test(ut()) || It();
|
|
148
127
|
}
|
|
149
128
|
function Mt() {
|
|
150
|
-
return
|
|
129
|
+
return /Android/i.test(ut());
|
|
130
|
+
}
|
|
131
|
+
function zt() {
|
|
132
|
+
return Lt() || Mt();
|
|
151
133
|
}
|
|
152
134
|
class Z {
|
|
153
135
|
constructor(t) {
|
|
@@ -159,14 +141,14 @@ class Z {
|
|
|
159
141
|
*/
|
|
160
142
|
log(t, e, i = {}) {
|
|
161
143
|
const o = this.config.traceProvider?.() ?? {}, s = {
|
|
162
|
-
timestamp: Nt(
|
|
144
|
+
timestamp: Nt(Ot()),
|
|
163
145
|
level: t,
|
|
164
146
|
msg: e,
|
|
165
147
|
service: this.config.service,
|
|
166
148
|
...o,
|
|
167
|
-
...
|
|
149
|
+
...Rt(i)
|
|
168
150
|
};
|
|
169
|
-
|
|
151
|
+
Tt(s, this.config.isDev);
|
|
170
152
|
}
|
|
171
153
|
/**
|
|
172
154
|
* Log at DEBUG level (development only).
|
|
@@ -202,37 +184,37 @@ class Z {
|
|
|
202
184
|
}).bind(this), e;
|
|
203
185
|
}
|
|
204
186
|
}
|
|
205
|
-
function
|
|
187
|
+
function dt(n, t) {
|
|
206
188
|
const e = t?.isDev !== void 0 ? t.isDev : typeof process < "u" ? process.env.NODE_ENV !== "production" : !0;
|
|
207
189
|
return new Z({ service: n, isDev: e, traceProvider: t?.traceProvider });
|
|
208
190
|
}
|
|
209
|
-
function
|
|
191
|
+
function N(n) {
|
|
210
192
|
if (n !== void 0)
|
|
211
193
|
return typeof n == "object" && n !== null && !Array.isArray(n) && !(n instanceof Error) ? n : n instanceof Error ? { error: n.message } : { value: n };
|
|
212
194
|
}
|
|
213
|
-
function
|
|
195
|
+
function ht(n) {
|
|
214
196
|
return {
|
|
215
|
-
debug: (t, e) => n.debug(t,
|
|
216
|
-
info: (t, e) => n.info(t,
|
|
217
|
-
warn: (t, e) => n.warn(t,
|
|
218
|
-
error: (t, e) => n.error(t,
|
|
197
|
+
debug: (t, e) => n.debug(t, N(e)),
|
|
198
|
+
info: (t, e) => n.info(t, N(e)),
|
|
199
|
+
warn: (t, e) => n.warn(t, N(e)),
|
|
200
|
+
error: (t, e) => n.error(t, N(e))
|
|
219
201
|
};
|
|
220
202
|
}
|
|
221
|
-
let
|
|
222
|
-
function
|
|
223
|
-
|
|
203
|
+
let mt = !1, C = ht(dt("client", { isDev: !1 }));
|
|
204
|
+
function Pt() {
|
|
205
|
+
mt = !0, C = ht(dt("client", { isDev: !0 }));
|
|
224
206
|
}
|
|
225
|
-
function
|
|
226
|
-
return
|
|
207
|
+
function Vi() {
|
|
208
|
+
return mt;
|
|
227
209
|
}
|
|
228
|
-
class
|
|
210
|
+
class Ft {
|
|
229
211
|
ready = !1;
|
|
230
212
|
onReady;
|
|
231
213
|
constructor(t) {
|
|
232
214
|
this.onReady = t;
|
|
233
215
|
}
|
|
234
216
|
handleMappingReceived() {
|
|
235
|
-
this.ready || (this.ready = !0,
|
|
217
|
+
this.ready || (this.ready = !0, C.info("Mapping received from server, client is now ready"), this.onReady?.());
|
|
236
218
|
}
|
|
237
219
|
get isReady() {
|
|
238
220
|
return this.ready;
|
|
@@ -241,6 +223,132 @@ class Pt {
|
|
|
241
223
|
this.ready = !1;
|
|
242
224
|
}
|
|
243
225
|
}
|
|
226
|
+
const O = {
|
|
227
|
+
/** Attribute selection requested (cancelable). `detail`: `{ attribute, value }`. */
|
|
228
|
+
SELECT: "ui:select",
|
|
229
|
+
/** Attribute selection applied. `detail`: `{ attribute, value }`. */
|
|
230
|
+
SELECTED: "ui:selected",
|
|
231
|
+
/** Focus changed (bubbles). `detail`: `{ component, attributes }`, or `null` for the overview. */
|
|
232
|
+
FOCUS_CHANGE: "vd:focus-change",
|
|
233
|
+
/** Resolved configuration changed (bubbles). `detail`: the resolved configuration, or `null` when nothing matches. */
|
|
234
|
+
CONFIGURATION_CHANGE: "vd:configuration-change",
|
|
235
|
+
/** Configuration submitted (bubbles). `detail`: the resolved configuration handed to the host. */
|
|
236
|
+
CONFIGURATION_SUBMIT: "vd:configuration-submit"
|
|
237
|
+
};
|
|
238
|
+
class $t {
|
|
239
|
+
constructor(t, e) {
|
|
240
|
+
this.value = t, this.attribute = e;
|
|
241
|
+
}
|
|
242
|
+
value;
|
|
243
|
+
attribute;
|
|
244
|
+
isSelectedValue = !1;
|
|
245
|
+
get isSelected() {
|
|
246
|
+
return this.isSelectedValue;
|
|
247
|
+
}
|
|
248
|
+
setSelected(t) {
|
|
249
|
+
this.isSelectedValue = t;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
class Dt {
|
|
253
|
+
name;
|
|
254
|
+
defaultValue;
|
|
255
|
+
values;
|
|
256
|
+
onSelect;
|
|
257
|
+
onChangeCallback;
|
|
258
|
+
constructor(t) {
|
|
259
|
+
this.name = t.name, this.defaultValue = t.defaultValue, this.onSelect = t.onSelect, this.values = this.createValues(t.values);
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Select a value for this attribute
|
|
263
|
+
* @throws {VirtualdisplayError} When value not found
|
|
264
|
+
*/
|
|
265
|
+
select(t) {
|
|
266
|
+
if (!this.values.has(t))
|
|
267
|
+
throw f.valueNotFound(this.name, t);
|
|
268
|
+
this.onSelect(this.name, t);
|
|
269
|
+
}
|
|
270
|
+
getValues() {
|
|
271
|
+
return Array.from(this.values.values());
|
|
272
|
+
}
|
|
273
|
+
getValue(t) {
|
|
274
|
+
return this.values.get(t);
|
|
275
|
+
}
|
|
276
|
+
/** The currently selected value, or undefined before any selection lands. */
|
|
277
|
+
get selected() {
|
|
278
|
+
for (const t of this.values.values())
|
|
279
|
+
if (t.isSelected)
|
|
280
|
+
return t.value;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Register callback that fires when selection changes
|
|
284
|
+
* Receives the newly selected AttributeValue
|
|
285
|
+
*/
|
|
286
|
+
onChange(t) {
|
|
287
|
+
this.onChangeCallback = t;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Update selection state from server mutation result
|
|
291
|
+
* Direct value comparison - no source/target translation
|
|
292
|
+
*/
|
|
293
|
+
handleResult(t) {
|
|
294
|
+
let e;
|
|
295
|
+
for (const i of this.values.values()) {
|
|
296
|
+
const o = i.value === t;
|
|
297
|
+
i.setSelected(o), o && (e = i);
|
|
298
|
+
}
|
|
299
|
+
e !== void 0 && this.onChangeCallback !== void 0 && this.onChangeCallback(e);
|
|
300
|
+
}
|
|
301
|
+
createValues(t) {
|
|
302
|
+
const e = /* @__PURE__ */ new Map();
|
|
303
|
+
for (const i of t) {
|
|
304
|
+
const o = new $t(i, this.name);
|
|
305
|
+
i === this.defaultValue && o.setSelected(!0), e.set(i, o);
|
|
306
|
+
}
|
|
307
|
+
return e;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
class Bt {
|
|
311
|
+
attributes = /* @__PURE__ */ new Map();
|
|
312
|
+
constructor(t, e, i) {
|
|
313
|
+
for (const o of t) {
|
|
314
|
+
const s = this.buildOptions(o, e);
|
|
315
|
+
this.attributes.set(o.name, new Dt(s));
|
|
316
|
+
}
|
|
317
|
+
this.onMutationFailed = i;
|
|
318
|
+
}
|
|
319
|
+
onMutationFailed;
|
|
320
|
+
get(t) {
|
|
321
|
+
return this.attributes.get(t);
|
|
322
|
+
}
|
|
323
|
+
/** The current selection as attribute name→value pairs, skipping unset attributes. */
|
|
324
|
+
getSelection() {
|
|
325
|
+
const t = {};
|
|
326
|
+
for (const [e, i] of this.attributes) {
|
|
327
|
+
const o = i.selected;
|
|
328
|
+
o !== void 0 && (t[e] = o);
|
|
329
|
+
}
|
|
330
|
+
return t;
|
|
331
|
+
}
|
|
332
|
+
handleResults(t) {
|
|
333
|
+
for (const e of t) {
|
|
334
|
+
if (!e.success) {
|
|
335
|
+
this.onMutationFailed?.(e.name, e.value);
|
|
336
|
+
continue;
|
|
337
|
+
}
|
|
338
|
+
this.get(e.name)?.handleResult(e.value);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
buildOptions(t, e) {
|
|
342
|
+
const i = {
|
|
343
|
+
name: t.name,
|
|
344
|
+
values: t.values,
|
|
345
|
+
onSelect: (o, s) => {
|
|
346
|
+
e([{ name: o, value: s }], !1);
|
|
347
|
+
}
|
|
348
|
+
};
|
|
349
|
+
return t.defaultValue !== void 0 ? { ...i, defaultValue: t.defaultValue } : i;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
244
352
|
const c = {
|
|
245
353
|
HANDSHAKE: "handshake",
|
|
246
354
|
MUTATION: "mutation",
|
|
@@ -259,59 +367,59 @@ const c = {
|
|
|
259
367
|
}, X = {
|
|
260
368
|
FOCUS: "focus",
|
|
261
369
|
UNFOCUS: "unfocus"
|
|
262
|
-
},
|
|
370
|
+
}, Ut = {
|
|
263
371
|
FOCUSED: "focused"
|
|
264
|
-
},
|
|
372
|
+
}, Vt = {
|
|
265
373
|
/** Behaves exactly like an unpriced combination: no price, no button. */
|
|
266
374
|
HIDDEN: "hidden"
|
|
267
|
-
},
|
|
268
|
-
function
|
|
375
|
+
}, jt = new Set(Object.values(c));
|
|
376
|
+
function Ht(n) {
|
|
269
377
|
if (typeof n != "object" || n === null)
|
|
270
378
|
return !1;
|
|
271
379
|
const t = n;
|
|
272
|
-
return typeof t.target == "string" ? !1 : typeof t.type == "string" &&
|
|
380
|
+
return typeof t.target == "string" ? !1 : typeof t.type == "string" && jt.has(t.type);
|
|
273
381
|
}
|
|
274
|
-
function
|
|
275
|
-
const t =
|
|
382
|
+
function Gt(n) {
|
|
383
|
+
const t = k(n);
|
|
276
384
|
return t !== null && t.type === c.HANDSHAKE;
|
|
277
385
|
}
|
|
278
|
-
function
|
|
279
|
-
const t =
|
|
386
|
+
function qt(n) {
|
|
387
|
+
const t = k(n);
|
|
280
388
|
return t !== null && t.type === c.MUTATION && Array.isArray(t.results);
|
|
281
389
|
}
|
|
282
|
-
function
|
|
283
|
-
const t =
|
|
390
|
+
function Zt(n) {
|
|
391
|
+
const t = k(n);
|
|
284
392
|
return t !== null && t.type === c.SNAPSHOT && ("data" in t || "error" in t);
|
|
285
393
|
}
|
|
286
|
-
function
|
|
287
|
-
const t =
|
|
394
|
+
function Wt(n) {
|
|
395
|
+
const t = k(n);
|
|
288
396
|
return t !== null && t.type === c.CAMERA && Array.isArray(t.transforms);
|
|
289
397
|
}
|
|
290
|
-
function
|
|
291
|
-
const t =
|
|
398
|
+
function Yt(n) {
|
|
399
|
+
const t = k(n);
|
|
292
400
|
return t !== null && t.type === c.MAPPING && Array.isArray(t.attributes);
|
|
293
401
|
}
|
|
294
|
-
function
|
|
295
|
-
const t =
|
|
402
|
+
function Xt(n) {
|
|
403
|
+
const t = k(n);
|
|
296
404
|
return t !== null && t.type === c.LOADING_INDICATOR && typeof t.progress == "number";
|
|
297
405
|
}
|
|
298
|
-
function
|
|
299
|
-
const t =
|
|
406
|
+
function Kt(n) {
|
|
407
|
+
const t = k(n);
|
|
300
408
|
return t !== null && t.type === c.CONFIG && typeof t.viewerSettings == "object";
|
|
301
409
|
}
|
|
302
|
-
function
|
|
303
|
-
const t =
|
|
410
|
+
function Qt(n) {
|
|
411
|
+
const t = k(n);
|
|
304
412
|
return t !== null && t.type === c.ANNOTATION_PLACED && typeof t.position == "object" && t.position !== null;
|
|
305
413
|
}
|
|
306
|
-
function
|
|
307
|
-
const t =
|
|
414
|
+
function Jt(n) {
|
|
415
|
+
const t = k(n);
|
|
308
416
|
return t !== null && t.type === c.FOCUS && typeof t.state == "string";
|
|
309
417
|
}
|
|
310
|
-
function
|
|
311
|
-
const t =
|
|
418
|
+
function te(n) {
|
|
419
|
+
const t = k(n);
|
|
312
420
|
return t !== null && t.type === c.PRICING && typeof t.pricing == "object" && t.pricing !== null;
|
|
313
421
|
}
|
|
314
|
-
function
|
|
422
|
+
function k(n) {
|
|
315
423
|
return typeof n != "object" || n === null ? null : n;
|
|
316
424
|
}
|
|
317
425
|
class K {
|
|
@@ -361,7 +469,7 @@ class K {
|
|
|
361
469
|
this.pending.length = 0;
|
|
362
470
|
}
|
|
363
471
|
}
|
|
364
|
-
class
|
|
472
|
+
class ee {
|
|
365
473
|
constructor(t, e) {
|
|
366
474
|
this.getTarget = t, this.sourceId = `vd-${Math.random().toString(36).slice(2, 8)}`, this.targetOrigin = e?.targetOrigin ?? "*", this.publisher = new K((i) => this.post(i)), this.consumer = new K((i) => this.routeToHandler(i)), this.shouldBuffer = e?.shouldBuffer ?? null, e?.bufferIncoming !== !0 && this.consumer.markReady();
|
|
367
475
|
}
|
|
@@ -424,7 +532,7 @@ class Kt {
|
|
|
424
532
|
start() {
|
|
425
533
|
this.listener === null && (this.listener = (t) => {
|
|
426
534
|
const { data: e } = t;
|
|
427
|
-
if (!
|
|
535
|
+
if (!Ht(e) || e._source === this.sourceId)
|
|
428
536
|
return;
|
|
429
537
|
const i = this.getTarget();
|
|
430
538
|
if (i !== null && t.source !== null && t.source !== i)
|
|
@@ -470,153 +578,6 @@ class Kt {
|
|
|
470
578
|
});
|
|
471
579
|
}
|
|
472
580
|
}
|
|
473
|
-
class Qt {
|
|
474
|
-
constructor(t) {
|
|
475
|
-
this.send = t;
|
|
476
|
-
}
|
|
477
|
-
send;
|
|
478
|
-
placedCallbacks = [];
|
|
479
|
-
setEnabled(t) {
|
|
480
|
-
this.send({
|
|
481
|
-
type: c.ANNOTATION_TOGGLE,
|
|
482
|
-
enabled: t
|
|
483
|
-
});
|
|
484
|
-
}
|
|
485
|
-
startPlacing() {
|
|
486
|
-
this.send({
|
|
487
|
-
type: c.ANNOTATION_PLACE_MODE,
|
|
488
|
-
enabled: !0
|
|
489
|
-
});
|
|
490
|
-
}
|
|
491
|
-
stopPlacing() {
|
|
492
|
-
this.send({
|
|
493
|
-
type: c.ANNOTATION_PLACE_MODE,
|
|
494
|
-
enabled: !1
|
|
495
|
-
});
|
|
496
|
-
}
|
|
497
|
-
onPlaced(t) {
|
|
498
|
-
this.placedCallbacks.push(t);
|
|
499
|
-
}
|
|
500
|
-
/** Called by the client when an ANNOTATION_PLACED message is received. */
|
|
501
|
-
handlePlaced(t) {
|
|
502
|
-
for (const e of this.placedCallbacks)
|
|
503
|
-
e(t);
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
class Jt {
|
|
507
|
-
constructor(t, e) {
|
|
508
|
-
this.value = t, this.attribute = e;
|
|
509
|
-
}
|
|
510
|
-
value;
|
|
511
|
-
attribute;
|
|
512
|
-
isSelectedValue = !1;
|
|
513
|
-
get isSelected() {
|
|
514
|
-
return this.isSelectedValue;
|
|
515
|
-
}
|
|
516
|
-
setSelected(t) {
|
|
517
|
-
this.isSelectedValue = t;
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
class te {
|
|
521
|
-
name;
|
|
522
|
-
defaultValue;
|
|
523
|
-
values;
|
|
524
|
-
onSelect;
|
|
525
|
-
onChangeCallback;
|
|
526
|
-
constructor(t) {
|
|
527
|
-
this.name = t.name, this.defaultValue = t.defaultValue, this.onSelect = t.onSelect, this.values = this.createValues(t.values);
|
|
528
|
-
}
|
|
529
|
-
/**
|
|
530
|
-
* Select a value for this attribute
|
|
531
|
-
* @throws {VirtualdisplayError} When value not found
|
|
532
|
-
*/
|
|
533
|
-
select(t) {
|
|
534
|
-
if (!this.values.has(t))
|
|
535
|
-
throw f.valueNotFound(this.name, t);
|
|
536
|
-
this.onSelect(this.name, t);
|
|
537
|
-
}
|
|
538
|
-
getValues() {
|
|
539
|
-
return Array.from(this.values.values());
|
|
540
|
-
}
|
|
541
|
-
getValue(t) {
|
|
542
|
-
return this.values.get(t);
|
|
543
|
-
}
|
|
544
|
-
/** The currently selected value, or undefined before any selection lands. */
|
|
545
|
-
get selected() {
|
|
546
|
-
for (const t of this.values.values())
|
|
547
|
-
if (t.isSelected)
|
|
548
|
-
return t.value;
|
|
549
|
-
}
|
|
550
|
-
/**
|
|
551
|
-
* Register callback that fires when selection changes
|
|
552
|
-
* Receives the newly selected AttributeValue
|
|
553
|
-
*/
|
|
554
|
-
onChange(t) {
|
|
555
|
-
this.onChangeCallback = t;
|
|
556
|
-
}
|
|
557
|
-
/**
|
|
558
|
-
* Update selection state from server mutation result
|
|
559
|
-
* Direct value comparison - no source/target translation
|
|
560
|
-
*/
|
|
561
|
-
handleResult(t) {
|
|
562
|
-
let e;
|
|
563
|
-
for (const i of this.values.values()) {
|
|
564
|
-
const o = i.value === t;
|
|
565
|
-
i.setSelected(o), o && (e = i);
|
|
566
|
-
}
|
|
567
|
-
e !== void 0 && this.onChangeCallback !== void 0 && this.onChangeCallback(e);
|
|
568
|
-
}
|
|
569
|
-
createValues(t) {
|
|
570
|
-
const e = /* @__PURE__ */ new Map();
|
|
571
|
-
for (const i of t) {
|
|
572
|
-
const o = new Jt(i, this.name);
|
|
573
|
-
i === this.defaultValue && o.setSelected(!0), e.set(i, o);
|
|
574
|
-
}
|
|
575
|
-
return e;
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
class ee {
|
|
579
|
-
attributes = /* @__PURE__ */ new Map();
|
|
580
|
-
constructor(t, e, i) {
|
|
581
|
-
for (const o of t) {
|
|
582
|
-
const s = this.buildOptions(o, e);
|
|
583
|
-
this.attributes.set(o.name, new te(s));
|
|
584
|
-
}
|
|
585
|
-
this.onMutationFailed = i;
|
|
586
|
-
}
|
|
587
|
-
onMutationFailed;
|
|
588
|
-
get(t) {
|
|
589
|
-
return this.attributes.get(t);
|
|
590
|
-
}
|
|
591
|
-
/** The current selection as attribute name→value pairs, skipping unset attributes. */
|
|
592
|
-
getSelection() {
|
|
593
|
-
const t = {};
|
|
594
|
-
for (const [e, i] of this.attributes) {
|
|
595
|
-
const o = i.selected;
|
|
596
|
-
o !== void 0 && (t[e] = o);
|
|
597
|
-
}
|
|
598
|
-
return t;
|
|
599
|
-
}
|
|
600
|
-
handleResults(t) {
|
|
601
|
-
for (const e of t) {
|
|
602
|
-
if (!e.success) {
|
|
603
|
-
this.onMutationFailed?.(e.name, e.value);
|
|
604
|
-
continue;
|
|
605
|
-
}
|
|
606
|
-
this.get(e.name)?.handleResult(e.value);
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
buildOptions(t, e) {
|
|
610
|
-
const i = {
|
|
611
|
-
name: t.name,
|
|
612
|
-
values: t.values,
|
|
613
|
-
onSelect: (o, s) => {
|
|
614
|
-
e([{ name: o, value: s }], !1);
|
|
615
|
-
}
|
|
616
|
-
};
|
|
617
|
-
return t.defaultValue !== void 0 ? { ...i, defaultValue: t.defaultValue } : i;
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
581
|
class ne {
|
|
621
582
|
constructor(t, e) {
|
|
622
583
|
this.send = t, this.onMutationFailed = e;
|
|
@@ -629,9 +590,9 @@ class ne {
|
|
|
629
590
|
* Handle incoming MAPPING message from server
|
|
630
591
|
*/
|
|
631
592
|
handleMappingReceived(t) {
|
|
632
|
-
|
|
593
|
+
C.debug("Initializing from server mapping", {
|
|
633
594
|
attributeCount: t.attributes.length
|
|
634
|
-
}), this.registry = new
|
|
595
|
+
}), this.registry = new Bt(
|
|
635
596
|
t.attributes,
|
|
636
597
|
(e, i) => this.sendMutation(e, i),
|
|
637
598
|
this.onMutationFailed
|
|
@@ -665,7 +626,7 @@ class ne {
|
|
|
665
626
|
}
|
|
666
627
|
const i = this.registry.get(t);
|
|
667
628
|
if (i === void 0) {
|
|
668
|
-
|
|
629
|
+
C.warn(`onChange: attribute "${t}" not found — callback will not fire`);
|
|
669
630
|
return;
|
|
670
631
|
}
|
|
671
632
|
i.onChange(e);
|
|
@@ -691,7 +652,7 @@ class ne {
|
|
|
691
652
|
replayPendingCallbacks() {
|
|
692
653
|
for (const { name: t, callback: e } of this.pendingCallbacks) {
|
|
693
654
|
const i = this.registry?.get(t);
|
|
694
|
-
i === void 0 &&
|
|
655
|
+
i === void 0 && C.warn(`onChange: attribute "${t}" not found — buffered callback will not fire`), i?.onChange(e);
|
|
695
656
|
}
|
|
696
657
|
this.pendingCallbacks.length = 0;
|
|
697
658
|
}
|
|
@@ -847,18 +808,6 @@ class oe {
|
|
|
847
808
|
}
|
|
848
809
|
}
|
|
849
810
|
}
|
|
850
|
-
const N = {
|
|
851
|
-
/** Attribute selection requested (cancelable). `detail`: `{ attribute, value }`. */
|
|
852
|
-
SELECT: "ui:select",
|
|
853
|
-
/** Attribute selection applied. `detail`: `{ attribute, value }`. */
|
|
854
|
-
SELECTED: "ui:selected",
|
|
855
|
-
/** Focus changed (bubbles). `detail`: `{ component, attributes }`, or `null` for the overview. */
|
|
856
|
-
FOCUS_CHANGE: "vd:focus-change",
|
|
857
|
-
/** Resolved configuration changed (bubbles). `detail`: the resolved configuration, or `null` when nothing matches. */
|
|
858
|
-
CONFIGURATION_CHANGE: "vd:configuration-change",
|
|
859
|
-
/** Configuration submitted (bubbles). `detail`: the resolved configuration handed to the host. */
|
|
860
|
-
CONFIGURATION_SUBMIT: "vd:configuration-submit"
|
|
861
|
-
};
|
|
862
811
|
class se {
|
|
863
812
|
constructor(t, e) {
|
|
864
813
|
this.send = t, this.dispatch = e;
|
|
@@ -896,7 +845,7 @@ class se {
|
|
|
896
845
|
}
|
|
897
846
|
/** Called by the client when a FocusStateMessage is received from the viewer. */
|
|
898
847
|
handleStateReceived(t) {
|
|
899
|
-
t.state ===
|
|
848
|
+
t.state === Ut.FOCUSED && t.component !== void 0 ? (this.focused = t.component, this.attributes = t.attributes ?? []) : (this.focused = null, this.attributes = []);
|
|
900
849
|
const e = this.focused !== null ? { component: this.focused, attributes: this.attributes } : null;
|
|
901
850
|
for (const i of this.changeCallbacks)
|
|
902
851
|
i(e);
|
|
@@ -1027,7 +976,7 @@ class le {
|
|
|
1027
976
|
if (this.pricing === void 0)
|
|
1028
977
|
return;
|
|
1029
978
|
const t = re(this.pricing.rules, this.selection);
|
|
1030
|
-
if (!(t === void 0 || t.availability ===
|
|
979
|
+
if (!(t === void 0 || t.availability === Vt.HIDDEN))
|
|
1031
980
|
return {
|
|
1032
981
|
attributes: { ...this.selection },
|
|
1033
982
|
reference: t.reference,
|
|
@@ -1090,6 +1039,7 @@ class ce {
|
|
|
1090
1039
|
}), this.developedCallbacks.clear(), this.errorCallbacks.clear());
|
|
1091
1040
|
}
|
|
1092
1041
|
}
|
|
1042
|
+
const J = 3e4;
|
|
1093
1043
|
class ue {
|
|
1094
1044
|
constructor(t) {
|
|
1095
1045
|
this.send = t;
|
|
@@ -1105,9 +1055,14 @@ class ue {
|
|
|
1105
1055
|
* @throws VirtualdisplayError if filename is invalid
|
|
1106
1056
|
*/
|
|
1107
1057
|
take(t) {
|
|
1108
|
-
this.validateFilename(t),
|
|
1109
|
-
const e = new ce(t)
|
|
1110
|
-
|
|
1058
|
+
this.validateFilename(t), C.debug("Taking snapshot", { filename: t });
|
|
1059
|
+
const e = new ce(t), i = setTimeout(() => {
|
|
1060
|
+
this.pendingPhotos.delete(t), C.warn("Snapshot timed out", { filename: t }), e.fail(new f(
|
|
1061
|
+
`Snapshot timed out: the viewer did not respond within ${J}ms`,
|
|
1062
|
+
A.SNAPSHOT_FAILED
|
|
1063
|
+
));
|
|
1064
|
+
}, J);
|
|
1065
|
+
return this.pendingPhotos.set(t, { photo: e, timeout: i }), this.send({
|
|
1111
1066
|
type: c.SNAPSHOT,
|
|
1112
1067
|
filename: t
|
|
1113
1068
|
}), e;
|
|
@@ -1119,17 +1074,19 @@ class ue {
|
|
|
1119
1074
|
handleSnapshotResult(t) {
|
|
1120
1075
|
const e = this.pendingPhotos.get(t.filename);
|
|
1121
1076
|
if (e === void 0) {
|
|
1122
|
-
|
|
1077
|
+
C.warn("No pending photo found for filename", {
|
|
1123
1078
|
filename: t.filename,
|
|
1124
1079
|
pendingFilenames: Array.from(this.pendingPhotos.keys())
|
|
1125
1080
|
});
|
|
1126
1081
|
return;
|
|
1127
1082
|
}
|
|
1128
|
-
|
|
1129
|
-
|
|
1083
|
+
clearTimeout(e.timeout), this.pendingPhotos.delete(t.filename);
|
|
1084
|
+
const { photo: i } = e;
|
|
1085
|
+
if (t.error !== void 0) {
|
|
1086
|
+
i.fail(new f(t.error, A.SNAPSHOT_FAILED));
|
|
1130
1087
|
return;
|
|
1131
1088
|
}
|
|
1132
|
-
t.data !== void 0 &&
|
|
1089
|
+
t.data !== void 0 && i.develop({ filename: t.filename, data: t.data });
|
|
1133
1090
|
}
|
|
1134
1091
|
/**
|
|
1135
1092
|
* Fail any pending photos and forget them. Called from client destroy
|
|
@@ -1141,10 +1098,10 @@ class ue {
|
|
|
1141
1098
|
return;
|
|
1142
1099
|
const t = new f(
|
|
1143
1100
|
"Client destroyed before snapshot completed",
|
|
1144
|
-
|
|
1101
|
+
A.SNAPSHOT_FAILED
|
|
1145
1102
|
);
|
|
1146
|
-
for (const e of this.pendingPhotos.values())
|
|
1147
|
-
e.fail(t);
|
|
1103
|
+
for (const { photo: e, timeout: i } of this.pendingPhotos.values())
|
|
1104
|
+
clearTimeout(i), e.fail(t);
|
|
1148
1105
|
this.pendingPhotos.clear();
|
|
1149
1106
|
}
|
|
1150
1107
|
/**
|
|
@@ -1154,19 +1111,19 @@ class ue {
|
|
|
1154
1111
|
if (t === "" || typeof t != "string")
|
|
1155
1112
|
throw new f(
|
|
1156
1113
|
"Filename must be a non-empty string",
|
|
1157
|
-
|
|
1114
|
+
A.INVALID_PARAMETER
|
|
1158
1115
|
);
|
|
1159
1116
|
if (!this.validExtensions.some(
|
|
1160
1117
|
(i) => t.toLowerCase().endsWith(i)
|
|
1161
1118
|
))
|
|
1162
1119
|
throw new f(
|
|
1163
1120
|
`Invalid filename: "${t}". Filename must end with one of: ${this.validExtensions.join(", ")}`,
|
|
1164
|
-
|
|
1121
|
+
A.INVALID_PARAMETER
|
|
1165
1122
|
);
|
|
1166
1123
|
if (t.includes("..") || t.includes("/") || t.includes("\\"))
|
|
1167
1124
|
throw new f(
|
|
1168
1125
|
'Filename cannot contain path separators or ".."',
|
|
1169
|
-
|
|
1126
|
+
A.INVALID_PARAMETER
|
|
1170
1127
|
);
|
|
1171
1128
|
}
|
|
1172
1129
|
}
|
|
@@ -1191,29 +1148,29 @@ class de {
|
|
|
1191
1148
|
};
|
|
1192
1149
|
}
|
|
1193
1150
|
}
|
|
1194
|
-
const he = {}, me = "en",
|
|
1151
|
+
const he = {}, me = "en", pt = (
|
|
1195
1152
|
/** @type {const} */
|
|
1196
1153
|
["en", "nl", "de"]
|
|
1197
1154
|
), W = [
|
|
1198
1155
|
"baseLocale"
|
|
1199
|
-
],
|
|
1200
|
-
let
|
|
1156
|
+
], tt = [];
|
|
1157
|
+
let et, nt;
|
|
1201
1158
|
function pe(n) {
|
|
1202
|
-
if (
|
|
1159
|
+
if (tt.length === 0)
|
|
1203
1160
|
return;
|
|
1204
1161
|
const t = typeof n == "string" ? n : n.href;
|
|
1205
|
-
if (
|
|
1206
|
-
return
|
|
1162
|
+
if (et === t)
|
|
1163
|
+
return nt;
|
|
1207
1164
|
const e = new URL(t, "http://dummy.com");
|
|
1208
1165
|
let i;
|
|
1209
|
-
for (const o of
|
|
1166
|
+
for (const o of tt)
|
|
1210
1167
|
if (new he(o.match, e.href).exec(e.href)) {
|
|
1211
1168
|
i = o;
|
|
1212
1169
|
break;
|
|
1213
1170
|
}
|
|
1214
|
-
return
|
|
1171
|
+
return et = t, nt = i, i;
|
|
1215
1172
|
}
|
|
1216
|
-
function
|
|
1173
|
+
function ft(n) {
|
|
1217
1174
|
const t = pe(n);
|
|
1218
1175
|
return t && t.exclude !== !0 && Array.isArray(t.strategy) ? t.strategy : W;
|
|
1219
1176
|
}
|
|
@@ -1222,12 +1179,12 @@ globalThis.__paraglide = /** @type {any} */
|
|
|
1222
1179
|
globalThis.__paraglide ?? {};
|
|
1223
1180
|
globalThis.__paraglide.ssr = /** @type {any} */
|
|
1224
1181
|
globalThis.__paraglide.ssr ?? {};
|
|
1225
|
-
let
|
|
1182
|
+
let it = !1, h = () => {
|
|
1226
1183
|
let n = W;
|
|
1227
|
-
!q && typeof window < "u" && window.location?.href && (n =
|
|
1184
|
+
!q && typeof window < "u" && window.location?.href && (n = ft(window.location.href));
|
|
1228
1185
|
const t = fe(n);
|
|
1229
1186
|
if (t)
|
|
1230
|
-
return
|
|
1187
|
+
return it || (it = !0, gt(t, { reload: !1 })), t;
|
|
1231
1188
|
throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found");
|
|
1232
1189
|
};
|
|
1233
1190
|
function fe(n, t) {
|
|
@@ -1235,7 +1192,7 @@ function fe(n, t) {
|
|
|
1235
1192
|
for (const i of n) {
|
|
1236
1193
|
if (i === "baseLocale")
|
|
1237
1194
|
e = me;
|
|
1238
|
-
else if (
|
|
1195
|
+
else if (vt(i) && I.has(i)) {
|
|
1239
1196
|
const s = I.get(i);
|
|
1240
1197
|
if (s) {
|
|
1241
1198
|
const r = s.getLocale();
|
|
@@ -1245,7 +1202,7 @@ function fe(n, t) {
|
|
|
1245
1202
|
return be(r);
|
|
1246
1203
|
}
|
|
1247
1204
|
}
|
|
1248
|
-
const o =
|
|
1205
|
+
const o = bt(e);
|
|
1249
1206
|
if (o)
|
|
1250
1207
|
return o;
|
|
1251
1208
|
}
|
|
@@ -1253,7 +1210,7 @@ function fe(n, t) {
|
|
|
1253
1210
|
const ge = (n) => {
|
|
1254
1211
|
window.location.reload();
|
|
1255
1212
|
};
|
|
1256
|
-
let
|
|
1213
|
+
let gt = (n, t) => {
|
|
1257
1214
|
const e = {
|
|
1258
1215
|
reload: !0,
|
|
1259
1216
|
...t
|
|
@@ -1265,9 +1222,9 @@ let ft = (n, t) => {
|
|
|
1265
1222
|
}
|
|
1266
1223
|
const o = [];
|
|
1267
1224
|
let s = W;
|
|
1268
|
-
!q && typeof window < "u" && window.location?.href && (s =
|
|
1225
|
+
!q && typeof window < "u" && window.location?.href && (s = ft(window.location.href));
|
|
1269
1226
|
for (const l of s)
|
|
1270
|
-
if (l !== "baseLocale" &&
|
|
1227
|
+
if (l !== "baseLocale" && vt(l) && I.has(l)) {
|
|
1271
1228
|
const d = I.get(l);
|
|
1272
1229
|
if (d) {
|
|
1273
1230
|
let u = d.setLocale(n);
|
|
@@ -1287,22 +1244,22 @@ let ft = (n, t) => {
|
|
|
1287
1244
|
});
|
|
1288
1245
|
r();
|
|
1289
1246
|
};
|
|
1290
|
-
function
|
|
1247
|
+
function bt(n) {
|
|
1291
1248
|
if (typeof n != "string")
|
|
1292
1249
|
return;
|
|
1293
1250
|
const t = n.toLowerCase();
|
|
1294
|
-
for (const e of
|
|
1251
|
+
for (const e of pt)
|
|
1295
1252
|
if (e.toLowerCase() === t)
|
|
1296
1253
|
return e;
|
|
1297
1254
|
}
|
|
1298
1255
|
function be(n) {
|
|
1299
|
-
const t =
|
|
1256
|
+
const t = bt(n);
|
|
1300
1257
|
if (t)
|
|
1301
1258
|
return t;
|
|
1302
|
-
throw new Error(`Invalid locale: ${n}. Expected one of: ${
|
|
1259
|
+
throw new Error(`Invalid locale: ${n}. Expected one of: ${pt.join(", ")}`);
|
|
1303
1260
|
}
|
|
1304
1261
|
const I = /* @__PURE__ */ new Map();
|
|
1305
|
-
function
|
|
1262
|
+
function vt(n) {
|
|
1306
1263
|
return typeof n == "string" && /^custom-[A-Za-z0-9_-]+$/.test(n);
|
|
1307
1264
|
}
|
|
1308
1265
|
const ve = (
|
|
@@ -1377,13 +1334,13 @@ const ve = (
|
|
|
1377
1334
|
const e = t.locale ?? h();
|
|
1378
1335
|
return e === "en" ? Ee() : e === "nl" ? xe() : Te();
|
|
1379
1336
|
})
|
|
1380
|
-
),
|
|
1337
|
+
), Oe = (
|
|
1381
1338
|
/** @type {(inputs: Controls_Qr_Modalinstructions1Inputs) => LocalizedString} */
|
|
1382
1339
|
() => (
|
|
1383
1340
|
/** @type {LocalizedString} */
|
|
1384
1341
|
"Your phone will open the 3D model in AR mode."
|
|
1385
1342
|
)
|
|
1386
|
-
),
|
|
1343
|
+
), Ne = (
|
|
1387
1344
|
/** @type {(inputs: Controls_Qr_Modalinstructions1Inputs) => LocalizedString} */
|
|
1388
1345
|
() => (
|
|
1389
1346
|
/** @type {LocalizedString} */
|
|
@@ -1399,7 +1356,7 @@ const ve = (
|
|
|
1399
1356
|
/** @type {((inputs?: Controls_Qr_Modalinstructions1Inputs, options?: { locale?: "en" | "nl" | "de" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Controls_Qr_Modalinstructions1Inputs, { locale?: "en" | "nl" | "de" }, {}>} */
|
|
1400
1357
|
((n = {}, t = {}) => {
|
|
1401
1358
|
const e = t.locale ?? h();
|
|
1402
|
-
return e === "en" ?
|
|
1359
|
+
return e === "en" ? Oe() : e === "nl" ? Ne() : Ie();
|
|
1403
1360
|
})
|
|
1404
1361
|
), Me = (
|
|
1405
1362
|
/** @type {(inputs: Controls_Qr_Closebutton1Inputs) => LocalizedString} */
|
|
@@ -1467,7 +1424,7 @@ const ve = (
|
|
|
1467
1424
|
/** @type {LocalizedString} */
|
|
1468
1425
|
"Herunterladen"
|
|
1469
1426
|
)
|
|
1470
|
-
),
|
|
1427
|
+
), yt = (
|
|
1471
1428
|
/** @type {((inputs?: Loading_Downloadingshort1Inputs, options?: { locale?: "en" | "nl" | "de" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Loading_Downloadingshort1Inputs, { locale?: "en" | "nl" | "de" }, {}>} */
|
|
1472
1429
|
((n = {}, t = {}) => {
|
|
1473
1430
|
const e = t.locale ?? h();
|
|
@@ -1531,7 +1488,7 @@ const ve = (
|
|
|
1531
1488
|
/** @type {(inputs: Controls_Configurator_OpenInputs) => LocalizedString} */
|
|
1532
1489
|
() => (
|
|
1533
1490
|
/** @type {LocalizedString} */
|
|
1534
|
-
"
|
|
1491
|
+
"Configureren"
|
|
1535
1492
|
)
|
|
1536
1493
|
), en = (
|
|
1537
1494
|
/** @type {(inputs: Controls_Configurator_OpenInputs) => LocalizedString} */
|
|
@@ -1701,17 +1658,17 @@ const ve = (
|
|
|
1701
1658
|
/** @type {LocalizedString} */
|
|
1702
1659
|
"Omhoog kantelen"
|
|
1703
1660
|
)
|
|
1704
|
-
),
|
|
1661
|
+
), On = (
|
|
1705
1662
|
/** @type {(inputs: Controls_Camera_Tiltup1Inputs) => LocalizedString} */
|
|
1706
1663
|
() => (
|
|
1707
1664
|
/** @type {LocalizedString} */
|
|
1708
1665
|
"Nach oben kippen"
|
|
1709
1666
|
)
|
|
1710
|
-
),
|
|
1667
|
+
), Nn = (
|
|
1711
1668
|
/** @type {((inputs?: Controls_Camera_Tiltup1Inputs, options?: { locale?: "en" | "nl" | "de" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Controls_Camera_Tiltup1Inputs, { locale?: "en" | "nl" | "de" }, {}>} */
|
|
1712
1669
|
((n = {}, t = {}) => {
|
|
1713
1670
|
const e = t.locale ?? h();
|
|
1714
|
-
return e === "en" ? Tn() : e === "nl" ? Rn() :
|
|
1671
|
+
return e === "en" ? Tn() : e === "nl" ? Rn() : On();
|
|
1715
1672
|
})
|
|
1716
1673
|
), In = (
|
|
1717
1674
|
/** @type {(inputs: Controls_Camera_Tiltdown1Inputs) => LocalizedString} */
|
|
@@ -1821,20 +1778,20 @@ const Wn = {
|
|
|
1821
1778
|
"stroke-linecap": "round",
|
|
1822
1779
|
"stroke-linejoin": "round"
|
|
1823
1780
|
};
|
|
1824
|
-
const
|
|
1781
|
+
const _t = ([n, t, e]) => {
|
|
1825
1782
|
const i = document.createElementNS("http://www.w3.org/2000/svg", n);
|
|
1826
1783
|
return Object.keys(t).forEach((o) => {
|
|
1827
1784
|
i.setAttribute(o, String(t[o]));
|
|
1828
1785
|
}), e?.length && e.forEach((o) => {
|
|
1829
|
-
const s =
|
|
1786
|
+
const s = _t(o);
|
|
1830
1787
|
i.appendChild(s);
|
|
1831
1788
|
}), i;
|
|
1832
|
-
},
|
|
1789
|
+
}, Ct = (n, t = {}) => {
|
|
1833
1790
|
const i = {
|
|
1834
1791
|
...Wn,
|
|
1835
1792
|
...t
|
|
1836
1793
|
};
|
|
1837
|
-
return
|
|
1794
|
+
return _t(["svg", i, n]);
|
|
1838
1795
|
};
|
|
1839
1796
|
const Yn = [
|
|
1840
1797
|
[
|
|
@@ -1855,7 +1812,7 @@ const Xn = [
|
|
|
1855
1812
|
],
|
|
1856
1813
|
["circle", { cx: "12", cy: "13", r: "3" }]
|
|
1857
1814
|
];
|
|
1858
|
-
const
|
|
1815
|
+
const wt = [["path", { d: "m6 9 6 6 6-6" }]];
|
|
1859
1816
|
const Kn = [["path", { d: "m15 18-6-6 6-6" }]];
|
|
1860
1817
|
const Qn = [["path", { d: "m9 18 6-6-6-6" }]];
|
|
1861
1818
|
const Jn = [["path", { d: "m18 15-6-6-6 6" }]];
|
|
@@ -1902,7 +1859,7 @@ const ri = [
|
|
|
1902
1859
|
["line", { x1: "8", x2: "14", y1: "11", y2: "11" }]
|
|
1903
1860
|
];
|
|
1904
1861
|
function y(n, { size: t = 20, strokeWidth: e = 1.75 } = {}) {
|
|
1905
|
-
return
|
|
1862
|
+
return Ct(n, { width: t, height: t, "stroke-width": e });
|
|
1906
1863
|
}
|
|
1907
1864
|
const g = {
|
|
1908
1865
|
ar: (n) => y(Yn, n),
|
|
@@ -1910,7 +1867,7 @@ const g = {
|
|
|
1910
1867
|
exitFullscreen: (n) => y(ei, n),
|
|
1911
1868
|
screenshot: (n) => y(Xn, n),
|
|
1912
1869
|
tiltUp: (n) => y(Jn, n),
|
|
1913
|
-
tiltDown: (n) => y(
|
|
1870
|
+
tiltDown: (n) => y(wt, n),
|
|
1914
1871
|
rotateLeft: (n) => y(Kn, n),
|
|
1915
1872
|
rotateRight: (n) => y(Qn, n),
|
|
1916
1873
|
zoomIn: (n) => y(si, n),
|
|
@@ -2045,7 +2002,7 @@ class ui {
|
|
|
2045
2002
|
v.value = p, v.textContent = s?.[u] ?? p, p === o && (v.selected = !0, l = !0), this.select.appendChild(v);
|
|
2046
2003
|
}
|
|
2047
2004
|
l || (r.selected = !0);
|
|
2048
|
-
const d =
|
|
2005
|
+
const d = Ct(wt, { width: 16, height: 16, "stroke-width": 2 });
|
|
2049
2006
|
d.classList.add("ui-native-select-icon"), this.element = document.createElement("div"), this.element.className = "ui-native-select-wrap", this.element.appendChild(this.select), this.element.appendChild(d);
|
|
2050
2007
|
}
|
|
2051
2008
|
setSelected(t) {
|
|
@@ -2389,20 +2346,20 @@ const x = _.fontFamily.sans.join(", "), mi = `
|
|
|
2389
2346
|
margin-block-start: 0.25rem;
|
|
2390
2347
|
}
|
|
2391
2348
|
`;
|
|
2392
|
-
let
|
|
2349
|
+
let ot = !1;
|
|
2393
2350
|
function fi() {
|
|
2394
|
-
if (
|
|
2351
|
+
if (ot || typeof document > "u")
|
|
2395
2352
|
return;
|
|
2396
|
-
|
|
2353
|
+
ot = !0;
|
|
2397
2354
|
const n = document.createElement("style");
|
|
2398
2355
|
n.id = "vd-ui-vanilla", n.textContent = pi, document.head.appendChild(n);
|
|
2399
2356
|
}
|
|
2400
|
-
function
|
|
2357
|
+
function st(n) {
|
|
2401
2358
|
const t = Math.max(0, Math.min(1, n));
|
|
2402
2359
|
return t * t * (3 - 2 * t);
|
|
2403
2360
|
}
|
|
2404
2361
|
function gi(n, t, e, i, o, s) {
|
|
2405
|
-
const [r, l, d] = n, u = Math.cos(t), p = Math.sin(t), v = u * r + p * d, E = -p * r + u * d,
|
|
2362
|
+
const [r, l, d] = n, u = Math.cos(t), p = Math.sin(t), v = u * r + p * d, E = -p * r + u * d, S = Math.cos(e), w = Math.sin(e), R = S * l - w * E, M = w * l + S * E, Y = 0.55;
|
|
2406
2363
|
return [i + v * s * Y, o - R * s * Y, M];
|
|
2407
2364
|
}
|
|
2408
2365
|
function bi(n, t, e) {
|
|
@@ -2416,7 +2373,7 @@ function vi(n, t, e, i, o) {
|
|
|
2416
2373
|
];
|
|
2417
2374
|
bi(n, s, l);
|
|
2418
2375
|
}
|
|
2419
|
-
const z = [-1, -1, 1], P = [1, -1, 1], F = [1, -1, -1], $ = [-1, -1, -1], D = [-1, 1, 1], B = [1, 1, 1], U = [1, 1, -1], V = [-1, 1, -1],
|
|
2376
|
+
const z = [-1, -1, 1], P = [1, -1, 1], F = [1, -1, -1], $ = [-1, -1, -1], D = [-1, 1, 1], B = [1, 1, 1], U = [1, 1, -1], V = [-1, 1, -1], rt = [
|
|
2420
2377
|
[z, P],
|
|
2421
2378
|
[P, F],
|
|
2422
2379
|
[F, $],
|
|
@@ -2429,7 +2386,7 @@ const z = [-1, -1, 1], P = [1, -1, 1], F = [1, -1, -1], $ = [-1, -1, -1], D = [-
|
|
|
2429
2386
|
[B, U],
|
|
2430
2387
|
[U, V],
|
|
2431
2388
|
[V, D]
|
|
2432
|
-
], yi = 400,
|
|
2389
|
+
], yi = 400, at = '-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif';
|
|
2433
2390
|
function _i() {
|
|
2434
2391
|
const n = document.createElement("div");
|
|
2435
2392
|
Object.assign(n.style, {
|
|
@@ -2466,14 +2423,14 @@ function _i() {
|
|
|
2466
2423
|
fontWeight: "400",
|
|
2467
2424
|
color: "#000",
|
|
2468
2425
|
fontVariantNumeric: "tabular-nums",
|
|
2469
|
-
fontFamily:
|
|
2426
|
+
fontFamily: at
|
|
2470
2427
|
});
|
|
2471
2428
|
const o = document.createElement("span");
|
|
2472
2429
|
return Object.assign(o.style, {
|
|
2473
2430
|
fontSize: "13px",
|
|
2474
2431
|
color: "#000",
|
|
2475
|
-
fontFamily:
|
|
2476
|
-
}), o.textContent =
|
|
2432
|
+
fontFamily: at
|
|
2433
|
+
}), o.textContent = yt(), e.appendChild(i), e.appendChild(o), n.appendChild(t), n.appendChild(e), { overlay: n, canvas: t, pctEl: i, phaseEl: o };
|
|
2477
2434
|
}
|
|
2478
2435
|
class Ci {
|
|
2479
2436
|
overlay;
|
|
@@ -2497,7 +2454,7 @@ class Ci {
|
|
|
2497
2454
|
}
|
|
2498
2455
|
get loadingTexts() {
|
|
2499
2456
|
return {
|
|
2500
|
-
downloading:
|
|
2457
|
+
downloading: yt(),
|
|
2501
2458
|
rendering: We()
|
|
2502
2459
|
};
|
|
2503
2460
|
}
|
|
@@ -2551,14 +2508,14 @@ class Ci {
|
|
|
2551
2508
|
return;
|
|
2552
2509
|
const t = this.canvas.width / Math.min(devicePixelRatio, 2), e = this.canvas.height / Math.min(devicePixelRatio, 2), i = (performance.now() - this.startTime) / 1e3;
|
|
2553
2510
|
this.ctx.fillStyle = "#fff", this.ctx.fillRect(0, 0, t, e);
|
|
2554
|
-
const o = t / 2, s = e * 0.44, r = Math.min(t, e) * 0.08, l = 0.785, d = 0.615, u = (w) => gi(w, l, d, o, s, r), p = 6, v = i % p / p, E =
|
|
2555
|
-
let
|
|
2556
|
-
v < 0.35 ?
|
|
2557
|
-
for (let w = 0; w < E && !(w >=
|
|
2558
|
-
const R =
|
|
2511
|
+
const o = t / 2, s = e * 0.44, r = Math.min(t, e) * 0.08, l = 0.785, d = 0.615, u = (w) => gi(w, l, d, o, s, r), p = 6, v = i % p / p, E = rt.length;
|
|
2512
|
+
let S;
|
|
2513
|
+
v < 0.35 ? S = st(v / 0.35) * E : v < 0.55 ? S = E : v < 0.9 ? S = (1 - st((v - 0.55) / 0.35)) * E : S = 0, this.ctx.shadowBlur = 5, this.ctx.shadowColor = "rgba(30,30,30,0.08)";
|
|
2514
|
+
for (let w = 0; w < E && !(w >= S); w++) {
|
|
2515
|
+
const R = rt[w];
|
|
2559
2516
|
if (R === void 0)
|
|
2560
2517
|
continue;
|
|
2561
|
-
const M = Math.min(1,
|
|
2518
|
+
const M = Math.min(1, S - w);
|
|
2562
2519
|
vi(this.ctx, u, R[0], R[1], M);
|
|
2563
2520
|
}
|
|
2564
2521
|
this.ctx.shadowBlur = 0;
|
|
@@ -2661,7 +2618,7 @@ function ki(n, t, e) {
|
|
|
2661
2618
|
zoomIn: new b({ variant: "outline", size: "icon", label: fn(), icon: g.zoomIn(), onClick: () => {
|
|
2662
2619
|
e.targetZoom = i(e.targetZoom + 10), n.zoom(e.targetZoom).set();
|
|
2663
2620
|
} }),
|
|
2664
|
-
tiltUp: new b({ variant: "outline", size: "icon", label:
|
|
2621
|
+
tiltUp: new b({ variant: "outline", size: "icon", label: Nn(), icon: g.tiltUp(), onClick: () => {
|
|
2665
2622
|
s(-15);
|
|
2666
2623
|
} }),
|
|
2667
2624
|
rotateLeft: new b({ variant: "outline", size: "icon", label: kn(), icon: g.rotateLeft(), onClick: () => {
|
|
@@ -2695,13 +2652,13 @@ function xi(n, t, e, i, o) {
|
|
|
2695
2652
|
r.className = "vd-attribute-label", r.textContent = j(n.name), r.id = `vd-attribute-label-${Ei++}`, s.appendChild(r), s.setAttribute("role", "group"), s.setAttribute("aria-labelledby", r.id);
|
|
2696
2653
|
const l = n.values.find((p) => t.getValue(n.name, p)?.isSelected === !0), d = n.values.map(j), u = n.values.length <= Ai ? new ci(n.values, l, d) : new ui(n.name, n.values, j(n.name), l, d);
|
|
2697
2654
|
return u.onSelect((p) => {
|
|
2698
|
-
e.dispatch(
|
|
2655
|
+
e.dispatch(O.SELECT, { attribute: n.name, value: p }, !0).defaultPrevented || i(n.name, p);
|
|
2699
2656
|
}), o(n.name, (p) => {
|
|
2700
|
-
u.setSelected(p.value), e.dispatch(
|
|
2657
|
+
u.setSelected(p.value), e.dispatch(O.SELECTED, { attribute: n.name, value: p.value });
|
|
2701
2658
|
}), s.appendChild(u.element), s;
|
|
2702
2659
|
}
|
|
2703
2660
|
const Ti = 80, Ri = 2500;
|
|
2704
|
-
class
|
|
2661
|
+
class Oi {
|
|
2705
2662
|
constructor(t, e = Ri) {
|
|
2706
2663
|
this.configuration = t, this.resetMs = e, this.element = document.createElement("div"), this.element.className = "vd-commerce vd-hidden";
|
|
2707
2664
|
const i = document.createElement("div");
|
|
@@ -2734,11 +2691,11 @@ class Ni {
|
|
|
2734
2691
|
this.priceEl.textContent = "", this.vatEl.textContent = "";
|
|
2735
2692
|
return;
|
|
2736
2693
|
}
|
|
2737
|
-
this.priceEl.textContent =
|
|
2694
|
+
this.priceEl.textContent = Ni(t.price, t.currency), this.vatEl.textContent = lt(this.configuration.vatDisplay);
|
|
2738
2695
|
}
|
|
2739
2696
|
renderButton() {
|
|
2740
2697
|
const t = this.configuration.submitEnabled;
|
|
2741
|
-
this.button.element.classList.toggle("vd-hidden", !t), t && this.state === "idle" && this.setButtonText(
|
|
2698
|
+
this.button.element.classList.toggle("vd-hidden", !t), t && this.state === "idle" && this.setButtonText(lt(this.configuration.buttonLabel));
|
|
2742
2699
|
}
|
|
2743
2700
|
async handleSubmit() {
|
|
2744
2701
|
if (this.state !== "busy") {
|
|
@@ -2763,10 +2720,10 @@ class Ni {
|
|
|
2763
2720
|
this.button.element.textContent = t, this.button.element.setAttribute("aria-label", t);
|
|
2764
2721
|
}
|
|
2765
2722
|
}
|
|
2766
|
-
function
|
|
2723
|
+
function lt(n) {
|
|
2767
2724
|
return (n ?? "").slice(0, Ti);
|
|
2768
2725
|
}
|
|
2769
|
-
function
|
|
2726
|
+
function Ni(n, t) {
|
|
2770
2727
|
try {
|
|
2771
2728
|
const e = new Intl.NumberFormat(h(), { style: "currency", currency: t }), i = e.resolvedOptions().maximumFractionDigits ?? 2;
|
|
2772
2729
|
return e.format(n / 10 ** i);
|
|
@@ -2774,7 +2731,7 @@ function Oi(n, t) {
|
|
|
2774
2731
|
return `${t} ${(n / 100).toFixed(2)}`;
|
|
2775
2732
|
}
|
|
2776
2733
|
}
|
|
2777
|
-
class
|
|
2734
|
+
class kt {
|
|
2778
2735
|
slot = null;
|
|
2779
2736
|
panel = null;
|
|
2780
2737
|
attach(t, e) {
|
|
@@ -2850,12 +2807,12 @@ class Mi {
|
|
|
2850
2807
|
}
|
|
2851
2808
|
}
|
|
2852
2809
|
const zi = {
|
|
2853
|
-
"inframe-bottom-left": () => new
|
|
2810
|
+
"inframe-bottom-left": () => new kt(),
|
|
2854
2811
|
"sidebar-right": () => new Li(),
|
|
2855
2812
|
hidden: () => new Mi()
|
|
2856
2813
|
};
|
|
2857
2814
|
function Pi(n) {
|
|
2858
|
-
return (zi[n ?? ""] ?? (() => new
|
|
2815
|
+
return (zi[n ?? ""] ?? (() => new kt()))();
|
|
2859
2816
|
}
|
|
2860
2817
|
const H = _.fontFamily.sans.join(", "), G = `
|
|
2861
2818
|
position: absolute;
|
|
@@ -3105,7 +3062,7 @@ class Bi {
|
|
|
3105
3062
|
this.loading?.showError(t);
|
|
3106
3063
|
}
|
|
3107
3064
|
applyViewerSettings(t) {
|
|
3108
|
-
this.settings = t, t.language !== void 0 &&
|
|
3065
|
+
this.settings = t, t.language !== void 0 && gt(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();
|
|
3109
3066
|
}
|
|
3110
3067
|
renderAttributeControls(t, e) {
|
|
3111
3068
|
if (!(this.container === null || this.slots.topRight === null) && (this.cameraControls?.element.remove(), this.cameraControls = null, this.teardownConfigurator(), this.settings.cameraControls === !0 && (this.cameraControls = new L(this.options.cameraApi, this.options.cameraPositionApi), this.cameraControls.element.style.display = "none", this.slots.topRight.appendChild(this.cameraControls.element)), this.placeScreenshotButton(), e.length !== 0)) {
|
|
@@ -3118,7 +3075,7 @@ class Bi {
|
|
|
3118
3075
|
this.options.onSelect,
|
|
3119
3076
|
this.options.onSubscribe
|
|
3120
3077
|
));
|
|
3121
|
-
this.commerce = new
|
|
3078
|
+
this.commerce = new Oi(this.options.configuration), this.attributes.appendChild(this.commerce.element), this.layout = Pi(this.settings.configuratorLayout), this.layout.attach(this.container, this.attributes);
|
|
3122
3079
|
}
|
|
3123
3080
|
}
|
|
3124
3081
|
get viewerSettings() {
|
|
@@ -3156,7 +3113,40 @@ class Bi {
|
|
|
3156
3113
|
this.screenshotBtn === null || this.slots.topRight === null || (this.cameraControls !== null ? this.cameraControls.element.appendChild(this.screenshotBtn.element) : this.slots.topRight.appendChild(this.screenshotBtn.element));
|
|
3157
3114
|
}
|
|
3158
3115
|
}
|
|
3159
|
-
class
|
|
3116
|
+
class Ui {
|
|
3117
|
+
constructor(t) {
|
|
3118
|
+
this.send = t;
|
|
3119
|
+
}
|
|
3120
|
+
send;
|
|
3121
|
+
placedCallbacks = [];
|
|
3122
|
+
setEnabled(t) {
|
|
3123
|
+
this.send({
|
|
3124
|
+
type: c.ANNOTATION_TOGGLE,
|
|
3125
|
+
enabled: t
|
|
3126
|
+
});
|
|
3127
|
+
}
|
|
3128
|
+
startPlacing() {
|
|
3129
|
+
this.send({
|
|
3130
|
+
type: c.ANNOTATION_PLACE_MODE,
|
|
3131
|
+
enabled: !0
|
|
3132
|
+
});
|
|
3133
|
+
}
|
|
3134
|
+
stopPlacing() {
|
|
3135
|
+
this.send({
|
|
3136
|
+
type: c.ANNOTATION_PLACE_MODE,
|
|
3137
|
+
enabled: !1
|
|
3138
|
+
});
|
|
3139
|
+
}
|
|
3140
|
+
onPlaced(t) {
|
|
3141
|
+
this.placedCallbacks.push(t);
|
|
3142
|
+
}
|
|
3143
|
+
/** Called by the client when an ANNOTATION_PLACED message is received. */
|
|
3144
|
+
handlePlaced(t) {
|
|
3145
|
+
for (const e of this.placedCallbacks)
|
|
3146
|
+
e(t);
|
|
3147
|
+
}
|
|
3148
|
+
}
|
|
3149
|
+
class Hi {
|
|
3160
3150
|
attributes;
|
|
3161
3151
|
readyStateTracker;
|
|
3162
3152
|
messenger;
|
|
@@ -3175,14 +3165,14 @@ class ji {
|
|
|
3175
3165
|
readyCallbacks = [];
|
|
3176
3166
|
mutationFailedCallbacks = [];
|
|
3177
3167
|
constructor(t) {
|
|
3178
|
-
this.options = t, this.initializeLogging(), this.messenger = new
|
|
3168
|
+
this.options = t, this.initializeLogging(), this.messenger = new ee(() => this.iframe?.contentWindow ?? null);
|
|
3179
3169
|
const e = (i) => {
|
|
3180
3170
|
this.messenger.send(i);
|
|
3181
3171
|
};
|
|
3182
3172
|
this.attributes = new ne(e, (i, o) => {
|
|
3183
3173
|
for (const s of this.mutationFailedCallbacks)
|
|
3184
3174
|
s({ attribute: i, value: o });
|
|
3185
|
-
}), this.snapshotApi = new ue(e), this.annotationsApi = new
|
|
3175
|
+
}), this.snapshotApi = new ue(e), this.annotationsApi = new Ui(e), this.cameraApi = new ie(e), this.cameraPositionApi = new oe(), this.focusApi = new se(e, (i) => {
|
|
3186
3176
|
this.dispatchFocusChange(i);
|
|
3187
3177
|
}), this.configurationApi = new le(
|
|
3188
3178
|
(i) => {
|
|
@@ -3191,7 +3181,7 @@ class ji {
|
|
|
3191
3181
|
(i) => {
|
|
3192
3182
|
this.dispatchConfigurationSubmit(i);
|
|
3193
3183
|
}
|
|
3194
|
-
), this.eventBus = new de(), this.qrModal = new hi(), this.readyStateTracker = new
|
|
3184
|
+
), this.eventBus = new de(), this.qrModal = new hi(), this.readyStateTracker = new Ft(() => {
|
|
3195
3185
|
const i = this.readyCallbacks;
|
|
3196
3186
|
this.readyCallbacks = [];
|
|
3197
3187
|
for (const o of i)
|
|
@@ -3212,29 +3202,29 @@ class ji {
|
|
|
3212
3202
|
}
|
|
3213
3203
|
registerHandlers() {
|
|
3214
3204
|
this.messenger.on(c.HANDSHAKE, (t) => {
|
|
3215
|
-
|
|
3205
|
+
Gt(t) && (C.info("Server handshake received, flushing publisher queue"), this.messenger.markReady());
|
|
3216
3206
|
}), this.messenger.on(c.MUTATION, (t) => {
|
|
3217
|
-
|
|
3207
|
+
qt(t) && (this.attributes.handleMutationResult(t), this.configurationApi.handleSelectionChanged(this.attributes.getSelection()));
|
|
3218
3208
|
}), this.messenger.on(c.SNAPSHOT, (t) => {
|
|
3219
|
-
|
|
3209
|
+
Zt(t) && this.snapshotApi.handleSnapshotResult(t);
|
|
3220
3210
|
}), this.messenger.on(c.CAMERA, (t) => {
|
|
3221
|
-
|
|
3211
|
+
Wt(t) && this.cameraPositionApi.handlePositionUpdate(t);
|
|
3222
3212
|
}), this.messenger.on(c.LOADING_INDICATOR, (t) => {
|
|
3223
|
-
|
|
3213
|
+
Xt(t) && (t.error !== void 0 ? this.ui.showError(t.error) : this.ui.updateProgress(t.progress, t.phase));
|
|
3224
3214
|
}), this.messenger.on(c.CONFIG, (t) => {
|
|
3225
|
-
|
|
3215
|
+
Kt(t) && this.handleConfig(t);
|
|
3226
3216
|
}), this.messenger.on(c.ANNOTATION_PLACED, (t) => {
|
|
3227
|
-
|
|
3217
|
+
Qt(t) && this.annotationsApi.handlePlaced(t.position);
|
|
3228
3218
|
}), this.messenger.on(c.MAPPING, (t) => {
|
|
3229
|
-
|
|
3219
|
+
Yt(t) && (this.attributes.handleMappingReceived(t), this.configurationApi.handleSelectionChanged(this.attributes.getSelection()), this.ui.renderAttributeControls(this.attributes, t.attributes), this.readyStateTracker.handleMappingReceived());
|
|
3230
3220
|
}), this.registerFacadeStateHandlers();
|
|
3231
3221
|
}
|
|
3232
3222
|
/** Handlers that feed viewer-reported state into the facades (focus, pricing). */
|
|
3233
3223
|
registerFacadeStateHandlers() {
|
|
3234
3224
|
this.messenger.on(c.FOCUS, (t) => {
|
|
3235
|
-
|
|
3225
|
+
Jt(t) && this.focusApi.handleStateReceived(t);
|
|
3236
3226
|
}), this.messenger.on(c.PRICING, (t) => {
|
|
3237
|
-
|
|
3227
|
+
te(t) && this.configurationApi.handlePricingReceived(t.pricing);
|
|
3238
3228
|
});
|
|
3239
3229
|
}
|
|
3240
3230
|
/**
|
|
@@ -3243,7 +3233,7 @@ class ji {
|
|
|
3243
3233
|
*/
|
|
3244
3234
|
dispatchFocusChange(t) {
|
|
3245
3235
|
this.container?.dispatchEvent(
|
|
3246
|
-
new CustomEvent(
|
|
3236
|
+
new CustomEvent(O.FOCUS_CHANGE, { detail: t, bubbles: !0 })
|
|
3247
3237
|
);
|
|
3248
3238
|
}
|
|
3249
3239
|
/**
|
|
@@ -3252,13 +3242,13 @@ class ji {
|
|
|
3252
3242
|
*/
|
|
3253
3243
|
dispatchConfigurationChange(t) {
|
|
3254
3244
|
this.container?.dispatchEvent(
|
|
3255
|
-
new CustomEvent(
|
|
3245
|
+
new CustomEvent(O.CONFIGURATION_CHANGE, { detail: t ?? null, bubbles: !0 })
|
|
3256
3246
|
);
|
|
3257
3247
|
}
|
|
3258
3248
|
/** Dispatch a bubbling `vd:configuration-submit` event when the CTA is used. */
|
|
3259
3249
|
dispatchConfigurationSubmit(t) {
|
|
3260
3250
|
this.container?.dispatchEvent(
|
|
3261
|
-
new CustomEvent(
|
|
3251
|
+
new CustomEvent(O.CONFIGURATION_SUBMIT, { detail: t, bubbles: !0 })
|
|
3262
3252
|
);
|
|
3263
3253
|
}
|
|
3264
3254
|
handleConfig(t) {
|
|
@@ -3267,24 +3257,24 @@ class ji {
|
|
|
3267
3257
|
const o = i !== void 0 ? { ...e ?? {}, ...i } : e;
|
|
3268
3258
|
if (i !== void 0 && e !== void 0) {
|
|
3269
3259
|
const s = Object.entries(i).filter(([r, l]) => e[r] !== l).map(([r, l]) => `${r} (metadata: ${e[r] ?? "undefined"}, override: ${l})`);
|
|
3270
|
-
s.length > 0 &&
|
|
3260
|
+
s.length > 0 && C.warn(`Viewer settings override active: ${s.join(", ")}`);
|
|
3271
3261
|
}
|
|
3272
3262
|
this.ui.applyViewerSettings(o), this.annotationsApi.setEnabled(o.annotations !== !1);
|
|
3273
3263
|
}
|
|
3274
3264
|
this.cameraPositionApi.applyLimits(t.cameraLimits);
|
|
3275
3265
|
}
|
|
3276
3266
|
activateAr() {
|
|
3277
|
-
if (
|
|
3267
|
+
if (zt()) {
|
|
3278
3268
|
this.messenger.send({ type: c.AR_ACTIVATE });
|
|
3279
3269
|
return;
|
|
3280
3270
|
}
|
|
3281
3271
|
this.qrModal.show(this.iframe?.src ?? "");
|
|
3282
3272
|
}
|
|
3283
3273
|
initializeLogging() {
|
|
3284
|
-
this.options.debug === !0 &&
|
|
3274
|
+
this.options.debug === !0 && Pt(), C.info("Initializing Virtualdisplay client", { model: this.options.model });
|
|
3285
3275
|
}
|
|
3286
3276
|
createAndConnectIframe() {
|
|
3287
|
-
const e = new
|
|
3277
|
+
const e = new At(this.options).create();
|
|
3288
3278
|
this.container = e.container, this.iframe = e.iframe, this.eventBus.attach(this.container), this.ui.attach(this.container);
|
|
3289
3279
|
try {
|
|
3290
3280
|
const i = new URL(this.iframe.src).origin;
|
|
@@ -3349,19 +3339,19 @@ class ji {
|
|
|
3349
3339
|
}
|
|
3350
3340
|
}
|
|
3351
3341
|
export {
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3342
|
+
Ui as Annotations,
|
|
3343
|
+
Dt as Attribute,
|
|
3344
|
+
$t as AttributeValue,
|
|
3355
3345
|
ie as Camera,
|
|
3356
3346
|
le as Configuration,
|
|
3357
|
-
|
|
3347
|
+
A as ERROR_CODES,
|
|
3358
3348
|
se as Focus,
|
|
3359
3349
|
ce as Photo,
|
|
3360
3350
|
ue as Snapshot,
|
|
3361
|
-
|
|
3362
|
-
|
|
3351
|
+
O as VD_EVENTS,
|
|
3352
|
+
Hi as VirtualdisplayClient,
|
|
3363
3353
|
f as VirtualdisplayError,
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3354
|
+
Pt as enableDebugMode,
|
|
3355
|
+
Vi as isDebugMode,
|
|
3356
|
+
C as logger
|
|
3367
3357
|
};
|