@orangelogic/design-system 4.28.0 → 4.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/library/chunks/{asset-link-format.BEJh0Fqs.js → asset-link-format.DLmg4fTR.js} +387 -381
  2. package/library/chunks/{audio.BZJvTs_4.js → audio.BVQX3_8E.js} +6 -3
  3. package/library/chunks/{bicolor-picker.C0PxxFzf.js → bicolor-picker.C9XSuhnX.js} +1 -1
  4. package/library/chunks/{block-width.CU2PEBrV.js → block-width.rWsXJkoW.js} +553 -529
  5. package/library/chunks/{border-input-group.w-T10AEY.js → border-input-group.DESRXoh1.js} +1 -1
  6. package/library/chunks/{color-picker.CDUhOLEs.js → color-picker.DUEghDon.js} +2 -2
  7. package/library/chunks/{color-swatch-group.DUskDB_p.js → color-swatch-group.Cf9NcMte.js} +45 -45
  8. package/library/chunks/{config-manager.C9OGzzbe.js → config-manager.FRWbPVTc.js} +17 -17
  9. package/library/chunks/{configs-controller.D3dYYbfz.js → configs-controller.R67BMWep.js} +26 -26
  10. package/library/chunks/{document-viewer.C7WOv7ns.js → document-viewer.DZp_IRF7.js} +16 -7
  11. package/library/chunks/{file-on-demand.DUWFRJnE.js → file-on-demand.C_2vBGS3.js} +3 -3
  12. package/library/chunks/{header.qIpzHeNc.js → header.BaWpIXRz.js} +5 -5
  13. package/library/chunks/{image.DzFSYcXq.js → image.BD0t8XU4.js} +1 -1
  14. package/library/chunks/{masonry.D7YK0FcU.js → masonry.B3G5f-eL.js} +1 -1
  15. package/library/chunks/{shadow-input-group.C9DU0Ehy.js → shadow-input-group.CFb61kzG.js} +1 -1
  16. package/library/chunks/src.DKYroWZc.js +720 -0
  17. package/library/chunks/{src.QS2741a8.js → src.fDrPRx_j.js} +8 -8
  18. package/library/chunks/{tab-group.DP9EvXFy.js → tab-group.oiueox5q.js} +627 -627
  19. package/library/chunks/{tab.C2OFvGGj.js → tab.Dd0cNxxc.js} +12 -8
  20. package/library/chunks/{url.CZO_DV8Y.js → url.BCc06dE7.js} +15 -6
  21. package/library/chunks/{video.BHfy8igQ.js → video.Ba5xl_3K.js} +1 -1
  22. package/library/components/asset-link-format.js +1 -1
  23. package/library/components/atoms.js +9 -9
  24. package/library/components/audio.js +1 -1
  25. package/library/components/bicolor-picker.js +1 -1
  26. package/library/components/border-input-group.js +1 -1
  27. package/library/components/color-picker.js +1 -1
  28. package/library/components/color-swatch-group.js +1 -1
  29. package/library/components/document-viewer.js +1 -1
  30. package/library/components/file-on-demand.js +1 -1
  31. package/library/components/header.js +1 -1
  32. package/library/components/image.js +1 -1
  33. package/library/components/masonry.js +1 -1
  34. package/library/components/molecules.js +4 -4
  35. package/library/components/organisms.js +3 -3
  36. package/library/components/shadow-input-group.js +1 -1
  37. package/library/components/tab-group.js +1 -1
  38. package/library/components/tab.js +1 -1
  39. package/library/components/types.js +12189 -12008
  40. package/library/components/video.js +1 -1
  41. package/library/package.json +1 -1
  42. package/library/packages/atoms/src/components/audio/audio.d.ts +2 -0
  43. package/library/packages/atoms/src/components/document-viewer/document-viewer.d.ts +6 -0
  44. package/library/packages/atoms/src/components/tab-group/tab-group.d.ts +65 -7
  45. package/library/packages/events/src/events.d.ts +0 -4
  46. package/library/packages/hybrid/rich-text/src/rich-text.d.ts +9 -0
  47. package/library/packages/organisms/src/content-builder/blocks/audio/audio.d.ts +13 -0
  48. package/library/packages/organisms/src/content-builder/blocks/button/button.d.ts +8 -0
  49. package/library/packages/organisms/src/content-builder/blocks/column/column.d.ts +5 -0
  50. package/library/packages/organisms/src/content-builder/blocks/column-group/column-group.d.ts +5 -0
  51. package/library/packages/organisms/src/content-builder/blocks/document-viewer/document-viewer.d.ts +8 -0
  52. package/library/packages/organisms/src/content-builder/blocks/image/image.d.ts +16 -13
  53. package/library/packages/organisms/src/content-builder/blocks/timeline/timeline.d.ts +0 -2
  54. package/library/packages/organisms/src/content-builder/blocks/video/video.d.ts +9 -0
  55. package/library/packages/organisms/src/content-builder/components/template-manager/template-manager.d.ts +11 -0
  56. package/library/packages/organisms/src/content-builder/content-builder.d.ts +17 -1
  57. package/library/packages/organisms/src/content-builder-viewer/content-builder-viewer.d.ts +15 -6
  58. package/library/packages/organisms/src/form/control-renderer/control-renderer.d.ts +1 -1
  59. package/library/packages/tools/src/fetch-asset/fetch-asset.d.ts +2 -1
  60. package/library/packages/tools/src/fetch-image/fetch-image.d.ts +28 -0
  61. package/library/packages/utils/src/asset-url-mode/asset-url-mode.d.ts +22 -0
  62. package/library/packages/utils/src/asset-url-mode/index.d.ts +1 -0
  63. package/library/packages/utils/src/url/url.d.ts +7 -0
  64. package/library/react-web-component.d.ts +25 -1
  65. package/library/utils.js +28 -706
  66. package/package.json +1 -1
  67. package/library/packages/events/src/cx-image-src-resolved.d.ts +0 -9
  68. package/library/packages/events/src/cx-timeline-data-resolved.d.ts +0 -9
  69. package/library/packages/events/src/cx-video-src-resolved.d.ts +0 -8
  70. package/library/packages/events/src/cx-video-thumbnail-resolved.d.ts +0 -8
