wj-elements 0.7.7 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. package/dist/animations.js +28 -51
  2. package/dist/animations.js.map +1 -1
  3. package/dist/base-path.js +19 -31
  4. package/dist/base-path.js.map +1 -1
  5. package/dist/custom-elements.json +11504 -11499
  6. package/dist/dark.css +1 -302
  7. package/dist/date.js +16 -36
  8. package/dist/date.js.map +1 -1
  9. package/dist/element-utils.js +20 -81
  10. package/dist/element-utils.js.map +1 -1
  11. package/dist/event.js +49 -165
  12. package/dist/event.js.map +1 -1
  13. package/dist/form-associated-element-BjeJn7j8.js +101 -0
  14. package/dist/{form-associated-element-DEQ4y-jn.js.map → form-associated-element-BjeJn7j8.js.map} +1 -1
  15. package/dist/icon-DmsqtDpL.js +102 -0
  16. package/dist/{icon-CReYMzAK.js.map → icon-DmsqtDpL.js.map} +1 -1
  17. package/dist/light.css +1 -731
  18. package/dist/localize.js +36 -111
  19. package/dist/localize.js.map +1 -1
  20. package/dist/packages/wje-accordion-item/accordion-item.element.d.ts +3 -2
  21. package/dist/permissions.js +14 -41
  22. package/dist/permissions.js.map +1 -1
  23. package/dist/popup.element-CbkhthPP.js +806 -0
  24. package/dist/{popup.element-CwXvVFK7.js.map → popup.element-CbkhthPP.js.map} +1 -1
  25. package/dist/router-links-CNsJ-elb.js +105 -0
  26. package/dist/{router-links-wjqCnncc.js.map → router-links-CNsJ-elb.js.map} +1 -1
  27. package/dist/skeleton.css +1 -197
  28. package/dist/styles.css +1 -866
  29. package/dist/universal-service.js +48 -109
  30. package/dist/universal-service.js.map +1 -1
  31. package/dist/utils.js +11 -18
  32. package/dist/utils.js.map +1 -1
  33. package/dist/web-types.json +760 -760
  34. package/dist/wje-accordion-item.js +33 -106
  35. package/dist/wje-accordion-item.js.map +1 -1
  36. package/dist/wje-accordion.js +19 -84
  37. package/dist/wje-accordion.js.map +1 -1
  38. package/dist/wje-animation.js +37 -4258
  39. package/dist/wje-animation.js.map +1 -1
  40. package/dist/wje-aside.js +9 -34
  41. package/dist/wje-aside.js.map +1 -1
  42. package/dist/wje-avatar.js +36 -126
  43. package/dist/wje-avatar.js.map +1 -1
  44. package/dist/wje-badge.js +10 -52
  45. package/dist/wje-badge.js.map +1 -1
  46. package/dist/wje-breadcrumb.js +205 -672
  47. package/dist/wje-breadcrumb.js.map +1 -1
  48. package/dist/wje-breadcrumbs.js +177 -633
  49. package/dist/wje-breadcrumbs.js.map +1 -1
  50. package/dist/wje-button-group.js +48 -153
  51. package/dist/wje-button-group.js.map +1 -1
  52. package/dist/wje-button.js +92 -413
  53. package/dist/wje-button.js.map +1 -1
  54. package/dist/wje-card-content.js +7 -30
  55. package/dist/wje-card-content.js.map +1 -1
  56. package/dist/wje-card-controls.js +7 -30
  57. package/dist/wje-card-controls.js.map +1 -1
  58. package/dist/wje-card-header.js +7 -30
  59. package/dist/wje-card-header.js.map +1 -1
  60. package/dist/wje-card-subtitle.js +7 -34
  61. package/dist/wje-card-subtitle.js.map +1 -1
  62. package/dist/wje-card-title.js +7 -34
  63. package/dist/wje-card-title.js.map +1 -1
  64. package/dist/wje-card.js +15 -71
  65. package/dist/wje-card.js.map +1 -1
  66. package/dist/wje-carousel-item.js +12 -56
  67. package/dist/wje-carousel-item.js.map +1 -1
  68. package/dist/wje-carousel.js +154 -509
  69. package/dist/wje-carousel.js.map +1 -1
  70. package/dist/wje-checkbox.js +50 -227
  71. package/dist/wje-checkbox.js.map +1 -1
  72. package/dist/wje-chip.js +43 -160
  73. package/dist/wje-chip.js.map +1 -1
  74. package/dist/wje-col.js +7 -20
  75. package/dist/wje-col.js.map +1 -1
  76. package/dist/wje-color-picker.js +445 -1464
  77. package/dist/wje-color-picker.js.map +1 -1
  78. package/dist/wje-container.js +9 -35
  79. package/dist/wje-container.js.map +1 -1
  80. package/dist/wje-copy-button.js +64 -204
  81. package/dist/wje-copy-button.js.map +1 -1
  82. package/dist/wje-dialog.js +85 -553
  83. package/dist/wje-dialog.js.map +1 -1
  84. package/dist/wje-divider.js +7 -34
  85. package/dist/wje-divider.js.map +1 -1
  86. package/dist/wje-dropdown.js +78 -305
  87. package/dist/wje-dropdown.js.map +1 -1
  88. package/dist/wje-element.js +191 -700
  89. package/dist/wje-element.js.map +1 -1
  90. package/dist/wje-file-upload-item.js +51 -156
  91. package/dist/wje-file-upload-item.js.map +1 -1
  92. package/dist/wje-file-upload.js +181 -619
  93. package/dist/wje-file-upload.js.map +1 -1
  94. package/dist/wje-footer.js +7 -31
  95. package/dist/wje-footer.js.map +1 -1
  96. package/dist/wje-form.js +7 -32
  97. package/dist/wje-form.js.map +1 -1
  98. package/dist/wje-format-digital.js +26 -118
  99. package/dist/wje-format-digital.js.map +1 -1
  100. package/dist/wje-grid.js +7 -33
  101. package/dist/wje-grid.js.map +1 -1
  102. package/dist/wje-header.js +9 -35
  103. package/dist/wje-header.js.map +1 -1
  104. package/dist/wje-icon-library.js +12 -18
  105. package/dist/wje-icon-library.js.map +1 -1
  106. package/dist/wje-icon-picker.js +65 -320
  107. package/dist/wje-icon-picker.js.map +1 -1
  108. package/dist/wje-icon.js +1 -1
  109. package/dist/wje-img-comparer.js +37 -114
  110. package/dist/wje-img-comparer.js.map +1 -1
  111. package/dist/wje-img.js +50 -198
  112. package/dist/wje-img.js.map +1 -1
  113. package/dist/wje-infinite-scroll.js +94 -346
  114. package/dist/wje-infinite-scroll.js.map +1 -1
  115. package/dist/wje-input-file.js +23 -84
  116. package/dist/wje-input-file.js.map +1 -1
  117. package/dist/wje-input.js +78 -392
  118. package/dist/wje-input.js.map +1 -1
  119. package/dist/wje-item.js +11 -64
  120. package/dist/wje-item.js.map +1 -1
  121. package/dist/wje-kanban.js +124 -401
  122. package/dist/wje-kanban.js.map +1 -1
  123. package/dist/wje-label.js +9 -32
  124. package/dist/wje-label.js.map +1 -1
  125. package/dist/wje-level-indicator.js +38 -157
  126. package/dist/wje-level-indicator.js.map +1 -1
  127. package/dist/wje-list.js +10 -40
  128. package/dist/wje-list.js.map +1 -1
  129. package/dist/wje-main.js +7 -31
  130. package/dist/wje-main.js.map +1 -1
  131. package/dist/wje-masonry.js +66 -211
  132. package/dist/wje-masonry.js.map +1 -1
  133. package/dist/wje-master.js +45 -161
  134. package/dist/wje-master.js.map +1 -1
  135. package/dist/wje-menu-button.js +10 -38
  136. package/dist/wje-menu-button.js.map +1 -1
  137. package/dist/wje-menu-item.js +127 -577
  138. package/dist/wje-menu-item.js.map +1 -1
  139. package/dist/wje-menu-label.js +9 -35
  140. package/dist/wje-menu-label.js.map +1 -1
  141. package/dist/wje-menu.js +14 -49
  142. package/dist/wje-menu.js.map +1 -1
  143. package/dist/wje-option.js +48 -279
  144. package/dist/wje-option.js.map +1 -1
  145. package/dist/wje-options.js +130 -384
  146. package/dist/wje-options.js.map +1 -1
  147. package/dist/wje-orgchart-group.js +16 -52
  148. package/dist/wje-orgchart-group.js.map +1 -1
  149. package/dist/wje-orgchart-item.js +24 -93
  150. package/dist/wje-orgchart-item.js.map +1 -1
  151. package/dist/wje-orgchart.js +18 -68
  152. package/dist/wje-orgchart.js.map +1 -1
  153. package/dist/wje-pagination.js +113 -397
  154. package/dist/wje-pagination.js.map +1 -1
  155. package/dist/wje-popup.js +3 -3
  156. package/dist/wje-popup.js.map +1 -1
  157. package/dist/wje-progress-bar.js +53 -205
  158. package/dist/wje-progress-bar.js.map +1 -1
  159. package/dist/wje-qr-code.js +398 -2980
  160. package/dist/wje-qr-code.js.map +1 -1
  161. package/dist/wje-radio-group.js +52 -190
  162. package/dist/wje-radio-group.js.map +1 -1
  163. package/dist/wje-radio.js +24 -118
  164. package/dist/wje-radio.js.map +1 -1
  165. package/dist/wje-rate.js +62 -266
  166. package/dist/wje-rate.js.map +1 -1
  167. package/dist/wje-relative-time.js +24 -99
  168. package/dist/wje-relative-time.js.map +1 -1
  169. package/dist/wje-reorder-dropzone.js +9 -31
  170. package/dist/wje-reorder-dropzone.js.map +1 -1
  171. package/dist/wje-reorder-handle.js +67 -204
  172. package/dist/wje-reorder-handle.js.map +1 -1
  173. package/dist/wje-reorder-item.js +14 -44
  174. package/dist/wje-reorder-item.js.map +1 -1
  175. package/dist/wje-reorder.js +61 -246
  176. package/dist/wje-reorder.js.map +1 -1
  177. package/dist/wje-route.js +6 -24
  178. package/dist/wje-route.js.map +1 -1
  179. package/dist/wje-router-link.js +11 -39
  180. package/dist/wje-router-link.js.map +1 -1
  181. package/dist/wje-router-outlet.js +76 -172
  182. package/dist/wje-router-outlet.js.map +1 -1
  183. package/dist/wje-routerx.js +537 -1331
  184. package/dist/wje-routerx.js.map +1 -1
  185. package/dist/wje-row.js +9 -31
  186. package/dist/wje-row.js.map +1 -1
  187. package/dist/wje-select.js +326 -1152
  188. package/dist/wje-select.js.map +1 -1
  189. package/dist/wje-slider.js +44 -225
  190. package/dist/wje-slider.js.map +1 -1
  191. package/dist/wje-sliding-container.js +295 -1319
  192. package/dist/wje-sliding-container.js.map +1 -1
  193. package/dist/wje-split-view.js +35 -121
  194. package/dist/wje-split-view.js.map +1 -1
  195. package/dist/wje-status.js +14 -45
  196. package/dist/wje-status.js.map +1 -1
  197. package/dist/wje-step.js +9 -32
  198. package/dist/wje-step.js.map +1 -1
  199. package/dist/wje-stepper.js +109 -357
  200. package/dist/wje-stepper.js.map +1 -1
  201. package/dist/wje-store.js +67 -360
  202. package/dist/wje-store.js.map +1 -1
  203. package/dist/wje-tab-group.js +85 -314
  204. package/dist/wje-tab-group.js.map +1 -1
  205. package/dist/wje-tab-panel.js +7 -28
  206. package/dist/wje-tab-panel.js.map +1 -1
  207. package/dist/wje-tab.js +21 -198
  208. package/dist/wje-tab.js.map +1 -1
  209. package/dist/wje-textarea.js +64 -264
  210. package/dist/wje-textarea.js.map +1 -1
  211. package/dist/wje-thumbnail.js +10 -51
  212. package/dist/wje-thumbnail.js.map +1 -1
  213. package/dist/wje-toast.js +127 -632
  214. package/dist/wje-toast.js.map +1 -1
  215. package/dist/wje-toggle.js +52 -177
  216. package/dist/wje-toggle.js.map +1 -1
  217. package/dist/wje-toolbar-action.js +128 -456
  218. package/dist/wje-toolbar-action.js.map +1 -1
  219. package/dist/wje-toolbar.js +75 -270
  220. package/dist/wje-toolbar.js.map +1 -1
  221. package/dist/wje-tooltip.js +50 -161
  222. package/dist/wje-tooltip.js.map +1 -1
  223. package/dist/wje-tree-item.js +70 -301
  224. package/dist/wje-tree-item.js.map +1 -1
  225. package/dist/wje-tree.js +145 -489
  226. package/dist/wje-tree.js.map +1 -1
  227. package/dist/wje-visually-hidden.js +7 -34
  228. package/dist/wje-visually-hidden.js.map +1 -1
  229. package/package.json +3 -2
  230. package/dist/form-associated-element-DEQ4y-jn.js +0 -245
  231. package/dist/icon-CReYMzAK.js +0 -245
  232. package/dist/popup.element-CwXvVFK7.js +0 -2133
  233. package/dist/router-links-wjqCnncc.js +0 -156
