@trintel/zooy 1.0.1-beta.0 → 1.0.1-beta.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.
Files changed (233) hide show
  1. package/README.md +282 -337
  2. package/dist/chunks/{16-ChlL35BX.js → 16-BXti8Tu-.js} +6 -6
  3. package/dist/chunks/16-CMCRqVYz.js +1 -0
  4. package/dist/chunks/{20-CZPIOG-A.js → 20-CQLnFcRb.js} +9 -9
  5. package/dist/chunks/20-Df0dXwyx.js +1 -0
  6. package/dist/chunks/{button-DdJepOoE.js → button-CgQW6Alg.js} +8 -7
  7. package/dist/chunks/button-CnwdjMNF.js +66 -0
  8. package/dist/chunks/button-skeleton-BcyctpC3.js +21 -0
  9. package/dist/chunks/{button-skeleton-COf2kCDL.js → button-skeleton-DEmHtnd8.js} +10 -9
  10. package/dist/chunks/checkbox-Bt024Adv.js +40 -0
  11. package/dist/chunks/{checkbox-B5mHvx0J.js → checkbox-D2LeqAn8.js} +9 -8
  12. package/dist/chunks/{class-map-BfNAkUL_.js → class-map-Dt10N9TS.js} +2 -2
  13. package/dist/chunks/{class-map-DEHG4tmw.js → class-map-emHvptF6.js} +1 -1
  14. package/dist/chunks/{content-switcher-item-DeGjVRQY.js → content-switcher-item-D6gOZCuS.js} +10 -9
  15. package/dist/chunks/content-switcher-item-Dtv8UD1x.js +27 -0
  16. package/dist/chunks/{dropdown-item-DPdwOION.js → dropdown-item-BDRUe-IF.js} +12 -11
  17. package/dist/chunks/dropdown-item-DNLmqxnr.js +69 -0
  18. package/dist/chunks/{focus-B9JYe97T.js → focus-Cyj1QfBL.js} +1 -1
  19. package/dist/chunks/{focus-rQSNiwy7.js → focus-Dty12qxz.js} +1 -1
  20. package/dist/chunks/{icon-loader-Dk_AU26w.js → icon-loader-C2EqV5wJ.js} +1 -1
  21. package/dist/chunks/{icon-loader-o_JYDmJX.js → icon-loader-DS-X84Yz.js} +1 -1
  22. package/dist/chunks/icon-loader-utils-B6kq3DHp.js +5 -0
  23. package/dist/chunks/{icon-loader-utils-BEOGXn0q.js → icon-loader-utils-BIiU-zGK.js} +23 -23
  24. package/dist/chunks/{if-defined-C0yJsxi2.js → if-defined--xXVpdta.js} +1 -1
  25. package/dist/chunks/if-defined-CFTJFEK6.js +5 -0
  26. package/dist/chunks/{if-non-empty-DTGflHtA.js → if-non-empty-0zvrDGPr.js} +1 -1
  27. package/dist/chunks/if-non-empty-BIwvmklX.js +1 -0
  28. package/dist/chunks/{index-C_K070Kn.js → index-1G2UuijG.js} +7 -6
  29. package/dist/chunks/index-21j_5emj.js +35 -0
  30. package/dist/chunks/{index-Dh4uigJs.js → index-82K_ozYZ.js} +10 -9
  31. package/dist/chunks/index-B1YLd9rD.js +23 -0
  32. package/dist/chunks/{index-BIaF1Dfx.js → index-B3EmHaO7.js} +5 -4
  33. package/dist/chunks/{index-Cixdzvwd.js → index-B4JPT-gj.js} +8 -7
  34. package/dist/chunks/index-B5-56fkV.js +62 -0
  35. package/dist/chunks/index-B612bWya.js +58 -0
  36. package/dist/chunks/index-B8nOkbPA.js +77 -0
  37. package/dist/chunks/index-BAEdnwkZ.js +25 -0
  38. package/dist/chunks/{index-DnpSGM23.js → index-BAMMtRO9.js} +8 -7
  39. package/dist/chunks/{index-Cd7aoWrX.js → index-BC-p6lrw.js} +7 -6
  40. package/dist/chunks/index-BEOc7JG-.js +16 -0
  41. package/dist/chunks/{index-DdNZTQw1.js → index-BG3BMHhy.js} +3 -2
  42. package/dist/chunks/{index-BxVW3p3I.js → index-BHWaezgU.js} +7 -6
  43. package/dist/chunks/{index-CT43RMOu.js → index-BJHILyIN.js} +3 -2
  44. package/dist/chunks/{index-CByffhPq.js → index-BKsBoGOO.js} +6 -5
  45. package/dist/chunks/index-BNjgzCq_.js +1 -0
  46. package/dist/chunks/{index-C8LyfVmf.js → index-BQNhvN2i.js} +6 -5
  47. package/dist/chunks/index-BTND2b3S.js +19 -0
  48. package/dist/chunks/{index-BJKftWYn.js → index-BZmOT6Xm.js} +16 -16
  49. package/dist/chunks/{index-CcgnA1uu.js → index-B_C9vt_w.js} +4 -3
  50. package/dist/chunks/{index-CgYZ66P_.js → index-B_JMGygD.js} +6 -5
  51. package/dist/chunks/index-Bd60xpxv.js +1 -0
  52. package/dist/chunks/index-BhJiw5Wx.js +1 -0
  53. package/dist/chunks/index-Bl6sE0-K.js +1 -0
  54. package/dist/chunks/{index-Dr_cqQ-_.js → index-BmvLxuoI.js} +16 -77
  55. package/dist/chunks/index-BwMEAhRr.js +2 -0
  56. package/dist/chunks/{index-caLn8cu1.js → index-BwOJ4JFm.js} +12 -11
  57. package/dist/chunks/index-BzmpjZ1o.js +26 -0
  58. package/dist/chunks/{index-x6SeA7x7.js → index-C06cFvgb.js} +7 -6
  59. package/dist/chunks/{index-BXczHDk-.js → index-C3LD0iwa.js} +6 -5
  60. package/dist/chunks/index-C4JzGVcF.js +49 -0
  61. package/dist/chunks/{index-DX6WAtmo.js → index-C5nYdcCH.js} +7 -6
  62. package/dist/chunks/index-C6SudlSp.js +4 -0
  63. package/dist/chunks/index-C6WHuZdF.js +79 -0
  64. package/dist/chunks/{index-DIR0jr3f.js → index-C8YWVLB0.js} +6 -5
  65. package/dist/chunks/{index-B1vQ44Hl.js → index-C8miW4lw.js} +9 -8
  66. package/dist/chunks/index-CArtDXbg.js +22 -0
  67. package/dist/chunks/{index-DwTj7cFr.js → index-CDNshf0_.js} +32 -32
  68. package/dist/chunks/{index-BgbqX0uv.js → index-CFYfFa1Z.js} +9 -8
  69. package/dist/chunks/index-CJZtiqY-.js +22 -0
  70. package/dist/chunks/{index-BUxB7aWd.js → index-CKBFfWOV.js} +9 -8
  71. package/dist/chunks/index-CMD0FIe-.js +41 -0
  72. package/dist/chunks/{index-BOTu9u-3.js → index-COcNpxlj.js} +12 -11
  73. package/dist/chunks/{index-WvrCPen2.js → index-CUTw26ex.js} +6 -5
  74. package/dist/chunks/{index-D5kiHJpX.js → index-CUd_43Fv.js} +5 -4
  75. package/dist/chunks/{index-D5GGFPcS.js → index-CXgbBzE5.js} +7 -6
  76. package/dist/chunks/index-CYg05Ph9.js +36 -0
  77. package/dist/chunks/{index-BSgHSOVT.js → index-CYpHcMws.js} +4 -3
  78. package/dist/chunks/{index-DFA4_spk.js → index-CZ2kGMvF.js} +9 -8
  79. package/dist/chunks/index-CZwmnbDv.js +1 -0
  80. package/dist/chunks/index-C_S3O2rJ.js +79 -0
  81. package/dist/chunks/{index-rwBsdvh6.js → index-C_Xg4nHN.js} +7 -6
  82. package/dist/chunks/index-CbuopDOc.js +1 -0
  83. package/dist/chunks/{index-qNmuI3RB.js → index-CcxiTkam.js} +33 -32
  84. package/dist/chunks/index-Ce9jg1n7.js +15 -0
  85. package/dist/chunks/index-CfLbYyk0.js +3 -0
  86. package/dist/chunks/{index-WNXgzThF.js → index-Ci2M9li9.js} +9 -8
  87. package/dist/chunks/index-CkMd-UJg.js +52 -0
  88. package/dist/chunks/index-Cl1_9l1N.js +4 -0
  89. package/dist/chunks/index-Clei4V9i.js +4 -0
  90. package/dist/chunks/index-CmA3uuMd.js +37 -0
  91. package/dist/chunks/index-Co5m8M3y.js +12 -0
  92. package/dist/chunks/{index-DnierBep.js → index-CoPuejcu.js} +12 -11
  93. package/dist/chunks/{index-B3CDjjXh.js → index-Cq6Vdh__.js} +10 -9
  94. package/dist/chunks/index-Cwe1NunF.js +46 -0
  95. package/dist/chunks/index-D1OTs_P5.js +1 -0
  96. package/dist/chunks/{index-CzTjJ8lP.js → index-D1PpRn2p.js} +20 -19
  97. package/dist/chunks/{index-UPr2EvBX.js → index-D3ldTviC.js} +5 -4
  98. package/dist/chunks/{index-oTjafsfN.js → index-DBvXH68A.js} +2 -1
  99. package/dist/chunks/index-DC7qmnoW.js +74 -0
  100. package/dist/chunks/index-DDRkmmQp.js +156 -0
  101. package/dist/chunks/{index-B3mXrMt1.js → index-DEcgB0oH.js} +4 -3
  102. package/dist/chunks/index-DH9eR0DH.js +32 -0
  103. package/dist/chunks/{index-CMF5Cawn.js → index-DLUPGsWM.js} +6 -5
  104. package/dist/chunks/{index-hLI0Bnyb.js → index-DQZqjZ8k.js} +6 -5
  105. package/dist/chunks/{index-D0xRAPD5.js → index-DXoeeipa.js} +6 -5
  106. package/dist/chunks/{index-CIzeMGQv.js → index-D_pgjOiX.js} +26 -26
  107. package/dist/chunks/{index-Bwix1iwB.js → index-Df3VILTD.js} +6 -5
  108. package/dist/chunks/{index-45EApaFs.js → index-DkUS58Ay.js} +8 -7
  109. package/dist/chunks/{index-CO-A2KY9.js → index-DktSeVhc.js} +9 -8
  110. package/dist/chunks/index-Dl6HFhg1.js +36 -0
  111. package/dist/chunks/{index-BwIoRMDI.js → index-DocEKbBo.js} +7 -6
  112. package/dist/chunks/index-Dqe5xXlT.js +160 -0
  113. package/dist/chunks/{index-Cv1hWa_y.js → index-DuGskRLI.js} +7 -6
  114. package/dist/chunks/index-DyoG-yF-.js +75 -0
  115. package/dist/chunks/index-E_bjKqnf.js +15 -0
  116. package/dist/chunks/{index-DaPfSuLu.js → index-GRYR4d36.js} +8 -7
  117. package/dist/chunks/index-H-w5fBQG.js +65 -0
  118. package/dist/chunks/{index-CBbsFlsv.js → index-HvLIPR2y.js} +7 -6
  119. package/dist/chunks/{index-DurPWBYc.js → index-LR7m5odx.js} +3 -2
  120. package/dist/chunks/index-OhwD9m-A.js +12 -0
  121. package/dist/chunks/index-RlFlo7pl.js +1 -0
  122. package/dist/chunks/{index-BSh7UYcP.js → index-TCPPpE9b.js} +3 -3
  123. package/dist/chunks/index-XTPnXw_W.js +45 -0
  124. package/dist/chunks/{index-BjQlt8g2.js → index-ZyhwV5v-.js} +9 -8
  125. package/dist/chunks/index-cFX6zBu4.js +19 -0
  126. package/dist/chunks/index-cMdyiXPa.js +1 -0
  127. package/dist/chunks/index-fghrBFfu.js +103 -0
  128. package/dist/chunks/index-h66Bp4Cx.js +8 -0
  129. package/dist/chunks/{index-BoNLj7PW.js → index-wTRaGtNG.js} +3 -2
  130. package/dist/chunks/index-wigDmvr8.js +121 -0
  131. package/dist/chunks/{index-DWfFgEXE.js → index-y_a1ZQAA.js} +9 -8
  132. package/dist/chunks/{loading-icon-DhJR6LyV.js → loading-icon-Bw73Z2Lq.js} +2 -2
  133. package/dist/chunks/loading-icon-D7mJr3sa.js +24 -0
  134. package/dist/chunks/main-A63e59aD.js +67 -0
  135. package/dist/chunks/main-DTOZMPON.js +3681 -0
  136. package/dist/chunks/property-C5teVlku.js +5 -0
  137. package/dist/chunks/{property-pT1z5CCa.js → property-Coy6Dag6.js} +1 -1
  138. package/dist/chunks/register-B533U9U9.js +1 -0
  139. package/dist/chunks/{register-BMNs2hNG.js → register-BO2Fr57T.js} +1 -1
  140. package/dist/chunks/{register-BK21_Wkj.js → register-CHuMnx--.js} +1 -1
  141. package/dist/chunks/register-ClkXTZwT.js +1383 -0
  142. package/dist/chunks/{search-CIhxkVjj.js → search-CsRC23Cp.js} +10 -9
  143. package/dist/chunks/search-DsyFfaxl.js +30 -0
  144. package/dist/chunks/select-BoaR85ix.js +76 -0
  145. package/dist/chunks/{select-item-DjoxYopL.js → select-CKe8zwIo.js} +33 -32
  146. package/dist/chunks/settings-Dy9UPb4i.js +64 -0
  147. package/dist/chunks/settings-NO9fjW0P.js +60 -0
  148. package/dist/chunks/{state-FnSmMH94.js → state-BFc9dfyj.js} +1 -1
  149. package/dist/chunks/{state-Bpmgn27B.js → state-C2XTwLOv.js} +1 -1
  150. package/dist/chunks/text-input-BuK8MjZG.js +68 -0
  151. package/dist/chunks/{text-input-BygzMjjc.js → text-input-D2BsjPTx.js} +8 -7
  152. package/dist/chunks/tooltip-content-B6aAm7Zu.js +3 -0
  153. package/dist/chunks/{tooltip-content-BjdZJ_Ui.js → tooltip-content-DXrPA6JW.js} +4 -3
  154. package/dist/chunks/{unsafe-html-D49sIpJ5.js → unsafe-html-9YCxB3h1.js} +5 -5
  155. package/dist/chunks/{unsafe-html-C_MKAcuC.js → unsafe-html-H7RRvoR7.js} +1 -1
  156. package/dist/zooy.cjs.js +1 -1
  157. package/dist/zooy.es.js +20 -2
  158. package/package.json +2 -3
  159. package/src/sass/{carbon-icons.scss → carbon.scss} +30 -0
  160. package/src/sass/main.scss +1 -1
  161. package/src/sass/panels.scss +23 -0
  162. package/src/sass/split.scss +14 -0
  163. package/dist/chunks/16-41wFkj7S.js +0 -1
  164. package/dist/chunks/20-gmyNFvDv.js +0 -1
  165. package/dist/chunks/button-skeleton-rf3WDPTZ.js +0 -21
  166. package/dist/chunks/button-zHEPxpXa.js +0 -66
  167. package/dist/chunks/checkbox-BRPCg-DN.js +0 -40
  168. package/dist/chunks/content-switcher-item-DucclV1b.js +0 -27
  169. package/dist/chunks/dropdown-item-BgLQ1VLo.js +0 -69
  170. package/dist/chunks/icon-loader-utils-BBjK16O-.js +0 -5
  171. package/dist/chunks/if-defined-BdZRLDJ6.js +0 -5
  172. package/dist/chunks/if-non-empty-CEHK-hqx.js +0 -1
  173. package/dist/chunks/index-16wphaSo.js +0 -4
  174. package/dist/chunks/index-27oFQaOS.js +0 -37
  175. package/dist/chunks/index-5jmZyISW.js +0 -1
  176. package/dist/chunks/index-B7mGUQhz.js +0 -79
  177. package/dist/chunks/index-BBNaYDog.js +0 -22
  178. package/dist/chunks/index-BBt9OmO5.js +0 -12
  179. package/dist/chunks/index-BJAuRs3y.js +0 -75
  180. package/dist/chunks/index-BLjNrhkN.js +0 -4
  181. package/dist/chunks/index-BPVpH8ll.js +0 -160
  182. package/dist/chunks/index-BRuvyoCz.js +0 -15
  183. package/dist/chunks/index-BXIxcS00.js +0 -22
  184. package/dist/chunks/index-BaVyBv2V.js +0 -25
  185. package/dist/chunks/index-ByKyGGzb.js +0 -3
  186. package/dist/chunks/index-ByTSSU1x.js +0 -1
  187. package/dist/chunks/index-CIbRjtWm.js +0 -32
  188. package/dist/chunks/index-CLGxSjLW.js +0 -62
  189. package/dist/chunks/index-CONgwvp0.js +0 -12
  190. package/dist/chunks/index-CUgiXqyk.js +0 -4
  191. package/dist/chunks/index-C_ttE2g9.js +0 -16
  192. package/dist/chunks/index-Ce-pMzBC.js +0 -19
  193. package/dist/chunks/index-ChcHMeAS.js +0 -35
  194. package/dist/chunks/index-Clq0Fl19.js +0 -15
  195. package/dist/chunks/index-CtxTJnIm.js +0 -58
  196. package/dist/chunks/index-D25buhRm.js +0 -79
  197. package/dist/chunks/index-D4DqJG5_.js +0 -16
  198. package/dist/chunks/index-DEjRiv5B.js +0 -1
  199. package/dist/chunks/index-DFZsXFsx.js +0 -19
  200. package/dist/chunks/index-DGauWNwV.js +0 -156
  201. package/dist/chunks/index-DNeagy5a.js +0 -65
  202. package/dist/chunks/index-DO0fmDR9.js +0 -2
  203. package/dist/chunks/index-DSitHBEh.js +0 -36
  204. package/dist/chunks/index-DW7ST0tB.js +0 -1
  205. package/dist/chunks/index-DbKlVm7y.js +0 -74
  206. package/dist/chunks/index-Dgi-m1K-.js +0 -1
  207. package/dist/chunks/index-DnYNK1mz.js +0 -8
  208. package/dist/chunks/index-DntY4deR.js +0 -41
  209. package/dist/chunks/index-Dp4A8k6C.js +0 -103
  210. package/dist/chunks/index-Dphpk5r2.js +0 -1
  211. package/dist/chunks/index-DrBrgF-v.js +0 -49
  212. package/dist/chunks/index-Dt-nBtrQ.js +0 -26
  213. package/dist/chunks/index-DyZVAYLv.js +0 -52
  214. package/dist/chunks/index-Hh597Yu6.js +0 -121
  215. package/dist/chunks/index-LxkAuMAA.js +0 -1
  216. package/dist/chunks/index-OaQhvPR1.js +0 -46
  217. package/dist/chunks/index-cTXIVcWI.js +0 -45
  218. package/dist/chunks/index-jBse-XgU.js +0 -35
  219. package/dist/chunks/index-qiqzy9MI.js +0 -23
  220. package/dist/chunks/index-siqJUhKa.js +0 -1
  221. package/dist/chunks/index-w-G9CFId.js +0 -1
  222. package/dist/chunks/loading-icon-DJQIjg97.js +0 -23
  223. package/dist/chunks/main-DUusfqrI.js +0 -18
  224. package/dist/chunks/main-Dp7wHHgP.js +0 -2882
  225. package/dist/chunks/property-DCYiZTFF.js +0 -5
  226. package/dist/chunks/register-Cc9zkA5F.js +0 -1
  227. package/dist/chunks/register-JwwMwdRf.js +0 -1273
  228. package/dist/chunks/search-C3raqgOD.js +0 -30
  229. package/dist/chunks/select-item-4aISXm0r.js +0 -76
  230. package/dist/chunks/settings-BPOpwVkr.js +0 -594
  231. package/dist/chunks/settings-CK2vhfPu.js +0 -78
  232. package/dist/chunks/text-input-cjcnMXO-.js +0 -68
  233. package/dist/chunks/tooltip-content-DHyDYyOH.js +0 -3
