@trintel/zooy 1.6.0 → 1.7.1

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.
@@ -0,0 +1,1486 @@
1
+ import { n as f, t as It } from "./component-library-registry-DB5UeqC2.js";
2
+ import { i as St, n as W, r as c } from "./zoo-CaW98OQn.js";
3
+ import { isDefAndNotNull as Pt, objToPaths as kt } from "badu";
4
+ import * as M from "ramda";
5
+ import { TABLE_SORT_DIRECTION as Ct } from "@carbon/web-components/lib/components/data-table/defs.js";
6
+ var yt = /* @__PURE__ */ f({ cdsTableWrap: () => xt }), Q = (t, e, s) => {
7
+ const n = customElements.get("cds-table"), o = customElements.get("cds-pagination"), a = customElements.get(n.selectorTableBatchActions);
8
+ customElements.get("cds-popover");
9
+ const r = e.dataBinder, i = e.pagination, d = e.skeleton, I = e.querySelector(n.selectorTableToolbarSearch), S = e.querySelector(n.selectorTableBatchActions), D = e.querySelector(n.selectorTableBody), R = [
10
+ "button",
11
+ "a",
12
+ "input",
13
+ "select",
14
+ "textarea",
15
+ '[role="button"]',
16
+ ".cds--table-expand",
17
+ ".cds--table-column-checkbox"
18
+ ].join(","), Z = e.querySelectorAll(n.selectorHeaderCell + "[is-sortable]"), rt = e.isSortable || Z.length > 0, z = /* @__PURE__ */ Symbol(), q = /* @__PURE__ */ Symbol(), x = /* @__PURE__ */ new Map(), ct = (l) => {
19
+ t.listen(e, "click", (p) => {
20
+ const u = p.target.closest(n.selectorTableRow);
21
+ if (!u || p.composedPath().some((h) => h.matches && h.matches(R))) return;
22
+ p.stopPropagation();
23
+ const v = c(u);
24
+ t.dispatchPanelEvent(l, { ...v });
25
+ });
26
+ }, it = (l) => {
27
+ t.listen(e, n.eventExpandoToggle, (p) => {
28
+ const u = p.target, v = u.tagName === "CDS-TABLE-HEADER-ROW", h = p.detail.expanded, b = {
29
+ tableAttrs: s,
30
+ ...c(u),
31
+ target: u,
32
+ allRows: v,
33
+ didExpand: h
34
+ };
35
+ t.dispatchPanelEvent(l, b);
36
+ });
37
+ }, lt = (l) => {
38
+ x.set(z, (p) => {
39
+ t.dispatchPanelEvent(l, p);
40
+ });
41
+ }, dt = (l) => {
42
+ x.set(q, (p) => {
43
+ const u = p.detail.selectedRows, v = Math.min(u.length, S.totalRowsCount), h = p.target, b = c(h), P = u.map(c), y = {
44
+ tableAttrs: s,
45
+ ...b,
46
+ target: h,
47
+ selectCount: v,
48
+ selection: P
49
+ };
50
+ t.dispatchPanelEvent(l, y);
51
+ });
52
+ }, pt = (l) => {
53
+ t.listen(e, n.eventTableRowSelect, (p) => {
54
+ const u = p.target, v = p.detail.selectedRows || [], h = v.length, b = v.map(c), P = {
55
+ tableAttrs: s,
56
+ ...c(u),
57
+ selectCount: h,
58
+ selection: b,
59
+ target: u
60
+ };
61
+ t.dispatchPanelEvent(l, P);
62
+ });
63
+ }, ut = () => {
64
+ t.listen(e, n.eventBeforeSort, (l) => {
65
+ const p = l.target, u = l.detail.oldSortDirection, v = l.detail.sortDirection, h = c(p), b = h.sortField, P = v === Ct.DESCENDING ? `-${b}` : b;
66
+ l.cancelBubble = !0, l.stopPropagation(), l.preventDefault(), D.innerHTML = "", d && d.show(), Z.forEach((A, g) => {
67
+ A === p ? (A.setAttribute("sort-active", "true"), A.setAttribute("sort-direction", v)) : (A.removeAttribute("sort-active"), A.setAttribute("sort-direction", "none"));
68
+ });
69
+ const y = { ordering: P };
70
+ r.fetchData(y).then(() => {
71
+ i.setData(r), d && d.hide();
72
+ }), x.has(z) && x.get(z)({
73
+ tableAttrs: s,
74
+ ...h,
75
+ sortNow: v,
76
+ sortWas: u,
77
+ sortField: b,
78
+ ordering: P,
79
+ target: p
80
+ });
81
+ });
82
+ }, vt = () => {
83
+ t.listen(e, n.eventTableRowSelectAll, (l) => {
84
+ l.detail.selectedRows.length === 0 && e.querySelectorAll(n.selectorTableRow).forEach((p) => {
85
+ p.disabled = !1, p.selected = !1;
86
+ }), x.has(q) && x.get(q)(l);
87
+ });
88
+ }, mt = () => {
89
+ t.listen(e, n.eventBeforeChangeSelectionAll, (l) => {
90
+ l.stopPropagation(), l.detail.callback && l.detail.callback();
91
+ });
92
+ }, ft = (l) => {
93
+ const p = e.querySelector("cds-table-header-row");
94
+ t.listen(l, a.eventClickSelectAll, (u) => {
95
+ u.stopPropagation(), p.dispatchEvent(new CustomEvent(n.eventBeforeChangeSelectionAll, {
96
+ bubbles: !0,
97
+ cancelable: !0,
98
+ composed: !0,
99
+ detail: {
100
+ selected: !0,
101
+ callback: () => {
102
+ l.selectedRowsCount = l.totalRowsCount, e.querySelectorAll(n.selectorTableRow).forEach((v) => {
103
+ v.disabled = !0;
104
+ });
105
+ }
106
+ }
107
+ }));
108
+ });
109
+ }, ht = (l) => {
110
+ t.listen(l, "keydown", (p) => {
111
+ if (p.key === "Enter") {
112
+ d && d.show(), i.totalItems = 0, e.querySelector("cds-table-body").replaceChildren();
113
+ const u = {
114
+ search: l.value || "",
115
+ offset: 0
116
+ };
117
+ r.fetchData(u).then(() => {
118
+ i.setData(r), d && d.hide();
119
+ });
120
+ }
121
+ });
122
+ }, gt = (l) => {
123
+ t.listen(l, n.eventSearchInput, (p) => {
124
+ if ((p.detail.value || "") === "") {
125
+ const u = {
126
+ search: "",
127
+ offset: 0
128
+ };
129
+ d && d.show(), r.fetchData(u).then(() => {
130
+ d && d.hide(), i.setData(r);
131
+ });
132
+ }
133
+ });
134
+ }, bt = (l) => {
135
+ l.caret = !1;
136
+ const p = l.querySelector("cds-icon-button, button:not([slot])"), u = l.querySelectorAll("cds-checkbox"), v = l.querySelectorAll("cds-modal-footer-button"), h = [...l.querySelectorAll("cds-checkbox-group")].map(c).map(M.pathOr("noop", [
137
+ "zoo",
138
+ "filter",
139
+ "field"
140
+ ])).reduce((g, E) => (g[E] = null, g), { offset: 0 });
141
+ if (!p || !v) {
142
+ console.error("Improperly configured Batch Filter popover");
143
+ return;
144
+ }
145
+ new MutationObserver(() => {
146
+ l.classList.toggle("cds--overflow-menu--open", l.open);
147
+ }).observe(l, {
148
+ attributes: !0,
149
+ attributeFilter: ["open"]
150
+ });
151
+ const b = /* @__PURE__ */ Symbol(), P = /* @__PURE__ */ Symbol(), y = [...v].reduce((g, E, w) => (E.hasAttribute("reset-filter") && g.set(b, E), E.hasAttribute("apply-filter") && g.set(P, E), g), /* @__PURE__ */ new Map()), A = () => {
152
+ const g = /* @__PURE__ */ new Map();
153
+ return u.forEach((E) => {
154
+ const w = E.getAttribute("id");
155
+ if (!w || !w.includes(":")) return;
156
+ const [N, _] = w.split(":");
157
+ g.has(N) || g.set(N, []), E.checked && g.get(N).push(_);
158
+ }), g;
159
+ };
160
+ if (y.has(b)) {
161
+ const g = (E) => E.checked = !1;
162
+ t.listen(y.get(b), "click", (E) => {
163
+ E.stopPropagation(), u.forEach(g), d && d.show(), r.fetchData(h).then(() => {
164
+ i && i.setData(r), d && d.hide(), l.open = !1;
165
+ });
166
+ });
167
+ }
168
+ y.has(P) && t.listen(y.get(P), "click", (g) => {
169
+ g.stopPropagation();
170
+ const E = [...A()].reduce((w, [N, _]) => (w[N] = Array.isArray(_) && _.length === 0 ? null : _, w), { offset: 0 });
171
+ d && d.show(), r.fetchData(E).then(() => {
172
+ i && i.setData(r), d && d.hide(), l.open = !1;
173
+ });
174
+ }), t.listen(p, "click", (g) => {
175
+ g.stopPropagation(), l.open = !l.open, l.classList.toggle("cds--overflow-menu--open", l.open);
176
+ });
177
+ }, Et = () => {
178
+ t.listen(i, o.eventPageSizeChanged, (l) => {
179
+ const p = {
180
+ limit: i.pageSize,
181
+ offset: 0
182
+ };
183
+ r.fetchData(p).then(() => {
184
+ i.setData(r);
185
+ });
186
+ });
187
+ }, Wt = () => {
188
+ let l = null;
189
+ t.listen(i, o.eventChangeCurrent, (p) => {
190
+ const { page: u } = p.detail, v = i.pageSize, h = (u - 1) * v;
191
+ if (h !== l) {
192
+ l = h;
193
+ const b = {
194
+ limit: v,
195
+ offset: h
196
+ };
197
+ r.fetchData(b).then(() => {
198
+ i.setData(r), d && d.hide();
199
+ });
200
+ }
201
+ });
202
+ };
203
+ r && i && (Et(), Wt()), r && I && (ht(I), gt(I));
204
+ const J = e.querySelector(n.selectorTableToolbarContent);
205
+ if (J) {
206
+ const l = J.querySelectorAll("cds-popover[data-batch-filter]");
207
+ r && l && l.forEach(bt);
208
+ }
209
+ e.isSelectable && (vt(), mt(), S && ft(S)), r && rt && ut();
210
+ const K = { zoo: { event: {
211
+ row: {
212
+ click: ct,
213
+ expand: it,
214
+ check: {
215
+ one: pt,
216
+ all: dt
217
+ }
218
+ },
219
+ column: { sort: lt }
220
+ } } };
221
+ kt(s).forEach(([l, p]) => {
222
+ M.hasPath(l, K) && M.path(l, K)(p);
223
+ });
224
+ }, At = (t) => {
225
+ const e = document.createElement("cds-pagination");
226
+ return e.backwardText = "Previous page", e.forwardText = "Next page", e.itemsPerPageText = "Items per page:", e.pageSize = t.limit, e.size = "lg", [
227
+ 10,
228
+ 25,
229
+ 50,
230
+ 100,
231
+ 500
232
+ ].forEach((s) => {
233
+ const n = document.createElement("cds-select-item");
234
+ n.value = s.toString(), n.textContent = s.toString(), e.appendChild(n);
235
+ }), e.setData = (s) => {
236
+ if (s.isPaginated) {
237
+ const { count: n } = M.pick(["count"], s.data);
238
+ e.pagesUnknown = Math.ceil(n / s.limit) > 100, e.totalItems = n, e.pagesUnknown ? e.formatStatusWithIndeterminateTotal = ({ start: o, end: a }) => `${o}–${a} of ${n} item${n <= 1 ? "" : "s"}` : delete e.formatStatusWithIndeterminateTotal;
239
+ }
240
+ }, e;
241
+ }, wt = (t) => {
242
+ if (!t.parentNode) {
243
+ console.error("[Carbon Table] Cannot create skeleton: table has no parent node");
244
+ return;
245
+ }
246
+ const e = !!t.querySelector("cds-table-header-title"), s = !!t.querySelector("cds-table-header-description"), n = !!t.querySelector("cds-table-toolbar"), o = [...t.querySelectorAll("cds-table-header-cell")].length, a = t.hasAttribute("zebra"), r = t.getAttribute("size"), i = document.createElement("cds-table-skeleton");
247
+ i.showHeader = e || s, i.showToolbar = n, i.zebra = a, i.columnCount = o, i.size = r, i.show = () => i.classList.remove("hidden"), i.hide = () => i.classList.add("hidden");
248
+ const d = document.createElement("div");
249
+ return d.classList.add("zoo-datatable-skeleton-wrapper"), t.parentNode.insertBefore(d, t), d.appendChild(i), d.appendChild(t), i;
250
+ }, Dt = (t, e) => {
251
+ const s = e.getAttribute("zoo-url-api"), n = parseInt(e.getAttribute("data-page-size") || 25, 10);
252
+ if (s) return new St(t, s, e, { urlParams: { limit: n } });
253
+ }, xt = {
254
+ selector: "cds-table",
255
+ init: function(t) {
256
+ const e = c(t), s = this, n = Dt(s, t);
257
+ if (Pt(n)) {
258
+ t.dataBinder = n;
259
+ const o = wt(t);
260
+ t.skeleton = o;
261
+ const a = At(n);
262
+ t.pagination = a, t.after(a), n.fetchData().then((r) => {
263
+ o.hide(), a.setData(n), Q(s, t, e);
264
+ });
265
+ } else Q(s, t, e);
266
+ }
267
+ }, Bt = /* @__PURE__ */ f({ cdsPaginationWrap: () => Nt }), Nt = {
268
+ selector: "cds-pagination",
269
+ init: function(t) {
270
+ const e = this, s = customElements.get("cds-pagination");
271
+ let n = null;
272
+ e.listen(t, s.eventChangeCurrent, (o) => {
273
+ const a = o.detail.page, r = t.pageSize, i = (a - 1) * r;
274
+ i !== n && (n = i, e.dispatchPanelEvent("pagination-changed-current", { detail: {
275
+ page: a,
276
+ pageSize: r,
277
+ action: "page-change"
278
+ } }));
279
+ }), e.listen(t, s.eventPageSizeChanged, (o) => {
280
+ const a = t.pageSize;
281
+ n = null, e.dispatchPanelEvent("pagination-changed-page-size", { detail: {
282
+ page: 1,
283
+ pageSize: a,
284
+ action: "page-size-change"
285
+ } });
286
+ });
287
+ }
288
+ }, _t = /* @__PURE__ */ f({
289
+ cdsModalBodyContentWrap: () => qt,
290
+ cdsModalBodyWrap: () => zt,
291
+ cdsModalCloseButWrap: () => Rt,
292
+ cdsModalFooterButWrap: () => Ut,
293
+ cdsModalFooterWrap: () => Lt,
294
+ cdsModalHeaderWrap: () => Mt,
295
+ cdsModalHeadingWrap: () => Ft,
296
+ cdsModalLabelWrap: () => Ot,
297
+ cdsModalWrap: () => Tt
298
+ }), Tt = {
299
+ selector: "cds-modal",
300
+ init: function(t) {
301
+ const e = customElements.get("cds-modal"), s = c(t), n = W(t, "open-event", "event");
302
+ n && this.listen(t, "cds-modal-beingopened", (r) => {
303
+ this.dispatchPanelEvent(n, {
304
+ ...s,
305
+ action: "opened"
306
+ });
307
+ });
308
+ const o = t.getAttribute("before-close-event");
309
+ o && this.listen(t, e.eventBeforeClose, (r) => {
310
+ this.dispatchPanelEvent(o, {
311
+ ...s,
312
+ action: "closing",
313
+ cancelable: !0
314
+ });
315
+ }), this.listen(t, e.eventClose, (r) => {
316
+ this.dispatchPanelEvent("destroy_me", {
317
+ ...s,
318
+ action: "closed",
319
+ triggeredBy: r.detail?.triggeredBy
320
+ });
321
+ });
322
+ const a = W(t, "primary-event", "event");
323
+ a && this.listen(t, "cds-modal-primary-focus", (r) => {
324
+ this.dispatchPanelEvent(a, {
325
+ ...s,
326
+ action: "primary"
327
+ });
328
+ });
329
+ }
330
+ }, Mt = { selector: "cds-modal-header" }, Ft = { selector: "cds-modal-heading" }, Ot = { selector: "cds-modal-label" }, Rt = { selector: "cds-modal-close-button" }, zt = { selector: "cds-modal-body" }, qt = { selector: "cds-modal-body-content" }, Lt = { selector: "cds-modal-footer" }, Ut = {
331
+ selector: "cds-modal-footer-button",
332
+ init: function(t) {
333
+ const e = c(t);
334
+ if (t.getAttribute("type") === "submit") {
335
+ this.listen(t, "click", (n) => {
336
+ let o = t.closest("form");
337
+ if (!o) {
338
+ const a = t.getAttribute("form");
339
+ a && (o = document.getElementById(a));
340
+ }
341
+ o && o.requestSubmit();
342
+ });
343
+ return;
344
+ }
345
+ const s = e.event;
346
+ s && this.listen(t, "click", (n) => {
347
+ n.stopPropagation(), this.dispatchPanelEvent(s, e);
348
+ });
349
+ }
350
+ }, Ht = /* @__PURE__ */ f({
351
+ cdsMenuButtonWrap: () => jt,
352
+ cdsMenuWrap: () => $t
353
+ }), $t = {
354
+ selector: "cds-menu",
355
+ init: function(t) {
356
+ const e = c(t), s = W(t, "open-event");
357
+ s && this.listen(t, "cds-menu-opened", (o) => {
358
+ this.dispatchPanelEvent(s, {
359
+ ...e,
360
+ action: "opened"
361
+ });
362
+ });
363
+ const n = W(t, "close-event");
364
+ n && this.listen(t, "cds-menu-closed", (o) => {
365
+ this.dispatchPanelEvent(n, {
366
+ ...e,
367
+ action: "closed"
368
+ });
369
+ }), this.listen(t, "click", (o) => {
370
+ if (o.target.tagName === "CDS-MENU-ITEM") {
371
+ const a = c(o.target), r = a.event || e.event;
372
+ r && (o.stopPropagation(), this.dispatchPanelEvent(r, {
373
+ ...e,
374
+ ...a
375
+ }));
376
+ }
377
+ }), this.listen(t, "cds-item-changed", (o) => {
378
+ const a = o.detail.triggeredBy, r = c(a), i = r.event || e.event;
379
+ i && this.dispatchPanelEvent(i, {
380
+ ...e,
381
+ ...r,
382
+ action: "selection-changed"
383
+ });
384
+ });
385
+ }
386
+ }, jt = {
387
+ selector: "cds-menu-button",
388
+ init: function(t) {
389
+ const e = c(t), s = t.querySelector("cds-menu");
390
+ s && this.listen(s, "click", (n) => {
391
+ if (n.target.tagName === "CDS-MENU-ITEM") {
392
+ const o = c(n.target), a = o.event || e.event;
393
+ a && (n.stopPropagation(), this.dispatchPanelEvent(a, {
394
+ ...e,
395
+ ...o
396
+ }));
397
+ }
398
+ });
399
+ }
400
+ }, Gt = /* @__PURE__ */ f({
401
+ cdsButFabWrap: () => Kt,
402
+ cdsButtonWrap: () => Vt,
403
+ cdsComboButWrap: () => Xt,
404
+ cdsCopyButWrap: () => Qt,
405
+ cdsIconButToggleWrap: () => Jt,
406
+ cdsIconButWrap: () => Zt
407
+ }), Vt = {
408
+ selector: "cds-button",
409
+ init: function(t) {
410
+ const e = c(t);
411
+ if (t.getAttribute("type") === "submit") {
412
+ this.listen(t, "click", (n) => {
413
+ let o = t.closest("form");
414
+ if (!o) {
415
+ const a = t.getAttribute("form");
416
+ a && (o = document.getElementById(a));
417
+ }
418
+ o && o.requestSubmit();
419
+ });
420
+ return;
421
+ }
422
+ const s = e.event;
423
+ s && this.listen(t, "click", (n) => {
424
+ n.stopPropagation(), this.dispatchPanelEvent(s, c(t));
425
+ });
426
+ }
427
+ }, Zt = {
428
+ selector: "cds-icon-button:not([data-toggle])",
429
+ event: "click",
430
+ getData: (t, e) => e
431
+ }, Jt = {
432
+ selector: "cds-icon-button[data-toggle]",
433
+ init: function(t) {
434
+ const e = c(t);
435
+ e.event && this.listen(t, "click", (s) => {
436
+ s.stopPropagation(), t.isSelected = !t.isSelected, this.dispatchPanelEvent(e.event, {
437
+ ...e,
438
+ isOn: t.isSelected
439
+ });
440
+ });
441
+ }
442
+ }, Kt = {
443
+ selector: "cds-button[data-fab]",
444
+ event: "click",
445
+ getData: (t, e) => e
446
+ }, Qt = {
447
+ selector: "cds-copy-button",
448
+ init: function(t) {
449
+ const e = c(t), s = e.event;
450
+ s && this.listen(t, "click", (o) => {
451
+ o.stopPropagation(), this.dispatchPanelEvent(s, {
452
+ ...e,
453
+ action: "copy"
454
+ });
455
+ });
456
+ const n = t.getAttribute("success-event");
457
+ if (n) {
458
+ const o = new MutationObserver(() => {
459
+ t.hasAttribute("feedback-shown") && this.dispatchPanelEvent(n, {
460
+ ...e,
461
+ action: "copied"
462
+ });
463
+ });
464
+ o.observe(t, {
465
+ attributes: !0,
466
+ attributeFilter: ["feedback-shown"]
467
+ }), t._copyObserver = o;
468
+ }
469
+ }
470
+ }, Xt = {
471
+ selector: "cds-combo-button",
472
+ init: function(t) {
473
+ const e = c(t);
474
+ e.event && this.listen(t, "click", (n) => {
475
+ const o = n.composedPath(), a = o.some((i) => i.tagName === "CDS-MENU-ITEM"), r = o.some((i) => i.tagName === "CDS-ICON-BUTTON");
476
+ !a && !r && (n.stopPropagation(), this.dispatchPanelEvent(e.event, {
477
+ ...e,
478
+ action: "primary"
479
+ }));
480
+ });
481
+ const s = t.querySelector("cds-menu");
482
+ s && this.listen(s, "click", (n) => {
483
+ if (n.target.tagName === "CDS-MENU-ITEM") {
484
+ const o = c(n.target), a = o.event || W(t, "menu-event", "event");
485
+ a && this.dispatchPanelEvent(a, {
486
+ ...e,
487
+ ...o,
488
+ action: "menu-item"
489
+ });
490
+ }
491
+ });
492
+ }
493
+ }, Yt = /* @__PURE__ */ f({
494
+ cdsComboBoxWrap: () => ee,
495
+ cdsDropdownWrap: () => te,
496
+ cdsMultiSelectWrap: () => se
497
+ }), te = {
498
+ selector: "cds-dropdown",
499
+ init: function(t) {
500
+ const e = customElements.get("cds-dropdown"), s = c(t), n = s.event;
501
+ n && this.listen(t, e.eventSelect, (a) => {
502
+ this.dispatchPanelEvent(n, {
503
+ ...s,
504
+ value: t.value,
505
+ selectedValue: a.detail?.item?.value,
506
+ selectedText: a.detail?.item?.textContent?.trim()
507
+ });
508
+ });
509
+ const o = t.getAttribute("toggle-event");
510
+ o && this.listen(t, e.eventToggle, (a) => {
511
+ this.dispatchPanelEvent(o, {
512
+ ...s,
513
+ open: t.hasAttribute("open")
514
+ });
515
+ });
516
+ }
517
+ }, ee = {
518
+ selector: "cds-combo-box",
519
+ init: function(t) {
520
+ const e = customElements.get("cds-combo-box"), s = c(t), n = s.event;
521
+ n && this.listen(t, e.eventSelect, (a) => {
522
+ const r = a.detail?.item;
523
+ this.dispatchPanelEvent(n, {
524
+ ...s,
525
+ value: t.value,
526
+ selectedValue: r?.value,
527
+ selectedText: r?.textContent?.trim()
528
+ });
529
+ });
530
+ const o = t.getAttribute("toggle-event");
531
+ o && this.listen(t, e.eventToggle, (a) => {
532
+ this.dispatchPanelEvent(o, {
533
+ ...s,
534
+ open: t.hasAttribute("open")
535
+ });
536
+ });
537
+ }
538
+ }, se = {
539
+ selector: "cds-multi-select",
540
+ init: function(t) {
541
+ const e = customElements.get("cds-multi-select"), s = c(t), n = s.event;
542
+ n && this.listen(t, e.eventSelect, (a) => {
543
+ const r = t.value ? t.value.split(",") : [];
544
+ this.dispatchPanelEvent(n, {
545
+ ...s,
546
+ selectedItems: r
547
+ });
548
+ });
549
+ const o = t.getAttribute("toggle-event");
550
+ o && this.listen(t, e.eventToggle, (a) => {
551
+ this.dispatchPanelEvent(o, {
552
+ ...s,
553
+ open: t.hasAttribute("open")
554
+ });
555
+ });
556
+ }
557
+ }, ne = /* @__PURE__ */ f({
558
+ cdsDatePickerWrap: () => oe,
559
+ cdsTimePickerWrap: () => ae
560
+ }), oe = {
561
+ selector: "cds-date-picker",
562
+ init: function(t) {
563
+ const e = customElements.get("cds-date-picker"), s = c(t), n = t.querySelector('cds-date-picker-input[kind="from"]'), o = t.querySelector('cds-date-picker-input[kind="to"]'), a = n && o, r = s.event;
564
+ r && this.listen(t, e.eventChange, (d) => {
565
+ let I;
566
+ a ? I = {
567
+ from: n.value || "",
568
+ to: o.value || ""
569
+ } : I = t.value, this.dispatchPanelEvent(r, {
570
+ ...s,
571
+ value: I
572
+ });
573
+ });
574
+ const i = t.getAttribute("error-event");
575
+ i && this.listen(t, e.eventFlatpickrError, (d) => {
576
+ this.dispatchPanelEvent(i, {
577
+ ...s,
578
+ error: d.detail
579
+ });
580
+ });
581
+ }
582
+ }, ae = {
583
+ selector: "cds-time-picker",
584
+ event: "cds-time-picker-changed",
585
+ getData: (t, e, s) => ({
586
+ ...e,
587
+ value: s.value
588
+ })
589
+ }, re = /* @__PURE__ */ f({
590
+ cdsFileUploaderButtonWrap: () => ie,
591
+ cdsFileUploaderDropContainerWrap: () => pe,
592
+ cdsFileUploaderWrap: () => ce
593
+ }), ce = {
594
+ selector: "cds-file-uploader",
595
+ init: function(t) {
596
+ const e = c(t), s = e.event;
597
+ if (s) {
598
+ const o = t.querySelector('input[type="file"]');
599
+ o && this.listen(o, "change", (a) => {
600
+ this.dispatchPanelEvent(s, {
601
+ ...e,
602
+ files: Array.from(a.target.files || [])
603
+ });
604
+ });
605
+ }
606
+ const n = t.getAttribute("delete-event");
607
+ n && this.listen(t, "cds-file-uploader-item-deleted", (o) => {
608
+ this.dispatchPanelEvent(n, {
609
+ ...e,
610
+ fileName: o.detail?.fileName,
611
+ fileId: o.detail?.fileId
612
+ });
613
+ });
614
+ }
615
+ };
616
+ function ot(t, e) {
617
+ const s = new DataTransfer();
618
+ for (const n of e) s.items.add(n);
619
+ t.files = s.files, t.dispatchEvent(new Event("change", { bubbles: !0 }));
620
+ }
621
+ function at(t) {
622
+ const e = t.getAttribute("for");
623
+ if (!e)
624
+ return console.warn(`[Zooy] ${t.tagName.toLowerCase()} missing 'for' attribute; cannot bind to a form input.`, t), null;
625
+ const s = t.ownerDocument.getElementById(e);
626
+ return !s || s.tagName !== "INPUT" || s.type !== "file" ? (console.warn(`[Zooy] 'for=${e}' did not resolve to an <input type="file">.`, t), null) : s;
627
+ }
628
+ var ie = {
629
+ selector: "cds-file-uploader-button",
630
+ init: function(t) {
631
+ const e = at(t), s = c(t), n = s.event;
632
+ this.listen(t, "cds-file-uploader-button-changed", (o) => {
633
+ const a = o.detail?.addedFiles || [];
634
+ e && ot(e, a), n && this.dispatchPanelEvent(n, {
635
+ ...s,
636
+ files: Array.from(a)
637
+ });
638
+ });
639
+ }
640
+ };
641
+ function le(t, e, s, n) {
642
+ const o = t.querySelector(`[data-file-list-for="${e}"]`);
643
+ if (o) {
644
+ o.replaceChildren();
645
+ for (const a of s) {
646
+ const r = t.createElement("cds-file-uploader-item");
647
+ r.setAttribute("state", "edit"), r.textContent = a.name, r.addEventListener("cds-file-uploader-item-deleted", () => {
648
+ n(a.name);
649
+ }), o.appendChild(r);
650
+ }
651
+ }
652
+ }
653
+ function de(t, e) {
654
+ const s = new DataTransfer();
655
+ for (const n of t.files) n.name !== e && s.items.add(n);
656
+ t.files = s.files, t.dispatchEvent(new Event("change", { bubbles: !0 }));
657
+ }
658
+ var pe = {
659
+ selector: "cds-file-uploader-drop-container",
660
+ init: function(t) {
661
+ const e = at(t), s = c(t), n = s.event, o = t.getAttribute("for"), a = () => {
662
+ if (!o || !e) return;
663
+ const r = Array.from(e.files);
664
+ le(t.ownerDocument, o, r, (i) => {
665
+ de(e, i), a();
666
+ }), t.multiple || (t.style.display = r.length > 0 ? "none" : "");
667
+ };
668
+ this.listen(t, "cds-file-uploader-drop-container-changed", (r) => {
669
+ const i = r.detail?.addedFiles || [], d = t.multiple ? i : i.slice(0, 1);
670
+ e && ot(e, d), a(), n && this.dispatchPanelEvent(n, {
671
+ ...s,
672
+ files: Array.from(d)
673
+ });
674
+ });
675
+ }
676
+ }, ue = /* @__PURE__ */ f({
677
+ cdsAccordionWrap: () => me,
678
+ cdsContentSwitcherWrap: () => fe,
679
+ cdsTabsWrap: () => ve
680
+ }), ve = {
681
+ selector: "cds-tabs",
682
+ init: function(t) {
683
+ const e = customElements.get("cds-tabs"), s = c(t), n = t.getAttribute("before-select-event");
684
+ n && this.listen(t, e.eventBeforeSelect, (a) => {
685
+ this.dispatchPanelEvent(n, {
686
+ ...s,
687
+ tabValue: a.detail.value,
688
+ cancelable: !0
689
+ });
690
+ });
691
+ const o = s.event;
692
+ o && this.listen(t, e.eventSelect, (a) => {
693
+ const r = a.detail.item, i = c(r);
694
+ this.dispatchPanelEvent(o, {
695
+ ...s,
696
+ ...i,
697
+ tabValue: a.detail.value
698
+ });
699
+ });
700
+ }
701
+ }, me = {
702
+ selector: "cds-accordion",
703
+ init: function(t) {
704
+ const e = customElements.get("cds-accordion-item"), s = c(t);
705
+ [...t.querySelectorAll("cds-accordion-item")].forEach((n) => {
706
+ const o = c(n), a = o.event || s.event;
707
+ a && this.listen(n, e.eventToggle, (r) => {
708
+ this.dispatchPanelEvent(a, {
709
+ ...s,
710
+ ...o,
711
+ open: r.detail.open
712
+ });
713
+ });
714
+ });
715
+ }
716
+ }, fe = {
717
+ selector: "cds-content-switcher",
718
+ init: function(t) {
719
+ const e = customElements.get("cds-content-switcher"), s = c(t), n = t.getAttribute("before-select-event");
720
+ n && this.listen(t, e.eventBeforeSelect, (a) => {
721
+ this.dispatchPanelEvent(n, {
722
+ ...s,
723
+ value: a.detail.value,
724
+ cancelable: !0
725
+ });
726
+ });
727
+ const o = s.event;
728
+ o && this.listen(t, e.eventSelect, (a) => {
729
+ const r = a.detail.item, i = c(r);
730
+ this.dispatchPanelEvent(o, {
731
+ ...s,
732
+ ...i,
733
+ value: r.getAttribute("value")
734
+ });
735
+ });
736
+ }
737
+ }, he = /* @__PURE__ */ f({
738
+ cdsBreadCrumbWrap: () => Ee,
739
+ cdsBreadcrumbItemWrap: () => ge,
740
+ cdsBreadcrumbLinkWrap: () => be
741
+ }), ge = { selector: "cds-breadcrumb-item" }, be = {
742
+ selector: "cds-breadcrumb-link",
743
+ event: "click",
744
+ getData: (t, e, s) => (t.preventDefault(), {
745
+ ...e,
746
+ href: s.getAttribute("href")
747
+ })
748
+ }, Ee = {
749
+ selector: "cds-breadcrumb",
750
+ init: function(t) {
751
+ const e = this, s = c(t), n = s.event;
752
+ if (n) {
753
+ const o = (r) => {
754
+ e.dispatchPanelEvent(n, {
755
+ ...s,
756
+ ...r
757
+ });
758
+ };
759
+ e.listen(t, "click", (r) => {
760
+ const i = r.target.closest("cds-breadcrumb-link");
761
+ i && (r.preventDefault(), r.stopPropagation(), o(c(i)));
762
+ });
763
+ const a = t.querySelector("cds-overflow-menu-body");
764
+ a && e.listen(a, "cds-overflow-menu-item-clicked", (r) => {
765
+ r.stopPropagation(), o(c(r.target));
766
+ });
767
+ }
768
+ }
769
+ }, We = /* @__PURE__ */ f({
770
+ cdsNumberInputWrap: () => Pe,
771
+ cdsPasswordInputWrap: () => ke,
772
+ cdsSearchWrap: () => Ce,
773
+ cdsTextAreaWrap: () => Se,
774
+ cdsTextInputWrap: () => Ie
775
+ }), Ie = {
776
+ selector: "cds-text-input",
777
+ multiEvent: !0,
778
+ events: [{
779
+ type: "input",
780
+ attrName: "event",
781
+ getData: (t, e) => ({
782
+ ...e,
783
+ value: t.currentTarget.value
784
+ })
785
+ }, {
786
+ type: "change",
787
+ attrName: "change-event",
788
+ getData: (t, e) => ({
789
+ ...e,
790
+ value: t.currentTarget.value
791
+ })
792
+ }]
793
+ }, Se = {
794
+ selector: "cds-textarea",
795
+ multiEvent: !0,
796
+ events: [{
797
+ type: "input",
798
+ attrName: "event",
799
+ getData: (t, e) => ({
800
+ ...e,
801
+ value: t.currentTarget.value
802
+ })
803
+ }, {
804
+ type: "change",
805
+ attrName: "change-event",
806
+ getData: (t, e) => ({
807
+ ...e,
808
+ value: t.currentTarget.value
809
+ })
810
+ }]
811
+ }, Pe = {
812
+ selector: "cds-number-input",
813
+ event: "cds-number-input",
814
+ getData: (t, e, s) => ({
815
+ ...e,
816
+ value: t.detail.value,
817
+ direction: t.detail.direction
818
+ })
819
+ }, ke = {
820
+ selector: "cds-password-input",
821
+ multiEvent: !0,
822
+ events: [{
823
+ type: "input",
824
+ attrName: "event",
825
+ getData: (t, e) => ({
826
+ ...e,
827
+ value: t.currentTarget.value
828
+ })
829
+ }, {
830
+ type: "change",
831
+ attrName: "change-event",
832
+ getData: (t, e) => ({
833
+ ...e,
834
+ value: t.currentTarget.value
835
+ })
836
+ }]
837
+ }, Ce = {
838
+ selector: "cds-search",
839
+ event: "cds-search-input",
840
+ getData: (t, e, s) => ({
841
+ ...e,
842
+ value: s.value
843
+ })
844
+ }, ye = /* @__PURE__ */ f({
845
+ cdsCheckboxWrap: () => Ae,
846
+ cdsRadioButGroupWrap: () => we,
847
+ cdsSelectWrap: () => xe,
848
+ cdsSliderWrap: () => Be,
849
+ cdsToggleWrap: () => De
850
+ }), Ae = {
851
+ selector: "cds-checkbox",
852
+ event: "cds-checkbox-changed",
853
+ getData: (t, e, s) => ({
854
+ ...e,
855
+ checked: t.detail.checked,
856
+ value: s.value
857
+ })
858
+ }, we = {
859
+ selector: "cds-radio-button-group",
860
+ event: "cds-radio-button-group-changed",
861
+ getData: (t, e) => ({
862
+ ...e,
863
+ value: t.detail?.value
864
+ })
865
+ }, De = {
866
+ selector: "cds-toggle",
867
+ event: "cds-toggle-changed",
868
+ getData: (t, e) => ({
869
+ ...e,
870
+ isOn: t.detail.checked,
871
+ value: t.detail.checked
872
+ })
873
+ }, xe = {
874
+ selector: "cds-select",
875
+ event: "cds-select-selected",
876
+ getData: (t, e) => ({
877
+ ...e,
878
+ value: t.detail.value
879
+ })
880
+ }, Be = {
881
+ selector: "cds-slider",
882
+ init: function(t) {
883
+ const e = c(t), s = e.event;
884
+ s && this.listen(t, "cds-slider-changed", (o) => {
885
+ this.dispatchPanelEvent(s, {
886
+ ...e,
887
+ value: o.detail.value
888
+ });
889
+ });
890
+ const n = t.getAttribute("input-event");
891
+ n && this.listen(t, "cds-slider-input-changed", (o) => {
892
+ this.dispatchPanelEvent(n, {
893
+ ...e,
894
+ value: o.detail.value
895
+ });
896
+ });
897
+ }
898
+ }, Ne = /* @__PURE__ */ f({
899
+ cdsFilterTagWrap: () => Me,
900
+ cdsSDismissibleTagWrap: () => Te,
901
+ cdsTagsWrap: () => _e
902
+ }), _e = {
903
+ selector: "cds-tag",
904
+ event: "click",
905
+ getData: (t, e) => e
906
+ }, Te = {
907
+ selector: "cds-dismissible-tag",
908
+ init: function(t) {
909
+ const e = c(t), s = t.getAttribute("click-event");
910
+ s && this.listen(t, "click", (o) => {
911
+ o.target.closest("button") || this.dispatchPanelEvent(s, { ...e });
912
+ });
913
+ const n = e.event;
914
+ n && this.listen(t, "cds-dismissible-tag-closed", (o) => {
915
+ this.dispatchPanelEvent(n, {
916
+ ...e,
917
+ action: "closed"
918
+ });
919
+ });
920
+ }
921
+ }, Me = {
922
+ selector: "cds-filter-tag",
923
+ event: "cds-filter-tag-closed",
924
+ getData: (t, e) => ({
925
+ ...e,
926
+ action: "remove"
927
+ })
928
+ }, Fe = /* @__PURE__ */ f({
929
+ cdsContainedListDescriptionWrap: () => qe,
930
+ cdsContainedListItemWrap: () => Le,
931
+ cdsContainedListWrap: () => ze,
932
+ cdsOverflowMenuWrap: () => Oe,
933
+ cdsStructuredListWrap: () => Re,
934
+ cdsTreeViewWrap: () => Ue
935
+ }), Oe = {
936
+ selector: "cds-overflow-menu",
937
+ init: function(t) {
938
+ const e = c(t), s = e.event, n = t.querySelector("cds-overflow-menu-body");
939
+ s && n && this.listen(n, "cds-overflow-menu-item-clicked", (o) => {
940
+ o.stopPropagation();
941
+ const a = c(o.target);
942
+ this.dispatchPanelEvent(s, {
943
+ ...e,
944
+ ...a
945
+ });
946
+ });
947
+ }
948
+ }, Re = {
949
+ selector: "cds-structured-list",
950
+ init: function(t) {
951
+ const e = c(t);
952
+ [...t.querySelectorAll("cds-structured-list-row")].forEach((s) => {
953
+ const n = c(s), o = n.event || e.event;
954
+ o && this.listen(s, "click", (a) => {
955
+ a.stopPropagation(), this.dispatchPanelEvent(o, {
956
+ ...e,
957
+ ...n
958
+ });
959
+ });
960
+ }), t.hasAttribute("selection") && this.listen(t, "cds-structured-list-selected", (s) => {
961
+ const n = s.detail.row, o = c(n), a = e.event;
962
+ a && this.dispatchPanelEvent(a, {
963
+ ...e,
964
+ ...o
965
+ });
966
+ });
967
+ }
968
+ }, ze = { selector: "cds-contained-list" }, qe = { selector: "cds-contained-list-description" }, Le = {
969
+ selector: "cds-contained-list-item",
970
+ event: "cds-contained-list-item-click",
971
+ getData: (t, e) => e
972
+ }, Ue = {
973
+ selector: "cds-tree-view",
974
+ init: function(t) {
975
+ const e = c(t);
976
+ this.listen(t, "cds-tree-node-selected", (n) => {
977
+ const o = n.detail.node, a = c(o), r = a.event || e.event;
978
+ r && this.dispatchPanelEvent(r, {
979
+ ...e,
980
+ ...a,
981
+ nodeId: o.id,
982
+ label: o.getAttribute("label")
983
+ });
984
+ });
985
+ const s = W(t, "expand-event");
986
+ s && this.listen(t, "cds-tree-node-expanded", (n) => {
987
+ this.dispatchPanelEvent(s, {
988
+ ...e,
989
+ nodeId: n.detail.node.id,
990
+ expanded: n.detail.expanded
991
+ });
992
+ });
993
+ }
994
+ }, He = /* @__PURE__ */ f({
995
+ cdsActionableNotificationWrap: () => Ge,
996
+ cdsInlineNotificationWrap: () => je,
997
+ cdsToastNotificationWrap: () => $e
998
+ }), $e = {
999
+ selector: "cds-toast-notification",
1000
+ event: "cds-notification-closed",
1001
+ getData: (t, e) => ({
1002
+ ...e,
1003
+ action: "closed"
1004
+ })
1005
+ }, je = {
1006
+ selector: "cds-inline-notification",
1007
+ event: "cds-notification-closed",
1008
+ getData: (t, e) => ({
1009
+ ...e,
1010
+ action: "closed"
1011
+ })
1012
+ }, Ge = {
1013
+ selector: "cds-actionable-notification",
1014
+ init: function(t) {
1015
+ const e = c(t), s = W(t, "close-event", "event");
1016
+ s && this.listen(t, "cds-notification-closed", (o) => {
1017
+ this.dispatchPanelEvent(s, {
1018
+ ...e,
1019
+ action: "closed"
1020
+ });
1021
+ });
1022
+ const n = W(t, "action-event");
1023
+ n && this.listen(t, "cds-notification-actioned", (o) => {
1024
+ this.dispatchPanelEvent(n, {
1025
+ ...e,
1026
+ action: "actioned"
1027
+ });
1028
+ });
1029
+ }
1030
+ }, Ve = /* @__PURE__ */ f({
1031
+ cdsClickableTileWrap: () => Je,
1032
+ cdsExpandableTileWrap: () => Ke,
1033
+ cdsRadioTileWrap: () => Xe,
1034
+ cdsSelectableTileWrap: () => Qe,
1035
+ cdsTileGroupWrap: () => Ye,
1036
+ cdsTileWrap: () => Ze
1037
+ }), Ze = { selector: "cds-tile" }, Je = {
1038
+ selector: "cds-clickable-tile",
1039
+ init: function(t) {
1040
+ const e = c(t), s = e.event;
1041
+ if (s) {
1042
+ const n = e.href || t.getAttribute("href") || "";
1043
+ t.removeAttribute("href"), t.addEventListener("click", (o) => {
1044
+ o.preventDefault(), o.stopPropagation(), this.dispatchPanelEvent(s, {
1045
+ ...e,
1046
+ href: n
1047
+ });
1048
+ }, !0);
1049
+ }
1050
+ }
1051
+ }, Ke = {
1052
+ selector: "cds-expandable-tile",
1053
+ init: function(t) {
1054
+ const e = c(t), s = t.getAttribute("before-toggle-event");
1055
+ s && this.listen(t, "cds-expandable-tile-beingtoggled", (o) => {
1056
+ this.dispatchPanelEvent(s, {
1057
+ ...e,
1058
+ expanded: o.detail.expanded,
1059
+ cancelable: !0
1060
+ });
1061
+ });
1062
+ const n = e.event;
1063
+ n && this.listen(t, "cds-expandable-tile-toggled", (o) => {
1064
+ this.dispatchPanelEvent(n, {
1065
+ ...e,
1066
+ expanded: o.detail.expanded
1067
+ });
1068
+ });
1069
+ }
1070
+ }, Qe = {
1071
+ selector: "cds-selectable-tile",
1072
+ event: "cds-selectable-tile-changed",
1073
+ getData: (t, e, s) => ({
1074
+ ...e,
1075
+ selected: t.detail.selected,
1076
+ value: s.value
1077
+ })
1078
+ }, Xe = {
1079
+ selector: "cds-radio-tile",
1080
+ event: "cds-radio-tile-selected",
1081
+ getData: (t, e, s) => ({
1082
+ ...e,
1083
+ selected: t.detail.selected,
1084
+ name: t.detail.name,
1085
+ value: s.value
1086
+ })
1087
+ }, Ye = {
1088
+ selector: "cds-tile-group",
1089
+ init: function(t) {
1090
+ const e = c(t), s = e.event;
1091
+ s && (this.listen(t, "cds-current-radio-tile-selection", (n) => {
1092
+ const o = n.detail.target;
1093
+ this.dispatchPanelEvent(s, {
1094
+ ...e,
1095
+ value: o?.value,
1096
+ name: o?.name,
1097
+ selected: o?.selected
1098
+ });
1099
+ }), this.listen(t, "cds-current-selectable-tile-selections", (n) => {
1100
+ const o = n.detail.currentSelections || [];
1101
+ this.dispatchPanelEvent(s, {
1102
+ ...e,
1103
+ values: o.map((a) => a.value),
1104
+ names: o.map((a) => a.name),
1105
+ count: o.length
1106
+ });
1107
+ }));
1108
+ }
1109
+ }, ts = /* @__PURE__ */ f({
1110
+ cdsInlineLoadingWrap: () => ns,
1111
+ cdsProgressBarWrap: () => es,
1112
+ cdsProgressIndicatorWrap: () => ss
1113
+ }), es = {
1114
+ selector: "cds-progress-bar",
1115
+ init: function(t) {
1116
+ const e = c(t);
1117
+ if (e.event) {
1118
+ const s = new MutationObserver(() => {
1119
+ const n = parseFloat(t.getAttribute("value") || "0");
1120
+ n >= parseFloat(t.getAttribute("max") || "100") && this.dispatchPanelEvent(e.event, {
1121
+ ...e,
1122
+ value: n,
1123
+ status: "complete"
1124
+ });
1125
+ });
1126
+ s.observe(t, {
1127
+ attributes: !0,
1128
+ attributeFilter: ["value"]
1129
+ }), t._progressObserver = s;
1130
+ }
1131
+ }
1132
+ }, ss = {
1133
+ selector: "cds-progress-indicator",
1134
+ init: function(t) {
1135
+ const e = c(t);
1136
+ this.listen(t, "cds-progress-step-click", (s) => {
1137
+ const n = s.target, o = c(n), a = o.event || e.event;
1138
+ a && this.dispatchPanelEvent(a, {
1139
+ ...e,
1140
+ ...o,
1141
+ stepIndex: n.getAttribute("data-index"),
1142
+ stepLabel: n.getAttribute("label")
1143
+ });
1144
+ });
1145
+ }
1146
+ }, ns = {
1147
+ selector: "cds-inline-loading",
1148
+ init: function(t) {
1149
+ const e = c(t), s = e.event;
1150
+ s && this.listen(t, "cds-inline-loading-onsuccess", (o) => {
1151
+ this.dispatchPanelEvent(s, {
1152
+ ...e,
1153
+ status: "finished"
1154
+ });
1155
+ });
1156
+ const n = t.getAttribute("status-event");
1157
+ if (n) {
1158
+ const o = new MutationObserver((a) => {
1159
+ a.forEach((r) => {
1160
+ if (r.attributeName === "status") {
1161
+ const i = t.getAttribute("status");
1162
+ this.dispatchPanelEvent(n, {
1163
+ ...e,
1164
+ status: i
1165
+ });
1166
+ }
1167
+ });
1168
+ });
1169
+ o.observe(t, {
1170
+ attributes: !0,
1171
+ attributeFilter: ["status"]
1172
+ }), t._statusObserver = o;
1173
+ }
1174
+ }
1175
+ }, os = /* @__PURE__ */ f({
1176
+ cdsPopoverWrap: () => rs,
1177
+ cdsToggletipWrap: () => cs,
1178
+ cdsTooltipWrap: () => as
1179
+ }), as = {
1180
+ selector: "cds-tooltip",
1181
+ init: function(t) {
1182
+ const e = c(t), s = W(t, "open-event");
1183
+ s && this.listen(t, "cds-tooltip-beingopened", (o) => {
1184
+ this.dispatchPanelEvent(s, {
1185
+ ...e,
1186
+ action: "opened"
1187
+ });
1188
+ });
1189
+ const n = W(t, "close-event");
1190
+ n && this.listen(t, "cds-tooltip-closed", (o) => {
1191
+ this.dispatchPanelEvent(n, {
1192
+ ...e,
1193
+ action: "closed"
1194
+ });
1195
+ });
1196
+ }
1197
+ }, rs = {
1198
+ selector: "cds-popover",
1199
+ init: function(t) {
1200
+ const e = c(t), s = W(t, "open-event");
1201
+ s && this.listen(t, "cds-popover-beingopened", (o) => {
1202
+ this.dispatchPanelEvent(s, {
1203
+ ...e,
1204
+ action: "opened"
1205
+ });
1206
+ });
1207
+ const n = W(t, "close-event");
1208
+ n && this.listen(t, "cds-popover-closed", (o) => {
1209
+ this.dispatchPanelEvent(n, {
1210
+ ...e,
1211
+ action: "closed"
1212
+ });
1213
+ });
1214
+ }
1215
+ }, cs = {
1216
+ selector: "cds-toggletip",
1217
+ init: function(t) {
1218
+ const e = c(t);
1219
+ if (e.event) {
1220
+ const s = new MutationObserver((n) => {
1221
+ n.forEach((o) => {
1222
+ if (o.attributeName === "open") {
1223
+ const a = t.hasAttribute("open");
1224
+ this.dispatchPanelEvent(e.event, {
1225
+ ...e,
1226
+ action: a ? "opened" : "closed",
1227
+ open: a
1228
+ });
1229
+ }
1230
+ });
1231
+ });
1232
+ s.observe(t, {
1233
+ attributes: !0,
1234
+ attributeFilter: ["open"]
1235
+ }), t._toggletipObserver = s;
1236
+ }
1237
+ }
1238
+ }, is = /* @__PURE__ */ f({
1239
+ cdsCodeSnipWrap: () => ds,
1240
+ cdsLinkWrap: () => ls
1241
+ }), ls = {
1242
+ selector: "cds-link",
1243
+ event: "click",
1244
+ getData: (t, e, s) => ({
1245
+ ...e,
1246
+ href: s.getAttribute("href")
1247
+ })
1248
+ }, ds = {
1249
+ selector: "cds-code-snippet",
1250
+ event: "cds-copy-button-clicked",
1251
+ getData: (t, e) => ({
1252
+ ...e,
1253
+ action: "copied"
1254
+ })
1255
+ }, ps = /* @__PURE__ */ f({
1256
+ cdsBadgeIndicatorWrap: () => Ws,
1257
+ cdsFormGroupWrap: () => ms,
1258
+ cdsFormItemWrap: () => vs,
1259
+ cdsFormWrap: () => us,
1260
+ cdsHeadingWrap: () => hs,
1261
+ cdsIconIndicatorWrap: () => Es,
1262
+ cdsIconWrap: () => bs,
1263
+ cdsLoadingWrap: () => Is,
1264
+ cdsSectionWrap: () => gs,
1265
+ cdsSkeletonPlaceholderWrap: () => Ps,
1266
+ cdsSkeletonTextWrap: () => Ss,
1267
+ cdsStackWrap: () => fs
1268
+ }), us = { selector: "cds-form" }, vs = { selector: "cds-form-item" }, ms = { selector: "cds-form-group" }, fs = { selector: "cds-stack" }, hs = { selector: "cds-heading" }, gs = { selector: "cds-section" }, bs = { selector: "cds-icon" }, Es = { selector: "cds-icon-indicator" }, Ws = { selector: "cds-badge-indicator" }, Is = { selector: "cds-loading" }, Ss = { selector: "cds-skeleton-text" }, Ps = { selector: "cds-skeleton-placeholder" };
1269
+ function m(t) {
1270
+ return Object.values(t).filter((e) => typeof e == "object" && e !== null && e.selector);
1271
+ }
1272
+ var ks = [
1273
+ ...m(Bt),
1274
+ ...m(yt),
1275
+ ...m(_t),
1276
+ ...m(Ht),
1277
+ ...m(Gt),
1278
+ ...m(Yt),
1279
+ ...m(ne),
1280
+ ...m(re),
1281
+ ...m(ue),
1282
+ ...m(he),
1283
+ ...m(We),
1284
+ ...m(ye),
1285
+ ...m(Ne),
1286
+ ...m(Fe),
1287
+ ...m(He),
1288
+ ...m(Ve),
1289
+ ...m(ts),
1290
+ ...m(os),
1291
+ ...m(is),
1292
+ ...m(ps)
1293
+ ];
1294
+ function Cs() {
1295
+ const t = /* @__PURE__ */ new Map();
1296
+ return ks.forEach((e) => {
1297
+ t.set(e.selector, e);
1298
+ }), t;
1299
+ }
1300
+ var ys = () => import("@carbon/web-components/es/components/accordion/index.js"), L = () => import("@carbon/web-components/es/components/breadcrumb/index.js"), As = () => import("@carbon/web-components/es/components/stack/index.js"), ws = () => import("@carbon/web-components/es/components/structured-list/index.js"), U = () => import("@carbon/web-components/es/components/contained-list/index.js"), B = () => import("@carbon/web-components/es/components/tile/index.js"), Ds = () => import("@carbon/web-components/es/components/tree-view/index.js"), xs = () => import("@carbon/web-components/es/components/link/index.js"), Bs = () => import("@carbon/web-components/es/components/tabs/index.js"), Ns = () => import("@carbon/web-components/es/components/content-switcher/index.js"), X = () => import("@carbon/web-components/es/components/menu/index.js"), _s = () => import("@carbon/web-components/es/components/overflow-menu/index.js"), H = () => import("@carbon/web-components/es/components/button/index.js"), Y = () => import("@carbon/web-components/es/components/icon-button/index.js"), Ts = () => import("@carbon/web-components/es/components/combo-button/index.js"), Ms = () => import("@carbon/web-components/es/components/copy-button/index.js"), Fs = () => import("@carbon/web-components/es/components/checkbox/index.js"), Os = () => import("@carbon/web-components/es/components/radio-button/index.js"), Rs = () => import("@carbon/web-components/es/components/toggle/index.js"), $ = () => import("@carbon/web-components/es/components/select/index.js"), zs = () => import("@carbon/web-components/es/components/slider/index.js"), j = () => import("@carbon/web-components/es/components/text-input/index.js"), qs = () => import("@carbon/web-components/es/components/textarea/index.js"), Ls = () => import("@carbon/web-components/es/components/number-input/index.js"), Us = () => import("@carbon/web-components/es/components/password-input/index.js"), tt = () => import("@carbon/web-components/es/components/search/index.js"), Hs = () => import("@carbon/web-components/es/components/combo-box/index.js"), $s = () => import("@carbon/web-components/es/components/dropdown/index.js"), js = () => import("@carbon/web-components/es/components/multi-select/index.js"), Gs = () => import("@carbon/web-components/es/components/date-picker/index.js"), Vs = () => import("@carbon/web-components/es/components/time-picker/index.js"), T = () => import("@carbon/web-components/es/components/file-uploader/index.js"), et = () => import("@carbon/web-components/es/components/form/index.js"), Zs = () => import("@carbon/web-components/es/components/form-group/index.js"), Js = () => import("@carbon/web-components/es/components/data-table/index.js"), st = () => import("@carbon/web-components/es/components/pagination/index.js"), Ks = () => import("@carbon/web-components/es/components/code-snippet/index.js"), G = () => import("@carbon/web-components/es/components/tag/index.js"), Qs = () => import("@carbon/web-components/es/components/badge-indicator/index.js"), V = () => import("@carbon/web-components/es/components/notification/index.js"), Xs = () => import("@carbon/web-components/es/components/loading/index.js"), Ys = () => import("@carbon/web-components/es/components/inline-loading/index.js"), tn = () => import("@carbon/web-components/es/components/progress-bar/index.js"), en = () => import("@carbon/web-components/es/components/progress-indicator/index.js"), sn = () => import("@carbon/web-components/es/components/skeleton-placeholder/index.js"), nn = () => import("@carbon/web-components/es/components/skeleton-text/index.js"), k = () => import("@carbon/web-components/es/components/modal/index.js"), C = () => import("@carbon/web-components/es/components/tooltip/index.js"), on = () => import("@carbon/web-components/es/components/popover/index.js"), an = () => import("@carbon/web-components/es/components/toggle-tip/index.js"), nt = () => import("@carbon/web-components/es/components/heading/index.js"), rn = () => import("@carbon/web-components/es/components/icon/index.js"), cn = () => import("@carbon/web-components/es/components/icon-indicator/index.js"), O = {
1301
+ "cds-table": [
1302
+ C,
1303
+ H,
1304
+ j,
1305
+ tt,
1306
+ $,
1307
+ st,
1308
+ Js
1309
+ ],
1310
+ "cds-pagination": [
1311
+ $,
1312
+ j,
1313
+ st
1314
+ ],
1315
+ "cds-button": [C, H],
1316
+ "cds-icon-button:not([data-toggle])": [C, Y],
1317
+ "cds-icon-button[data-toggle]": [C, Y],
1318
+ "cds-button[data-fab]": [C, H],
1319
+ "cds-copy-button": [C, Ms],
1320
+ "cds-combo-button": [C, Ts],
1321
+ "cds-checkbox": [Fs],
1322
+ "cds-radio-button-group": [Os],
1323
+ "cds-toggle": [Rs],
1324
+ "cds-select": [$],
1325
+ "cds-slider": [zs],
1326
+ "cds-text-input": [j],
1327
+ "cds-textarea": [qs],
1328
+ "cds-number-input": [Ls],
1329
+ "cds-password-input": [C, Us],
1330
+ "cds-search": [tt],
1331
+ "cds-dropdown": [$s],
1332
+ "cds-combo-box": [Hs],
1333
+ "cds-multi-select": [js],
1334
+ "cds-date-picker": [Gs],
1335
+ "cds-time-picker": [Vs],
1336
+ "cds-file-uploader": [T],
1337
+ "cds-file-uploader-button": [T],
1338
+ "cds-file-uploader-drop-container": [T],
1339
+ "cds-file-uploader-item": [T],
1340
+ "cds-tabs": [Bs],
1341
+ "cds-accordion": [ys],
1342
+ "cds-content-switcher": [Ns],
1343
+ "cds-breadcrumb": [L],
1344
+ "cds-breadcrumb-item": [L],
1345
+ "cds-breadcrumb-link": [L],
1346
+ "cds-menu": [X],
1347
+ "cds-menu-button": [X],
1348
+ "cds-overflow-menu": [_s],
1349
+ "cds-structured-list": [ws],
1350
+ "cds-contained-list": [U],
1351
+ "cds-contained-list-item": [U],
1352
+ "cds-contained-list-description": [U],
1353
+ "cds-tree-view": [Ds],
1354
+ "cds-modal": [k],
1355
+ "cds-modal-header": [k],
1356
+ "cds-modal-heading": [k],
1357
+ "cds-modal-label": [k],
1358
+ "cds-modal-close-button": [k],
1359
+ "cds-modal-body": [k],
1360
+ "cds-modal-body-content": [k],
1361
+ "cds-modal-footer": [k],
1362
+ "cds-modal-footer-button": [k],
1363
+ "cds-toast-notification": [V],
1364
+ "cds-inline-notification": [V],
1365
+ "cds-actionable-notification": [V],
1366
+ "cds-tile": [B],
1367
+ "cds-tile-group": [B],
1368
+ "cds-clickable-tile": [B],
1369
+ "cds-expandable-tile": [B],
1370
+ "cds-selectable-tile": [B],
1371
+ "cds-radio-tile": [B],
1372
+ "cds-progress-bar": [tn],
1373
+ "cds-progress-indicator": [en],
1374
+ "cds-inline-loading": [Ys],
1375
+ "cds-tooltip": [C],
1376
+ "cds-popover": [on],
1377
+ "cds-toggletip": [an],
1378
+ "cds-tag": [G],
1379
+ "cds-dismissible-tag": [G],
1380
+ "cds-filter-tag": [G],
1381
+ "cds-link": [xs],
1382
+ "cds-code-snippet": [Ks],
1383
+ "cds-form": [et],
1384
+ "cds-form-item": [et],
1385
+ "cds-form-group": [Zs],
1386
+ "cds-stack": [As],
1387
+ "cds-heading": [nt],
1388
+ "cds-section": [nt],
1389
+ "cds-icon": [rn],
1390
+ "cds-icon-indicator": [cn],
1391
+ "cds-badge-indicator": [Qs],
1392
+ "cds-loading": [Xs],
1393
+ "cds-skeleton-text": [nn],
1394
+ "cds-skeleton-placeholder": [sn]
1395
+ };
1396
+ function ln(t) {
1397
+ const e = /* @__PURE__ */ new Map();
1398
+ if (!t || !(t instanceof Element)) return e;
1399
+ for (const n of Object.keys(F)) e.set(n, []);
1400
+ for (const [n] of Object.entries(F)) t.matches(n) && e.get(n).push(t);
1401
+ const s = t.querySelectorAll("*");
1402
+ for (const n of s) for (const [o] of Object.entries(F)) n.matches(o) && e.get(o).push(n);
1403
+ for (const [n, o] of e.entries()) o.length === 0 && e.delete(n);
1404
+ return e;
1405
+ }
1406
+ function dn(t) {
1407
+ const e = /* @__PURE__ */ new Set();
1408
+ for (const [s, n] of t.entries()) n.length > 0 && O[s] && O[s].forEach((o) => e.add(o));
1409
+ return e;
1410
+ }
1411
+ async function pn(t, e) {
1412
+ if (t.size === 0) return;
1413
+ const s = Array.from(t).map(async (n) => (e.has(n) || e.set(n, n()), e.get(n)));
1414
+ await Promise.all(s);
1415
+ }
1416
+ function un(t, e) {
1417
+ let s = 0;
1418
+ for (const [n, o] of t.entries()) {
1419
+ const a = F[n];
1420
+ o.forEach((r) => {
1421
+ if (a.init) {
1422
+ a.init.call(e, r);
1423
+ return;
1424
+ }
1425
+ if (a.multiEvent) {
1426
+ const I = c(r);
1427
+ a.events.forEach((S) => {
1428
+ const D = W(r, S.attrName, "event");
1429
+ D && e.listen(r, S.type, (R) => {
1430
+ e.dispatchPanelEvent(D, S.getData(R, I, r));
1431
+ });
1432
+ });
1433
+ return;
1434
+ }
1435
+ const i = c(r), d = i.event;
1436
+ d && e.listen(r, a.event, (I) => {
1437
+ I.stopPropagation();
1438
+ const S = a.getData(I, i, r), D = S._eventOverride || d;
1439
+ delete S._eventOverride, e.dispatchPanelEvent(D, S);
1440
+ });
1441
+ }), s += o.length;
1442
+ }
1443
+ return s;
1444
+ }
1445
+ var F = Object.fromEntries(Cs()), vn = async function(t, e) {
1446
+ const s = ln(t);
1447
+ if (s.size === 0) {
1448
+ this.debugMe("[Carbon] No Carbon components found in panel");
1449
+ return;
1450
+ }
1451
+ this.carbonComponents || (this.carbonComponents = /* @__PURE__ */ new Map());
1452
+ for (const [a, r] of s.entries()) this.carbonComponents.set(a, r);
1453
+ const n = dn(s);
1454
+ if (n.size > 0) try {
1455
+ await pn(n, e);
1456
+ } catch (a) {
1457
+ console.error("[Carbon] Failed to load some component modules:", a);
1458
+ }
1459
+ const o = un(s, this);
1460
+ o > 0 && this.debugMe(`[Carbon] Total components initialized: ${o}`);
1461
+ }, bn = (t = {}) => {
1462
+ const { preload: e = [] } = t, s = /* @__PURE__ */ new Map();
1463
+ if (e.length > 0) {
1464
+ const n = e.filter((a) => O[a] ? !0 : (console.warn(`[Carbon] No import found for selector: ${a}`), !1)), o = n.flatMap((a) => O[a].map((r) => (s.has(r) || s.set(r, r()), s.get(r))));
1465
+ Promise.all(o).then(() => console.debug(`[Carbon] Preloaded: ${n.join(", ")}`)).catch((a) => console.warn("[Carbon] Preload error:", a));
1466
+ }
1467
+ It.register("carbon", {
1468
+ cache: s,
1469
+ render: async function(n, o) {
1470
+ try {
1471
+ await vn.call(this, n, o);
1472
+ } catch (a) {
1473
+ console.error("[Carbon] Initialization error:", a);
1474
+ }
1475
+ },
1476
+ dispose: function(n) {
1477
+ },
1478
+ config: {
1479
+ version: "2.0",
1480
+ description: "IBM Carbon Design System Web Components"
1481
+ }
1482
+ }), console.debug("[Zooy] Carbon Design System library registered");
1483
+ };
1484
+ export {
1485
+ bn as registerCarbonLibrary
1486
+ };