@epigraph/solutions 0.0.5-alpha → 0.2.0

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,1702 +0,0 @@
1
- import { e as Ve, a7 as Y, a0 as Be } from "./three.module-CYfxkCtM.js";
2
- var k = /* @__PURE__ */ ((i) => (i.AR = "ar", i))(k || {}), I = /* @__PURE__ */ ((i) => (i.type = "t", i.identifierType = "idt", i.identifier = "id", i.epigraphSessionId = "eid", i.action = "a", i))(I || {});
3
- class fe {
4
- constructor(e = window.location.href) {
5
- this._baseUrl = e;
6
- }
7
- get baseUrl() {
8
- return this._baseUrl;
9
- }
10
- set baseUrl(e) {
11
- this._baseUrl = e;
12
- }
13
- /**
14
- * Gets the parameters from the baseUrl of this class instance.
15
- * This handles both encrypted and decrypted URLs.
16
- *
17
- * @param {string} parameterToSearch Name of the parameter that needs to be queried from the current URL.
18
- * @returns {string | null} Either the value of the parameterToSearch or null if not found.
19
- */
20
- getParameterInUrl(e) {
21
- const t = new URL(this._baseUrl);
22
- let r = t.searchParams.get(e);
23
- return r || (r = this.decryptQueryParametersInUrl(t).searchParams.get(e)), r;
24
- }
25
- /**
26
- * A convenience wrapper to test if the URL has a given parameter name in the query parameters.
27
- * This handles both encrypted and decrypted URLs.
28
- *
29
- * @param {string} parameterToSearch Name of the parameter that needs to be queried from the current URL.
30
- * @returns {boolean} Whether the parameter exists in the current URL.
31
- */
32
- hasParameterInUrl(e) {
33
- return !!this.getParameterInUrl(e);
34
- }
35
- /**
36
- * Generate the URL to be shown as View in your space QR code.
37
- *
38
- * @param {object} parametersToAdd Object containing <key>parameter_name: <value>parameter_value for the URL.
39
- * @param {boolean} encryptParameters Whether the parameters be encrypted within the URL.
40
- * @returns {URL} The generated URL.
41
- */
42
- generateQrCodeUrl(e = {}, t = !0) {
43
- const r = new URL(this._baseUrl);
44
- for (const [s, l] of Object.entries(e))
45
- r.searchParams.set(s, l);
46
- return t && this.encryptQueryParametersInUrl(r), r;
47
- }
48
- /**
49
- * Encrypts the query parameters in a given URL object using base64 encoding.
50
- *
51
- * @param {URL} url The original url object with query parameters.
52
- * @returns {URL} Process URL object with encrypted parameters
53
- */
54
- encryptQueryParametersInUrl(e) {
55
- return e.search = btoa(e.search), e;
56
- }
57
- /**
58
- * Decrypts the query parameters in a given URL object using base64 encoding.
59
- *
60
- * @param {URL} url The original url object with query parameters.
61
- * @returns {URL} Process URL object with decrypted parameters
62
- */
63
- decryptQueryParametersInUrl(e) {
64
- let t = e;
65
- try {
66
- e.search = atob(e.search.slice(1)), t = e;
67
- } catch (r) {
68
- window.epigraph.logger.info({ title: `Couldn't decode URL: ${e}`, details: r });
69
- }
70
- return t;
71
- }
72
- }
73
- /**
74
- * @license
75
- * Copyright 2019 Google LLC
76
- * SPDX-License-Identifier: BSD-3-Clause
77
- */
78
- const q = globalThis, ae = q.ShadowRoot && (q.ShadyCSS === void 0 || q.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, le = Symbol(), pe = /* @__PURE__ */ new WeakMap();
79
- let Pe = class {
80
- constructor(i, e, t) {
81
- if (this._$cssResult$ = !0, t !== le) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
82
- this.cssText = i, this.t = e;
83
- }
84
- get styleSheet() {
85
- let i = this.o;
86
- const e = this.t;
87
- if (ae && i === void 0) {
88
- const t = e !== void 0 && e.length === 1;
89
- t && (i = pe.get(e)), i === void 0 && ((this.o = i = new CSSStyleSheet()).replaceSync(this.cssText), t && pe.set(e, i));
90
- }
91
- return i;
92
- }
93
- toString() {
94
- return this.cssText;
95
- }
96
- };
97
- const Le = (i) => new Pe(typeof i == "string" ? i : i + "", void 0, le), Ge = (i, ...e) => {
98
- const t = i.length === 1 ? i[0] : e.reduce((r, s, l) => r + ((p) => {
99
- if (p._$cssResult$ === !0) return p.cssText;
100
- if (typeof p == "number") return p;
101
- throw Error("Value passed to 'css' function must be a 'css' function result: " + p + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
102
- })(s) + i[l + 1], i[0]);
103
- return new Pe(t, i, le);
104
- }, He = (i, e) => {
105
- if (ae) i.adoptedStyleSheets = e.map((t) => t instanceof CSSStyleSheet ? t : t.styleSheet);
106
- else for (const t of e) {
107
- const r = document.createElement("style"), s = q.litNonce;
108
- s !== void 0 && r.setAttribute("nonce", s), r.textContent = t.cssText, i.appendChild(r);
109
- }
110
- }, $e = ae ? (i) => i : (i) => i instanceof CSSStyleSheet ? ((e) => {
111
- let t = "";
112
- for (const r of e.cssRules) t += r.cssText;
113
- return Le(t);
114
- })(i) : i;
115
- /**
116
- * @license
117
- * Copyright 2017 Google LLC
118
- * SPDX-License-Identifier: BSD-3-Clause
119
- */
120
- const { is: ze, defineProperty: je, getOwnPropertyDescriptor: De, getOwnPropertyNames: Qe, getOwnPropertySymbols: We, getPrototypeOf: Je } = Object, ie = globalThis, me = ie.trustedTypes, Ke = me ? me.emptyScript : "", Xe = ie.reactiveElementPolyfillSupport, Q = (i, e) => i, oe = { toAttribute(i, e) {
121
- switch (e) {
122
- case Boolean:
123
- i = i ? Ke : null;
124
- break;
125
- case Object:
126
- case Array:
127
- i = i == null ? i : JSON.stringify(i);
128
- }
129
- return i;
130
- }, fromAttribute(i, e) {
131
- let t = i;
132
- switch (e) {
133
- case Boolean:
134
- t = i !== null;
135
- break;
136
- case Number:
137
- t = i === null ? null : Number(i);
138
- break;
139
- case Object:
140
- case Array:
141
- try {
142
- t = JSON.parse(i);
143
- } catch {
144
- t = null;
145
- }
146
- }
147
- return t;
148
- } }, xe = (i, e) => !ze(i, e), ye = { attribute: !0, type: String, converter: oe, reflect: !1, useDefault: !1, hasChanged: xe };
149
- Symbol.metadata ??= Symbol("metadata"), ie.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
150
- let H = class extends HTMLElement {
151
- static addInitializer(i) {
152
- this._$Ei(), (this.l ??= []).push(i);
153
- }
154
- static get observedAttributes() {
155
- return this.finalize(), this._$Eh && [...this._$Eh.keys()];
156
- }
157
- static createProperty(i, e = ye) {
158
- if (e.state && (e.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(i) && ((e = Object.create(e)).wrapped = !0), this.elementProperties.set(i, e), !e.noAccessor) {
159
- const t = Symbol(), r = this.getPropertyDescriptor(i, t, e);
160
- r !== void 0 && je(this.prototype, i, r);
161
- }
162
- }
163
- static getPropertyDescriptor(i, e, t) {
164
- const { get: r, set: s } = De(this.prototype, i) ?? { get() {
165
- return this[e];
166
- }, set(l) {
167
- this[e] = l;
168
- } };
169
- return { get: r, set(l) {
170
- const p = r?.call(this);
171
- s?.call(this, l), this.requestUpdate(i, p, t);
172
- }, configurable: !0, enumerable: !0 };
173
- }
174
- static getPropertyOptions(i) {
175
- return this.elementProperties.get(i) ?? ye;
176
- }
177
- static _$Ei() {
178
- if (this.hasOwnProperty(Q("elementProperties"))) return;
179
- const i = Je(this);
180
- i.finalize(), i.l !== void 0 && (this.l = [...i.l]), this.elementProperties = new Map(i.elementProperties);
181
- }
182
- static finalize() {
183
- if (this.hasOwnProperty(Q("finalized"))) return;
184
- if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(Q("properties"))) {
185
- const e = this.properties, t = [...Qe(e), ...We(e)];
186
- for (const r of t) this.createProperty(r, e[r]);
187
- }
188
- const i = this[Symbol.metadata];
189
- if (i !== null) {
190
- const e = litPropertyMetadata.get(i);
191
- if (e !== void 0) for (const [t, r] of e) this.elementProperties.set(t, r);
192
- }
193
- this._$Eh = /* @__PURE__ */ new Map();
194
- for (const [e, t] of this.elementProperties) {
195
- const r = this._$Eu(e, t);
196
- r !== void 0 && this._$Eh.set(r, e);
197
- }
198
- this.elementStyles = this.finalizeStyles(this.styles);
199
- }
200
- static finalizeStyles(i) {
201
- const e = [];
202
- if (Array.isArray(i)) {
203
- const t = new Set(i.flat(1 / 0).reverse());
204
- for (const r of t) e.unshift($e(r));
205
- } else i !== void 0 && e.push($e(i));
206
- return e;
207
- }
208
- static _$Eu(i, e) {
209
- const t = e.attribute;
210
- return t === !1 ? void 0 : typeof t == "string" ? t : typeof i == "string" ? i.toLowerCase() : void 0;
211
- }
212
- constructor() {
213
- super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
214
- }
215
- _$Ev() {
216
- this._$ES = new Promise((i) => this.enableUpdating = i), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach((i) => i(this));
217
- }
218
- addController(i) {
219
- (this._$EO ??= /* @__PURE__ */ new Set()).add(i), this.renderRoot !== void 0 && this.isConnected && i.hostConnected?.();
220
- }
221
- removeController(i) {
222
- this._$EO?.delete(i);
223
- }
224
- _$E_() {
225
- const i = /* @__PURE__ */ new Map(), e = this.constructor.elementProperties;
226
- for (const t of e.keys()) this.hasOwnProperty(t) && (i.set(t, this[t]), delete this[t]);
227
- i.size > 0 && (this._$Ep = i);
228
- }
229
- createRenderRoot() {
230
- const i = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
231
- return He(i, this.constructor.elementStyles), i;
232
- }
233
- connectedCallback() {
234
- this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach((i) => i.hostConnected?.());
235
- }
236
- enableUpdating(i) {
237
- }
238
- disconnectedCallback() {
239
- this._$EO?.forEach((i) => i.hostDisconnected?.());
240
- }
241
- attributeChangedCallback(i, e, t) {
242
- this._$AK(i, t);
243
- }
244
- _$ET(i, e) {
245
- const t = this.constructor.elementProperties.get(i), r = this.constructor._$Eu(i, t);
246
- if (r !== void 0 && t.reflect === !0) {
247
- const s = (t.converter?.toAttribute !== void 0 ? t.converter : oe).toAttribute(e, t.type);
248
- this._$Em = i, s == null ? this.removeAttribute(r) : this.setAttribute(r, s), this._$Em = null;
249
- }
250
- }
251
- _$AK(i, e) {
252
- const t = this.constructor, r = t._$Eh.get(i);
253
- if (r !== void 0 && this._$Em !== r) {
254
- const s = t.getPropertyOptions(r), l = typeof s.converter == "function" ? { fromAttribute: s.converter } : s.converter?.fromAttribute !== void 0 ? s.converter : oe;
255
- this._$Em = r, this[r] = l.fromAttribute(e, s.type) ?? this._$Ej?.get(r) ?? null, this._$Em = null;
256
- }
257
- }
258
- requestUpdate(i, e, t) {
259
- if (i !== void 0) {
260
- const r = this.constructor, s = this[i];
261
- if (t ??= r.getPropertyOptions(i), !((t.hasChanged ?? xe)(s, e) || t.useDefault && t.reflect && s === this._$Ej?.get(i) && !this.hasAttribute(r._$Eu(i, t)))) return;
262
- this.C(i, e, t);
263
- }
264
- this.isUpdatePending === !1 && (this._$ES = this._$EP());
265
- }
266
- C(i, e, { useDefault: t, reflect: r, wrapped: s }, l) {
267
- t && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(i) && (this._$Ej.set(i, l ?? e ?? this[i]), s !== !0 || l !== void 0) || (this._$AL.has(i) || (this.hasUpdated || t || (e = void 0), this._$AL.set(i, e)), r === !0 && this._$Em !== i && (this._$Eq ??= /* @__PURE__ */ new Set()).add(i));
268
- }
269
- async _$EP() {
270
- this.isUpdatePending = !0;
271
- try {
272
- await this._$ES;
273
- } catch (e) {
274
- Promise.reject(e);
275
- }
276
- const i = this.scheduleUpdate();
277
- return i != null && await i, !this.isUpdatePending;
278
- }
279
- scheduleUpdate() {
280
- return this.performUpdate();
281
- }
282
- performUpdate() {
283
- if (!this.isUpdatePending) return;
284
- if (!this.hasUpdated) {
285
- if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
286
- for (const [r, s] of this._$Ep) this[r] = s;
287
- this._$Ep = void 0;
288
- }
289
- const t = this.constructor.elementProperties;
290
- if (t.size > 0) for (const [r, s] of t) {
291
- const { wrapped: l } = s, p = this[r];
292
- l !== !0 || this._$AL.has(r) || p === void 0 || this.C(r, void 0, s, p);
293
- }
294
- }
295
- let i = !1;
296
- const e = this._$AL;
297
- try {
298
- i = this.shouldUpdate(e), i ? (this.willUpdate(e), this._$EO?.forEach((t) => t.hostUpdate?.()), this.update(e)) : this._$EM();
299
- } catch (t) {
300
- throw i = !1, this._$EM(), t;
301
- }
302
- i && this._$AE(e);
303
- }
304
- willUpdate(i) {
305
- }
306
- _$AE(i) {
307
- this._$EO?.forEach((e) => e.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(i)), this.updated(i);
308
- }
309
- _$EM() {
310
- this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
311
- }
312
- get updateComplete() {
313
- return this.getUpdateComplete();
314
- }
315
- getUpdateComplete() {
316
- return this._$ES;
317
- }
318
- shouldUpdate(i) {
319
- return !0;
320
- }
321
- update(i) {
322
- this._$Eq &&= this._$Eq.forEach((e) => this._$ET(e, this[e])), this._$EM();
323
- }
324
- updated(i) {
325
- }
326
- firstUpdated(i) {
327
- }
328
- };
329
- H.elementStyles = [], H.shadowRootOptions = { mode: "open" }, H[Q("elementProperties")] = /* @__PURE__ */ new Map(), H[Q("finalized")] = /* @__PURE__ */ new Map(), Xe?.({ ReactiveElement: H }), (ie.reactiveElementVersions ??= []).push("2.1.0");
330
- /**
331
- * @license
332
- * Copyright 2017 Google LLC
333
- * SPDX-License-Identifier: BSD-3-Clause
334
- */
335
- const he = globalThis, re = he.trustedTypes, ve = re ? re.createPolicy("lit-html", { createHTML: (i) => i }) : void 0, Se = "$lit$", b = `lit$${Math.random().toFixed(9).slice(2)}$`, Ce = "?" + b, Fe = `<${Ce}>`, G = document, J = () => G.createComment(""), K = (i) => i === null || typeof i != "object" && typeof i != "function", ce = Array.isArray, Ze = (i) => ce(i) || typeof i?.[Symbol.iterator] == "function", ne = `[
336
- \f\r]`, D = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, _e = /-->/g, ge = />/g, B = RegExp(`>|${ne}(?:([^\\s"'>=/]+)(${ne}*=${ne}*(?:[^
337
- \f\r"'\`<>=]|("|')|))|$)`, "g"), Ae = /'/g, we = /"/g, Ne = /^(?:script|style|textarea|title)$/i, Ye = (i) => (e, ...t) => ({ _$litType$: i, strings: e, values: t }), ke = Ye(1), z = Symbol.for("lit-noChange"), N = Symbol.for("lit-nothing"), Ee = /* @__PURE__ */ new WeakMap(), L = G.createTreeWalker(G, 129);
338
- function Te(i, e) {
339
- if (!ce(i) || !i.hasOwnProperty("raw")) throw Error("invalid template strings array");
340
- return ve !== void 0 ? ve.createHTML(e) : e;
341
- }
342
- const qe = (i, e) => {
343
- const t = i.length - 1, r = [];
344
- let s, l = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", p = D;
345
- for (let _ = 0; _ < t; _++) {
346
- const a = i[_];
347
- let h, f, n = -1, o = 0;
348
- for (; o < a.length && (p.lastIndex = o, f = p.exec(a), f !== null); ) o = p.lastIndex, p === D ? f[1] === "!--" ? p = _e : f[1] !== void 0 ? p = ge : f[2] !== void 0 ? (Ne.test(f[2]) && (s = RegExp("</" + f[2], "g")), p = B) : f[3] !== void 0 && (p = B) : p === B ? f[0] === ">" ? (p = s ?? D, n = -1) : f[1] === void 0 ? n = -2 : (n = p.lastIndex - f[2].length, h = f[1], p = f[3] === void 0 ? B : f[3] === '"' ? we : Ae) : p === we || p === Ae ? p = B : p === _e || p === ge ? p = D : (p = B, s = void 0);
349
- const d = p === B && i[_ + 1].startsWith("/>") ? " " : "";
350
- l += p === D ? a + Fe : n >= 0 ? (r.push(h), a.slice(0, n) + Se + a.slice(n) + b + d) : a + b + (n === -2 ? _ : d);
351
- }
352
- return [Te(i, l + (i[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), r];
353
- };
354
- class X {
355
- constructor({ strings: e, _$litType$: t }, r) {
356
- let s;
357
- this.parts = [];
358
- let l = 0, p = 0;
359
- const _ = e.length - 1, a = this.parts, [h, f] = qe(e, t);
360
- if (this.el = X.createElement(h, r), L.currentNode = this.el.content, t === 2 || t === 3) {
361
- const n = this.el.content.firstChild;
362
- n.replaceWith(...n.childNodes);
363
- }
364
- for (; (s = L.nextNode()) !== null && a.length < _; ) {
365
- if (s.nodeType === 1) {
366
- if (s.hasAttributes()) for (const n of s.getAttributeNames()) if (n.endsWith(Se)) {
367
- const o = f[p++], d = s.getAttribute(n).split(b), c = /([.?@])?(.*)/.exec(o);
368
- a.push({ type: 1, index: l, name: c[2], strings: d, ctor: c[1] === "." ? tt : c[1] === "?" ? rt : c[1] === "@" ? it : se }), s.removeAttribute(n);
369
- } else n.startsWith(b) && (a.push({ type: 6, index: l }), s.removeAttribute(n));
370
- if (Ne.test(s.tagName)) {
371
- const n = s.textContent.split(b), o = n.length - 1;
372
- if (o > 0) {
373
- s.textContent = re ? re.emptyScript : "";
374
- for (let d = 0; d < o; d++) s.append(n[d], J()), L.nextNode(), a.push({ type: 2, index: ++l });
375
- s.append(n[o], J());
376
- }
377
- }
378
- } else if (s.nodeType === 8) if (s.data === Ce) a.push({ type: 2, index: l });
379
- else {
380
- let n = -1;
381
- for (; (n = s.data.indexOf(b, n + 1)) !== -1; ) a.push({ type: 7, index: l }), n += b.length - 1;
382
- }
383
- l++;
384
- }
385
- }
386
- static createElement(e, t) {
387
- const r = G.createElement("template");
388
- return r.innerHTML = e, r;
389
- }
390
- }
391
- function j(i, e, t = i, r) {
392
- if (e === z) return e;
393
- let s = r !== void 0 ? t._$Co?.[r] : t._$Cl;
394
- const l = K(e) ? void 0 : e._$litDirective$;
395
- return s?.constructor !== l && (s?._$AO?.(!1), l === void 0 ? s = void 0 : (s = new l(i), s._$AT(i, t, r)), r !== void 0 ? (t._$Co ??= [])[r] = s : t._$Cl = s), s !== void 0 && (e = j(i, s._$AS(i, e.values), s, r)), e;
396
- }
397
- class et {
398
- constructor(e, t) {
399
- this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = t;
400
- }
401
- get parentNode() {
402
- return this._$AM.parentNode;
403
- }
404
- get _$AU() {
405
- return this._$AM._$AU;
406
- }
407
- u(e) {
408
- const { el: { content: t }, parts: r } = this._$AD, s = (e?.creationScope ?? G).importNode(t, !0);
409
- L.currentNode = s;
410
- let l = L.nextNode(), p = 0, _ = 0, a = r[0];
411
- for (; a !== void 0; ) {
412
- if (p === a.index) {
413
- let h;
414
- a.type === 2 ? h = new ue(l, l.nextSibling, this, e) : a.type === 1 ? h = new a.ctor(l, a.name, a.strings, this, e) : a.type === 6 && (h = new st(l, this, e)), this._$AV.push(h), a = r[++_];
415
- }
416
- p !== a?.index && (l = L.nextNode(), p++);
417
- }
418
- return L.currentNode = G, s;
419
- }
420
- p(e) {
421
- let t = 0;
422
- for (const r of this._$AV) r !== void 0 && (r.strings !== void 0 ? (r._$AI(e, r, t), t += r.strings.length - 2) : r._$AI(e[t])), t++;
423
- }
424
- }
425
- let ue = class Ie {
426
- get _$AU() {
427
- return this._$AM?._$AU ?? this._$Cv;
428
- }
429
- constructor(e, t, r, s) {
430
- this.type = 2, this._$AH = N, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = r, this.options = s, this._$Cv = s?.isConnected ?? !0;
431
- }
432
- get parentNode() {
433
- let e = this._$AA.parentNode;
434
- const t = this._$AM;
435
- return t !== void 0 && e?.nodeType === 11 && (e = t.parentNode), e;
436
- }
437
- get startNode() {
438
- return this._$AA;
439
- }
440
- get endNode() {
441
- return this._$AB;
442
- }
443
- _$AI(e, t = this) {
444
- e = j(this, e, t), K(e) ? e === N || e == null || e === "" ? (this._$AH !== N && this._$AR(), this._$AH = N) : e !== this._$AH && e !== z && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : Ze(e) ? this.k(e) : this._(e);
445
- }
446
- O(e) {
447
- return this._$AA.parentNode.insertBefore(e, this._$AB);
448
- }
449
- T(e) {
450
- this._$AH !== e && (this._$AR(), this._$AH = this.O(e));
451
- }
452
- _(e) {
453
- this._$AH !== N && K(this._$AH) ? this._$AA.nextSibling.data = e : this.T(G.createTextNode(e)), this._$AH = e;
454
- }
455
- $(e) {
456
- const { values: t, _$litType$: r } = e, s = typeof r == "number" ? this._$AC(e) : (r.el === void 0 && (r.el = X.createElement(Te(r.h, r.h[0]), this.options)), r);
457
- if (this._$AH?._$AD === s) this._$AH.p(t);
458
- else {
459
- const l = new et(s, this), p = l.u(this.options);
460
- l.p(t), this.T(p), this._$AH = l;
461
- }
462
- }
463
- _$AC(e) {
464
- let t = Ee.get(e.strings);
465
- return t === void 0 && Ee.set(e.strings, t = new X(e)), t;
466
- }
467
- k(e) {
468
- ce(this._$AH) || (this._$AH = [], this._$AR());
469
- const t = this._$AH;
470
- let r, s = 0;
471
- for (const l of e) s === t.length ? t.push(r = new Ie(this.O(J()), this.O(J()), this, this.options)) : r = t[s], r._$AI(l), s++;
472
- s < t.length && (this._$AR(r && r._$AB.nextSibling, s), t.length = s);
473
- }
474
- _$AR(e = this._$AA.nextSibling, t) {
475
- for (this._$AP?.(!1, !0, t); e && e !== this._$AB; ) {
476
- const r = e.nextSibling;
477
- e.remove(), e = r;
478
- }
479
- }
480
- setConnected(e) {
481
- this._$AM === void 0 && (this._$Cv = e, this._$AP?.(e));
482
- }
483
- };
484
- class se {
485
- get tagName() {
486
- return this.element.tagName;
487
- }
488
- get _$AU() {
489
- return this._$AM._$AU;
490
- }
491
- constructor(e, t, r, s, l) {
492
- this.type = 1, this._$AH = N, this._$AN = void 0, this.element = e, this.name = t, this._$AM = s, this.options = l, r.length > 2 || r[0] !== "" || r[1] !== "" ? (this._$AH = Array(r.length - 1).fill(new String()), this.strings = r) : this._$AH = N;
493
- }
494
- _$AI(e, t = this, r, s) {
495
- const l = this.strings;
496
- let p = !1;
497
- if (l === void 0) e = j(this, e, t, 0), p = !K(e) || e !== this._$AH && e !== z, p && (this._$AH = e);
498
- else {
499
- const _ = e;
500
- let a, h;
501
- for (e = l[0], a = 0; a < l.length - 1; a++) h = j(this, _[r + a], t, a), h === z && (h = this._$AH[a]), p ||= !K(h) || h !== this._$AH[a], h === N ? e = N : e !== N && (e += (h ?? "") + l[a + 1]), this._$AH[a] = h;
502
- }
503
- p && !s && this.j(e);
504
- }
505
- j(e) {
506
- e === N ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
507
- }
508
- }
509
- class tt extends se {
510
- constructor() {
511
- super(...arguments), this.type = 3;
512
- }
513
- j(e) {
514
- this.element[this.name] = e === N ? void 0 : e;
515
- }
516
- }
517
- class rt extends se {
518
- constructor() {
519
- super(...arguments), this.type = 4;
520
- }
521
- j(e) {
522
- this.element.toggleAttribute(this.name, !!e && e !== N);
523
- }
524
- }
525
- class it extends se {
526
- constructor(e, t, r, s, l) {
527
- super(e, t, r, s, l), this.type = 5;
528
- }
529
- _$AI(e, t = this) {
530
- if ((e = j(this, e, t, 0) ?? N) === z) return;
531
- const r = this._$AH, s = e === N && r !== N || e.capture !== r.capture || e.once !== r.once || e.passive !== r.passive, l = e !== N && (r === N || s);
532
- s && this.element.removeEventListener(this.name, this, r), l && this.element.addEventListener(this.name, this, e), this._$AH = e;
533
- }
534
- handleEvent(e) {
535
- typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, e) : this._$AH.handleEvent(e);
536
- }
537
- }
538
- class st {
539
- constructor(e, t, r) {
540
- this.element = e, this.type = 6, this._$AN = void 0, this._$AM = t, this.options = r;
541
- }
542
- get _$AU() {
543
- return this._$AM._$AU;
544
- }
545
- _$AI(e) {
546
- j(this, e);
547
- }
548
- }
549
- const nt = he.litHtmlPolyfillSupport;
550
- nt?.(X, ue), (he.litHtmlVersions ??= []).push("3.3.0");
551
- const ot = (i, e, t) => {
552
- const r = t?.renderBefore ?? e;
553
- let s = r._$litPart$;
554
- if (s === void 0) {
555
- const l = t?.renderBefore ?? null;
556
- r._$litPart$ = s = new ue(e.insertBefore(J(), l), l, void 0, t ?? {});
557
- }
558
- return s._$AI(i), s;
559
- };
560
- /**
561
- * @license
562
- * Copyright 2017 Google LLC
563
- * SPDX-License-Identifier: BSD-3-Clause
564
- */
565
- const de = globalThis;
566
- class W extends H {
567
- constructor() {
568
- super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
569
- }
570
- createRenderRoot() {
571
- const e = super.createRenderRoot();
572
- return this.renderOptions.renderBefore ??= e.firstChild, e;
573
- }
574
- update(e) {
575
- const t = this.render();
576
- this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(e), this._$Do = ot(t, this.renderRoot, this.renderOptions);
577
- }
578
- connectedCallback() {
579
- super.connectedCallback(), this._$Do?.setConnected(!0);
580
- }
581
- disconnectedCallback() {
582
- super.disconnectedCallback(), this._$Do?.setConnected(!1);
583
- }
584
- render() {
585
- return z;
586
- }
587
- }
588
- W._$litElement$ = !0, W.finalized = !0, de.litElementHydrateSupport?.({ LitElement: W });
589
- const at = de.litElementPolyfillSupport;
590
- at?.({ LitElement: W });
591
- (de.litElementVersions ??= []).push("4.2.0");
592
- class Me {
593
- constructor(e, t, r, s = "") {
594
- this._success = e, this._payload = t, this._status = r, this._message = s;
595
- }
596
- get success() {
597
- return this._success;
598
- }
599
- get payload() {
600
- return this._payload;
601
- }
602
- get status() {
603
- return this._status;
604
- }
605
- get message() {
606
- return this._message;
607
- }
608
- }
609
- function lt(i, e, t = "") {
610
- return new Me(!0, i, e, t);
611
- }
612
- function Ue(i, e, t = "") {
613
- return new Me(!1, i, e, t);
614
- }
615
- class pt {
616
- /**
617
- * Constructs a new instance of the class with the provided parameters.
618
- *
619
- * @param {NexusEndpoints} [baseUrl=NexusEndpoints.PRODUCTION] - The base URL endpoint for the API, defaulting to the production environment.
620
- * @param {string} epgLocation - The window.location.href associated with the epigraph data.
621
- * @param {string} epigraphSessionId - The session identifier for the epigraph session.
622
- * @param {string} epigraphComponentVersion - The version of the Epigraph Component(1.x.x or 1.2.1, etc.).
623
- * @param {string} [epigraphXPath=""] - The XPath expression for epigraph data processing, defaults to an empty string.
624
- * @param {NexusAPIVersions} [apiVersion=NexusAPIVersions.V1] - The API version to use, defaulting to version 1.
625
- * @return {void}
626
- */
627
- constructor(e = "https://api.myepigraph.com/api/", t, r, s = "", l = "", p = "v1/") {
628
- this.epigraphXPath = "", this.epigraphComponentVersion = s, this.epigraphSessionId = r, this.epigraphXPath = l, this.baseUrl = e + p, this.epgLocation = t;
629
- }
630
- /*******************************************************************************************************************
631
- * Epigraph Button API Calls *
632
- ******************************************************************************************************************/
633
- async getButtonBySku(e, t = "") {
634
- const r = {};
635
- t !== "" && (r.version_id = t);
636
- const s = `experience/button/sku/${e}`, l = this.buildNexusUrl(
637
- s,
638
- r
639
- );
640
- return await this.callNexusAPI(
641
- l,
642
- "GET"
643
- /* GET */
644
- );
645
- }
646
- async getButtonByShopifyVariantId(e, t = "") {
647
- const r = {};
648
- t !== "" && (r.version_id = t);
649
- const s = `experience/button/shopify_variant_id/${e}`, l = this.buildNexusUrl(
650
- s,
651
- r
652
- );
653
- return await this.callNexusAPI(
654
- l,
655
- "GET"
656
- /* GET */
657
- );
658
- }
659
- async getButtonByUpc(e, t = "") {
660
- const r = {};
661
- t !== "" && (r.version_id = t);
662
- const s = `experience/button/upc/${e}`, l = this.buildNexusUrl(
663
- s,
664
- r
665
- );
666
- return await this.callNexusAPI(
667
- l,
668
- "GET"
669
- /* GET */
670
- );
671
- }
672
- async getButtonByAsin(e, t = "") {
673
- const r = {};
674
- t !== "" && (r.version_id = t);
675
- const s = `experience/button/asin/${e}`, l = this.buildNexusUrl(
676
- s,
677
- r
678
- );
679
- return await this.callNexusAPI(
680
- l,
681
- "GET"
682
- /* GET */
683
- );
684
- }
685
- /*******************************************************************************************************************
686
- * Epigraph Viewer API Calls *
687
- ******************************************************************************************************************/
688
- async getViewerBySku(e, t = "") {
689
- const r = {};
690
- t !== "" && (r.version_id = t);
691
- const s = `experience/viewer/sku/${e}`, l = this.buildNexusUrl(
692
- s,
693
- r
694
- );
695
- return await this.callNexusAPI(
696
- l,
697
- "GET"
698
- /* GET */
699
- );
700
- }
701
- async getViewerByShopifyVariantId(e, t = "") {
702
- const r = {};
703
- t !== "" && (r.version_id = t);
704
- const s = `experience/viewer/shopify_variant_id/${e}`, l = this.buildNexusUrl(
705
- s,
706
- r
707
- );
708
- return await this.callNexusAPI(
709
- l,
710
- "GET"
711
- /* GET */
712
- );
713
- }
714
- async getViewerByUpc(e, t = "") {
715
- const r = {};
716
- t !== "" && (r.version_id = t);
717
- const s = `experience/viewer/upc/${e}`, l = this.buildNexusUrl(
718
- s,
719
- r
720
- );
721
- return await this.callNexusAPI(
722
- l,
723
- "GET"
724
- /* GET */
725
- );
726
- }
727
- async getViewerByAsin(e, t = "") {
728
- const r = {};
729
- t !== "" && (r.version_id = t);
730
- const s = `experience/viewer/asin/${e}`, l = this.buildNexusUrl(
731
- s,
732
- r
733
- );
734
- return await this.callNexusAPI(
735
- l,
736
- "GET"
737
- /* GET */
738
- );
739
- }
740
- /*******************************************************************************************************************
741
- * Epigraph Tour API Calls *
742
- ******************************************************************************************************************/
743
- async getTourBySku(e, t = "") {
744
- const r = {};
745
- t !== "" && (r.version_id = t);
746
- const s = `experience/tour/sku/${e}`, l = this.buildNexusUrl(
747
- s,
748
- r
749
- );
750
- return await this.callNexusAPI(
751
- l,
752
- "GET"
753
- /* GET */
754
- );
755
- }
756
- async getTourByShopifyVariantId(e, t = "") {
757
- const r = {};
758
- t !== "" && (r.version_id = t);
759
- const s = `experience/tour/shopify_variant_id/${e}`, l = this.buildNexusUrl(
760
- s,
761
- r
762
- );
763
- return await this.callNexusAPI(
764
- l,
765
- "GET"
766
- /* GET */
767
- );
768
- }
769
- async getTourByUpc(e, t = "") {
770
- const r = {};
771
- t !== "" && (r.version_id = t);
772
- const s = `experience/tour/upc/${e}`, l = this.buildNexusUrl(
773
- s,
774
- r
775
- );
776
- return await this.callNexusAPI(
777
- l,
778
- "GET"
779
- /* GET */
780
- );
781
- }
782
- async getTourByAsin(e, t = "") {
783
- const r = {};
784
- t !== "" && (r.version_id = t);
785
- const s = `experience/tour/asin/${e}`, l = this.buildNexusUrl(
786
- s,
787
- r
788
- );
789
- return await this.callNexusAPI(
790
- l,
791
- "GET"
792
- /* GET */
793
- );
794
- }
795
- /*******************************************************************************************************************
796
- * Configurator API Calls *
797
- ******************************************************************************************************************/
798
- async getConfiguratorByExperienceId(e, t = "") {
799
- const r = {};
800
- t !== "" && (r.version_id = t);
801
- const s = `experience/configurator/experience_id/${e}`, l = this.buildNexusUrl(
802
- s,
803
- r
804
- );
805
- return await this.callNexusAPI(
806
- l,
807
- "GET"
808
- /* GET */
809
- );
810
- }
811
- async getConfiguratorByClientAccessKey(e, t = "") {
812
- const r = {};
813
- t !== "" && (r.version_id = t);
814
- const s = `experience/configurator/client_access_key/${e}`, l = this.buildNexusUrl(
815
- s,
816
- r
817
- );
818
- return await this.callNexusAPI(
819
- l,
820
- "GET"
821
- /* GET */
822
- );
823
- }
824
- /*******************************************************************************************************************
825
- * ConfiguratorLite API Calls *
826
- ******************************************************************************************************************/
827
- async getConfiguratorLiteByExperienceId(e, t = "") {
828
- const r = {};
829
- t !== "" && (r.version_id = t);
830
- const s = `experience/configurator-lite/experience_id/${e}`, l = this.buildNexusUrl(
831
- s,
832
- r
833
- );
834
- return await this.callNexusAPI(
835
- l,
836
- "GET"
837
- /* GET */
838
- );
839
- }
840
- async getConfiguratorLiteByProjectId(e, t = "") {
841
- const r = {};
842
- t !== "" && (r.version_id = t);
843
- const s = `experience/configurator-lite/project_id/${e}`, l = this.buildNexusUrl(
844
- s,
845
- r
846
- );
847
- return await this.callNexusAPI(
848
- l,
849
- "GET"
850
- /* GET */
851
- );
852
- }
853
- /*******************************************************************************************************************
854
- * Save & Share Calls *
855
- ******************************************************************************************************************/
856
- async postExperienceSaveAndShare(e, t) {
857
- const r = `experience/${e}/save`, s = this.buildNexusUrl(
858
- r
859
- ), l = {
860
- save_data: JSON.stringify(t)
861
- }, p = new Headers();
862
- return p.set("Content-Type", "application/json"), await this.callNexusAPI(s, "POST", JSON.stringify(l), p);
863
- }
864
- async getExperienceSaveAndShare(e, t) {
865
- const r = `experience/${e}/save/${t}`, s = this.buildNexusUrl(
866
- r
867
- );
868
- return await this.callNexusAPI(
869
- s,
870
- "GET"
871
- /* GET */
872
- );
873
- }
874
- /**
875
- * Makes a call to the Nexus API and ensures the response is returned in JSON format.
876
- * Automatically appends the `application/json` accept header if not already provided.
877
- *
878
- * @param {URL} url - The URL of the Nexus API endpoint to call.
879
- * @param method
880
- * @param body
881
- * @param headers
882
- * @return {Promise<Result>} A promise that resolves with the API response, encapsulated in a success or failure result format.
883
- */
884
- async callNexusAPI(e, t = "GET", r, s = new Headers()) {
885
- s = this.addRequiredHeaders(s);
886
- const l = {
887
- method: t,
888
- body: r,
889
- headers: s
890
- };
891
- try {
892
- const p = await fetch(e, l), _ = await p.json();
893
- if (!p.ok) {
894
- let a = "Unable to retrieve configurator experience";
895
- return _.message && (a = _.message), Promise.resolve(
896
- Ue(_, p.status, a)
897
- );
898
- }
899
- return Promise.resolve(lt(_, p.status));
900
- } catch {
901
- return Promise.resolve(Ue({}, 500, "Unknown error"));
902
- }
903
- }
904
- buildNexusUrl(e, t = {}) {
905
- let r = new URL(this.baseUrl);
906
- r.pathname += e;
907
- for (const [s, l] of Object.entries(t))
908
- r.searchParams.set(s, l);
909
- return r;
910
- }
911
- /**
912
- * Adds required headers to the provided headers object if they are not already present.
913
- * Ensures that the headers include "accept", "EPG-Location", "EPG-Session-ID",
914
- * and "EPG-XPATH" with their respective values.
915
- *
916
- * @param {Headers} headers - The headers object to which the required headers will be added.
917
- * @return {Headers} The updated headers object containing all required headers.
918
- */
919
- addRequiredHeaders(e) {
920
- return e.has("accept") || e.set("accept", "application/json"), e.has("EPG-Location") || e.set("EPG-location", this.epgLocation), e.has("EPG-Session-ID") || e.set("EPG-Session-ID", this.epigraphSessionId), e.has("EPG-XPATH") || e.set("EPG-XPATH", this.epigraphXPath), e.has("EPG-Version") || e.set("EPG-Version", this.epigraphComponentVersion), e;
921
- }
922
- }
923
- var ee = /* @__PURE__ */ ((i) => (i.PRODUCTION = "https://api.myepigraph.com/api/", i.STAGING = "https://nexus.epigraph.dev/api/", i.LOCAL = "https://nexus.test/api/", i))(ee || {});
924
- let Re = null;
925
- class Oe {
926
- }
927
- Oe.render = function(i, e) {
928
- Re(i, e);
929
- };
930
- self.QrCreator = Oe;
931
- (function(i) {
932
- function e(_, a, h, f) {
933
- var n = {}, o = i(h, a);
934
- o.u(_), o.J(), f = f || 0;
935
- var d = o.h(), c = o.h() + 2 * f;
936
- return n.text = _, n.level = a, n.version = h, n.O = c, n.a = function(m, U) {
937
- return m -= f, U -= f, 0 > m || m >= d || 0 > U || U >= d ? !1 : o.a(m, U);
938
- }, n;
939
- }
940
- function t(_, a, h, f, n, o, d, c, m, U) {
941
- function S(y, g, u, $, w, P, x) {
942
- y ? (_.lineTo(g + P, u + x), _.arcTo(g, u, $, w, o)) : _.lineTo(g, u);
943
- }
944
- d ? _.moveTo(a + o, h) : _.moveTo(a, h), S(c, f, h, f, n, -o, 0), S(m, f, n, a, n, 0, -o), S(U, a, n, a, h, o, 0), S(d, a, h, f, h, 0, o);
945
- }
946
- function r(_, a, h, f, n, o, d, c, m, U) {
947
- function S(y, g, u, $) {
948
- _.moveTo(y + u, g), _.lineTo(
949
- y,
950
- g
951
- ), _.lineTo(y, g + $), _.arcTo(y, g, y + u, g, o);
952
- }
953
- d && S(a, h, o, o), c && S(f, h, -o, o), m && S(f, n, -o, -o), U && S(a, n, o, -o);
954
- }
955
- function s(_, a) {
956
- var h = a.fill;
957
- if (typeof h == "string") _.fillStyle = h;
958
- else {
959
- var f = h.type, n = h.colorStops;
960
- if (h = h.position.map((d) => Math.round(d * a.size)), f === "linear-gradient") var o = _.createLinearGradient.apply(_, h);
961
- else if (f === "radial-gradient") o = _.createRadialGradient.apply(_, h);
962
- else throw Error("Unsupported fill");
963
- n.forEach(([d, c]) => {
964
- o.addColorStop(d, c);
965
- }), _.fillStyle = o;
966
- }
967
- }
968
- function l(_, a) {
969
- e: {
970
- var h = a.text, f = a.v, n = a.N, o = a.K, d = a.P;
971
- for (n = Math.max(1, n || 1), o = Math.min(40, o || 40); n <= o; n += 1) try {
972
- var c = e(h, f, n, d);
973
- break e;
974
- } catch {
975
- }
976
- c = void 0;
977
- }
978
- if (!c) return null;
979
- for (h = _.getContext("2d"), a.background && (h.fillStyle = a.background, h.fillRect(a.left, a.top, a.size, a.size)), f = c.O, o = a.size / f, h.beginPath(), d = 0; d < f; d += 1) for (n = 0; n < f; n += 1) {
980
- var m = h, U = a.left + n * o, S = a.top + d * o, y = d, g = n, u = c.a, $ = U + o, w = S + o, P = y - 1, x = y + 1, E = g - 1, A = g + 1, R = Math.floor(Math.min(0.5, Math.max(0, a.R)) * o), O = u(y, g), V = u(P, E), F = u(P, g);
981
- P = u(P, A);
982
- var Z = u(y, A);
983
- A = u(x, A), g = u(
984
- x,
985
- g
986
- ), x = u(x, E), y = u(y, E), U = Math.round(U), S = Math.round(S), $ = Math.round($), w = Math.round(w), O ? t(m, U, S, $, w, R, !F && !y, !F && !Z, !g && !Z, !g && !y) : r(m, U, S, $, w, R, F && y && V, F && Z && P, g && Z && A, g && y && x);
987
- }
988
- return s(h, a), h.fill(), _;
989
- }
990
- var p = { minVersion: 1, maxVersion: 40, ecLevel: "L", left: 0, top: 0, size: 200, fill: "#000", background: null, text: "no text", radius: 0.5, quiet: 0 };
991
- Re = function(_, a) {
992
- var h = {};
993
- Object.assign(h, p, _), h.N = h.minVersion, h.K = h.maxVersion, h.v = h.ecLevel, h.left = h.left, h.top = h.top, h.size = h.size, h.fill = h.fill, h.background = h.background, h.text = h.text, h.R = h.radius, h.P = h.quiet, a instanceof HTMLCanvasElement ? ((a.width !== h.size || a.height !== h.size) && (a.width = h.size, a.height = h.size), a.getContext("2d").clearRect(0, 0, a.width, a.height), l(a, h)) : (_ = document.createElement("canvas"), _.width = h.size, _.height = h.size, h = l(_, h), a.appendChild(h));
994
- };
995
- })(function() {
996
- function i(a) {
997
- var h = t.s(a);
998
- return { S: function() {
999
- return 4;
1000
- }, b: function() {
1001
- return h.length;
1002
- }, write: function(f) {
1003
- for (var n = 0; n < h.length; n += 1) f.put(h[n], 8);
1004
- } };
1005
- }
1006
- function e() {
1007
- var a = [], h = 0, f = {
1008
- B: function() {
1009
- return a;
1010
- },
1011
- c: function(n) {
1012
- return (a[Math.floor(n / 8)] >>> 7 - n % 8 & 1) == 1;
1013
- },
1014
- put: function(n, o) {
1015
- for (var d = 0; d < o; d += 1) f.m((n >>> o - d - 1 & 1) == 1);
1016
- },
1017
- f: function() {
1018
- return h;
1019
- },
1020
- m: function(n) {
1021
- var o = Math.floor(h / 8);
1022
- a.length <= o && a.push(0), n && (a[o] |= 128 >>> h % 8), h += 1;
1023
- }
1024
- };
1025
- return f;
1026
- }
1027
- function t(a, h) {
1028
- function f(y, g) {
1029
- for (var u = -1; 7 >= u; u += 1) if (!(-1 >= y + u || c <= y + u)) for (var $ = -1; 7 >= $; $ += 1) -1 >= g + $ || c <= g + $ || (d[y + u][g + $] = 0 <= u && 6 >= u && ($ == 0 || $ == 6) || 0 <= $ && 6 >= $ && (u == 0 || u == 6) || 2 <= u && 4 >= u && 2 <= $ && 4 >= $);
1030
- }
1031
- function n(y, g) {
1032
- for (var u = c = 4 * a + 17, $ = Array(u), w = 0; w < u; w += 1) {
1033
- $[w] = Array(u);
1034
- for (var P = 0; P < u; P += 1) $[w][P] = null;
1035
- }
1036
- for (d = $, f(0, 0), f(c - 7, 0), f(0, c - 7), u = l.G(a), $ = 0; $ < u.length; $ += 1) for (w = 0; w < u.length; w += 1) {
1037
- P = u[$];
1038
- var x = u[w];
1039
- if (d[P][x] == null) for (var E = -2; 2 >= E; E += 1) for (var A = -2; 2 >= A; A += 1) d[P + E][x + A] = E == -2 || E == 2 || A == -2 || A == 2 || E == 0 && A == 0;
1040
- }
1041
- for (u = 8; u < c - 8; u += 1) d[u][6] == null && (d[u][6] = u % 2 == 0);
1042
- for (u = 8; u < c - 8; u += 1) d[6][u] == null && (d[6][u] = u % 2 == 0);
1043
- for (u = l.w(o << 3 | g), $ = 0; 15 > $; $ += 1) w = !y && (u >> $ & 1) == 1, d[6 > $ ? $ : 8 > $ ? $ + 1 : c - 15 + $][8] = w, d[8][8 > $ ? c - $ - 1 : 9 > $ ? 15 - $ : 14 - $] = w;
1044
- if (d[c - 8][8] = !y, 7 <= a) {
1045
- for (u = l.A(a), $ = 0; 18 > $; $ += 1) w = !y && (u >> $ & 1) == 1, d[Math.floor($ / 3)][$ % 3 + c - 8 - 3] = w;
1046
- for ($ = 0; 18 > $; $ += 1) w = !y && (u >> $ & 1) == 1, d[$ % 3 + c - 8 - 3][Math.floor($ / 3)] = w;
1047
- }
1048
- if (m == null) {
1049
- for (y = _.I(a, o), u = e(), $ = 0; $ < U.length; $ += 1) w = U[$], u.put(4, 4), u.put(w.b(), l.f(4, a)), w.write(u);
1050
- for ($ = w = 0; $ < y.length; $ += 1) w += y[$].j;
1051
- if (u.f() > 8 * w) throw Error("code length overflow. (" + u.f() + ">" + 8 * w + ")");
1052
- for (u.f() + 4 <= 8 * w && u.put(0, 4); u.f() % 8 != 0; ) u.m(!1);
1053
- for (; !(u.f() >= 8 * w) && (u.put(236, 8), !(u.f() >= 8 * w)); )
1054
- u.put(17, 8);
1055
- var R = 0;
1056
- for (w = $ = 0, P = Array(y.length), x = Array(y.length), E = 0; E < y.length; E += 1) {
1057
- var O = y[E].j, V = y[E].o - O;
1058
- for ($ = Math.max($, O), w = Math.max(w, V), P[E] = Array(O), A = 0; A < P[E].length; A += 1) P[E][A] = 255 & u.B()[A + R];
1059
- for (R += O, A = l.C(V), O = r(P[E], A.b() - 1).l(A), x[E] = Array(A.b() - 1), A = 0; A < x[E].length; A += 1) V = A + O.b() - x[E].length, x[E][A] = 0 <= V ? O.c(V) : 0;
1060
- }
1061
- for (A = u = 0; A < y.length; A += 1) u += y[A].o;
1062
- for (u = Array(u), A = R = 0; A < $; A += 1) for (E = 0; E < y.length; E += 1) A < P[E].length && (u[R] = P[E][A], R += 1);
1063
- for (A = 0; A < w; A += 1) for (E = 0; E < y.length; E += 1) A < x[E].length && (u[R] = x[E][A], R += 1);
1064
- m = u;
1065
- }
1066
- for (y = m, u = -1, $ = c - 1, w = 7, P = 0, g = l.F(g), x = c - 1; 0 < x; x -= 2) for (x == 6 && --x; ; ) {
1067
- for (E = 0; 2 > E; E += 1) d[$][x - E] == null && (A = !1, P < y.length && (A = (y[P] >>> w & 1) == 1), g($, x - E) && (A = !A), d[$][x - E] = A, --w, w == -1 && (P += 1, w = 7));
1068
- if ($ += u, 0 > $ || c <= $) {
1069
- $ -= u, u = -u;
1070
- break;
1071
- }
1072
- }
1073
- }
1074
- var o = s[h], d = null, c = 0, m = null, U = [], S = { u: function(y) {
1075
- y = i(y), U.push(y), m = null;
1076
- }, a: function(y, g) {
1077
- if (0 > y || c <= y || 0 > g || c <= g) throw Error(y + "," + g);
1078
- return d[y][g];
1079
- }, h: function() {
1080
- return c;
1081
- }, J: function() {
1082
- for (var y = 0, g = 0, u = 0; 8 > u; u += 1) {
1083
- n(!0, u);
1084
- var $ = l.D(S);
1085
- (u == 0 || y > $) && (y = $, g = u);
1086
- }
1087
- n(!1, g);
1088
- } };
1089
- return S;
1090
- }
1091
- function r(a, h) {
1092
- if (typeof a.length > "u") throw Error(a.length + "/" + h);
1093
- var f = function() {
1094
- for (var o = 0; o < a.length && a[o] == 0; ) o += 1;
1095
- for (var d = Array(a.length - o + h), c = 0; c < a.length - o; c += 1) d[c] = a[c + o];
1096
- return d;
1097
- }(), n = { c: function(o) {
1098
- return f[o];
1099
- }, b: function() {
1100
- return f.length;
1101
- }, multiply: function(o) {
1102
- for (var d = Array(n.b() + o.b() - 1), c = 0; c < n.b(); c += 1) for (var m = 0; m < o.b(); m += 1) d[c + m] ^= p.i(p.g(n.c(c)) + p.g(o.c(m)));
1103
- return r(d, 0);
1104
- }, l: function(o) {
1105
- if (0 > n.b() - o.b()) return n;
1106
- for (var d = p.g(n.c(0)) - p.g(o.c(0)), c = Array(n.b()), m = 0; m < n.b(); m += 1) c[m] = n.c(m);
1107
- for (m = 0; m < o.b(); m += 1) c[m] ^= p.i(p.g(o.c(m)) + d);
1108
- return r(c, 0).l(o);
1109
- } };
1110
- return n;
1111
- }
1112
- t.s = function(a) {
1113
- for (var h = [], f = 0; f < a.length; f++) {
1114
- var n = a.charCodeAt(f);
1115
- 128 > n ? h.push(n) : 2048 > n ? h.push(192 | n >> 6, 128 | n & 63) : 55296 > n || 57344 <= n ? h.push(224 | n >> 12, 128 | n >> 6 & 63, 128 | n & 63) : (f++, n = 65536 + ((n & 1023) << 10 | a.charCodeAt(f) & 1023), h.push(240 | n >> 18, 128 | n >> 12 & 63, 128 | n >> 6 & 63, 128 | n & 63));
1116
- }
1117
- return h;
1118
- };
1119
- var s = { L: 1, M: 0, Q: 3, H: 2 }, l = /* @__PURE__ */ function() {
1120
- function a(n) {
1121
- for (var o = 0; n != 0; ) o += 1, n >>>= 1;
1122
- return o;
1123
- }
1124
- var h = [
1125
- [],
1126
- [6, 18],
1127
- [6, 22],
1128
- [6, 26],
1129
- [6, 30],
1130
- [6, 34],
1131
- [6, 22, 38],
1132
- [6, 24, 42],
1133
- [6, 26, 46],
1134
- [6, 28, 50],
1135
- [6, 30, 54],
1136
- [6, 32, 58],
1137
- [6, 34, 62],
1138
- [6, 26, 46, 66],
1139
- [6, 26, 48, 70],
1140
- [6, 26, 50, 74],
1141
- [6, 30, 54, 78],
1142
- [6, 30, 56, 82],
1143
- [6, 30, 58, 86],
1144
- [6, 34, 62, 90],
1145
- [6, 28, 50, 72, 94],
1146
- [6, 26, 50, 74, 98],
1147
- [6, 30, 54, 78, 102],
1148
- [6, 28, 54, 80, 106],
1149
- [6, 32, 58, 84, 110],
1150
- [6, 30, 58, 86, 114],
1151
- [6, 34, 62, 90, 118],
1152
- [6, 26, 50, 74, 98, 122],
1153
- [6, 30, 54, 78, 102, 126],
1154
- [6, 26, 52, 78, 104, 130],
1155
- [6, 30, 56, 82, 108, 134],
1156
- [6, 34, 60, 86, 112, 138],
1157
- [6, 30, 58, 86, 114, 142],
1158
- [6, 34, 62, 90, 118, 146],
1159
- [6, 30, 54, 78, 102, 126, 150],
1160
- [6, 24, 50, 76, 102, 128, 154],
1161
- [6, 28, 54, 80, 106, 132, 158],
1162
- [6, 32, 58, 84, 110, 136, 162],
1163
- [6, 26, 54, 82, 110, 138, 166],
1164
- [6, 30, 58, 86, 114, 142, 170]
1165
- ], f = { w: function(n) {
1166
- for (var o = n << 10; 0 <= a(o) - a(1335); ) o ^= 1335 << a(o) - a(1335);
1167
- return (n << 10 | o) ^ 21522;
1168
- }, A: function(n) {
1169
- for (var o = n << 12; 0 <= a(o) - a(7973); ) o ^= 7973 << a(o) - a(7973);
1170
- return n << 12 | o;
1171
- }, G: function(n) {
1172
- return h[n - 1];
1173
- }, F: function(n) {
1174
- switch (n) {
1175
- case 0:
1176
- return function(o, d) {
1177
- return (o + d) % 2 == 0;
1178
- };
1179
- case 1:
1180
- return function(o) {
1181
- return o % 2 == 0;
1182
- };
1183
- case 2:
1184
- return function(o, d) {
1185
- return d % 3 == 0;
1186
- };
1187
- case 3:
1188
- return function(o, d) {
1189
- return (o + d) % 3 == 0;
1190
- };
1191
- case 4:
1192
- return function(o, d) {
1193
- return (Math.floor(o / 2) + Math.floor(d / 3)) % 2 == 0;
1194
- };
1195
- case 5:
1196
- return function(o, d) {
1197
- return o * d % 2 + o * d % 3 == 0;
1198
- };
1199
- case 6:
1200
- return function(o, d) {
1201
- return (o * d % 2 + o * d % 3) % 2 == 0;
1202
- };
1203
- case 7:
1204
- return function(o, d) {
1205
- return (o * d % 3 + (o + d) % 2) % 2 == 0;
1206
- };
1207
- default:
1208
- throw Error("bad maskPattern:" + n);
1209
- }
1210
- }, C: function(n) {
1211
- for (var o = r([1], 0), d = 0; d < n; d += 1) o = o.multiply(r([1, p.i(d)], 0));
1212
- return o;
1213
- }, f: function(n, o) {
1214
- if (n != 4 || 1 > o || 40 < o) throw Error("mode: " + n + "; type: " + o);
1215
- return 10 > o ? 8 : 16;
1216
- }, D: function(n) {
1217
- for (var o = n.h(), d = 0, c = 0; c < o; c += 1) for (var m = 0; m < o; m += 1) {
1218
- for (var U = 0, S = n.a(c, m), y = -1; 1 >= y; y += 1) if (!(0 > c + y || o <= c + y)) for (var g = -1; 1 >= g; g += 1) 0 > m + g || o <= m + g || (y != 0 || g != 0) && S == n.a(c + y, m + g) && (U += 1);
1219
- 5 < U && (d += 3 + U - 5);
1220
- }
1221
- for (c = 0; c < o - 1; c += 1) for (m = 0; m < o - 1; m += 1) U = 0, n.a(c, m) && (U += 1), n.a(c + 1, m) && (U += 1), n.a(c, m + 1) && (U += 1), n.a(c + 1, m + 1) && (U += 1), (U == 0 || U == 4) && (d += 3);
1222
- for (c = 0; c < o; c += 1) for (m = 0; m < o - 6; m += 1) n.a(c, m) && !n.a(c, m + 1) && n.a(c, m + 2) && n.a(c, m + 3) && n.a(c, m + 4) && !n.a(c, m + 5) && n.a(c, m + 6) && (d += 40);
1223
- for (m = 0; m < o; m += 1) for (c = 0; c < o - 6; c += 1) n.a(c, m) && !n.a(c + 1, m) && n.a(c + 2, m) && n.a(c + 3, m) && n.a(c + 4, m) && !n.a(c + 5, m) && n.a(c + 6, m) && (d += 40);
1224
- for (m = U = 0; m < o; m += 1) for (c = 0; c < o; c += 1) n.a(c, m) && (U += 1);
1225
- return d += Math.abs(100 * U / o / o - 50) / 5 * 10;
1226
- } };
1227
- return f;
1228
- }(), p = function() {
1229
- for (var a = Array(256), h = Array(256), f = 0; 8 > f; f += 1) a[f] = 1 << f;
1230
- for (f = 8; 256 > f; f += 1) a[f] = a[f - 4] ^ a[f - 5] ^ a[f - 6] ^ a[f - 8];
1231
- for (f = 0; 255 > f; f += 1) h[a[f]] = f;
1232
- return { g: function(n) {
1233
- if (1 > n) throw Error("glog(" + n + ")");
1234
- return h[n];
1235
- }, i: function(n) {
1236
- for (; 0 > n; ) n += 255;
1237
- for (; 256 <= n; ) n -= 255;
1238
- return a[n];
1239
- } };
1240
- }(), _ = /* @__PURE__ */ function() {
1241
- function a(n, o) {
1242
- switch (o) {
1243
- case s.L:
1244
- return h[4 * (n - 1)];
1245
- case s.M:
1246
- return h[4 * (n - 1) + 1];
1247
- case s.Q:
1248
- return h[4 * (n - 1) + 2];
1249
- case s.H:
1250
- return h[4 * (n - 1) + 3];
1251
- }
1252
- }
1253
- var h = [
1254
- [1, 26, 19],
1255
- [1, 26, 16],
1256
- [1, 26, 13],
1257
- [1, 26, 9],
1258
- [1, 44, 34],
1259
- [1, 44, 28],
1260
- [1, 44, 22],
1261
- [1, 44, 16],
1262
- [1, 70, 55],
1263
- [1, 70, 44],
1264
- [2, 35, 17],
1265
- [2, 35, 13],
1266
- [1, 100, 80],
1267
- [2, 50, 32],
1268
- [2, 50, 24],
1269
- [4, 25, 9],
1270
- [1, 134, 108],
1271
- [2, 67, 43],
1272
- [2, 33, 15, 2, 34, 16],
1273
- [2, 33, 11, 2, 34, 12],
1274
- [2, 86, 68],
1275
- [4, 43, 27],
1276
- [4, 43, 19],
1277
- [4, 43, 15],
1278
- [2, 98, 78],
1279
- [4, 49, 31],
1280
- [2, 32, 14, 4, 33, 15],
1281
- [4, 39, 13, 1, 40, 14],
1282
- [2, 121, 97],
1283
- [2, 60, 38, 2, 61, 39],
1284
- [4, 40, 18, 2, 41, 19],
1285
- [4, 40, 14, 2, 41, 15],
1286
- [2, 146, 116],
1287
- [
1288
- 3,
1289
- 58,
1290
- 36,
1291
- 2,
1292
- 59,
1293
- 37
1294
- ],
1295
- [4, 36, 16, 4, 37, 17],
1296
- [4, 36, 12, 4, 37, 13],
1297
- [2, 86, 68, 2, 87, 69],
1298
- [4, 69, 43, 1, 70, 44],
1299
- [6, 43, 19, 2, 44, 20],
1300
- [6, 43, 15, 2, 44, 16],
1301
- [4, 101, 81],
1302
- [1, 80, 50, 4, 81, 51],
1303
- [4, 50, 22, 4, 51, 23],
1304
- [3, 36, 12, 8, 37, 13],
1305
- [2, 116, 92, 2, 117, 93],
1306
- [6, 58, 36, 2, 59, 37],
1307
- [4, 46, 20, 6, 47, 21],
1308
- [7, 42, 14, 4, 43, 15],
1309
- [4, 133, 107],
1310
- [8, 59, 37, 1, 60, 38],
1311
- [8, 44, 20, 4, 45, 21],
1312
- [12, 33, 11, 4, 34, 12],
1313
- [3, 145, 115, 1, 146, 116],
1314
- [4, 64, 40, 5, 65, 41],
1315
- [11, 36, 16, 5, 37, 17],
1316
- [11, 36, 12, 5, 37, 13],
1317
- [5, 109, 87, 1, 110, 88],
1318
- [5, 65, 41, 5, 66, 42],
1319
- [5, 54, 24, 7, 55, 25],
1320
- [11, 36, 12, 7, 37, 13],
1321
- [5, 122, 98, 1, 123, 99],
1322
- [
1323
- 7,
1324
- 73,
1325
- 45,
1326
- 3,
1327
- 74,
1328
- 46
1329
- ],
1330
- [15, 43, 19, 2, 44, 20],
1331
- [3, 45, 15, 13, 46, 16],
1332
- [1, 135, 107, 5, 136, 108],
1333
- [10, 74, 46, 1, 75, 47],
1334
- [1, 50, 22, 15, 51, 23],
1335
- [2, 42, 14, 17, 43, 15],
1336
- [5, 150, 120, 1, 151, 121],
1337
- [9, 69, 43, 4, 70, 44],
1338
- [17, 50, 22, 1, 51, 23],
1339
- [2, 42, 14, 19, 43, 15],
1340
- [3, 141, 113, 4, 142, 114],
1341
- [3, 70, 44, 11, 71, 45],
1342
- [17, 47, 21, 4, 48, 22],
1343
- [9, 39, 13, 16, 40, 14],
1344
- [3, 135, 107, 5, 136, 108],
1345
- [3, 67, 41, 13, 68, 42],
1346
- [15, 54, 24, 5, 55, 25],
1347
- [15, 43, 15, 10, 44, 16],
1348
- [4, 144, 116, 4, 145, 117],
1349
- [17, 68, 42],
1350
- [17, 50, 22, 6, 51, 23],
1351
- [19, 46, 16, 6, 47, 17],
1352
- [2, 139, 111, 7, 140, 112],
1353
- [17, 74, 46],
1354
- [7, 54, 24, 16, 55, 25],
1355
- [34, 37, 13],
1356
- [
1357
- 4,
1358
- 151,
1359
- 121,
1360
- 5,
1361
- 152,
1362
- 122
1363
- ],
1364
- [4, 75, 47, 14, 76, 48],
1365
- [11, 54, 24, 14, 55, 25],
1366
- [16, 45, 15, 14, 46, 16],
1367
- [6, 147, 117, 4, 148, 118],
1368
- [6, 73, 45, 14, 74, 46],
1369
- [11, 54, 24, 16, 55, 25],
1370
- [30, 46, 16, 2, 47, 17],
1371
- [8, 132, 106, 4, 133, 107],
1372
- [8, 75, 47, 13, 76, 48],
1373
- [7, 54, 24, 22, 55, 25],
1374
- [22, 45, 15, 13, 46, 16],
1375
- [10, 142, 114, 2, 143, 115],
1376
- [19, 74, 46, 4, 75, 47],
1377
- [28, 50, 22, 6, 51, 23],
1378
- [33, 46, 16, 4, 47, 17],
1379
- [8, 152, 122, 4, 153, 123],
1380
- [22, 73, 45, 3, 74, 46],
1381
- [8, 53, 23, 26, 54, 24],
1382
- [12, 45, 15, 28, 46, 16],
1383
- [3, 147, 117, 10, 148, 118],
1384
- [3, 73, 45, 23, 74, 46],
1385
- [4, 54, 24, 31, 55, 25],
1386
- [11, 45, 15, 31, 46, 16],
1387
- [7, 146, 116, 7, 147, 117],
1388
- [21, 73, 45, 7, 74, 46],
1389
- [1, 53, 23, 37, 54, 24],
1390
- [19, 45, 15, 26, 46, 16],
1391
- [5, 145, 115, 10, 146, 116],
1392
- [19, 75, 47, 10, 76, 48],
1393
- [15, 54, 24, 25, 55, 25],
1394
- [23, 45, 15, 25, 46, 16],
1395
- [13, 145, 115, 3, 146, 116],
1396
- [2, 74, 46, 29, 75, 47],
1397
- [42, 54, 24, 1, 55, 25],
1398
- [23, 45, 15, 28, 46, 16],
1399
- [17, 145, 115],
1400
- [10, 74, 46, 23, 75, 47],
1401
- [10, 54, 24, 35, 55, 25],
1402
- [19, 45, 15, 35, 46, 16],
1403
- [17, 145, 115, 1, 146, 116],
1404
- [14, 74, 46, 21, 75, 47],
1405
- [29, 54, 24, 19, 55, 25],
1406
- [11, 45, 15, 46, 46, 16],
1407
- [13, 145, 115, 6, 146, 116],
1408
- [14, 74, 46, 23, 75, 47],
1409
- [44, 54, 24, 7, 55, 25],
1410
- [59, 46, 16, 1, 47, 17],
1411
- [12, 151, 121, 7, 152, 122],
1412
- [12, 75, 47, 26, 76, 48],
1413
- [39, 54, 24, 14, 55, 25],
1414
- [22, 45, 15, 41, 46, 16],
1415
- [6, 151, 121, 14, 152, 122],
1416
- [6, 75, 47, 34, 76, 48],
1417
- [46, 54, 24, 10, 55, 25],
1418
- [2, 45, 15, 64, 46, 16],
1419
- [17, 152, 122, 4, 153, 123],
1420
- [29, 74, 46, 14, 75, 47],
1421
- [49, 54, 24, 10, 55, 25],
1422
- [24, 45, 15, 46, 46, 16],
1423
- [4, 152, 122, 18, 153, 123],
1424
- [13, 74, 46, 32, 75, 47],
1425
- [48, 54, 24, 14, 55, 25],
1426
- [42, 45, 15, 32, 46, 16],
1427
- [20, 147, 117, 4, 148, 118],
1428
- [40, 75, 47, 7, 76, 48],
1429
- [43, 54, 24, 22, 55, 25],
1430
- [10, 45, 15, 67, 46, 16],
1431
- [19, 148, 118, 6, 149, 119],
1432
- [18, 75, 47, 31, 76, 48],
1433
- [34, 54, 24, 34, 55, 25],
1434
- [20, 45, 15, 61, 46, 16]
1435
- ], f = { I: function(n, o) {
1436
- var d = a(n, o);
1437
- if (typeof d > "u") throw Error("bad rs block @ typeNumber:" + n + "/errorCorrectLevel:" + o);
1438
- n = d.length / 3, o = [];
1439
- for (var c = 0; c < n; c += 1) for (var m = d[3 * c], U = d[3 * c + 1], S = d[3 * c + 2], y = 0; y < m; y += 1) {
1440
- var g = S, u = {};
1441
- u.o = U, u.j = g, o.push(u);
1442
- }
1443
- return o;
1444
- } };
1445
- return f;
1446
- }();
1447
- return t;
1448
- }());
1449
- const ht = QrCreator;
1450
- var ct = Object.defineProperty, ut = (i, e, t, r) => {
1451
- for (var s = void 0, l = i.length - 1, p; l >= 0; l--)
1452
- (p = i[l]) && (s = p(e, t, s) || s);
1453
- return s && ct(e, t, s), s;
1454
- };
1455
- class te extends W {
1456
- static {
1457
- this.webComponentName = "epigraph-qr-code-generator";
1458
- }
1459
- static {
1460
- this.styles = Ge`
1461
- :host {
1462
- display: none;
1463
- }
1464
- `;
1465
- }
1466
- get qrCodeGenCanvasRef() {
1467
- return this._qrCodeGenCanvasRef;
1468
- }
1469
- /**
1470
- * Converts any given data uri to a blob.
1471
- *
1472
- * @param {string} dataUri Raw data URI, either fetched from an HTML Canvas or any other valid source.
1473
- * @returns {Blob} The generate blob.
1474
- */
1475
- dataUritoBlob(e) {
1476
- const t = e.split(",");
1477
- if (t.length !== 2)
1478
- throw new Error("Invalid data URI format");
1479
- const r = t[0].split(":")[1].split(";")[0], s = atob(t[1]), l = new Uint8Array(Array.from(s, (p) => p.charCodeAt(0)));
1480
- return new Blob([l], { type: r });
1481
- }
1482
- /**
1483
- * Generates a QR code as image data url for the qrCodeContent provided.
1484
- *
1485
- * @param {string} qrCodeContent The content to be embedded in the QR code.
1486
- * @returns {string} Session data URL for the generated QR code.
1487
- */
1488
- generateQrCode(e = {
1489
- text: "www.epigraph.us",
1490
- radius: 0.5,
1491
- // 0.0 to 0.5
1492
- ecLevel: "H",
1493
- // L, M, Q, H
1494
- fill: "black",
1495
- // foreground color
1496
- background: null,
1497
- // color or null for transparent
1498
- size: 256
1499
- // in pixels
1500
- }) {
1501
- if (!this._qrCodeGenCanvasRef)
1502
- return "";
1503
- ht.render(e, this._qrCodeGenCanvasRef);
1504
- const t = this._qrCodeGenCanvasRef.toDataURL(), r = this.dataUritoBlob(t);
1505
- return URL.createObjectURL(r);
1506
- }
1507
- /**
1508
- * Override for the LitElement's render method.
1509
- *
1510
- * @returns {html} HTML to be rendered by this component.
1511
- */
1512
- render() {
1513
- return ke`
1514
- <canvas id="qrCodeCanvas"></canvas>
1515
- `;
1516
- }
1517
- }
1518
- ut([
1519
- Ve("#qrCodeCanvas")
1520
- ], te.prototype, "_qrCodeGenCanvasRef");
1521
- window.customElements.get(te.webComponentName) === void 0 && window.customElements.define(te.webComponentName, te);
1522
- var be = /* @__PURE__ */ ((i) => (i.RAW = "raw", i.DISTANCE = "distance", i.WEIGHT = "weight", i))(be || {}), v = /* @__PURE__ */ ((i) => (i.millimeter = "mm", i.centimeter = "cm", i.decimeter = "dm", i.meter = "m", i.decameter = "dam", i.hectometer = "hm", i.kilometer = "km", i.inch = "in", i.foot = "ft", i.yard = "yd", i.mile = "mi", i))(v || {});
1523
- let C = {};
1524
- C[`${v.millimeter}-${v.meter}`] = 1e-3;
1525
- C[`${v.meter}-${v.millimeter}`] = 1e3;
1526
- C[`${v.centimeter}-${v.meter}`] = 0.01;
1527
- C[`${v.meter}-${v.centimeter}`] = 100;
1528
- C[`${v.decimeter}-${v.meter}`] = 0.1;
1529
- C[`${v.meter}-${v.decimeter}`] = 10;
1530
- C[`${v.meter}-${v.meter}`] = 1;
1531
- C[`${v.decameter}-${v.meter}`] = 10;
1532
- C[`${v.meter}-${v.decameter}`] = 0.1;
1533
- C[`${v.hectometer}-${v.meter}`] = 100;
1534
- C[`${v.meter}-${v.hectometer}`] = 0.01;
1535
- C[`${v.kilometer}-${v.meter}`] = 1e3;
1536
- C[`${v.meter}-${v.kilometer}`] = 1e-3;
1537
- C[`${v.inch}-${v.meter}`] = 0.0254;
1538
- C[`${v.meter}-${v.inch}`] = 39.3701;
1539
- C[`${v.foot}-${v.meter}`] = 0.3048;
1540
- C[`${v.meter}-${v.foot}`] = 3.28084;
1541
- C[`${v.yard}-${v.meter}`] = 0.9144;
1542
- C[`${v.meter}-${v.yard}`] = 1.09361;
1543
- C[`${v.mile}-${v.meter}`] = 1609.34;
1544
- C[`${v.meter}-${v.mile}`] = 621371e-9;
1545
- class T {
1546
- constructor(e, t) {
1547
- if (this._type = be.DISTANCE, this._rawValue = e, this._rawValueUnit = t, t !== v.meter) {
1548
- const r = T.convert(this._rawValue, t, v.meter);
1549
- this._rawValue = r.value, this._rawValueUnit = r.valueUnit;
1550
- }
1551
- }
1552
- get type() {
1553
- return this._type;
1554
- }
1555
- static buildConvertedUnitResult(e, t) {
1556
- return {
1557
- value: e,
1558
- valueUnit: t,
1559
- valueWithUnit: `${e.toFixed(2)}${t}`
1560
- };
1561
- }
1562
- static convert(e, t, r) {
1563
- let s = e, l = r;
1564
- if (t === r)
1565
- return T.buildConvertedUnitResult(s, l);
1566
- const p = C[`${t}-${r}`];
1567
- return s = e * p, T.buildConvertedUnitResult(s, l);
1568
- }
1569
- /** ----------------- METRIC UNITS ----------------- */
1570
- get inMillimeters() {
1571
- return T.convert(this._rawValue, this._rawValueUnit, v.millimeter);
1572
- }
1573
- get inCentimeters() {
1574
- return T.convert(this._rawValue, this._rawValueUnit, v.centimeter);
1575
- }
1576
- get inDecimeters() {
1577
- return T.convert(this._rawValue, this._rawValueUnit, v.decimeter);
1578
- }
1579
- get inMeters() {
1580
- return T.convert(this._rawValue, this._rawValueUnit, v.meter);
1581
- }
1582
- get inDecameters() {
1583
- return T.convert(this._rawValue, this._rawValueUnit, v.decameter);
1584
- }
1585
- get inHectometers() {
1586
- return T.convert(this._rawValue, this._rawValueUnit, v.hectometer);
1587
- }
1588
- get inKilometers() {
1589
- return T.convert(this._rawValue, this._rawValueUnit, v.kilometer);
1590
- }
1591
- /** ----------------- METRIC UNITS ----------------- */
1592
- get inInches() {
1593
- return T.convert(this._rawValue, this._rawValueUnit, v.inch);
1594
- }
1595
- get inFeet() {
1596
- return T.convert(this._rawValue, this._rawValueUnit, v.foot);
1597
- }
1598
- get inYard() {
1599
- return T.convert(this._rawValue, this._rawValueUnit, v.yard);
1600
- }
1601
- get inMiles() {
1602
- return T.convert(this._rawValue, this._rawValueUnit, v.mile);
1603
- }
1604
- }
1605
- class M {
1606
- /**
1607
- * A more sophisticated way of truly blocking execution instead of using setTimeout directly,
1608
- * which requires you to put all the later execution within a single function making the code look messy.
1609
- *
1610
- * @param {number} time Time in milliseconds
1611
- * @returns {Promise<void>}
1612
- */
1613
- static async wait(e) {
1614
- return new Promise((t) => {
1615
- setTimeout(() => {
1616
- t();
1617
- }, e);
1618
- });
1619
- }
1620
- /**
1621
- * Generates and returns a "style" type DOM element that could be added to the page hierarchy.
1622
- *
1623
- * @param {string} id DOM element id that would be used to later identify this element.
1624
- * @param {string} contents Contents of the style element.
1625
- * @returns {HTMLStyleElement}
1626
- */
1627
- static generateStylesDomElem(e, t = "") {
1628
- const r = document.createElement("style");
1629
- return r.setAttribute("id", e), r.innerHTML = t, r;
1630
- }
1631
- /**
1632
- * Generates and returns a "div" type DOM element that could be added to the page hierarchy.
1633
- *
1634
- * @param {string} id DOM element id that would be used to later identify this element.
1635
- * @param {string} contents Contents of the div element.
1636
- * @returns {HTMLDivElement}
1637
- */
1638
- static generateHtmlDivElem(e, t = "") {
1639
- const r = document.createElement("div");
1640
- return r.setAttribute("id", e), r.innerHTML = t, r;
1641
- }
1642
- static getUrlParameterByName(e, t = window.location.search) {
1643
- const r = new URLSearchParams(t);
1644
- return Object.fromEntries(r.entries())[e];
1645
- }
1646
- static getBaseUrl() {
1647
- const e = M.getUrlParameterByName("parentUrl");
1648
- return e || window.location.href;
1649
- }
1650
- static normalizeRadian(e) {
1651
- return Math.atan2(Math.sin(e), Math.cos(e));
1652
- }
1653
- static isBetweenOnCircle(e, t, r) {
1654
- return e = M.normalizeRadian(e), t = M.normalizeRadian(t), r = M.normalizeRadian(r), t <= r ? e >= t && e <= r : e >= t || e <= r;
1655
- }
1656
- static getPointInBetweenByPercentage(e, t, r) {
1657
- let s = t.clone().sub(e);
1658
- const l = s.length();
1659
- return s = s.normalize().multiplyScalar(l * r), e.clone().add(s);
1660
- }
1661
- static clampAzimuth(e, t, r) {
1662
- if (Math.abs(t) == 1 / 0 || r == 1 / 0)
1663
- return e;
1664
- const s = M.normalizeRadian(e), l = M.normalizeRadian(t), p = M.normalizeRadian(r);
1665
- if (M.isBetweenOnCircle(s, l, p))
1666
- return s;
1667
- const _ = Math.abs(M.normalizeRadian(s - l)), a = Math.abs(M.normalizeRadian(s - p));
1668
- return _ < a ? l : p;
1669
- }
1670
- static resolveNexusEndpoint(e) {
1671
- let t = ee.PRODUCTION;
1672
- return e == "local" ? t = ee.LOCAL : e === "staging" && (t = ee.STAGING), t;
1673
- }
1674
- static parseUrlForEpigraphParams(e) {
1675
- const t = /* @__PURE__ */ new Map(), r = new fe(e);
1676
- t.set(I.epigraphSessionId, r.getParameterInUrl(I.epigraphSessionId)), t.set(I.identifier, r.getParameterInUrl(I.identifier)), t.set(I.identifierType, r.getParameterInUrl(I.identifierType)), t.set(I.type, r.getParameterInUrl(I.type));
1677
- const s = r.getParameterInUrl(I.action);
1678
- return s && t.set(k.AR, JSON.parse(s)[k.AR]), t;
1679
- }
1680
- static generateShareableUrl({ baseUrl: e, identifier: t, identifierType: r, arCompatible: s = !1 }) {
1681
- const l = /* @__PURE__ */ new Map();
1682
- return l.set(I.epigraphSessionId, window.epigraph.epigraphSessionId), l.set(I.identifier, t), l.set(I.identifierType, r), s && l.set(I.action, `{"${k.AR}":true}`), new fe(e).generateQrCodeUrl(Object.fromEntries(l.entries()), !1);
1683
- }
1684
- static _dispose3(e) {
1685
- e instanceof Y && e.geometry.dispose(), e instanceof Y && (Array.isArray(e.material) ? e.material.forEach((t) => t.dispose()) : e.material.dispose(), e.material?.map?.dispose());
1686
- }
1687
- static dispose3(e) {
1688
- e.traverse((t) => {
1689
- t instanceof Y && M._dispose3(t);
1690
- }), (e instanceof Y || e instanceof Be) && M._dispose3(e);
1691
- }
1692
- }
1693
- export {
1694
- M as A,
1695
- W as O,
1696
- pt as P,
1697
- I as c,
1698
- v as e,
1699
- k as i,
1700
- fe as l,
1701
- T as m
1702
- };