@@ -0,0 +1,3681 @@
1
+ const numericString = "0123456789".split("");
2
+ [...numericString];
3
+ const alphaLower = "abcdefghijklmnopqrstuvwxyz".split(""), alphaUpper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
4
+ [...alphaLower, ...alphaUpper, ...numericString];
5
+ (/* @__PURE__ */ new Map()).set("true", !0).set("false", !1);
6
+ const compose = (...O) => (...D) => O.reduce((w, U) => (F) => w(U(F)))(...D), identity = (O) => O, whatType = (O) => typeof O, isDef = (O) => O !== void 0, isUndefined = (O) => O === void 0, isDefAndNotNull = (O) => O != null, isString = (O) => whatType(O) === "string", isNumber = (O) => whatType(O) === "number" && !Number.isNaN(
7
+ /** @type number */
8
+ O
9
+ ), isArray = (O) => O instanceof Array, reverse = (O) => Array.from(O).reduce((D, w) => [w, ...D], []), toLowerCase = (O) => O.toLowerCase(), toString = (O) => O + "", toNumber = (O) => +O;
10
+ compose(toLowerCase, toString);
11
+ const makeRandomString = () => {
12
+ let O = 2147483648;
13
+ return Math.floor(Math.random() * O).toString(36) + Math.abs(Math.floor(Math.random() * O) ^ Date.now()).toString(36);
14
+ }, stripLeadingChar = (O) => (D) => D.startsWith(O) ? D.slice(O.length) : D, join = (O) => (D) => D.join(O);
15
+ compose(join(""), reverse);
16
+ const pathOr = (O, D) => (w) => {
17
+ const U = D.reduce((F, q) => {
18
+ try {
19
+ return F[maybeNumber(q)];
20
+ } catch {
21
+ return;
22
+ }
23
+ }, w);
24
+ return U === void 0 ? O : U;
25
+ }, randomId = (O) => {
26
+ const D = makeRandomString();
27
+ return O ? D.substr(0, O) : D;
28
+ }, maybeNumber = (O) => {
29
+ if (O === null || whatType(O) === "string" && O.length > 1 && O.startsWith("0") && !O.startsWith("0."))
30
+ return O;
31
+ const D = 1 * O;
32
+ return D > Number.MAX_SAFE_INTEGER || Number.isNaN(D) ? O : D;
33
+ };
34
+ compose(toNumber, join(""), reverse, toString);
35
+ class EVT extends EventTarget {
36
+ /**
37
+ * Set this to true to get some debug in the console.
38
+ * @type {boolean}
39
+ * @private
40
+ */
41
+ #t = !1;
42
+ /**
43
+ * True if this is disposed.
44
+ * @type {boolean}
45
+ * @private
46
+ */
47
+ #e = !1;
48
+ /**
49
+ * A map of listener targets to an object of event: functions
50
+ * When adding a listener, immediately also create the un-listen functions
51
+ * and store those in an object keyed with the event.
52
+ * Store these objects against the target in a map
53
+ * @type {Map<!EventTarget, !Object<string, !Function>>}
54
+ * @private
55
+ */
56
+ #s = /* @__PURE__ */ new Map();
57
+ /**
58
+ * A set of components that are currently listening to this component
59
+ * @type {!Set<!EventTarget>}
60
+ * @private
61
+ */
62
+ #r = /* @__PURE__ */ new Set();
63
+ /**
64
+ * A set of interval timers as defined by setInterval.
65
+ * Use this to store the timers created particular to this component.
66
+ * On destruction, these timers will be cleared.
67
+ * @type {Set<any>}
68
+ * @private
69
+ */
70
+ #n = /* @__PURE__ */ new Set();
71
+ //--[ Static ]--
72
+ /**
73
+ * Creates a CustomEvent with the given type and data payload.
74
+ * @param {string} event The event type
75
+ * @param {*} data The data to attach to the event's detail property
76
+ * @return {!CustomEvent} A new CustomEvent instance
77
+ */
78
+ static makeEvent(D, w) {
79
+ return new CustomEvent(D, { detail: w });
80
+ }
81
+ /**
82
+ * Sets debug mode for this component. When enabled, debug messages
83
+ * will be logged to the console.
84
+ * @param {boolean} bool True to enable debug mode, false to disable
85
+ * @throws {Error} If the value is not a boolean
86
+ */
87
+ set debugMode(D) {
88
+ if (typeof D != "boolean")
89
+ throw new Error("This must be a boolean");
90
+ this.#t = D;
91
+ }
92
+ get debugMode() {
93
+ return this.#t;
94
+ }
95
+ /**
96
+ * Returns whether this component has been disposed.
97
+ * @return {boolean} True if disposed, false otherwise
98
+ */
99
+ get disposed() {
100
+ return this.#e;
101
+ }
102
+ /**
103
+ * Returns the map of targets this component is listening to.
104
+ * @return {!Map<!EventTarget, !Object<string, !Function>>} Map of targets to their event handlers
105
+ */
106
+ get listeningTo() {
107
+ return this.#s;
108
+ }
109
+ get isObservedBy() {
110
+ return this.#r;
111
+ }
112
+ get activeIntervals() {
113
+ return this.#n;
114
+ }
115
+ /**
116
+ * Logs debug messages to the console if debug mode is enabled.
117
+ * Automatically prepends the constructor name to the output.
118
+ * @param {...*} s Arguments to log
119
+ */
120
+ debugMe(...D) {
121
+ this.#t && console.log.apply(null, [this.constructor.name, "DEBUG:", ...D]);
122
+ }
123
+ //--[ Listeners and Listening ]--
124
+ /**
125
+ * @param {!EventTarget|!EVT} comp
126
+ */
127
+ isListenedToBy(D) {
128
+ this.#r.add(D);
129
+ }
130
+ /**
131
+ * WARNING! DO not use options={passive: true} here. It disallows us to
132
+ * use preventDefault when we intercept the form, and that leads to a
133
+ * general inability to POST forms.
134
+ *
135
+ * @param {!EventTarget|!EVT|!Node} target
136
+ * @param {string} event
137
+ * @param {!Function} action
138
+ * @param {boolean|!Object} options
139
+ */
140
+ listen(D, w, U, F = !1) {
141
+ D.addEventListener(w, U, F);
142
+ const q = this.listeningTo.get(D) || {};
143
+ q[w] = () => D.removeEventListener(w, U, F), this.listeningTo.set(D, q), isDef(D.isListenedToBy) && D.isListenedToBy(this);
144
+ }
145
+ /**
146
+ * Remove self from all components tt are listening to me.
147
+ */
148
+ stopBeingListenedTo() {
149
+ for (const D of this.isObservedBy)
150
+ D.stopListeningTo(this), this.isObservedBy.delete(D);
151
+ }
152
+ /**
153
+ * Stop listening to all events on target.
154
+ * @param {!EventTarget|!EVT|!Node|undefined} target
155
+ * @param {string=} opt_event
156
+ */
157
+ stopListeningTo(D, w) {
158
+ D && this.listeningTo.has(D) && (isDef(D.isObservedBy) && D.isObservedBy.delete(this), isDef(w) ? (Object.entries(this.listeningTo.get(D)).forEach(([U, F]) => {
159
+ U === w && F();
160
+ }), Object.keys(this.listeningTo.get(D)).length || this.listeningTo.delete(D)) : (Object.values(this.listeningTo.get(D)).forEach((U) => U()), this.listeningTo.delete(D)));
161
+ }
162
+ /**
163
+ * Removes all the event listeners that is managed by this
164
+ * component.
165
+ */
166
+ removeAllListener() {
167
+ for (const D of this.listeningTo.keys())
168
+ this.stopListeningTo(D);
169
+ }
170
+ /**
171
+ * Clears all active intervals created by this component.
172
+ * Called automatically during disposal to prevent memory leaks.
173
+ */
174
+ clearAllIntervals() {
175
+ for (const D of this.activeIntervals)
176
+ clearInterval(D), this.activeIntervals.delete(D);
177
+ }
178
+ /**
179
+ * Executes a function repeatedly at a specified interval.
180
+ * The interval is tracked and will be automatically cleared on disposal.
181
+ * @param {!Function} f The function to execute on each interval
182
+ * @param {number} interval The interval in milliseconds
183
+ */
184
+ doOnBeat(D, w) {
185
+ const U = setInterval(D, w);
186
+ this.activeIntervals.add(U);
187
+ }
188
+ /**
189
+ * Disposes of the component. Calls `exitDocument`, which is expected to
190
+ * remove event handlers and clean up the component. Propagates the call to
191
+ * the component's children, if any. Removes the component's DOM from the
192
+ * document unless it was decorated.
193
+ * @protected
194
+ */
195
+ disposeInternal() {
196
+ this.stopBeingListenedTo(), this.removeAllListener(), this.clearAllIntervals(), this.#e = !0;
197
+ }
198
+ /**
199
+ * Public method to dispose of this component. Calls disposeInternal()
200
+ * to perform cleanup of event listeners, intervals, and observers.
201
+ * After calling this method, the component should not be used.
202
+ */
203
+ dispose() {
204
+ this.disposeInternal();
205
+ }
206
+ }
207
+ class ZooyEventData {
208
+ constructor(D, w) {
209
+ this.value_ = D, this.data_ = w || {};
210
+ }
211
+ getValue() {
212
+ return this.value_;
213
+ }
214
+ getData() {
215
+ return this.data_;
216
+ }
217
+ }
218
+ const UiEventType = {
219
+ /**
220
+ * Dispatched after the content from the template is in the DOM
221
+ * and the in-line scripts from the AJAX call has been eval'd.
222
+ */
223
+ COMP: randomId(),
224
+ COMP_DRAG_START: randomId(),
225
+ COMP_DRAG_MOVE: randomId(),
226
+ COMP_DRAG_END: randomId(),
227
+ PANEL: randomId(),
228
+ VIEW: randomId(),
229
+ SPLIT: randomId(),
230
+ SPLIT_WILL_OPEN: randomId(),
231
+ SPLIT_DID_OPEN: randomId(),
232
+ SPLIT_WILL_CLOSE: randomId(),
233
+ SPLIT_DID_CLOSE: randomId(),
234
+ SPLIT_TRANSITION_END: randomId(),
235
+ READY: randomId(),
236
+ PANEL_MINIMIZE: randomId(),
237
+ FORM_SUBMIT_SUCCESS: randomId()
238
+ };
239
+ var EN_US = ["second", "minute", "hour", "day", "week", "month", "year"];
240
+ function en_US(O, D) {
241
+ if (D === 0)
242
+ return ["just now", "right now"];
243
+ var w = EN_US[Math.floor(D / 2)];
244
+ return O > 1 && (w += "s"), [O + " " + w + " ago", "in " + O + " " + w];
245
+ }
246
+ var ZH_CN = ["秒", "分钟", "小时", "天", "周", "个月", "年"];
247
+ function zh_CN(O, D) {
248
+ if (D === 0)
249
+ return ["刚刚", "片刻后"];
250
+ var w = ZH_CN[~~(D / 2)];
251
+ return [O + " " + w + "前", O + " " + w + "后"];
252
+ }
253
+ var Locales = {}, register = function(O, D) {
254
+ Locales[O] = D;
255
+ }, getLocale = function(O) {
256
+ return Locales[O] || Locales.en_US;
257
+ }, SEC_ARRAY = [
258
+ 60,
259
+ 60,
260
+ 24,
261
+ 7,
262
+ 365 / 7 / 12,
263
+ 12
264
+ ];
265
+ function toDate(O) {
266
+ return O instanceof Date ? O : !isNaN(O) || /^\d+$/.test(O) ? new Date(parseInt(O)) : (O = (O || "").trim().replace(/\.\d+/, "").replace(/-/, "/").replace(/-/, "/").replace(/(\d)T(\d)/, "$1 $2").replace(/Z/, " UTC").replace(/([+-]\d\d):?(\d\d)/, " $1$2"), new Date(O));
267
+ }
268
+ function formatDiff(O, D) {
269
+ var w = O < 0 ? 1 : 0;
270
+ O = Math.abs(O);
271
+ for (var U = O, F = 0; O >= SEC_ARRAY[F] && F < SEC_ARRAY.length; F++)
272
+ O /= SEC_ARRAY[F];
273
+ return O = Math.floor(O), F *= 2, O > (F === 0 ? 9 : 1) && (F += 1), D(O, F, U)[w].replace("%s", O.toString());
274
+ }
275
+ function diffSec(O, D) {
276
+ var w = /* @__PURE__ */ new Date();
277
+ return (+w - +toDate(O)) / 1e3;
278
+ }
279
+ var format = function(O, D, w) {
280
+ var U = diffSec(O);
281
+ return formatDiff(U, getLocale(D));
282
+ };
283
+ register("en_US", en_US);
284
+ register("zh_CN", zh_CN);
285
+ const getInputChecked_ = function(O) {
286
+ return O.checked ? (
287
+ /** @type {?} */
288
+ O.value
289
+ ) : null;
290
+ }, getSelectSingle_ = function(O) {
291
+ const D = (
292
+ /** @type {!HTMLSelectElement} */
293
+ O.selectedIndex
294
+ );
295
+ return D >= 0 ? (
296
+ /** @type {!HTMLSelectElement} */
297
+ O.options[D].value
298
+ ) : null;
299
+ }, getSelectMultiple_ = function(O) {
300
+ const D = [];
301
+ for (let w, U = 0; w = /** @type {!HTMLSelectElement} */
302
+ O.options[U]; U++)
303
+ w.selected && D.push(w.value);
304
+ return D.length ? D : null;
305
+ }, getValue = function(O) {
306
+ const D = (
307
+ /** @type {!HTMLInputElement} */
308
+ O.type
309
+ );
310
+ switch (isString(D) && D.toLowerCase()) {
311
+ case "checkbox":
312
+ case "radio":
313
+ return getInputChecked_(O);
314
+ case "select-one":
315
+ return getSelectSingle_(O);
316
+ case "select-multiple":
317
+ return getSelectMultiple_(O);
318
+ default:
319
+ return O.value !== null && O.value !== void 0 ? O.value : null;
320
+ }
321
+ }, formToJSON = (O) => [...O].reduce((D, w) => (D[w.name] = w.value, D), {}), replaceNode = (O, D) => {
322
+ const w = D.parentNode;
323
+ w && w.replaceChild(O, D);
324
+ }, removeNode = (O) => O && O.parentNode ? O.parentNode.removeChild(O) : null, insertSiblingAfter = (O, D) => {
325
+ D.parentNode && D.parentNode.insertBefore(O, D.nextSibling);
326
+ }, isInPage = (O) => O === document.body ? !1 : document.body.contains(O), getPos = (O) => [O.offsetLeft, O.offsetTop], randomColour = (O) => [1, 2, 3].map(() => Math.floor(Math.random() * 256) + 1).reduce((D, w) => `${D}${w},`, "rgba(") + `${O || 0.5}`, totalWidth = (O) => {
327
+ const D = window.getComputedStyle(O), w = O.offsetWidth, U = parseFloat(D.marginLeft) + parseFloat(D.marginRight), F = parseFloat(D.paddingLeft) + parseFloat(D.paddingRight), q = parseFloat(D.borderLeftWidth) + parseFloat(D.borderRightWidth);
328
+ return w + U - F + q;
329
+ }, totalHeight = (O) => {
330
+ const D = window.getComputedStyle(O), w = O.offsetHeight, U = parseFloat(D.marginTop) + parseFloat(D.marginBottom), F = parseFloat(D.paddingTop) + parseFloat(D.paddingBottom), q = parseFloat(D.borderTopWidth) + parseFloat(D.borderBottomWidth);
331
+ return w + U - F + q;
332
+ }, evalScripts = (comp) => (arr) => {
333
+ arr && Array.from(arr).forEach((s) => {
334
+ (function() {
335
+ eval(s.text);
336
+ }).bind(comp)();
337
+ });
338
+ }, evalModules = (O) => (D) => {
339
+ D && Array.from(D).forEach((w) => {
340
+ (function() {
341
+ const U = document.createElement("script");
342
+ U.type = "module", U.textContent = w.textContent;
343
+ const F = O.getElement(), q = getElDataMap(w).zv_comp_access;
344
+ q && (F.zvComponent = O, F.classList.add(q)), F.appendChild(U);
345
+ }).bind(O)();
346
+ });
347
+ }, splitScripts = (O) => {
348
+ const w = new DOMParser().parseFromString(O, "text/html");
349
+ return {
350
+ html: w.body.firstElementChild,
351
+ scripts: w.querySelectorAll('script:not([type="module"])'),
352
+ modules: w.querySelectorAll('script[type="module"]')
353
+ };
354
+ }, handleTemplateProm = (O) => Promise.resolve(splitScripts(O)), enableClass = (O, D, w) => {
355
+ w ? O.classList.add(D) : O.classList.remove(D);
356
+ }, toggleClass = (O, D) => {
357
+ const w = !Array.from(O.classList).includes(D);
358
+ return enableClass(O, D, w), w;
359
+ }, getElDataMap = (O) => O ? Object.assign({}, O.dataset || {}) : {}, dtFormatter = {
360
+ year: "numeric",
361
+ month: "short",
362
+ day: "numeric",
363
+ hour: "2-digit",
364
+ minute: "2-digit",
365
+ second: "2-digit"
366
+ }, dFormatter = {
367
+ year: "numeric",
368
+ month: "short",
369
+ day: "numeric"
370
+ }, dtf = new Intl.DateTimeFormat("en", {
371
+ day: "2-digit",
372
+ month: "short",
373
+ year: "2-digit",
374
+ hour: "2-digit",
375
+ minute: "2-digit",
376
+ second: "2-digit",
377
+ // hour12: false
378
+ hourCycle: "h23"
379
+ }), dateToZooyStdTimeString = (O) => {
380
+ const [{ value: D }, , { value: w }, , { value: U }, , { value: F }, , { value: q }, , { value: W }, ,] = dtf.formatToParts(O);
381
+ return `${w} ${D} ${U} ${F}:${q}:${W}`;
382
+ }, parseMomentAgo = (O, D = "both", w = void 0) => {
383
+ let U = O;
384
+ isNumber(U) && U < 9466848e5 ? U = U * 1e3 : w && (U = U + w);
385
+ const F = new Date(U), q = format(F), W = dateToZooyStdTimeString(F);
386
+ switch (D) {
387
+ case "time|ago":
388
+ return `${W}|${q}`;
389
+ case "ago":
390
+ return `${q}`;
391
+ case "datetime":
392
+ case "time":
393
+ return `${W}`;
394
+ case "both":
395
+ case "ago (time)":
396
+ default:
397
+ return `${q} (${W})`;
398
+ }
399
+ }, parseObfuscated = (O) => {
400
+ const w = ((F) => (q) => q < F.length - 4)(O);
401
+ return ((F) => F.split("").map((q, W) => w(W) ? "*" : q).join(""))(O);
402
+ }, parseMap = (/* @__PURE__ */ new Map()).set(void 0, (O, D, w) => identity(O)).set("", (O, D, w) => identity(O)).set("class_update_only", (O, D, w) => identity(O)).set("frac_100", (O, D, w) => Math.round(O * 100 * 100) / 100).set("date_and_time", (O, D, w) => new Date(O).toLocaleString(void 0, dtFormatter)).set("date", (O, D, w) => new Date(O).toLocaleString(void 0, dFormatter)).set("moment_ago", (O, D, w) => parseMomentAgo(O, "both", w.zdd_date_tz || void 0)).set("moment_ago_only", (O, D, w) => parseMomentAgo(O, "ago", w.zdd_date_tz || void 0)).set("moment_ago_datetime", (O, D, w) => parseMomentAgo(O, "datetime", w.zdd_date_tz || void 0)).set("pretty-json", (O, D, w) => JSON.stringify(O, null, 4)).set("obfuscated", (O, D, w) => parseObfuscated(O)).set("linear-progress", (O, D, w) => {
403
+ const U = toNumber(w.zpmax), F = D.linProg;
404
+ return U && F && (F.progress = O / U, O = void 0), O;
405
+ }), parseDataPropKvDef = (O) => O.trim().split(",").map((U) => U.trim()).map((U) => {
406
+ const [F, q] = U.split(":").map((W) => W.trim());
407
+ return [F, q];
408
+ }).filter(([U, F]) => U !== "" && F !== ""), parseDataProps = (O, D) => {
409
+ const w = getElDataMap(O);
410
+ delete O.dataset.zoodatapropkv;
411
+ const U = w.zoodatapropkv || "";
412
+ return parseDataPropKvDef(U).forEach(([q, W]) => {
413
+ O.dataset[q] = pathOr(void 0, W.split("."))(D);
414
+ }), O;
415
+ }, mapDataToEls = (O, D, w = /* @__PURE__ */ new Map(), U = void 0) => {
416
+ if (!D)
417
+ return;
418
+ const F = new Map([...parseMap, ...w]);
419
+ [...O.querySelectorAll("[data-zdd],[data-zdd_class_update],[data-zdd_template_loop_index]")].forEach((q) => {
420
+ const W = getElDataMap(q), X = W.zdd || "", G = W.zdd_parse_as, K = W.zdd_render_effect || "", Q = W.zdd_class_update, tt = W.zdd_template_loop_index, J = W.zdd_units || "";
421
+ let Y = pathOr(void 0, X.split("."))(D);
422
+ if (isDefAndNotNull(Y) && (Y = F.has(G) ? F.get(G)(Y, q, W) : Y), tt && isNumber(U) && (console.log("loopIndex: ", tt, " opt_loopIndex: ", U), tt === "zero_indexed" ? q.innerHTML = U : tt === "one_indexed" ? q.innerHTML = U + 1 : q.innerHTML = U), Q) {
423
+ const [Z, et, st] = Q.split(":"), rt = pathOr(void 0, Z.split("."))(D);
424
+ if (isDefAndNotNull(rt))
425
+ switch (et) {
426
+ case "swap": {
427
+ const nt = /\{}/gi, ot = st.replace(nt, ""), lt = st.replace(nt, rt);
428
+ q.classList.remove(...[...q.classList].filter((ht) => ht.includes(ot))), q.classList.add(lt);
429
+ break;
430
+ }
431
+ case "remove_on_data":
432
+ q.classList.remove(st);
433
+ break;
434
+ case "choice_map":
435
+ st.split("|").filter((nt) => nt !== "").forEach((nt) => {
436
+ const [ot, lt] = nt.split(">");
437
+ ot === rt + "" ? q.classList.add.apply(q.classList, lt.split(".")) : q.classList.remove.apply(q.classList, lt.split("."));
438
+ });
439
+ break;
440
+ }
441
+ }
442
+ if (G === "templated-array" && isArray(Y))
443
+ if (Y.length === 0)
444
+ q.classList.add("display__none");
445
+ else {
446
+ q.classList.remove("display__none"), Y = Y || [];
447
+ const Z = q.firstElementChild;
448
+ Z.classList.remove("display__none"), q.replaceChildren(...Y.map((et, st) => {
449
+ const rt = Z.cloneNode(!0), nt = parseDataProps(rt, et);
450
+ return mapDataToEls(nt, et, void 0, st), nt;
451
+ }));
452
+ }
453
+ else if (isDefAndNotNull(Y))
454
+ if (K === "typewriter") {
455
+ let Z = 0;
456
+ const et = Y + J, st = 5, rt = () => {
457
+ Z < et.length && (q.innerHTML += et.charAt(Z), Z++, setTimeout(rt, st));
458
+ };
459
+ q.innerHTML = "", rt();
460
+ } else
461
+ q.innerHTML = Y + J;
462
+ });
463
+ }, domUtils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
464
+ __proto__: null,
465
+ dateToZooyStdTimeString,
466
+ dtf,
467
+ enableClass,
468
+ evalModules,
469
+ evalScripts,
470
+ formToJSON,
471
+ getElDataMap,
472
+ getPos,
473
+ getValue,
474
+ handleTemplateProm,
475
+ insertSiblingAfter,
476
+ isInPage,
477
+ mapDataToEls,
478
+ parseDataPropKvDef,
479
+ parseMap,
480
+ parseMomentAgo,
481
+ randomColour,
482
+ removeNode,
483
+ replaceNode,
484
+ splitScripts,
485
+ toggleClass,
486
+ totalHeight,
487
+ totalWidth
488
+ }, Symbol.toStringTag, { value: "Module" }));
489
+ class ComponentLibraryRegistry {
490
+ /**
491
+ * Internal storage for registered component libraries.
492
+ * @type {Map<string, {render: Function, cache: Map, config: Object}>}
493
+ * @private
494
+ */
495
+ static #t = /* @__PURE__ */ new Map();
496
+ /**
497
+ * Registers a pluggable component library.
498
+ *
499
+ * @param {string} name - Library identifier (e.g., 'carbon', 'material')
500
+ * @param {Object} library - Library configuration object
501
+ * @param {Function} library.render - Main render function: async function(panel, cache)
502
+ * @param {Function} [library.dispose] - Optional cleanup function: function(element)
503
+ * @param {Object} [library.config] - Optional library-specific configuration
504
+ *
505
+ * @throws {Error} If library doesn't provide a render function
506
+ *
507
+ * @example
508
+ * ComponentLibraryRegistry.register('carbon', {
509
+ * render: async function(panel, cache) {
510
+ * // Scan, load, and attach components
511
+ * },
512
+ * dispose: function(element) {
513
+ * // Optional cleanup logic
514
+ * },
515
+ * config: { version: '2.0' }
516
+ * });
517
+ */
518
+ static register(D, w) {
519
+ if (!w.render)
520
+ throw new Error(`Component library '${D}' must provide a render function`);
521
+ this.#t.set(D, {
522
+ ...w,
523
+ // Preserve all library properties (utils, helpers, etc.)
524
+ dispose: w.dispose || null,
525
+ // Optional disposal function
526
+ cache: /* @__PURE__ */ new Map(),
527
+ // Each library gets its own import cache
528
+ config: w.config || {}
529
+ }), console.debug(`[ComponentLibraryRegistry] Registered: ${D}`);
530
+ }
531
+ /**
532
+ * Gets a registered component library by name.
533
+ *
534
+ * @param {string} name - Library identifier
535
+ * @returns {Object} Library object with render, cache, config
536
+ * @throws {Error} If library is not registered
537
+ */
538
+ static get(D) {
539
+ if (!this.#t.has(D)) {
540
+ const w = Array.from(this.#t.keys()).join(", ");
541
+ throw new Error(
542
+ `Component library '${D}' is not registered. Available: ${w || "none"}`
543
+ );
544
+ }
545
+ return this.#t.get(D);
546
+ }
547
+ /**
548
+ * Checks if a component library is registered.
549
+ *
550
+ * @param {string} name - Library identifier
551
+ * @returns {boolean} True if registered
552
+ */
553
+ static has(D) {
554
+ return this.#t.has(D);
555
+ }
556
+ /**
557
+ * Gets all registered library names.
558
+ *
559
+ * @returns {string[]} Array of registered library names
560
+ */
561
+ static getRegisteredLibraries() {
562
+ return Array.from(this.#t.keys());
563
+ }
564
+ /**
565
+ * Gets cache statistics for all registered component libraries.
566
+ * Useful for debugging and monitoring.
567
+ *
568
+ * @returns {Object} Map of library name → cache stats
569
+ */
570
+ static getCacheStats() {
571
+ const D = {};
572
+ for (const [w, U] of this.#t.entries())
573
+ D[w] = {
574
+ cacheSize: U.cache.size,
575
+ config: U.config
576
+ };
577
+ return D;
578
+ }
579
+ /**
580
+ * Clears import caches for all component libraries.
581
+ * Useful for development/hot-reload scenarios.
582
+ */
583
+ static clearAllCaches() {
584
+ for (const [D, w] of this.#t.entries())
585
+ w.cache.clear(), console.debug(`[ComponentLibraryRegistry] Cleared cache for: ${D}`);
586
+ }
587
+ /**
588
+ * Clears cache for a specific library.
589
+ *
590
+ * @param {string} name - Library identifier
591
+ * @throws {Error} If library is not registered
592
+ */
593
+ static clearCache(D) {
594
+ this.get(D).cache.clear(), console.debug(`[ComponentLibraryRegistry] Cleared cache for: ${D}`);
595
+ }
596
+ /**
597
+ * Unregisters a component library (primarily for testing).
598
+ *
599
+ * @param {string} name - Library identifier
600
+ * @returns {boolean} True if library was unregistered, false if not found
601
+ */
602
+ static unregister(D) {
603
+ return this.#t.delete(D);
604
+ }
605
+ /**
606
+ * Unregisters all component libraries (primarily for testing).
607
+ */
608
+ static unregisterAll() {
609
+ this.#t.clear();
610
+ }
611
+ }
612
+ const ComponentError = {
613
+ /**
614
+ * Error when a method is not supported.
615
+ */
616
+ NOT_SUPPORTED: "Method not supported",
617
+ /**
618
+ * Error when the given element can not be decorated.
619
+ */
620
+ DECORATE_INVALID: "Invalid element to decorate",
621
+ /**
622
+ * Error when the component is already rendered and another render attempt is
623
+ * made.
624
+ */
625
+ ALREADY_RENDERED: "Component already rendered",
626
+ /**
627
+ * Error when an already disposed component is attempted to be rendered.
628
+ */
629
+ ALREADY_DISPOSED: "Component already disposed",
630
+ /**
631
+ * Error when an attempt is made to set the parent of a component in a way
632
+ * that would result in an inconsistent object graph.
633
+ */
634
+ PARENT_UNABLE_TO_BE_SET: "Unable to set parent component",
635
+ /**
636
+ * Error when an attempt is made to add a child component at an out-of-bounds
637
+ * index. We don't support sparse child arrays.
638
+ */
639
+ CHILD_INDEX_OUT_OF_BOUNDS: "Child component index out of bounds",
640
+ /**
641
+ * Error when an attempt is made to remove a child component from a component
642
+ * other than its parent.
643
+ */
644
+ NOT_OUR_CHILD: "Child is not in parent component",
645
+ /**
646
+ * Error when an operation requiring DOM interaction is made when the
647
+ * component is not in the document
648
+ */
649
+ NOT_IN_DOCUMENT: "Operation not supported while component is not in document",
650
+ /**
651
+ * Error when an invalid component state is encountered.
652
+ */
653
+ STATE_INVALID: "Invalid component state"
654
+ };
655
+ class Component extends EVT {
656
+ //--[ Static ]--
657
+ /**
658
+ * Returns the component event type code used for dispatching component events.
659
+ * @return {string} The COMP event type
660
+ */
661
+ static compEventCode() {
662
+ return UiEventType.COMP;
663
+ }
664
+ /**
665
+ * Returns the component ready event type code.
666
+ * @return {string} The READY event type
667
+ */
668
+ static compReadyCode() {
669
+ return UiEventType.READY;
670
+ }
671
+ /**
672
+ * Returns the component error enumeration object.
673
+ * @return {!Object<string, string>} The ComponentError enum
674
+ */
675
+ static compErrors() {
676
+ return ComponentError;
677
+ }
678
+ #t;
679
+ #e;
680
+ #s;
681
+ #r;
682
+ #n;
683
+ #i;
684
+ #o;
685
+ #a;
686
+ constructor() {
687
+ super(), this.#t = () => (
688
+ /** @type {!HTMLElement} */
689
+ document.createElement("div")
690
+ ), this.#e = !1, this.#s = void 0, this.#r = void 0, this.#n = void 0, this.#i = void 0, this.#o = /* @__PURE__ */ new Map(), this.outOfTreeElements = [], this.placeholderDom = void 0, this.#a = () => {
691
+ };
692
+ }
693
+ //--[ Getters and Setters ]--
694
+ /**
695
+ * @param {Element|undefined} e
696
+ */
697
+ set target(D) {
698
+ this.#n = D;
699
+ }
700
+ /**
701
+ * @returns {Element|undefined}
702
+ */
703
+ get target() {
704
+ return this.#n;
705
+ }
706
+ /**
707
+ * Sets the model associated with the UI component.
708
+ * @param {*} m
709
+ */
710
+ set model(D) {
711
+ this.#r = D;
712
+ }
713
+ /**
714
+ * Returns the model associated with the UI component.
715
+ * @return {*}
716
+ */
717
+ get model() {
718
+ return this.#r;
719
+ }
720
+ /**
721
+ * @param {boolean} bool
722
+ */
723
+ set isInDocument(D) {
724
+ this.#e = D;
725
+ }
726
+ /**
727
+ * @return {boolean}
728
+ */
729
+ get isInDocument() {
730
+ return this.#e;
731
+ }
732
+ /**
733
+ * A function that makes a DOM element.
734
+ * @param {!function():(!HTMLElement|!Element|!DocumentFragment)} func
735
+ */
736
+ set domFunc(D) {
737
+ this.#t = D;
738
+ }
739
+ /**
740
+ * @param {!Function} func A callback guaranteed to fire after the panels is
741
+ * ready, and in the document, but before the
742
+ * {@code UiEventType.READY} event is fired.
743
+ */
744
+ set readyFunc(D) {
745
+ this.#a = D;
746
+ }
747
+ //--[ DOM Management ]--
748
+ /**
749
+ * Internal method to set the component's root element. Used primarily during
750
+ * rendering and re-rendering operations.
751
+ * @param {!Node} frag The DOM node to set as this component's element
752
+ * @private
753
+ */
754
+ setElementInternal_(D) {
755
+ this.#s = D;
756
+ }
757
+ /**
758
+ * Gets the component's element.
759
+ * @return {!HTMLElement|undefined} The element
760
+ * for the component.
761
+ */
762
+ getElement() {
763
+ return this.#s;
764
+ }
765
+ /**
766
+ * Creates the initial DOM representation for the component. The default
767
+ * implementation is to set this.element_ = div.
768
+ */
769
+ createDom() {
770
+ this.#s = this.#t();
771
+ }
772
+ /**
773
+ * Asserts that this component can be rendered asynchronously.
774
+ * Throws an error if the component has already been disposed.
775
+ * Used by async rendering methods to validate component state.
776
+ * @throws {Error} If the component is already disposed
777
+ */
778
+ assertCanRenderAsync() {
779
+ if (this.disposed)
780
+ throw new Error(ComponentError.ALREADY_DISPOSED);
781
+ }
782
+ /**
783
+ * Renders the component. If a parent element is supplied, the component's
784
+ * element will be appended to it. If there is no optional parent element and
785
+ * the element doesn't have a parentNode then it will be appended to the
786
+ * document body.
787
+ *
788
+ * If this component has a parent component, and the parent component is
789
+ * not in the document already, then this will not call `enterDocument`
790
+ * on this component.
791
+ *
792
+ * Throws an Error if the component is already rendered.
793
+ *
794
+ * @param {Element=} opt_parentElement Optional parent element to render the
795
+ * component into.
796
+ */
797
+ render(D) {
798
+ this.render_(D);
799
+ }
800
+ /**
801
+ * Renders the component. If a parent element is supplied, the component's
802
+ * element will be appended to it. If there is no optional parent element and
803
+ * the element doesn't have a parentNode then it will be appended to the
804
+ * document body.
805
+ *
806
+ * If this component has a parent component, and the parent component is
807
+ * not in the document already, then this will not call `enterDocument`
808
+ * on this component.
809
+ *
810
+ * Throws an Error if the component is already rendered.
811
+ *
812
+ * @param {Element=} opt_target Optional parent element to render the
813
+ * component into.
814
+ * @private
815
+ */
816
+ render_(D) {
817
+ if (this.disposed)
818
+ throw new Error(ComponentError.ALREADY_DISPOSED);
819
+ if (this.isInDocument)
820
+ throw new Error(ComponentError.ALREADY_RENDERED);
821
+ this.#s || this.createDom();
822
+ const w = (
823
+ /** @type {!Node} */
824
+ this.#s
825
+ );
826
+ D && (this.#n = D), this.placeholderDom && removeNode(this.placeholderDom), this.#n ? isInPage(w) || this.#n.insertBefore(w, null) : isInPage(
827
+ /** @type {!Node} */
828
+ w
829
+ ) || document.body.appendChild(w), (!this.#i || this.#i.isInDocument) && this.enterDocument();
830
+ }
831
+ //--[ Life-cycle ]--
832
+ /**
833
+ * @param {Node} el
834
+ * @param {Node} targetParent
835
+ */
836
+ hoist(D, w = void 0) {
837
+ w || (w = document.querySelector("body")), w.appendChild(D), this.outOfTreeElements.push(D);
838
+ }
839
+ /**
840
+ * Executes the beforeReady callback function if one was set.
841
+ * Called automatically during enterDocument, before the READY event is dispatched.
842
+ * Allows components to perform final setup operations once they're in the DOM.
843
+ */
844
+ executeBeforeReady() {
845
+ this.#a();
846
+ }
847
+ /**
848
+ * Called when the component's element is known to be in the document. Anything
849
+ * using document.getElementById etc. should be done at this stage.
850
+ *
851
+ * If the component contains child components, this call is propagated to its
852
+ * children.
853
+ */
854
+ enterDocument() {
855
+ this.disposed ? removeNode(this.getElement()) : (this.isInDocument = !0, [...this.#o.values()].forEach((D) => {
856
+ !D.isInDocument && D.getElement() && D.enterDocument();
857
+ }), this.executeBeforeReady(), this.dispatchCompEvent(UiEventType.READY));
858
+ }
859
+ /**
860
+ * Called by dispose to clean up the elements and listeners created by a
861
+ * component, or by a parent component/application who has removed the
862
+ * component from the document but wants to reuse it later.
863
+ *
864
+ * If the component contains child components, this call is propagated to its
865
+ * children.
866
+ *
867
+ * It should be possible for the component to be rendered again once this
868
+ * method has been called.
869
+ */
870
+ exitDocument() {
871
+ [...this.#o.values()].forEach((D) => {
872
+ D.isInDocument && D.exitDocument();
873
+ }), this.stopBeingListenedTo(), this.removeAllListener(), this.isInDocument = !1, removeNode(this.getElement()), this.placeholderDom && removeNode(this.placeholderDom);
874
+ }
875
+ /**
876
+ * Disposes of the component. Calls `exitDocument`, which is expected to
877
+ * remove event handlers and clean up the component. Propagates the call to
878
+ * the component's children, if any. Removes the component's DOM from the
879
+ * document unless it was decorated.
880
+ * @protected
881
+ */
882
+ disposeInternal() {
883
+ this.isInDocument && this.exitDocument(), this.#o && [...this.#o.values()].forEach((D) => D.disposeInternal()), this.outOfTreeElements.forEach(removeNode), this.#s && removeNode(this.#s), this.placeholderDom && removeNode(this.placeholderDom), this.#o = null, this.#s = void 0, this.#r = null, this.#i = null, super.disposeInternal();
884
+ }
885
+ /**
886
+ * Disposes of the component and performs cleanup. Aborts any pending async
887
+ * operations, asks registered component libraries to cleanup their components,
888
+ * and calls the parent dispose method.
889
+ * After calling this method, the component should not be used.
890
+ */
891
+ dispose() {
892
+ this.abortController && this.abortController.abort();
893
+ const D = this.getElement();
894
+ if (D)
895
+ for (const w of ComponentLibraryRegistry.getRegisteredLibraries())
896
+ try {
897
+ const U = ComponentLibraryRegistry.get(w);
898
+ U.dispose && U.dispose(D);
899
+ } catch (U) {
900
+ console.debug(`[${w}] Cleanup error during component disposal (non-critical):`, U);
901
+ }
902
+ super.dispose();
903
+ }
904
+ //--[ Built in events ]--
905
+ /**
906
+ * Dispatches a {@code UiEventType.COMP} event.
907
+ * A shorthand method to get panels to dispatch uniform events.
908
+ * Views may listen just to this event, and act on the supplied value or
909
+ * data payload.
910
+ * Example:
911
+ * b.listen(a, Component.compEventCode(), e => {
912
+ * console.log('B got', Component.compEventCode(), e);
913
+ * console.log('Value is', e.detail.getValue());
914
+ * console.log('Data is', e.detail.getData());
915
+ * });
916
+ * @param {string|number} value
917
+ * @param {(string|number|?Object)=} opt_data
918
+ * @return {boolean} If anyone called preventDefault on the event object (or
919
+ * if any of the handlers returns false this will also return false.
920
+ */
921
+ dispatchCompEvent(D, w) {
922
+ const U = new ZooyEventData(D, w), F = EVT.makeEvent(UiEventType.COMP, U);
923
+ return this.dispatchEvent(F);
924
+ }
925
+ }
926
+ const EV = {
927
+ // Mouse events
928
+ CLICK: "click",
929
+ DBLCLICK: "dblclick",
930
+ MOUSEDOWN: "mousedown",
931
+ MOUSEUP: "mouseup",
932
+ MOUSEMOVE: "mousemove",
933
+ // Touch events
934
+ // Note that other touch events exist, but we should follow the W3C list here.
935
+ // http://www.w3.org/TR/touch-events/#list-of-touchevent-types
936
+ TOUCHSTART: "touchstart",
937
+ TOUCHMOVE: "touchmove",
938
+ TOUCHEND: "touchend",
939
+ // Form events
940
+ SUBMIT: "submit",
941
+ CHANGE: "change",
942
+ INPUT: "input",
943
+ INVALID: "invalid",
944
+ // Drag and drop events
945
+ DRAGSTART: "dragstart",
946
+ DRAGEND: "dragend",
947
+ DRAGOVER: "dragover",
948
+ DRAGENTER: "dragenter",
949
+ DRAGEXIT: "dragexit",
950
+ DRAGLEAVE: "dragleave",
951
+ DROP: "drop",
952
+ // Transitions
953
+ TRANSITIONEND: "transitionend"
954
+ }, touchEvents = [EV.TOUCHMOVE, EV.TOUCHSTART, EV.TOUCHEND], isTouchEvent = (O) => touchEvents.includes(O.type), normalizeEvent = (O) => (isTouchEvent(O) && (O.clientX = O.targetTouches[0].clientX, O.clientY = O.targetTouches[0].clientY), O), dragStartListener = (O, D, w, U) => (F) => {
955
+ F.preventDefault();
956
+ const q = normalizeEvent(F), W = (
957
+ /** @type {!HTMLElement} */
958
+ q.currentTarget
959
+ ), [X, G] = getPos(W), K = q.clientX - X, Q = q.clientY - G, tt = O(X, G, K, Q, W), J = w(X, G, K, Q, W), Y = D(X, G, K, Q, W);
960
+ let Z = freeMoveListener(Y, W, K, Q);
961
+ ["x", "ew"].includes(U) ? Z = xMoveOnlyListener(Y, W, K) : ["y", "ns"].includes(U) && (Z = yMoveOnlyListener(Y, W, K, Q));
962
+ let et = !1;
963
+ const st = (nt) => {
964
+ et = !0, Z(nt);
965
+ }, rt = (nt) => {
966
+ document.removeEventListener(EV.MOUSEMOVE, st, !0), document.removeEventListener(EV.TOUCHMOVE, st, !0), document.removeEventListener(EV.MOUSEUP, rt, !0), document.removeEventListener(EV.TOUCHEND, rt, !0), et && J(nt);
967
+ };
968
+ return document.addEventListener(EV.MOUSEUP, rt, !0), document.addEventListener(EV.TOUCHEND, rt, !0), document.addEventListener(EV.MOUSEMOVE, st, !0), document.addEventListener(EV.TOUCHMOVE, st, !0), tt(F), rt;
969
+ }, freeMoveListener = (O, D, w, U) => (F) => {
970
+ F.preventDefault();
971
+ const q = normalizeEvent(F);
972
+ D.style.left = `${q.clientX - w}px`, D.style.top = `${q.clientY - U}px`, O(q);
973
+ }, xMoveOnlyListener = (O, D, w, U) => (F) => {
974
+ F.preventDefault();
975
+ const q = normalizeEvent(F);
976
+ D.style.left = `${q.clientX - w}px`, O(q);
977
+ }, yMoveOnlyListener = (O, D, w, U) => (F) => {
978
+ F.preventDefault();
979
+ const q = normalizeEvent(F);
980
+ D.style.top = `${q.clientY - U}px`, O(q);
981
+ }, makeEmitter = (O, D) => (w, U, F, q, W) => (X) => {
982
+ O.dispatchCompEvent(D, {
983
+ component: O,
984
+ browserEvent: X,
985
+ left: w,
986
+ top: U,
987
+ clientX: X.clientX,
988
+ clientY: X.clientY,
989
+ xOrg: F,
990
+ yOrg: q,
991
+ deltaX: X.clientX - F - w,
992
+ deltaY: X.clientY - q - U,
993
+ target: W
994
+ });
995
+ };
996
+ class Dragger extends Component {
997
+ #t;
998
+ #e;
999
+ #s;
1000
+ #r;
1001
+ /**
1002
+ * @param {string} freedom Restrict the directions in which the
1003
+ * dragger can be moved.
1004
+ */
1005
+ constructor(D = "xy") {
1006
+ super(), this.#t = ["x", "y", "xy", "ew", "ns"].includes(D.toLowerCase()) ? D.toLowerCase() : "xy", this.#e = void 0, this.#s = !0, this.#r = (w) => null;
1007
+ }
1008
+ /**
1009
+ * Cancels the current drag operation in progress, if any.
1010
+ * @param {!Event} event The event that triggered the cancel
1011
+ */
1012
+ cancelDrag(D) {
1013
+ this.#r(D);
1014
+ }
1015
+ //--[ Getters and Setters ]--
1016
+ /**
1017
+ * Sets the direction in which the component can be dragged.
1018
+ * Only 'x' or 'y' will lock the movements to those directions.
1019
+ * Anything else will be considered free movement
1020
+ * @param {string} axis
1021
+ */
1022
+ set moveFreedom(D) {
1023
+ this.#t = D, this.#s || (this.lock(), this.unlock());
1024
+ }
1025
+ /**
1026
+ * Get the direction in which this component can move.
1027
+ * @return {string}
1028
+ */
1029
+ get moveFreedom() {
1030
+ return this.#t;
1031
+ }
1032
+ //--[ Override ]--
1033
+ /**
1034
+ * @inheritDoc
1035
+ */
1036
+ executeBeforeReady() {
1037
+ this.unlock(), super.executeBeforeReady();
1038
+ }
1039
+ //--[ Dragger Specific ]--
1040
+ /**
1041
+ * Make the component draggable
1042
+ */
1043
+ unlock() {
1044
+ const D = (w) => (U) => {
1045
+ this.#r = w(U);
1046
+ };
1047
+ if (this.isInDocument && this.#s) {
1048
+ const w = makeEmitter(this, UiEventType.COMP_DRAG_MOVE), U = makeEmitter(this, UiEventType.COMP_DRAG_START), F = makeEmitter(this, UiEventType.COMP_DRAG_END), q = dragStartListener(
1049
+ U,
1050
+ w,
1051
+ F,
1052
+ this.#t
1053
+ );
1054
+ this.#s = !1, this.#e = /** @type {!Node} */
1055
+ this.#e || this.getElement(), this.listen(this.#e, EV.MOUSEDOWN, D(q)), this.listen(this.#e, EV.TOUCHSTART, q), this.#e.classList.remove("locked");
1056
+ }
1057
+ }
1058
+ /**
1059
+ * Lock the component in place.
1060
+ * Removes all the listeners added when it was made draggable.
1061
+ */
1062
+ lock() {
1063
+ this.stopListeningTo(this.#e, EV.MOUSEDOWN), this.stopListeningTo(this.#e, EV.TOUCHSTART), this.#s = !0, this.#e.classList.add("locked");
1064
+ }
1065
+ }
1066
+ const splitRe_ = new RegExp(
1067
+ "^(?:([^:/?#.]+):)?(?://(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/#?]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$"
1068
+ ), ComponentIndex = {
1069
+ PATH: 5,
1070
+ QUERY_DATA: 6
1071
+ }, split = (O) => (
1072
+ /** @type {!Array<string|undefined>} */
1073
+ O.match(splitRe_)
1074
+ ), decodeOrEmpty_ = (O, D) => O ? decodeURI(O.replace(/%25/g, "%2525")) : "", getPath = (O) => decodeOrEmpty_(split(O)[ComponentIndex.PATH]), getQueryData = (O) => decodeOrEmpty_(split(O)[ComponentIndex.QUERY_DATA]), objectToUrlParms = (O) => [...Object.entries(O)].map(
1075
+ (D) => `${D[0]}=${D[1]}`
1076
+ ).join("&"), isValidValue = (O) => O != null && O !== "", queryDataToMap = (O) => O.split("&").reduce((D, w) => {
1077
+ const [U, F] = w.split("=");
1078
+ return isValidValue(U) && isValidValue(F) && D.set(U, F), D;
1079
+ }, /* @__PURE__ */ new Map()), uriUtils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1080
+ __proto__: null,
1081
+ getPath,
1082
+ getQueryData,
1083
+ objectToUrlParms,
1084
+ queryDataToMap
1085
+ }, Symbol.toStringTag, { value: "Module" })), stripLeadingSpace = stripLeadingChar(" "), stripLeadingSlash = stripLeadingChar("/"), getCookieByName = (O) => document.cookie.split(";").map((D) => D.split("=")).reduce((D, w) => D.set(stripLeadingSpace(w[0]), w[1]), /* @__PURE__ */ new Map()).get(O), spinner = (O) => {
1086
+ let D = 0, w;
1087
+ const U = (F) => {
1088
+ const q = F > 0;
1089
+ return q ? D += 1 : D -= 1, q ? D === 1 : D === 0;
1090
+ };
1091
+ return (F) => {
1092
+ w = w || document.getElementById(O), w && U(F) && w.classList.toggle("viz", D > 0);
1093
+ };
1094
+ }, spin = spinner("the_loader"), startSpin = () => Promise.resolve(spin(1)), stopSpin = (O) => (spin(0), Promise.resolve(O)), checkStatus = (O) => O.ok ? Promise.resolve(O) : Promise.reject(new Error(`${O.url} ${O.status} (${O.statusText})`)), checkStatusTwo = (O) => (D) => {
1095
+ if (D.type === "opaqueredirect" || D.redirected) {
1096
+ const w = stripLeadingSlash(getPath(D.url));
1097
+ O.setIsRedirected(!0, w), console.log("Redirect detected", w);
1098
+ }
1099
+ return checkStatus(D);
1100
+ }, getJson = (O) => O.status === 204 ? Promise.resolve({}) : O.json().then(
1101
+ (D) => Promise.resolve(D),
1102
+ (D) => Promise.reject(new Error(`Could not get JSON from response: ${D}`))
1103
+ ), getText = (O) => O.text().then(
1104
+ (D) => Promise.resolve(D),
1105
+ (D) => Promise.reject(new Error(`Could not get text from response: ${D}`))
1106
+ ), getTextOrJson = (O) => O.headers.get("Content-Type") === "application/json" ? getJson(O) : getText(O), jsonInit = (O, D, w = "POST", U = void 0) => {
1107
+ const F = new Headers();
1108
+ F.append("Content-type", "application/json"), F.append("X-Requested-With", "XMLHttpRequest"), O && O !== "" && F.append("Authorization", `Bearer ${O}`);
1109
+ const q = {
1110
+ cache: "no-cache",
1111
+ method: w,
1112
+ headers: F,
1113
+ credentials: "include",
1114
+ body: JSON.stringify(D)
1115
+ };
1116
+ return U && (q.signal = U), q;
1117
+ }, basicPutPostPatchInit = (O, D, w = !1, U = void 0) => {
1118
+ const F = new Headers();
1119
+ if (D && D !== "" && F.append("Authorization", `Bearer ${D}`), F.append("X-Requested-With", "XMLHttpRequest"), w) {
1120
+ const W = getCookieByName("csrftoken");
1121
+ W && w && F.append("X-CSRFToken", W);
1122
+ }
1123
+ const q = {
1124
+ cache: "no-cache",
1125
+ method: O,
1126
+ headers: F,
1127
+ redirect: "follow",
1128
+ // This is anyway the default.
1129
+ credentials: "include"
1130
+ };
1131
+ return U && (q.signal = U), q;
1132
+ }, formPostInit = (O, D, w = void 0) => {
1133
+ const F = basicPutPostPatchInit("POST", O, !1, w);
1134
+ return F.body = new FormData(D.formEl), F;
1135
+ }, basicGetInit = (O, D = void 0) => {
1136
+ const w = new Headers();
1137
+ w.append("Authorization", `Bearer ${O}`), w.append("X-Requested-With", "XMLHttpRequest");
1138
+ const U = {
1139
+ cache: "no-cache",
1140
+ headers: w,
1141
+ credentials: "include"
1142
+ };
1143
+ return D && (U.signal = D), U;
1144
+ }, putPostPatchNobody = (O, D) => {
1145
+ const w = new Request(O);
1146
+ return fetch(w, D).then(checkStatus).then(getText);
1147
+ }, genCatchClause = (O, D = void 0) => (w) => (stopSpin("").then(identity), w.name === "AbortError" ? console.info(O, "ABORTED!") : console.error(O, w), D);
1148
+ class UserManager {
1149
+ /**
1150
+ * @param {!Object=} opt_data
1151
+ */
1152
+ constructor(D) {
1153
+ this.user_ = {}, this.jwt = "", D && this.updateProfileFromJwt(D).then(() => {
1154
+ });
1155
+ }
1156
+ /**
1157
+ * @param {Object} data
1158
+ * @param {boolean=} opt_onlyIfNoneExists
1159
+ * @return {Promise}
1160
+ * @private
1161
+ */
1162
+ updateProfileFromJwt(D, w = !1) {
1163
+ return w && this.jwt !== "" ? Promise.resolve("User Profile Already exists") : D.non_field_errors ? Promise.reject(new Error(`JWT ${D.non_field_errors}`)) : (this.updateToken(D.token), this.updateProfile(D.user), Promise.resolve("User Profile Updated"));
1164
+ }
1165
+ /**
1166
+ * @param {UserLikeType} data
1167
+ */
1168
+ updateProfile(D) {
1169
+ this.user_ = D;
1170
+ }
1171
+ /**
1172
+ * @param {string} t
1173
+ */
1174
+ updateToken(D) {
1175
+ this.jwt = D;
1176
+ }
1177
+ /**
1178
+ * @return {number|undefined}
1179
+ */
1180
+ get id() {
1181
+ return this.user_.id;
1182
+ }
1183
+ /**
1184
+ * @return {string|undefined}
1185
+ */
1186
+ get name() {
1187
+ return this.user_.name;
1188
+ }
1189
+ /**
1190
+ * @return {string|undefined}
1191
+ */
1192
+ get surname() {
1193
+ return this.user_.surname;
1194
+ }
1195
+ /**
1196
+ * @return {string|undefined}
1197
+ */
1198
+ get salutation() {
1199
+ let D = this.name;
1200
+ const w = this.surname;
1201
+ return w && (D = D + " " + w), D;
1202
+ }
1203
+ /**
1204
+ * @param {FormPanel} formPanel
1205
+ * @return {Promise}
1206
+ */
1207
+ formSubmit(D) {
1208
+ const w = new Request(D.uri.toString()), U = D.processSubmitReply.bind(D), F = genCatchClause("Form submit error");
1209
+ return startSpin().then(() => fetch(w, formPostInit(
1210
+ this.jwt,
1211
+ D,
1212
+ D.abortController.signal
1213
+ ))).then(checkStatusTwo(D)).then(stopSpin).then(getTextOrJson).then(U).catch(F);
1214
+ }
1215
+ /**
1216
+ * @param {string} uri
1217
+ * @param {Boolean} useDocumentCookies
1218
+ * @param {AbortSignal|undefined} signal
1219
+ * @return {Promise}
1220
+ */
1221
+ putNoBody(D, w = void 0, U = !1) {
1222
+ const F = genCatchClause("putNobody error"), q = basicPutPostPatchInit(
1223
+ "PUT",
1224
+ this.jwt,
1225
+ U,
1226
+ w
1227
+ );
1228
+ return putPostPatchNobody(D, q).catch(F);
1229
+ }
1230
+ /**
1231
+ * @param {string} uri
1232
+ * @param {AbortSignal|undefined} signal
1233
+ * @return {Promise}
1234
+ */
1235
+ fetch(D, w = void 0) {
1236
+ const U = new Request(D.toString()), F = genCatchClause(`UMan Text GET Fetch: ${D}`);
1237
+ return startSpin().then(() => fetch(U, basicGetInit(this.jwt, w))).then(checkStatus).then(stopSpin).then(getText).catch(F);
1238
+ }
1239
+ /**
1240
+ * Use this if you want to directly get a parsed template that does not go
1241
+ * through panel logic.
1242
+ * @param {string} uri
1243
+ * @param {AbortSignal|undefined} signal
1244
+ * @return {Promise}
1245
+ */
1246
+ fetchAndSplit(D, w = void 0) {
1247
+ const U = genCatchClause(`fetchAndSplit: ${D}`);
1248
+ return this.fetch(D, w).then(handleTemplateProm).catch(U);
1249
+ }
1250
+ /**
1251
+ * @param {string} uri
1252
+ * @param {AbortSignal|undefined} signal
1253
+ * @return {Promise}
1254
+ */
1255
+ fetchJson(D, w = void 0) {
1256
+ const U = new Request(D.toString()), F = genCatchClause(`fetchJson: ${D}`, {}), q = basicGetInit(this.jwt, w);
1257
+ return startSpin().then(() => fetch(U, q)).then(checkStatus).then(stopSpin).then(getJson).catch(F);
1258
+ }
1259
+ /**
1260
+ * @param {string} uri
1261
+ * @param {Object} payload
1262
+ * @param {AbortSignal|undefined} signal
1263
+ * @return {Promise}
1264
+ */
1265
+ patchJson(D, w, U = void 0) {
1266
+ const F = new Request(D.toString()), q = genCatchClause(`patchJson: ${D}`), W = jsonInit(this.jwt, w, "PATCH", U);
1267
+ return fetch(F, W).then(checkStatus).then(getJson).catch(q);
1268
+ }
1269
+ /**
1270
+ * @param {string} uri
1271
+ * @param {Object} payload
1272
+ * @param {AbortSignal|undefined} signal
1273
+ * @return {Promise}
1274
+ */
1275
+ postJson(D, w, U = void 0) {
1276
+ const F = new Request(D.toString()), q = genCatchClause(`postJson: ${D}`), W = jsonInit(this.jwt, w, "POST", U);
1277
+ return fetch(F, W).then(checkStatus).then(getJson).catch(q);
1278
+ }
1279
+ /**
1280
+ * @param {string} uri
1281
+ * @param {Object} payload
1282
+ * @param {AbortSignal|undefined} signal
1283
+ * @return {Promise}
1284
+ */
1285
+ putJson(D, w, U = void 0) {
1286
+ const F = new Request(D.toString()), q = genCatchClause(`putJson: ${D}`), W = jsonInit(this.jwt, w, "PUT", U);
1287
+ return fetch(F, W).then(checkStatus).then(getJson).catch(q);
1288
+ }
1289
+ /**
1290
+ * @param {string} uri
1291
+ * @param {Object} payload
1292
+ * @param {AbortSignal|undefined} signal
1293
+ * @return {Promise}
1294
+ */
1295
+ delJson(D, w, U = void 0) {
1296
+ const F = new Request(D.toString()), q = genCatchClause(`delJson: ${D}`), W = jsonInit(this.jwt, w, "DELETE", U);
1297
+ return fetch(F, W).then(checkStatus).then(getJson).catch(q);
1298
+ }
1299
+ }
1300
+ class Panel extends Component {
1301
+ /**
1302
+ * Returns the panel event type code used for dispatching panel events.
1303
+ * @return {string} The PANEL event type
1304
+ */
1305
+ static panelEventCode() {
1306
+ return UiEventType.PANEL;
1307
+ }
1308
+ /**
1309
+ * Returns the component ready event type code.
1310
+ * @return {string} The READY event type
1311
+ */
1312
+ static compReadyCode() {
1313
+ return UiEventType.READY;
1314
+ }
1315
+ /**
1316
+ * Creates a new Panel instance.
1317
+ * @param {string=} uri Optional URI for fetching panel content
1318
+ */
1319
+ constructor(D) {
1320
+ super(), this.qParamMap_ = /* @__PURE__ */ new Map(), this.uri_ = "", D && this.parseUri(D), this.evalScripts = evalScripts(this), this.evalModules = evalModules(this), this.redirected = !1, this.responseObject = { html: null, scripts: null }, this.user_ = void 0, "AbortController" in window ? this.abortController = new AbortController() : this.abortController = {
1321
+ signal: void 0,
1322
+ abort: () => {
1323
+ }
1324
+ }, this.listMap = /* @__PURE__ */ new Map();
1325
+ }
1326
+ //--[ Getters and Setters ]--
1327
+ get uri() {
1328
+ const D = this.qParamMap_.size > 0 ? "?" + objectToUrlParms(Object.fromEntries(this.qParamMap_)) : "";
1329
+ return this.uri_ + D;
1330
+ }
1331
+ /**
1332
+ * @param {!UserManager} user
1333
+ */
1334
+ set user(D) {
1335
+ this.user_ = D;
1336
+ }
1337
+ /**
1338
+ * @return {!UserManager}
1339
+ */
1340
+ get user() {
1341
+ return this.user_ || (this.user_ = new UserManager()), this.user_;
1342
+ }
1343
+ /**
1344
+ * Parses a URI into its path and query parameters. Updates the panel's
1345
+ * internal URI and query parameter map.
1346
+ * @param {string} uri The URI to parse
1347
+ */
1348
+ parseUri(D) {
1349
+ this.uri_ = getPath(D), this.qParamMap_ = queryDataToMap(getQueryData(D));
1350
+ }
1351
+ /**
1352
+ * Adds or updates a query parameter in the panel's query parameter map.
1353
+ * @param {string} k The parameter key
1354
+ * @param {string} v The parameter value
1355
+ */
1356
+ addToQParams(D, w) {
1357
+ this.qParamMap_.set(D, w);
1358
+ }
1359
+ /**
1360
+ * Removes a query parameter from the panel's query parameter map.
1361
+ * @param {string} k The parameter key to remove
1362
+ */
1363
+ removeFromQParams(D) {
1364
+ this.qParamMap_.delete(D);
1365
+ }
1366
+ /**
1367
+ * Clears all query parameters from the panel's query parameter map.
1368
+ */
1369
+ clearQParams() {
1370
+ this.qParamMap_.clear();
1371
+ }
1372
+ //--[ Carbon Component Access ]-----
1373
+ /**
1374
+ * Gets all Carbon components of a specific type in this panel.
1375
+ * Components are scanned and stored during Carbon library initialization.
1376
+ * @param {string} selector - Carbon component selector (e.g., 'cds-table', 'cds-button')
1377
+ * @return {Element[]} Array of matching elements, or empty array if none found
1378
+ * @example
1379
+ * const tables = this.getCarbonComponents('cds-table');
1380
+ * const buttons = this.getCarbonComponents('cds-button');
1381
+ */
1382
+ getCarbonComponents(D) {
1383
+ return this.carbonComponents?.get(D) || [];
1384
+ }
1385
+ /**
1386
+ * Gets a single Carbon component by its ID.
1387
+ * Searches across all Carbon component types stored in this panel.
1388
+ * @param {string} id - The element ID to search for
1389
+ * @return {Element|undefined} The matching element, or undefined if not found
1390
+ * @example
1391
+ * const table = this.getCarbonComponentById('companies-table');
1392
+ */
1393
+ getCarbonComponentById(D) {
1394
+ if (this.carbonComponents)
1395
+ for (const w of this.carbonComponents.values()) {
1396
+ const U = w.find((F) => F.id === D);
1397
+ if (U)
1398
+ return U;
1399
+ }
1400
+ }
1401
+ //--[ Template Render ]-----
1402
+ /**
1403
+ * Temporarily render placeholder DOM
1404
+ * @param {Node!} placeholder
1405
+ */
1406
+ renderPlaceHolder(D) {
1407
+ this.target && (this.placeholderDom = D, this.target.insertBefore(this.placeholderDom, null));
1408
+ }
1409
+ /**
1410
+ * Expects HTML data from a call to the back.
1411
+ * @param {Function=} opt_callback An optional callback to call before
1412
+ * rendering the panel. This is useful for when you only want to attach the
1413
+ * new panel to the view right before you render it - meaning the existing
1414
+ * panel stays in place on the DOM for the duration of the fetch call.
1415
+ * @return {Promise} Returns a promise with this panel as value.
1416
+ */
1417
+ renderWithTemplate(D) {
1418
+ const w = this.user;
1419
+ return w ? w.fetch(this.uri, this.abortController.signal).then((U) => (this.assertCanRenderAsync(), D && D(this), this.onRenderWithTemplateReply(U).catch((F) => {
1420
+ F.message !== Component.compErrors().ALREADY_DISPOSED && console.error("RenderWithTemplate Err:", F);
1421
+ }), this)).catch((U) => {
1422
+ throw console.error("Panel.renderWithTemplate fetch failed:", U), U;
1423
+ }) : Promise.reject(new Error("No UserManager instance available for Panel.renderWithTemplate()"));
1424
+ }
1425
+ /**
1426
+ * @param {string} s
1427
+ * @private
1428
+ * @return {Promise}
1429
+ */
1430
+ onRenderWithTemplateReply(D) {
1431
+ return this.responseObject = splitScripts(D), this.domFunc = () => (
1432
+ /** @type {!Element} */
1433
+ this.responseObject.html
1434
+ ), this.render(), Promise.resolve(this);
1435
+ }
1436
+ /**
1437
+ * Partially replace panel's content.
1438
+ * If an ID query selector (#something) is passed in, then that single node is replaced
1439
+ * in the panel DOM with the single node in the content DOM
1440
+ *
1441
+ * If a class query selector (.some_class) is passed in, all elements in the
1442
+ * panel's dom with that class is replaced with the matching
1443
+ * element ID in the content DOM matching the target DOMs element IDs
1444
+ *
1445
+ * NOTE: For the spot replacement to work, you need both the classname
1446
+ * and a unique element ID on the element you intend to replace.
1447
+ *
1448
+ * NOTE: Top level replacements will clobber child replacements.
1449
+ *
1450
+ * @param content
1451
+ * @param qs
1452
+ */
1453
+ onReplacePartialDom(D, w) {
1454
+ const U = this.getElement();
1455
+ if (isUndefined(U))
1456
+ return;
1457
+ const F = D.html;
1458
+ if (w.startsWith("."))
1459
+ [...U.querySelectorAll(w)].filter((q) => isDefAndNotNull(q.id)).map((q) => [q, F.querySelector(`#${q.id}`)]).filter(([q, W]) => isDefAndNotNull(W)).forEach(([q, W]) => {
1460
+ q.parentNode.replaceChild(W, q), this.parseContent(W);
1461
+ });
1462
+ else if (w.startsWith("#")) {
1463
+ const q = F.querySelector(w), W = U.querySelector(w);
1464
+ W.parentNode.replaceChild(q, W), this.parseContent(q);
1465
+ }
1466
+ this.evalScripts(D.scripts), this.evalModules(D.modules);
1467
+ }
1468
+ //--[ JSON Render ]-----
1469
+ /**
1470
+ * Equivalent to the @code{renderWithTemplate} method in that it is guaranteed
1471
+ * that a reply from the callback is received before @code{render} is called.
1472
+ * @param {function(Object, !Panel)} opt_callback The callback function
1473
+ * that will receive the reply event.
1474
+ */
1475
+ renderWithJSON(D) {
1476
+ return this.user ? this.user.fetchJson(this.uri_, this.abortController.signal).then((U) => {
1477
+ this.assertCanRenderAsync(), D && D(U, this), this.onRenderWithJSON(U).then(identity);
1478
+ }).catch((U) => {
1479
+ throw console.error("Panel.renderWithJSON fetch failed:", U), U;
1480
+ }) : Promise.reject(new Error("No UserManager instance available for Panel.renderWithJSON()"));
1481
+ }
1482
+ /**
1483
+ * On reply from a GET call to the panel URI
1484
+ * @param {Object} _json The callback function
1485
+ * that will receive the reply event.
1486
+ * @return {Promise}
1487
+ */
1488
+ onRenderWithJSON(D) {
1489
+ return Promise.resolve(this);
1490
+ }
1491
+ /**
1492
+ * @param {Element} _el
1493
+ * @param {Object} _elDataMap
1494
+ * @param {Object} _json
1495
+ */
1496
+ onAsyncJsonReply(D, w, U) {
1497
+ }
1498
+ /**
1499
+ * Called on each async HTML response, after the content is in the DOM
1500
+ * and rendered.
1501
+ * @param {Element} _el
1502
+ * @param {Object} _elDataMap
1503
+ */
1504
+ onAsyncHtmlReply(D, w) {
1505
+ }
1506
+ /**
1507
+ * Hook method called when the view broadcasts data to all its panels.
1508
+ * Override this method to handle broadcasted data in subclasses.
1509
+ * @param {*} _data The data broadcast from the view
1510
+ */
1511
+ onViewDataBroadcast(D) {
1512
+ }
1513
+ //--[ JSON Render ]-----
1514
+ /**
1515
+ * @param {Element} panel
1516
+ */
1517
+ parseContent(D) {
1518
+ if (this.debugMe("Enable interactions. Panel:", D), typeof window.customElements < "u" && ComponentLibraryRegistry.has("carbon")) {
1519
+ const J = ComponentLibraryRegistry.get("carbon");
1520
+ J.render.call(this, D, J.cache).catch((Y) => console.error("[Zooy] Carbon initialization failed:", Y));
1521
+ }
1522
+ if (ComponentLibraryRegistry.has("mdc")) {
1523
+ const J = ComponentLibraryRegistry.get("mdc");
1524
+ J.render.call(this, D, J.cache);
1525
+ }
1526
+ D.classList.contains("zoo__modal-base") && D.classList.contains("close_on_click") && this.listen(D, EV.CLICK, (J) => {
1527
+ J.target === D && this.dispatchPanelEvent("destroy_me");
1528
+ }), [...D.querySelectorAll(
1529
+ ".zoo__button:not(.external):not(.mdc-data-table__row)"
1530
+ )].forEach((J) => {
1531
+ this.listen(J, EV.CLICK, (Y) => {
1532
+ Y.stopPropagation();
1533
+ const Z = Y.currentTarget, et = getElDataMap(Z);
1534
+ this.dispatchPanelEvent(et.zv, Object.assign({
1535
+ orgEvt: Y,
1536
+ trigger: Z,
1537
+ href: Z.href || et.href
1538
+ }, et));
1539
+ });
1540
+ }), [...D.querySelectorAll("[href]:not(.external)")].forEach((J) => {
1541
+ this.listen(J, EV.CLICK, (Y) => {
1542
+ const Z = Y.currentTarget;
1543
+ Y.preventDefault(), Y.stopPropagation();
1544
+ const et = getElDataMap(Z), st = et.zv || "href";
1545
+ this.dispatchPanelEvent(st, Object.assign({
1546
+ orgEvt: Y,
1547
+ trigger: Y.target,
1548
+ href: Z.href || et.href
1549
+ }, et));
1550
+ });
1551
+ }), [...D.querySelectorAll("form.intercept_submit")].forEach((J) => {
1552
+ J.noValidate = !0, this.listen(J, EV.SUBMIT, (Y) => {
1553
+ Y.preventDefault(), Y.stopPropagation();
1554
+ const Z = getElDataMap(J), et = formToJSON(J.elements);
1555
+ this.dispatchPanelEvent(Z.zv, Object.assign({
1556
+ orgEvt: Y,
1557
+ trigger: Y.target,
1558
+ formData: et,
1559
+ href: Z.href
1560
+ }, Z));
1561
+ });
1562
+ }), [...D.querySelectorAll(".zoo__toggle_class_driver")].forEach(
1563
+ (J) => {
1564
+ const Y = getElDataMap(J), Z = Y.toggle_class_target_id, et = Y.toggle_class, st = D.querySelector(`#${Z}`);
1565
+ st && et && J.addEventListener(EV.CLICK, (rt) => {
1566
+ rt.stopPropagation(), st.classList.toggle(et);
1567
+ });
1568
+ }
1569
+ );
1570
+ const w = Array.from(D.querySelectorAll(".folder_drop_zone")), U = Array.from(D.querySelectorAll("[draggable]")), F = (J) => {
1571
+ J.preventDefault(), J.target.classList.add("drag_over");
1572
+ }, q = (J) => {
1573
+ J.preventDefault();
1574
+ }, W = (J) => {
1575
+ J.preventDefault(), J.target.classList.remove("drag_over");
1576
+ }, X = (J) => {
1577
+ J.preventDefault(), J.target.classList.remove("drag_over");
1578
+ }, G = (J) => {
1579
+ J.preventDefault(), J.target.classList.remove("drag_over");
1580
+ }, K = (J) => {
1581
+ J.dataTransfer.dropEffect = "move";
1582
+ const Y = getElDataMap(J.target);
1583
+ J.dataTransfer.setData("text/plain", JSON.stringify(Y)), J.target.classList.add("drag_in_progress");
1584
+ }, Q = (J) => {
1585
+ J.target.classList.remove("drag_in_progress");
1586
+ }, tt = (J) => {
1587
+ G(J), J.stopPropagation();
1588
+ const Y = JSON.parse(J.dataTransfer.getData("text/plain")), Z = getElDataMap(J.target);
1589
+ return this.dispatchPanelEvent("drop_on", {
1590
+ custom: { on: Z, from: Y }
1591
+ }), !1;
1592
+ };
1593
+ w.forEach((J) => {
1594
+ this.listen(J, EV.DRAGOVER, q), this.listen(J, EV.DRAGENTER, F), this.listen(J, EV.DRAGEXIT, X), this.listen(J, EV.DRAGLEAVE, W), this.listen(J, EV.DROP, tt);
1595
+ }), U.forEach((J) => {
1596
+ this.listen(J, EV.DRAGSTART, K), this.listen(J, EV.DRAGEND, Q);
1597
+ }), [...D.querySelectorAll(".zoo_async_json")].forEach((J) => {
1598
+ const Y = getElDataMap(J), Z = Y.href, et = this.onAsyncJsonReply.bind(this, J, Y);
1599
+ this.user.fetchJson(Z, this.abortController.signal).then(et);
1600
+ const st = Y.z_json_reusable;
1601
+ st && (this.jsonCallFuncs = this.jsonCallFuncs || {}, this.jsonCallFuncs[st] = () => {
1602
+ this.user.fetchJson(Z, this.abortController.signal).then(et);
1603
+ });
1604
+ const rt = toNumber(Y.z_interval);
1605
+ isNumber(rt) && this.doOnBeat(() => {
1606
+ this.user.fetchJson(Z, this.abortController.signal).then(et);
1607
+ }, rt * 60 * 1e3);
1608
+ }), [...D.querySelectorAll(".zoo_async_html")].forEach(
1609
+ /**
1610
+ * @param {Element} el
1611
+ */
1612
+ (J) => {
1613
+ const Y = getElDataMap(J), Z = Y.href;
1614
+ this.user.fetchAndSplit(Z, this.abortController.signal).then((st) => {
1615
+ J.appendChild(st.html), this.parseContent(J), this.evalScripts(st.scripts), this.evalModules(st.modules), this.onAsyncHtmlReply(J, Y);
1616
+ });
1617
+ const et = toNumber(Y.z_interval);
1618
+ isNumber(et) && this.doOnBeat(() => {
1619
+ this.user.fetchAndSplit(Z, this.abortController.signal).then((st) => {
1620
+ J.replaceChildren(st.html), this.parseContent(J), this.evalScripts(st.scripts), this.evalModules(st.modules);
1621
+ });
1622
+ }, et * 60 * 1e3);
1623
+ }
1624
+ );
1625
+ }
1626
+ /**
1627
+ * @inheritDoc
1628
+ * Called when the panel enters the document. Parses content to enable
1629
+ * Material Design Components, executes scripts and modules, then dispatches
1630
+ * the READY event.
1631
+ */
1632
+ enterDocument() {
1633
+ const D = this.getElement();
1634
+ this.parseContent(D), this.evalScripts(this.responseObject.scripts), this.evalModules(this.responseObject.modules), super.enterDocument();
1635
+ }
1636
+ /**
1637
+ * @inheritDoc
1638
+ * Called when the panel exits the document. Aborts any pending async
1639
+ * operations and performs cleanup.
1640
+ */
1641
+ exitDocument() {
1642
+ this.abortController.abort(), super.exitDocument();
1643
+ }
1644
+ /**
1645
+ * @param {boolean} bool
1646
+ * @param {?string} url
1647
+ */
1648
+ setIsRedirected(D, w) {
1649
+ this.redirected = D, this.redirected && w && (this.uri_ = w);
1650
+ }
1651
+ //--[ Built in events ]--
1652
+ /**
1653
+ * Dispatches a @code{UiEventType.PANEL} event.
1654
+ * A shorthand method to get panels to dispatch uniform events.
1655
+ * Views may listen just to this event, and act on the supplied value or
1656
+ * data payload.
1657
+ * @example
1658
+ * b.listen(a, Panel.panelEventCode(), e => {
1659
+ * console.log('B got', Panel.panelEventCode(), e);
1660
+ * console.log('Value is', e.detail.getValue());
1661
+ * console.log('Data is', e.detail.getData());
1662
+ * });
1663
+ * @param {string|number} value
1664
+ * @param {(string|number|?Object)=} opt_data
1665
+ * @return {boolean} If anyone called preventDefault on the event object
1666
+ * or if any of the handlers returns false this will also return false.
1667
+ */
1668
+ dispatchPanelEvent(D, w) {
1669
+ const U = new ZooyEventData(D, w), F = EVT.makeEvent(UiEventType.PANEL, U);
1670
+ return this.debugMe("PANEL EVENT FIRED. Value:", D, "Opt DATA:", w), this.dispatchEvent(F);
1671
+ }
1672
+ }
1673
+ class FormPanel extends Panel {
1674
+ /**
1675
+ * @type {?HTMLFormElement}
1676
+ * @private
1677
+ */
1678
+ #t = null;
1679
+ /**
1680
+ * Map of form fields to their error message DOM elements
1681
+ * @type {!Map<HTMLInputElement, Element>}
1682
+ * @private
1683
+ */
1684
+ #e = /* @__PURE__ */ new Map();
1685
+ #s = !0;
1686
+ /**
1687
+ * Creates a new FormPanel instance.
1688
+ * @param {string=} uri Optional URI for fetching form content
1689
+ * @param {boolean} intercept If false, we do not try and intercept the forms
1690
+ */
1691
+ constructor(D, w = !0) {
1692
+ super(D), this.#s = w, this.debugMode = !0, this.onSubmitSucFunc = (U, F) => null;
1693
+ }
1694
+ /**
1695
+ * Gets the form element managed by this panel.
1696
+ * @return {?HTMLFormElement} The form element, or null if not found
1697
+ */
1698
+ get formEl() {
1699
+ return this.#t;
1700
+ }
1701
+ /**
1702
+ * @inheritDoc
1703
+ * Called when the form panel enters the document. Identifies the form element
1704
+ * and sets up submission interception and field error handling.
1705
+ */
1706
+ enterDocument() {
1707
+ super.enterDocument(), this.formIdElementToForm_();
1708
+ }
1709
+ /**
1710
+ * Internal method to identify the form element and set up interception.
1711
+ * @private
1712
+ */
1713
+ formIdElementToForm_() {
1714
+ this.#t = this.getFormFromId(), this.#t && (this.#a(this.#t), this.#r());
1715
+ }
1716
+ /**
1717
+ * @param {string=} string The id of the form we want to sterilise.
1718
+ * @return {?HTMLFormElement}
1719
+ */
1720
+ getFormFromId(D) {
1721
+ let w = null, U = this.getElement().querySelector("form");
1722
+ return D && (U = document.getElementById(
1723
+ /** @type {string} */
1724
+ D
1725
+ ) || U), U && U.tagName.toLowerCase() === "form" && (w = /** @type {HTMLFormElement} */
1726
+ U), w;
1727
+ }
1728
+ //--[ Field Validation Methods ]--
1729
+ /**
1730
+ * Initializes field validation. Sets up event listeners on the form
1731
+ * for change, input, and invalid events.
1732
+ * @private
1733
+ */
1734
+ #r() {
1735
+ this.#t && (this.listen(this.#t, EV.CHANGE, (D) => {
1736
+ this.#o(D);
1737
+ }, { passive: !0 }), this.listen(this.#t, EV.INPUT, (D) => {
1738
+ this.clearAllValidationErrors(), this.#o(D);
1739
+ }), this.listen(this.#t, EV.INVALID, (D) => {
1740
+ D.preventDefault();
1741
+ const w = (
1742
+ /** @type {HTMLInputElement} */
1743
+ D.target
1744
+ );
1745
+ this.#i(w), this.displayFieldError(w);
1746
+ }, { passive: !0 }));
1747
+ }
1748
+ /**
1749
+ * Checks all form fields for validity. Returns true if all fields are valid.
1750
+ * Displays error messages for any invalid fields.
1751
+ * @return {boolean} True if all fields are valid, false otherwise
1752
+ */
1753
+ checkAllFields() {
1754
+ const D = [...this.#t.elements].map((w) => [this.#n(w), w]).filter((w) => !w[0]);
1755
+ return D.forEach((w) => this.displayFieldError(w[1])), D.length === 0;
1756
+ }
1757
+ /**
1758
+ * Clear all existing validation errors
1759
+ */
1760
+ clearAllValidationErrors() {
1761
+ [...this.#t ? this.#t.elements : []].forEach((U) => this.#i(U)), [...this.#t.querySelectorAll(".non-field-errors")].forEach((U) => U.classList.remove("alert-error"));
1762
+ }
1763
+ /**
1764
+ * Format the message dom object and insert it into the DOM
1765
+ * @param {HTMLInputElement} field The field after which the alert will be inserted.
1766
+ * @param {string} msg The message in the alert.
1767
+ * @param {string} _css A CSS class name to add to the alert div.
1768
+ * @private
1769
+ */
1770
+ displayAlert_(D, w, U) {
1771
+ const F = document.getElementById(`${D.id}-helper-text`) || document.createElement("p");
1772
+ F.textContent = w, this.#e.set(D, F);
1773
+ }
1774
+ /**
1775
+ * Check validation for a single field
1776
+ * @param {HTMLInputElement} field
1777
+ * @return {boolean} True if field is valid
1778
+ * @private
1779
+ */
1780
+ #n(D) {
1781
+ this.#i(D);
1782
+ let w = !D.willValidate;
1783
+ return D.willValidate && (w = D.checkValidity()), w;
1784
+ }
1785
+ /**
1786
+ * Clear alert for a single field
1787
+ * @param {HTMLInputElement} field
1788
+ * @private
1789
+ */
1790
+ #i(D) {
1791
+ D.classList.remove("error"), this.#e.has(D) && (this.#e.get(D).textContent = ""), this.#e.delete(D);
1792
+ }
1793
+ /**
1794
+ * Display the given error message on the given form field.
1795
+ * @param {HTMLInputElement} field
1796
+ * @param {string=} opt_msg
1797
+ */
1798
+ displayFieldError(D, w) {
1799
+ const U = w || D.validationMessage;
1800
+ D.classList.add("error"), this.displayAlert_(D, U, "alert-error");
1801
+ }
1802
+ /**
1803
+ * Display the given success message on the given form field.
1804
+ * @param {HTMLInputElement} field
1805
+ * @param {string} message
1806
+ */
1807
+ displayFieldSuccess(D, w) {
1808
+ this.displayAlert_(D, w, "alert-success");
1809
+ }
1810
+ /**
1811
+ * Display the given information message on the given form field.
1812
+ * @param {HTMLInputElement} field
1813
+ * @param {string} message
1814
+ */
1815
+ displayFieldInfo(D, w) {
1816
+ this.displayAlert_(D, w, "alert-info");
1817
+ }
1818
+ /**
1819
+ * Validate field on change event
1820
+ * @param {Event} e
1821
+ * @private
1822
+ */
1823
+ #o(D) {
1824
+ this.#n(
1825
+ /** @type {HTMLInputElement} */
1826
+ D.target
1827
+ );
1828
+ }
1829
+ /**
1830
+ * Given a form id, get the form, and intercept and sterilise its submit.
1831
+ * Forms that passed through here will not be able to be submitted with a
1832
+ * normal submit button anymore, but built in HTML5 Constraint Validation
1833
+ * will still function on the form. This way, we can still have a button with
1834
+ * type="submit", which will trigger the validation, and we can submit
1835
+ * valid forms with xhrio which allows us to add callbacks to them.
1836
+ *
1837
+ * @param {HTMLFormElement} form The form we want to sterilise.
1838
+ * @return {HTMLFormElement}
1839
+ */
1840
+ #a(D) {
1841
+ if (D && this.#s) {
1842
+ D.noValidate = !0;
1843
+ const w = this.user;
1844
+ this.listen(D, EV.SUBMIT, (U) => {
1845
+ U.preventDefault(), this.debugMe("Intercepted from SUBMIT"), this.checkAllFields() && w && w.formSubmit(this);
1846
+ });
1847
+ }
1848
+ return D;
1849
+ }
1850
+ //--[ Round Trip ]--
1851
+ /**
1852
+ * @param {function(!FormPanel, (string|!ServerFormSuccessJsonType)=): (?|null|Promise<?>)} func
1853
+ */
1854
+ onSubmitSuccess(D) {
1855
+ this.onSubmitSucFunc = D;
1856
+ }
1857
+ /**
1858
+ * Given a 'fetch' reply, replace the form.
1859
+ * This simply replaced the form element with what came back from the server
1860
+ * and re-reads the scripts.
1861
+ * @param {string} reply
1862
+ */
1863
+ replaceForm(D) {
1864
+ if (this.responseObject = splitScripts(D), this.responseObject.html) {
1865
+ if (this.redirected) {
1866
+ this.removeAllListener();
1867
+ const w = this.getElement(), U = w.parentNode;
1868
+ this.setElementInternal_(this.responseObject.html), U.replaceChild(this.getElement(), w);
1869
+ } else {
1870
+ const w = (
1871
+ /** @type {!Element} */
1872
+ this.responseObject.html.querySelector("form")
1873
+ );
1874
+ w && replaceNode(w, this.#t);
1875
+ const U = (
1876
+ /** @type {!Element} */
1877
+ this.responseObject.html.querySelector('button[type="submit"]')
1878
+ ), F = (
1879
+ /** @type {!Element} */
1880
+ this.getElement().querySelector('button[type="submit"]')
1881
+ );
1882
+ U && F && replaceNode(U, F);
1883
+ }
1884
+ this.enterDocument();
1885
+ }
1886
+ }
1887
+ /**
1888
+ * Expects HTML data from a call to the back.
1889
+ * @return {Promise} Returns a promise with this panel as value.
1890
+ */
1891
+ refreshFromFromServer() {
1892
+ const D = this.user, w = this.uri;
1893
+ return D ? D.fetch(w, this.abortController.signal).then(
1894
+ (U) => this.replaceForm(U)
1895
+ ) : Promise.reject(new Error("No UserManager instance available for FormPanel.refreshFromFromServer()"));
1896
+ }
1897
+ /**
1898
+ * @param {string} reply
1899
+ * @return {Promise}
1900
+ */
1901
+ processSubmitReply(D) {
1902
+ this.clearAllValidationErrors();
1903
+ let w = !1;
1904
+ if (whatType(D) === "object" && D.success)
1905
+ return Promise.resolve(this).then(() => {
1906
+ this.onSubmitSucFunc(this, D), this.dispatchCompEvent(UiEventType.FORM_SUBMIT_SUCCESS);
1907
+ });
1908
+ if (D === "success" ? (this.debugMe(`
1909
+ 1.REDIRECTED: ${this.redirected}
1910
+ REPLY: ${D}`), w = !0) : D === `redirected_success
1911
+ ` ? (this.debugMe(`
1912
+ 2.REDIRECTED: ${this.redirected}
1913
+ REPLY: ${D}`), w = !0, this.redirected = !1) : (this.debugMe(`
1914
+ 3.REDIRECTED: ${this.redirected}
1915
+ REPLY: Some form HTML`), this.replaceForm(D)), w && this.redirected)
1916
+ return this.debugMe(`
1917
+ 4.REDIRECTED: ${this.redirected}
1918
+ SUCCESS: ${w}`), this.redirected = !1, Promise.resolve(this);
1919
+ if (w)
1920
+ return this.debugMe(`
1921
+ 5.REDIRECTED: ${this.redirected}
1922
+ SUCCESS: ${w}`), Promise.resolve(this).then(() => {
1923
+ this.onSubmitSucFunc(this), this.dispatchCompEvent(UiEventType.FORM_SUBMIT_SUCCESS);
1924
+ });
1925
+ this.debugMe(`
1926
+ 6.REDIRECTED: ${this.redirected}
1927
+ SUCCESS: ${w}`);
1928
+ }
1929
+ }
1930
+ class Split extends Component {
1931
+ /**
1932
+ * Returns the split event type code used for dispatching split events.
1933
+ * @return {string} The SPLIT event type
1934
+ */
1935
+ static splitEventCode() {
1936
+ return UiEventType.SPLIT;
1937
+ }
1938
+ /**
1939
+ * Creates a new Split component instance. Initializes nest tracking and
1940
+ * callback management.
1941
+ */
1942
+ constructor() {
1943
+ super(), this.dragImage_ = document.createElement("canvas"), this.nestMap_ = /* @__PURE__ */ new Map(), this.nestCallbackMap_ = /* @__PURE__ */ new Map(), this.splitNests_ = /* @__PURE__ */ new Set();
1944
+ }
1945
+ /**
1946
+ * Returns all nest entries (name and config object) that have a valid element.
1947
+ * @return {!Array<!Array<string, !Object>>} Array of [nestName, nestConfig] pairs
1948
+ */
1949
+ get nests() {
1950
+ return [...this.nestMap_.entries()].filter(([D, { nestEl: w }]) => w);
1951
+ }
1952
+ /**
1953
+ * Gets the nest element for a given nest name.
1954
+ * @param {string} nestName The nest name to look up
1955
+ * @return {!Element | undefined} The nest element, or undefined if not found
1956
+ */
1957
+ getNest(D) {
1958
+ return this.nestMap_.get(D)?.nestEl;
1959
+ }
1960
+ /**
1961
+ * Returns the names of all nests that haven't been further split.
1962
+ * @return {!Array<string>} Array of nest names
1963
+ */
1964
+ get nestNames() {
1965
+ return [...this.nestMap_.entries()].filter(([D, w]) => !this.splitNests_.has(w)).map(([D]) => D);
1966
+ }
1967
+ /**
1968
+ * Closes and locks all nests in this split component.
1969
+ * @param {!Function=} callback Callback to execute after each nest closes
1970
+ * @param {boolean=} opt_skipAni If true, skips animation
1971
+ */
1972
+ closeAndLockAll(D = identity, w = !1) {
1973
+ this.nestNames.forEach((U) => this.closeAndLock(U, D, w));
1974
+ }
1975
+ /**
1976
+ * Opens and unlocks all nests in this split component.
1977
+ * @param {!Function=} callback Callback to execute after each nest opens
1978
+ * @param {boolean=} opt_skipAni If true, skips animation
1979
+ */
1980
+ openAndUnlockAll(D = identity, w = !1) {
1981
+ this.nestNames.forEach((U) => this.openAndUnlock(U, D, w));
1982
+ }
1983
+ // ---------------------------------------------------------------------------
1984
+ /**
1985
+ * Lock a dragger. Removes the listeners that make it draggable.
1986
+ * Adds the 'locked' class to the element.
1987
+ * Sets the element's "display" style to none.
1988
+ * Even though all these operations are performed on the the dragger, access
1989
+ * is vai the nest name - for consistency with the rest of the API.
1990
+ * @param {string} nestName Nest name
1991
+ */
1992
+ lock(D) {
1993
+ const { dragEl: w } = this.nestMap_.get(D);
1994
+ w.classList.add("locked");
1995
+ }
1996
+ /**
1997
+ * The reverse of a lock. Removes the classes added by <@code>lock</> and
1998
+ * restores the draggable listeners.
1999
+ * Even though all these operations are performed on the the dragger, access
2000
+ * is vai the nest name - for consistency with the rest of the API.
2001
+ * @param {string} nestName Nest name
2002
+ */
2003
+ unlock(D) {
2004
+ const { dragEl: w } = this.nestMap_.get(D);
2005
+ w.classList.remove("locked");
2006
+ }
2007
+ /**
2008
+ * Resize a nest.
2009
+ * @param {string} nestName Nest name
2010
+ * @param {number} size The required size of the resulting move.
2011
+ * @param {Function?} callback A callback function to call once
2012
+ * the resize completed.
2013
+ * @param {boolean?} opt_skipAni When true, the resize won't be animated, but
2014
+ * simply affected directly.
2015
+ */
2016
+ resize(D, w, U = identity, F = !1) {
2017
+ const { sizeNow: q, nestEl: W, canResize: X } = this.nestMap_.get(D);
2018
+ X && (F || q === w ? (W.classList.remove("animated"), W.style.flexBasis = `${w}px`, this.nestMap_.get(D).sizeNow = w, U()) : (W.classList.add("animated"), this.nestCallbackMap_.set(D, () => {
2019
+ W.classList.remove("animated"), this.nestMap_.get(D).sizeNow = w, U();
2020
+ }), W.style.flexBasis = `${w}px`));
2021
+ }
2022
+ /**
2023
+ * Close the nest and lock it. See <@code>lock</>
2024
+ * @param {string} nestName Nest name
2025
+ * @param {Function?} callback A callback function to call once
2026
+ * the resize completed.
2027
+ * @param {boolean?} opt_skipAni When true, the resize won't be animated, but
2028
+ * simply affected directly.
2029
+ */
2030
+ closeAndLock(D, w = identity, U = !1) {
2031
+ const { nestEl: F, dragEl: q, canResize: W } = this.nestMap_.get(D);
2032
+ if (!W)
2033
+ return;
2034
+ const X = () => {
2035
+ q.classList.add("locked", "closed"), F.classList.add("closed"), w();
2036
+ };
2037
+ this.resize(D, 0, X, U);
2038
+ }
2039
+ closeAndUnlock(D, w = identity, U = !1) {
2040
+ const { nestEl: F, dragEl: q, canResize: W } = this.nestMap_.get(D);
2041
+ if (!W)
2042
+ return;
2043
+ const X = () => {
2044
+ F.classList.remove("closed"), q.classList.remove("closed", "locked"), q.classList.add("collapsed"), w();
2045
+ };
2046
+ this.resize(D, 0, X, U);
2047
+ }
2048
+ /**
2049
+ * Open a closed and locked nest. Simply a convenience method to combine
2050
+ * the unlock and resize steps.
2051
+ * @param {string} nestName Nest name
2052
+ * @param {number?} size The required size of the resulting move.
2053
+ * @param {Function?} callback A callback function to call once
2054
+ * the resize completed.
2055
+ * @param {boolean?} opt_skipAni When true, the resize won't be animated, but
2056
+ * simply affected directly.
2057
+ */
2058
+ openAndUnlock(D, w, U, F = !1) {
2059
+ const {
2060
+ nestEl: q,
2061
+ dragEl: W,
2062
+ defSize: X,
2063
+ lastSize: G,
2064
+ canResize: K
2065
+ } = this.nestMap_.get(D);
2066
+ if (!K)
2067
+ return;
2068
+ const Q = w || G || X;
2069
+ q.classList.remove("closed"), W.classList.remove("closed", "locked", "collapsed"), setTimeout(() => {
2070
+ this.resize(D, Q, U, F);
2071
+ }, 50);
2072
+ }
2073
+ /**
2074
+ * Open a closed and locked nest. Keep the nest locked.
2075
+ * @param {string} nestName Nest name
2076
+ * @param {number?} size The required size of the resulting move.
2077
+ * @param {Function?} callback A callback function to call once
2078
+ * the resize completed.
2079
+ * @param {boolean?} opt_skipAni When true, the resize won't be animated, but
2080
+ * simply affected directly.
2081
+ */
2082
+ openAndLock(D, w, U, F = !1) {
2083
+ const {
2084
+ nestEl: q,
2085
+ dragEl: W,
2086
+ defSize: X,
2087
+ lastSize: G,
2088
+ canResize: K
2089
+ } = this.nestMap_.get(D);
2090
+ if (!K)
2091
+ return;
2092
+ const Q = w || G || X;
2093
+ q.classList.remove("closed"), W.classList.remove("closed", "collapsed"), setTimeout(() => {
2094
+ this.resize(D, Q, U, F);
2095
+ }, 50);
2096
+ }
2097
+ /**
2098
+ * Close nest. Move it out the way, but continue to make it draggable;
2099
+ * to the nest and dragger.
2100
+ * @param {string} nestName Nest name
2101
+ * @param {Function|undefined} callback A callback function to call once
2102
+ * the resize completed.
2103
+ * @param {boolean?} opt_skipAni When true, the resize won't be animated, but
2104
+ * simply affected directly.
2105
+ */
2106
+ close(D, w = identity, U = !1) {
2107
+ const { dragEl: F, canResize: q, nestEl: W } = this.nestMap_.get(D);
2108
+ if (!q)
2109
+ return;
2110
+ this.dispatchSplitEvent(UiEventType.SPLIT_WILL_CLOSE, { nestName: D, nestEl: W });
2111
+ const X = () => {
2112
+ F.classList.add("collapsed"), this.dispatchSplitEvent(UiEventType.SPLIT_DID_CLOSE, { nestName: D, nestEl: W }), w();
2113
+ };
2114
+ this.resize(D, 0, X, U);
2115
+ }
2116
+ /**
2117
+ * Open the nest ignoring its current locked state.
2118
+ * @param {string} nestName Nest name
2119
+ * @param {Function|undefined} callback A callback function to call once
2120
+ * the resize completed.
2121
+ * @param {boolean?} opt_skipAni When true, the resize won't be animated, but
2122
+ * simply affected directly.
2123
+ */
2124
+ open(D, w = identity, U = !1) {
2125
+ const { defSize: F, lastSize: q, dragEl: W, canResize: X, nestEl: G } = this.nestMap_.get(D);
2126
+ if (!X)
2127
+ return;
2128
+ this.dispatchSplitEvent(UiEventType.SPLIT_WILL_OPEN, { nestName: D, nestEl: G }), W.classList.remove("collapsed", "closed");
2129
+ const K = q || F, Q = () => {
2130
+ this.dispatchSplitEvent(UiEventType.SPLIT_DID_OPEN, { nestName: D, nestEl: G }), w();
2131
+ };
2132
+ this.resize(D, K, Q, U);
2133
+ }
2134
+ /**
2135
+ * Close the nest ignoring its current locked state.
2136
+ * @param {string} nestName Nest name
2137
+ * @param {Function|undefined} callback A callback function to call once
2138
+ * the resize completed.
2139
+ * @param {boolean?} opt_skipAni When true, the resize won't be animated, but
2140
+ * simply affected directly.
2141
+ */
2142
+ toggle(D, w, U = !1) {
2143
+ this.nestMap_.get(D).sizeNow === 0 ? this.open(D, w, U) : this.close(D, w, U);
2144
+ }
2145
+ //----------------------------------------------------------------------------
2146
+ /**
2147
+ * Split an element into parts, each separated by a dragger component.
2148
+ * The split creates 3 new elements inside root element. Thus it is not
2149
+ * truly splitting the reference element, but rather overlaying the
2150
+ * split functionality over the reference element.
2151
+ * A split can be either horizontal - called "EW" (east-west) or
2152
+ * vertical - called "NS" (north-south).
2153
+ * By convention the new elements created are called 'nests', and are named
2154
+ * in order "A", "B" and "C" respectively.
2155
+ * For EW splits the we name from left to right:
2156
+ * A B C
2157
+ * For NS splits we name from top to bottom:
2158
+ * A
2159
+ * B
2160
+ * C
2161
+ * Each newly created nest is a valid root for further splitting.
2162
+ * When a nest is split, the resultant nests names are prepended with the
2163
+ * name of the root nest that was split.
2164
+ * Example: If nest C is split, the resultant nests are named CA, CB, and CC.
2165
+ * When one of these (for example CA) is split further, the pattern continues
2166
+ * with the resulting nests being CAA, CAB, CAC etc.
2167
+ * @param {Element=} opt_el The element to split. If not given, the
2168
+ * components own element is used. Else, the element is checked to be
2169
+ * a member of this split-group, and if so, is split.
2170
+ * @param {?string} orientation Only 'EW' or 'NS'. Defaults to 'EW'
2171
+ * @param {?number} defSizeA Default size of the 'A' nest.
2172
+ * @param {?number} defSizeC Default size of the 'C' nest. The 'B' nest gets the
2173
+ * remainder of the 'A' and 'C' nests, and can not be set directly.
2174
+ * @param {?Array<string>} classArrA Extra class names to be added to this nest
2175
+ * @param {?Array<string>} classArrB Extra class names to be added to this nest
2176
+ * @param {?Array<string>} classArrC Extra class names to be added to this nest
2177
+ * @param {?Array<string>} classArrDragger Extra classes for the dragger element
2178
+ * @param {?Array<string>} classArrGrabber Extra classes for the grabber element
2179
+ */
2180
+ addSplit(D = void 0, w = "EW", U = 100, F = 100, q = [], W = [], X = [], G = [], K = []) {
2181
+ const Q = D || this.getElement();
2182
+ if (this.splitNests_.has(Q))
2183
+ return ["Already used!", Q];
2184
+ convertElToSplit(Q, w), this.splitNests_.add(Q);
2185
+ let tt = "";
2186
+ if (D) {
2187
+ const it = [...this.nestMap_.entries()].find(([at, { nestEl: ct }]) => ct === D);
2188
+ if (it)
2189
+ tt = it[0];
2190
+ else
2191
+ return ["Element not managed by this component", D];
2192
+ }
2193
+ const J = `${tt}A`, Y = makeOuterNest(U, ["zoo_nest__A", J, ...q]), Z = new Dragger(w);
2194
+ Z.domFunc = makeDraggerEl([`zoo_drag_${J}`, ...G], K), Z.render(Q), this.nestMap_.set(J, {
2195
+ side: "A",
2196
+ nestEl: Y,
2197
+ dragger: Z,
2198
+ dragEl: Z.getElement(),
2199
+ defSize: U,
2200
+ sizeNow: -1,
2201
+ canResize: !0
2202
+ });
2203
+ const et = `${tt}B`, st = makeInnerNest(["zoo_nest__B", et, ...W]);
2204
+ this.nestMap_.set(et, { nestEl: st, canResize: !1 });
2205
+ const rt = `${tt}C`, nt = new Dragger(w);
2206
+ nt.domFunc = makeDraggerEl([`zoo_drag_${rt}`, ...G], K), nt.render(Q);
2207
+ const ot = makeOuterNest(F, ["zoo_nest__C", rt, ...X]);
2208
+ this.nestMap_.set(rt, {
2209
+ side: "C",
2210
+ nestEl: ot,
2211
+ dragger: nt,
2212
+ dragEl: nt.getElement(),
2213
+ defSize: F,
2214
+ sizeNow: -1,
2215
+ canResize: !0
2216
+ }), [Y, Z.getElement(), st, nt.getElement(), ot].forEach((it) => Q.appendChild(it));
2217
+ let lt = 0;
2218
+ const ht = (it, at, ct, gt) => {
2219
+ let dt;
2220
+ const ut = it === "NS" ? "height" : "width", ft = it === "NS" ? "deltaY" : "deltaX";
2221
+ return (pt) => {
2222
+ switch (pt.detail.value_) {
2223
+ case UiEventType.COMP_DRAG_START:
2224
+ dt = at.getBoundingClientRect()[ut], lt = st.getBoundingClientRect()[ut] + dt, this.nestMap_.get(ct).dragEl.classList.remove("collapsed");
2225
+ break;
2226
+ case UiEventType.COMP_DRAG_MOVE: {
2227
+ const mt = Math.min(lt, dt + gt * pt.detail.data_[ft]);
2228
+ this.nestMap_.get(ct).lastSize = mt, at.style.flexBasis = mt + "px";
2229
+ break;
2230
+ }
2231
+ case UiEventType.COMP_DRAG_END:
2232
+ this.dispatchSplitEvent(UiEventType.COMP_DRAG_END, this.nestMap_.get(ct));
2233
+ break;
2234
+ }
2235
+ };
2236
+ };
2237
+ this.listen(Z, Component.compEventCode(), ht(w, Y, J, 1)), this.listen(nt, Component.compEventCode(), ht(w, ot, rt, -1)), this.listen(Z.getElement(), EV.DBLCLICK, () => this.toggle(J)), this.listen(nt.getElement(), EV.DBLCLICK, () => this.toggle(rt)), this.listen(Z.getElement().querySelector(".zoo_grabber"), EV.CLICK, () => this.toggle(J)), this.listen(nt.getElement().querySelector(".zoo_grabber"), EV.CLICK, () => this.toggle(rt)), this.listen(Y, EV.TRANSITIONEND, (it) => {
2238
+ if (it.propertyName === "flex-basis" && it.target === Y) {
2239
+ const at = this.nestCallbackMap_.get(J);
2240
+ this.nestCallbackMap_.delete(J), at && at(), this.dispatchSplitEvent(UiEventType.SPLIT_TRANSITION_END, this.nestMap_.get(J));
2241
+ }
2242
+ }), this.listen(ot, EV.TRANSITIONEND, (it) => {
2243
+ if (it.propertyName === "flex-basis" && it.target === ot) {
2244
+ const at = this.nestCallbackMap_.get(rt);
2245
+ this.nestCallbackMap_.delete(rt), at && at(), this.dispatchSplitEvent(UiEventType.SPLIT_TRANSITION_END, this.nestMap_.get(rt));
2246
+ }
2247
+ });
2248
+ }
2249
+ //--[ Built in events ]--
2250
+ /**
2251
+ * Dispatches a {@code UiEventType.SPLIT} event.
2252
+ * Views may listen just to this event, and act on the supplied value or
2253
+ * data payload.
2254
+ * @param {string|number} value
2255
+ * @param {(string|number|?Object)=} opt_data
2256
+ * @return {boolean} If anyone called preventDefault on the event object (or
2257
+ * if any of the handlers returns false this will also return false.
2258
+ */
2259
+ dispatchSplitEvent(D, w) {
2260
+ const U = new ZooyEventData(D, w), F = EVT.makeEvent(UiEventType.SPLIT, U);
2261
+ return this.dispatchEvent(F);
2262
+ }
2263
+ }
2264
+ const convertElToSplit = (O, D) => (O.classList.add("zoo_split", `zoo_split__${D.toLowerCase()}`), O), makeOuterNest = (O, D = []) => {
2265
+ const w = document.createElement("div");
2266
+ return w.setAttribute("id", randomId(7)), w.classList.add("zoo_nest", "zoo_nest__outer", ...D), w.style.flexBasis = O + "px", w;
2267
+ }, makeInnerNest = (O = []) => {
2268
+ const D = document.createElement("div");
2269
+ return D.setAttribute("id", randomId(7)), D.classList.add("zoo_nest", "zoo_nest__inner", ...O), D;
2270
+ }, makeDraggerEl = (O = [], D = []) => () => {
2271
+ const w = document.createElement("div");
2272
+ w.setAttribute("id", randomId(7)), w.classList.add("zoo_dragger", ...O);
2273
+ const U = document.createElement("div");
2274
+ return U.classList.add("zoo_grabber", ...D), w.appendChild(U), w;
2275
+ }, needsToScroll = (O) => {
2276
+ const w = O.getBoundingClientRect().bottom;
2277
+ return (U) => U.getBoundingClientRect().bottom > w;
2278
+ }, treeNodeSelect = (O) => (D) => {
2279
+ const w = O.getElement().querySelector(".zv_tree_container"), U = needsToScroll(w), F = O.getElement().querySelectorAll(".tree-node");
2280
+ let q;
2281
+ [...F].forEach((W) => {
2282
+ enableClass(W, "mdc-deprecated-list-item--activated", W.id === `tree-node_${D}`), W.id === `tree-node_${D}` && (q = W);
2283
+ }), q && U(q) && q.scrollIntoView(!1);
2284
+ }, toggleTree = (O, D) => {
2285
+ const w = D.getElement().querySelector(".children"), U = (
2286
+ /**@type {boolean} */
2287
+ O.isOn
2288
+ ), F = D.getElement().querySelectorAll(".children"), q = D.getElement().querySelectorAll(".zoo__reveal_icon");
2289
+ [...F].forEach((W) => enableClass(
2290
+ W,
2291
+ "zoo__tree-children__hidden",
2292
+ W !== w && !U
2293
+ )), [...q].forEach((W) => enableClass(
2294
+ W,
2295
+ "zoo__icon_rotated",
2296
+ W !== w && !U
2297
+ ));
2298
+ }, toggleTreeChildren = (O, D) => {
2299
+ const w = D.trigger, U = w.getAttribute("data-child-id"), F = O.getElement().querySelector(`#${U}`);
2300
+ toggleClass(F, "zoo__tree-children__hidden"), toggleClass(w, "zoo__icon_rotated");
2301
+ }, _openTreeFromNodeUp = (O, D) => {
2302
+ const w = D.parentElement;
2303
+ w.classList.contains("children") && (enableClass(w, "zoo__tree-children__hidden", !1), _openTreeFromNodeUp(O, w));
2304
+ }, treeUtils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2305
+ __proto__: null,
2306
+ _openTreeFromNodeUp,
2307
+ toggleTree,
2308
+ toggleTreeChildren,
2309
+ treeNodeSelect
2310
+ }, Symbol.toStringTag, { value: "Module" })), MdcTreeHandlers = {
2311
+ /**
2312
+ * Toggle the entire tree open or closed.
2313
+ * First level children remain open for better UX.
2314
+ *
2315
+ * @param {Object} eventData - Event data with isOn boolean
2316
+ * @param {Panel} ePanel - The panel containing the tree
2317
+ */
2318
+ toggle_tree: function(O, D) {
2319
+ toggleTree(O, D);
2320
+ },
2321
+ /**
2322
+ * Toggle children visibility for a specific tree node.
2323
+ *
2324
+ * @param {Object} eventData - Event data with trigger element
2325
+ * @param {Panel} ePanel - The panel containing the tree
2326
+ */
2327
+ "tree_toggle-children": function(O, D) {
2328
+ toggleTreeChildren(D, O);
2329
+ }
2330
+ }, SearchHandlers = {
2331
+ /**
2332
+ * Perform search with query string construction.
2333
+ * Builds href with search query and additional query parameters.
2334
+ *
2335
+ * @param {Object} eventData - Event data with href, formData.q, and targetval
2336
+ * @param {Panel} ePanel - The panel to update
2337
+ */
2338
+ search: function(O, D) {
2339
+ let w = `${O.href}`;
2340
+ const U = O.formData.q, F = O.targetval;
2341
+ if (U !== "" && (w = `${w}?q=${U}`), F !== "") {
2342
+ let q = F;
2343
+ F.includes("page=") && (q = F.split("&").filter((W) => !W.includes("page=")).join("&")), w = U !== "" ? `${w}&${q}` : `${w}?${q}`;
2344
+ }
2345
+ this.user.fetchAndSplit(w, D.abortController.signal).then(
2346
+ (q) => D.onReplacePartialDom(q, O.zvptarget)
2347
+ );
2348
+ },
2349
+ /**
2350
+ * Reset search form and query parameters.
2351
+ * Clears the 'q' field in the closest form and removes 'q' from query params.
2352
+ *
2353
+ * @param {Object} eventData - Event data with trigger element
2354
+ * @param {Panel} ePanel - The panel to update
2355
+ */
2356
+ reset_search: function(O, D) {
2357
+ const w = O.trigger.closest("form");
2358
+ D.removeFromQParams("q"), w.elements.q.value = "", w.dispatchEvent(new Event("submit"));
2359
+ }
2360
+ }, QueryParamHandlers = {
2361
+ /**
2362
+ * Handle pagination by fetching content with query parameters.
2363
+ *
2364
+ * @param {Object} eventData - Event data with href and targetval for pagination
2365
+ * @param {Panel} ePanel - The panel to update
2366
+ */
2367
+ paginate: function(O, D) {
2368
+ const w = `${O.href}?${O.targetval}`;
2369
+ this.user.fetchAndSplit(w, D.abortController.signal).then(
2370
+ (U) => D.onReplacePartialDom(U, O.zvptarget)
2371
+ );
2372
+ },
2373
+ /**
2374
+ * Handle list filtering with query parameters.
2375
+ *
2376
+ * @param {Object} eventData - Event data with href and targetval for filtering
2377
+ * @param {Panel} ePanel - The panel to update
2378
+ */
2379
+ list_filter: function(O, D) {
2380
+ const w = `${O.href}?${O.targetval}`;
2381
+ this.user.fetchAndSplit(w, D.abortController.signal).then(
2382
+ (U) => D.onReplacePartialDom(U, O.zvptarget)
2383
+ );
2384
+ }
2385
+ }, handlers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2386
+ __proto__: null,
2387
+ MdcTreeHandlers,
2388
+ QueryParamHandlers,
2389
+ SearchHandlers
2390
+ }, Symbol.toStringTag, { value: "Module" }));
2391
+ class View extends EVT {
2392
+ #t = void 0;
2393
+ #e = void 0;
2394
+ //--[ Static ]--
2395
+ /**
2396
+ * Returns the view event type code used for dispatching view events.
2397
+ * @return {string} The VIEW event type
2398
+ */
2399
+ static viewEventCode() {
2400
+ return UiEventType.VIEW;
2401
+ }
2402
+ /**
2403
+ * Creates a new View instance. Initializes panel management, event handling,
2404
+ * and metadata storage.
2405
+ */
2406
+ constructor() {
2407
+ super(), this.panelMap = /* @__PURE__ */ new Map(), this.user_ = void 0, this.split_ = void 0, this.panelEventMap_ = this.initPanelEventsInternal_(), this.switchViewMap_ = /* @__PURE__ */ new Map(), this.metaData_ = /* @__PURE__ */ new Map();
2408
+ }
2409
+ set recordHistory(D) {
2410
+ this.#e = D;
2411
+ }
2412
+ get recordHistory() {
2413
+ return this.#e;
2414
+ }
2415
+ set registerViewConstructor(D) {
2416
+ this.#t = D;
2417
+ }
2418
+ get registerViewConstructor() {
2419
+ return this.#t;
2420
+ }
2421
+ set split(D) {
2422
+ this.split_ = D, this.listen(this.split_, UiEventType.SPLIT, (w) => {
2423
+ const U = w.detail.getValue(), F = w.detail.getData();
2424
+ switch (U) {
2425
+ case UiEventType.SPLIT_WILL_OPEN:
2426
+ this.onSplitWillOpen(F);
2427
+ break;
2428
+ case UiEventType.SPLIT_WILL_CLOSE:
2429
+ this.onSplitWillClose(F);
2430
+ break;
2431
+ case UiEventType.SPLIT_DID_CLOSE:
2432
+ this.onSplitDidClose(F);
2433
+ break;
2434
+ case UiEventType.SPLIT_DID_OPEN:
2435
+ this.onSplitDidOpen(F);
2436
+ break;
2437
+ case UiEventType.SPLIT_TRANSITION_END:
2438
+ break;
2439
+ }
2440
+ });
2441
+ }
2442
+ get split() {
2443
+ if (!this.split_)
2444
+ throw new Error("No SPLIT component available");
2445
+ return this.split_;
2446
+ }
2447
+ /**
2448
+ * @param {!UserManager} user
2449
+ */
2450
+ set user(D) {
2451
+ this.user_ = D, this.panelMap.forEach((w) => w.user = D);
2452
+ }
2453
+ /**
2454
+ * @return {!UserManager}
2455
+ */
2456
+ get user() {
2457
+ return this.user_ || (this.user_ = new UserManager()), this.user_;
2458
+ }
2459
+ /**
2460
+ * Render each of the panels in this view.
2461
+ */
2462
+ render() {
2463
+ this.initPanelEvents(), this.preRender(), this.configurePanels(), this.displayPanels(), this.postRender();
2464
+ }
2465
+ /**
2466
+ * Placeholder for subclasses to add panel event functions.
2467
+ */
2468
+ initPanelEvents() {
2469
+ }
2470
+ /**
2471
+ * Run before the render.
2472
+ */
2473
+ preRender() {
2474
+ }
2475
+ /**
2476
+ * Placeholder for panel configuration functionality;
2477
+ */
2478
+ configurePanels() {
2479
+ }
2480
+ /**
2481
+ * Placeholder for panel display functionality;
2482
+ */
2483
+ displayPanels() {
2484
+ }
2485
+ /**
2486
+ * Placeholder for post render functionality.
2487
+ */
2488
+ postRender() {
2489
+ }
2490
+ /**
2491
+ * @inheritDoc
2492
+ */
2493
+ dispose() {
2494
+ [...this.panelMap.values()].forEach((D) => D.dispose()), super.dispose();
2495
+ }
2496
+ /**
2497
+ * Add a panel as a child of the view.
2498
+ * @param {string} name The name of the panel - used as a key in the panel map.
2499
+ * @param {!Panel} panel The panel itself.
2500
+ */
2501
+ addPanelToView(D, w) {
2502
+ w.user = this.user, this.removePanelByName(D), this.panelMap.set(D, w), this.listen(w, Panel.panelEventCode(), this.onPanelEvent.bind(this));
2503
+ }
2504
+ /**
2505
+ * Remove a panel from the view by name.
2506
+ * @param {string} name The name of the panel - used as a key in the panel map.
2507
+ */
2508
+ removePanelByName(D) {
2509
+ this.panelMap.has(D) && this.panelMap.get(D).dispose();
2510
+ }
2511
+ /**
2512
+ * @param {Panel} panel
2513
+ */
2514
+ removePanel(D) {
2515
+ const [w, U] = [...this.panelMap.entries()].find(([F, q]) => q === D);
2516
+ w && U && (U.dispose(), this.panelMap.delete(w));
2517
+ }
2518
+ /**
2519
+ * @param {string} name
2520
+ * @return {Panel|undefined}
2521
+ */
2522
+ getPanelByName(D) {
2523
+ return this.panelMap.get(D);
2524
+ }
2525
+ /**
2526
+ * Broadcasts data to all panels in this view. Each panel receives the data
2527
+ * via its onViewDataBroadcast method.
2528
+ * @param {*} data The data to broadcast to all panels
2529
+ */
2530
+ broadcastToPanels(D) {
2531
+ [...this.panelMap.values()].forEach((w) => w.onViewDataBroadcast(D));
2532
+ }
2533
+ /**
2534
+ * Initializes the internal panel event map with default event handlers.
2535
+ * Sets up handlers for panel lifecycle and view coordination.
2536
+ *
2537
+ * Note: This method also registers application-specific handlers (search,
2538
+ * pagination, etc.) for backwards compatibility. These will be removed in
2539
+ * a future version - applications should explicitly register handlers they need.
2540
+ *
2541
+ * @return {!Map<string, !Function>} Map of event names to handler functions
2542
+ * @private
2543
+ */
2544
+ initPanelEventsInternal_() {
2545
+ const D = /* @__PURE__ */ new Map();
2546
+ return D.set("destroy_me", (w, U) => {
2547
+ this.removePanel(U);
2548
+ }), D.set("switch_view", (w, U) => {
2549
+ this.debugMe("switch_view received: eventData", w);
2550
+ const F = w.view;
2551
+ this.switchViewMap_.has(F) ? this.switchViewMap_.get(F)(w, U) : this.debugMe("NO VIEW FOUND FOR:", F, this.switchViewMap_);
2552
+ }), Object.entries({
2553
+ ...SearchHandlers,
2554
+ ...QueryParamHandlers
2555
+ }).forEach(([w, U]) => {
2556
+ D.set(w, U.bind(this));
2557
+ }), D;
2558
+ }
2559
+ /**
2560
+ * Maps a panel event name to a handler function. Allows dynamic registration
2561
+ * of custom panel event handlers at runtime.
2562
+ * @param {string} s The event name to map
2563
+ * @param {!Function} func The handler function that receives (eventData, ePanel)
2564
+ */
2565
+ mapPanEv(D, w) {
2566
+ this.panelEventMap_.set(D, w);
2567
+ }
2568
+ /**
2569
+ * A map of string to function where the function receives an object and
2570
+ * a panel.
2571
+ * @param {string} s
2572
+ * @param {function(
2573
+ * {view:string, pk:string, emit:string, href:string}, Panel):?} func
2574
+ */
2575
+ mapSwitchView(D, w) {
2576
+ this.switchViewMap_.set(D, w);
2577
+ }
2578
+ /**
2579
+ * @param {!CustomEvent} e
2580
+ */
2581
+ onPanelEvent(D) {
2582
+ const w = D.detail.getValue(), U = D.detail.getData(), F = (
2583
+ /** @type {Panel} */
2584
+ D.target
2585
+ );
2586
+ this.panelEventMap_.has(w) ? this.panelEventMap_.get(w)(U, F) : this.debugMe(`NO EVENT MATCH
2587
+ oPe: ${D}
2588
+ eventValue: ${w}
2589
+ eventData: ${JSON.stringify(U, void 0, 2)}
2590
+ ePanel: ${F.constructor.name}`);
2591
+ }
2592
+ //--[ Split Events ]--
2593
+ /**
2594
+ * Triggered before a split will open.
2595
+ *
2596
+ * @param {{nestName: !string, nestEl:!HTMLElement}} _data
2597
+ */
2598
+ onSplitWillOpen(D) {
2599
+ }
2600
+ /**
2601
+ * Triggered before a split will close.
2602
+ *
2603
+ * @param {{nestName: !string, nestEl:!HTMLElement}} _data
2604
+ */
2605
+ onSplitWillClose(D) {
2606
+ }
2607
+ /**
2608
+ * Triggered after a split closed.
2609
+ *
2610
+ * @param {{nestName: !string, nestEl:!HTMLElement}} _data
2611
+ */
2612
+ onSplitDidClose(D) {
2613
+ }
2614
+ /**
2615
+ * Triggered after a split opened.
2616
+ *
2617
+ * @param {{nestName: !string, nestEl:!HTMLElement}} _data
2618
+ */
2619
+ onSplitDidOpen(D) {
2620
+ }
2621
+ //--[ Built in events ]--
2622
+ /**
2623
+ * Dispatches a {@code UiEventType.VIEW} event.
2624
+ * A shorthand method to get panels to dispatch uniform events.
2625
+ * Views may listen just to this event, and act on the supplied value or
2626
+ * data payload.
2627
+ * Example:
2628
+ * b.listen(a, Component.compEventCode(), e => {
2629
+ * console.log('B got', Component.compEventCode(), e);
2630
+ * console.log('Value is', e.detail.getValue());
2631
+ * console.log('Data is', e.detail.getData());
2632
+ * });
2633
+ * @param {string|number} value
2634
+ * @param {(string|number|?Object)=} opt_data
2635
+ * @return {boolean} If anyone called preventDefault on the event object (or
2636
+ * if any of the handlers returns false this will also return false.
2637
+ */
2638
+ dispatchViewEvent(D, w) {
2639
+ const U = new ZooyEventData(D, w), F = EVT.makeEvent(UiEventType.VIEW, U);
2640
+ return this.dispatchEvent(F);
2641
+ }
2642
+ //--[ Meta Data ]--
2643
+ /**
2644
+ * Returns the metadata map associated with this view.
2645
+ * @return {!Map<string, *>} The metadata map
2646
+ */
2647
+ get metaData() {
2648
+ return this.metaData_;
2649
+ }
2650
+ /**
2651
+ * Sets a metadata key-value pair for this view.
2652
+ * @param {string} k The metadata key
2653
+ * @param {*} v The metadata value
2654
+ * @return {!Map<string, *>} The updated metadata map
2655
+ */
2656
+ setMetaData(D, w) {
2657
+ return this.metaData_.set(D, w), this.metaData;
2658
+ }
2659
+ /**
2660
+ * Retrieves a metadata value by key.
2661
+ * @param {string} k The metadata key
2662
+ * @return {*} The metadata value, or undefined if not found
2663
+ */
2664
+ getMetaData(D) {
2665
+ return this.metaData_.get(D);
2666
+ }
2667
+ /**
2668
+ * Checks if a metadata key exists.
2669
+ * @param {string} k The metadata key
2670
+ * @return {boolean} True if the key exists, false otherwise
2671
+ */
2672
+ hasMetaData(D) {
2673
+ return this.metaData_.has(D);
2674
+ }
2675
+ }
2676
+ class Conductor extends EVT {
2677
+ #t = /* @__PURE__ */ new Map();
2678
+ #e = null;
2679
+ /**
2680
+ * @type {!UserManager|undefined}
2681
+ * @private
2682
+ */
2683
+ #s = void 0;
2684
+ #r = void 0;
2685
+ #n = /* @__PURE__ */ new Map();
2686
+ /**
2687
+ * Creates a new Conductor instance. Sets up browser history listening
2688
+ * and initializes view event handling.
2689
+ */
2690
+ constructor() {
2691
+ super(), this.#n = this.#i(), window.addEventListener("popstate", (D) => {
2692
+ D.state !== null && this.navTo(D.state);
2693
+ });
2694
+ }
2695
+ set split(D) {
2696
+ this.#r = D;
2697
+ }
2698
+ get split() {
2699
+ if (!this.#r)
2700
+ throw new Error("No SPLIT component available");
2701
+ return this.#r;
2702
+ }
2703
+ /**
2704
+ * @param {!UserManager} user
2705
+ */
2706
+ set user(D) {
2707
+ this.#s = D, this.#e && (this.#e.user = this.user);
2708
+ }
2709
+ /**
2710
+ * @return {!UserManager}
2711
+ */
2712
+ get user() {
2713
+ return this.#s || (this.#s = new UserManager()), this.#s;
2714
+ }
2715
+ /**
2716
+ * Initializes the internal view event map with default event handlers.
2717
+ * Sets up handlers for common view events like 'switch_view'.
2718
+ * @return {!Map<string, !Function>} Map of event names to handler functions
2719
+ * @private
2720
+ */
2721
+ #i() {
2722
+ return (/* @__PURE__ */ new Map()).set("switch_view", (D, w) => {
2723
+ if (this.#t.has(D.view)) {
2724
+ const U = this.#t.get(D.view)(
2725
+ D.pk || D.recordId,
2726
+ D
2727
+ );
2728
+ this.switchView(U);
2729
+ }
2730
+ });
2731
+ }
2732
+ /**
2733
+ * Maps a view event name to a handler function. Allows dynamic registration
2734
+ * of custom view event handlers at runtime.
2735
+ * @param {string} s The event name to map
2736
+ * @param {!Function} func The handler function that receives (eventData, eView)
2737
+ */
2738
+ mapViewEv(D, w) {
2739
+ this.#n.set(D, w);
2740
+ }
2741
+ /**
2742
+ * Registers a view constructor function that can be used to create instances
2743
+ * of a specific view type.
2744
+ * @param {string} s The view type identifier
2745
+ * @param {!Function} f Constructor function that receives (pk, data) and returns a View
2746
+ */
2747
+ registerViewConstructor(D, w) {
2748
+ this.#t.set(D, w);
2749
+ }
2750
+ /**
2751
+ * @param {!CustomEvent} e Event object.
2752
+ */
2753
+ onViewEvent(D) {
2754
+ const w = D.detail.getValue(), U = D.detail.getData(), F = (
2755
+ /** @type {Panel} */
2756
+ D.target
2757
+ );
2758
+ this.#n.has(w) ? this.#n.get(w)(U, F) : console.warn("Unhandled VIEW Event:", D, w, U, F);
2759
+ }
2760
+ /**
2761
+ * Make the given view active.
2762
+ * @param {!View} view
2763
+ */
2764
+ setActiveView(D) {
2765
+ this.#e && (this.stopListeningTo(this.#e), this.#e.dispose(), this.#e = null), this.#e = D, this.#e.render();
2766
+ }
2767
+ /**
2768
+ * @param {!View} view
2769
+ * @returns {!View}
2770
+ */
2771
+ initView(D) {
2772
+ return D.user = this.user, D.split = this.split, D.recordHistory = this.recordHistory.bind(this), D.registerViewConstructor = this.registerViewConstructor.bind(this), this.listen(D, View.viewEventCode(), this.onViewEvent.bind(this)), D;
2773
+ }
2774
+ //--[ Views Utilities ]--
2775
+ /**
2776
+ * @param {!View} view The view we want active.
2777
+ */
2778
+ switchView(D) {
2779
+ this.setActiveView(this.initView(D));
2780
+ }
2781
+ //--[ History and Navigation ]--
2782
+ /**
2783
+ * Records the given item in browser history. If item.init is true, replaces
2784
+ * the current history state. Otherwise, pushes a new history state unless
2785
+ * item.history is true.
2786
+ * @param {!Object} item The history item containing view state
2787
+ */
2788
+ recordHistory(D) {
2789
+ this.debugMe("HISTORY", D), D.init ? history.replaceState(D, "", document.location.href) : D.history || history.pushState(D, "", null);
2790
+ }
2791
+ /**
2792
+ * Navigates to a specific view based on the history item. Attempts to use
2793
+ * the active view's switchViewMap first, falling back to registered view
2794
+ * constructors if needed.
2795
+ * @param {!Object} item History item containing {view, pk, ...} properties
2796
+ */
2797
+ navTo = (D) => {
2798
+ D.history = !0;
2799
+ const w = D.view, U = this.#e;
2800
+ if (U.switchViewMap_.has(w))
2801
+ this.debugMe("NAV:VIEW:MAP", D), U.switchViewMap_.get(w)(D);
2802
+ else if (this.#t.has(w)) {
2803
+ const F = this.#t.get(w)(D.pk, D);
2804
+ this.debugMe("NAV:NEW:VIEW", D), this.switchView(F);
2805
+ }
2806
+ };
2807
+ }
2808
+ const DEFAULT_FORMATTERS = {
2809
+ /**
2810
+ * Format as JSON (useful for debugging)
2811
+ */
2812
+ json: (O) => JSON.stringify(O, null, 2)
2813
+ };
2814
+ class DataBinder {
2815
+ #t;
2816
+ #e;
2817
+ #s;
2818
+ #r = [];
2819
+ #n;
2820
+ #i;
2821
+ #o;
2822
+ /**
2823
+ * Creates a new DataBinder instance.
2824
+ *
2825
+ * @param {Object} options - Configuration options
2826
+ * @param {string} [options.url] - API endpoint URL (optional if using setData)
2827
+ * @param {string|HTMLTemplateElement} options.template - Template ID or element
2828
+ * @param {Element} options.container - Container element for rendered items
2829
+ * @param {string} [options.dataPath] - JSON path to data array (auto-detected if omitted)
2830
+ * @param {Function} [options.fetchFn] - Custom fetch function (for authentication, etc.)
2831
+ * @param {Object<string, Function>} [options.formatters] - Custom formatters
2832
+ * @throws {Error} If template or container is missing/invalid
2833
+ */
2834
+ constructor(D = {}) {
2835
+ if (!D.template)
2836
+ throw new Error("DataBinder requires options.template");
2837
+ if (!D.container)
2838
+ throw new Error("DataBinder requires options.container");
2839
+ if (this.#t = D.url, this.#i = D.dataPath, this.#s = D.container, this.#o = D.fetchFn || fetch.bind(window), this.#e = typeof D.template == "string" ? document.getElementById(D.template) : D.template, !this.#e || this.#e.tagName !== "TEMPLATE")
2840
+ throw new Error("DataBinder template must be a <template> element or valid template ID");
2841
+ this.#n = { ...DEFAULT_FORMATTERS, ...D.formatters };
2842
+ }
2843
+ /**
2844
+ * Loads data from the configured URL with optional query parameters.
2845
+ * Dispatches 'data-loading', 'data-loaded', and 'data-error' events.
2846
+ *
2847
+ * @param {Object} [params={}] - Query parameters to append to URL
2848
+ * @return {Promise<Array>} The loaded data array
2849
+ * @throws {Error} If fetch fails or URL is not configured
2850
+ */
2851
+ async load(D = {}) {
2852
+ if (!this.#t)
2853
+ throw new Error("DataBinder.load() requires a configured URL");
2854
+ this.#c("data-loading");
2855
+ try {
2856
+ const w = new URL(this.#t, window.location.origin);
2857
+ Object.entries(D).forEach(([q, W]) => {
2858
+ isDefAndNotNull(W) && w.searchParams.set(q, W);
2859
+ });
2860
+ const U = await this.#o(w.toString()), F = U instanceof Response ? U.ok ? await U.json() : Promise.reject(new Error(`HTTP ${U.status}: ${U.statusText}`)) : U;
2861
+ if (this.#r = this.#u(F), !Array.isArray(this.#r))
2862
+ throw new Error("Extracted data is not an array");
2863
+ return this.render(), this.#c("data-loaded", { data: this.#r }), this.#r;
2864
+ } catch (w) {
2865
+ throw this.#c("data-error", { error: w }), w;
2866
+ }
2867
+ }
2868
+ /**
2869
+ * Sets data directly without fetching from URL.
2870
+ * Useful for static data or when data is already available.
2871
+ *
2872
+ * @param {Array} data - Array of data objects
2873
+ */
2874
+ setData(D) {
2875
+ this.#r = Array.isArray(D) ? D : [], this.render();
2876
+ }
2877
+ /**
2878
+ * Gets the current data array.
2879
+ *
2880
+ * @return {Array} The current data
2881
+ */
2882
+ getData() {
2883
+ return this.#r;
2884
+ }
2885
+ /**
2886
+ * Re-renders all items from the current data.
2887
+ * Clears the container and renders each item using the template.
2888
+ */
2889
+ render() {
2890
+ this.#s.innerHTML = "", this.#r.forEach((D, w) => {
2891
+ const U = this.#a(D, w);
2892
+ this.#s.appendChild(U);
2893
+ });
2894
+ }
2895
+ /**
2896
+ * Disposes of this DataBinder instance.
2897
+ * Clears data and container.
2898
+ */
2899
+ dispose() {
2900
+ this.#r = [], this.#s.innerHTML = "", this.#e = null, this.#s = null;
2901
+ }
2902
+ /**
2903
+ * Renders a single item from the template.
2904
+ *
2905
+ * @param {Object} item - Data object
2906
+ * @param {number} index - Item index in array
2907
+ * @return {DocumentFragment} Rendered template clone
2908
+ * @private
2909
+ */
2910
+ #a(D, w) {
2911
+ const U = this.#e.content.cloneNode(!0);
2912
+ return this.#d(U, D, w), U.querySelectorAll("[data-bind]").forEach((F) => {
2913
+ this.#h(F, D, w);
2914
+ }), U.querySelectorAll("[data-show-if]").forEach((F) => {
2915
+ const q = F.getAttribute("data-show-if");
2916
+ this.#l(D, q, w) || F.remove();
2917
+ }), U.querySelectorAll("[data-hide-if]").forEach((F) => {
2918
+ const q = F.getAttribute("data-hide-if");
2919
+ this.#l(D, q, w) && F.remove();
2920
+ }), U.querySelectorAll("[data-bind]").forEach((F) => {
2921
+ F.removeAttribute("data-bind"), F.removeAttribute("data-format");
2922
+ }), U.querySelectorAll("[data-bind-attr]").forEach((F) => {
2923
+ F.removeAttribute("data-bind-attr");
2924
+ }), U.querySelectorAll("[data-show-if]").forEach((F) => {
2925
+ F.removeAttribute("data-show-if");
2926
+ }), U.querySelectorAll("[data-hide-if]").forEach((F) => {
2927
+ F.removeAttribute("data-hide-if");
2928
+ }), U;
2929
+ }
2930
+ /**
2931
+ * Binds data to element content.
2932
+ *
2933
+ * @param {Element} el - Element to bind to
2934
+ * @param {Object} item - Data object
2935
+ * @param {number} index - Item index
2936
+ * @private
2937
+ */
2938
+ #h(D, w, U) {
2939
+ const F = D.getAttribute("data-bind"), q = D.getAttribute("data-format");
2940
+ let W = this.#l(w, F, U);
2941
+ q && this.#n[q] && (W = this.#n[q](W, w)), D.textContent = W ?? "";
2942
+ }
2943
+ /**
2944
+ * Binds data to element attributes.
2945
+ * Supports syntax: data-bind-attr="attr1:path1, attr2:path2"
2946
+ *
2947
+ * @param {DocumentFragment} clone - Template clone
2948
+ * @param {Object} item - Data object
2949
+ * @param {number} index - Item index
2950
+ * @private
2951
+ */
2952
+ #d(D, w, U) {
2953
+ D.querySelectorAll("[data-bind-attr]").forEach((F) => {
2954
+ F.getAttribute("data-bind-attr").split(",").forEach((W) => {
2955
+ const [X, G] = W.split(":").map((K) => K.trim());
2956
+ if (X && G) {
2957
+ const K = this.#l(w, G, U);
2958
+ isDefAndNotNull(K) && F.setAttribute(X, K);
2959
+ }
2960
+ });
2961
+ });
2962
+ }
2963
+ /**
2964
+ * Gets a value from an object using dot notation.
2965
+ * Supports special variables: $index (0-based), $index1 (1-based)
2966
+ *
2967
+ * @param {Object} obj - Object to query
2968
+ * @param {string} path - Dot-separated path (e.g., "profile.name")
2969
+ * @param {number} index - Item index for special variables
2970
+ * @return {*} The value, or undefined if not found
2971
+ * @private
2972
+ */
2973
+ #l(D, w, U) {
2974
+ return w === "$index" ? U : w === "$index1" ? U + 1 : w.split(".").reduce((F, q) => F?.[q], D);
2975
+ }
2976
+ /**
2977
+ * Extracts the data array from a JSON response.
2978
+ * Tries common patterns: json.rows, json.data, json.items, or json itself.
2979
+ *
2980
+ * @param {Object|Array} json - JSON response
2981
+ * @return {Array} Extracted data array
2982
+ * @private
2983
+ */
2984
+ #u(D) {
2985
+ return this.#i ? this.#i.split(".").reduce((w, U) => w?.[U], D) : D.rows ? D.rows : D.data ? D.data : D.items ? D.items : Array.isArray(D) ? D : (console.warn("DataBinder: Could not extract data array from response", D), []);
2986
+ }
2987
+ /**
2988
+ * Dispatches a custom event on the container.
2989
+ *
2990
+ * @param {string} eventName - Event name
2991
+ * @param {Object} [detail={}] - Event detail
2992
+ * @private
2993
+ */
2994
+ #c(D, w = {}) {
2995
+ this.#s.dispatchEvent(new CustomEvent(D, {
2996
+ detail: w,
2997
+ bubbles: !0
2998
+ }));
2999
+ }
3000
+ }
3001
+ const SEMANTIC_ATTRIBUTES = [
3002
+ // Event attributes
3003
+ "event",
3004
+ "change-event",
3005
+ "open-event",
3006
+ "close-event",
3007
+ "primary-event",
3008
+ // Data/Record identification
3009
+ "record-id",
3010
+ "record-type",
3011
+ // URLs/Endpoints
3012
+ "endpoint",
3013
+ "url",
3014
+ // Actions/Operations
3015
+ "action",
3016
+ "method",
3017
+ // Targeting
3018
+ "target"
3019
+ ], ATTRIBUTE_TO_PROPERTY = {
3020
+ event: "event",
3021
+ "change-event": "changeEvent",
3022
+ "open-event": "openEvent",
3023
+ "close-event": "closeEvent",
3024
+ "primary-event": "primaryEvent",
3025
+ "record-id": "recordId",
3026
+ "record-type": "recordType",
3027
+ endpoint: "endpoint",
3028
+ url: "url",
3029
+ action: "action",
3030
+ method: "method",
3031
+ target: "target"
3032
+ }, getSemanticAttributes = (O) => {
3033
+ const D = {};
3034
+ return SEMANTIC_ATTRIBUTES.forEach((w) => {
3035
+ const U = O.getAttribute(w);
3036
+ if (U !== null) {
3037
+ const F = ATTRIBUTE_TO_PROPERTY[w];
3038
+ D[F] = U;
3039
+ }
3040
+ }), Array.from(O.attributes).forEach((w) => {
3041
+ if (w.name.startsWith("data-")) {
3042
+ const U = w.name.slice(5).replace(/-([a-z])/g, (F, q) => q.toUpperCase());
3043
+ D[U] = w.value;
3044
+ }
3045
+ }), D;
3046
+ }, getEventName = (O) => O.getAttribute("event"), getEventAttribute = (O, D, w = "event") => O.getAttribute(D) || O.getAttribute(w);
3047
+ /**
3048
+ * @license
3049
+ * Copyright 2019 Google LLC
3050
+ * SPDX-License-Identifier: BSD-3-Clause
3051
+ */
3052
+ const t$1 = globalThis, e$2 = t$1.ShadowRoot && (t$1.ShadyCSS === void 0 || t$1.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, s$2 = Symbol(), o$3 = /* @__PURE__ */ new WeakMap();
3053
+ let n$2 = class {
3054
+ constructor(D, w, U) {
3055
+ if (this._$cssResult$ = !0, U !== s$2) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
3056
+ this.cssText = D, this.t = w;
3057
+ }
3058
+ get styleSheet() {
3059
+ let D = this.o;
3060
+ const w = this.t;
3061
+ if (e$2 && D === void 0) {
3062
+ const U = w !== void 0 && w.length === 1;
3063
+ U && (D = o$3.get(w)), D === void 0 && ((this.o = D = new CSSStyleSheet()).replaceSync(this.cssText), U && o$3.set(w, D));
3064
+ }
3065
+ return D;
3066
+ }
3067
+ toString() {
3068
+ return this.cssText;
3069
+ }
3070
+ };
3071
+ const r$2 = (O) => new n$2(typeof O == "string" ? O : O + "", void 0, s$2), i$3 = (O, ...D) => {
3072
+ const w = O.length === 1 ? O[0] : D.reduce(((U, F, q) => U + ((W) => {
3073
+ if (W._$cssResult$ === !0) return W.cssText;
3074
+ if (typeof W == "number") return W;
3075
+ throw Error("Value passed to 'css' function must be a 'css' function result: " + W + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
3076
+ })(F) + O[q + 1]), O[0]);
3077
+ return new n$2(w, O, s$2);
3078
+ }, S$1 = (O, D) => {
3079
+ if (e$2) O.adoptedStyleSheets = D.map(((w) => w instanceof CSSStyleSheet ? w : w.styleSheet));
3080
+ else for (const w of D) {
3081
+ const U = document.createElement("style"), F = t$1.litNonce;
3082
+ F !== void 0 && U.setAttribute("nonce", F), U.textContent = w.cssText, O.appendChild(U);
3083
+ }
3084
+ }, c$2 = e$2 ? (O) => O : (O) => O instanceof CSSStyleSheet ? ((D) => {
3085
+ let w = "";
3086
+ for (const U of D.cssRules) w += U.cssText;
3087
+ return r$2(w);
3088
+ })(O) : O;
3089
+ /**
3090
+ * @license
3091
+ * Copyright 2017 Google LLC
3092
+ * SPDX-License-Identifier: BSD-3-Clause
3093
+ */
3094
+ const { is: i$2, defineProperty: e$1, getOwnPropertyDescriptor: h$1, getOwnPropertyNames: r$1, getOwnPropertySymbols: o$2, getPrototypeOf: n$1 } = Object, a$1 = globalThis, c$1 = a$1.trustedTypes, l$1 = c$1 ? c$1.emptyScript : "", p$1 = a$1.reactiveElementPolyfillSupport, d$1 = (O, D) => O, u$1 = { toAttribute(O, D) {
3095
+ switch (D) {
3096
+ case Boolean:
3097
+ O = O ? l$1 : null;
3098
+ break;
3099
+ case Object:
3100
+ case Array:
3101
+ O = O == null ? O : JSON.stringify(O);
3102
+ }
3103
+ return O;
3104
+ }, fromAttribute(O, D) {
3105
+ let w = O;
3106
+ switch (D) {
3107
+ case Boolean:
3108
+ w = O !== null;
3109
+ break;
3110
+ case Number:
3111
+ w = O === null ? null : Number(O);
3112
+ break;
3113
+ case Object:
3114
+ case Array:
3115
+ try {
3116
+ w = JSON.parse(O);
3117
+ } catch {
3118
+ w = null;
3119
+ }
3120
+ }
3121
+ return w;
3122
+ } }, f$1 = (O, D) => !i$2(O, D), b$1 = { attribute: !0, type: String, converter: u$1, reflect: !1, useDefault: !1, hasChanged: f$1 };
3123
+ Symbol.metadata ??= Symbol("metadata"), a$1.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
3124
+ let y$1 = class extends HTMLElement {
3125
+ static addInitializer(D) {
3126
+ this._$Ei(), (this.l ??= []).push(D);
3127
+ }
3128
+ static get observedAttributes() {
3129
+ return this.finalize(), this._$Eh && [...this._$Eh.keys()];
3130
+ }
3131
+ static createProperty(D, w = b$1) {
3132
+ if (w.state && (w.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(D) && ((w = Object.create(w)).wrapped = !0), this.elementProperties.set(D, w), !w.noAccessor) {
3133
+ const U = Symbol(), F = this.getPropertyDescriptor(D, U, w);
3134
+ F !== void 0 && e$1(this.prototype, D, F);
3135
+ }
3136
+ }
3137
+ static getPropertyDescriptor(D, w, U) {
3138
+ const { get: F, set: q } = h$1(this.prototype, D) ?? { get() {
3139
+ return this[w];
3140
+ }, set(W) {
3141
+ this[w] = W;
3142
+ } };
3143
+ return { get: F, set(W) {
3144
+ const X = F?.call(this);
3145
+ q?.call(this, W), this.requestUpdate(D, X, U);
3146
+ }, configurable: !0, enumerable: !0 };
3147
+ }
3148
+ static getPropertyOptions(D) {
3149
+ return this.elementProperties.get(D) ?? b$1;
3150
+ }
3151
+ static _$Ei() {
3152
+ if (this.hasOwnProperty(d$1("elementProperties"))) return;
3153
+ const D = n$1(this);
3154
+ D.finalize(), D.l !== void 0 && (this.l = [...D.l]), this.elementProperties = new Map(D.elementProperties);
3155
+ }
3156
+ static finalize() {
3157
+ if (this.hasOwnProperty(d$1("finalized"))) return;
3158
+ if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(d$1("properties"))) {
3159
+ const w = this.properties, U = [...r$1(w), ...o$2(w)];
3160
+ for (const F of U) this.createProperty(F, w[F]);
3161
+ }
3162
+ const D = this[Symbol.metadata];
3163
+ if (D !== null) {
3164
+ const w = litPropertyMetadata.get(D);
3165
+ if (w !== void 0) for (const [U, F] of w) this.elementProperties.set(U, F);
3166
+ }
3167
+ this._$Eh = /* @__PURE__ */ new Map();
3168
+ for (const [w, U] of this.elementProperties) {
3169
+ const F = this._$Eu(w, U);
3170
+ F !== void 0 && this._$Eh.set(F, w);
3171
+ }
3172
+ this.elementStyles = this.finalizeStyles(this.styles);
3173
+ }
3174
+ static finalizeStyles(D) {
3175
+ const w = [];
3176
+ if (Array.isArray(D)) {
3177
+ const U = new Set(D.flat(1 / 0).reverse());
3178
+ for (const F of U) w.unshift(c$2(F));
3179
+ } else D !== void 0 && w.push(c$2(D));
3180
+ return w;
3181
+ }
3182
+ static _$Eu(D, w) {
3183
+ const U = w.attribute;
3184
+ return U === !1 ? void 0 : typeof U == "string" ? U : typeof D == "string" ? D.toLowerCase() : void 0;
3185
+ }
3186
+ constructor() {
3187
+ super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
3188
+ }
3189
+ _$Ev() {
3190
+ this._$ES = new Promise(((D) => this.enableUpdating = D)), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach(((D) => D(this)));
3191
+ }
3192
+ addController(D) {
3193
+ (this._$EO ??= /* @__PURE__ */ new Set()).add(D), this.renderRoot !== void 0 && this.isConnected && D.hostConnected?.();
3194
+ }
3195
+ removeController(D) {
3196
+ this._$EO?.delete(D);
3197
+ }
3198
+ _$E_() {
3199
+ const D = /* @__PURE__ */ new Map(), w = this.constructor.elementProperties;
3200
+ for (const U of w.keys()) this.hasOwnProperty(U) && (D.set(U, this[U]), delete this[U]);
3201
+ D.size > 0 && (this._$Ep = D);
3202
+ }
3203
+ createRenderRoot() {
3204
+ const D = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
3205
+ return S$1(D, this.constructor.elementStyles), D;
3206
+ }
3207
+ connectedCallback() {
3208
+ this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach(((D) => D.hostConnected?.()));
3209
+ }
3210
+ enableUpdating(D) {
3211
+ }
3212
+ disconnectedCallback() {
3213
+ this._$EO?.forEach(((D) => D.hostDisconnected?.()));
3214
+ }
3215
+ attributeChangedCallback(D, w, U) {
3216
+ this._$AK(D, U);
3217
+ }
3218
+ _$ET(D, w) {
3219
+ const U = this.constructor.elementProperties.get(D), F = this.constructor._$Eu(D, U);
3220
+ if (F !== void 0 && U.reflect === !0) {
3221
+ const q = (U.converter?.toAttribute !== void 0 ? U.converter : u$1).toAttribute(w, U.type);
3222
+ this._$Em = D, q == null ? this.removeAttribute(F) : this.setAttribute(F, q), this._$Em = null;
3223
+ }
3224
+ }
3225
+ _$AK(D, w) {
3226
+ const U = this.constructor, F = U._$Eh.get(D);
3227
+ if (F !== void 0 && this._$Em !== F) {
3228
+ const q = U.getPropertyOptions(F), W = typeof q.converter == "function" ? { fromAttribute: q.converter } : q.converter?.fromAttribute !== void 0 ? q.converter : u$1;
3229
+ this._$Em = F;
3230
+ const X = W.fromAttribute(w, q.type);
3231
+ this[F] = X ?? this._$Ej?.get(F) ?? X, this._$Em = null;
3232
+ }
3233
+ }
3234
+ requestUpdate(D, w, U) {
3235
+ if (D !== void 0) {
3236
+ const F = this.constructor, q = this[D];
3237
+ if (U ??= F.getPropertyOptions(D), !((U.hasChanged ?? f$1)(q, w) || U.useDefault && U.reflect && q === this._$Ej?.get(D) && !this.hasAttribute(F._$Eu(D, U)))) return;
3238
+ this.C(D, w, U);
3239
+ }
3240
+ this.isUpdatePending === !1 && (this._$ES = this._$EP());
3241
+ }
3242
+ C(D, w, { useDefault: U, reflect: F, wrapped: q }, W) {
3243
+ U && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(D) && (this._$Ej.set(D, W ?? w ?? this[D]), q !== !0 || W !== void 0) || (this._$AL.has(D) || (this.hasUpdated || U || (w = void 0), this._$AL.set(D, w)), F === !0 && this._$Em !== D && (this._$Eq ??= /* @__PURE__ */ new Set()).add(D));
3244
+ }
3245
+ async _$EP() {
3246
+ this.isUpdatePending = !0;
3247
+ try {
3248
+ await this._$ES;
3249
+ } catch (w) {
3250
+ Promise.reject(w);
3251
+ }
3252
+ const D = this.scheduleUpdate();
3253
+ return D != null && await D, !this.isUpdatePending;
3254
+ }
3255
+ scheduleUpdate() {
3256
+ return this.performUpdate();
3257
+ }
3258
+ performUpdate() {
3259
+ if (!this.isUpdatePending) return;
3260
+ if (!this.hasUpdated) {
3261
+ if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
3262
+ for (const [F, q] of this._$Ep) this[F] = q;
3263
+ this._$Ep = void 0;
3264
+ }
3265
+ const U = this.constructor.elementProperties;
3266
+ if (U.size > 0) for (const [F, q] of U) {
3267
+ const { wrapped: W } = q, X = this[F];
3268
+ W !== !0 || this._$AL.has(F) || X === void 0 || this.C(F, void 0, q, X);
3269
+ }
3270
+ }
3271
+ let D = !1;
3272
+ const w = this._$AL;
3273
+ try {
3274
+ D = this.shouldUpdate(w), D ? (this.willUpdate(w), this._$EO?.forEach(((U) => U.hostUpdate?.())), this.update(w)) : this._$EM();
3275
+ } catch (U) {
3276
+ throw D = !1, this._$EM(), U;
3277
+ }
3278
+ D && this._$AE(w);
3279
+ }
3280
+ willUpdate(D) {
3281
+ }
3282
+ _$AE(D) {
3283
+ this._$EO?.forEach(((w) => w.hostUpdated?.())), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(D)), this.updated(D);
3284
+ }
3285
+ _$EM() {
3286
+ this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
3287
+ }
3288
+ get updateComplete() {
3289
+ return this.getUpdateComplete();
3290
+ }
3291
+ getUpdateComplete() {
3292
+ return this._$ES;
3293
+ }
3294
+ shouldUpdate(D) {
3295
+ return !0;
3296
+ }
3297
+ update(D) {
3298
+ this._$Eq &&= this._$Eq.forEach(((w) => this._$ET(w, this[w]))), this._$EM();
3299
+ }
3300
+ updated(D) {
3301
+ }
3302
+ firstUpdated(D) {
3303
+ }
3304
+ };
3305
+ y$1.elementStyles = [], y$1.shadowRootOptions = { mode: "open" }, y$1[d$1("elementProperties")] = /* @__PURE__ */ new Map(), y$1[d$1("finalized")] = /* @__PURE__ */ new Map(), p$1?.({ ReactiveElement: y$1 }), (a$1.reactiveElementVersions ??= []).push("2.1.1");
3306
+ /**
3307
+ * @license
3308
+ * Copyright 2017 Google LLC
3309
+ * SPDX-License-Identifier: BSD-3-Clause
3310
+ */
3311
+ const t = globalThis, i$1 = t.trustedTypes, s$1 = i$1 ? i$1.createPolicy("lit-html", { createHTML: (O) => O }) : void 0, e = "$lit$", h = `lit$${Math.random().toFixed(9).slice(2)}$`, o$1 = "?" + h, n = `<${o$1}>`, r = document, l = () => r.createComment(""), c = (O) => O === null || typeof O != "object" && typeof O != "function", a = Array.isArray, u = (O) => a(O) || typeof O?.[Symbol.iterator] == "function", d = `[
3312
+ \f\r]`, f = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, v = /-->/g, _ = />/g, m = RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^
3313
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), p = /'/g, g = /"/g, $ = /^(?:script|style|textarea|title)$/i, y = (O) => (D, ...w) => ({ _$litType$: O, strings: D, values: w }), x = y(1), b = y(2), T = Symbol.for("lit-noChange"), E = Symbol.for("lit-nothing"), A = /* @__PURE__ */ new WeakMap(), C = r.createTreeWalker(r, 129);
3314
+ function P(O, D) {
3315
+ if (!a(O) || !O.hasOwnProperty("raw")) throw Error("invalid template strings array");
3316
+ return s$1 !== void 0 ? s$1.createHTML(D) : D;
3317
+ }
3318
+ const V = (O, D) => {
3319
+ const w = O.length - 1, U = [];
3320
+ let F, q = D === 2 ? "<svg>" : D === 3 ? "<math>" : "", W = f;
3321
+ for (let X = 0; X < w; X++) {
3322
+ const G = O[X];
3323
+ let K, Q, tt = -1, J = 0;
3324
+ for (; J < G.length && (W.lastIndex = J, Q = W.exec(G), Q !== null); ) J = W.lastIndex, W === f ? Q[1] === "!--" ? W = v : Q[1] !== void 0 ? W = _ : Q[2] !== void 0 ? ($.test(Q[2]) && (F = RegExp("</" + Q[2], "g")), W = m) : Q[3] !== void 0 && (W = m) : W === m ? Q[0] === ">" ? (W = F ?? f, tt = -1) : Q[1] === void 0 ? tt = -2 : (tt = W.lastIndex - Q[2].length, K = Q[1], W = Q[3] === void 0 ? m : Q[3] === '"' ? g : p) : W === g || W === p ? W = m : W === v || W === _ ? W = f : (W = m, F = void 0);
3325
+ const Y = W === m && O[X + 1].startsWith("/>") ? " " : "";
3326
+ q += W === f ? G + n : tt >= 0 ? (U.push(K), G.slice(0, tt) + e + G.slice(tt) + h + Y) : G + h + (tt === -2 ? X : Y);
3327
+ }
3328
+ return [P(O, q + (O[w] || "<?>") + (D === 2 ? "</svg>" : D === 3 ? "</math>" : "")), U];
3329
+ };
3330
+ class N {
3331
+ constructor({ strings: D, _$litType$: w }, U) {
3332
+ let F;
3333
+ this.parts = [];
3334
+ let q = 0, W = 0;
3335
+ const X = D.length - 1, G = this.parts, [K, Q] = V(D, w);
3336
+ if (this.el = N.createElement(K, U), C.currentNode = this.el.content, w === 2 || w === 3) {
3337
+ const tt = this.el.content.firstChild;
3338
+ tt.replaceWith(...tt.childNodes);
3339
+ }
3340
+ for (; (F = C.nextNode()) !== null && G.length < X; ) {
3341
+ if (F.nodeType === 1) {
3342
+ if (F.hasAttributes()) for (const tt of F.getAttributeNames()) if (tt.endsWith(e)) {
3343
+ const J = Q[W++], Y = F.getAttribute(tt).split(h), Z = /([.?@])?(.*)/.exec(J);
3344
+ G.push({ type: 1, index: q, name: Z[2], strings: Y, ctor: Z[1] === "." ? H : Z[1] === "?" ? I : Z[1] === "@" ? L : k }), F.removeAttribute(tt);
3345
+ } else tt.startsWith(h) && (G.push({ type: 6, index: q }), F.removeAttribute(tt));
3346
+ if ($.test(F.tagName)) {
3347
+ const tt = F.textContent.split(h), J = tt.length - 1;
3348
+ if (J > 0) {
3349
+ F.textContent = i$1 ? i$1.emptyScript : "";
3350
+ for (let Y = 0; Y < J; Y++) F.append(tt[Y], l()), C.nextNode(), G.push({ type: 2, index: ++q });
3351
+ F.append(tt[J], l());
3352
+ }
3353
+ }
3354
+ } else if (F.nodeType === 8) if (F.data === o$1) G.push({ type: 2, index: q });
3355
+ else {
3356
+ let tt = -1;
3357
+ for (; (tt = F.data.indexOf(h, tt + 1)) !== -1; ) G.push({ type: 7, index: q }), tt += h.length - 1;
3358
+ }
3359
+ q++;
3360
+ }
3361
+ }
3362
+ static createElement(D, w) {
3363
+ const U = r.createElement("template");
3364
+ return U.innerHTML = D, U;
3365
+ }
3366
+ }
3367
+ function S(O, D, w = O, U) {
3368
+ if (D === T) return D;
3369
+ let F = U !== void 0 ? w._$Co?.[U] : w._$Cl;
3370
+ const q = c(D) ? void 0 : D._$litDirective$;
3371
+ return F?.constructor !== q && (F?._$AO?.(!1), q === void 0 ? F = void 0 : (F = new q(O), F._$AT(O, w, U)), U !== void 0 ? (w._$Co ??= [])[U] = F : w._$Cl = F), F !== void 0 && (D = S(O, F._$AS(O, D.values), F, U)), D;
3372
+ }
3373
+ class M {
3374
+ constructor(D, w) {
3375
+ this._$AV = [], this._$AN = void 0, this._$AD = D, this._$AM = w;
3376
+ }
3377
+ get parentNode() {
3378
+ return this._$AM.parentNode;
3379
+ }
3380
+ get _$AU() {
3381
+ return this._$AM._$AU;
3382
+ }
3383
+ u(D) {
3384
+ const { el: { content: w }, parts: U } = this._$AD, F = (D?.creationScope ?? r).importNode(w, !0);
3385
+ C.currentNode = F;
3386
+ let q = C.nextNode(), W = 0, X = 0, G = U[0];
3387
+ for (; G !== void 0; ) {
3388
+ if (W === G.index) {
3389
+ let K;
3390
+ G.type === 2 ? K = new R(q, q.nextSibling, this, D) : G.type === 1 ? K = new G.ctor(q, G.name, G.strings, this, D) : G.type === 6 && (K = new z(q, this, D)), this._$AV.push(K), G = U[++X];
3391
+ }
3392
+ W !== G?.index && (q = C.nextNode(), W++);
3393
+ }
3394
+ return C.currentNode = r, F;
3395
+ }
3396
+ p(D) {
3397
+ let w = 0;
3398
+ for (const U of this._$AV) U !== void 0 && (U.strings !== void 0 ? (U._$AI(D, U, w), w += U.strings.length - 2) : U._$AI(D[w])), w++;
3399
+ }
3400
+ }
3401
+ class R {
3402
+ get _$AU() {
3403
+ return this._$AM?._$AU ?? this._$Cv;
3404
+ }
3405
+ constructor(D, w, U, F) {
3406
+ this.type = 2, this._$AH = E, this._$AN = void 0, this._$AA = D, this._$AB = w, this._$AM = U, this.options = F, this._$Cv = F?.isConnected ?? !0;
3407
+ }
3408
+ get parentNode() {
3409
+ let D = this._$AA.parentNode;
3410
+ const w = this._$AM;
3411
+ return w !== void 0 && D?.nodeType === 11 && (D = w.parentNode), D;
3412
+ }
3413
+ get startNode() {
3414
+ return this._$AA;
3415
+ }
3416
+ get endNode() {
3417
+ return this._$AB;
3418
+ }
3419
+ _$AI(D, w = this) {
3420
+ D = S(this, D, w), c(D) ? D === E || D == null || D === "" ? (this._$AH !== E && this._$AR(), this._$AH = E) : D !== this._$AH && D !== T && this._(D) : D._$litType$ !== void 0 ? this.$(D) : D.nodeType !== void 0 ? this.T(D) : u(D) ? this.k(D) : this._(D);
3421
+ }
3422
+ O(D) {
3423
+ return this._$AA.parentNode.insertBefore(D, this._$AB);
3424
+ }
3425
+ T(D) {
3426
+ this._$AH !== D && (this._$AR(), this._$AH = this.O(D));
3427
+ }
3428
+ _(D) {
3429
+ this._$AH !== E && c(this._$AH) ? this._$AA.nextSibling.data = D : this.T(r.createTextNode(D)), this._$AH = D;
3430
+ }
3431
+ $(D) {
3432
+ const { values: w, _$litType$: U } = D, F = typeof U == "number" ? this._$AC(D) : (U.el === void 0 && (U.el = N.createElement(P(U.h, U.h[0]), this.options)), U);
3433
+ if (this._$AH?._$AD === F) this._$AH.p(w);
3434
+ else {
3435
+ const q = new M(F, this), W = q.u(this.options);
3436
+ q.p(w), this.T(W), this._$AH = q;
3437
+ }
3438
+ }
3439
+ _$AC(D) {
3440
+ let w = A.get(D.strings);
3441
+ return w === void 0 && A.set(D.strings, w = new N(D)), w;
3442
+ }
3443
+ k(D) {
3444
+ a(this._$AH) || (this._$AH = [], this._$AR());
3445
+ const w = this._$AH;
3446
+ let U, F = 0;
3447
+ for (const q of D) F === w.length ? w.push(U = new R(this.O(l()), this.O(l()), this, this.options)) : U = w[F], U._$AI(q), F++;
3448
+ F < w.length && (this._$AR(U && U._$AB.nextSibling, F), w.length = F);
3449
+ }
3450
+ _$AR(D = this._$AA.nextSibling, w) {
3451
+ for (this._$AP?.(!1, !0, w); D !== this._$AB; ) {
3452
+ const U = D.nextSibling;
3453
+ D.remove(), D = U;
3454
+ }
3455
+ }
3456
+ setConnected(D) {
3457
+ this._$AM === void 0 && (this._$Cv = D, this._$AP?.(D));
3458
+ }
3459
+ }
3460
+ class k {
3461
+ get tagName() {
3462
+ return this.element.tagName;
3463
+ }
3464
+ get _$AU() {
3465
+ return this._$AM._$AU;
3466
+ }
3467
+ constructor(D, w, U, F, q) {
3468
+ this.type = 1, this._$AH = E, this._$AN = void 0, this.element = D, this.name = w, this._$AM = F, this.options = q, U.length > 2 || U[0] !== "" || U[1] !== "" ? (this._$AH = Array(U.length - 1).fill(new String()), this.strings = U) : this._$AH = E;
3469
+ }
3470
+ _$AI(D, w = this, U, F) {
3471
+ const q = this.strings;
3472
+ let W = !1;
3473
+ if (q === void 0) D = S(this, D, w, 0), W = !c(D) || D !== this._$AH && D !== T, W && (this._$AH = D);
3474
+ else {
3475
+ const X = D;
3476
+ let G, K;
3477
+ for (D = q[0], G = 0; G < q.length - 1; G++) K = S(this, X[U + G], w, G), K === T && (K = this._$AH[G]), W ||= !c(K) || K !== this._$AH[G], K === E ? D = E : D !== E && (D += (K ?? "") + q[G + 1]), this._$AH[G] = K;
3478
+ }
3479
+ W && !F && this.j(D);
3480
+ }
3481
+ j(D) {
3482
+ D === E ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, D ?? "");
3483
+ }
3484
+ }
3485
+ class H extends k {
3486
+ constructor() {
3487
+ super(...arguments), this.type = 3;
3488
+ }
3489
+ j(D) {
3490
+ this.element[this.name] = D === E ? void 0 : D;
3491
+ }
3492
+ }
3493
+ class I extends k {
3494
+ constructor() {
3495
+ super(...arguments), this.type = 4;
3496
+ }
3497
+ j(D) {
3498
+ this.element.toggleAttribute(this.name, !!D && D !== E);
3499
+ }
3500
+ }
3501
+ class L extends k {
3502
+ constructor(D, w, U, F, q) {
3503
+ super(D, w, U, F, q), this.type = 5;
3504
+ }
3505
+ _$AI(D, w = this) {
3506
+ if ((D = S(this, D, w, 0) ?? E) === T) return;
3507
+ const U = this._$AH, F = D === E && U !== E || D.capture !== U.capture || D.once !== U.once || D.passive !== U.passive, q = D !== E && (U === E || F);
3508
+ F && this.element.removeEventListener(this.name, this, U), q && this.element.addEventListener(this.name, this, D), this._$AH = D;
3509
+ }
3510
+ handleEvent(D) {
3511
+ typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, D) : this._$AH.handleEvent(D);
3512
+ }
3513
+ }
3514
+ class z {
3515
+ constructor(D, w, U) {
3516
+ this.element = D, this.type = 6, this._$AN = void 0, this._$AM = w, this.options = U;
3517
+ }
3518
+ get _$AU() {
3519
+ return this._$AM._$AU;
3520
+ }
3521
+ _$AI(D) {
3522
+ S(this, D);
3523
+ }
3524
+ }
3525
+ const j = t.litHtmlPolyfillSupport;
3526
+ j?.(N, R), (t.litHtmlVersions ??= []).push("3.3.1");
3527
+ const B = (O, D, w) => {
3528
+ const U = w?.renderBefore ?? D;
3529
+ let F = U._$litPart$;
3530
+ if (F === void 0) {
3531
+ const q = w?.renderBefore ?? null;
3532
+ U._$litPart$ = F = new R(D.insertBefore(l(), q), q, void 0, w ?? {});
3533
+ }
3534
+ return F._$AI(O), F;
3535
+ };
3536
+ /**
3537
+ * @license
3538
+ * Copyright 2017 Google LLC
3539
+ * SPDX-License-Identifier: BSD-3-Clause
3540
+ */
3541
+ const s = globalThis;
3542
+ class i extends y$1 {
3543
+ constructor() {
3544
+ super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
3545
+ }
3546
+ createRenderRoot() {
3547
+ const D = super.createRenderRoot();
3548
+ return this.renderOptions.renderBefore ??= D.firstChild, D;
3549
+ }
3550
+ update(D) {
3551
+ const w = this.render();
3552
+ this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(D), this._$Do = B(w, this.renderRoot, this.renderOptions);
3553
+ }
3554
+ connectedCallback() {
3555
+ super.connectedCallback(), this._$Do?.setConnected(!0);
3556
+ }
3557
+ disconnectedCallback() {
3558
+ super.disconnectedCallback(), this._$Do?.setConnected(!1);
3559
+ }
3560
+ render() {
3561
+ return T;
3562
+ }
3563
+ }
3564
+ i._$litElement$ = !0, i.finalized = !0, s.litElementHydrateSupport?.({ LitElement: i });
3565
+ const o = s.litElementPolyfillSupport;
3566
+ o?.({ LitElement: i });
3567
+ (s.litElementVersions ??= []).push("4.2.1");
3568
+ class ZooTag extends i {
3569
+ static properties = {
3570
+ token: { type: String }
3571
+ };
3572
+ static styles = i$3`
3573
+ :host {
3574
+ display: inline-block;
3575
+ }
3576
+
3577
+ .tag {
3578
+ display: inline-flex;
3579
+ align-items: center;
3580
+ min-height: 1.5rem;
3581
+ max-width: 100%;
3582
+ min-width: 2rem;
3583
+ padding: 0 0.5rem;
3584
+ border-radius: 0.9375rem;
3585
+ font-size: 0.75rem;
3586
+ font-weight: 400;
3587
+ line-height: 1.33333;
3588
+ letter-spacing: 0.32px;
3589
+ white-space: nowrap;
3590
+ word-break: break-word;
3591
+ box-sizing: border-box;
3592
+ }
3593
+ `;
3594
+ render() {
3595
+ const D = this.token ?? "default";
3596
+ return x`
3597
+ <span
3598
+ class="tag"
3599
+ style="
3600
+ background-color: var(--zoo-tag-${D}-bg, var(--zoo-tag-default-bg, #9e9e9e));
3601
+ color: var(--zoo-tag-${D}-fg, var(--zoo-tag-default-fg, #ffffff));
3602
+ "
3603
+ >
3604
+ <slot></slot>
3605
+ </span>
3606
+ `;
3607
+ }
3608
+ }
3609
+ customElements.get("zoo-tag") || customElements.define("zoo-tag", ZooTag);
3610
+ const zoo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3611
+ __proto__: null,
3612
+ SEMANTIC_ATTRIBUTES,
3613
+ ZooTag,
3614
+ getEventAttribute,
3615
+ getEventName,
3616
+ getSemanticAttributes
3617
+ }, Symbol.toStringTag, { value: "Module" }));
3618
+ async function registerCarbonLibrary() {
3619
+ const { registerCarbonLibrary: O } = await import("./register-ClkXTZwT.js");
3620
+ return O();
3621
+ }
3622
+ async function registerMdcLibrary() {
3623
+ const { registerMdcLibrary: O } = await import("./register-CHuMnx--.js");
3624
+ return O();
3625
+ }
3626
+ const zooy = {
3627
+ EVT,
3628
+ Component,
3629
+ Dragger,
3630
+ Panel,
3631
+ FormPanel,
3632
+ Split,
3633
+ UserManager,
3634
+ View,
3635
+ Conductor,
3636
+ DataBinder,
3637
+ UiEventType,
3638
+ domUtils,
3639
+ uriUtils,
3640
+ registerCarbonLibrary,
3641
+ registerMdcLibrary,
3642
+ ComponentLibraryRegistry,
3643
+ handlers,
3644
+ zoo
3645
+ };
3646
+ export {
3647
+ B,
3648
+ ComponentLibraryRegistry as C,
3649
+ DataBinder as D,
3650
+ E,
3651
+ FormPanel as F,
3652
+ Panel as P,
3653
+ Split as S,
3654
+ T,
3655
+ UserManager as U,
3656
+ View as V,
3657
+ i$3 as a,
3658
+ b,
3659
+ getEventAttribute as c,
3660
+ getElDataMap as d,
3661
+ isDefAndNotNull as e,
3662
+ f$1 as f,
3663
+ getSemanticAttributes as g,
3664
+ treeUtils as h,
3665
+ i,
3666
+ registerMdcLibrary as j,
3667
+ EVT as k,
3668
+ Component as l,
3669
+ Dragger as m,
3670
+ UiEventType as n,
3671
+ Conductor as o,
3672
+ domUtils as p,
3673
+ uriUtils as q,
3674
+ registerCarbonLibrary as r,
3675
+ handlers as s,
3676
+ toLowerCase as t,
3677
+ u$1 as u,
3678
+ zoo as v,
3679
+ x,
3680
+ zooy as z
3681
+ };