@@ -0,0 +1,720 @@
1
+ import "./i18n.BMXeDUpk.js";
2
+ import "./string.DamEXDH2.js";
3
+ import { a as e } from "./dom.dDaS97WU.js";
4
+ import { r as t } from "./form.-ADsa-59.js";
5
+ import "./browser.Ct4pHP9I.js";
6
+ import { n } from "./position-picker.dY_vgF_H.js";
7
+ import "./default-value.opqQgoRT.js";
8
+ import "./date.BL4L64Hx.js";
9
+ import { c as r, d as i, o as a } from "./url.BCc06dE7.js";
10
+ import "./responsive.L9Csz2w2.js";
11
+ import "./template.Cyvih0XQ.js";
12
+ import { i as o, r as s, t as c } from "./asset-link-format.DhdgEsA0.js";
13
+ //#region ../../packages/utils/src/date/iso-week-number.ts
14
+ function l(e) {
15
+ let t = /* @__PURE__ */ new Date(`${e}T00:00:00Z`);
16
+ if (Number.isNaN(t.getTime())) return 0;
17
+ let n = new Date(Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate())), r = n.getUTCDay() || 7;
18
+ n.setUTCDate(n.getUTCDate() + 4 - r);
19
+ let i = new Date(Date.UTC(n.getUTCFullYear(), 0, 1)), a = (n.getTime() - i.getTime()) / 864e5;
20
+ return Math.ceil((a + 1) / 7);
21
+ }
22
+ //#endregion
23
+ //#region ../../packages/utils/src/actions/asset-click.ts
24
+ function u(e) {
25
+ if (!this.ownerDocument.defaultView?.Matrix3 || !e) return;
26
+ let t = this.ownerDocument.defaultView?.location.origin;
27
+ t && this.ownerDocument?.defaultView?.postMessage({
28
+ detail: {
29
+ assetId: e,
30
+ mode: "Details"
31
+ },
32
+ type: "cx-cms5-view-asset"
33
+ }, t);
34
+ }
35
+ function d(e) {
36
+ if (!this.ownerDocument.defaultView?.Matrix3 || !e) return;
37
+ let t = this.ownerDocument.defaultView?.location.origin;
38
+ t && this.ownerDocument?.defaultView?.postMessage({
39
+ detail: {
40
+ assetId: e,
41
+ mode: "Container"
42
+ },
43
+ type: "cx-cms5-view-asset"
44
+ }, t);
45
+ }
46
+ function f(e, t = void 0) {
47
+ this.ownerDocument.defaultView?.Matrix3 && e && this.ownerDocument.defaultView?.open(a(e, "https://", !0), t ?? "_blank");
48
+ }
49
+ function p(e) {
50
+ if (!this.ownerDocument.defaultView?.Matrix3 || !e) return;
51
+ let t = this.ownerDocument.defaultView?.location.origin;
52
+ t && this.ownerDocument?.defaultView?.postMessage({
53
+ detail: { assetIds: [e] },
54
+ type: "cx-cms5-share-assets"
55
+ }, t);
56
+ }
57
+ function m(e, t) {
58
+ if (!this.ownerDocument.defaultView?.Matrix3 || !e) return;
59
+ let n = t || {}, r = this.ownerDocument.defaultView?.location.origin;
60
+ r && this.ownerDocument?.defaultView?.postMessage({
61
+ detail: {
62
+ assetIds: e,
63
+ formats: n
64
+ },
65
+ type: "cx-cms5-download-assets"
66
+ }, r);
67
+ }
68
+ //#endregion
69
+ //#region ../../packages/utils/src/array/array.ts
70
+ function h(e, t) {
71
+ return e.filter((e, n) => n !== t);
72
+ }
73
+ function g(e, t) {
74
+ return e.filter((e, n) => !t.includes(n));
75
+ }
76
+ function _(e, t, n) {
77
+ return [
78
+ ...e.slice(0, t),
79
+ n,
80
+ ...e.slice(t)
81
+ ];
82
+ }
83
+ function v(e, t, n) {
84
+ return [
85
+ ...e.slice(0, t),
86
+ ...n,
87
+ ...e.slice(t)
88
+ ];
89
+ }
90
+ function ee(e, t, n) {
91
+ return e.findIndex((e) => e[t] === n);
92
+ }
93
+ function te(e, t, n) {
94
+ let r = h([...e], t), i = n;
95
+ return i >= e.length - 1 && (i += 1), _(r, i, e[t]);
96
+ }
97
+ function ne(e, t, n) {
98
+ return v(g([...e], t), n === 0 ? n : t.reduce((e, t) => n > t ? e - 1 : e, n), t.map((t) => e[t]));
99
+ }
100
+ function re(e, t) {
101
+ return e.reduce((e, n) => {
102
+ let r = n[t];
103
+ return e[r] ??= [], e[r].push(n), e;
104
+ }, {});
105
+ }
106
+ function ie(e, t, n) {
107
+ if (!e.length) return [t];
108
+ let r = n.findIndex((e) => e.id === t), i = e[e.length - 1], a = n.findIndex((e) => e.id === i);
109
+ if (r < 0 || a < 0) return [t];
110
+ let o = n.reduce((e, t, n) => (e[t.id] = n, e), {}), s = r > a, c = s ? a : r, l = s ? r : a, u = n.slice(c, l + 1).filter((t) => !(!t || e.includes(t.id))).map((e) => e.id), d = s ? u : [...u].reverse(), f = e.includes(t) ? e.slice(0, e.indexOf(t) + 1) : [...e, ...d];
111
+ return f.sort((e, t) => o[e] - o[t]), f;
112
+ }
113
+ function ae(e, t, n, r, i, a) {
114
+ let o = n + 1;
115
+ if (e.length < 2) throw Error("Values array must contain at least 2 elements");
116
+ if (n < 0 || o >= e.length) throw Error("Invalid index or not enough values to adjust");
117
+ if (r < 0) throw Error("Minimum value must be non-negative");
118
+ let s = i + t;
119
+ s < r && (t = r - i, s = r);
120
+ let c = a - t;
121
+ c < r && (t = a - r, s = i + t, c = r), e[n] = parseFloat(s.toFixed(2)), e[o] = parseFloat(c.toFixed(2));
122
+ }
123
+ //#endregion
124
+ //#region ../../packages/utils/src/custom-element/popup.ts
125
+ var oe = class {
126
+ hostConnected() {}
127
+ hostDisconnected() {}
128
+ constructor(t) {
129
+ this.currentZIndex = e(), (this.host = t).addController(this);
130
+ }
131
+ async activatePopup() {
132
+ this.currentZIndex = e();
133
+ }
134
+ }, y = class {
135
+ constructor(e, t = {}) {
136
+ this.element = e, this.noChildDrag = t.noChildDrag ?? !1, this.dragThreshold = t.dragThreshold ?? 5, this.isDragging = !1, this.hasDragged = !1, this.startX = 0, this.startY = 0, this.lastClientX = 0, this.lastClientY = 0, this.onMouseDown = this.onMouseDown.bind(this), this.onMouseMove = this.onMouseMove.bind(this), this.onMouseUp = this.onMouseUp.bind(this), this.onClick = this.onClick.bind(this), this.attach();
137
+ }
138
+ attach() {
139
+ this.element.addEventListener("mousedown", this.onMouseDown), window.addEventListener("mouseup", this.onMouseUp), window.addEventListener("mousemove", this.onMouseMove), this.element.addEventListener("click", this.onClick, !0);
140
+ }
141
+ detach() {
142
+ this.element.removeEventListener("mousedown", this.onMouseDown), window.removeEventListener("mouseup", this.onMouseUp), window.removeEventListener("mousemove", this.onMouseMove), this.element.removeEventListener("click", this.onClick, !0);
143
+ }
144
+ onMouseDown(e) {
145
+ this.noChildDrag && e.target !== this.element || (this.isDragging = !0, this.hasDragged = !1, this.startX = e.clientX, this.startY = e.clientY, this.lastClientX = e.clientX, this.lastClientY = e.clientY, e.preventDefault());
146
+ }
147
+ onMouseMove(e) {
148
+ if (!this.isDragging) return;
149
+ let t = e.clientX - this.lastClientX, n = e.clientY - this.lastClientY;
150
+ !this.hasDragged && (Math.abs(e.clientX - this.startX) > this.dragThreshold || Math.abs(e.clientY - this.startY) > this.dragThreshold) && (this.hasDragged = !0), this.element.scrollLeft -= t, this.element.scrollTop -= n, this.lastClientX = e.clientX, this.lastClientY = e.clientY;
151
+ }
152
+ onMouseUp() {
153
+ this.isDragging = !1;
154
+ }
155
+ onClick(e) {
156
+ this.hasDragged && (e.stopImmediatePropagation(), e.preventDefault());
157
+ }
158
+ }, se = (e) => e.ctrlKey || e.metaKey, ce = window.location.origin.includes("localhost:") ? "https://local.orangelogic.com" : window.location.origin;
159
+ function le(e, t, n, r = ce) {
160
+ let i = new URL(r + "/" + e);
161
+ return Array.isArray(n) ? n.forEach((e) => {
162
+ e[1] && i.searchParams.append(e[0], e[1]);
163
+ }) : n && Object.keys(n).forEach((e) => {
164
+ n[e] && i.searchParams.append(e, n[e]);
165
+ }), fetch(i, t);
166
+ }
167
+ //#endregion
168
+ //#region ../../packages/utils/src/font/font.ts
169
+ function b(e) {
170
+ return e.replaceAll(" ", "_");
171
+ }
172
+ function ue(e) {
173
+ return e.value ?? b(e.typeface);
174
+ }
175
+ function de(e) {
176
+ return b([
177
+ e.value || e.name,
178
+ e.fontStyle,
179
+ e.fontWeight
180
+ ].filter((e) => e != null && e !== "").join("_"));
181
+ }
182
+ function x(e) {
183
+ return e.length >= 2 && (e.startsWith("'") && e.endsWith("'") || e.startsWith("\"") && e.endsWith("\""));
184
+ }
185
+ function S(e) {
186
+ return x(e) || !e.includes(" ") ? e : `'${e.replace(/\\/g, "\\\\").replace(/'/g, "\\'")}'`;
187
+ }
188
+ function C(e) {
189
+ return x(e) ? e.slice(1, -1).replace(/\\(.)/g, "$1") : e;
190
+ }
191
+ function w(e, t) {
192
+ if (!e?.document) return !1;
193
+ let n = e.document.createElement("canvas").getContext("2d"), r = (e) => n ? (n.font = `32px ${S(e)}, monospace`, n.measureText("mmmmmmmmmmwwwwwww").width) : 0, i = r("monospace");
194
+ return r(t) !== i;
195
+ }
196
+ function fe(e, t) {
197
+ if (!e?.document?.fonts) return !1;
198
+ let n = !1;
199
+ return e.document.fonts.forEach((e) => {
200
+ e.family.replace(/['"]/g, "").toLowerCase() === t.toLowerCase() && (n = !0);
201
+ }), n ? !0 : w(e, t);
202
+ }
203
+ function T(e) {
204
+ let t = /\bitalic\b/i, n = /\b(semi[-\s]?condensed|condensed)\b/i, r = (e) => {
205
+ let r = e.fontFamily.toLowerCase(), i = e.fontStyle.toLowerCase(), a = t.test(i), o = n.test(r), s = 0;
206
+ return a && (s = 1), o && (s = a ? 3 : 2), {
207
+ family: e.fontFamily,
208
+ styleRank: s,
209
+ weight: Number(e.fontWeight)
210
+ };
211
+ };
212
+ return [...e].sort((e, t) => {
213
+ let n = r(e), i = r(t);
214
+ return n.weight === i.weight ? n.styleRank === i.styleRank ? n.family.localeCompare(i.family) : n.styleRank - i.styleRank : n.weight - i.weight;
215
+ });
216
+ }
217
+ function pe(e, t, n = [
218
+ 300,
219
+ 400,
220
+ 500,
221
+ 700,
222
+ 900
223
+ ], r = ["normal", "italic"]) {
224
+ let i = [];
225
+ if (w(e, t)) for (let e of n) for (let n of r) i.push({
226
+ fontFamily: t,
227
+ fontStyle: n,
228
+ fontWeight: e.toString(),
229
+ src: ""
230
+ });
231
+ return T(i);
232
+ }
233
+ function me(e, t) {
234
+ let n = C(t);
235
+ return e.find((e) => e.families.length > 0 && (e.typeface === n || e.value === n || e.families.some((e) => e.value === n)));
236
+ }
237
+ function he(e, t) {
238
+ let n = me(e, t);
239
+ return n ? T(n.families.map((e) => ({
240
+ fontFamily: e.value ?? n.typeface,
241
+ fontStyle: e.fontStyle || "normal",
242
+ fontWeight: String(e.fontWeight ?? 400),
243
+ src: ""
244
+ }))) : [];
245
+ }
246
+ //#endregion
247
+ //#region ../../packages/utils/src/form/form.ts
248
+ function ge(e) {
249
+ let t = new FormData(e), n = {};
250
+ return t.forEach((e, t) => {
251
+ if (Reflect.has(n, t)) {
252
+ let r = n[t];
253
+ Array.isArray(r) ? r.push(e) : n[t] = [n[t], e];
254
+ } else n[t] = e;
255
+ }), n;
256
+ }
257
+ function E(e) {
258
+ let n = [...e.getRootNode().querySelectorAll("*")], r = [...e.elements], i = t.get(e), a = i ? Array.from(i) : [];
259
+ return [...r, ...a].sort((e, t) => n.indexOf(e) < n.indexOf(t) ? -1 : +(n.indexOf(e) > n.indexOf(t)));
260
+ }
261
+ function D(e) {
262
+ return E(e).some((e) => e.hasAttribute("data-user-valid") || e.hasAttribute("data-user-invalid"));
263
+ }
264
+ //#endregion
265
+ //#region ../../packages/utils/src/history-manager/history-manager.ts
266
+ var O = class {
267
+ constructor(e = null) {
268
+ this.history = e === null ? [] : [e], this.redoStack = [];
269
+ }
270
+ add(e) {
271
+ this.history.push(e), this.redoStack = [];
272
+ }
273
+ undo() {
274
+ if (this.history.length > 1) {
275
+ let e = this.history.pop();
276
+ return this.redoStack.push(e), this.getCurrent();
277
+ }
278
+ return null;
279
+ }
280
+ redo() {
281
+ if (this.redoStack.length > 0) {
282
+ let e = this.redoStack.pop();
283
+ return this.history.push(e), e;
284
+ }
285
+ return null;
286
+ }
287
+ getCurrent() {
288
+ return this.history[this.history.length - 1] || null;
289
+ }
290
+ clear() {
291
+ this.history = [], this.redoStack = [];
292
+ }
293
+ canUndo() {
294
+ return this.history.length > 1;
295
+ }
296
+ canRedo() {
297
+ return this.redoStack.length > 0;
298
+ }
299
+ getHistory() {
300
+ return [...this.history];
301
+ }
302
+ }, k = /* @__PURE__ */ function(e) {
303
+ return e.ArrowDown = "ArrowDown", e.ArrowLeft = "ArrowLeft", e.ArrowRight = "ArrowRight", e.ArrowUp = "ArrowUp", e.Enter = "Enter", e.Escape = "Escape", e.Tab = "Tab", e;
304
+ }({});
305
+ //#endregion
306
+ //#region ../../packages/utils/src/object/object.ts
307
+ function A(e, t) {
308
+ let n = {}, r = new Set(t);
309
+ return Object.keys(e).forEach((t) => {
310
+ r.has(t) || (n[t] = e[t]);
311
+ }), n;
312
+ }
313
+ function j(e, t) {
314
+ let n = {};
315
+ return t.forEach((t) => {
316
+ t in e && (n[t] = e[t]);
317
+ }), n;
318
+ }
319
+ function M(e) {
320
+ if (!e) return {};
321
+ let t;
322
+ try {
323
+ t = JSON.parse(e);
324
+ } catch {
325
+ return {};
326
+ }
327
+ return typeof t == "object" ? t : {};
328
+ }
329
+ function N(e, t = !0) {
330
+ if (!e) return [];
331
+ let n;
332
+ try {
333
+ n = JSON.parse(e);
334
+ } catch {
335
+ return [];
336
+ }
337
+ return Array.isArray(n) ? t ? n.filter((e) => typeof e == "string") : n : [];
338
+ }
339
+ //#endregion
340
+ //#region ../../packages/utils/src/storage/storage.ts
341
+ function P(e, t) {
342
+ return typeof Storage < "u" && localStorage.getItem(e) !== null ? localStorage.getItem(e) : t;
343
+ }
344
+ function F(e, t) {
345
+ typeof Storage < "u" && localStorage.setItem(e, t.toString());
346
+ }
347
+ //#endregion
348
+ //#region ../../packages/utils/src/toast/toast.ts
349
+ var I = (e, t) => {
350
+ try {
351
+ window.Matrix3?.ShowNotification && window.Matrix3.ShowNotification(e, t ? { notificationType: t.notificationType } : void 0);
352
+ } catch {
353
+ return;
354
+ }
355
+ }, L = "__cxUseExpiringAssetUrls", R = "path_TR1", z = "path_TRX";
356
+ function B(e) {
357
+ return e ?? globalThis;
358
+ }
359
+ function _e(e) {
360
+ return !!e && i(e) === null && !r(e);
361
+ }
362
+ function ve(e, t) {
363
+ return !e || r(e) ? !1 : t ? i(e) !== null : _e(e);
364
+ }
365
+ function ye(e, t) {
366
+ B(t)[L] = e === !0;
367
+ }
368
+ function V(e) {
369
+ return B(e)[L] === !0;
370
+ }
371
+ function be(e) {
372
+ return !V(e);
373
+ }
374
+ function xe(e, t, n) {
375
+ if (n?.trim().toLowerCase().replace(/^\./, "") === "gif" && t && e.path_TRX) return z;
376
+ if (e.path_TR1) return R;
377
+ if (t && e.path_TRX) return z;
378
+ }
379
+ //#endregion
380
+ //#region ../../packages/utils/src/transformation/transformation.ts
381
+ var H = "/AssetLink/";
382
+ function U(e) {
383
+ return V() || i(e) !== null;
384
+ }
385
+ var Se = {
386
+ [n.BottomCenter]: c.South,
387
+ [n.BottomLeft]: c.Southwest,
388
+ [n.BottomRight]: c.Southeast,
389
+ [n.CenterCenter]: c.Center,
390
+ [n.CenterLeft]: c.West,
391
+ [n.CenterRight]: c.East,
392
+ [n.TopCenter]: c.North,
393
+ [n.TopLeft]: c.Northwest,
394
+ [n.TopRight]: c.Northeast
395
+ }, W = "/t/", G = [
396
+ 400,
397
+ 800,
398
+ 1200,
399
+ 1600,
400
+ 2400
401
+ ];
402
+ function K({ asset: e, baseUrl: t, extension: n, options: r, parameters: i, transformations: a, useSession: c = "" }) {
403
+ if (t == null) return "";
404
+ let l = t, u = a?.findLast((e) => e.key === s.Quality);
405
+ if (u && (a = [...a?.filter((e) => e.key !== s.Quality) || [], u]), a) {
406
+ let e = [];
407
+ for (let t = 0; t < a.length; t++) {
408
+ let n = a[t];
409
+ if (n.key === s.Rotate) {
410
+ let r = n.value.rotation ?? 0;
411
+ for (; a[t + 1]?.key === s.Rotate;) t++, r += a[t].value.rotation ?? 0;
412
+ r !== 0 && e.push({
413
+ key: s.Rotate,
414
+ value: { rotation: r }
415
+ });
416
+ } else e.push(n);
417
+ }
418
+ a = e;
419
+ }
420
+ a && a.length > 0 && (l += "/t/"), a?.forEach(({ key: e, value: t }) => {
421
+ if (e === s.Resize) {
422
+ if (t.unit === o.AspectRatio && t.ratioWidth && t.ratioHeight) {
423
+ l += `re_ar_${t.ratioWidth}:${t.ratioHeight}/`;
424
+ return;
425
+ }
426
+ let e = [...[{
427
+ key: "re_w_",
428
+ value: Math.round(t.width ?? 0)
429
+ }, {
430
+ key: "re_h_",
431
+ value: Math.round(t.height ?? 0)
432
+ }].filter((e) => e.value !== void 0).map((e) => ({
433
+ key: e.key,
434
+ value: Math.round(Number(e.value))
435
+ })), {
436
+ key: "re_rm_",
437
+ value: "stretch"
438
+ }];
439
+ e.forEach(({ key: t, value: n }, r) => {
440
+ l += `${t}${n}${r < e.length - 1 ? "," : ""}`;
441
+ }), l += "/";
442
+ }
443
+ if (e === s.Crop) {
444
+ let e = t.unit === o.AspectRatio && !!t.ratioWidth && !!t.ratioHeight, n = !t.disabledSize && !e, i = n && (t.x !== void 0 || t.y !== void 0), a = [...[
445
+ {
446
+ key: "c_",
447
+ value: t.mode
448
+ },
449
+ ...e ? [{
450
+ key: "ar_",
451
+ value: `${t.ratioWidth}:${t.ratioHeight}`
452
+ }] : [],
453
+ ...n ? [
454
+ {
455
+ key: "c_w_",
456
+ value: Math.round(t.width ?? 0)
457
+ },
458
+ {
459
+ key: "c_h_",
460
+ value: Math.round(t.height ?? 0)
461
+ },
462
+ {
463
+ key: "c_x_",
464
+ value: Math.round(t.x ?? 0) === 0 && r?.omitZeroXY ? void 0 : Math.round(t.x ?? 0)
465
+ },
466
+ {
467
+ key: "c_y_",
468
+ value: Math.round(t.y ?? 0) === 0 && r?.omitZeroXY ? void 0 : Math.round(t.y ?? 0)
469
+ }
470
+ ] : [],
471
+ ...!i && t.focusMode && t.focusMode !== "manual" ? [{
472
+ key: t.isFocusModeAuto ? "acm_" : "c_g_",
473
+ value: t.focusMode
474
+ }] : [],
475
+ ...!i && t.focusMode === "manual" && t.position ? [{
476
+ key: "c_g_",
477
+ value: Se[t.position]
478
+ }] : []
479
+ ].filter((e) => e.value !== void 0 && e.value !== null).map((e) => ({
480
+ key: e.key,
481
+ value: e.value
482
+ })), ...e ? [] : [{
483
+ key: "c_whu_",
484
+ value: "pixel"
485
+ }]];
486
+ a.forEach(({ key: e, value: t }, n) => {
487
+ let r = [
488
+ "c_w_",
489
+ "c_h_",
490
+ "c_x_",
491
+ "c_y_"
492
+ ].includes(e);
493
+ l += `${e}${r ? Math.round(Number(t)) : t}${n < a.length - 1 ? "," : ""}`;
494
+ }), l += "/";
495
+ }
496
+ if (e === s.Rotate && ([{
497
+ key: "r_a_",
498
+ value: t.rotation
499
+ }].filter((e) => e.value !== void 0).map((e) => ({
500
+ key: e.key,
501
+ value: Math.round(Number(e.value))
502
+ })).forEach(({ key: e, value: t }) => {
503
+ l += `${e}${t}`;
504
+ }), l += "/"), e === s.Quality) {
505
+ let e = [{
506
+ key: "q_level_",
507
+ value: t.quality
508
+ }].filter((e) => e.value !== void 0).map((e) => ({
509
+ key: e.key,
510
+ value: Math.round(Number(e.value))
511
+ }));
512
+ e.forEach(({ key: t, value: n }, r) => {
513
+ l += `${t}${n}${r < e.length - 1 ? "," : ""}`;
514
+ }), l += "/";
515
+ }
516
+ if (e === s.Metadata) {
517
+ let e = [{
518
+ key: "fl_keep_metadata",
519
+ value: t.keepMetadata
520
+ }].filter((e) => e.value !== void 0).map((e) => ({
521
+ key: e.key,
522
+ value: e.value
523
+ }));
524
+ e.forEach(({ key: t }, n) => {
525
+ l += `${t}${n < e.length - 1 ? "," : ""}`;
526
+ }), l += "/";
527
+ }
528
+ }), n && (l += `${e?.identifier ?? crypto.randomUUID()}${n}`);
529
+ let d = [];
530
+ return i && i.length > 0 && i.forEach(({ key: e, value: t }) => {
531
+ d.push(`${encodeURIComponent(e.trim())}=${encodeURIComponent(t.trim())}`);
532
+ }), t && c && d.push(`UseSession=${encodeURIComponent(c)}`), d.length > 0 && (l += `?${d.join("&")}`), l.endsWith("/") && (l = l.slice(0, -1)), l;
533
+ }
534
+ var q = ".auto";
535
+ function Ce(e) {
536
+ if (Array.isArray(e)) return e;
537
+ if (typeof e != "string" || !e) return [];
538
+ try {
539
+ let t = JSON.parse(e);
540
+ return Array.isArray(t) ? t : [];
541
+ } catch {
542
+ return [];
543
+ }
544
+ }
545
+ function we(e, t, n = {}) {
546
+ let r = n.format === "TRX" && X(n.extension), i = !!n.autoFormat && !r;
547
+ if (!e || U(e) || !t?.length && !i) return e;
548
+ let a = t?.length ? K({
549
+ baseUrl: "",
550
+ transformations: t
551
+ }).replace(/\/t\//g, "") : "";
552
+ if (!a && !i) return e;
553
+ let o = e.indexOf(H);
554
+ if (o < 0) return a ? `${e}${W}${a}` : e;
555
+ let s = e.slice(0, o + 11), c = e.slice(o + 11);
556
+ if (!c) return e;
557
+ let l = c.indexOf(W), u = l >= 0, d = c.indexOf("/"), f = u ? l : d, p = f >= 0 ? c.slice(0, f) : c, m = u ? c.slice(l + 3) : d >= 0 ? c.slice(d + 1) : "", h = m.slice(m.lastIndexOf("/") + 1), g = h ? `${h.replace(/\.[^.]+$/, "")}${q}` : `${p.replace(/\.[^.]+$/, "")}${q}`, _ = [a, i ? g : u ? "" : h].filter(Boolean);
558
+ return _.length === 0 ? e : `${s}${p}${W}${_.join("/")}`;
559
+ }
560
+ function Te(e) {
561
+ return `re_w_${Math.round(e)}`;
562
+ }
563
+ function J(e, t) {
564
+ if (!e || U(e) || !Number.isFinite(t) || t <= 0) return e;
565
+ let n = e.indexOf(H);
566
+ if (n < 0) return e;
567
+ let r = Te(t), i = e.slice(0, n + 11), a = e.slice(n + 11), o = a.indexOf(W);
568
+ if (o >= 0) return `${i}${a.slice(0, o)}${W}${r}/${a.slice(o + 3)}`;
569
+ let s = a.indexOf("/");
570
+ return s >= 0 ? `${i}${a.slice(0, s)}${W}${r}${a.slice(s)}` : `${i}${a}${W}${r}`;
571
+ }
572
+ function Ee(e) {
573
+ let t = e.indexOf(H);
574
+ return t < 0 ? !1 : e.slice(t + 11).includes(W);
575
+ }
576
+ function De(e) {
577
+ let t = e.indexOf(H);
578
+ if (t < 0) return !1;
579
+ let n = e.slice(t + 11), r = n.indexOf(W);
580
+ return r < 0 ? !1 : n.slice(r + 3).includes("/");
581
+ }
582
+ var Oe = "TRX", ke = "TR1", Ae = /* @__PURE__ */ new Set([
583
+ "avif",
584
+ "bmp",
585
+ "gif",
586
+ "ico",
587
+ "jpeg",
588
+ "jpg",
589
+ "png",
590
+ "svg",
591
+ "webp"
592
+ ]);
593
+ function Y(e) {
594
+ if (!e) return "";
595
+ let t = e.trim().toLowerCase();
596
+ return t.startsWith(".") ? t.slice(1) : t;
597
+ }
598
+ function X(e) {
599
+ return Y(e) === "gif";
600
+ }
601
+ function je(e) {
602
+ return Y(e) === "svg";
603
+ }
604
+ var Me = 1048576e3, Ne = {
605
+ b: 1,
606
+ byte: 1,
607
+ bytes: 1,
608
+ gb: 1024 ** 3,
609
+ kb: 1024,
610
+ mb: 1024 ** 2,
611
+ tb: 1024 ** 4
612
+ };
613
+ function Z(e) {
614
+ if (typeof e == "number") return Number.isFinite(e) && e >= 0 ? e : void 0;
615
+ if (!e) return;
616
+ let t = /^\s*([\d.,]+)\s*([a-z]*)\s*$/i.exec(e);
617
+ if (!t) return;
618
+ let n = Number(t[1].replace(/,/g, ""));
619
+ if (!Number.isFinite(n) || n < 0) return;
620
+ let r = t[2].toLowerCase();
621
+ if (!r) return n;
622
+ let i = Ne[r];
623
+ return i === void 0 ? void 0 : n * i;
624
+ }
625
+ function Pe(e, t) {
626
+ if (e) return;
627
+ let n = typeof t == "number" ? t : Number(t ?? "");
628
+ return Number.isFinite(n) && n > 0 ? n : void 0;
629
+ }
630
+ function Fe(e, t) {
631
+ if (!Ae.has(Y(e))) return "TR1";
632
+ let n = Z(t);
633
+ return n !== void 0 && n > 1048576e3 ? "TR1" : "TRX";
634
+ }
635
+ function Q(e, t = {}) {
636
+ if (U(e) || !e.includes(H) || De(e) || t.format === "TRX" && (X(t.extension) || je(t.extension))) return "";
637
+ let { maxWidth: n, widths: r = G } = t, i = [...r].filter((e) => Number.isFinite(e) && e > 0).sort((e, t) => e - t);
638
+ if (i.length === 0) return "";
639
+ let a = i;
640
+ if (n !== void 0 && Number.isFinite(n) && n > 0) {
641
+ let e = i.filter((e) => e <= n);
642
+ a = e.length > 0 ? e : [i[0]];
643
+ }
644
+ let o = n !== void 0 && Number.isFinite(n) && n > 0, s = (o ? a.filter((e) => n > e * 1.15) : a).map((t) => `${J(e, t)} ${t}w`);
645
+ return o && s.push(`${e} ${n}w`), s.join(", ");
646
+ }
647
+ function Ie(e, t = 100) {
648
+ return !Number.isFinite(e) || e <= 0 ? "" : `${Math.ceil(e / t) * t}px`;
649
+ }
650
+ //#endregion
651
+ //#region ../../packages/utils/src/video/video.ts
652
+ var Le = 10;
653
+ function Re(e, t) {
654
+ let n = 0, r = e.length;
655
+ for (; n < r;) {
656
+ let i = Math.floor((n + r) / 2);
657
+ e[i].time < t.time ? n = i + 1 : r = i;
658
+ }
659
+ e.splice(n, 0, t);
660
+ }
661
+ function $(e, t, n) {
662
+ return e.find((e) => e.col === t && e.row === n) ?? null;
663
+ }
664
+ function ze(e, t, n) {
665
+ return new Promise((r) => {
666
+ if (t > 0 && Math.abs(e.currentTime - t) < .001) {
667
+ r();
668
+ return;
669
+ }
670
+ if (t === 0) {
671
+ let t = () => {
672
+ e.removeEventListener("seeked", t);
673
+ let n = () => {
674
+ e.removeEventListener("seeked", n), r();
675
+ };
676
+ e.addEventListener("seeked", n), e.currentTime = 0;
677
+ };
678
+ e.addEventListener("seeked", t), e.currentTime = n;
679
+ } else {
680
+ let n = () => {
681
+ e.removeEventListener("seeked", n), r();
682
+ };
683
+ e.addEventListener("seeked", n), e.currentTime = t;
684
+ }
685
+ });
686
+ }
687
+ async function* Be({ cache: e, canvas: t, duration: n, maxInterval: r, src: i, video: a }) {
688
+ if (!t) throw Error("Canvas is required");
689
+ if (!a) throw Error("Video is required");
690
+ let { columns: o, frameHeight: s, frameWidth: c, rows: l, spriteCtx: u } = t;
691
+ try {
692
+ for (let t = 0; t < l; t++) for (let d = 0; d < o; d++) {
693
+ let f = t * o + d, p = f * r;
694
+ if (p >= n) continue;
695
+ let m = d * c, h = t * s, g = $(e[i] ?? [], d, t), _ = d === o - 1 && t === l - 1 || p + r >= n;
696
+ g ? yield {
697
+ ...g,
698
+ isLastFrame: _
699
+ } : (await ze(a, p, r), u.drawImage(a, m, h, c, s), yield {
700
+ col: d,
701
+ columns: o,
702
+ frameHeight: s,
703
+ frameWidth: c,
704
+ index: f,
705
+ isLastFrame: _,
706
+ row: t,
707
+ rows: l,
708
+ time: Number(p.toFixed(10)),
709
+ x: m,
710
+ y: h
711
+ }), await new Promise(requestAnimationFrame);
712
+ }
713
+ } catch {}
714
+ }
715
+ function Ve({ duration: e, frameWidth: t, playbackSpeed: n, scale: r }) {
716
+ let i = t * n / r;
717
+ return i > e && (i = e / 2), i;
718
+ }
719
+ //#endregion
720
+ export { ae as $, F as A, pe as B, ve as C, ye as D, be as E, k as F, S as G, he as H, O as I, C as J, T as K, E as L, M, N, I as O, j as P, oe as Q, D as R, R as S, xe as T, ue as U, de as V, fe as W, se as X, le as Y, y as Z, Z as _, Re as a, te as at, Pe as b, Me as c, g as ct, we as d, d as dt, ee as et, J as f, f as ft, Ee as g, K as h, Ve as i, ne as it, A as j, P as k, Oe as l, m as lt, Ie as m, l as mt, Be as n, _ as nt, ke as o, ie as ot, Q as p, p as pt, w as q, $ as r, v as rt, q as s, h as st, Le as t, re as tt, G as u, u as ut, Ce as v, V as w, z as x, Fe as y, ge as z };