@trintel/zooy 1.6.1 → 1.8.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.
@@ -0,0 +1,1507 @@
1
+ import { n as f, t as St } from "./component-library-registry-DB5UeqC2.js";
2
+ import { i as Pt, n as W, r as i } from "./zoo-CaW98OQn.js";
3
+ import { isDefAndNotNull as yt, 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 At = /* @__PURE__ */ f({ cdsTableWrap: () => _t }), 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, c = e.pagination, d = e.skeleton, I = e.querySelector(n.selectorTableToolbarSearch), S = e.querySelector(n.selectorTableBatchActions), D = e.querySelector(n.selectorTableBody), O = [
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]"), ct = e.isSortable || Z.length > 0, R = /* @__PURE__ */ Symbol(), L = /* @__PURE__ */ Symbol(), x = /* @__PURE__ */ new Map(), it = (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(O))) return;
22
+ p.stopPropagation();
23
+ const v = i(u);
24
+ t.dispatchPanelEvent(l, { ...v });
25
+ });
26
+ }, lt = (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
+ ...i(u),
31
+ target: u,
32
+ allRows: v,
33
+ didExpand: h
34
+ };
35
+ t.dispatchPanelEvent(l, b);
36
+ });
37
+ }, dt = (l) => {
38
+ x.set(R, (p) => {
39
+ t.dispatchPanelEvent(l, p);
40
+ });
41
+ }, pt = (l) => {
42
+ x.set(L, (p) => {
43
+ const u = p.detail.selectedRows, v = Math.min(u.length, S.totalRowsCount), h = p.target, b = i(h), P = u.map(i), C = {
44
+ tableAttrs: s,
45
+ ...b,
46
+ target: h,
47
+ selectCount: v,
48
+ selection: P
49
+ };
50
+ t.dispatchPanelEvent(l, C);
51
+ });
52
+ }, ut = (l) => {
53
+ t.listen(e, n.eventTableRowSelect, (p) => {
54
+ const u = p.target, v = p.detail.selectedRows || [], h = v.length, b = v.map(i), P = {
55
+ tableAttrs: s,
56
+ ...i(u),
57
+ selectCount: h,
58
+ selection: b,
59
+ target: u
60
+ };
61
+ t.dispatchPanelEvent(l, P);
62
+ });
63
+ }, vt = () => {
64
+ t.listen(e, n.eventBeforeSort, (l) => {
65
+ const p = l.target, u = l.detail.oldSortDirection, v = l.detail.sortDirection, h = i(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 C = { ordering: P };
70
+ r.fetchData(C).then(() => {
71
+ c.setData(r), d && d.hide();
72
+ }), x.has(R) && x.get(R)({
73
+ tableAttrs: s,
74
+ ...h,
75
+ sortNow: v,
76
+ sortWas: u,
77
+ sortField: b,
78
+ ordering: P,
79
+ target: p
80
+ });
81
+ });
82
+ }, mt = () => {
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(L) && x.get(L)(l);
87
+ });
88
+ }, ft = () => {
89
+ t.listen(e, n.eventBeforeChangeSelectionAll, (l) => {
90
+ l.stopPropagation(), l.detail.callback && l.detail.callback();
91
+ });
92
+ }, ht = (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
+ }, gt = (l) => {
110
+ t.listen(l, "keydown", (p) => {
111
+ if (p.key === "Enter") {
112
+ d && d.show(), c.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
+ c.setData(r), d && d.hide();
119
+ });
120
+ }
121
+ });
122
+ }, bt = (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(), c.setData(r);
131
+ });
132
+ }
133
+ });
134
+ }, Et = (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(i).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(), C = [...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 [B, N] = w.split(":");
157
+ g.has(B) || g.set(B, []), E.checked && g.get(B).push(N);
158
+ }), g;
159
+ };
160
+ if (C.has(b)) {
161
+ const g = (E) => E.checked = !1;
162
+ t.listen(C.get(b), "click", (E) => {
163
+ E.stopPropagation(), u.forEach(g), d && d.show(), r.fetchData(h).then(() => {
164
+ c && c.setData(r), d && d.hide(), l.open = !1;
165
+ });
166
+ });
167
+ }
168
+ C.has(P) && t.listen(C.get(P), "click", (g) => {
169
+ g.stopPropagation();
170
+ const E = [...A()].reduce((w, [B, N]) => (w[B] = Array.isArray(N) && N.length === 0 ? null : N, w), { offset: 0 });
171
+ d && d.show(), r.fetchData(E).then(() => {
172
+ c && c.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
+ }, Wt = () => {
178
+ t.listen(c, o.eventPageSizeChanged, (l) => {
179
+ const p = {
180
+ limit: c.pageSize,
181
+ offset: 0
182
+ };
183
+ r.fetchData(p).then(() => {
184
+ c.setData(r);
185
+ });
186
+ });
187
+ }, It = () => {
188
+ let l = null;
189
+ t.listen(c, o.eventChangeCurrent, (p) => {
190
+ const { page: u } = p.detail, v = c.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
+ c.setData(r), d && d.hide();
199
+ });
200
+ }
201
+ });
202
+ };
203
+ r && c && (Wt(), It()), r && I && (gt(I), bt(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(Et);
208
+ }
209
+ e.isSelectable && (mt(), ft(), S && ht(S)), r && ct && vt();
210
+ const K = { zoo: { event: {
211
+ row: {
212
+ click: it,
213
+ expand: lt,
214
+ check: {
215
+ one: ut,
216
+ all: pt
217
+ }
218
+ },
219
+ column: { sort: dt }
220
+ } } };
221
+ kt(s).forEach(([l, p]) => {
222
+ M.hasPath(l, K) && M.path(l, K)(p);
223
+ });
224
+ }, wt = (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
+ }, Dt = (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"), c = document.createElement("cds-table-skeleton");
247
+ c.showHeader = e || s, c.showToolbar = n, c.zebra = a, c.columnCount = o, c.size = r, c.show = () => c.classList.remove("hidden"), c.hide = () => c.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(c), d.appendChild(t), c;
250
+ }, xt = (t, e) => {
251
+ const s = e.getAttribute("zoo-url-api"), n = parseInt(e.getAttribute("data-page-size") || 25, 10);
252
+ if (s) return new Pt(t, s, e, { urlParams: { limit: n } });
253
+ }, _t = {
254
+ selector: "cds-table",
255
+ init: function(t) {
256
+ const e = i(t), s = this, n = xt(s, t);
257
+ if (yt(n)) {
258
+ t.dataBinder = n;
259
+ const o = Dt(t);
260
+ t.skeleton = o;
261
+ const a = wt(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, c = (a - 1) * r;
274
+ c !== n && (n = c, 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
+ }, Tt = /* @__PURE__ */ f({
289
+ cdsModalBodyContentWrap: () => qt,
290
+ cdsModalBodyWrap: () => Lt,
291
+ cdsModalCloseButWrap: () => Rt,
292
+ cdsModalFooterButWrap: () => $t,
293
+ cdsModalFooterWrap: () => Ut,
294
+ cdsModalHeaderWrap: () => Ft,
295
+ cdsModalHeadingWrap: () => zt,
296
+ cdsModalLabelWrap: () => Ot,
297
+ cdsModalWrap: () => Mt
298
+ }), Mt = {
299
+ selector: "cds-modal",
300
+ init: function(t) {
301
+ const e = customElements.get("cds-modal"), s = i(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
+ }, Ft = { selector: "cds-modal-header" }, zt = { selector: "cds-modal-heading" }, Ot = { selector: "cds-modal-label" }, Rt = { selector: "cds-modal-close-button" }, Lt = { selector: "cds-modal-body" }, qt = { selector: "cds-modal-body-content" }, Ut = { selector: "cds-modal-footer" }, $t = {
331
+ selector: "cds-modal-footer-button",
332
+ init: function(t) {
333
+ const e = i(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: () => Gt,
352
+ cdsMenuWrap: () => jt
353
+ }), jt = {
354
+ selector: "cds-menu",
355
+ init: function(t) {
356
+ const e = i(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 = i(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 = i(a), c = r.event || e.event;
379
+ c && this.dispatchPanelEvent(c, {
380
+ ...e,
381
+ ...r,
382
+ action: "selection-changed"
383
+ });
384
+ });
385
+ }
386
+ }, Gt = {
387
+ selector: "cds-menu-button",
388
+ init: function(t) {
389
+ const e = i(t), s = t.querySelector("cds-menu");
390
+ s && this.listen(s, "click", (n) => {
391
+ if (n.target.tagName === "CDS-MENU-ITEM") {
392
+ const o = i(n.target), a = o.event || e.event;
393
+ a && (n.stopPropagation(), this.dispatchPanelEvent(a, {
394
+ ...e,
395
+ ...o
396
+ }));
397
+ }
398
+ });
399
+ }
400
+ }, Vt = /* @__PURE__ */ f({
401
+ cdsButFabWrap: () => Qt,
402
+ cdsButtonWrap: () => Zt,
403
+ cdsComboButWrap: () => Yt,
404
+ cdsCopyButWrap: () => Xt,
405
+ cdsIconButToggleWrap: () => Kt,
406
+ cdsIconButWrap: () => Jt
407
+ }), Zt = {
408
+ selector: "cds-button",
409
+ init: function(t) {
410
+ const e = i(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, i(t));
425
+ });
426
+ }
427
+ }, Jt = {
428
+ selector: "cds-icon-button:not([data-toggle])",
429
+ event: "click",
430
+ getData: (t, e) => e
431
+ }, Kt = {
432
+ selector: "cds-icon-button[data-toggle]",
433
+ init: function(t) {
434
+ const e = i(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
+ }, Qt = {
443
+ selector: "cds-button[data-fab]",
444
+ event: "click",
445
+ getData: (t, e) => e
446
+ }, Xt = {
447
+ selector: "cds-copy-button",
448
+ init: function(t) {
449
+ const e = i(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
+ }, Yt = {
471
+ selector: "cds-combo-button",
472
+ init: function(t) {
473
+ const e = i(t);
474
+ e.event && this.listen(t, "click", (n) => {
475
+ const o = n.composedPath(), a = o.some((c) => c.tagName === "CDS-MENU-ITEM"), r = o.some((c) => c.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 = i(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
+ }, te = /* @__PURE__ */ f({
494
+ cdsComboBoxWrap: () => se,
495
+ cdsDropdownWrap: () => ee,
496
+ cdsMultiSelectWrap: () => ne
497
+ }), ee = {
498
+ selector: "cds-dropdown",
499
+ init: function(t) {
500
+ const e = customElements.get("cds-dropdown"), s = i(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
+ }, se = {
518
+ selector: "cds-combo-box",
519
+ init: function(t) {
520
+ const e = customElements.get("cds-combo-box"), s = i(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
+ }, ne = {
539
+ selector: "cds-multi-select",
540
+ init: function(t) {
541
+ const e = customElements.get("cds-multi-select"), s = i(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
+ }, oe = /* @__PURE__ */ f({
558
+ cdsDatePickerWrap: () => ae,
559
+ cdsTimePickerWrap: () => re
560
+ }), ae = {
561
+ selector: "cds-date-picker",
562
+ init: function(t) {
563
+ const e = customElements.get("cds-date-picker"), s = i(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 c = t.getAttribute("error-event");
575
+ c && this.listen(t, e.eventFlatpickrError, (d) => {
576
+ this.dispatchPanelEvent(c, {
577
+ ...s,
578
+ error: d.detail
579
+ });
580
+ });
581
+ }
582
+ }, re = {
583
+ selector: "cds-time-picker",
584
+ event: "cds-time-picker-changed",
585
+ getData: (t, e, s) => ({
586
+ ...e,
587
+ value: s.value
588
+ })
589
+ }, ce = /* @__PURE__ */ f({
590
+ cdsFileUploaderButtonWrap: () => le,
591
+ cdsFileUploaderDropContainerWrap: () => ue,
592
+ cdsFileUploaderWrap: () => ie
593
+ });
594
+ function ot(t) {
595
+ customElements.whenDefined(t).then((e) => {
596
+ if (!(!e || e.prototype.__zooyAcceptPatched)) {
597
+ if (typeof e.prototype._getFiles != "function") {
598
+ console.warn(`[Zooy] ${t}._getFiles missing; accept-split patch skipped (Carbon may have refactored).`);
599
+ return;
600
+ }
601
+ e.prototype._getFiles = function(s, n) {
602
+ if (n === void 0 && (n = (s.type === "drop" ? s.dataTransfer : s.target)?.files), !this.accept || !/^(change|drop)$/.test(s.type)) return Array.from(n ?? []);
603
+ const o = new Set(this.accept.split(/[\s,]+/).filter(Boolean));
604
+ return Array.prototype.filter.call(n ?? [], ({ name: a, type: r = "" }) => {
605
+ const c = a.match(/\.[^.]+$/), d = c ? c[0].toLowerCase() : void 0;
606
+ return o.has(r) || d && o.has(d);
607
+ });
608
+ }, e.prototype.__zooyAcceptPatched = !0;
609
+ }
610
+ });
611
+ }
612
+ ot("cds-file-uploader-drop-container");
613
+ ot("cds-file-uploader-button");
614
+ var ie = {
615
+ selector: "cds-file-uploader",
616
+ init: function(t) {
617
+ const e = i(t), s = e.event;
618
+ if (s) {
619
+ const o = t.querySelector('input[type="file"]');
620
+ o && this.listen(o, "change", (a) => {
621
+ this.dispatchPanelEvent(s, {
622
+ ...e,
623
+ files: Array.from(a.target.files || [])
624
+ });
625
+ });
626
+ }
627
+ const n = t.getAttribute("delete-event");
628
+ n && this.listen(t, "cds-file-uploader-item-deleted", (o) => {
629
+ this.dispatchPanelEvent(n, {
630
+ ...e,
631
+ fileName: o.detail?.fileName,
632
+ fileId: o.detail?.fileId
633
+ });
634
+ });
635
+ }
636
+ };
637
+ function at(t, e) {
638
+ const s = new DataTransfer();
639
+ for (const n of e) s.items.add(n);
640
+ t.files = s.files, t.dispatchEvent(new Event("change", { bubbles: !0 }));
641
+ }
642
+ function rt(t) {
643
+ const e = t.getAttribute("for");
644
+ if (!e)
645
+ return console.warn(`[Zooy] ${t.tagName.toLowerCase()} missing 'for' attribute; cannot bind to a form input.`, t), null;
646
+ const s = t.ownerDocument.getElementById(e);
647
+ return !s || s.tagName !== "INPUT" || s.type !== "file" ? (console.warn(`[Zooy] 'for=${e}' did not resolve to an <input type="file">.`, t), null) : s;
648
+ }
649
+ var le = {
650
+ selector: "cds-file-uploader-button",
651
+ init: function(t) {
652
+ const e = rt(t), s = i(t), n = s.event;
653
+ this.listen(t, "cds-file-uploader-button-changed", (o) => {
654
+ const a = o.detail?.addedFiles || [];
655
+ e && at(e, a), n && this.dispatchPanelEvent(n, {
656
+ ...s,
657
+ files: Array.from(a)
658
+ });
659
+ });
660
+ }
661
+ };
662
+ function de(t, e, s, n) {
663
+ const o = t.querySelector(`[data-file-list-for="${e}"]`);
664
+ if (o) {
665
+ o.replaceChildren();
666
+ for (const a of s) {
667
+ const r = t.createElement("cds-file-uploader-item");
668
+ r.setAttribute("state", "edit"), r.textContent = a.name, r.addEventListener("cds-file-uploader-item-deleted", () => {
669
+ n(a.name);
670
+ }), o.appendChild(r);
671
+ }
672
+ }
673
+ }
674
+ function pe(t, e) {
675
+ const s = new DataTransfer();
676
+ for (const n of t.files) n.name !== e && s.items.add(n);
677
+ t.files = s.files, t.dispatchEvent(new Event("change", { bubbles: !0 }));
678
+ }
679
+ var ue = {
680
+ selector: "cds-file-uploader-drop-container",
681
+ init: function(t) {
682
+ const e = rt(t), s = i(t), n = s.event, o = t.getAttribute("for"), a = () => {
683
+ if (!o || !e) return;
684
+ const r = Array.from(e.files);
685
+ de(t.ownerDocument, o, r, (c) => {
686
+ pe(e, c), a();
687
+ }), t.multiple || (t.style.display = r.length > 0 ? "none" : "");
688
+ };
689
+ this.listen(t, "cds-file-uploader-drop-container-changed", (r) => {
690
+ const c = r.detail?.addedFiles || [], d = t.multiple ? c : c.slice(0, 1);
691
+ e && at(e, d), a(), n && this.dispatchPanelEvent(n, {
692
+ ...s,
693
+ files: Array.from(d)
694
+ });
695
+ });
696
+ }
697
+ }, ve = /* @__PURE__ */ f({
698
+ cdsAccordionWrap: () => fe,
699
+ cdsContentSwitcherWrap: () => he,
700
+ cdsTabsWrap: () => me
701
+ }), me = {
702
+ selector: "cds-tabs",
703
+ init: function(t) {
704
+ const e = customElements.get("cds-tabs"), s = i(t), n = t.getAttribute("before-select-event");
705
+ n && this.listen(t, e.eventBeforeSelect, (a) => {
706
+ this.dispatchPanelEvent(n, {
707
+ ...s,
708
+ tabValue: a.detail.value,
709
+ cancelable: !0
710
+ });
711
+ });
712
+ const o = s.event;
713
+ o && this.listen(t, e.eventSelect, (a) => {
714
+ const r = a.detail.item, c = i(r);
715
+ this.dispatchPanelEvent(o, {
716
+ ...s,
717
+ ...c,
718
+ tabValue: a.detail.value
719
+ });
720
+ });
721
+ }
722
+ }, fe = {
723
+ selector: "cds-accordion",
724
+ init: function(t) {
725
+ const e = customElements.get("cds-accordion-item"), s = i(t);
726
+ [...t.querySelectorAll("cds-accordion-item")].forEach((n) => {
727
+ const o = i(n), a = o.event || s.event;
728
+ a && this.listen(n, e.eventToggle, (r) => {
729
+ this.dispatchPanelEvent(a, {
730
+ ...s,
731
+ ...o,
732
+ open: r.detail.open
733
+ });
734
+ });
735
+ });
736
+ }
737
+ }, he = {
738
+ selector: "cds-content-switcher",
739
+ init: function(t) {
740
+ const e = customElements.get("cds-content-switcher"), s = i(t), n = t.getAttribute("before-select-event");
741
+ n && this.listen(t, e.eventBeforeSelect, (a) => {
742
+ this.dispatchPanelEvent(n, {
743
+ ...s,
744
+ value: a.detail.value,
745
+ cancelable: !0
746
+ });
747
+ });
748
+ const o = s.event;
749
+ o && this.listen(t, e.eventSelect, (a) => {
750
+ const r = a.detail.item, c = i(r);
751
+ this.dispatchPanelEvent(o, {
752
+ ...s,
753
+ ...c,
754
+ value: r.getAttribute("value")
755
+ });
756
+ });
757
+ }
758
+ }, ge = /* @__PURE__ */ f({
759
+ cdsBreadCrumbWrap: () => We,
760
+ cdsBreadcrumbItemWrap: () => be,
761
+ cdsBreadcrumbLinkWrap: () => Ee
762
+ }), be = { selector: "cds-breadcrumb-item" }, Ee = {
763
+ selector: "cds-breadcrumb-link",
764
+ event: "click",
765
+ getData: (t, e, s) => (t.preventDefault(), {
766
+ ...e,
767
+ href: s.getAttribute("href")
768
+ })
769
+ }, We = {
770
+ selector: "cds-breadcrumb",
771
+ init: function(t) {
772
+ const e = this, s = i(t), n = s.event;
773
+ if (n) {
774
+ const o = (r) => {
775
+ e.dispatchPanelEvent(n, {
776
+ ...s,
777
+ ...r
778
+ });
779
+ };
780
+ e.listen(t, "click", (r) => {
781
+ const c = r.target.closest("cds-breadcrumb-link");
782
+ c && (r.preventDefault(), r.stopPropagation(), o(i(c)));
783
+ });
784
+ const a = t.querySelector("cds-overflow-menu-body");
785
+ a && e.listen(a, "cds-overflow-menu-item-clicked", (r) => {
786
+ r.stopPropagation(), o(i(r.target));
787
+ });
788
+ }
789
+ }
790
+ }, Ie = /* @__PURE__ */ f({
791
+ cdsNumberInputWrap: () => ye,
792
+ cdsPasswordInputWrap: () => ke,
793
+ cdsSearchWrap: () => Ce,
794
+ cdsTextAreaWrap: () => Pe,
795
+ cdsTextInputWrap: () => Se
796
+ }), Se = {
797
+ selector: "cds-text-input",
798
+ multiEvent: !0,
799
+ events: [{
800
+ type: "input",
801
+ attrName: "event",
802
+ getData: (t, e) => ({
803
+ ...e,
804
+ value: t.currentTarget.value
805
+ })
806
+ }, {
807
+ type: "change",
808
+ attrName: "change-event",
809
+ getData: (t, e) => ({
810
+ ...e,
811
+ value: t.currentTarget.value
812
+ })
813
+ }]
814
+ }, Pe = {
815
+ selector: "cds-textarea",
816
+ multiEvent: !0,
817
+ events: [{
818
+ type: "input",
819
+ attrName: "event",
820
+ getData: (t, e) => ({
821
+ ...e,
822
+ value: t.currentTarget.value
823
+ })
824
+ }, {
825
+ type: "change",
826
+ attrName: "change-event",
827
+ getData: (t, e) => ({
828
+ ...e,
829
+ value: t.currentTarget.value
830
+ })
831
+ }]
832
+ }, ye = {
833
+ selector: "cds-number-input",
834
+ event: "cds-number-input",
835
+ getData: (t, e, s) => ({
836
+ ...e,
837
+ value: t.detail.value,
838
+ direction: t.detail.direction
839
+ })
840
+ }, ke = {
841
+ selector: "cds-password-input",
842
+ multiEvent: !0,
843
+ events: [{
844
+ type: "input",
845
+ attrName: "event",
846
+ getData: (t, e) => ({
847
+ ...e,
848
+ value: t.currentTarget.value
849
+ })
850
+ }, {
851
+ type: "change",
852
+ attrName: "change-event",
853
+ getData: (t, e) => ({
854
+ ...e,
855
+ value: t.currentTarget.value
856
+ })
857
+ }]
858
+ }, Ce = {
859
+ selector: "cds-search",
860
+ event: "cds-search-input",
861
+ getData: (t, e, s) => ({
862
+ ...e,
863
+ value: s.value
864
+ })
865
+ }, Ae = /* @__PURE__ */ f({
866
+ cdsCheckboxWrap: () => we,
867
+ cdsRadioButGroupWrap: () => De,
868
+ cdsSelectWrap: () => _e,
869
+ cdsSliderWrap: () => Be,
870
+ cdsToggleWrap: () => xe
871
+ }), we = {
872
+ selector: "cds-checkbox",
873
+ event: "cds-checkbox-changed",
874
+ getData: (t, e, s) => ({
875
+ ...e,
876
+ checked: t.detail.checked,
877
+ value: s.value
878
+ })
879
+ }, De = {
880
+ selector: "cds-radio-button-group",
881
+ event: "cds-radio-button-group-changed",
882
+ getData: (t, e) => ({
883
+ ...e,
884
+ value: t.detail?.value
885
+ })
886
+ }, xe = {
887
+ selector: "cds-toggle",
888
+ event: "cds-toggle-changed",
889
+ getData: (t, e) => ({
890
+ ...e,
891
+ isOn: t.detail.checked,
892
+ value: t.detail.checked
893
+ })
894
+ }, _e = {
895
+ selector: "cds-select",
896
+ event: "cds-select-selected",
897
+ getData: (t, e) => ({
898
+ ...e,
899
+ value: t.detail.value
900
+ })
901
+ }, Be = {
902
+ selector: "cds-slider",
903
+ init: function(t) {
904
+ const e = i(t), s = e.event;
905
+ s && this.listen(t, "cds-slider-changed", (o) => {
906
+ this.dispatchPanelEvent(s, {
907
+ ...e,
908
+ value: o.detail.value
909
+ });
910
+ });
911
+ const n = t.getAttribute("input-event");
912
+ n && this.listen(t, "cds-slider-input-changed", (o) => {
913
+ this.dispatchPanelEvent(n, {
914
+ ...e,
915
+ value: o.detail.value
916
+ });
917
+ });
918
+ }
919
+ }, Ne = /* @__PURE__ */ f({
920
+ cdsFilterTagWrap: () => Fe,
921
+ cdsSDismissibleTagWrap: () => Me,
922
+ cdsTagsWrap: () => Te
923
+ }), Te = {
924
+ selector: "cds-tag",
925
+ event: "click",
926
+ getData: (t, e) => e
927
+ }, Me = {
928
+ selector: "cds-dismissible-tag",
929
+ init: function(t) {
930
+ const e = i(t), s = t.getAttribute("click-event");
931
+ s && this.listen(t, "click", (o) => {
932
+ o.target.closest("button") || this.dispatchPanelEvent(s, { ...e });
933
+ });
934
+ const n = e.event;
935
+ n && this.listen(t, "cds-dismissible-tag-closed", (o) => {
936
+ this.dispatchPanelEvent(n, {
937
+ ...e,
938
+ action: "closed"
939
+ });
940
+ });
941
+ }
942
+ }, Fe = {
943
+ selector: "cds-filter-tag",
944
+ event: "cds-filter-tag-closed",
945
+ getData: (t, e) => ({
946
+ ...e,
947
+ action: "remove"
948
+ })
949
+ }, ze = /* @__PURE__ */ f({
950
+ cdsContainedListDescriptionWrap: () => qe,
951
+ cdsContainedListItemWrap: () => Ue,
952
+ cdsContainedListWrap: () => Le,
953
+ cdsOverflowMenuWrap: () => Oe,
954
+ cdsStructuredListWrap: () => Re,
955
+ cdsTreeViewWrap: () => $e
956
+ }), Oe = {
957
+ selector: "cds-overflow-menu",
958
+ init: function(t) {
959
+ const e = i(t), s = e.event, n = t.querySelector("cds-overflow-menu-body");
960
+ s && n && this.listen(n, "cds-overflow-menu-item-clicked", (o) => {
961
+ o.stopPropagation();
962
+ const a = i(o.target);
963
+ this.dispatchPanelEvent(s, {
964
+ ...e,
965
+ ...a
966
+ });
967
+ });
968
+ }
969
+ }, Re = {
970
+ selector: "cds-structured-list",
971
+ init: function(t) {
972
+ const e = i(t);
973
+ [...t.querySelectorAll("cds-structured-list-row")].forEach((s) => {
974
+ const n = i(s), o = n.event || e.event;
975
+ o && this.listen(s, "click", (a) => {
976
+ a.stopPropagation(), this.dispatchPanelEvent(o, {
977
+ ...e,
978
+ ...n
979
+ });
980
+ });
981
+ }), t.hasAttribute("selection") && this.listen(t, "cds-structured-list-selected", (s) => {
982
+ const n = s.detail.row, o = i(n), a = e.event;
983
+ a && this.dispatchPanelEvent(a, {
984
+ ...e,
985
+ ...o
986
+ });
987
+ });
988
+ }
989
+ }, Le = { selector: "cds-contained-list" }, qe = { selector: "cds-contained-list-description" }, Ue = {
990
+ selector: "cds-contained-list-item",
991
+ event: "cds-contained-list-item-click",
992
+ getData: (t, e) => e
993
+ }, $e = {
994
+ selector: "cds-tree-view",
995
+ init: function(t) {
996
+ const e = i(t);
997
+ this.listen(t, "cds-tree-node-selected", (n) => {
998
+ const o = n.detail.node, a = i(o), r = a.event || e.event;
999
+ r && this.dispatchPanelEvent(r, {
1000
+ ...e,
1001
+ ...a,
1002
+ nodeId: o.id,
1003
+ label: o.getAttribute("label")
1004
+ });
1005
+ });
1006
+ const s = W(t, "expand-event");
1007
+ s && this.listen(t, "cds-tree-node-expanded", (n) => {
1008
+ this.dispatchPanelEvent(s, {
1009
+ ...e,
1010
+ nodeId: n.detail.node.id,
1011
+ expanded: n.detail.expanded
1012
+ });
1013
+ });
1014
+ }
1015
+ }, He = /* @__PURE__ */ f({
1016
+ cdsActionableNotificationWrap: () => Ve,
1017
+ cdsInlineNotificationWrap: () => Ge,
1018
+ cdsToastNotificationWrap: () => je
1019
+ }), je = {
1020
+ selector: "cds-toast-notification",
1021
+ event: "cds-notification-closed",
1022
+ getData: (t, e) => ({
1023
+ ...e,
1024
+ action: "closed"
1025
+ })
1026
+ }, Ge = {
1027
+ selector: "cds-inline-notification",
1028
+ event: "cds-notification-closed",
1029
+ getData: (t, e) => ({
1030
+ ...e,
1031
+ action: "closed"
1032
+ })
1033
+ }, Ve = {
1034
+ selector: "cds-actionable-notification",
1035
+ init: function(t) {
1036
+ const e = i(t), s = W(t, "close-event", "event");
1037
+ s && this.listen(t, "cds-notification-closed", (o) => {
1038
+ this.dispatchPanelEvent(s, {
1039
+ ...e,
1040
+ action: "closed"
1041
+ });
1042
+ });
1043
+ const n = W(t, "action-event");
1044
+ n && this.listen(t, "cds-notification-actioned", (o) => {
1045
+ this.dispatchPanelEvent(n, {
1046
+ ...e,
1047
+ action: "actioned"
1048
+ });
1049
+ });
1050
+ }
1051
+ }, Ze = /* @__PURE__ */ f({
1052
+ cdsClickableTileWrap: () => Ke,
1053
+ cdsExpandableTileWrap: () => Qe,
1054
+ cdsRadioTileWrap: () => Ye,
1055
+ cdsSelectableTileWrap: () => Xe,
1056
+ cdsTileGroupWrap: () => ts,
1057
+ cdsTileWrap: () => Je
1058
+ }), Je = { selector: "cds-tile" }, Ke = {
1059
+ selector: "cds-clickable-tile",
1060
+ init: function(t) {
1061
+ const e = i(t), s = e.event;
1062
+ if (s) {
1063
+ const n = e.href || t.getAttribute("href") || "";
1064
+ t.removeAttribute("href"), t.addEventListener("click", (o) => {
1065
+ o.preventDefault(), o.stopPropagation(), this.dispatchPanelEvent(s, {
1066
+ ...e,
1067
+ href: n
1068
+ });
1069
+ }, !0);
1070
+ }
1071
+ }
1072
+ }, Qe = {
1073
+ selector: "cds-expandable-tile",
1074
+ init: function(t) {
1075
+ const e = i(t), s = t.getAttribute("before-toggle-event");
1076
+ s && this.listen(t, "cds-expandable-tile-beingtoggled", (o) => {
1077
+ this.dispatchPanelEvent(s, {
1078
+ ...e,
1079
+ expanded: o.detail.expanded,
1080
+ cancelable: !0
1081
+ });
1082
+ });
1083
+ const n = e.event;
1084
+ n && this.listen(t, "cds-expandable-tile-toggled", (o) => {
1085
+ this.dispatchPanelEvent(n, {
1086
+ ...e,
1087
+ expanded: o.detail.expanded
1088
+ });
1089
+ });
1090
+ }
1091
+ }, Xe = {
1092
+ selector: "cds-selectable-tile",
1093
+ event: "cds-selectable-tile-changed",
1094
+ getData: (t, e, s) => ({
1095
+ ...e,
1096
+ selected: t.detail.selected,
1097
+ value: s.value
1098
+ })
1099
+ }, Ye = {
1100
+ selector: "cds-radio-tile",
1101
+ event: "cds-radio-tile-selected",
1102
+ getData: (t, e, s) => ({
1103
+ ...e,
1104
+ selected: t.detail.selected,
1105
+ name: t.detail.name,
1106
+ value: s.value
1107
+ })
1108
+ }, ts = {
1109
+ selector: "cds-tile-group",
1110
+ init: function(t) {
1111
+ const e = i(t), s = e.event;
1112
+ s && (this.listen(t, "cds-current-radio-tile-selection", (n) => {
1113
+ const o = n.detail.target;
1114
+ this.dispatchPanelEvent(s, {
1115
+ ...e,
1116
+ value: o?.value,
1117
+ name: o?.name,
1118
+ selected: o?.selected
1119
+ });
1120
+ }), this.listen(t, "cds-current-selectable-tile-selections", (n) => {
1121
+ const o = n.detail.currentSelections || [];
1122
+ this.dispatchPanelEvent(s, {
1123
+ ...e,
1124
+ values: o.map((a) => a.value),
1125
+ names: o.map((a) => a.name),
1126
+ count: o.length
1127
+ });
1128
+ }));
1129
+ }
1130
+ }, es = /* @__PURE__ */ f({
1131
+ cdsInlineLoadingWrap: () => os,
1132
+ cdsProgressBarWrap: () => ss,
1133
+ cdsProgressIndicatorWrap: () => ns
1134
+ }), ss = {
1135
+ selector: "cds-progress-bar",
1136
+ init: function(t) {
1137
+ const e = i(t);
1138
+ if (e.event) {
1139
+ const s = new MutationObserver(() => {
1140
+ const n = parseFloat(t.getAttribute("value") || "0");
1141
+ n >= parseFloat(t.getAttribute("max") || "100") && this.dispatchPanelEvent(e.event, {
1142
+ ...e,
1143
+ value: n,
1144
+ status: "complete"
1145
+ });
1146
+ });
1147
+ s.observe(t, {
1148
+ attributes: !0,
1149
+ attributeFilter: ["value"]
1150
+ }), t._progressObserver = s;
1151
+ }
1152
+ }
1153
+ }, ns = {
1154
+ selector: "cds-progress-indicator",
1155
+ init: function(t) {
1156
+ const e = i(t);
1157
+ this.listen(t, "cds-progress-step-click", (s) => {
1158
+ const n = s.target, o = i(n), a = o.event || e.event;
1159
+ a && this.dispatchPanelEvent(a, {
1160
+ ...e,
1161
+ ...o,
1162
+ stepIndex: n.getAttribute("data-index"),
1163
+ stepLabel: n.getAttribute("label")
1164
+ });
1165
+ });
1166
+ }
1167
+ }, os = {
1168
+ selector: "cds-inline-loading",
1169
+ init: function(t) {
1170
+ const e = i(t), s = e.event;
1171
+ s && this.listen(t, "cds-inline-loading-onsuccess", (o) => {
1172
+ this.dispatchPanelEvent(s, {
1173
+ ...e,
1174
+ status: "finished"
1175
+ });
1176
+ });
1177
+ const n = t.getAttribute("status-event");
1178
+ if (n) {
1179
+ const o = new MutationObserver((a) => {
1180
+ a.forEach((r) => {
1181
+ if (r.attributeName === "status") {
1182
+ const c = t.getAttribute("status");
1183
+ this.dispatchPanelEvent(n, {
1184
+ ...e,
1185
+ status: c
1186
+ });
1187
+ }
1188
+ });
1189
+ });
1190
+ o.observe(t, {
1191
+ attributes: !0,
1192
+ attributeFilter: ["status"]
1193
+ }), t._statusObserver = o;
1194
+ }
1195
+ }
1196
+ }, as = /* @__PURE__ */ f({
1197
+ cdsPopoverWrap: () => cs,
1198
+ cdsToggletipWrap: () => is,
1199
+ cdsTooltipWrap: () => rs
1200
+ }), rs = {
1201
+ selector: "cds-tooltip",
1202
+ init: function(t) {
1203
+ const e = i(t), s = W(t, "open-event");
1204
+ s && this.listen(t, "cds-tooltip-beingopened", (o) => {
1205
+ this.dispatchPanelEvent(s, {
1206
+ ...e,
1207
+ action: "opened"
1208
+ });
1209
+ });
1210
+ const n = W(t, "close-event");
1211
+ n && this.listen(t, "cds-tooltip-closed", (o) => {
1212
+ this.dispatchPanelEvent(n, {
1213
+ ...e,
1214
+ action: "closed"
1215
+ });
1216
+ });
1217
+ }
1218
+ }, cs = {
1219
+ selector: "cds-popover",
1220
+ init: function(t) {
1221
+ const e = i(t), s = W(t, "open-event");
1222
+ s && this.listen(t, "cds-popover-beingopened", (o) => {
1223
+ this.dispatchPanelEvent(s, {
1224
+ ...e,
1225
+ action: "opened"
1226
+ });
1227
+ });
1228
+ const n = W(t, "close-event");
1229
+ n && this.listen(t, "cds-popover-closed", (o) => {
1230
+ this.dispatchPanelEvent(n, {
1231
+ ...e,
1232
+ action: "closed"
1233
+ });
1234
+ });
1235
+ }
1236
+ }, is = {
1237
+ selector: "cds-toggletip",
1238
+ init: function(t) {
1239
+ const e = i(t);
1240
+ if (e.event) {
1241
+ const s = new MutationObserver((n) => {
1242
+ n.forEach((o) => {
1243
+ if (o.attributeName === "open") {
1244
+ const a = t.hasAttribute("open");
1245
+ this.dispatchPanelEvent(e.event, {
1246
+ ...e,
1247
+ action: a ? "opened" : "closed",
1248
+ open: a
1249
+ });
1250
+ }
1251
+ });
1252
+ });
1253
+ s.observe(t, {
1254
+ attributes: !0,
1255
+ attributeFilter: ["open"]
1256
+ }), t._toggletipObserver = s;
1257
+ }
1258
+ }
1259
+ }, ls = /* @__PURE__ */ f({
1260
+ cdsCodeSnipWrap: () => ps,
1261
+ cdsLinkWrap: () => ds
1262
+ }), ds = {
1263
+ selector: "cds-link",
1264
+ event: "click",
1265
+ getData: (t, e, s) => ({
1266
+ ...e,
1267
+ href: s.getAttribute("href")
1268
+ })
1269
+ }, ps = {
1270
+ selector: "cds-code-snippet",
1271
+ event: "cds-copy-button-clicked",
1272
+ getData: (t, e) => ({
1273
+ ...e,
1274
+ action: "copied"
1275
+ })
1276
+ }, us = /* @__PURE__ */ f({
1277
+ cdsBadgeIndicatorWrap: () => Is,
1278
+ cdsFormGroupWrap: () => fs,
1279
+ cdsFormItemWrap: () => ms,
1280
+ cdsFormWrap: () => vs,
1281
+ cdsHeadingWrap: () => gs,
1282
+ cdsIconIndicatorWrap: () => Ws,
1283
+ cdsIconWrap: () => Es,
1284
+ cdsLoadingWrap: () => Ss,
1285
+ cdsSectionWrap: () => bs,
1286
+ cdsSkeletonPlaceholderWrap: () => ys,
1287
+ cdsSkeletonTextWrap: () => Ps,
1288
+ cdsStackWrap: () => hs
1289
+ }), vs = { selector: "cds-form" }, ms = { selector: "cds-form-item" }, fs = { selector: "cds-form-group" }, hs = { selector: "cds-stack" }, gs = { selector: "cds-heading" }, bs = { selector: "cds-section" }, Es = { selector: "cds-icon" }, Ws = { selector: "cds-icon-indicator" }, Is = { selector: "cds-badge-indicator" }, Ss = { selector: "cds-loading" }, Ps = { selector: "cds-skeleton-text" }, ys = { selector: "cds-skeleton-placeholder" };
1290
+ function m(t) {
1291
+ return Object.values(t).filter((e) => typeof e == "object" && e !== null && e.selector);
1292
+ }
1293
+ var ks = [
1294
+ ...m(Bt),
1295
+ ...m(At),
1296
+ ...m(Tt),
1297
+ ...m(Ht),
1298
+ ...m(Vt),
1299
+ ...m(te),
1300
+ ...m(oe),
1301
+ ...m(ce),
1302
+ ...m(ve),
1303
+ ...m(ge),
1304
+ ...m(Ie),
1305
+ ...m(Ae),
1306
+ ...m(Ne),
1307
+ ...m(ze),
1308
+ ...m(He),
1309
+ ...m(Ze),
1310
+ ...m(es),
1311
+ ...m(as),
1312
+ ...m(ls),
1313
+ ...m(us)
1314
+ ];
1315
+ function Cs() {
1316
+ const t = /* @__PURE__ */ new Map();
1317
+ return ks.forEach((e) => {
1318
+ t.set(e.selector, e);
1319
+ }), t;
1320
+ }
1321
+ var As = () => import("@carbon/web-components/es/components/accordion/index.js"), q = () => import("@carbon/web-components/es/components/breadcrumb/index.js"), ws = () => import("@carbon/web-components/es/components/stack/index.js"), Ds = () => import("@carbon/web-components/es/components/structured-list/index.js"), U = () => import("@carbon/web-components/es/components/contained-list/index.js"), _ = () => import("@carbon/web-components/es/components/tile/index.js"), xs = () => import("@carbon/web-components/es/components/tree-view/index.js"), _s = () => 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"), Ts = () => import("@carbon/web-components/es/components/overflow-menu/index.js"), $ = () => import("@carbon/web-components/es/components/button/index.js"), Y = () => import("@carbon/web-components/es/components/icon-button/index.js"), Ms = () => import("@carbon/web-components/es/components/combo-button/index.js"), Fs = () => import("@carbon/web-components/es/components/copy-button/index.js"), zs = () => 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"), H = () => import("@carbon/web-components/es/components/select/index.js"), Ls = () => 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"), Us = () => import("@carbon/web-components/es/components/number-input/index.js"), $s = () => 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"), js = () => import("@carbon/web-components/es/components/dropdown/index.js"), Gs = () => import("@carbon/web-components/es/components/multi-select/index.js"), Vs = () => import("@carbon/web-components/es/components/date-picker/index.js"), Zs = () => 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"), Js = () => import("@carbon/web-components/es/components/form-group/index.js"), Ks = () => import("@carbon/web-components/es/components/data-table/index.js"), st = () => import("@carbon/web-components/es/components/pagination/index.js"), Qs = () => import("@carbon/web-components/es/components/code-snippet/index.js"), G = () => import("@carbon/web-components/es/components/tag/index.js"), Xs = () => import("@carbon/web-components/es/components/badge-indicator/index.js"), V = () => import("@carbon/web-components/es/components/notification/index.js"), Ys = () => import("@carbon/web-components/es/components/loading/index.js"), tn = () => import("@carbon/web-components/es/components/inline-loading/index.js"), en = () => import("@carbon/web-components/es/components/progress-bar/index.js"), sn = () => import("@carbon/web-components/es/components/progress-indicator/index.js"), nn = () => import("@carbon/web-components/es/components/skeleton-placeholder/index.js"), on = () => import("@carbon/web-components/es/components/skeleton-text/index.js"), y = () => import("@carbon/web-components/es/components/modal/index.js"), k = () => import("@carbon/web-components/es/components/tooltip/index.js"), an = () => import("@carbon/web-components/es/components/popover/index.js"), rn = () => import("@carbon/web-components/es/components/toggle-tip/index.js"), nt = () => import("@carbon/web-components/es/components/heading/index.js"), cn = () => import("@carbon/web-components/es/components/icon/index.js"), ln = () => import("@carbon/web-components/es/components/icon-indicator/index.js"), z = {
1322
+ "cds-table": [
1323
+ k,
1324
+ $,
1325
+ j,
1326
+ tt,
1327
+ H,
1328
+ st,
1329
+ Ks
1330
+ ],
1331
+ "cds-pagination": [
1332
+ H,
1333
+ j,
1334
+ st
1335
+ ],
1336
+ "cds-button": [k, $],
1337
+ "cds-icon-button:not([data-toggle])": [k, Y],
1338
+ "cds-icon-button[data-toggle]": [k, Y],
1339
+ "cds-button[data-fab]": [k, $],
1340
+ "cds-copy-button": [k, Fs],
1341
+ "cds-combo-button": [k, Ms],
1342
+ "cds-checkbox": [zs],
1343
+ "cds-radio-button-group": [Os],
1344
+ "cds-toggle": [Rs],
1345
+ "cds-select": [H],
1346
+ "cds-slider": [Ls],
1347
+ "cds-text-input": [j],
1348
+ "cds-textarea": [qs],
1349
+ "cds-number-input": [Us],
1350
+ "cds-password-input": [k, $s],
1351
+ "cds-search": [tt],
1352
+ "cds-dropdown": [js],
1353
+ "cds-combo-box": [Hs],
1354
+ "cds-multi-select": [Gs],
1355
+ "cds-date-picker": [Vs],
1356
+ "cds-time-picker": [Zs],
1357
+ "cds-file-uploader": [T],
1358
+ "cds-file-uploader-button": [T],
1359
+ "cds-file-uploader-drop-container": [T],
1360
+ "cds-file-uploader-item": [T],
1361
+ "cds-tabs": [Bs],
1362
+ "cds-accordion": [As],
1363
+ "cds-content-switcher": [Ns],
1364
+ "cds-breadcrumb": [q],
1365
+ "cds-breadcrumb-item": [q],
1366
+ "cds-breadcrumb-link": [q],
1367
+ "cds-menu": [X],
1368
+ "cds-menu-button": [X],
1369
+ "cds-overflow-menu": [Ts],
1370
+ "cds-structured-list": [Ds],
1371
+ "cds-contained-list": [U],
1372
+ "cds-contained-list-item": [U],
1373
+ "cds-contained-list-description": [U],
1374
+ "cds-tree-view": [xs],
1375
+ "cds-modal": [y],
1376
+ "cds-modal-header": [y],
1377
+ "cds-modal-heading": [y],
1378
+ "cds-modal-label": [y],
1379
+ "cds-modal-close-button": [y],
1380
+ "cds-modal-body": [y],
1381
+ "cds-modal-body-content": [y],
1382
+ "cds-modal-footer": [y],
1383
+ "cds-modal-footer-button": [y],
1384
+ "cds-toast-notification": [V],
1385
+ "cds-inline-notification": [V],
1386
+ "cds-actionable-notification": [V],
1387
+ "cds-tile": [_],
1388
+ "cds-tile-group": [_],
1389
+ "cds-clickable-tile": [_],
1390
+ "cds-expandable-tile": [_],
1391
+ "cds-selectable-tile": [_],
1392
+ "cds-radio-tile": [_],
1393
+ "cds-progress-bar": [en],
1394
+ "cds-progress-indicator": [sn],
1395
+ "cds-inline-loading": [tn],
1396
+ "cds-tooltip": [k],
1397
+ "cds-popover": [an],
1398
+ "cds-toggletip": [rn],
1399
+ "cds-tag": [G],
1400
+ "cds-dismissible-tag": [G],
1401
+ "cds-filter-tag": [G],
1402
+ "cds-link": [_s],
1403
+ "cds-code-snippet": [Qs],
1404
+ "cds-form": [et],
1405
+ "cds-form-item": [et],
1406
+ "cds-form-group": [Js],
1407
+ "cds-stack": [ws],
1408
+ "cds-heading": [nt],
1409
+ "cds-section": [nt],
1410
+ "cds-icon": [cn],
1411
+ "cds-icon-indicator": [ln],
1412
+ "cds-badge-indicator": [Xs],
1413
+ "cds-loading": [Ys],
1414
+ "cds-skeleton-text": [on],
1415
+ "cds-skeleton-placeholder": [nn]
1416
+ };
1417
+ function dn(t) {
1418
+ const e = /* @__PURE__ */ new Map();
1419
+ if (!t || !(t instanceof Element)) return e;
1420
+ for (const n of Object.keys(F)) e.set(n, []);
1421
+ for (const [n] of Object.entries(F)) t.matches(n) && e.get(n).push(t);
1422
+ const s = t.querySelectorAll("*");
1423
+ for (const n of s) for (const [o] of Object.entries(F)) n.matches(o) && e.get(o).push(n);
1424
+ for (const [n, o] of e.entries()) o.length === 0 && e.delete(n);
1425
+ return e;
1426
+ }
1427
+ function pn(t) {
1428
+ const e = /* @__PURE__ */ new Set();
1429
+ for (const [s, n] of t.entries()) n.length > 0 && z[s] && z[s].forEach((o) => e.add(o));
1430
+ return e;
1431
+ }
1432
+ async function un(t, e) {
1433
+ if (t.size === 0) return;
1434
+ const s = Array.from(t).map(async (n) => (e.has(n) || e.set(n, n()), e.get(n)));
1435
+ await Promise.all(s);
1436
+ }
1437
+ function vn(t, e) {
1438
+ let s = 0;
1439
+ for (const [n, o] of t.entries()) {
1440
+ const a = F[n];
1441
+ o.forEach((r) => {
1442
+ if (a.init) {
1443
+ a.init.call(e, r);
1444
+ return;
1445
+ }
1446
+ if (a.multiEvent) {
1447
+ const I = i(r);
1448
+ a.events.forEach((S) => {
1449
+ const D = W(r, S.attrName, "event");
1450
+ D && e.listen(r, S.type, (O) => {
1451
+ e.dispatchPanelEvent(D, S.getData(O, I, r));
1452
+ });
1453
+ });
1454
+ return;
1455
+ }
1456
+ const c = i(r), d = c.event;
1457
+ d && e.listen(r, a.event, (I) => {
1458
+ I.stopPropagation();
1459
+ const S = a.getData(I, c, r), D = S._eventOverride || d;
1460
+ delete S._eventOverride, e.dispatchPanelEvent(D, S);
1461
+ });
1462
+ }), s += o.length;
1463
+ }
1464
+ return s;
1465
+ }
1466
+ var F = Object.fromEntries(Cs()), mn = async function(t, e) {
1467
+ const s = dn(t);
1468
+ if (s.size === 0) {
1469
+ this.debugMe("[Carbon] No Carbon components found in panel");
1470
+ return;
1471
+ }
1472
+ this.carbonComponents || (this.carbonComponents = /* @__PURE__ */ new Map());
1473
+ for (const [a, r] of s.entries()) this.carbonComponents.set(a, r);
1474
+ const n = pn(s);
1475
+ if (n.size > 0) try {
1476
+ await un(n, e);
1477
+ } catch (a) {
1478
+ console.error("[Carbon] Failed to load some component modules:", a);
1479
+ }
1480
+ const o = vn(s, this);
1481
+ o > 0 && this.debugMe(`[Carbon] Total components initialized: ${o}`);
1482
+ }, En = (t = {}) => {
1483
+ const { preload: e = [] } = t, s = /* @__PURE__ */ new Map();
1484
+ if (e.length > 0) {
1485
+ const n = e.filter((a) => z[a] ? !0 : (console.warn(`[Carbon] No import found for selector: ${a}`), !1)), o = n.flatMap((a) => z[a].map((r) => (s.has(r) || s.set(r, r()), s.get(r))));
1486
+ Promise.all(o).then(() => console.debug(`[Carbon] Preloaded: ${n.join(", ")}`)).catch((a) => console.warn("[Carbon] Preload error:", a));
1487
+ }
1488
+ St.register("carbon", {
1489
+ cache: s,
1490
+ render: async function(n, o) {
1491
+ try {
1492
+ await mn.call(this, n, o);
1493
+ } catch (a) {
1494
+ console.error("[Carbon] Initialization error:", a);
1495
+ }
1496
+ },
1497
+ dispose: function(n) {
1498
+ },
1499
+ config: {
1500
+ version: "2.0",
1501
+ description: "IBM Carbon Design System Web Components"
1502
+ }
1503
+ }), console.debug("[Zooy] Carbon Design System library registered");
1504
+ };
1505
+ export {
1506
+ En as registerCarbonLibrary
1507
+ };