package/dist/localize.js CHANGED
@@ -1,135 +1,60 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- class LocalizerDefault {
5
- constructor(element) {
6
- __publicField(this, "convertLangCode", (lang) => lang.replace("-", "_").replace(/_([a-z]{2})$/, (_, code) => `_${code.toUpperCase()}`));
4
+ class t {
5
+ constructor(t2) {
6
+ __publicField(this, "convertLangCode", (t2) => t2.replace("-", "_").replace(/_([a-z]{2})$/, (t3, e2) => `_${e2.toUpperCase()}`));
7
7
  var _a, _b, _c, _d;
8
- this.element = element;
9
- this.lang = ((_a = this.element) == null ? void 0 : _a.lang) || ((_b = document.documentElement) == null ? void 0 : _b.lang) || "en-GB";
10
- this.dir = ((_c = this.element) == null ? void 0 : _c.dir) || ((_d = document.documentElement) == null ? void 0 : _d.dir) || "ltr";
11
- this.currentLang = "en-GB";
12
- this.setLanguage();
8
+ this.element = t2, this.lang = ((_a = this.element) == null ? void 0 : _a.lang) || ((_b = document.documentElement) == null ? void 0 : _b.lang) || "en-GB", this.dir = ((_c = this.element) == null ? void 0 : _c.dir) || ((_d = document.documentElement) == null ? void 0 : _d.dir) || "ltr", this.currentLang = "en-GB", this.setLanguage();
13
9
  }
14
10
  get languages() {
15
11
  return window.translations;
16
12
  }
17
- // Nastavenie aktuálneho jazyka
18
13
  setLanguage() {
19
14
  var _a;
20
- if ((_a = this.languages) == null ? void 0 : _a.has(this.lang)) {
21
- this.currentLang = this.lang;
22
- } else {
23
- console.error(`Language "${this.lang}" not loaded.`);
24
- }
15
+ ((_a = this.languages) == null ? void 0 : _a.has(this.lang)) ? this.currentLang = this.lang : console.error(`Language "${this.lang}" not loaded.`);
25
16
  }
26
- /**
27
- * Translates a given translation key based on the currently selected language.
28
- * @param {string} key The key representing the text to be translated.
29
- * @returns {string} The translated text if available; otherwise, returns the original key.
30
- */
31
- translate(key) {
17
+ translate(t2) {
32
18
  var _a;
33
- const langMap = (_a = this.languages) == null ? void 0 : _a.get(this.currentLang);
34
- if (!langMap) return key;
35
- return langMap ? langMap[key] || key : key;
36
- }
37
- /**
38
- * Translates a key and then interpolates placeholders in the format {placeholder}.
39
- * The method first resolves the base text through `translate()`. If the result is not a string,
40
- * it is returned unchanged. For string results, every placeholder wrapped in curly braces is matched,
41
- * the token name is trimmed, and the value is looked up in the `params` object.
42
- * When a matching param exists, its value is converted to a string and inserted into the translation.
43
- * Missing or `null` params are left in their original `{placeholder}` form so unresolved tokens stay visible.
44
- * @param {string} key The translation key.
45
- * @param {object} [params] Key-value map used for interpolation. Defaults to an empty object.
46
- * @returns {string} Localized string with interpolated params.
47
- * @example
48
- * // If the translation is:
49
- * // "personalSettings.settings.synchronization.checkbox.exportApprovedAbsence":
50
- * // "Exportuj schválené absencie do {calendar}"
51
- * this.localizer.translateWithParams(
52
- * 'personalSettings.settings.synchronization.checkbox.exportApprovedAbsence',
53
- * { calendar: 'Google kalendára' },
54
- * );
55
- * // Returns: 'Exportuj schválené absencie do Google kalendára'
56
- */
57
- translateWithParams(key, params = {}) {
58
- const translated = this.translate(key);
59
- if (typeof translated !== "string") return translated;
60
- return translated.replace(/\{([^{}]+)\}/g, (match, token) => {
61
- const value = params[token.trim()];
62
- return value === void 0 || value === null ? match : String(value);
19
+ const e2 = (_a = this.languages) == null ? void 0 : _a.get(this.currentLang);
20
+ return e2 && e2 && e2[t2] || t2;
21
+ }
22
+ translateWithParams(t2, e2 = {}) {
23
+ const n = this.translate(t2);
24
+ return "string" != typeof n ? n : n.replace(/\{([^{}]+)\}/g, (t3, n2) => {
25
+ const r = e2[n2.trim()];
26
+ return null == r ? t3 : String(r);
63
27
  });
64
28
  }
65
- /**
66
- * Translates a key into a localized string based on the provided count and pluralization type.
67
- * @param {string} key The base translation key to be used for fetching the localized string.
68
- * @param {number} [count] The count value used to determine the pluralization form. Defaults to 0.
69
- * @param {string} [type] The type of pluralization to use, such as 'cardinal' or 'ordinal'. Defaults to 'cardinal'.
70
- * @returns {string} The translated string, adapted to the pluralization rules and count.
71
- */
72
- translatePlural(key, count = 0, type = "cardinal") {
73
- const plural = new Intl.PluralRules(this.currentLang, { type });
74
- const k = `${key}.${plural.select(count)}`;
75
- const t = this.translate(k);
76
- if (t !== k) return t;
77
- return this.translate(`${key}.other`);
29
+ translatePlural(t2, e2 = 0, n = "cardinal") {
30
+ const r = `${t2}.${new Intl.PluralRules(this.currentLang, { type: n }).select(e2)}`, a = this.translate(r);
31
+ return a !== r ? a : this.translate(`${t2}.other`);
78
32
  }
79
- /**
80
- * Formats a number according to the specified locale and formatting options.
81
- * @param {number} number The numeric value to format.
82
- * @param {object} options An object containing formatting options for the number.
83
- * @returns {string} The formatted number as a string.
84
- */
85
- formatNumber(number, options) {
86
- return new Intl.NumberFormat(this.currentLang, options).format(number);
33
+ formatNumber(t2, e2) {
34
+ return new Intl.NumberFormat(this.currentLang, e2).format(t2);
87
35
  }
88
- /**
89
- * Formats a given date based on the specified options and the current language setting.
90
- * @param {string|Date|number} date The date to format. Can be a Date object, a timestamp, or a date string.
91
- * @param {object} options The formatting options to customize the output, as supported by Intl.DateTimeFormat.
92
- * @returns {string} The formatted date string based on the specified options and current language.
93
- */
94
- formatDate(date, options) {
95
- return new Intl.DateTimeFormat(this.currentLang, options).format(new Date(date));
36
+ formatDate(t2, e2) {
37
+ return new Intl.DateTimeFormat(this.currentLang, e2).format(new Date(t2));
96
38
  }
97
- /**
98
- * Formats a relative time string based on a given language, value, unit, and formatting options.
99
- * @param {string} lang The language to use for formatting. Defaults to `this.currentLang` if not provided.
100
- * @param {number} value The numerical value to format, representing the time difference.
101
- * @param {string} [unit] The unit of time to use (e.g., "second", "minute", "hour", "day", "week", "month", "year").
102
- * @param {object} [options] An object containing formatting options, such as the style for the numeric representation.
103
- * @returns {string} The formatted relative time string in the specified language.
104
- */
105
- relativeTime(lang, value = 0, unit = "day", options = { numeric: "auto" }) {
106
- lang = lang || this.currentLang;
107
- return new Intl.RelativeTimeFormat(lang, options).format(value, unit);
39
+ relativeTime(t2, e2 = 0, n = "day", r = { numeric: "auto" }) {
40
+ return t2 = t2 || this.currentLang, new Intl.RelativeTimeFormat(t2, r).format(e2, n);
108
41
  }
109
42
  }
110
- function registerTranslation(...translation) {
111
- translation.forEach((t) => {
112
- if (!t.code) {
113
- console.error("Translation object is missing 'code' property:", t);
114
- return;
115
- }
116
- const code = t.code.toLowerCase();
117
- if (window.translations.has(code)) {
118
- window.translations.set(code, { ...window.translations.get(code), ...t });
119
- } else {
120
- window.translations.set(code, t);
121
- }
122
- });
123
- }
124
- class Localizer extends LocalizerDefault {
125
- constructor(element) {
126
- super(element);
127
- }
128
- static registerTranslation(...translation) {
129
- registerTranslation(...translation);
43
+ class e extends t {
44
+ constructor(t2) {
45
+ super(t2);
46
+ }
47
+ static registerTranslation(...t2) {
48
+ !(function(...t3) {
49
+ t3.forEach((t4) => {
50
+ if (!t4.code) return void console.error("Translation object is missing 'code' property:", t4);
51
+ const e2 = t4.code.toLowerCase();
52
+ window.translations.has(e2) ? window.translations.set(e2, { ...window.translations.get(e2), ...t4 }) : window.translations.set(e2, t4);
53
+ });
54
+ })(...t2);
130
55
  }
131
56
  }
132
57
  export {
133
- Localizer
58
+ e as Localizer
134
59
  };
135
60
  //# sourceMappingURL=localize.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"localize.js","sources":["../packages/localize/localize.js","../packages/utils/localize.js"],"sourcesContent":["// export const translations = new Map();\n\nexport class LocalizerDefault {\n constructor(element) {\n this.element = element;\n\n this.lang = this.element?.lang || document.documentElement?.lang || 'en-GB';\n this.dir = this.element?.dir || document.documentElement?.dir || 'ltr';\n this.currentLang = 'en-GB';\n\n this.setLanguage();\n }\n\n get languages() {\n return window.translations;\n }\n\n // Nastavenie aktuálneho jazyka\n setLanguage() {\n if (this.languages?.has(this.lang)) {\n this.currentLang = this.lang;\n } else {\n console.error(`Language \"${this.lang}\" not loaded.`);\n }\n }\n\n convertLangCode = (lang) => lang.replace(\"-\", \"_\").replace(/_([a-z]{2})$/, (_, code) => `_${code.toUpperCase()}`);\n\n /**\n * Translates a given translation key based on the currently selected language.\n * @param {string} key The key representing the text to be translated.\n * @returns {string} The translated text if available; otherwise, returns the original key.\n */\n translate(key) {\n const langMap = this.languages?.get(this.currentLang);\n if (!langMap) return key;\n return langMap ? langMap[key] || key : key;\n }\n\n /**\n * Translates a key and then interpolates placeholders in the format {placeholder}.\n * The method first resolves the base text through `translate()`. If the result is not a string,\n * it is returned unchanged. For string results, every placeholder wrapped in curly braces is matched,\n * the token name is trimmed, and the value is looked up in the `params` object.\n * When a matching param exists, its value is converted to a string and inserted into the translation.\n * Missing or `null` params are left in their original `{placeholder}` form so unresolved tokens stay visible.\n * @param {string} key The translation key.\n * @param {object} [params] Key-value map used for interpolation. Defaults to an empty object.\n * @returns {string} Localized string with interpolated params.\n * @example\n * // If the translation is:\n * // \"personalSettings.settings.synchronization.checkbox.exportApprovedAbsence\":\n * // \"Exportuj schválené absencie do {calendar}\"\n * this.localizer.translateWithParams(\n * 'personalSettings.settings.synchronization.checkbox.exportApprovedAbsence',\n * { calendar: 'Google kalendára' },\n * );\n * // Returns: 'Exportuj schválené absencie do Google kalendára'\n */\n translateWithParams(key, params = {}) {\n const translated = this.translate(key);\n\n if (typeof translated !== 'string') return translated;\n\n return translated.replace(/\\{([^{}]+)\\}/g, (match, token) => {\n const value = params[token.trim()];\n return value === undefined || value === null ? match : String(value);\n });\n }\n\n /**\n * Translates a key into a localized string based on the provided count and pluralization type.\n * @param {string} key The base translation key to be used for fetching the localized string.\n * @param {number} [count] The count value used to determine the pluralization form. Defaults to 0.\n * @param {string} [type] The type of pluralization to use, such as 'cardinal' or 'ordinal'. Defaults to 'cardinal'.\n * @returns {string} The translated string, adapted to the pluralization rules and count.\n */\n translatePlural(key, count = 0, type = 'cardinal') {\n const plural = new Intl.PluralRules(this.currentLang, { type });\n const k = `${key}.${plural.select(count)}`;\n const t = this.translate(k);\n if (t !== k) return t;\n return this.translate(`${key}.other`);\n }\n\n /**\n * Formats a number according to the specified locale and formatting options.\n * @param {number} number The numeric value to format.\n * @param {object} options An object containing formatting options for the number.\n * @returns {string} The formatted number as a string.\n */\n formatNumber(number, options) {\n return new Intl.NumberFormat(this.currentLang, options).format(number);\n }\n\n /**\n * Formats a given date based on the specified options and the current language setting.\n * @param {string|Date|number} date The date to format. Can be a Date object, a timestamp, or a date string.\n * @param {object} options The formatting options to customize the output, as supported by Intl.DateTimeFormat.\n * @returns {string} The formatted date string based on the specified options and current language.\n */\n formatDate(date, options) {\n return new Intl.DateTimeFormat(this.currentLang, options).format(new Date(date));\n }\n\n /**\n * Formats a relative time string based on a given language, value, unit, and formatting options.\n * @param {string} lang The language to use for formatting. Defaults to `this.currentLang` if not provided.\n * @param {number} value The numerical value to format, representing the time difference.\n * @param {string} [unit] The unit of time to use (e.g., \"second\", \"minute\", \"hour\", \"day\", \"week\", \"month\", \"year\").\n * @param {object} [options] An object containing formatting options, such as the style for the numeric representation.\n * @returns {string} The formatted relative time string in the specified language.\n */\n relativeTime(lang, value = 0, unit = 'day', options = { numeric: 'auto' }) {\n lang = lang || this.currentLang;\n return new Intl.RelativeTimeFormat(lang, options).format(value, unit);\n }\n}\n\nexport function registerTranslation(...translation) {\n translation.forEach((t) => {\n if (!t.code) {\n console.error(\"Translation object is missing 'code' property:\", t);\n return;\n }\n\n const code = t.code.toLowerCase();\n if (window.translations.has(code)) {\n window.translations.set(code, { ...window.translations.get(code), ...t });\n } else {\n window.translations.set(code, t);\n }\n });\n}\n","import { LocalizerDefault, registerTranslation } from '../localize/localize.js';\n\nexport class Localizer extends LocalizerDefault {\n constructor(element) {\n super(element);\n }\n static registerTranslation(...translation) {\n registerTranslation(...translation);\n }\n}\n"],"names":[],"mappings":";;;AAEO,MAAM,iBAAiB;AAAA,EAC1B,YAAY,SAAS;AAuBrB,2CAAkB,CAAC,SAAS,KAAK,QAAQ,KAAK,GAAG,EAAE,QAAQ,gBAAgB,CAAC,GAAG,SAAS,IAAI,KAAK,YAAW,CAAE,EAAE;AA1BpH;AAIQ,SAAK,UAAU;AAEf,SAAK,SAAO,UAAK,YAAL,mBAAc,WAAQ,cAAS,oBAAT,mBAA0B,SAAQ;AACpE,SAAK,QAAM,UAAK,YAAL,mBAAc,UAAO,cAAS,oBAAT,mBAA0B,QAAO;AACjE,SAAK,cAAc;AAEnB,SAAK,YAAW;AAAA,EACpB;AAAA,EAEA,IAAI,YAAY;AACZ,WAAO,OAAO;AAAA,EAClB;AAAA;AAAA,EAGA,cAAc;AAlBlB;AAmBQ,SAAI,UAAK,cAAL,mBAAgB,IAAI,KAAK,OAAO;AAChC,WAAK,cAAc,KAAK;AAAA,IAC5B,OAAO;AACH,cAAQ,MAAM,aAAa,KAAK,IAAI,eAAe;AAAA,IACvD;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,UAAU,KAAK;AAjCnB;AAkCQ,UAAM,WAAU,UAAK,cAAL,mBAAgB,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AAQ,GAAG,OAAO,OAAO,UAAU,EAAE,SAAS,UAAU;AACvE,WAAO,QAAQ,KAAK;AACpB,WAAO,IAAI,KAAK,mBAAmB,MAAM,OAAO,EAAE,OAAO,OAAO,IAAI;AAAA,EACxE;AACJ;AAEO,SAAS,uBAAuB,aAAa;AAChD,cAAY,QAAQ,CAAC,MAAM;AACvB,QAAI,CAAC,EAAE,MAAM;AACT,cAAQ,MAAM,kDAAkD,CAAC;AACjE;AAAA,IACJ;AAEA,UAAM,OAAO,EAAE,KAAK,YAAW;AAC/B,QAAI,OAAO,aAAa,IAAI,IAAI,GAAG;AAC/B,aAAO,aAAa,IAAI,MAAM,EAAE,GAAG,OAAO,aAAa,IAAI,IAAI,GAAG,GAAG,EAAC,CAAE;AAAA,IAC5E,OAAO;AACH,aAAO,aAAa,IAAI,MAAM,CAAC;AAAA,IACnC;AAAA,EACJ,CAAC;AACL;ACnIO,MAAM,kBAAkB,iBAAiB;AAAA,EAC5C,YAAY,SAAS;AACjB,UAAM,OAAO;AAAA,EACjB;AAAA,EACA,OAAO,uBAAuB,aAAa;AACvC,wBAAoB,GAAG,WAAW;AAAA,EACtC;AACJ;"}
1
+ {"version":3,"file":"localize.js","sources":["../packages/localize/localize.js","../packages/utils/localize.js"],"sourcesContent":["// export const translations = new Map();\n\nexport class LocalizerDefault {\n constructor(element) {\n this.element = element;\n\n this.lang = this.element?.lang || document.documentElement?.lang || 'en-GB';\n this.dir = this.element?.dir || document.documentElement?.dir || 'ltr';\n this.currentLang = 'en-GB';\n\n this.setLanguage();\n }\n\n get languages() {\n return window.translations;\n }\n\n // Nastavenie aktuálneho jazyka\n setLanguage() {\n if (this.languages?.has(this.lang)) {\n this.currentLang = this.lang;\n } else {\n console.error(`Language \"${this.lang}\" not loaded.`);\n }\n }\n\n convertLangCode = (lang) => lang.replace(\"-\", \"_\").replace(/_([a-z]{2})$/, (_, code) => `_${code.toUpperCase()}`);\n\n /**\n * Translates a given translation key based on the currently selected language.\n * @param {string} key The key representing the text to be translated.\n * @returns {string} The translated text if available; otherwise, returns the original key.\n */\n translate(key) {\n const langMap = this.languages?.get(this.currentLang);\n if (!langMap) return key;\n return langMap ? langMap[key] || key : key;\n }\n\n /**\n * Translates a key and then interpolates placeholders in the format {placeholder}.\n * The method first resolves the base text through `translate()`. If the result is not a string,\n * it is returned unchanged. For string results, every placeholder wrapped in curly braces is matched,\n * the token name is trimmed, and the value is looked up in the `params` object.\n * When a matching param exists, its value is converted to a string and inserted into the translation.\n * Missing or `null` params are left in their original `{placeholder}` form so unresolved tokens stay visible.\n * @param {string} key The translation key.\n * @param {object} [params] Key-value map used for interpolation. Defaults to an empty object.\n * @returns {string} Localized string with interpolated params.\n * @example\n * // If the translation is:\n * // \"personalSettings.settings.synchronization.checkbox.exportApprovedAbsence\":\n * // \"Exportuj schválené absencie do {calendar}\"\n * this.localizer.translateWithParams(\n * 'personalSettings.settings.synchronization.checkbox.exportApprovedAbsence',\n * { calendar: 'Google kalendára' },\n * );\n * // Returns: 'Exportuj schválené absencie do Google kalendára'\n */\n translateWithParams(key, params = {}) {\n const translated = this.translate(key);\n\n if (typeof translated !== 'string') return translated;\n\n return translated.replace(/\\{([^{}]+)\\}/g, (match, token) => {\n const value = params[token.trim()];\n return value === undefined || value === null ? match : String(value);\n });\n }\n\n /**\n * Translates a key into a localized string based on the provided count and pluralization type.\n * @param {string} key The base translation key to be used for fetching the localized string.\n * @param {number} [count] The count value used to determine the pluralization form. Defaults to 0.\n * @param {string} [type] The type of pluralization to use, such as 'cardinal' or 'ordinal'. Defaults to 'cardinal'.\n * @returns {string} The translated string, adapted to the pluralization rules and count.\n */\n translatePlural(key, count = 0, type = 'cardinal') {\n const plural = new Intl.PluralRules(this.currentLang, { type });\n const k = `${key}.${plural.select(count)}`;\n const t = this.translate(k);\n if (t !== k) return t;\n return this.translate(`${key}.other`);\n }\n\n /**\n * Formats a number according to the specified locale and formatting options.\n * @param {number} number The numeric value to format.\n * @param {object} options An object containing formatting options for the number.\n * @returns {string} The formatted number as a string.\n */\n formatNumber(number, options) {\n return new Intl.NumberFormat(this.currentLang, options).format(number);\n }\n\n /**\n * Formats a given date based on the specified options and the current language setting.\n * @param {string|Date|number} date The date to format. Can be a Date object, a timestamp, or a date string.\n * @param {object} options The formatting options to customize the output, as supported by Intl.DateTimeFormat.\n * @returns {string} The formatted date string based on the specified options and current language.\n */\n formatDate(date, options) {\n return new Intl.DateTimeFormat(this.currentLang, options).format(new Date(date));\n }\n\n /**\n * Formats a relative time string based on a given language, value, unit, and formatting options.\n * @param {string} lang The language to use for formatting. Defaults to `this.currentLang` if not provided.\n * @param {number} value The numerical value to format, representing the time difference.\n * @param {string} [unit] The unit of time to use (e.g., \"second\", \"minute\", \"hour\", \"day\", \"week\", \"month\", \"year\").\n * @param {object} [options] An object containing formatting options, such as the style for the numeric representation.\n * @returns {string} The formatted relative time string in the specified language.\n */\n relativeTime(lang, value = 0, unit = 'day', options = { numeric: 'auto' }) {\n lang = lang || this.currentLang;\n return new Intl.RelativeTimeFormat(lang, options).format(value, unit);\n }\n}\n\nexport function registerTranslation(...translation) {\n translation.forEach((t) => {\n if (!t.code) {\n console.error(\"Translation object is missing 'code' property:\", t);\n return;\n }\n\n const code = t.code.toLowerCase();\n if (window.translations.has(code)) {\n window.translations.set(code, { ...window.translations.get(code), ...t });\n } else {\n window.translations.set(code, t);\n }\n });\n}\n","import { LocalizerDefault, registerTranslation } from '../localize/localize.js';\n\nexport class Localizer extends LocalizerDefault {\n constructor(element) {\n super(element);\n }\n static registerTranslation(...translation) {\n registerTranslation(...translation);\n }\n}\n"],"names":["LocalizerDefault","element","convertLangCode","lang","replace","_","code","toUpperCase","this","document","documentElement","dir","currentLang","setLanguage","languages","window","translations","has","console","error","key","langMap","get","params","translated","translate","match","token","value","trim","String","count","type","k","Intl","PluralRules","select","t","number","options","NumberFormat","format","date","DateTimeFormat","Date","unit","numeric","RelativeTimeFormat","Localizer","super","translation","forEach","toLowerCase","set","registerTranslation"],"mappings":";;;A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iB,GAAuBJ;EAC3B;AAAA;"}
@@ -23,6 +23,7 @@ import { default as WJElement } from '../wje-element/element.js';
23
23
  * @cssproperty [--wje-accordion-border-expanded=var(--wje-color-contrast-0)] - Border color of the expanded item wrapper.
24
24
  * @cssproperty [--wje-accordion-headline-color=var(--wje-color-contrast-11)] - Text color of the headline area.
25
25
  * @cssproperty [--wje-accordion-content-color=var(--wje-color-contrast-6)] - Text color of the expandable content area.
26
+ * @cssproperty [--wje-accordion-content-margin=0 var(--wje-spacing-small, 0.75rem) var(--wje-spacing-small, 0.75rem)] - Margin around the slotted expandable content.
26
27
  * @cssproperty [--wje-accordion-marker-rotate=0deg] - Rotation applied to the toggle marker icon.
27
28
  * // @fires wje-accordion-item:open - Dispatched when the item is expanded.
28
29
  * // @fires wje-accordion-item:close - Dispatched when the item is collapsed.
@@ -54,11 +55,11 @@ export default class AccordionItem extends WJElement {
54
55
  */
55
56
  afterDraw(): void;
56
57
  /**
57
- * Collapses the accordion item and updates the headline ARIA state.
58
+ * Collapses the accordion item, updates the headline ARIA state, and makes its content inert.
58
59
  */
59
60
  collapse(): void;
60
61
  /**
61
- * Expands the accordion item and updates the headline ARIA state.
62
+ * Expands the accordion item, updates the headline ARIA state, and makes its content interactive.
62
63
  */
63
64
  expand(): void;
64
65
  }
@@ -1,56 +1,29 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- const _Permissions = class _Permissions {
5
- /**
6
- * Sets the permission key for the Permissions utility.
7
- * The key is stored internally and defaults to 'permissions' if no value is provided.
8
- * @param {string} value The key to set for permissions. If no value is provided, the default is 'permissions'.
9
- */
10
- static set permissionKey(value) {
11
- _Permissions._permissionKey = value || "permissions";
4
+ const _s = class _s {
5
+ static set permissionKey(i) {
6
+ _s._permissionKey = i || "permissions";
12
7
  }
13
- /**
14
- * Retrieves the permission key used for accessing the permissions utility.
15
- * @returns {string} The permission key associated with the Permissions utility.
16
- */
17
8
  static get permissionKey() {
18
- return _Permissions._permissionKey;
9
+ return _s._permissionKey;
19
10
  }
20
- /**
21
- * Sets the permissions by storing them in the local storage.
22
- * @param {Array<string>} value The permissions array to be stored.
23
- */
24
- static set permissions(value) {
25
- window.localStorage.setItem(_Permissions.permissionKey, JSON.stringify(value));
11
+ static set permissions(i) {
12
+ window.localStorage.setItem(_s.permissionKey, JSON.stringify(i));
26
13
  }
27
- /**
28
- * Retrieves the list of permissions stored in the browser's local storage.
29
- * @returns {Array} An array of permissions. If no permissions are found, returns an empty array.
30
- */
31
14
  static get permissions() {
32
- return JSON.parse(window.localStorage.getItem(_Permissions.permissionKey)) || [];
15
+ return JSON.parse(window.localStorage.getItem(_s.permissionKey)) || [];
33
16
  }
34
- /**
35
- * Determines whether the specified key exists in the permissions list.
36
- * @param {string} key The key to check for existence in the permissions list.
37
- * @returns {boolean} Returns true if the key exists in the permissions list; otherwise, returns false.
38
- */
39
- static includesKey(key) {
40
- return _Permissions.permissions.includes(key);
17
+ static includesKey(i) {
18
+ return _s.permissions.includes(i);
41
19
  }
42
- /**
43
- * Checks if at least one of the given permissions is fulfilled, based on the permissions available in `Permissions`.
44
- * @param {Array<string>} permissions The list of permissions to check against the permissions available in `Permissions`.
45
- * @returns {boolean} Returns `true` if any of the given permissions match the permissions available in `Permissions`, otherwise returns `false`.
46
- */
47
- static isPermissionFulfilled(permissions) {
48
- return permissions.some((perm) => _Permissions.permissions.includes(perm));
20
+ static isPermissionFulfilled(i) {
21
+ return i.some((i2) => _s.permissions.includes(i2));
49
22
  }
50
23
  };
51
- __publicField(_Permissions, "_permissionKey", "permissions");
52
- let Permissions = _Permissions;
24
+ __publicField(_s, "_permissionKey", "permissions");
25
+ let s = _s;
53
26
  export {
54
- Permissions
27
+ s as Permissions
55
28
  };
56
29
  //# sourceMappingURL=permissions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"permissions.js","sources":["../packages/utils/permissions.js"],"sourcesContent":["/**\n * Permissions is a utility class for managing permissions.\n * It allows setting, retrieving, and checking permissions stored in the browser's local storage.\n */\nexport class Permissions {\n static _permissionKey = 'permissions';\n\n /**\n * Sets the permission key for the Permissions utility.\n * The key is stored internally and defaults to 'permissions' if no value is provided.\n * @param {string} value The key to set for permissions. If no value is provided, the default is 'permissions'.\n */\n static set permissionKey(value) {\n Permissions._permissionKey = value || 'permissions';\n }\n\n /**\n * Retrieves the permission key used for accessing the permissions utility.\n * @returns {string} The permission key associated with the Permissions utility.\n */\n static get permissionKey() {\n return Permissions._permissionKey;\n }\n\n /**\n * Sets the permissions by storing them in the local storage.\n * @param {Array<string>} value The permissions array to be stored.\n */\n static set permissions(value) {\n window.localStorage.setItem(Permissions.permissionKey, JSON.stringify(value));\n }\n\n /**\n * Retrieves the list of permissions stored in the browser's local storage.\n * @returns {Array} An array of permissions. If no permissions are found, returns an empty array.\n */\n static get permissions() {\n return JSON.parse(window.localStorage.getItem(Permissions.permissionKey)) || [];\n }\n\n /**\n * Determines whether the specified key exists in the permissions list.\n * @param {string} key The key to check for existence in the permissions list.\n * @returns {boolean} Returns true if the key exists in the permissions list; otherwise, returns false.\n */\n static includesKey(key) {\n return Permissions.permissions.includes(key);\n }\n\n /**\n * Checks if at least one of the given permissions is fulfilled, based on the permissions available in `Permissions`.\n * @param {Array<string>} permissions The list of permissions to check against the permissions available in `Permissions`.\n * @returns {boolean} Returns `true` if any of the given permissions match the permissions available in `Permissions`, otherwise returns `false`.\n */\n static isPermissionFulfilled(permissions) {\n return permissions.some((perm) => Permissions.permissions.includes(perm));\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,eAAN,MAAM,aAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQrB,WAAW,cAAc,OAAO;AAC5B,iBAAY,iBAAiB,SAAS;AAAA,EAC1C;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,WAAW,gBAAgB;AACvB,WAAO,aAAY;AAAA,EACvB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,WAAW,YAAY,OAAO;AAC1B,WAAO,aAAa,QAAQ,aAAY,eAAe,KAAK,UAAU,KAAK,CAAC;AAAA,EAChF;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,WAAW,cAAc;AACrB,WAAO,KAAK,MAAM,OAAO,aAAa,QAAQ,aAAY,aAAa,CAAC,KAAK,CAAA;AAAA,EACjF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,YAAY,KAAK;AACpB,WAAO,aAAY,YAAY,SAAS,GAAG;AAAA,EAC/C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,sBAAsB,aAAa;AACtC,WAAO,YAAY,KAAK,CAAC,SAAS,aAAY,YAAY,SAAS,IAAI,CAAC;AAAA,EAC5E;AACJ;AApDI,cADS,cACF,kBAAiB;AADrB,IAAM,cAAN;"}
1
+ {"version":3,"file":"permissions.js","sources":["../packages/utils/permissions.js"],"sourcesContent":["/**\n * Permissions is a utility class for managing permissions.\n * It allows setting, retrieving, and checking permissions stored in the browser's local storage.\n */\nexport class Permissions {\n static _permissionKey = 'permissions';\n\n /**\n * Sets the permission key for the Permissions utility.\n * The key is stored internally and defaults to 'permissions' if no value is provided.\n * @param {string} value The key to set for permissions. If no value is provided, the default is 'permissions'.\n */\n static set permissionKey(value) {\n Permissions._permissionKey = value || 'permissions';\n }\n\n /**\n * Retrieves the permission key used for accessing the permissions utility.\n * @returns {string} The permission key associated with the Permissions utility.\n */\n static get permissionKey() {\n return Permissions._permissionKey;\n }\n\n /**\n * Sets the permissions by storing them in the local storage.\n * @param {Array<string>} value The permissions array to be stored.\n */\n static set permissions(value) {\n window.localStorage.setItem(Permissions.permissionKey, JSON.stringify(value));\n }\n\n /**\n * Retrieves the list of permissions stored in the browser's local storage.\n * @returns {Array} An array of permissions. If no permissions are found, returns an empty array.\n */\n static get permissions() {\n return JSON.parse(window.localStorage.getItem(Permissions.permissionKey)) || [];\n }\n\n /**\n * Determines whether the specified key exists in the permissions list.\n * @param {string} key The key to check for existence in the permissions list.\n * @returns {boolean} Returns true if the key exists in the permissions list; otherwise, returns false.\n */\n static includesKey(key) {\n return Permissions.permissions.includes(key);\n }\n\n /**\n * Checks if at least one of the given permissions is fulfilled, based on the permissions available in `Permissions`.\n * @param {Array<string>} permissions The list of permissions to check against the permissions available in `Permissions`.\n * @returns {boolean} Returns `true` if any of the given permissions match the permissions available in `Permissions`, otherwise returns `false`.\n */\n static isPermissionFulfilled(permissions) {\n return permissions.some((perm) => Permissions.permissions.includes(perm));\n }\n}\n"],"names":["Permissions","value","_permissionKey","permissionKey","window","localStorage","setItem","JSON","stringify","permissions","parse","getItem","key","includes","some","perm","static"],"mappings":";;;AAIO,MAAMA,KAAN,MAAMA,GAAAA;AAAAA,EAQT,WAAA,cAAyBC,GAAAA;AACrBD,OAAYE,iBAAiBD,KAAS;AAAA,EAC1C;AAAA,EAMA,WAAA,gBAAWE;AACP,WAAOH,GAAYE;AAAAA,EACvB;AAAA,EAMA,WAAA,YAAuBD,GAAAA;AACnBG,WAAOC,aAAaC,QAAQN,GAAYG,eAAeI,KAAKC,UAAUP,CAAAA,CAAAA;AAAAA,EAC1E;AAAA,EAMA,WAAA,cAAWQ;AACP,WAAOF,KAAKG,MAAMN,OAAOC,aAAaM,QAAQX,GAAYG,aAAAA,CAAAA,KAAmB,CAAA;AAAA,EACjF;AAAA,EAOA,OAAA,YAAmBS,GAAAA;AACf,WAAOZ,GAAYS,YAAYI,SAASD,CAAAA;AAAAA,EAC5C;AAAA,EAOA,OAAA,sBAA6BH,GAAAA;AACzB,WAAOA,EAAYK,KAAMC,CAAAA,OAASf,GAAYS,YAAYI,SAASE;EACvE;AAAA;AAnDAC,cADShB,IACTgB,kBAAwB;AADrB,IAAMhB,IAAN;"}