ds-one 0.3.0-alpha.1 → 0.3.0-alpha.2
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/DS1/0-face/device.ts +180 -34
- package/DS1/1-root/one.css +1 -1
- package/DS1/index.ts +0 -1
- package/README.md +2 -2
- package/dist/0-face/device.d.ts +47 -1
- package/dist/0-face/device.d.ts.map +1 -1
- package/dist/0-face/device.js +132 -25
- package/dist/ds-one.bundle.js +1421 -1436
- package/dist/ds-one.bundle.js.map +1 -1
- package/dist/ds-one.bundle.min.js +1206 -1217
- package/dist/ds-one.bundle.min.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/package.json +1 -1
- package/DS1/0-face/scaling.ts +0 -152
- package/dist/0-face/scaling.d.ts +0 -48
- package/dist/0-face/scaling.d.ts.map +0 -1
- package/dist/0-face/scaling.js +0 -114
- package/dist/2-core/styles/ds-banner.css +0 -77
- package/dist/2-core/styles/ds-button.css +0 -67
- package/dist/2-core/styles/ds-cycle.css +0 -21
- package/dist/2-core/styles/ds-date.css +0 -9
- package/dist/2-core/styles/ds-gap.css +0 -93
- package/dist/2-core/styles/ds-icon.css +0 -30
- package/dist/2-core/styles/ds-input.css +0 -46
- package/dist/2-core/styles/ds-pagedots.css +0 -26
- package/dist/2-core/styles/ds-text.css +0 -29
- package/dist/2-core/styles/ds-tooltip.css +0 -49
- package/dist/3-unit/styles/ds-accordion.css +0 -46
- package/dist/3-unit/styles/ds-list.css +0 -9
- package/dist/3-unit/styles/ds-row.css +0 -19
- package/dist/3-unit/styles/ds-table.css +0 -80
- package/dist/4-page/styles/ds-container.css +0 -35
- package/dist/4-page/styles/ds-grid.css +0 -56
- package/dist/4-page/styles/ds-layout.css +0 -251
- package/dist/ds-one.bundle.css +0 -700
- package/dist/ds-one.bundle.css.map +0 -7
- package/dist/ds-one.bundle.min.css +0 -2
- package/dist/ds-one.bundle.min.css.map +0 -7
package/dist/ds-one.bundle.js
CHANGED
|
@@ -1,1610 +1,1596 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
7
|
+
var __accessCheck = (obj, member, msg) => {
|
|
8
|
+
if (!member.has(obj))
|
|
9
|
+
throw TypeError("Cannot " + msg);
|
|
10
|
+
};
|
|
11
|
+
var __privateIn = (member, obj) => {
|
|
12
|
+
if (Object(obj) !== obj)
|
|
13
|
+
throw TypeError('Cannot use the "in" operator on this value');
|
|
14
|
+
return member.has(obj);
|
|
15
|
+
};
|
|
16
|
+
var __privateAdd = (obj, member, value) => {
|
|
17
|
+
if (member.has(obj))
|
|
18
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
19
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
20
|
+
};
|
|
21
|
+
var __privateMethod = (obj, member, method) => {
|
|
22
|
+
__accessCheck(obj, member, "access private method");
|
|
23
|
+
return method;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* @license
|
|
27
|
+
* Copyright Google LLC All Rights Reserved.
|
|
28
|
+
*
|
|
29
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
30
|
+
* found in the LICENSE file at https://angular.io/license
|
|
31
|
+
*/
|
|
32
|
+
function defaultEquals(a2, b2) {
|
|
33
|
+
return Object.is(a2, b2);
|
|
15
34
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
userAgent: nav && (nav.userAgent || nav.vendor) || "",
|
|
32
|
-
screenWidth,
|
|
33
|
-
screenHeight
|
|
34
|
-
};
|
|
35
|
+
/**
|
|
36
|
+
* @license
|
|
37
|
+
* Copyright Google LLC All Rights Reserved.
|
|
38
|
+
*
|
|
39
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
40
|
+
* found in the LICENSE file at https://angular.io/license
|
|
41
|
+
*/
|
|
42
|
+
let activeConsumer = null;
|
|
43
|
+
let inNotificationPhase = false;
|
|
44
|
+
let epoch = 1;
|
|
45
|
+
const SIGNAL = /* @__PURE__ */ Symbol("SIGNAL");
|
|
46
|
+
function setActiveConsumer(consumer) {
|
|
47
|
+
const prev = activeConsumer;
|
|
48
|
+
activeConsumer = consumer;
|
|
49
|
+
return prev;
|
|
35
50
|
}
|
|
36
|
-
function
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
function getActiveConsumer() {
|
|
52
|
+
return activeConsumer;
|
|
53
|
+
}
|
|
54
|
+
function isInNotificationPhase() {
|
|
55
|
+
return inNotificationPhase;
|
|
56
|
+
}
|
|
57
|
+
const REACTIVE_NODE = {
|
|
58
|
+
version: 0,
|
|
59
|
+
lastCleanEpoch: 0,
|
|
60
|
+
dirty: false,
|
|
61
|
+
producerNode: void 0,
|
|
62
|
+
producerLastReadVersion: void 0,
|
|
63
|
+
producerIndexOfThis: void 0,
|
|
64
|
+
nextProducerIndex: 0,
|
|
65
|
+
liveConsumerNode: void 0,
|
|
66
|
+
liveConsumerIndexOfThis: void 0,
|
|
67
|
+
consumerAllowSignalWrites: false,
|
|
68
|
+
consumerIsAlwaysLive: false,
|
|
69
|
+
producerMustRecompute: () => false,
|
|
70
|
+
producerRecomputeValue: () => {
|
|
71
|
+
},
|
|
72
|
+
consumerMarkedDirty: () => {
|
|
73
|
+
},
|
|
74
|
+
consumerOnSignalRead: () => {
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
function producerAccessed(node) {
|
|
78
|
+
if (inNotificationPhase) {
|
|
79
|
+
throw new Error(
|
|
80
|
+
typeof ngDevMode !== "undefined" && ngDevMode ? `Assertion error: signal read during notification phase` : ""
|
|
54
81
|
);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
82
|
+
}
|
|
83
|
+
if (activeConsumer === null) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
activeConsumer.consumerOnSignalRead(node);
|
|
87
|
+
const idx = activeConsumer.nextProducerIndex++;
|
|
88
|
+
assertConsumerNode(activeConsumer);
|
|
89
|
+
if (idx < activeConsumer.producerNode.length && activeConsumer.producerNode[idx] !== node) {
|
|
90
|
+
if (consumerIsLive(activeConsumer)) {
|
|
91
|
+
const staleProducer = activeConsumer.producerNode[idx];
|
|
92
|
+
producerRemoveLiveConsumerAtIndex(staleProducer, activeConsumer.producerIndexOfThis[idx]);
|
|
61
93
|
}
|
|
62
|
-
console.log(
|
|
63
|
-
`[DS one] Desktop device detected (${deviceInfo.screenWidth}x${deviceInfo.screenHeight})`
|
|
64
|
-
);
|
|
65
94
|
}
|
|
66
|
-
if (
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
isMobile: deviceInfo.isMobile,
|
|
70
|
-
isTablet: deviceInfo.isTablet,
|
|
71
|
-
isDesktop: deviceInfo.isDesktop,
|
|
72
|
-
isTouchCapable: deviceInfo.isTouchCapable,
|
|
73
|
-
viewport: `${deviceInfo.screenWidth}x${deviceInfo.screenHeight}`,
|
|
74
|
-
userAgent: deviceInfo.userAgent
|
|
75
|
-
});
|
|
95
|
+
if (activeConsumer.producerNode[idx] !== node) {
|
|
96
|
+
activeConsumer.producerNode[idx] = node;
|
|
97
|
+
activeConsumer.producerIndexOfThis[idx] = consumerIsLive(activeConsumer) ? producerAddLiveConsumer(node, activeConsumer, idx) : 0;
|
|
76
98
|
}
|
|
77
|
-
|
|
99
|
+
activeConsumer.producerLastReadVersion[idx] = node.version;
|
|
78
100
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
initDeviceDetection();
|
|
101
|
+
function producerIncrementEpoch() {
|
|
102
|
+
epoch++;
|
|
103
|
+
}
|
|
104
|
+
function producerUpdateValueVersion(node) {
|
|
105
|
+
if (!node.dirty && node.lastCleanEpoch === epoch) {
|
|
106
|
+
return;
|
|
86
107
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
108
|
+
if (!node.producerMustRecompute(node) && !consumerPollProducersForChange(node)) {
|
|
109
|
+
node.dirty = false;
|
|
110
|
+
node.lastCleanEpoch = epoch;
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
node.producerRecomputeValue(node);
|
|
114
|
+
node.dirty = false;
|
|
115
|
+
node.lastCleanEpoch = epoch;
|
|
94
116
|
}
|
|
95
|
-
function
|
|
96
|
-
if (
|
|
117
|
+
function producerNotifyConsumers(node) {
|
|
118
|
+
if (node.liveConsumerNode === void 0) {
|
|
97
119
|
return;
|
|
98
120
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
121
|
+
const prev = inNotificationPhase;
|
|
122
|
+
inNotificationPhase = true;
|
|
123
|
+
try {
|
|
124
|
+
for (const consumer of node.liveConsumerNode) {
|
|
125
|
+
if (!consumer.dirty) {
|
|
126
|
+
consumerMarkDirty(consumer);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
} finally {
|
|
130
|
+
inNotificationPhase = prev;
|
|
104
131
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
132
|
+
}
|
|
133
|
+
function producerUpdatesAllowed() {
|
|
134
|
+
return (activeConsumer == null ? void 0 : activeConsumer.consumerAllowSignalWrites) !== false;
|
|
135
|
+
}
|
|
136
|
+
function consumerMarkDirty(node) {
|
|
137
|
+
var _a;
|
|
138
|
+
node.dirty = true;
|
|
139
|
+
producerNotifyConsumers(node);
|
|
140
|
+
(_a = node.consumerMarkedDirty) == null ? void 0 : _a.call(node.wrapper ?? node);
|
|
141
|
+
}
|
|
142
|
+
function consumerBeforeComputation(node) {
|
|
143
|
+
node && (node.nextProducerIndex = 0);
|
|
144
|
+
return setActiveConsumer(node);
|
|
145
|
+
}
|
|
146
|
+
function consumerAfterComputation(node, prevConsumer) {
|
|
147
|
+
setActiveConsumer(prevConsumer);
|
|
148
|
+
if (!node || node.producerNode === void 0 || node.producerIndexOfThis === void 0 || node.producerLastReadVersion === void 0) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
if (consumerIsLive(node)) {
|
|
152
|
+
for (let i3 = node.nextProducerIndex; i3 < node.producerNode.length; i3++) {
|
|
153
|
+
producerRemoveLiveConsumerAtIndex(node.producerNode[i3], node.producerIndexOfThis[i3]);
|
|
115
154
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
155
|
+
}
|
|
156
|
+
while (node.producerNode.length > node.nextProducerIndex) {
|
|
157
|
+
node.producerNode.pop();
|
|
158
|
+
node.producerLastReadVersion.pop();
|
|
159
|
+
node.producerIndexOfThis.pop();
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
function consumerPollProducersForChange(node) {
|
|
163
|
+
assertConsumerNode(node);
|
|
164
|
+
for (let i3 = 0; i3 < node.producerNode.length; i3++) {
|
|
165
|
+
const producer = node.producerNode[i3];
|
|
166
|
+
const seenVersion = node.producerLastReadVersion[i3];
|
|
167
|
+
if (seenVersion !== producer.version) {
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
170
|
+
producerUpdateValueVersion(producer);
|
|
171
|
+
if (seenVersion !== producer.version) {
|
|
172
|
+
return true;
|
|
119
173
|
}
|
|
120
|
-
`;
|
|
121
|
-
const existingStyle = document.getElementById("ds-one-applike-style");
|
|
122
|
-
if (existingStyle) {
|
|
123
|
-
existingStyle.remove();
|
|
124
174
|
}
|
|
125
|
-
|
|
126
|
-
let lastTouchEnd = 0;
|
|
127
|
-
let touchStartTime = 0;
|
|
128
|
-
const preventZoom = (event) => {
|
|
129
|
-
if (event instanceof TouchEvent) {
|
|
130
|
-
if (event.touches.length > 1) {
|
|
131
|
-
event.preventDefault();
|
|
132
|
-
event.stopPropagation();
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
const now = Date.now();
|
|
136
|
-
if (event.type === "touchstart") {
|
|
137
|
-
if (now - lastTouchEnd < 300) {
|
|
138
|
-
event.preventDefault();
|
|
139
|
-
event.stopPropagation();
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
touchStartTime = now;
|
|
143
|
-
} else if (event.type === "touchend") {
|
|
144
|
-
const touchDuration = now - touchStartTime;
|
|
145
|
-
if (touchDuration < 300 && now - lastTouchEnd < 300) {
|
|
146
|
-
event.preventDefault();
|
|
147
|
-
event.stopPropagation();
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
lastTouchEnd = now;
|
|
151
|
-
} else if (event.type === "touchmove") {
|
|
152
|
-
if (event.touches.length > 1) {
|
|
153
|
-
event.preventDefault();
|
|
154
|
-
event.stopPropagation();
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
if (event instanceof WheelEvent && (event.ctrlKey || event.metaKey)) {
|
|
160
|
-
event.preventDefault();
|
|
161
|
-
event.stopPropagation();
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
const options = { passive: false, capture: true };
|
|
166
|
-
document.addEventListener("touchstart", preventZoom, options);
|
|
167
|
-
document.addEventListener("touchmove", preventZoom, options);
|
|
168
|
-
document.addEventListener("touchend", preventZoom, options);
|
|
169
|
-
document.addEventListener("touchcancel", preventZoom, options);
|
|
170
|
-
document.addEventListener("wheel", preventZoom, options);
|
|
171
|
-
document.addEventListener(
|
|
172
|
-
"gesturestart",
|
|
173
|
-
(e2) => {
|
|
174
|
-
e2.preventDefault();
|
|
175
|
-
e2.stopPropagation();
|
|
176
|
-
},
|
|
177
|
-
options
|
|
178
|
-
);
|
|
179
|
-
document.addEventListener(
|
|
180
|
-
"gesturechange",
|
|
181
|
-
(e2) => {
|
|
182
|
-
e2.preventDefault();
|
|
183
|
-
e2.stopPropagation();
|
|
184
|
-
},
|
|
185
|
-
options
|
|
186
|
-
);
|
|
187
|
-
document.addEventListener(
|
|
188
|
-
"gestureend",
|
|
189
|
-
(e2) => {
|
|
190
|
-
e2.preventDefault();
|
|
191
|
-
e2.stopPropagation();
|
|
192
|
-
},
|
|
193
|
-
options
|
|
194
|
-
);
|
|
175
|
+
return false;
|
|
195
176
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
"pt",
|
|
206
|
-
"sv",
|
|
207
|
-
"zh"
|
|
208
|
-
];
|
|
209
|
-
const LANGUAGE_PRIORITY_LOOKUP = new Map(
|
|
210
|
-
LANGUAGE_PRIORITY_ORDER.map((code, index) => [code, index])
|
|
211
|
-
);
|
|
212
|
-
const FALLBACK_LANGUAGE_NAMES = {
|
|
213
|
-
da: "Danish",
|
|
214
|
-
"da-dk": "Danish",
|
|
215
|
-
de: "German",
|
|
216
|
-
"de-de": "German",
|
|
217
|
-
en: "English",
|
|
218
|
-
"en-us": "English",
|
|
219
|
-
es: "Spanish",
|
|
220
|
-
"es-es": "Spanish",
|
|
221
|
-
fr: "French",
|
|
222
|
-
"fr-fr": "French",
|
|
223
|
-
it: "Italian",
|
|
224
|
-
"it-it": "Italian",
|
|
225
|
-
ja: "Japanese",
|
|
226
|
-
"ja-jp": "Japanese",
|
|
227
|
-
pt: "Portuguese",
|
|
228
|
-
"pt-pt": "Portuguese",
|
|
229
|
-
sv: "Swedish",
|
|
230
|
-
"sv-se": "Swedish",
|
|
231
|
-
zh: "Chinese",
|
|
232
|
-
"zh-cn": "Chinese",
|
|
233
|
-
"zh-tw": "Chinese",
|
|
234
|
-
"zh-hans": "Chinese",
|
|
235
|
-
"zh-hant": "Chinese"
|
|
236
|
-
};
|
|
237
|
-
const DISPLAY_NAME_CACHE = /* @__PURE__ */ new Map();
|
|
238
|
-
let displayNameFallbackWarningShown = false;
|
|
239
|
-
const DEFAULT_TRANSLATION_FILE = "./translations.json";
|
|
240
|
-
let loadAttempted = false;
|
|
241
|
-
function normalizeCandidate(path) {
|
|
242
|
-
if (!path) {
|
|
243
|
-
return null;
|
|
244
|
-
}
|
|
245
|
-
const trimmed = path.trim();
|
|
246
|
-
if (!trimmed) {
|
|
247
|
-
return null;
|
|
248
|
-
}
|
|
249
|
-
if (trimmed.startsWith("./") || trimmed.startsWith("../") || trimmed.startsWith("/") || /^https?:\/\//i.test(trimmed)) {
|
|
250
|
-
return trimmed;
|
|
177
|
+
function producerAddLiveConsumer(node, consumer, indexOfThis) {
|
|
178
|
+
var _a;
|
|
179
|
+
assertProducerNode(node);
|
|
180
|
+
assertConsumerNode(node);
|
|
181
|
+
if (node.liveConsumerNode.length === 0) {
|
|
182
|
+
(_a = node.watched) == null ? void 0 : _a.call(node.wrapper);
|
|
183
|
+
for (let i3 = 0; i3 < node.producerNode.length; i3++) {
|
|
184
|
+
node.producerIndexOfThis[i3] = producerAddLiveConsumer(node.producerNode[i3], node, i3);
|
|
185
|
+
}
|
|
251
186
|
}
|
|
252
|
-
|
|
187
|
+
node.liveConsumerIndexOfThis.push(indexOfThis);
|
|
188
|
+
return node.liveConsumerNode.push(consumer) - 1;
|
|
253
189
|
}
|
|
254
|
-
function
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
"data-ds-one-translations"
|
|
263
|
-
);
|
|
264
|
-
if (scriptCandidate) {
|
|
265
|
-
return scriptCandidate;
|
|
190
|
+
function producerRemoveLiveConsumerAtIndex(node, idx) {
|
|
191
|
+
var _a;
|
|
192
|
+
assertProducerNode(node);
|
|
193
|
+
assertConsumerNode(node);
|
|
194
|
+
if (typeof ngDevMode !== "undefined" && ngDevMode && idx >= node.liveConsumerNode.length) {
|
|
195
|
+
throw new Error(
|
|
196
|
+
`Assertion error: active consumer index ${idx} is out of bounds of ${node.liveConsumerNode.length} consumers)`
|
|
197
|
+
);
|
|
266
198
|
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
199
|
+
if (node.liveConsumerNode.length === 1) {
|
|
200
|
+
(_a = node.unwatched) == null ? void 0 : _a.call(node.wrapper);
|
|
201
|
+
for (let i3 = 0; i3 < node.producerNode.length; i3++) {
|
|
202
|
+
producerRemoveLiveConsumerAtIndex(node.producerNode[i3], node.producerIndexOfThis[i3]);
|
|
203
|
+
}
|
|
270
204
|
}
|
|
271
|
-
const
|
|
272
|
-
|
|
273
|
-
|
|
205
|
+
const lastIdx = node.liveConsumerNode.length - 1;
|
|
206
|
+
node.liveConsumerNode[idx] = node.liveConsumerNode[lastIdx];
|
|
207
|
+
node.liveConsumerIndexOfThis[idx] = node.liveConsumerIndexOfThis[lastIdx];
|
|
208
|
+
node.liveConsumerNode.length--;
|
|
209
|
+
node.liveConsumerIndexOfThis.length--;
|
|
210
|
+
if (idx < node.liveConsumerNode.length) {
|
|
211
|
+
const idxProducer = node.liveConsumerIndexOfThis[idx];
|
|
212
|
+
const consumer = node.liveConsumerNode[idx];
|
|
213
|
+
assertConsumerNode(consumer);
|
|
214
|
+
consumer.producerIndexOfThis[idxProducer] = idx;
|
|
274
215
|
}
|
|
275
|
-
return null;
|
|
276
216
|
}
|
|
277
|
-
function
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
const attributeCandidate = findAttributeCandidate();
|
|
281
|
-
const windowNormalized = normalizeCandidate(windowCandidate ?? "");
|
|
282
|
-
if (windowNormalized) {
|
|
283
|
-
candidates.push(windowNormalized);
|
|
284
|
-
}
|
|
285
|
-
const attrNormalized = normalizeCandidate(attributeCandidate ?? "");
|
|
286
|
-
if (attrNormalized && !candidates.includes(attrNormalized)) {
|
|
287
|
-
candidates.push(attrNormalized);
|
|
288
|
-
}
|
|
289
|
-
if (candidates.length === 0) {
|
|
290
|
-
candidates.push(DEFAULT_TRANSLATION_FILE);
|
|
291
|
-
}
|
|
292
|
-
return candidates;
|
|
217
|
+
function consumerIsLive(node) {
|
|
218
|
+
var _a;
|
|
219
|
+
return node.consumerIsAlwaysLive || (((_a = node == null ? void 0 : node.liveConsumerNode) == null ? void 0 : _a.length) ?? 0) > 0;
|
|
293
220
|
}
|
|
294
|
-
function
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
return Object.values(candidate).every(
|
|
299
|
-
(entry) => entry && typeof entry === "object"
|
|
300
|
-
);
|
|
221
|
+
function assertConsumerNode(node) {
|
|
222
|
+
node.producerNode ?? (node.producerNode = []);
|
|
223
|
+
node.producerIndexOfThis ?? (node.producerIndexOfThis = []);
|
|
224
|
+
node.producerLastReadVersion ?? (node.producerLastReadVersion = []);
|
|
301
225
|
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
if (!response.ok) {
|
|
306
|
-
return null;
|
|
307
|
-
}
|
|
308
|
-
const translations = await response.json();
|
|
309
|
-
if (!validateTranslationMap(translations)) {
|
|
310
|
-
console.warn(
|
|
311
|
-
`[DS one] Invalid translation format in ${source}. Expected object with language codes as keys.`
|
|
312
|
-
);
|
|
313
|
-
return null;
|
|
314
|
-
}
|
|
315
|
-
const languages = Object.keys(translations);
|
|
316
|
-
if (languages.length === 0) {
|
|
317
|
-
console.warn(`[DS one] No languages found in ${source}`);
|
|
318
|
-
return null;
|
|
319
|
-
}
|
|
320
|
-
return translations;
|
|
321
|
-
} catch {
|
|
322
|
-
return null;
|
|
323
|
-
}
|
|
226
|
+
function assertProducerNode(node) {
|
|
227
|
+
node.liveConsumerNode ?? (node.liveConsumerNode = []);
|
|
228
|
+
node.liveConsumerIndexOfThis ?? (node.liveConsumerIndexOfThis = []);
|
|
324
229
|
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
return true;
|
|
230
|
+
/**
|
|
231
|
+
* @license
|
|
232
|
+
* Copyright Google LLC All Rights Reserved.
|
|
233
|
+
*
|
|
234
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
235
|
+
* found in the LICENSE file at https://angular.io/license
|
|
236
|
+
*/
|
|
237
|
+
function computedGet(node) {
|
|
238
|
+
producerUpdateValueVersion(node);
|
|
239
|
+
producerAccessed(node);
|
|
240
|
+
if (node.value === ERRORED) {
|
|
241
|
+
throw node.error;
|
|
338
242
|
}
|
|
339
|
-
|
|
340
|
-
for (const source of sources) {
|
|
341
|
-
const translations = await fetchTranslationFile(source);
|
|
342
|
-
if (!translations) {
|
|
343
|
-
continue;
|
|
344
|
-
}
|
|
345
|
-
window.DS_ONE_TRANSLATIONS = translations;
|
|
346
|
-
const languages = Object.keys(translations);
|
|
347
|
-
console.log(
|
|
348
|
-
`[DS one] External translations loaded from ${source}: ${languages.length} language(s) – ${languages.join(", ")}`
|
|
349
|
-
);
|
|
350
|
-
window.dispatchEvent(new CustomEvent("translations-ready"));
|
|
351
|
-
return true;
|
|
352
|
-
}
|
|
353
|
-
console.info(
|
|
354
|
-
`[DS one] No external translations found at ${sources[0] ?? DEFAULT_TRANSLATION_FILE}. Using bundled translations.`
|
|
355
|
-
);
|
|
356
|
-
return false;
|
|
243
|
+
return node.value;
|
|
357
244
|
}
|
|
358
|
-
function
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
245
|
+
function createComputed(computation) {
|
|
246
|
+
const node = Object.create(COMPUTED_NODE);
|
|
247
|
+
node.computation = computation;
|
|
248
|
+
const computed = () => computedGet(node);
|
|
249
|
+
computed[SIGNAL] = node;
|
|
250
|
+
return computed;
|
|
363
251
|
}
|
|
364
|
-
|
|
365
|
-
const
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
252
|
+
const UNSET = /* @__PURE__ */ Symbol("UNSET");
|
|
253
|
+
const COMPUTING = /* @__PURE__ */ Symbol("COMPUTING");
|
|
254
|
+
const ERRORED = /* @__PURE__ */ Symbol("ERRORED");
|
|
255
|
+
const COMPUTED_NODE = /* @__PURE__ */ (() => {
|
|
256
|
+
return {
|
|
257
|
+
...REACTIVE_NODE,
|
|
258
|
+
value: UNSET,
|
|
259
|
+
dirty: true,
|
|
260
|
+
error: null,
|
|
261
|
+
equal: defaultEquals,
|
|
262
|
+
producerMustRecompute(node) {
|
|
263
|
+
return node.value === UNSET || node.value === COMPUTING;
|
|
264
|
+
},
|
|
265
|
+
producerRecomputeValue(node) {
|
|
266
|
+
if (node.value === COMPUTING) {
|
|
267
|
+
throw new Error("Detected cycle in computations.");
|
|
268
|
+
}
|
|
269
|
+
const oldValue = node.value;
|
|
270
|
+
node.value = COMPUTING;
|
|
271
|
+
const prevConsumer = consumerBeforeComputation(node);
|
|
272
|
+
let newValue;
|
|
273
|
+
let wasEqual = false;
|
|
274
|
+
try {
|
|
275
|
+
newValue = node.computation.call(node.wrapper);
|
|
276
|
+
const oldOk = oldValue !== UNSET && oldValue !== ERRORED;
|
|
277
|
+
wasEqual = oldOk && node.equal.call(node.wrapper, oldValue, newValue);
|
|
278
|
+
} catch (err) {
|
|
279
|
+
newValue = ERRORED;
|
|
280
|
+
node.error = err;
|
|
281
|
+
} finally {
|
|
282
|
+
consumerAfterComputation(node, prevConsumer);
|
|
283
|
+
}
|
|
284
|
+
if (wasEqual) {
|
|
285
|
+
node.value = oldValue;
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
node.value = newValue;
|
|
289
|
+
node.version++;
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
})();
|
|
293
|
+
/**
|
|
294
|
+
* @license
|
|
295
|
+
* Copyright Google LLC All Rights Reserved.
|
|
296
|
+
*
|
|
297
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
298
|
+
* found in the LICENSE file at https://angular.io/license
|
|
299
|
+
*/
|
|
300
|
+
function defaultThrowError() {
|
|
301
|
+
throw new Error();
|
|
371
302
|
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
if (typeof priority === "number") {
|
|
376
|
-
return priority;
|
|
377
|
-
}
|
|
378
|
-
return LANGUAGE_PRIORITY_ORDER.length;
|
|
303
|
+
let throwInvalidWriteToSignalErrorFn = defaultThrowError;
|
|
304
|
+
function throwInvalidWriteToSignalError() {
|
|
305
|
+
throwInvalidWriteToSignalErrorFn();
|
|
379
306
|
}
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
307
|
+
/**
|
|
308
|
+
* @license
|
|
309
|
+
* Copyright Google LLC All Rights Reserved.
|
|
310
|
+
*
|
|
311
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
312
|
+
* found in the LICENSE file at https://angular.io/license
|
|
313
|
+
*/
|
|
314
|
+
function createSignal(initialValue) {
|
|
315
|
+
const node = Object.create(SIGNAL_NODE);
|
|
316
|
+
node.value = initialValue;
|
|
317
|
+
const getter = () => {
|
|
318
|
+
producerAccessed(node);
|
|
319
|
+
return node.value;
|
|
320
|
+
};
|
|
321
|
+
getter[SIGNAL] = node;
|
|
322
|
+
return getter;
|
|
389
323
|
}
|
|
390
|
-
function
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
324
|
+
function signalGetFn() {
|
|
325
|
+
producerAccessed(this);
|
|
326
|
+
return this.value;
|
|
327
|
+
}
|
|
328
|
+
function signalSetFn(node, newValue) {
|
|
329
|
+
if (!producerUpdatesAllowed()) {
|
|
330
|
+
throwInvalidWriteToSignalError();
|
|
394
331
|
}
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
displayNames = new Intl.DisplayNames([normalizedLocale], {
|
|
399
|
-
type: "language"
|
|
400
|
-
});
|
|
401
|
-
DISPLAY_NAME_CACHE.set(normalizedLocale, displayNames);
|
|
402
|
-
}
|
|
403
|
-
const cleanedCode = code.replace("_", "-");
|
|
404
|
-
const fullMatch = displayNames.of(cleanedCode);
|
|
405
|
-
if (fullMatch && fullMatch !== cleanedCode) {
|
|
406
|
-
return fullMatch;
|
|
407
|
-
}
|
|
408
|
-
const baseMatch = displayNames.of(extractPrimarySubtag(cleanedCode));
|
|
409
|
-
if (baseMatch) {
|
|
410
|
-
return baseMatch;
|
|
411
|
-
}
|
|
412
|
-
} catch (error) {
|
|
413
|
-
if (!displayNameFallbackWarningShown) {
|
|
414
|
-
console.info(
|
|
415
|
-
"[DS one] Intl.DisplayNames is not available, using fallback language names."
|
|
416
|
-
);
|
|
417
|
-
displayNameFallbackWarningShown = true;
|
|
418
|
-
}
|
|
332
|
+
if (!node.equal.call(node.wrapper, node.value, newValue)) {
|
|
333
|
+
node.value = newValue;
|
|
334
|
+
signalValueChanged(node);
|
|
419
335
|
}
|
|
420
|
-
return void 0;
|
|
421
336
|
}
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
|
|
337
|
+
const SIGNAL_NODE = /* @__PURE__ */ (() => {
|
|
338
|
+
return {
|
|
339
|
+
...REACTIVE_NODE,
|
|
340
|
+
equal: defaultEquals,
|
|
341
|
+
value: void 0
|
|
342
|
+
};
|
|
343
|
+
})();
|
|
344
|
+
function signalValueChanged(node) {
|
|
345
|
+
node.version++;
|
|
346
|
+
producerIncrementEpoch();
|
|
347
|
+
producerNotifyConsumers(node);
|
|
430
348
|
}
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
349
|
+
/**
|
|
350
|
+
* @license
|
|
351
|
+
* Copyright 2024 Bloomberg Finance L.P.
|
|
352
|
+
*
|
|
353
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
354
|
+
* you may not use this file except in compliance with the License.
|
|
355
|
+
* You may obtain a copy of the License at
|
|
356
|
+
*
|
|
357
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
358
|
+
*
|
|
359
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
360
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
361
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
362
|
+
* See the License for the specific language governing permissions and
|
|
363
|
+
* limitations under the License.
|
|
364
|
+
*/
|
|
365
|
+
const NODE = Symbol("node");
|
|
366
|
+
var Signal;
|
|
367
|
+
((Signal2) => {
|
|
368
|
+
var _a, _brand, _b, _brand2;
|
|
369
|
+
class State {
|
|
370
|
+
constructor(initialValue, options = {}) {
|
|
371
|
+
__privateAdd(this, _brand);
|
|
372
|
+
__publicField(this, _a);
|
|
373
|
+
const ref = createSignal(initialValue);
|
|
374
|
+
const node = ref[SIGNAL];
|
|
375
|
+
this[NODE] = node;
|
|
376
|
+
node.wrapper = this;
|
|
377
|
+
if (options) {
|
|
378
|
+
const equals = options.equals;
|
|
379
|
+
if (equals) {
|
|
380
|
+
node.equal = equals;
|
|
381
|
+
}
|
|
382
|
+
node.watched = options[Signal2.subtle.watched];
|
|
383
|
+
node.unwatched = options[Signal2.subtle.unwatched];
|
|
384
|
+
}
|
|
445
385
|
}
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
for (const locale of localesToTry) {
|
|
451
|
-
if (!locale || tried.has(locale)) {
|
|
452
|
-
continue;
|
|
386
|
+
get() {
|
|
387
|
+
if (!(0, Signal2.isState)(this))
|
|
388
|
+
throw new TypeError("Wrong receiver type for Signal.State.prototype.get");
|
|
389
|
+
return signalGetFn.call(this[NODE]);
|
|
453
390
|
}
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
391
|
+
set(newValue) {
|
|
392
|
+
if (!(0, Signal2.isState)(this))
|
|
393
|
+
throw new TypeError("Wrong receiver type for Signal.State.prototype.set");
|
|
394
|
+
if (isInNotificationPhase()) {
|
|
395
|
+
throw new Error("Writes to signals not permitted during Watcher callback");
|
|
396
|
+
}
|
|
397
|
+
const ref = this[NODE];
|
|
398
|
+
signalSetFn(ref, newValue);
|
|
458
399
|
}
|
|
459
400
|
}
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
"sv-se": "sv",
|
|
489
|
-
zh: "zh",
|
|
490
|
-
"zh-cn": "zh",
|
|
491
|
-
"zh-hans": "zh",
|
|
492
|
-
"zh-tw": "zh",
|
|
493
|
-
"zh-hant": "zh"
|
|
494
|
-
};
|
|
495
|
-
function resolvePreferredLanguage(languageTag) {
|
|
496
|
-
if (!languageTag) {
|
|
497
|
-
return null;
|
|
498
|
-
}
|
|
499
|
-
const normalized = languageTag.toLowerCase().replace("_", "-");
|
|
500
|
-
const directMatch = BROWSER_LANGUAGE_PREFERENCES[normalized];
|
|
501
|
-
if (directMatch) {
|
|
502
|
-
return directMatch;
|
|
503
|
-
}
|
|
504
|
-
const primary = extractPrimarySubtag(normalized);
|
|
505
|
-
const primaryMatch = BROWSER_LANGUAGE_PREFERENCES[primary];
|
|
506
|
-
if (primaryMatch) {
|
|
507
|
-
return primaryMatch;
|
|
508
|
-
}
|
|
509
|
-
return languageTag;
|
|
510
|
-
}
|
|
511
|
-
function getBrowserLanguage() {
|
|
512
|
-
if (typeof navigator === "undefined") {
|
|
513
|
-
return defaultLanguage;
|
|
514
|
-
}
|
|
515
|
-
const browserLang = navigator.language;
|
|
516
|
-
if (browserLang) {
|
|
517
|
-
const resolved = resolvePreferredLanguage(browserLang);
|
|
518
|
-
if (resolved) {
|
|
519
|
-
return resolved;
|
|
401
|
+
_a = NODE;
|
|
402
|
+
_brand = /* @__PURE__ */ new WeakSet();
|
|
403
|
+
Signal2.isState = (s2) => typeof s2 === "object" && __privateIn(_brand, s2);
|
|
404
|
+
Signal2.State = State;
|
|
405
|
+
class Computed {
|
|
406
|
+
// Create a Signal which evaluates to the value returned by the callback.
|
|
407
|
+
// Callback is called with this signal as the parameter.
|
|
408
|
+
constructor(computation, options) {
|
|
409
|
+
__privateAdd(this, _brand2);
|
|
410
|
+
__publicField(this, _b);
|
|
411
|
+
const ref = createComputed(computation);
|
|
412
|
+
const node = ref[SIGNAL];
|
|
413
|
+
node.consumerAllowSignalWrites = true;
|
|
414
|
+
this[NODE] = node;
|
|
415
|
+
node.wrapper = this;
|
|
416
|
+
if (options) {
|
|
417
|
+
const equals = options.equals;
|
|
418
|
+
if (equals) {
|
|
419
|
+
node.equal = equals;
|
|
420
|
+
}
|
|
421
|
+
node.watched = options[Signal2.subtle.watched];
|
|
422
|
+
node.unwatched = options[Signal2.subtle.unwatched];
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
get() {
|
|
426
|
+
if (!(0, Signal2.isComputed)(this))
|
|
427
|
+
throw new TypeError("Wrong receiver type for Signal.Computed.prototype.get");
|
|
428
|
+
return computedGet(this[NODE]);
|
|
520
429
|
}
|
|
521
430
|
}
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
431
|
+
_b = NODE;
|
|
432
|
+
_brand2 = /* @__PURE__ */ new WeakSet();
|
|
433
|
+
Signal2.isComputed = (c2) => typeof c2 === "object" && __privateIn(_brand2, c2);
|
|
434
|
+
Signal2.Computed = Computed;
|
|
435
|
+
((subtle2) => {
|
|
436
|
+
var _a2, _brand3, _assertSignals, assertSignals_fn;
|
|
437
|
+
function untrack(cb) {
|
|
438
|
+
let output;
|
|
439
|
+
let prevActiveConsumer = null;
|
|
440
|
+
try {
|
|
441
|
+
prevActiveConsumer = setActiveConsumer(null);
|
|
442
|
+
output = cb();
|
|
443
|
+
} finally {
|
|
444
|
+
setActiveConsumer(prevActiveConsumer);
|
|
527
445
|
}
|
|
446
|
+
return output;
|
|
528
447
|
}
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
value: localStorage.getItem("language") || getBrowserLanguage(),
|
|
537
|
-
set: function(lang) {
|
|
538
|
-
this.value = lang;
|
|
539
|
-
localStorage.setItem("language", lang);
|
|
540
|
-
window.dispatchEvent(
|
|
541
|
-
new CustomEvent("language-changed", {
|
|
542
|
-
detail: { language: lang },
|
|
543
|
-
bubbles: true,
|
|
544
|
-
composed: true
|
|
545
|
-
})
|
|
546
|
-
);
|
|
547
|
-
}
|
|
548
|
-
};
|
|
549
|
-
if (typeof window !== "undefined") {
|
|
550
|
-
if (document.readyState === "loading") {
|
|
551
|
-
document.addEventListener("DOMContentLoaded", () => {
|
|
552
|
-
loadExternalTranslations();
|
|
553
|
-
});
|
|
554
|
-
} else {
|
|
555
|
-
loadExternalTranslations();
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
if (typeof window !== "undefined") {
|
|
559
|
-
window.addEventListener("translations-ready", () => {
|
|
560
|
-
translationData = getTranslationData();
|
|
561
|
-
window.dispatchEvent(new CustomEvent("translations-loaded"));
|
|
562
|
-
const currentLang = currentLanguage.value;
|
|
563
|
-
window.dispatchEvent(
|
|
564
|
-
new CustomEvent("language-changed", {
|
|
565
|
-
detail: { language: currentLang },
|
|
566
|
-
bubbles: true,
|
|
567
|
-
composed: true
|
|
568
|
-
})
|
|
569
|
-
);
|
|
570
|
-
});
|
|
571
|
-
}
|
|
572
|
-
setTimeout(() => {
|
|
573
|
-
window.dispatchEvent(new CustomEvent("translations-loaded"));
|
|
574
|
-
const currentLang = currentLanguage.value;
|
|
575
|
-
window.dispatchEvent(
|
|
576
|
-
new CustomEvent("language-changed", {
|
|
577
|
-
detail: { language: currentLang },
|
|
578
|
-
bubbles: true,
|
|
579
|
-
composed: true
|
|
580
|
-
})
|
|
581
|
-
);
|
|
582
|
-
}, 100);
|
|
583
|
-
function translate(key) {
|
|
584
|
-
const lang = currentLanguage.value;
|
|
585
|
-
if (translationData?.[lang]?.[key]) {
|
|
586
|
-
return translationData[lang][key];
|
|
587
|
-
}
|
|
588
|
-
if (lang !== defaultLanguage && translationData?.[defaultLanguage]?.[key]) {
|
|
589
|
-
return translationData[defaultLanguage][key];
|
|
590
|
-
}
|
|
591
|
-
console.warn(
|
|
592
|
-
`[DS one (Internationalization)] No translation found for key "${key}"`
|
|
593
|
-
);
|
|
594
|
-
return key;
|
|
595
|
-
}
|
|
596
|
-
function hasTranslation(key, language = currentLanguage.value) {
|
|
597
|
-
if (!key) {
|
|
598
|
-
return false;
|
|
599
|
-
}
|
|
600
|
-
const langData = translationData?.[language];
|
|
601
|
-
if (langData && Object.prototype.hasOwnProperty.call(langData, key)) {
|
|
602
|
-
return true;
|
|
603
|
-
}
|
|
604
|
-
if (language !== defaultLanguage && translationData?.[defaultLanguage] && Object.prototype.hasOwnProperty.call(translationData[defaultLanguage], key)) {
|
|
605
|
-
return true;
|
|
606
|
-
}
|
|
607
|
-
return false;
|
|
608
|
-
}
|
|
609
|
-
function getText(key) {
|
|
610
|
-
return translate(key);
|
|
611
|
-
}
|
|
612
|
-
function getAvailableLanguages() {
|
|
613
|
-
const currentData = getTranslationData();
|
|
614
|
-
if (currentData && Object.keys(currentData).length > 0) {
|
|
615
|
-
const languages = Object.keys(currentData);
|
|
616
|
-
return Promise.resolve(sortLanguageCodes(languages));
|
|
617
|
-
}
|
|
618
|
-
return Promise.resolve([defaultLanguage]);
|
|
619
|
-
}
|
|
620
|
-
function getAvailableLanguagesSync() {
|
|
621
|
-
const currentData = getTranslationData();
|
|
622
|
-
if (currentData && Object.keys(currentData).length > 0) {
|
|
623
|
-
return sortLanguageCodes(Object.keys(currentData));
|
|
624
|
-
}
|
|
625
|
-
return [defaultLanguage];
|
|
626
|
-
}
|
|
627
|
-
function loadTranslations(language, translations) {
|
|
628
|
-
console.log(
|
|
629
|
-
`Loading additional translations for ${language}:`,
|
|
630
|
-
Object.keys(translations).length,
|
|
631
|
-
"keys"
|
|
632
|
-
);
|
|
633
|
-
}
|
|
634
|
-
function setLanguage(language) {
|
|
635
|
-
localStorage.setItem("language", language);
|
|
636
|
-
currentLanguage.set(language);
|
|
637
|
-
window.dispatchEvent(
|
|
638
|
-
new CustomEvent("language-changed", {
|
|
639
|
-
detail: { language },
|
|
640
|
-
bubbles: true,
|
|
641
|
-
composed: true
|
|
642
|
-
})
|
|
643
|
-
);
|
|
644
|
-
}
|
|
645
|
-
function savePreferences(preferences) {
|
|
646
|
-
if (typeof window === "undefined") {
|
|
647
|
-
return;
|
|
648
|
-
}
|
|
649
|
-
try {
|
|
650
|
-
const raw = window.localStorage?.getItem("ds-one:preferences");
|
|
651
|
-
const existing = raw ? JSON.parse(raw) : {};
|
|
652
|
-
const next = { ...existing, ...preferences };
|
|
653
|
-
window.localStorage?.setItem("ds-one:preferences", JSON.stringify(next));
|
|
654
|
-
} catch (error) {
|
|
655
|
-
console.warn("ds-one: unable to persist preferences", error);
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
const PRICE_LABELS = {
|
|
659
|
-
da: "kr.",
|
|
660
|
-
nb: "kr.",
|
|
661
|
-
sv: "kr.",
|
|
662
|
-
de: "€",
|
|
663
|
-
en: "$",
|
|
664
|
-
pt: "€",
|
|
665
|
-
es: "€",
|
|
666
|
-
zh: "¥",
|
|
667
|
-
ja: "¥",
|
|
668
|
-
ko: "₩"
|
|
669
|
-
};
|
|
670
|
-
function getPriceLabel(options) {
|
|
671
|
-
const { language, country } = options;
|
|
672
|
-
if (country) {
|
|
673
|
-
const countryUpper = country.toUpperCase();
|
|
674
|
-
if (countryUpper === "US" || countryUpper === "USA") {
|
|
675
|
-
return "$";
|
|
448
|
+
subtle2.untrack = untrack;
|
|
449
|
+
function introspectSources(sink) {
|
|
450
|
+
var _a3;
|
|
451
|
+
if (!(0, Signal2.isComputed)(sink) && !(0, Signal2.isWatcher)(sink)) {
|
|
452
|
+
throw new TypeError("Called introspectSources without a Computed or Watcher argument");
|
|
453
|
+
}
|
|
454
|
+
return ((_a3 = sink[NODE].producerNode) == null ? void 0 : _a3.map((n3) => n3.wrapper)) ?? [];
|
|
676
455
|
}
|
|
677
|
-
|
|
678
|
-
|
|
456
|
+
subtle2.introspectSources = introspectSources;
|
|
457
|
+
function introspectSinks(signal) {
|
|
458
|
+
var _a3;
|
|
459
|
+
if (!(0, Signal2.isComputed)(signal) && !(0, Signal2.isState)(signal)) {
|
|
460
|
+
throw new TypeError("Called introspectSinks without a Signal argument");
|
|
461
|
+
}
|
|
462
|
+
return ((_a3 = signal[NODE].liveConsumerNode) == null ? void 0 : _a3.map((n3) => n3.wrapper)) ?? [];
|
|
679
463
|
}
|
|
680
|
-
|
|
681
|
-
|
|
464
|
+
subtle2.introspectSinks = introspectSinks;
|
|
465
|
+
function hasSinks(signal) {
|
|
466
|
+
if (!(0, Signal2.isComputed)(signal) && !(0, Signal2.isState)(signal)) {
|
|
467
|
+
throw new TypeError("Called hasSinks without a Signal argument");
|
|
468
|
+
}
|
|
469
|
+
const liveConsumerNode = signal[NODE].liveConsumerNode;
|
|
470
|
+
if (!liveConsumerNode)
|
|
471
|
+
return false;
|
|
472
|
+
return liveConsumerNode.length > 0;
|
|
682
473
|
}
|
|
683
|
-
|
|
684
|
-
|
|
474
|
+
subtle2.hasSinks = hasSinks;
|
|
475
|
+
function hasSources(signal) {
|
|
476
|
+
if (!(0, Signal2.isComputed)(signal) && !(0, Signal2.isWatcher)(signal)) {
|
|
477
|
+
throw new TypeError("Called hasSources without a Computed or Watcher argument");
|
|
478
|
+
}
|
|
479
|
+
const producerNode = signal[NODE].producerNode;
|
|
480
|
+
if (!producerNode)
|
|
481
|
+
return false;
|
|
482
|
+
return producerNode.length > 0;
|
|
685
483
|
}
|
|
686
|
-
|
|
687
|
-
|
|
484
|
+
subtle2.hasSources = hasSources;
|
|
485
|
+
class Watcher {
|
|
486
|
+
// When a (recursive) source of Watcher is written to, call this callback,
|
|
487
|
+
// if it hasn't already been called since the last `watch` call.
|
|
488
|
+
// No signals may be read or written during the notify.
|
|
489
|
+
constructor(notify) {
|
|
490
|
+
__privateAdd(this, _brand3);
|
|
491
|
+
__privateAdd(this, _assertSignals);
|
|
492
|
+
__publicField(this, _a2);
|
|
493
|
+
let node = Object.create(REACTIVE_NODE);
|
|
494
|
+
node.wrapper = this;
|
|
495
|
+
node.consumerMarkedDirty = notify;
|
|
496
|
+
node.consumerIsAlwaysLive = true;
|
|
497
|
+
node.consumerAllowSignalWrites = false;
|
|
498
|
+
node.producerNode = [];
|
|
499
|
+
this[NODE] = node;
|
|
500
|
+
}
|
|
501
|
+
// Add these signals to the Watcher's set, and set the watcher to run its
|
|
502
|
+
// notify callback next time any signal in the set (or one of its dependencies) changes.
|
|
503
|
+
// Can be called with no arguments just to reset the "notified" state, so that
|
|
504
|
+
// the notify callback will be invoked again.
|
|
505
|
+
watch(...signals) {
|
|
506
|
+
if (!(0, Signal2.isWatcher)(this)) {
|
|
507
|
+
throw new TypeError("Called unwatch without Watcher receiver");
|
|
508
|
+
}
|
|
509
|
+
__privateMethod(this, _assertSignals, assertSignals_fn).call(this, signals);
|
|
510
|
+
const node = this[NODE];
|
|
511
|
+
node.dirty = false;
|
|
512
|
+
const prev = setActiveConsumer(node);
|
|
513
|
+
for (const signal of signals) {
|
|
514
|
+
producerAccessed(signal[NODE]);
|
|
515
|
+
}
|
|
516
|
+
setActiveConsumer(prev);
|
|
517
|
+
}
|
|
518
|
+
// Remove these signals from the watched set (e.g., for an effect which is disposed)
|
|
519
|
+
unwatch(...signals) {
|
|
520
|
+
if (!(0, Signal2.isWatcher)(this)) {
|
|
521
|
+
throw new TypeError("Called unwatch without Watcher receiver");
|
|
522
|
+
}
|
|
523
|
+
__privateMethod(this, _assertSignals, assertSignals_fn).call(this, signals);
|
|
524
|
+
const node = this[NODE];
|
|
525
|
+
assertConsumerNode(node);
|
|
526
|
+
for (let i3 = node.producerNode.length - 1; i3 >= 0; i3--) {
|
|
527
|
+
if (signals.includes(node.producerNode[i3].wrapper)) {
|
|
528
|
+
producerRemoveLiveConsumerAtIndex(node.producerNode[i3], node.producerIndexOfThis[i3]);
|
|
529
|
+
const lastIdx = node.producerNode.length - 1;
|
|
530
|
+
node.producerNode[i3] = node.producerNode[lastIdx];
|
|
531
|
+
node.producerIndexOfThis[i3] = node.producerIndexOfThis[lastIdx];
|
|
532
|
+
node.producerNode.length--;
|
|
533
|
+
node.producerIndexOfThis.length--;
|
|
534
|
+
node.nextProducerIndex--;
|
|
535
|
+
if (i3 < node.producerNode.length) {
|
|
536
|
+
const idxConsumer = node.producerIndexOfThis[i3];
|
|
537
|
+
const producer = node.producerNode[i3];
|
|
538
|
+
assertProducerNode(producer);
|
|
539
|
+
producer.liveConsumerIndexOfThis[idxConsumer] = i3;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
// Returns the set of computeds in the Watcher's set which are still yet
|
|
545
|
+
// to be re-evaluated
|
|
546
|
+
getPending() {
|
|
547
|
+
if (!(0, Signal2.isWatcher)(this)) {
|
|
548
|
+
throw new TypeError("Called getPending without Watcher receiver");
|
|
549
|
+
}
|
|
550
|
+
const node = this[NODE];
|
|
551
|
+
return node.producerNode.filter((n3) => n3.dirty).map((n3) => n3.wrapper);
|
|
552
|
+
}
|
|
688
553
|
}
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
};
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
711
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
712
|
-
};
|
|
713
|
-
var __privateMethod = (obj, member, method) => {
|
|
714
|
-
__accessCheck(obj, member, "access private method");
|
|
715
|
-
return method;
|
|
716
|
-
};
|
|
554
|
+
_a2 = NODE;
|
|
555
|
+
_brand3 = /* @__PURE__ */ new WeakSet();
|
|
556
|
+
_assertSignals = /* @__PURE__ */ new WeakSet();
|
|
557
|
+
assertSignals_fn = function(signals) {
|
|
558
|
+
for (const signal of signals) {
|
|
559
|
+
if (!(0, Signal2.isComputed)(signal) && !(0, Signal2.isState)(signal)) {
|
|
560
|
+
throw new TypeError("Called watch/unwatch without a Computed or State argument");
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
};
|
|
564
|
+
Signal2.isWatcher = (w) => __privateIn(_brand3, w);
|
|
565
|
+
subtle2.Watcher = Watcher;
|
|
566
|
+
function currentComputed() {
|
|
567
|
+
var _a3;
|
|
568
|
+
return (_a3 = getActiveConsumer()) == null ? void 0 : _a3.wrapper;
|
|
569
|
+
}
|
|
570
|
+
subtle2.currentComputed = currentComputed;
|
|
571
|
+
subtle2.watched = Symbol("watched");
|
|
572
|
+
subtle2.unwatched = Symbol("unwatched");
|
|
573
|
+
})(Signal2.subtle || (Signal2.subtle = {}));
|
|
574
|
+
})(Signal || (Signal = {}));
|
|
717
575
|
/**
|
|
718
576
|
* @license
|
|
719
|
-
* Copyright Google LLC
|
|
720
|
-
*
|
|
721
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
722
|
-
* found in the LICENSE file at https://angular.io/license
|
|
577
|
+
* Copyright 2023 Google LLC
|
|
578
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
723
579
|
*/
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
}
|
|
580
|
+
new FinalizationRegistry((({ watcher: t2, signal: i3 }) => {
|
|
581
|
+
t2.unwatch(i3);
|
|
582
|
+
}));
|
|
727
583
|
/**
|
|
728
584
|
* @license
|
|
729
|
-
* Copyright Google LLC
|
|
730
|
-
*
|
|
731
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
732
|
-
* found in the LICENSE file at https://angular.io/license
|
|
585
|
+
* Copyright 2017 Google LLC
|
|
586
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
733
587
|
*/
|
|
734
|
-
|
|
735
|
-
let
|
|
736
|
-
|
|
737
|
-
const SIGNAL = /* @__PURE__ */ Symbol("SIGNAL");
|
|
738
|
-
function setActiveConsumer(consumer) {
|
|
739
|
-
const prev = activeConsumer;
|
|
740
|
-
activeConsumer = consumer;
|
|
741
|
-
return prev;
|
|
742
|
-
}
|
|
743
|
-
function getActiveConsumer() {
|
|
744
|
-
return activeConsumer;
|
|
745
|
-
}
|
|
746
|
-
function isInNotificationPhase() {
|
|
747
|
-
return inNotificationPhase;
|
|
748
|
-
}
|
|
749
|
-
const REACTIVE_NODE = {
|
|
750
|
-
version: 0,
|
|
751
|
-
lastCleanEpoch: 0,
|
|
752
|
-
dirty: false,
|
|
753
|
-
producerNode: void 0,
|
|
754
|
-
producerLastReadVersion: void 0,
|
|
755
|
-
producerIndexOfThis: void 0,
|
|
756
|
-
nextProducerIndex: 0,
|
|
757
|
-
liveConsumerNode: void 0,
|
|
758
|
-
liveConsumerIndexOfThis: void 0,
|
|
759
|
-
consumerAllowSignalWrites: false,
|
|
760
|
-
consumerIsAlwaysLive: false,
|
|
761
|
-
producerMustRecompute: () => false,
|
|
762
|
-
producerRecomputeValue: () => {
|
|
763
|
-
},
|
|
764
|
-
consumerMarkedDirty: () => {
|
|
765
|
-
},
|
|
766
|
-
consumerOnSignalRead: () => {
|
|
588
|
+
const t$2 = { CHILD: 2 }, e$4 = (t2) => (...e2) => ({ _$litDirective$: t2, values: e2 });
|
|
589
|
+
let i$4 = class i {
|
|
590
|
+
constructor(t2) {
|
|
767
591
|
}
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
if (inNotificationPhase) {
|
|
771
|
-
throw new Error(
|
|
772
|
-
typeof ngDevMode !== "undefined" && ngDevMode ? `Assertion error: signal read during notification phase` : ""
|
|
773
|
-
);
|
|
592
|
+
get _$AU() {
|
|
593
|
+
return this._$AM._$AU;
|
|
774
594
|
}
|
|
775
|
-
|
|
776
|
-
|
|
595
|
+
_$AT(t2, e2, i3) {
|
|
596
|
+
this._$Ct = t2, this._$AM = e2, this._$Ci = i3;
|
|
777
597
|
}
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
598
|
+
_$AS(t2, e2) {
|
|
599
|
+
return this.update(t2, e2);
|
|
600
|
+
}
|
|
601
|
+
update(t2, e2) {
|
|
602
|
+
return this.render(...e2);
|
|
603
|
+
}
|
|
604
|
+
};
|
|
605
|
+
/**
|
|
606
|
+
* @license
|
|
607
|
+
* Copyright 2017 Google LLC
|
|
608
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
609
|
+
*/
|
|
610
|
+
const t$1 = globalThis, i$3 = t$1.trustedTypes, s$2 = i$3 ? i$3.createPolicy("lit-html", { createHTML: (t2) => t2 }) : void 0, e$3 = "$lit$", h$1 = `lit$${Math.random().toFixed(9).slice(2)}$`, o$4 = "?" + h$1, n$2 = `<${o$4}>`, r$3 = document, l$1 = () => r$3.createComment(""), c$2 = (t2) => null === t2 || "object" != typeof t2 && "function" != typeof t2, a$1 = Array.isArray, u$1 = (t2) => a$1(t2) || "function" == typeof t2?.[Symbol.iterator], d$1 = "[ \n\f\r]", f$1 = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, v = /-->/g, _ = />/g, m = RegExp(`>|${d$1}(?:([^\\s"'>=/]+)(${d$1}*=${d$1}*(?:[^
|
|
611
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), p$1 = /'/g, g = /"/g, $ = /^(?:script|style|textarea|title)$/i, y$1 = (t2) => (i3, ...s2) => ({ _$litType$: t2, strings: i3, values: s2 }), x = y$1(1), T = Symbol.for("lit-noChange"), E = Symbol.for("lit-nothing"), A = /* @__PURE__ */ new WeakMap(), C = r$3.createTreeWalker(r$3, 129);
|
|
612
|
+
function P(t2, i3) {
|
|
613
|
+
if (!a$1(t2) || !t2.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
614
|
+
return void 0 !== s$2 ? s$2.createHTML(i3) : i3;
|
|
615
|
+
}
|
|
616
|
+
const V = (t2, i3) => {
|
|
617
|
+
const s2 = t2.length - 1, o2 = [];
|
|
618
|
+
let r2, l2 = 2 === i3 ? "<svg>" : 3 === i3 ? "<math>" : "", c2 = f$1;
|
|
619
|
+
for (let i4 = 0; i4 < s2; i4++) {
|
|
620
|
+
const s3 = t2[i4];
|
|
621
|
+
let a2, u2, d2 = -1, y2 = 0;
|
|
622
|
+
for (; y2 < s3.length && (c2.lastIndex = y2, u2 = c2.exec(s3), null !== u2); ) y2 = c2.lastIndex, c2 === f$1 ? "!--" === u2[1] ? c2 = v : void 0 !== u2[1] ? c2 = _ : void 0 !== u2[2] ? ($.test(u2[2]) && (r2 = RegExp("</" + u2[2], "g")), c2 = m) : void 0 !== u2[3] && (c2 = m) : c2 === m ? ">" === u2[0] ? (c2 = r2 ?? f$1, d2 = -1) : void 0 === u2[1] ? d2 = -2 : (d2 = c2.lastIndex - u2[2].length, a2 = u2[1], c2 = void 0 === u2[3] ? m : '"' === u2[3] ? g : p$1) : c2 === g || c2 === p$1 ? c2 = m : c2 === v || c2 === _ ? c2 = f$1 : (c2 = m, r2 = void 0);
|
|
623
|
+
const x2 = c2 === m && t2[i4 + 1].startsWith("/>") ? " " : "";
|
|
624
|
+
l2 += c2 === f$1 ? s3 + n$2 : d2 >= 0 ? (o2.push(a2), s3.slice(0, d2) + e$3 + s3.slice(d2) + h$1 + x2) : s3 + h$1 + (-2 === d2 ? i4 : x2);
|
|
625
|
+
}
|
|
626
|
+
return [P(t2, l2 + (t2[s2] || "<?>") + (2 === i3 ? "</svg>" : 3 === i3 ? "</math>" : "")), o2];
|
|
627
|
+
};
|
|
628
|
+
class N {
|
|
629
|
+
constructor({ strings: t2, _$litType$: s2 }, n3) {
|
|
630
|
+
let r2;
|
|
631
|
+
this.parts = [];
|
|
632
|
+
let c2 = 0, a2 = 0;
|
|
633
|
+
const u2 = t2.length - 1, d2 = this.parts, [f2, v2] = V(t2, s2);
|
|
634
|
+
if (this.el = N.createElement(f2, n3), C.currentNode = this.el.content, 2 === s2 || 3 === s2) {
|
|
635
|
+
const t3 = this.el.content.firstChild;
|
|
636
|
+
t3.replaceWith(...t3.childNodes);
|
|
637
|
+
}
|
|
638
|
+
for (; null !== (r2 = C.nextNode()) && d2.length < u2; ) {
|
|
639
|
+
if (1 === r2.nodeType) {
|
|
640
|
+
if (r2.hasAttributes()) for (const t3 of r2.getAttributeNames()) if (t3.endsWith(e$3)) {
|
|
641
|
+
const i3 = v2[a2++], s3 = r2.getAttribute(t3).split(h$1), e2 = /([.?@])?(.*)/.exec(i3);
|
|
642
|
+
d2.push({ type: 1, index: c2, name: e2[2], strings: s3, ctor: "." === e2[1] ? H : "?" === e2[1] ? I : "@" === e2[1] ? L : k }), r2.removeAttribute(t3);
|
|
643
|
+
} else t3.startsWith(h$1) && (d2.push({ type: 6, index: c2 }), r2.removeAttribute(t3));
|
|
644
|
+
if ($.test(r2.tagName)) {
|
|
645
|
+
const t3 = r2.textContent.split(h$1), s3 = t3.length - 1;
|
|
646
|
+
if (s3 > 0) {
|
|
647
|
+
r2.textContent = i$3 ? i$3.emptyScript : "";
|
|
648
|
+
for (let i3 = 0; i3 < s3; i3++) r2.append(t3[i3], l$1()), C.nextNode(), d2.push({ type: 2, index: ++c2 });
|
|
649
|
+
r2.append(t3[s3], l$1());
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
} else if (8 === r2.nodeType) if (r2.data === o$4) d2.push({ type: 2, index: c2 });
|
|
653
|
+
else {
|
|
654
|
+
let t3 = -1;
|
|
655
|
+
for (; -1 !== (t3 = r2.data.indexOf(h$1, t3 + 1)); ) d2.push({ type: 7, index: c2 }), t3 += h$1.length - 1;
|
|
656
|
+
}
|
|
657
|
+
c2++;
|
|
785
658
|
}
|
|
786
659
|
}
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
660
|
+
static createElement(t2, i3) {
|
|
661
|
+
const s2 = r$3.createElement("template");
|
|
662
|
+
return s2.innerHTML = t2, s2;
|
|
790
663
|
}
|
|
791
|
-
activeConsumer.producerLastReadVersion[idx] = node.version;
|
|
792
664
|
}
|
|
793
|
-
function
|
|
794
|
-
|
|
665
|
+
function S$1(t2, i3, s2 = t2, e2) {
|
|
666
|
+
if (i3 === T) return i3;
|
|
667
|
+
let h2 = void 0 !== e2 ? s2._$Co?.[e2] : s2._$Cl;
|
|
668
|
+
const o2 = c$2(i3) ? void 0 : i3._$litDirective$;
|
|
669
|
+
return h2?.constructor !== o2 && (h2?._$AO?.(false), void 0 === o2 ? h2 = void 0 : (h2 = new o2(t2), h2._$AT(t2, s2, e2)), void 0 !== e2 ? (s2._$Co ?? (s2._$Co = []))[e2] = h2 : s2._$Cl = h2), void 0 !== h2 && (i3 = S$1(t2, h2._$AS(t2, i3.values), h2, e2)), i3;
|
|
795
670
|
}
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
671
|
+
class M {
|
|
672
|
+
constructor(t2, i3) {
|
|
673
|
+
this._$AV = [], this._$AN = void 0, this._$AD = t2, this._$AM = i3;
|
|
799
674
|
}
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
node.lastCleanEpoch = epoch;
|
|
803
|
-
return;
|
|
675
|
+
get parentNode() {
|
|
676
|
+
return this._$AM.parentNode;
|
|
804
677
|
}
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
node.lastCleanEpoch = epoch;
|
|
808
|
-
}
|
|
809
|
-
function producerNotifyConsumers(node) {
|
|
810
|
-
if (node.liveConsumerNode === void 0) {
|
|
811
|
-
return;
|
|
678
|
+
get _$AU() {
|
|
679
|
+
return this._$AM._$AU;
|
|
812
680
|
}
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
681
|
+
u(t2) {
|
|
682
|
+
const { el: { content: i3 }, parts: s2 } = this._$AD, e2 = (t2?.creationScope ?? r$3).importNode(i3, true);
|
|
683
|
+
C.currentNode = e2;
|
|
684
|
+
let h2 = C.nextNode(), o2 = 0, n3 = 0, l2 = s2[0];
|
|
685
|
+
for (; void 0 !== l2; ) {
|
|
686
|
+
if (o2 === l2.index) {
|
|
687
|
+
let i4;
|
|
688
|
+
2 === l2.type ? i4 = new R(h2, h2.nextSibling, this, t2) : 1 === l2.type ? i4 = new l2.ctor(h2, l2.name, l2.strings, this, t2) : 6 === l2.type && (i4 = new z(h2, this, t2)), this._$AV.push(i4), l2 = s2[++n3];
|
|
819
689
|
}
|
|
690
|
+
o2 !== l2?.index && (h2 = C.nextNode(), o2++);
|
|
820
691
|
}
|
|
821
|
-
|
|
822
|
-
|
|
692
|
+
return C.currentNode = r$3, e2;
|
|
693
|
+
}
|
|
694
|
+
p(t2) {
|
|
695
|
+
let i3 = 0;
|
|
696
|
+
for (const s2 of this._$AV) void 0 !== s2 && (void 0 !== s2.strings ? (s2._$AI(t2, s2, i3), i3 += s2.strings.length - 2) : s2._$AI(t2[i3])), i3++;
|
|
823
697
|
}
|
|
824
698
|
}
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
function consumerMarkDirty(node) {
|
|
829
|
-
var _a;
|
|
830
|
-
node.dirty = true;
|
|
831
|
-
producerNotifyConsumers(node);
|
|
832
|
-
(_a = node.consumerMarkedDirty) == null ? void 0 : _a.call(node.wrapper ?? node);
|
|
833
|
-
}
|
|
834
|
-
function consumerBeforeComputation(node) {
|
|
835
|
-
node && (node.nextProducerIndex = 0);
|
|
836
|
-
return setActiveConsumer(node);
|
|
837
|
-
}
|
|
838
|
-
function consumerAfterComputation(node, prevConsumer) {
|
|
839
|
-
setActiveConsumer(prevConsumer);
|
|
840
|
-
if (!node || node.producerNode === void 0 || node.producerIndexOfThis === void 0 || node.producerLastReadVersion === void 0) {
|
|
841
|
-
return;
|
|
699
|
+
class R {
|
|
700
|
+
get _$AU() {
|
|
701
|
+
return this._$AM?._$AU ?? this._$Cv;
|
|
842
702
|
}
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
producerRemoveLiveConsumerAtIndex(node.producerNode[i3], node.producerIndexOfThis[i3]);
|
|
846
|
-
}
|
|
703
|
+
constructor(t2, i3, s2, e2) {
|
|
704
|
+
this.type = 2, this._$AH = E, this._$AN = void 0, this._$AA = t2, this._$AB = i3, this._$AM = s2, this.options = e2, this._$Cv = e2?.isConnected ?? true;
|
|
847
705
|
}
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
706
|
+
get parentNode() {
|
|
707
|
+
let t2 = this._$AA.parentNode;
|
|
708
|
+
const i3 = this._$AM;
|
|
709
|
+
return void 0 !== i3 && 11 === t2?.nodeType && (t2 = i3.parentNode), t2;
|
|
852
710
|
}
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
711
|
+
get startNode() {
|
|
712
|
+
return this._$AA;
|
|
713
|
+
}
|
|
714
|
+
get endNode() {
|
|
715
|
+
return this._$AB;
|
|
716
|
+
}
|
|
717
|
+
_$AI(t2, i3 = this) {
|
|
718
|
+
t2 = S$1(this, t2, i3), c$2(t2) ? t2 === E || null == t2 || "" === t2 ? (this._$AH !== E && this._$AR(), this._$AH = E) : t2 !== this._$AH && t2 !== T && this._(t2) : void 0 !== t2._$litType$ ? this.$(t2) : void 0 !== t2.nodeType ? this.T(t2) : u$1(t2) ? this.k(t2) : this._(t2);
|
|
719
|
+
}
|
|
720
|
+
O(t2) {
|
|
721
|
+
return this._$AA.parentNode.insertBefore(t2, this._$AB);
|
|
722
|
+
}
|
|
723
|
+
T(t2) {
|
|
724
|
+
this._$AH !== t2 && (this._$AR(), this._$AH = this.O(t2));
|
|
725
|
+
}
|
|
726
|
+
_(t2) {
|
|
727
|
+
this._$AH !== E && c$2(this._$AH) ? this._$AA.nextSibling.data = t2 : this.T(r$3.createTextNode(t2)), this._$AH = t2;
|
|
728
|
+
}
|
|
729
|
+
$(t2) {
|
|
730
|
+
const { values: i3, _$litType$: s2 } = t2, e2 = "number" == typeof s2 ? this._$AC(t2) : (void 0 === s2.el && (s2.el = N.createElement(P(s2.h, s2.h[0]), this.options)), s2);
|
|
731
|
+
if (this._$AH?._$AD === e2) this._$AH.p(i3);
|
|
732
|
+
else {
|
|
733
|
+
const t3 = new M(e2, this), s3 = t3.u(this.options);
|
|
734
|
+
t3.p(i3), this.T(s3), this._$AH = t3;
|
|
865
735
|
}
|
|
866
736
|
}
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
for (
|
|
876
|
-
|
|
737
|
+
_$AC(t2) {
|
|
738
|
+
let i3 = A.get(t2.strings);
|
|
739
|
+
return void 0 === i3 && A.set(t2.strings, i3 = new N(t2)), i3;
|
|
740
|
+
}
|
|
741
|
+
k(t2) {
|
|
742
|
+
a$1(this._$AH) || (this._$AH = [], this._$AR());
|
|
743
|
+
const i3 = this._$AH;
|
|
744
|
+
let s2, e2 = 0;
|
|
745
|
+
for (const h2 of t2) e2 === i3.length ? i3.push(s2 = new R(this.O(l$1()), this.O(l$1()), this, this.options)) : s2 = i3[e2], s2._$AI(h2), e2++;
|
|
746
|
+
e2 < i3.length && (this._$AR(s2 && s2._$AB.nextSibling, e2), i3.length = e2);
|
|
747
|
+
}
|
|
748
|
+
_$AR(t2 = this._$AA.nextSibling, i3) {
|
|
749
|
+
for (this._$AP?.(false, true, i3); t2 !== this._$AB; ) {
|
|
750
|
+
const i4 = t2.nextSibling;
|
|
751
|
+
t2.remove(), t2 = i4;
|
|
877
752
|
}
|
|
878
753
|
}
|
|
879
|
-
|
|
880
|
-
|
|
754
|
+
setConnected(t2) {
|
|
755
|
+
void 0 === this._$AM && (this._$Cv = t2, this._$AP?.(t2));
|
|
756
|
+
}
|
|
881
757
|
}
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
assertConsumerNode(node);
|
|
886
|
-
if (typeof ngDevMode !== "undefined" && ngDevMode && idx >= node.liveConsumerNode.length) {
|
|
887
|
-
throw new Error(
|
|
888
|
-
`Assertion error: active consumer index ${idx} is out of bounds of ${node.liveConsumerNode.length} consumers)`
|
|
889
|
-
);
|
|
758
|
+
class k {
|
|
759
|
+
get tagName() {
|
|
760
|
+
return this.element.tagName;
|
|
890
761
|
}
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
762
|
+
get _$AU() {
|
|
763
|
+
return this._$AM._$AU;
|
|
764
|
+
}
|
|
765
|
+
constructor(t2, i3, s2, e2, h2) {
|
|
766
|
+
this.type = 1, this._$AH = E, this._$AN = void 0, this.element = t2, this.name = i3, this._$AM = e2, this.options = h2, s2.length > 2 || "" !== s2[0] || "" !== s2[1] ? (this._$AH = Array(s2.length - 1).fill(new String()), this.strings = s2) : this._$AH = E;
|
|
767
|
+
}
|
|
768
|
+
_$AI(t2, i3 = this, s2, e2) {
|
|
769
|
+
const h2 = this.strings;
|
|
770
|
+
let o2 = false;
|
|
771
|
+
if (void 0 === h2) t2 = S$1(this, t2, i3, 0), o2 = !c$2(t2) || t2 !== this._$AH && t2 !== T, o2 && (this._$AH = t2);
|
|
772
|
+
else {
|
|
773
|
+
const e3 = t2;
|
|
774
|
+
let n3, r2;
|
|
775
|
+
for (t2 = h2[0], n3 = 0; n3 < h2.length - 1; n3++) r2 = S$1(this, e3[s2 + n3], i3, n3), r2 === T && (r2 = this._$AH[n3]), o2 || (o2 = !c$2(r2) || r2 !== this._$AH[n3]), r2 === E ? t2 = E : t2 !== E && (t2 += (r2 ?? "") + h2[n3 + 1]), this._$AH[n3] = r2;
|
|
895
776
|
}
|
|
777
|
+
o2 && !e2 && this.j(t2);
|
|
896
778
|
}
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
node.liveConsumerIndexOfThis[idx] = node.liveConsumerIndexOfThis[lastIdx];
|
|
900
|
-
node.liveConsumerNode.length--;
|
|
901
|
-
node.liveConsumerIndexOfThis.length--;
|
|
902
|
-
if (idx < node.liveConsumerNode.length) {
|
|
903
|
-
const idxProducer = node.liveConsumerIndexOfThis[idx];
|
|
904
|
-
const consumer = node.liveConsumerNode[idx];
|
|
905
|
-
assertConsumerNode(consumer);
|
|
906
|
-
consumer.producerIndexOfThis[idxProducer] = idx;
|
|
779
|
+
j(t2) {
|
|
780
|
+
t2 === E ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t2 ?? "");
|
|
907
781
|
}
|
|
908
782
|
}
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
783
|
+
class H extends k {
|
|
784
|
+
constructor() {
|
|
785
|
+
super(...arguments), this.type = 3;
|
|
786
|
+
}
|
|
787
|
+
j(t2) {
|
|
788
|
+
this.element[this.name] = t2 === E ? void 0 : t2;
|
|
789
|
+
}
|
|
912
790
|
}
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
791
|
+
class I extends k {
|
|
792
|
+
constructor() {
|
|
793
|
+
super(...arguments), this.type = 4;
|
|
794
|
+
}
|
|
795
|
+
j(t2) {
|
|
796
|
+
this.element.toggleAttribute(this.name, !!t2 && t2 !== E);
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
class L extends k {
|
|
800
|
+
constructor(t2, i3, s2, e2, h2) {
|
|
801
|
+
super(t2, i3, s2, e2, h2), this.type = 5;
|
|
802
|
+
}
|
|
803
|
+
_$AI(t2, i3 = this) {
|
|
804
|
+
if ((t2 = S$1(this, t2, i3, 0) ?? E) === T) return;
|
|
805
|
+
const s2 = this._$AH, e2 = t2 === E && s2 !== E || t2.capture !== s2.capture || t2.once !== s2.once || t2.passive !== s2.passive, h2 = t2 !== E && (s2 === E || e2);
|
|
806
|
+
e2 && this.element.removeEventListener(this.name, this, s2), h2 && this.element.addEventListener(this.name, this, t2), this._$AH = t2;
|
|
807
|
+
}
|
|
808
|
+
handleEvent(t2) {
|
|
809
|
+
"function" == typeof this._$AH ? this._$AH.call(this.options?.host ?? this.element, t2) : this._$AH.handleEvent(t2);
|
|
810
|
+
}
|
|
917
811
|
}
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
812
|
+
class z {
|
|
813
|
+
constructor(t2, i3, s2) {
|
|
814
|
+
this.element = t2, this.type = 6, this._$AN = void 0, this._$AM = i3, this.options = s2;
|
|
815
|
+
}
|
|
816
|
+
get _$AU() {
|
|
817
|
+
return this._$AM._$AU;
|
|
818
|
+
}
|
|
819
|
+
_$AI(t2) {
|
|
820
|
+
S$1(this, t2);
|
|
821
|
+
}
|
|
921
822
|
}
|
|
823
|
+
const j = t$1.litHtmlPolyfillSupport;
|
|
824
|
+
j?.(N, R), (t$1.litHtmlVersions ?? (t$1.litHtmlVersions = [])).push("3.3.1");
|
|
825
|
+
const B = (t2, i3, s2) => {
|
|
826
|
+
const e2 = s2?.renderBefore ?? i3;
|
|
827
|
+
let h2 = e2._$litPart$;
|
|
828
|
+
if (void 0 === h2) {
|
|
829
|
+
const t3 = s2?.renderBefore ?? null;
|
|
830
|
+
e2._$litPart$ = h2 = new R(i3.insertBefore(l$1(), t3), t3, void 0, s2 ?? {});
|
|
831
|
+
}
|
|
832
|
+
return h2._$AI(t2), h2;
|
|
833
|
+
};
|
|
922
834
|
/**
|
|
923
835
|
* @license
|
|
924
|
-
* Copyright Google LLC
|
|
925
|
-
*
|
|
926
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
927
|
-
* found in the LICENSE file at https://angular.io/license
|
|
836
|
+
* Copyright 2023 Google LLC
|
|
837
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
928
838
|
*/
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
839
|
+
Signal.State;
|
|
840
|
+
Signal.Computed;
|
|
841
|
+
const r$2 = (l2, o2) => new Signal.State(l2, o2);
|
|
842
|
+
const defaultScalingConfig = {
|
|
843
|
+
mode: "auto",
|
|
844
|
+
baseWidth: 280,
|
|
845
|
+
minScale: 0.75,
|
|
846
|
+
maxScale: 2
|
|
847
|
+
};
|
|
848
|
+
const scalingFactor = r$2(1);
|
|
849
|
+
const scalingConfig = r$2(defaultScalingConfig);
|
|
850
|
+
function detectMobileDevice() {
|
|
851
|
+
if (typeof navigator === "undefined" || typeof window === "undefined") {
|
|
852
|
+
return false;
|
|
934
853
|
}
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
const
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
854
|
+
const nav = navigator;
|
|
855
|
+
const win = window;
|
|
856
|
+
const ua = nav && (nav.userAgent || nav.vendor) || win && win.opera || "";
|
|
857
|
+
const uaMatchesMobile = /Mobile|Android|iP(ad|hone|od)|IEMobile|BlackBerry|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)|Windows Phone|Phone|Tablet/i.test(
|
|
858
|
+
ua
|
|
859
|
+
);
|
|
860
|
+
const touchPoints = nav && nav.maxTouchPoints || 0;
|
|
861
|
+
const isTouchCapable = touchPoints > 1;
|
|
862
|
+
const narrowViewport = win ? Math.min(win.innerWidth || 0, win.innerHeight || 0) <= 820 : false;
|
|
863
|
+
return uaMatchesMobile || isTouchCapable && narrowViewport;
|
|
943
864
|
}
|
|
944
|
-
|
|
945
|
-
const
|
|
946
|
-
const
|
|
947
|
-
const
|
|
865
|
+
function getDeviceInfo() {
|
|
866
|
+
const isMobile = detectMobileDevice();
|
|
867
|
+
const nav = navigator;
|
|
868
|
+
const win = window;
|
|
869
|
+
const touchPoints = nav && nav.maxTouchPoints || 0;
|
|
870
|
+
const isTouchCapable = touchPoints > 1;
|
|
871
|
+
const screenWidth = typeof document !== "undefined" ? document.documentElement.clientWidth : win?.innerWidth || 0;
|
|
872
|
+
const screenHeight = typeof document !== "undefined" ? document.documentElement.clientHeight : win?.innerHeight || 0;
|
|
873
|
+
const isTablet = isMobile && Math.min(screenWidth, screenHeight) >= 600;
|
|
948
874
|
return {
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
producerRecomputeValue(node) {
|
|
958
|
-
if (node.value === COMPUTING) {
|
|
959
|
-
throw new Error("Detected cycle in computations.");
|
|
960
|
-
}
|
|
961
|
-
const oldValue = node.value;
|
|
962
|
-
node.value = COMPUTING;
|
|
963
|
-
const prevConsumer = consumerBeforeComputation(node);
|
|
964
|
-
let newValue;
|
|
965
|
-
let wasEqual = false;
|
|
966
|
-
try {
|
|
967
|
-
newValue = node.computation.call(node.wrapper);
|
|
968
|
-
const oldOk = oldValue !== UNSET && oldValue !== ERRORED;
|
|
969
|
-
wasEqual = oldOk && node.equal.call(node.wrapper, oldValue, newValue);
|
|
970
|
-
} catch (err) {
|
|
971
|
-
newValue = ERRORED;
|
|
972
|
-
node.error = err;
|
|
973
|
-
} finally {
|
|
974
|
-
consumerAfterComputation(node, prevConsumer);
|
|
975
|
-
}
|
|
976
|
-
if (wasEqual) {
|
|
977
|
-
node.value = oldValue;
|
|
978
|
-
return;
|
|
979
|
-
}
|
|
980
|
-
node.value = newValue;
|
|
981
|
-
node.version++;
|
|
982
|
-
}
|
|
875
|
+
isMobile,
|
|
876
|
+
isTablet,
|
|
877
|
+
isDesktop: !isMobile,
|
|
878
|
+
isTouchCapable,
|
|
879
|
+
deviceType: isMobile ? isTablet ? "tablet" : "mobile" : "desktop",
|
|
880
|
+
userAgent: nav && (nav.userAgent || nav.vendor) || "",
|
|
881
|
+
screenWidth,
|
|
882
|
+
screenHeight
|
|
983
883
|
};
|
|
984
|
-
})();
|
|
985
|
-
/**
|
|
986
|
-
* @license
|
|
987
|
-
* Copyright Google LLC All Rights Reserved.
|
|
988
|
-
*
|
|
989
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
990
|
-
* found in the LICENSE file at https://angular.io/license
|
|
991
|
-
*/
|
|
992
|
-
function defaultThrowError() {
|
|
993
|
-
throw new Error();
|
|
994
884
|
}
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
885
|
+
function calculateScalingFactor(viewportWidth, config = scalingConfig.get()) {
|
|
886
|
+
if (config.mode === "fixed") {
|
|
887
|
+
return 1;
|
|
888
|
+
}
|
|
889
|
+
const rawScale = viewportWidth / config.baseWidth;
|
|
890
|
+
const clampedScale = Math.max(
|
|
891
|
+
config.minScale,
|
|
892
|
+
Math.min(config.maxScale, rawScale)
|
|
893
|
+
);
|
|
894
|
+
return Number(clampedScale.toFixed(3));
|
|
998
895
|
}
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
function createSignal(initialValue) {
|
|
1007
|
-
const node = Object.create(SIGNAL_NODE);
|
|
1008
|
-
node.value = initialValue;
|
|
1009
|
-
const getter = () => {
|
|
1010
|
-
producerAccessed(node);
|
|
1011
|
-
return node.value;
|
|
1012
|
-
};
|
|
1013
|
-
getter[SIGNAL] = node;
|
|
1014
|
-
return getter;
|
|
896
|
+
function setScalingConfig(config) {
|
|
897
|
+
const currentConfig = scalingConfig.get();
|
|
898
|
+
const newConfig = { ...currentConfig, ...config };
|
|
899
|
+
scalingConfig.set(newConfig);
|
|
900
|
+
if (typeof window !== "undefined") {
|
|
901
|
+
updateScalingFactor();
|
|
902
|
+
}
|
|
1015
903
|
}
|
|
1016
|
-
function
|
|
1017
|
-
|
|
1018
|
-
|
|
904
|
+
function updateScalingFactor() {
|
|
905
|
+
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
906
|
+
return;
|
|
907
|
+
}
|
|
908
|
+
const isMobile = detectMobileDevice();
|
|
909
|
+
if (!isMobile) {
|
|
910
|
+
const factor = 1;
|
|
911
|
+
scalingFactor.set(factor);
|
|
912
|
+
document.documentElement.style.setProperty("--sf", factor.toString());
|
|
913
|
+
window.dispatchEvent(
|
|
914
|
+
new CustomEvent("scaling-changed", {
|
|
915
|
+
detail: { scalingFactor: factor, config: scalingConfig.get() }
|
|
916
|
+
})
|
|
917
|
+
);
|
|
918
|
+
return;
|
|
919
|
+
}
|
|
920
|
+
const viewportWidth = document.documentElement.clientWidth;
|
|
921
|
+
const config = scalingConfig.get();
|
|
922
|
+
const newFactor = calculateScalingFactor(viewportWidth, config);
|
|
923
|
+
scalingFactor.set(newFactor);
|
|
924
|
+
document.documentElement.style.setProperty("--sf", newFactor.toString());
|
|
925
|
+
window.dispatchEvent(
|
|
926
|
+
new CustomEvent("scaling-changed", {
|
|
927
|
+
detail: { scalingFactor: newFactor, config }
|
|
928
|
+
})
|
|
929
|
+
);
|
|
1019
930
|
}
|
|
1020
|
-
function
|
|
1021
|
-
|
|
1022
|
-
|
|
931
|
+
function getScalingFactor() {
|
|
932
|
+
return scalingFactor.get();
|
|
933
|
+
}
|
|
934
|
+
function scale(designPx) {
|
|
935
|
+
return designPx * scalingFactor.get();
|
|
936
|
+
}
|
|
937
|
+
function unscale(scaledPx) {
|
|
938
|
+
const factor = scalingFactor.get();
|
|
939
|
+
return factor === 0 ? scaledPx : scaledPx / factor;
|
|
940
|
+
}
|
|
941
|
+
function initDeviceDetection() {
|
|
942
|
+
const deviceInfo = getDeviceInfo();
|
|
943
|
+
if (typeof document === "undefined") {
|
|
944
|
+
return deviceInfo;
|
|
1023
945
|
}
|
|
1024
|
-
if (
|
|
1025
|
-
|
|
1026
|
-
|
|
946
|
+
if (deviceInfo.isMobile) {
|
|
947
|
+
document.documentElement.classList.add("mobile");
|
|
948
|
+
document.documentElement.classList.remove("desktop");
|
|
949
|
+
} else {
|
|
950
|
+
document.documentElement.classList.add("desktop");
|
|
951
|
+
document.documentElement.classList.remove("mobile");
|
|
952
|
+
}
|
|
953
|
+
updateScalingFactor();
|
|
954
|
+
const factor = scalingFactor.get();
|
|
955
|
+
if (deviceInfo.isMobile) {
|
|
956
|
+
console.log(
|
|
957
|
+
`[DS one] Mobile device detected - ${deviceInfo.deviceType} (${deviceInfo.screenWidth}x${deviceInfo.screenHeight}), scaling factor: ${factor.toFixed(2)}`
|
|
958
|
+
);
|
|
959
|
+
} else {
|
|
960
|
+
console.log(
|
|
961
|
+
`[DS one] Desktop device detected (${deviceInfo.screenWidth}x${deviceInfo.screenHeight})`
|
|
962
|
+
);
|
|
963
|
+
}
|
|
964
|
+
if (typeof window !== "undefined" && window.DS_ONE_DEBUG) {
|
|
965
|
+
console.log("[DS one] Device Info:", {
|
|
966
|
+
type: deviceInfo.deviceType,
|
|
967
|
+
isMobile: deviceInfo.isMobile,
|
|
968
|
+
isTablet: deviceInfo.isTablet,
|
|
969
|
+
isDesktop: deviceInfo.isDesktop,
|
|
970
|
+
isTouchCapable: deviceInfo.isTouchCapable,
|
|
971
|
+
viewport: `${deviceInfo.screenWidth}x${deviceInfo.screenHeight}`,
|
|
972
|
+
scalingFactor: factor,
|
|
973
|
+
userAgent: deviceInfo.userAgent
|
|
974
|
+
});
|
|
1027
975
|
}
|
|
976
|
+
return deviceInfo;
|
|
1028
977
|
}
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
}
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
978
|
+
if (typeof window !== "undefined") {
|
|
979
|
+
if (document.readyState === "loading") {
|
|
980
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
981
|
+
initDeviceDetection();
|
|
982
|
+
});
|
|
983
|
+
} else {
|
|
984
|
+
initDeviceDetection();
|
|
985
|
+
}
|
|
986
|
+
let resizeTimeout;
|
|
987
|
+
window.addEventListener("resize", () => {
|
|
988
|
+
clearTimeout(resizeTimeout);
|
|
989
|
+
resizeTimeout = setTimeout(() => {
|
|
990
|
+
initDeviceDetection();
|
|
991
|
+
}, 100);
|
|
992
|
+
});
|
|
993
|
+
window.addEventListener("orientationchange", () => {
|
|
994
|
+
setTimeout(initDeviceDetection, 100);
|
|
995
|
+
});
|
|
1040
996
|
}
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
*
|
|
1045
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1046
|
-
* you may not use this file except in compliance with the License.
|
|
1047
|
-
* You may obtain a copy of the License at
|
|
1048
|
-
*
|
|
1049
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1050
|
-
*
|
|
1051
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1052
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1053
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1054
|
-
* See the License for the specific language governing permissions and
|
|
1055
|
-
* limitations under the License.
|
|
1056
|
-
*/
|
|
1057
|
-
const NODE = Symbol("node");
|
|
1058
|
-
var Signal;
|
|
1059
|
-
((Signal2) => {
|
|
1060
|
-
var _a, _brand, _b, _brand2;
|
|
1061
|
-
class State {
|
|
1062
|
-
constructor(initialValue, options = {}) {
|
|
1063
|
-
__privateAdd(this, _brand);
|
|
1064
|
-
__publicField(this, _a);
|
|
1065
|
-
const ref = createSignal(initialValue);
|
|
1066
|
-
const node = ref[SIGNAL];
|
|
1067
|
-
this[NODE] = node;
|
|
1068
|
-
node.wrapper = this;
|
|
1069
|
-
if (options) {
|
|
1070
|
-
const equals = options.equals;
|
|
1071
|
-
if (equals) {
|
|
1072
|
-
node.equal = equals;
|
|
1073
|
-
}
|
|
1074
|
-
node.watched = options[Signal2.subtle.watched];
|
|
1075
|
-
node.unwatched = options[Signal2.subtle.unwatched];
|
|
1076
|
-
}
|
|
1077
|
-
}
|
|
1078
|
-
get() {
|
|
1079
|
-
if (!(0, Signal2.isState)(this))
|
|
1080
|
-
throw new TypeError("Wrong receiver type for Signal.State.prototype.get");
|
|
1081
|
-
return signalGetFn.call(this[NODE]);
|
|
1082
|
-
}
|
|
1083
|
-
set(newValue) {
|
|
1084
|
-
if (!(0, Signal2.isState)(this))
|
|
1085
|
-
throw new TypeError("Wrong receiver type for Signal.State.prototype.set");
|
|
1086
|
-
if (isInNotificationPhase()) {
|
|
1087
|
-
throw new Error("Writes to signals not permitted during Watcher callback");
|
|
1088
|
-
}
|
|
1089
|
-
const ref = this[NODE];
|
|
1090
|
-
signalSetFn(ref, newValue);
|
|
1091
|
-
}
|
|
997
|
+
function applike() {
|
|
998
|
+
if (typeof document === "undefined" || typeof window === "undefined") {
|
|
999
|
+
return;
|
|
1092
1000
|
}
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
// Create a Signal which evaluates to the value returned by the callback.
|
|
1099
|
-
// Callback is called with this signal as the parameter.
|
|
1100
|
-
constructor(computation, options) {
|
|
1101
|
-
__privateAdd(this, _brand2);
|
|
1102
|
-
__publicField(this, _b);
|
|
1103
|
-
const ref = createComputed(computation);
|
|
1104
|
-
const node = ref[SIGNAL];
|
|
1105
|
-
node.consumerAllowSignalWrites = true;
|
|
1106
|
-
this[NODE] = node;
|
|
1107
|
-
node.wrapper = this;
|
|
1108
|
-
if (options) {
|
|
1109
|
-
const equals = options.equals;
|
|
1110
|
-
if (equals) {
|
|
1111
|
-
node.equal = equals;
|
|
1112
|
-
}
|
|
1113
|
-
node.watched = options[Signal2.subtle.watched];
|
|
1114
|
-
node.unwatched = options[Signal2.subtle.unwatched];
|
|
1115
|
-
}
|
|
1116
|
-
}
|
|
1117
|
-
get() {
|
|
1118
|
-
if (!(0, Signal2.isComputed)(this))
|
|
1119
|
-
throw new TypeError("Wrong receiver type for Signal.Computed.prototype.get");
|
|
1120
|
-
return computedGet(this[NODE]);
|
|
1121
|
-
}
|
|
1001
|
+
let viewport = document.querySelector('meta[name="viewport"]');
|
|
1002
|
+
if (!viewport) {
|
|
1003
|
+
viewport = document.createElement("meta");
|
|
1004
|
+
viewport.setAttribute("name", "viewport");
|
|
1005
|
+
document.head.appendChild(viewport);
|
|
1122
1006
|
}
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
(
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
prevActiveConsumer = setActiveConsumer(null);
|
|
1134
|
-
output = cb();
|
|
1135
|
-
} finally {
|
|
1136
|
-
setActiveConsumer(prevActiveConsumer);
|
|
1137
|
-
}
|
|
1138
|
-
return output;
|
|
1139
|
-
}
|
|
1140
|
-
subtle2.untrack = untrack;
|
|
1141
|
-
function introspectSources(sink) {
|
|
1142
|
-
var _a3;
|
|
1143
|
-
if (!(0, Signal2.isComputed)(sink) && !(0, Signal2.isWatcher)(sink)) {
|
|
1144
|
-
throw new TypeError("Called introspectSources without a Computed or Watcher argument");
|
|
1145
|
-
}
|
|
1146
|
-
return ((_a3 = sink[NODE].producerNode) == null ? void 0 : _a3.map((n3) => n3.wrapper)) ?? [];
|
|
1147
|
-
}
|
|
1148
|
-
subtle2.introspectSources = introspectSources;
|
|
1149
|
-
function introspectSinks(signal) {
|
|
1150
|
-
var _a3;
|
|
1151
|
-
if (!(0, Signal2.isComputed)(signal) && !(0, Signal2.isState)(signal)) {
|
|
1152
|
-
throw new TypeError("Called introspectSinks without a Signal argument");
|
|
1153
|
-
}
|
|
1154
|
-
return ((_a3 = signal[NODE].liveConsumerNode) == null ? void 0 : _a3.map((n3) => n3.wrapper)) ?? [];
|
|
1155
|
-
}
|
|
1156
|
-
subtle2.introspectSinks = introspectSinks;
|
|
1157
|
-
function hasSinks(signal) {
|
|
1158
|
-
if (!(0, Signal2.isComputed)(signal) && !(0, Signal2.isState)(signal)) {
|
|
1159
|
-
throw new TypeError("Called hasSinks without a Signal argument");
|
|
1160
|
-
}
|
|
1161
|
-
const liveConsumerNode = signal[NODE].liveConsumerNode;
|
|
1162
|
-
if (!liveConsumerNode)
|
|
1163
|
-
return false;
|
|
1164
|
-
return liveConsumerNode.length > 0;
|
|
1007
|
+
viewport.setAttribute(
|
|
1008
|
+
"content",
|
|
1009
|
+
"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
|
|
1010
|
+
);
|
|
1011
|
+
const style = document.createElement("style");
|
|
1012
|
+
style.id = "ds-one-applike-style";
|
|
1013
|
+
style.textContent = `
|
|
1014
|
+
* {
|
|
1015
|
+
touch-action: pan-x pan-y !important;
|
|
1016
|
+
-ms-touch-action: pan-x pan-y !important;
|
|
1165
1017
|
}
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
throw new TypeError("Called hasSources without a Computed or Watcher argument");
|
|
1170
|
-
}
|
|
1171
|
-
const producerNode = signal[NODE].producerNode;
|
|
1172
|
-
if (!producerNode)
|
|
1173
|
-
return false;
|
|
1174
|
-
return producerNode.length > 0;
|
|
1018
|
+
html, body {
|
|
1019
|
+
touch-action: pan-x pan-y !important;
|
|
1020
|
+
-ms-touch-action: pan-x pan-y !important;
|
|
1175
1021
|
}
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
node.producerNode = [];
|
|
1191
|
-
this[NODE] = node;
|
|
1192
|
-
}
|
|
1193
|
-
// Add these signals to the Watcher's set, and set the watcher to run its
|
|
1194
|
-
// notify callback next time any signal in the set (or one of its dependencies) changes.
|
|
1195
|
-
// Can be called with no arguments just to reset the "notified" state, so that
|
|
1196
|
-
// the notify callback will be invoked again.
|
|
1197
|
-
watch(...signals) {
|
|
1198
|
-
if (!(0, Signal2.isWatcher)(this)) {
|
|
1199
|
-
throw new TypeError("Called unwatch without Watcher receiver");
|
|
1200
|
-
}
|
|
1201
|
-
__privateMethod(this, _assertSignals, assertSignals_fn).call(this, signals);
|
|
1202
|
-
const node = this[NODE];
|
|
1203
|
-
node.dirty = false;
|
|
1204
|
-
const prev = setActiveConsumer(node);
|
|
1205
|
-
for (const signal of signals) {
|
|
1206
|
-
producerAccessed(signal[NODE]);
|
|
1207
|
-
}
|
|
1208
|
-
setActiveConsumer(prev);
|
|
1022
|
+
`;
|
|
1023
|
+
const existingStyle = document.getElementById("ds-one-applike-style");
|
|
1024
|
+
if (existingStyle) {
|
|
1025
|
+
existingStyle.remove();
|
|
1026
|
+
}
|
|
1027
|
+
document.head.appendChild(style);
|
|
1028
|
+
let lastTouchEnd = 0;
|
|
1029
|
+
let touchStartTime = 0;
|
|
1030
|
+
const preventZoom = (event) => {
|
|
1031
|
+
if (event instanceof TouchEvent) {
|
|
1032
|
+
if (event.touches.length > 1) {
|
|
1033
|
+
event.preventDefault();
|
|
1034
|
+
event.stopPropagation();
|
|
1035
|
+
return;
|
|
1209
1036
|
}
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
if (
|
|
1213
|
-
|
|
1037
|
+
const now = Date.now();
|
|
1038
|
+
if (event.type === "touchstart") {
|
|
1039
|
+
if (now - lastTouchEnd < 300) {
|
|
1040
|
+
event.preventDefault();
|
|
1041
|
+
event.stopPropagation();
|
|
1042
|
+
return;
|
|
1214
1043
|
}
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
node.producerNode[i3] = node.producerNode[lastIdx];
|
|
1223
|
-
node.producerIndexOfThis[i3] = node.producerIndexOfThis[lastIdx];
|
|
1224
|
-
node.producerNode.length--;
|
|
1225
|
-
node.producerIndexOfThis.length--;
|
|
1226
|
-
node.nextProducerIndex--;
|
|
1227
|
-
if (i3 < node.producerNode.length) {
|
|
1228
|
-
const idxConsumer = node.producerIndexOfThis[i3];
|
|
1229
|
-
const producer = node.producerNode[i3];
|
|
1230
|
-
assertProducerNode(producer);
|
|
1231
|
-
producer.liveConsumerIndexOfThis[idxConsumer] = i3;
|
|
1232
|
-
}
|
|
1233
|
-
}
|
|
1044
|
+
touchStartTime = now;
|
|
1045
|
+
} else if (event.type === "touchend") {
|
|
1046
|
+
const touchDuration = now - touchStartTime;
|
|
1047
|
+
if (touchDuration < 300 && now - lastTouchEnd < 300) {
|
|
1048
|
+
event.preventDefault();
|
|
1049
|
+
event.stopPropagation();
|
|
1050
|
+
return;
|
|
1234
1051
|
}
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1052
|
+
lastTouchEnd = now;
|
|
1053
|
+
} else if (event.type === "touchmove") {
|
|
1054
|
+
if (event.touches.length > 1) {
|
|
1055
|
+
event.preventDefault();
|
|
1056
|
+
event.stopPropagation();
|
|
1057
|
+
return;
|
|
1241
1058
|
}
|
|
1242
|
-
const node = this[NODE];
|
|
1243
|
-
return node.producerNode.filter((n3) => n3.dirty).map((n3) => n3.wrapper);
|
|
1244
1059
|
}
|
|
1245
1060
|
}
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
for (const signal of signals) {
|
|
1251
|
-
if (!(0, Signal2.isComputed)(signal) && !(0, Signal2.isState)(signal)) {
|
|
1252
|
-
throw new TypeError("Called watch/unwatch without a Computed or State argument");
|
|
1253
|
-
}
|
|
1254
|
-
}
|
|
1255
|
-
};
|
|
1256
|
-
Signal2.isWatcher = (w) => __privateIn(_brand3, w);
|
|
1257
|
-
subtle2.Watcher = Watcher;
|
|
1258
|
-
function currentComputed() {
|
|
1259
|
-
var _a3;
|
|
1260
|
-
return (_a3 = getActiveConsumer()) == null ? void 0 : _a3.wrapper;
|
|
1061
|
+
if (event instanceof WheelEvent && (event.ctrlKey || event.metaKey)) {
|
|
1062
|
+
event.preventDefault();
|
|
1063
|
+
event.stopPropagation();
|
|
1064
|
+
return;
|
|
1261
1065
|
}
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
}
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1066
|
+
};
|
|
1067
|
+
const options = { passive: false, capture: true };
|
|
1068
|
+
document.addEventListener("touchstart", preventZoom, options);
|
|
1069
|
+
document.addEventListener("touchmove", preventZoom, options);
|
|
1070
|
+
document.addEventListener("touchend", preventZoom, options);
|
|
1071
|
+
document.addEventListener("touchcancel", preventZoom, options);
|
|
1072
|
+
document.addEventListener("wheel", preventZoom, options);
|
|
1073
|
+
document.addEventListener(
|
|
1074
|
+
"gesturestart",
|
|
1075
|
+
(e2) => {
|
|
1076
|
+
e2.preventDefault();
|
|
1077
|
+
e2.stopPropagation();
|
|
1078
|
+
},
|
|
1079
|
+
options
|
|
1080
|
+
);
|
|
1081
|
+
document.addEventListener(
|
|
1082
|
+
"gesturechange",
|
|
1083
|
+
(e2) => {
|
|
1084
|
+
e2.preventDefault();
|
|
1085
|
+
e2.stopPropagation();
|
|
1086
|
+
},
|
|
1087
|
+
options
|
|
1088
|
+
);
|
|
1089
|
+
document.addEventListener(
|
|
1090
|
+
"gestureend",
|
|
1091
|
+
(e2) => {
|
|
1092
|
+
e2.preventDefault();
|
|
1093
|
+
e2.stopPropagation();
|
|
1094
|
+
},
|
|
1095
|
+
options
|
|
1096
|
+
);
|
|
1097
|
+
}
|
|
1098
|
+
let translationKeys = {};
|
|
1099
|
+
const LANGUAGE_PRIORITY_ORDER = [
|
|
1100
|
+
"da",
|
|
1101
|
+
"de",
|
|
1102
|
+
"en",
|
|
1103
|
+
"es",
|
|
1104
|
+
"fr",
|
|
1105
|
+
"it",
|
|
1106
|
+
"ja",
|
|
1107
|
+
"pt",
|
|
1108
|
+
"sv",
|
|
1109
|
+
"zh"
|
|
1110
|
+
];
|
|
1111
|
+
const LANGUAGE_PRIORITY_LOOKUP = new Map(
|
|
1112
|
+
LANGUAGE_PRIORITY_ORDER.map((code, index) => [code, index])
|
|
1113
|
+
);
|
|
1114
|
+
const FALLBACK_LANGUAGE_NAMES = {
|
|
1115
|
+
da: "Danish",
|
|
1116
|
+
"da-dk": "Danish",
|
|
1117
|
+
de: "German",
|
|
1118
|
+
"de-de": "German",
|
|
1119
|
+
en: "English",
|
|
1120
|
+
"en-us": "English",
|
|
1121
|
+
es: "Spanish",
|
|
1122
|
+
"es-es": "Spanish",
|
|
1123
|
+
fr: "French",
|
|
1124
|
+
"fr-fr": "French",
|
|
1125
|
+
it: "Italian",
|
|
1126
|
+
"it-it": "Italian",
|
|
1127
|
+
ja: "Japanese",
|
|
1128
|
+
"ja-jp": "Japanese",
|
|
1129
|
+
pt: "Portuguese",
|
|
1130
|
+
"pt-pt": "Portuguese",
|
|
1131
|
+
sv: "Swedish",
|
|
1132
|
+
"sv-se": "Swedish",
|
|
1133
|
+
zh: "Chinese",
|
|
1134
|
+
"zh-cn": "Chinese",
|
|
1135
|
+
"zh-tw": "Chinese",
|
|
1136
|
+
"zh-hans": "Chinese",
|
|
1137
|
+
"zh-hant": "Chinese"
|
|
1138
|
+
};
|
|
1139
|
+
const DISPLAY_NAME_CACHE = /* @__PURE__ */ new Map();
|
|
1140
|
+
let displayNameFallbackWarningShown = false;
|
|
1141
|
+
const DEFAULT_TRANSLATION_FILE = "./translations.json";
|
|
1142
|
+
let loadAttempted = false;
|
|
1143
|
+
function normalizeCandidate(path) {
|
|
1144
|
+
if (!path) {
|
|
1145
|
+
return null;
|
|
1283
1146
|
}
|
|
1284
|
-
|
|
1285
|
-
|
|
1147
|
+
const trimmed = path.trim();
|
|
1148
|
+
if (!trimmed) {
|
|
1149
|
+
return null;
|
|
1286
1150
|
}
|
|
1287
|
-
|
|
1288
|
-
|
|
1151
|
+
if (trimmed.startsWith("./") || trimmed.startsWith("../") || trimmed.startsWith("/") || /^https?:\/\//i.test(trimmed)) {
|
|
1152
|
+
return trimmed;
|
|
1289
1153
|
}
|
|
1290
|
-
|
|
1291
|
-
|
|
1154
|
+
return `./${trimmed}`;
|
|
1155
|
+
}
|
|
1156
|
+
function findAttributeCandidate() {
|
|
1157
|
+
if (typeof document === "undefined") {
|
|
1158
|
+
return null;
|
|
1292
1159
|
}
|
|
1293
|
-
|
|
1294
|
-
|
|
1160
|
+
const scriptWithAttribute = document.querySelector(
|
|
1161
|
+
"script[data-ds-one-translations]"
|
|
1162
|
+
);
|
|
1163
|
+
const scriptCandidate = scriptWithAttribute?.getAttribute(
|
|
1164
|
+
"data-ds-one-translations"
|
|
1165
|
+
);
|
|
1166
|
+
if (scriptCandidate) {
|
|
1167
|
+
return scriptCandidate;
|
|
1295
1168
|
}
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
if (!a$1(t2) || !t2.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
1306
|
-
return void 0 !== s$2 ? s$2.createHTML(i3) : i3;
|
|
1169
|
+
const metaCandidate = document.querySelector('meta[name="ds-one:translations"]')?.getAttribute("content");
|
|
1170
|
+
if (metaCandidate) {
|
|
1171
|
+
return metaCandidate;
|
|
1172
|
+
}
|
|
1173
|
+
const linkCandidate = document.querySelector('link[rel="ds-one-translations"]')?.getAttribute("href");
|
|
1174
|
+
if (linkCandidate) {
|
|
1175
|
+
return linkCandidate;
|
|
1176
|
+
}
|
|
1177
|
+
return null;
|
|
1307
1178
|
}
|
|
1308
|
-
|
|
1309
|
-
const
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
const x2 = c2 === m && t2[i4 + 1].startsWith("/>") ? " " : "";
|
|
1316
|
-
l2 += c2 === f$1 ? s3 + n$2 : d2 >= 0 ? (o2.push(a2), s3.slice(0, d2) + e$3 + s3.slice(d2) + h$1 + x2) : s3 + h$1 + (-2 === d2 ? i4 : x2);
|
|
1179
|
+
function resolveTranslationSources() {
|
|
1180
|
+
const candidates = [];
|
|
1181
|
+
const windowCandidate = typeof window !== "undefined" ? window.DS_ONE_TRANSLATIONS_FILE : null;
|
|
1182
|
+
const attributeCandidate = findAttributeCandidate();
|
|
1183
|
+
const windowNormalized = normalizeCandidate(windowCandidate ?? "");
|
|
1184
|
+
if (windowNormalized) {
|
|
1185
|
+
candidates.push(windowNormalized);
|
|
1317
1186
|
}
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1187
|
+
const attrNormalized = normalizeCandidate(attributeCandidate ?? "");
|
|
1188
|
+
if (attrNormalized && !candidates.includes(attrNormalized)) {
|
|
1189
|
+
candidates.push(attrNormalized);
|
|
1190
|
+
}
|
|
1191
|
+
if (candidates.length === 0) {
|
|
1192
|
+
candidates.push(DEFAULT_TRANSLATION_FILE);
|
|
1193
|
+
}
|
|
1194
|
+
return candidates;
|
|
1195
|
+
}
|
|
1196
|
+
function validateTranslationMap(candidate) {
|
|
1197
|
+
if (!candidate || typeof candidate !== "object") {
|
|
1198
|
+
return false;
|
|
1199
|
+
}
|
|
1200
|
+
return Object.values(candidate).every(
|
|
1201
|
+
(entry) => entry && typeof entry === "object"
|
|
1202
|
+
);
|
|
1203
|
+
}
|
|
1204
|
+
async function fetchTranslationFile(source) {
|
|
1205
|
+
try {
|
|
1206
|
+
const response = await fetch(source);
|
|
1207
|
+
if (!response.ok) {
|
|
1208
|
+
return null;
|
|
1329
1209
|
}
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
if ($.test(r2.tagName)) {
|
|
1337
|
-
const t3 = r2.textContent.split(h$1), s3 = t3.length - 1;
|
|
1338
|
-
if (s3 > 0) {
|
|
1339
|
-
r2.textContent = i$3 ? i$3.emptyScript : "";
|
|
1340
|
-
for (let i3 = 0; i3 < s3; i3++) r2.append(t3[i3], l$1()), C.nextNode(), d2.push({ type: 2, index: ++c2 });
|
|
1341
|
-
r2.append(t3[s3], l$1());
|
|
1342
|
-
}
|
|
1343
|
-
}
|
|
1344
|
-
} else if (8 === r2.nodeType) if (r2.data === o$4) d2.push({ type: 2, index: c2 });
|
|
1345
|
-
else {
|
|
1346
|
-
let t3 = -1;
|
|
1347
|
-
for (; -1 !== (t3 = r2.data.indexOf(h$1, t3 + 1)); ) d2.push({ type: 7, index: c2 }), t3 += h$1.length - 1;
|
|
1348
|
-
}
|
|
1349
|
-
c2++;
|
|
1210
|
+
const translations = await response.json();
|
|
1211
|
+
if (!validateTranslationMap(translations)) {
|
|
1212
|
+
console.warn(
|
|
1213
|
+
`[DS one] Invalid translation format in ${source}. Expected object with language codes as keys.`
|
|
1214
|
+
);
|
|
1215
|
+
return null;
|
|
1350
1216
|
}
|
|
1217
|
+
const languages = Object.keys(translations);
|
|
1218
|
+
if (languages.length === 0) {
|
|
1219
|
+
console.warn(`[DS one] No languages found in ${source}`);
|
|
1220
|
+
return null;
|
|
1221
|
+
}
|
|
1222
|
+
return translations;
|
|
1223
|
+
} catch {
|
|
1224
|
+
return null;
|
|
1351
1225
|
}
|
|
1352
|
-
static createElement(t2, i3) {
|
|
1353
|
-
const s2 = r$3.createElement("template");
|
|
1354
|
-
return s2.innerHTML = t2, s2;
|
|
1355
|
-
}
|
|
1356
|
-
}
|
|
1357
|
-
function S$1(t2, i3, s2 = t2, e2) {
|
|
1358
|
-
if (i3 === T) return i3;
|
|
1359
|
-
let h2 = void 0 !== e2 ? s2._$Co?.[e2] : s2._$Cl;
|
|
1360
|
-
const o2 = c$2(i3) ? void 0 : i3._$litDirective$;
|
|
1361
|
-
return h2?.constructor !== o2 && (h2?._$AO?.(false), void 0 === o2 ? h2 = void 0 : (h2 = new o2(t2), h2._$AT(t2, s2, e2)), void 0 !== e2 ? (s2._$Co ?? (s2._$Co = []))[e2] = h2 : s2._$Cl = h2), void 0 !== h2 && (i3 = S$1(t2, h2._$AS(t2, i3.values), h2, e2)), i3;
|
|
1362
1226
|
}
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1227
|
+
async function loadExternalTranslations() {
|
|
1228
|
+
if (loadAttempted) {
|
|
1229
|
+
return false;
|
|
1366
1230
|
}
|
|
1367
|
-
|
|
1368
|
-
|
|
1231
|
+
loadAttempted = true;
|
|
1232
|
+
if (typeof window === "undefined") {
|
|
1233
|
+
return false;
|
|
1369
1234
|
}
|
|
1370
|
-
|
|
1371
|
-
|
|
1235
|
+
if (window.DS_ONE_TRANSLATIONS && Object.keys(window.DS_ONE_TRANSLATIONS).length > 0) {
|
|
1236
|
+
console.log(
|
|
1237
|
+
`[DS one] Translations already loaded (${Object.keys(window.DS_ONE_TRANSLATIONS).length} languages), skipping auto-load`
|
|
1238
|
+
);
|
|
1239
|
+
return true;
|
|
1372
1240
|
}
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
if (o2 === l2.index) {
|
|
1379
|
-
let i4;
|
|
1380
|
-
2 === l2.type ? i4 = new R(h2, h2.nextSibling, this, t2) : 1 === l2.type ? i4 = new l2.ctor(h2, l2.name, l2.strings, this, t2) : 6 === l2.type && (i4 = new z(h2, this, t2)), this._$AV.push(i4), l2 = s2[++n3];
|
|
1381
|
-
}
|
|
1382
|
-
o2 !== l2?.index && (h2 = C.nextNode(), o2++);
|
|
1241
|
+
const sources = resolveTranslationSources();
|
|
1242
|
+
for (const source of sources) {
|
|
1243
|
+
const translations = await fetchTranslationFile(source);
|
|
1244
|
+
if (!translations) {
|
|
1245
|
+
continue;
|
|
1383
1246
|
}
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1247
|
+
window.DS_ONE_TRANSLATIONS = translations;
|
|
1248
|
+
const languages = Object.keys(translations);
|
|
1249
|
+
console.log(
|
|
1250
|
+
`[DS one] External translations loaded from ${source}: ${languages.length} language(s) – ${languages.join(", ")}`
|
|
1251
|
+
);
|
|
1252
|
+
window.dispatchEvent(new CustomEvent("translations-ready"));
|
|
1253
|
+
return true;
|
|
1389
1254
|
}
|
|
1255
|
+
console.info(
|
|
1256
|
+
`[DS one] No external translations found at ${sources[0] ?? DEFAULT_TRANSLATION_FILE}. Using bundled translations.`
|
|
1257
|
+
);
|
|
1258
|
+
return false;
|
|
1390
1259
|
}
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
return
|
|
1394
|
-
}
|
|
1395
|
-
constructor(t2, i3, s2, e2) {
|
|
1396
|
-
this.type = 2, this._$AH = E, this._$AN = void 0, this._$AA = t2, this._$AB = i3, this._$AM = s2, this.options = e2, this._$Cv = e2?.isConnected ?? true;
|
|
1260
|
+
function getTranslationData() {
|
|
1261
|
+
if (typeof window !== "undefined" && window.DS_ONE_TRANSLATIONS) {
|
|
1262
|
+
return window.DS_ONE_TRANSLATIONS;
|
|
1397
1263
|
}
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1264
|
+
return translationKeys;
|
|
1265
|
+
}
|
|
1266
|
+
let translationData = getTranslationData();
|
|
1267
|
+
const defaultLanguage = "en";
|
|
1268
|
+
function extractPrimarySubtag(code) {
|
|
1269
|
+
if (!code) {
|
|
1270
|
+
return "";
|
|
1402
1271
|
}
|
|
1403
|
-
|
|
1404
|
-
|
|
1272
|
+
return code.toLowerCase().split(/[-_]/)[0] ?? "";
|
|
1273
|
+
}
|
|
1274
|
+
function getLanguagePriority(code) {
|
|
1275
|
+
const primary = extractPrimarySubtag(code);
|
|
1276
|
+
const priority = LANGUAGE_PRIORITY_LOOKUP.get(primary);
|
|
1277
|
+
if (typeof priority === "number") {
|
|
1278
|
+
return priority;
|
|
1405
1279
|
}
|
|
1406
|
-
|
|
1407
|
-
|
|
1280
|
+
return LANGUAGE_PRIORITY_ORDER.length;
|
|
1281
|
+
}
|
|
1282
|
+
function sortLanguageCodes(codes) {
|
|
1283
|
+
return [...codes].sort((a2, b2) => {
|
|
1284
|
+
const priorityA = getLanguagePriority(a2);
|
|
1285
|
+
const priorityB = getLanguagePriority(b2);
|
|
1286
|
+
if (priorityA !== priorityB) {
|
|
1287
|
+
return priorityA - priorityB;
|
|
1288
|
+
}
|
|
1289
|
+
return a2.localeCompare(b2);
|
|
1290
|
+
});
|
|
1291
|
+
}
|
|
1292
|
+
function getDisplayNameForLocale(locale, code) {
|
|
1293
|
+
const normalizedLocale = locale?.replace("_", "-");
|
|
1294
|
+
if (!normalizedLocale) {
|
|
1295
|
+
return void 0;
|
|
1408
1296
|
}
|
|
1409
|
-
|
|
1410
|
-
|
|
1297
|
+
try {
|
|
1298
|
+
let displayNames = DISPLAY_NAME_CACHE.get(normalizedLocale);
|
|
1299
|
+
if (!displayNames) {
|
|
1300
|
+
displayNames = new Intl.DisplayNames([normalizedLocale], {
|
|
1301
|
+
type: "language"
|
|
1302
|
+
});
|
|
1303
|
+
DISPLAY_NAME_CACHE.set(normalizedLocale, displayNames);
|
|
1304
|
+
}
|
|
1305
|
+
const cleanedCode = code.replace("_", "-");
|
|
1306
|
+
const fullMatch = displayNames.of(cleanedCode);
|
|
1307
|
+
if (fullMatch && fullMatch !== cleanedCode) {
|
|
1308
|
+
return fullMatch;
|
|
1309
|
+
}
|
|
1310
|
+
const baseMatch = displayNames.of(extractPrimarySubtag(cleanedCode));
|
|
1311
|
+
if (baseMatch) {
|
|
1312
|
+
return baseMatch;
|
|
1313
|
+
}
|
|
1314
|
+
} catch (error) {
|
|
1315
|
+
if (!displayNameFallbackWarningShown) {
|
|
1316
|
+
console.info(
|
|
1317
|
+
"[DS one] Intl.DisplayNames is not available, using fallback language names."
|
|
1318
|
+
);
|
|
1319
|
+
displayNameFallbackWarningShown = true;
|
|
1320
|
+
}
|
|
1411
1321
|
}
|
|
1412
|
-
|
|
1413
|
-
|
|
1322
|
+
return void 0;
|
|
1323
|
+
}
|
|
1324
|
+
function getFallbackDisplayName(code) {
|
|
1325
|
+
const normalized = code.toLowerCase().replace("_", "-");
|
|
1326
|
+
const direct = FALLBACK_LANGUAGE_NAMES[normalized];
|
|
1327
|
+
if (direct) {
|
|
1328
|
+
return direct;
|
|
1414
1329
|
}
|
|
1415
|
-
|
|
1416
|
-
|
|
1330
|
+
const primary = extractPrimarySubtag(normalized);
|
|
1331
|
+
return FALLBACK_LANGUAGE_NAMES[primary];
|
|
1332
|
+
}
|
|
1333
|
+
function getLanguageDisplayName(code, options = {}) {
|
|
1334
|
+
if (!code) {
|
|
1335
|
+
return "";
|
|
1417
1336
|
}
|
|
1418
|
-
|
|
1419
|
-
|
|
1337
|
+
const localesToTry = [];
|
|
1338
|
+
if (options.locale) {
|
|
1339
|
+
localesToTry.push(options.locale);
|
|
1420
1340
|
}
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1341
|
+
if (typeof navigator !== "undefined") {
|
|
1342
|
+
if (Array.isArray(navigator.languages)) {
|
|
1343
|
+
localesToTry.push(...navigator.languages);
|
|
1344
|
+
}
|
|
1345
|
+
if (navigator.language) {
|
|
1346
|
+
localesToTry.push(navigator.language);
|
|
1427
1347
|
}
|
|
1428
1348
|
}
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
_$AR(t2 = this._$AA.nextSibling, i3) {
|
|
1441
|
-
for (this._$AP?.(false, true, i3); t2 !== this._$AB; ) {
|
|
1442
|
-
const i4 = t2.nextSibling;
|
|
1443
|
-
t2.remove(), t2 = i4;
|
|
1349
|
+
localesToTry.push(defaultLanguage);
|
|
1350
|
+
localesToTry.push("en");
|
|
1351
|
+
const tried = /* @__PURE__ */ new Set();
|
|
1352
|
+
for (const locale of localesToTry) {
|
|
1353
|
+
if (!locale || tried.has(locale)) {
|
|
1354
|
+
continue;
|
|
1355
|
+
}
|
|
1356
|
+
tried.add(locale);
|
|
1357
|
+
const displayName = getDisplayNameForLocale(locale, code);
|
|
1358
|
+
if (displayName) {
|
|
1359
|
+
return displayName;
|
|
1444
1360
|
}
|
|
1445
1361
|
}
|
|
1446
|
-
|
|
1447
|
-
|
|
1362
|
+
const fallback = getFallbackDisplayName(code);
|
|
1363
|
+
if (fallback) {
|
|
1364
|
+
return fallback;
|
|
1448
1365
|
}
|
|
1366
|
+
const primary = extractPrimarySubtag(code);
|
|
1367
|
+
return primary ? primary.toUpperCase() : code;
|
|
1449
1368
|
}
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1369
|
+
const BROWSER_LANGUAGE_PREFERENCES = {
|
|
1370
|
+
da: "da",
|
|
1371
|
+
"da-dk": "da",
|
|
1372
|
+
de: "de",
|
|
1373
|
+
"de-de": "de",
|
|
1374
|
+
en: "en",
|
|
1375
|
+
"en-us": "en",
|
|
1376
|
+
"en-gb": "en",
|
|
1377
|
+
es: "es",
|
|
1378
|
+
"es-es": "es",
|
|
1379
|
+
"es-mx": "es",
|
|
1380
|
+
fr: "fr",
|
|
1381
|
+
"fr-fr": "fr",
|
|
1382
|
+
it: "it",
|
|
1383
|
+
"it-it": "it",
|
|
1384
|
+
ja: "ja",
|
|
1385
|
+
"ja-jp": "ja",
|
|
1386
|
+
pt: "pt",
|
|
1387
|
+
"pt-pt": "pt",
|
|
1388
|
+
"pt-br": "pt",
|
|
1389
|
+
sv: "sv",
|
|
1390
|
+
"sv-se": "sv",
|
|
1391
|
+
zh: "zh",
|
|
1392
|
+
"zh-cn": "zh",
|
|
1393
|
+
"zh-hans": "zh",
|
|
1394
|
+
"zh-tw": "zh",
|
|
1395
|
+
"zh-hant": "zh"
|
|
1396
|
+
};
|
|
1397
|
+
function resolvePreferredLanguage(languageTag) {
|
|
1398
|
+
if (!languageTag) {
|
|
1399
|
+
return null;
|
|
1459
1400
|
}
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
else {
|
|
1465
|
-
const e3 = t2;
|
|
1466
|
-
let n3, r2;
|
|
1467
|
-
for (t2 = h2[0], n3 = 0; n3 < h2.length - 1; n3++) r2 = S$1(this, e3[s2 + n3], i3, n3), r2 === T && (r2 = this._$AH[n3]), o2 || (o2 = !c$2(r2) || r2 !== this._$AH[n3]), r2 === E ? t2 = E : t2 !== E && (t2 += (r2 ?? "") + h2[n3 + 1]), this._$AH[n3] = r2;
|
|
1468
|
-
}
|
|
1469
|
-
o2 && !e2 && this.j(t2);
|
|
1401
|
+
const normalized = languageTag.toLowerCase().replace("_", "-");
|
|
1402
|
+
const directMatch = BROWSER_LANGUAGE_PREFERENCES[normalized];
|
|
1403
|
+
if (directMatch) {
|
|
1404
|
+
return directMatch;
|
|
1470
1405
|
}
|
|
1471
|
-
|
|
1472
|
-
|
|
1406
|
+
const primary = extractPrimarySubtag(normalized);
|
|
1407
|
+
const primaryMatch = BROWSER_LANGUAGE_PREFERENCES[primary];
|
|
1408
|
+
if (primaryMatch) {
|
|
1409
|
+
return primaryMatch;
|
|
1473
1410
|
}
|
|
1411
|
+
return languageTag;
|
|
1474
1412
|
}
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1413
|
+
function getBrowserLanguage() {
|
|
1414
|
+
if (typeof navigator === "undefined") {
|
|
1415
|
+
return defaultLanguage;
|
|
1478
1416
|
}
|
|
1479
|
-
|
|
1480
|
-
|
|
1417
|
+
const browserLang = navigator.language;
|
|
1418
|
+
if (browserLang) {
|
|
1419
|
+
const resolved = resolvePreferredLanguage(browserLang);
|
|
1420
|
+
if (resolved) {
|
|
1421
|
+
return resolved;
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
if (Array.isArray(navigator.languages)) {
|
|
1425
|
+
for (const candidate of navigator.languages) {
|
|
1426
|
+
const resolved = resolvePreferredLanguage(candidate);
|
|
1427
|
+
if (resolved) {
|
|
1428
|
+
return resolved;
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1481
1431
|
}
|
|
1432
|
+
return defaultLanguage;
|
|
1482
1433
|
}
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1434
|
+
typeof window !== "undefined" ? window.localStorage?.getItem(
|
|
1435
|
+
"ds-one:language"
|
|
1436
|
+
) ?? void 0 : void 0;
|
|
1437
|
+
const currentLanguage = {
|
|
1438
|
+
value: localStorage.getItem("language") || getBrowserLanguage(),
|
|
1439
|
+
set: function(lang) {
|
|
1440
|
+
this.value = lang;
|
|
1441
|
+
localStorage.setItem("language", lang);
|
|
1442
|
+
window.dispatchEvent(
|
|
1443
|
+
new CustomEvent("language-changed", {
|
|
1444
|
+
detail: { language: lang },
|
|
1445
|
+
bubbles: true,
|
|
1446
|
+
composed: true
|
|
1447
|
+
})
|
|
1448
|
+
);
|
|
1486
1449
|
}
|
|
1487
|
-
|
|
1488
|
-
|
|
1450
|
+
};
|
|
1451
|
+
if (typeof window !== "undefined") {
|
|
1452
|
+
if (document.readyState === "loading") {
|
|
1453
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
1454
|
+
loadExternalTranslations();
|
|
1455
|
+
});
|
|
1456
|
+
} else {
|
|
1457
|
+
loadExternalTranslations();
|
|
1489
1458
|
}
|
|
1490
1459
|
}
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1460
|
+
if (typeof window !== "undefined") {
|
|
1461
|
+
window.addEventListener("translations-ready", () => {
|
|
1462
|
+
translationData = getTranslationData();
|
|
1463
|
+
window.dispatchEvent(new CustomEvent("translations-loaded"));
|
|
1464
|
+
const currentLang = currentLanguage.value;
|
|
1465
|
+
window.dispatchEvent(
|
|
1466
|
+
new CustomEvent("language-changed", {
|
|
1467
|
+
detail: { language: currentLang },
|
|
1468
|
+
bubbles: true,
|
|
1469
|
+
composed: true
|
|
1470
|
+
})
|
|
1471
|
+
);
|
|
1472
|
+
});
|
|
1473
|
+
}
|
|
1474
|
+
setTimeout(() => {
|
|
1475
|
+
window.dispatchEvent(new CustomEvent("translations-loaded"));
|
|
1476
|
+
const currentLang = currentLanguage.value;
|
|
1477
|
+
window.dispatchEvent(
|
|
1478
|
+
new CustomEvent("language-changed", {
|
|
1479
|
+
detail: { language: currentLang },
|
|
1480
|
+
bubbles: true,
|
|
1481
|
+
composed: true
|
|
1482
|
+
})
|
|
1483
|
+
);
|
|
1484
|
+
}, 100);
|
|
1485
|
+
function translate(key) {
|
|
1486
|
+
const lang = currentLanguage.value;
|
|
1487
|
+
if (translationData?.[lang]?.[key]) {
|
|
1488
|
+
return translationData[lang][key];
|
|
1499
1489
|
}
|
|
1500
|
-
|
|
1501
|
-
|
|
1490
|
+
if (lang !== defaultLanguage && translationData?.[defaultLanguage]?.[key]) {
|
|
1491
|
+
return translationData[defaultLanguage][key];
|
|
1502
1492
|
}
|
|
1493
|
+
console.warn(
|
|
1494
|
+
`[DS one (Internationalization)] No translation found for key "${key}"`
|
|
1495
|
+
);
|
|
1496
|
+
return key;
|
|
1503
1497
|
}
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1498
|
+
function hasTranslation(key, language = currentLanguage.value) {
|
|
1499
|
+
if (!key) {
|
|
1500
|
+
return false;
|
|
1507
1501
|
}
|
|
1508
|
-
|
|
1509
|
-
|
|
1502
|
+
const langData = translationData?.[language];
|
|
1503
|
+
if (langData && Object.prototype.hasOwnProperty.call(langData, key)) {
|
|
1504
|
+
return true;
|
|
1510
1505
|
}
|
|
1511
|
-
|
|
1512
|
-
|
|
1506
|
+
if (language !== defaultLanguage && translationData?.[defaultLanguage] && Object.prototype.hasOwnProperty.call(translationData[defaultLanguage], key)) {
|
|
1507
|
+
return true;
|
|
1513
1508
|
}
|
|
1509
|
+
return false;
|
|
1514
1510
|
}
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
const B = (t2, i3, s2) => {
|
|
1518
|
-
const e2 = s2?.renderBefore ?? i3;
|
|
1519
|
-
let h2 = e2._$litPart$;
|
|
1520
|
-
if (void 0 === h2) {
|
|
1521
|
-
const t3 = s2?.renderBefore ?? null;
|
|
1522
|
-
e2._$litPart$ = h2 = new R(i3.insertBefore(l$1(), t3), t3, void 0, s2 ?? {});
|
|
1523
|
-
}
|
|
1524
|
-
return h2._$AI(t2), h2;
|
|
1525
|
-
};
|
|
1526
|
-
/**
|
|
1527
|
-
* @license
|
|
1528
|
-
* Copyright 2023 Google LLC
|
|
1529
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
1530
|
-
*/
|
|
1531
|
-
Signal.State;
|
|
1532
|
-
Signal.Computed;
|
|
1533
|
-
const r$2 = (l2, o2) => new Signal.State(l2, o2);
|
|
1534
|
-
const defaultConfig = {
|
|
1535
|
-
mode: "auto",
|
|
1536
|
-
baseWidth: 280,
|
|
1537
|
-
minScale: 0.75,
|
|
1538
|
-
maxScale: 2
|
|
1539
|
-
};
|
|
1540
|
-
const scalingFactor = r$2(1);
|
|
1541
|
-
const scalingConfig = r$2(defaultConfig);
|
|
1542
|
-
function calculateScalingFactor(viewportWidth, config = scalingConfig.get()) {
|
|
1543
|
-
if (config.mode === "fixed") {
|
|
1544
|
-
return 1;
|
|
1545
|
-
}
|
|
1546
|
-
const rawScale = viewportWidth / config.baseWidth;
|
|
1547
|
-
const clampedScale = Math.max(
|
|
1548
|
-
config.minScale,
|
|
1549
|
-
Math.min(config.maxScale, rawScale)
|
|
1550
|
-
);
|
|
1551
|
-
return Number(clampedScale.toFixed(3));
|
|
1511
|
+
function getText(key) {
|
|
1512
|
+
return translate(key);
|
|
1552
1513
|
}
|
|
1553
|
-
function
|
|
1554
|
-
const
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
updateScalingFactor();
|
|
1514
|
+
function getAvailableLanguages() {
|
|
1515
|
+
const currentData = getTranslationData();
|
|
1516
|
+
if (currentData && Object.keys(currentData).length > 0) {
|
|
1517
|
+
const languages = Object.keys(currentData);
|
|
1518
|
+
return Promise.resolve(sortLanguageCodes(languages));
|
|
1559
1519
|
}
|
|
1520
|
+
return Promise.resolve([defaultLanguage]);
|
|
1560
1521
|
}
|
|
1561
|
-
function
|
|
1562
|
-
|
|
1563
|
-
|
|
1522
|
+
function getAvailableLanguagesSync() {
|
|
1523
|
+
const currentData = getTranslationData();
|
|
1524
|
+
if (currentData && Object.keys(currentData).length > 0) {
|
|
1525
|
+
return sortLanguageCodes(Object.keys(currentData));
|
|
1564
1526
|
}
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1527
|
+
return [defaultLanguage];
|
|
1528
|
+
}
|
|
1529
|
+
function loadTranslations(language, translations) {
|
|
1530
|
+
console.log(
|
|
1531
|
+
`Loading additional translations for ${language}:`,
|
|
1532
|
+
Object.keys(translations).length,
|
|
1533
|
+
"keys"
|
|
1534
|
+
);
|
|
1535
|
+
}
|
|
1536
|
+
function setLanguage(language) {
|
|
1537
|
+
localStorage.setItem("language", language);
|
|
1538
|
+
currentLanguage.set(language);
|
|
1570
1539
|
window.dispatchEvent(
|
|
1571
|
-
new CustomEvent("
|
|
1572
|
-
detail: {
|
|
1540
|
+
new CustomEvent("language-changed", {
|
|
1541
|
+
detail: { language },
|
|
1542
|
+
bubbles: true,
|
|
1543
|
+
composed: true
|
|
1573
1544
|
})
|
|
1574
1545
|
);
|
|
1575
1546
|
}
|
|
1576
|
-
function
|
|
1577
|
-
return scalingFactor.get();
|
|
1578
|
-
}
|
|
1579
|
-
function scale(designPx) {
|
|
1580
|
-
return designPx * scalingFactor.get();
|
|
1581
|
-
}
|
|
1582
|
-
function unscale(scaledPx) {
|
|
1583
|
-
const factor = scalingFactor.get();
|
|
1584
|
-
return factor === 0 ? scaledPx : scaledPx / factor;
|
|
1585
|
-
}
|
|
1586
|
-
function initScaling() {
|
|
1547
|
+
function savePreferences(preferences) {
|
|
1587
1548
|
if (typeof window === "undefined") {
|
|
1588
1549
|
return;
|
|
1589
1550
|
}
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
}
|
|
1598
|
-
window.addEventListener("orientationchange", () => {
|
|
1599
|
-
setTimeout(updateScalingFactor, 100);
|
|
1600
|
-
});
|
|
1551
|
+
try {
|
|
1552
|
+
const raw = window.localStorage?.getItem("ds-one:preferences");
|
|
1553
|
+
const existing = raw ? JSON.parse(raw) : {};
|
|
1554
|
+
const next = { ...existing, ...preferences };
|
|
1555
|
+
window.localStorage?.setItem("ds-one:preferences", JSON.stringify(next));
|
|
1556
|
+
} catch (error) {
|
|
1557
|
+
console.warn("ds-one: unable to persist preferences", error);
|
|
1558
|
+
}
|
|
1601
1559
|
}
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1560
|
+
const PRICE_LABELS = {
|
|
1561
|
+
da: "kr.",
|
|
1562
|
+
nb: "kr.",
|
|
1563
|
+
sv: "kr.",
|
|
1564
|
+
de: "€",
|
|
1565
|
+
en: "$",
|
|
1566
|
+
pt: "€",
|
|
1567
|
+
es: "€",
|
|
1568
|
+
zh: "¥",
|
|
1569
|
+
ja: "¥",
|
|
1570
|
+
ko: "₩"
|
|
1571
|
+
};
|
|
1572
|
+
function getPriceLabel(options) {
|
|
1573
|
+
const { language, country } = options;
|
|
1574
|
+
if (country) {
|
|
1575
|
+
const countryUpper = country.toUpperCase();
|
|
1576
|
+
if (countryUpper === "US" || countryUpper === "USA") {
|
|
1577
|
+
return "$";
|
|
1578
|
+
}
|
|
1579
|
+
if (countryUpper === "GB" || countryUpper === "UK") {
|
|
1580
|
+
return "£";
|
|
1581
|
+
}
|
|
1582
|
+
if (countryUpper === "JP" || countryUpper === "JPN") {
|
|
1583
|
+
return "¥";
|
|
1584
|
+
}
|
|
1585
|
+
if (countryUpper === "CN" || countryUpper === "CHN") {
|
|
1586
|
+
return "¥";
|
|
1587
|
+
}
|
|
1588
|
+
if (countryUpper === "KR" || countryUpper === "KOR") {
|
|
1589
|
+
return "₩";
|
|
1590
|
+
}
|
|
1607
1591
|
}
|
|
1592
|
+
const primaryLang = language.toLowerCase().split(/[-_]/)[0];
|
|
1593
|
+
return PRICE_LABELS[primaryLang] || "$";
|
|
1608
1594
|
}
|
|
1609
1595
|
function getInitialTheme() {
|
|
1610
1596
|
if (typeof window === "undefined") {
|
|
@@ -4723,7 +4709,6 @@ export {
|
|
|
4723
4709
|
getText,
|
|
4724
4710
|
hasTranslation,
|
|
4725
4711
|
initDeviceDetection,
|
|
4726
|
-
initScaling,
|
|
4727
4712
|
loadTranslations,
|
|
4728
4713
|
savePreferences,
|
|
4729
4714
|
scale,
|