@livenetworks/ashlar 2.0.7 → 2.0.9

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 (213) hide show
  1. package/LICENSE +641 -641
  2. package/components/COMPONENTS.md +1116 -1116
  3. package/components/index.js +81 -81
  4. package/components/ln-accordion/ln-accordion-dev.scss +8 -8
  5. package/components/ln-accordion/ln-accordion.js +1 -1
  6. package/components/ln-accordion/ln-accordion.schema.json +30 -30
  7. package/components/ln-ajax/ln-ajax-dev.scss +8 -8
  8. package/components/ln-ajax/ln-ajax.js +1 -1
  9. package/components/ln-ajax/ln-ajax.schema.json +30 -30
  10. package/components/ln-api-connector/ln-api-connector.js +1 -1
  11. package/components/ln-api-connector/ln-api-connector.schema.json +9 -0
  12. package/components/ln-api-connector/src/ln-api-connector.js +2 -0
  13. package/components/ln-api-queue/ln-api-queue.js +1 -1
  14. package/components/ln-api-queue/ln-api-queue.schema.json +34 -34
  15. package/components/ln-api-queue/src/ln-api-queue.js +3 -13
  16. package/components/ln-autoresize/ln-autoresize-dev.scss +8 -8
  17. package/components/ln-autoresize/ln-autoresize.js +1 -1
  18. package/components/ln-autoresize/ln-autoresize.schema.json +22 -22
  19. package/components/ln-autosave/ln-autosave-dev.scss +13 -13
  20. package/components/ln-autosave/ln-autosave.js +1 -1
  21. package/components/ln-autosave/ln-autosave.schema.json +48 -48
  22. package/components/ln-autosave/src/autosave-model.js +34 -34
  23. package/components/ln-chart/ln-chart.js +1 -1
  24. package/components/ln-chart/ln-chart.schema.json +146 -146
  25. package/components/ln-chart/src/chart-model.js +154 -154
  26. package/components/ln-circular-progress/ln-circular-progress.js +1 -1
  27. package/components/ln-circular-progress/ln-circular-progress.schema.json +42 -42
  28. package/components/ln-confirm/ln-confirm-dev.scss +24 -24
  29. package/components/ln-confirm/ln-confirm.js +1 -1
  30. package/components/ln-confirm/ln-confirm.schema.json +66 -66
  31. package/components/ln-confirm/src/ln-confirm.js +178 -178
  32. package/components/ln-core/attrs.js +13 -0
  33. package/components/ln-core/crypto.js +286 -265
  34. package/components/ln-core/dom.js +115 -115
  35. package/components/ln-core/form.js +146 -136
  36. package/components/ln-core/helpers.js +33 -33
  37. package/components/ln-core/http.js +48 -48
  38. package/components/ln-core/index.js +1 -1
  39. package/components/ln-core/lifecycle.js +5 -0
  40. package/components/ln-core/ln-core.schema.json +3 -2
  41. package/components/ln-core/locale.js +55 -55
  42. package/components/ln-core/matching.js +78 -78
  43. package/components/ln-core/number.js +125 -125
  44. package/components/ln-core/template.js +206 -206
  45. package/components/ln-couchdb-connector/ln-couchdb-connector.js +1 -1
  46. package/components/ln-couchdb-connector/ln-couchdb-connector.schema.json +50 -50
  47. package/components/ln-couchdb-connector/src/ln-couchdb-connector.js +1 -0
  48. package/components/ln-data-coordinator/README.md +9 -38
  49. package/components/ln-data-coordinator/ln-data-coordinator-dev.scss +8 -8
  50. package/components/ln-data-coordinator/ln-data-coordinator.js +1 -1
  51. package/components/ln-data-coordinator/ln-data-coordinator.schema.json +16 -16
  52. package/components/ln-data-coordinator/src/data-read-policy.js +0 -7
  53. package/components/ln-data-coordinator/src/ln-data-coordinator.js +432 -1308
  54. package/components/ln-data-store/ln-data-store-dev.scss +13 -13
  55. package/components/ln-data-store/ln-data-store.js +1 -1
  56. package/components/ln-data-store/ln-data-store.schema.json +84 -84
  57. package/components/ln-data-store/src/data-store-model.js +184 -184
  58. package/components/ln-data-store/src/ln-data-store.js +1 -1
  59. package/components/ln-date/ln-date.js +1 -1
  60. package/components/ln-date/ln-date.schema.json +92 -92
  61. package/components/ln-date/src/date-model.js +186 -186
  62. package/components/ln-debug/ln-debug.js +1 -1
  63. package/components/ln-debug/ln-debug.schema.json +28 -28
  64. package/components/ln-debug/src/console-sink.js +19 -19
  65. package/components/ln-debug/src/gate.js +95 -95
  66. package/components/ln-debug/src/generated-attributes.js +4 -2
  67. package/components/ln-dropdown/ln-dropdown-dev.scss +13 -13
  68. package/components/ln-dropdown/ln-dropdown.js +1 -1
  69. package/components/ln-dropdown/ln-dropdown.schema.json +90 -90
  70. package/components/ln-editor/ln-editor.js +1 -1
  71. package/components/ln-editor/ln-editor.schema.json +58 -58
  72. package/components/ln-external-links/ln-external-links.js +1 -1
  73. package/components/ln-external-links/ln-external-links.schema.json +18 -18
  74. package/components/ln-fill/ln-fill.js +1 -1
  75. package/components/ln-fill/ln-fill.schema.json +23 -23
  76. package/components/ln-filter/ln-filter.js +1 -1
  77. package/components/ln-filter/ln-filter.schema.json +153 -153
  78. package/components/ln-filter/src/filter-model.js +185 -185
  79. package/components/ln-form/ln-form-dev.scss +8 -8
  80. package/components/ln-form/ln-form.js +1 -1
  81. package/components/ln-form/ln-form.schema.json +6 -0
  82. package/components/ln-form/src/ln-form.js +21 -0
  83. package/components/ln-http/ln-http.js +1 -1
  84. package/components/ln-http/ln-http.schema.json +6 -6
  85. package/components/ln-icon/ln-icon.schema.json +6 -6
  86. package/components/ln-include/ln-include.js +1 -1
  87. package/components/ln-include/ln-include.schema.json +23 -23
  88. package/components/ln-key/ln-key-dev.scss +18 -18
  89. package/components/ln-key/ln-key.js +1 -1
  90. package/components/ln-key/ln-key.schema.json +56 -56
  91. package/components/ln-key/src/ln-key.js +10 -10
  92. package/components/ln-link/ln-link-dev.scss +8 -8
  93. package/components/ln-link/ln-link.js +1 -1
  94. package/components/ln-link/ln-link.schema.json +22 -22
  95. package/components/ln-list/README.md +152 -152
  96. package/components/ln-list/ln-list-dev.scss +8 -8
  97. package/components/ln-list/ln-list.js +1 -1
  98. package/components/ln-list/ln-list.schema.json +166 -166
  99. package/components/ln-modal/ln-modal.js +1 -1
  100. package/components/ln-modal/ln-modal.schema.json +65 -65
  101. package/components/ln-nav/ln-nav.js +1 -1
  102. package/components/ln-nav/ln-nav.schema.json +25 -25
  103. package/components/ln-number/ln-number.js +1 -1
  104. package/components/ln-number/ln-number.schema.json +63 -63
  105. package/components/ln-number/src/ln-number.js +26 -0
  106. package/components/ln-number/src/number-model.js +31 -31
  107. package/components/ln-obfuscator/README.md +60 -60
  108. package/components/ln-obfuscator/ln-obfuscator.js +1 -1
  109. package/components/ln-obfuscator/ln-obfuscator.schema.json +49 -49
  110. package/components/ln-obfuscator/src/ln-obfuscator.js +159 -159
  111. package/components/ln-obfuscator/src/obfuscator-model.js +250 -250
  112. package/components/ln-options/ln-options.js +1 -1
  113. package/components/ln-options/ln-options.schema.json +6 -0
  114. package/components/ln-options/src/ln-options.js +4 -4
  115. package/components/ln-persist/README.md +151 -151
  116. package/components/ln-persist/ln-persist.js +1 -1
  117. package/components/ln-persist/ln-persist.schema.json +28 -28
  118. package/components/ln-persist/src/ln-persist.js +83 -83
  119. package/components/ln-picklist/README.md +230 -230
  120. package/components/ln-picklist/ln-picklist-dev.scss +22 -22
  121. package/components/ln-picklist/ln-picklist.js +1 -1
  122. package/components/ln-picklist/ln-picklist.schema.json +49 -49
  123. package/components/ln-picklist/src/ln-picklist.js +228 -228
  124. package/components/ln-popover/ln-popover-dev.scss +13 -13
  125. package/components/ln-popover/ln-popover.js +1 -1
  126. package/components/ln-popover/ln-popover.schema.json +82 -82
  127. package/components/ln-progress/ln-progress-dev.scss +8 -8
  128. package/components/ln-progress/ln-progress.js +1 -1
  129. package/components/ln-progress/ln-progress.schema.json +40 -40
  130. package/components/ln-router/ln-router.js +1 -1
  131. package/components/ln-router/ln-router.schema.json +76 -76
  132. package/components/ln-scroll/README.md +45 -45
  133. package/components/ln-scroll/ln-scroll.js +1 -1
  134. package/components/ln-scroll/ln-scroll.schema.json +85 -85
  135. package/components/ln-scroll/src/ln-scroll.js +150 -150
  136. package/components/ln-search/README.md +188 -188
  137. package/components/ln-search/ln-search.js +1 -1
  138. package/components/ln-search/ln-search.schema.json +103 -103
  139. package/components/ln-slug/ln-slug.js +1 -1
  140. package/components/ln-slug/ln-slug.schema.json +23 -23
  141. package/components/ln-slug/src/ln-slug.js +25 -1
  142. package/components/ln-sort/ln-sort.js +1 -1
  143. package/components/ln-sort/ln-sort.schema.json +104 -104
  144. package/components/ln-sort/src/ln-sort.js +321 -321
  145. package/components/ln-sort/src/sort-model.js +117 -117
  146. package/components/ln-sortable/ln-sortable-dev.scss +13 -13
  147. package/components/ln-sortable/ln-sortable.js +1 -1
  148. package/components/ln-sortable/ln-sortable.schema.json +36 -36
  149. package/components/ln-stat/ln-stat-dev.scss +8 -8
  150. package/components/ln-stat/ln-stat.js +1 -1
  151. package/components/ln-stat/ln-stat.schema.json +32 -32
  152. package/components/ln-stat/src/stat-model.js +28 -28
  153. package/components/ln-table/ln-table.js +1 -1
  154. package/components/ln-table/ln-table.schema.json +211 -211
  155. package/components/ln-table/src/table-model.js +98 -98
  156. package/components/ln-table-coordinator/ln-table-coordinator.js +1 -1
  157. package/components/ln-table-coordinator/ln-table-coordinator.schema.json +93 -93
  158. package/components/ln-tabs/ln-tabs.js +1 -1
  159. package/components/ln-tabs/ln-tabs.schema.json +75 -75
  160. package/components/ln-tabs/src/ln-tabs.js +208 -208
  161. package/components/ln-tabs/src/tabs-model.js +82 -82
  162. package/components/ln-time/ln-time-dev.scss +13 -13
  163. package/components/ln-time/ln-time.js +1 -1
  164. package/components/ln-time/ln-time.schema.json +38 -38
  165. package/components/ln-toast/ln-toast.js +1 -1
  166. package/components/ln-toast/ln-toast.schema.json +65 -65
  167. package/components/ln-toggle/ln-toggle.js +1 -1
  168. package/components/ln-toggle/ln-toggle.schema.json +52 -52
  169. package/components/ln-tooltip/ln-tooltip.js +1 -1
  170. package/components/ln-tooltip/ln-tooltip.schema.json +86 -86
  171. package/components/ln-translations/ln-translations.js +1 -1
  172. package/components/ln-translations/ln-translations.schema.json +120 -120
  173. package/components/ln-ui-coordinator/README.md +62 -62
  174. package/components/ln-ui-coordinator/ln-ui-coordinator.js +1 -1
  175. package/components/ln-ui-coordinator/ln-ui-coordinator.schema.json +28 -28
  176. package/components/ln-ui-coordinator/src/ln-ui-coordinator.js +140 -140
  177. package/components/ln-upload/ln-upload.js +1 -1
  178. package/components/ln-upload/ln-upload.schema.json +193 -193
  179. package/components/ln-upload/src/upload-model.js +78 -78
  180. package/components/ln-validate/ln-validate.js +1 -1
  181. package/components/ln-validate/ln-validate.schema.json +50 -50
  182. package/components/ln-validate/src/validate-model.js +64 -64
  183. package/components/ln-websocket-connector/README.md +166 -166
  184. package/components/ln-websocket-connector/ln-websocket-connector.js +1 -1
  185. package/components/ln-websocket-connector/ln-websocket-connector.schema.json +29 -29
  186. package/components/ln-websocket-connector/src/ln-websocket-connector.js +283 -279
  187. package/ln-ashlar.html-data.json +15 -8
  188. package/package.json +85 -84
  189. package/theme/brand.css +73 -73
  190. package/theme/components/_confirm.scss +6 -6
  191. package/theme/components/_picklist.scss +3 -3
  192. package/theme/config/_palette.scss +274 -274
  193. package/theme/config/_theme.scss +292 -292
  194. package/theme/config/_tokens.scss +285 -285
  195. package/theme/config/mixins/_index.scss +62 -62
  196. package/theme/config/mixins/_picklist.scss +66 -66
  197. package/theme/ln-ashlar-dev.scss +66 -66
  198. package/theme/ln-ashlar-landing.scss +56 -56
  199. package/theme/ln-ashlar-theme.scss +63 -63
  200. package/theme/presentation/_bento.scss +151 -151
  201. package/theme/presentation/_cta.scss +111 -111
  202. package/theme/presentation/_effects.scss +216 -216
  203. package/theme/presentation/_features.scss +108 -108
  204. package/theme/presentation/_footer.scss +129 -129
  205. package/theme/presentation/_hero.scss +158 -158
  206. package/theme/presentation/_layout.scss +170 -170
  207. package/theme/presentation/_navbar.scss +140 -140
  208. package/theme/presentation/_pricing.scss +262 -262
  209. package/theme/presentation/_stats.scss +87 -87
  210. package/theme/presentation/_testimonials.scss +124 -124
  211. package/theme/presentation/_tokens.scss +39 -39
  212. package/theme/presentation/_typography.scss +163 -163
  213. package/web-types.json +26 -12
@@ -1,184 +1,184 @@
1
- import { compareValues, detectValueType } from '../../ln-core/compare.js';
2
- import { matchesFilterValues, matchesSearchTokens, tokenizeSearchQuery } from '../../ln-core/matching.js';
3
-
4
- /**
5
- * Sorts an array of record objects by field and direction using pure core comparison.
6
- * @param {Array<Record<string, any>>} records
7
- * @param {{ field?: string, direction?: string } | null} [sort]
8
- * @param {Intl.Collator} [collator]
9
- * @returns {Array<Record<string, any>>}
10
- */
11
- export function sortRecords(records, sort, collator) {
12
- if (!Array.isArray(records) || !sort || !sort.field) return records;
13
- const { field, direction } = sort;
14
- const desc = direction === 'desc';
15
-
16
- // Lock the value type once for the entire sort operation (per Doctrinal / compare.js rules)
17
- const sampleValues = records.map(r => (r ? r[field] : undefined));
18
- const valueType = detectValueType(sampleValues);
19
-
20
- return [...records].sort((a, b) => {
21
- const va = a ? a[field] : undefined;
22
- const vb = b ? b[field] : undefined;
23
-
24
- const result = compareValues(va, vb, valueType, collator);
25
- return desc ? -result : result;
26
- });
27
- }
28
-
29
- /**
30
- * Filters an array of records against a dictionary of active filter arrays.
31
- * Reuses matchesFilterValues from ln-core/matching (AND across fields, OR within field).
32
- * @param {Array<Record<string, any>>} records
33
- * @param {Record<string, Array<any>>} filters
34
- * @returns {Array<Record<string, any>>}
35
- */
36
- export function filterRecords(records, filters) {
37
- if (!Array.isArray(records) || !filters || typeof filters !== 'object') return records;
38
-
39
- const keys = Object.keys(filters).filter(k => Array.isArray(filters[k]) && filters[k].length > 0);
40
- if (!keys.length) return records;
41
-
42
- return records.filter(record => {
43
- if (!record) return false;
44
- return keys.every(field => matchesFilterValues(record[field], filters[field]));
45
- });
46
- }
47
-
48
- /**
49
- * Searches records across specified fields using ln-core/matching tokenization and matching.
50
- * @param {Array<Record<string, any>>} records
51
- * @param {string} query
52
- * @param {string[]} searchFields
53
- * @returns {Array<Record<string, any>>}
54
- */
55
- export function searchRecords(records, query, searchFields) {
56
- if (!Array.isArray(records) || !query || !searchFields || !searchFields.length) return records;
57
-
58
- const tokens = tokenizeSearchQuery(query);
59
- if (!tokens.length) return records;
60
-
61
- return records.filter(record => {
62
- if (!record) return false;
63
- return tokens.every(token =>
64
- searchFields.some(field => {
65
- const val = record[field];
66
- return val != null && matchesSearchTokens(String(val), [token]);
67
- })
68
- );
69
- });
70
- }
71
-
72
- /**
73
- * Computes aggregates (count, sum, avg) on a specific field across records.
74
- * @param {Array<Record<string, any>>} records
75
- * @param {string} field
76
- * @param {'count' | 'sum' | 'avg'} fn
77
- * @returns {number}
78
- */
79
- export function aggregateRecords(records, field, fn) {
80
- if (!Array.isArray(records) || !records.length) return 0;
81
- if (fn === 'count') return records.length;
82
-
83
- const numbers = records
84
- .map(r => (r && r[field] != null ? parseFloat(r[field]) : NaN))
85
- .filter(v => Number.isFinite(v));
86
-
87
- const sum = numbers.reduce((a, b) => a + b, 0);
88
-
89
- if (fn === 'sum') return sum;
90
- if (fn === 'avg') return numbers.length ? sum / numbers.length : 0;
91
- return 0;
92
- }
93
-
94
- /**
95
- * Executes full in-memory query evaluation: filter -> search -> sort -> slice.
96
- * @param {Array<Record<string, any>>} records
97
- * @param {{ filters?: Record<string, any[]>, search?: string, sort?: { field?: string, direction?: string }, offset?: number, limit?: number }} [options={}]
98
- * @param {string[]} [searchFields=[]]
99
- * @param {Intl.Collator} [collator]
100
- * @returns {{ records: Array<Record<string, any>>, total: number, filtered: number }}
101
- */
102
- export function queryRecords(records, options = {}, searchFields = [], collator) {
103
- if (!Array.isArray(records)) {
104
- return { records: [], total: 0, filtered: 0 };
105
- }
106
-
107
- const total = records.length;
108
- let result = records;
109
-
110
- if (options.filters) {
111
- result = filterRecords(result, options.filters);
112
- }
113
- if (options.search) {
114
- result = searchRecords(result, options.search, searchFields);
115
- }
116
-
117
- const filtered = result.length;
118
-
119
- if (options.sort) {
120
- result = sortRecords(result, options.sort, collator);
121
- }
122
-
123
- if (options.offset || options.limit) {
124
- const offset = options.offset || 0;
125
- const limit = options.limit || result.length;
126
- result = result.slice(offset, offset + limit);
127
- }
128
-
129
- return { records: result, total, filtered };
130
- }
131
-
132
- /**
133
- * Decorates records with computed fields (pure, no console side-effects).
134
- * @param {Array<Record<string, any>>} records
135
- * @param {Record<string, (record: any) => any>} [computed]
136
- * @returns {Array<Record<string, any>>}
137
- */
138
- export function decorateRecords(records, computed) {
139
- if (!Array.isArray(records) || !computed || typeof computed !== 'object') return records;
140
-
141
- return records.map(record => {
142
- if (!record) return null;
143
- const copy = { ...record };
144
- for (const [fieldName, fn] of Object.entries(computed)) {
145
- if (typeof fn === 'function') {
146
- try {
147
- copy[fieldName] = fn(record);
148
- } catch (_) {
149
- copy[fieldName] = undefined;
150
- }
151
- }
152
- }
153
- return copy;
154
- });
155
- }
156
-
157
- /**
158
- * Pure helper to compute whether an IndexedDB upgrade is needed.
159
- * @param {string[]} existingStoreNames
160
- * @param {Record<string, { indexes: string[] }>} requiredStores
161
- * @param {Record<string, string[]>} existingIndexMap
162
- * @param {string} [metaStoreName='_meta']
163
- * @returns {boolean}
164
- */
165
- export function checkNeedsUpgrade(existingStoreNames, requiredStores, existingIndexMap, metaStoreName = '_meta') {
166
- if (!Array.isArray(existingStoreNames) || !existingStoreNames.includes(metaStoreName)) return true;
167
- for (const name of Object.keys(requiredStores || {})) {
168
- if (!existingStoreNames.includes(name)) return true;
169
- const requiredIdxs = (requiredStores[name] && requiredStores[name].indexes) || [];
170
- const existingIdxs = (existingIndexMap && existingIndexMap[name]) || [];
171
- if (requiredIdxs.some(idx => !existingIdxs.includes(idx))) return true;
172
- }
173
- return false;
174
- }
175
-
176
- /**
177
- * Pure helper to normalize synchronization errors into a standard response shape.
178
- * @param {any} err
179
- * @returns {{ ok: false, error: string }}
180
- */
181
- export function normalizeSyncError(err) {
182
- const errorMsg = (err && err.message) ? err.message : String(err);
183
- return { ok: false, error: errorMsg };
184
- }
1
+ import { compareValues, detectValueType } from '../../ln-core/compare.js';
2
+ import { matchesFilterValues, matchesSearchTokens, tokenizeSearchQuery } from '../../ln-core/matching.js';
3
+
4
+ /**
5
+ * Sorts an array of record objects by field and direction using pure core comparison.
6
+ * @param {Array<Record<string, any>>} records
7
+ * @param {{ field?: string, direction?: string } | null} [sort]
8
+ * @param {Intl.Collator} [collator]
9
+ * @returns {Array<Record<string, any>>}
10
+ */
11
+ export function sortRecords(records, sort, collator) {
12
+ if (!Array.isArray(records) || !sort || !sort.field) return records;
13
+ const { field, direction } = sort;
14
+ const desc = direction === 'desc';
15
+
16
+ // Lock the value type once for the entire sort operation (per Doctrinal / compare.js rules)
17
+ const sampleValues = records.map(r => (r ? r[field] : undefined));
18
+ const valueType = detectValueType(sampleValues);
19
+
20
+ return [...records].sort((a, b) => {
21
+ const va = a ? a[field] : undefined;
22
+ const vb = b ? b[field] : undefined;
23
+
24
+ const result = compareValues(va, vb, valueType, collator);
25
+ return desc ? -result : result;
26
+ });
27
+ }
28
+
29
+ /**
30
+ * Filters an array of records against a dictionary of active filter arrays.
31
+ * Reuses matchesFilterValues from ln-core/matching (AND across fields, OR within field).
32
+ * @param {Array<Record<string, any>>} records
33
+ * @param {Record<string, Array<any>>} filters
34
+ * @returns {Array<Record<string, any>>}
35
+ */
36
+ export function filterRecords(records, filters) {
37
+ if (!Array.isArray(records) || !filters || typeof filters !== 'object') return records;
38
+
39
+ const keys = Object.keys(filters).filter(k => Array.isArray(filters[k]) && filters[k].length > 0);
40
+ if (!keys.length) return records;
41
+
42
+ return records.filter(record => {
43
+ if (!record) return false;
44
+ return keys.every(field => matchesFilterValues(record[field], filters[field]));
45
+ });
46
+ }
47
+
48
+ /**
49
+ * Searches records across specified fields using ln-core/matching tokenization and matching.
50
+ * @param {Array<Record<string, any>>} records
51
+ * @param {string} query
52
+ * @param {string[]} searchFields
53
+ * @returns {Array<Record<string, any>>}
54
+ */
55
+ export function searchRecords(records, query, searchFields) {
56
+ if (!Array.isArray(records) || !query || !searchFields || !searchFields.length) return records;
57
+
58
+ const tokens = tokenizeSearchQuery(query);
59
+ if (!tokens.length) return records;
60
+
61
+ return records.filter(record => {
62
+ if (!record) return false;
63
+ return tokens.every(token =>
64
+ searchFields.some(field => {
65
+ const val = record[field];
66
+ return val != null && matchesSearchTokens(String(val), [token]);
67
+ })
68
+ );
69
+ });
70
+ }
71
+
72
+ /**
73
+ * Computes aggregates (count, sum, avg) on a specific field across records.
74
+ * @param {Array<Record<string, any>>} records
75
+ * @param {string} field
76
+ * @param {'count' | 'sum' | 'avg'} fn
77
+ * @returns {number}
78
+ */
79
+ export function aggregateRecords(records, field, fn) {
80
+ if (!Array.isArray(records) || !records.length) return 0;
81
+ if (fn === 'count') return records.length;
82
+
83
+ const numbers = records
84
+ .map(r => (r && r[field] != null ? parseFloat(r[field]) : NaN))
85
+ .filter(v => Number.isFinite(v));
86
+
87
+ const sum = numbers.reduce((a, b) => a + b, 0);
88
+
89
+ if (fn === 'sum') return sum;
90
+ if (fn === 'avg') return numbers.length ? sum / numbers.length : 0;
91
+ return 0;
92
+ }
93
+
94
+ /**
95
+ * Executes full in-memory query evaluation: filter -> search -> sort -> slice.
96
+ * @param {Array<Record<string, any>>} records
97
+ * @param {{ filters?: Record<string, any[]>, search?: string, sort?: { field?: string, direction?: string }, offset?: number, limit?: number }} [options={}]
98
+ * @param {string[]} [searchFields=[]]
99
+ * @param {Intl.Collator} [collator]
100
+ * @returns {{ records: Array<Record<string, any>>, total: number, filtered: number }}
101
+ */
102
+ export function queryRecords(records, options = {}, searchFields = [], collator) {
103
+ if (!Array.isArray(records)) {
104
+ return { records: [], total: 0, filtered: 0 };
105
+ }
106
+
107
+ const total = records.length;
108
+ let result = records;
109
+
110
+ if (options.filters) {
111
+ result = filterRecords(result, options.filters);
112
+ }
113
+ if (options.search) {
114
+ result = searchRecords(result, options.search, searchFields);
115
+ }
116
+
117
+ const filtered = result.length;
118
+
119
+ if (options.sort) {
120
+ result = sortRecords(result, options.sort, collator);
121
+ }
122
+
123
+ if (options.offset || options.limit) {
124
+ const offset = options.offset || 0;
125
+ const limit = options.limit || result.length;
126
+ result = result.slice(offset, offset + limit);
127
+ }
128
+
129
+ return { records: result, total, filtered };
130
+ }
131
+
132
+ /**
133
+ * Decorates records with computed fields (pure, no console side-effects).
134
+ * @param {Array<Record<string, any>>} records
135
+ * @param {Record<string, (record: any) => any>} [computed]
136
+ * @returns {Array<Record<string, any>>}
137
+ */
138
+ export function decorateRecords(records, computed) {
139
+ if (!Array.isArray(records) || !computed || typeof computed !== 'object') return records;
140
+
141
+ return records.map(record => {
142
+ if (!record) return null;
143
+ const copy = { ...record };
144
+ for (const [fieldName, fn] of Object.entries(computed)) {
145
+ if (typeof fn === 'function') {
146
+ try {
147
+ copy[fieldName] = fn(record);
148
+ } catch (_) {
149
+ copy[fieldName] = undefined;
150
+ }
151
+ }
152
+ }
153
+ return copy;
154
+ });
155
+ }
156
+
157
+ /**
158
+ * Pure helper to compute whether an IndexedDB upgrade is needed.
159
+ * @param {string[]} existingStoreNames
160
+ * @param {Record<string, { indexes: string[] }>} requiredStores
161
+ * @param {Record<string, string[]>} existingIndexMap
162
+ * @param {string} [metaStoreName='_meta']
163
+ * @returns {boolean}
164
+ */
165
+ export function checkNeedsUpgrade(existingStoreNames, requiredStores, existingIndexMap, metaStoreName = '_meta') {
166
+ if (!Array.isArray(existingStoreNames) || !existingStoreNames.includes(metaStoreName)) return true;
167
+ for (const name of Object.keys(requiredStores || {})) {
168
+ if (!existingStoreNames.includes(name)) return true;
169
+ const requiredIdxs = (requiredStores[name] && requiredStores[name].indexes) || [];
170
+ const existingIdxs = (existingIndexMap && existingIndexMap[name]) || [];
171
+ if (requiredIdxs.some(idx => !existingIdxs.includes(idx))) return true;
172
+ }
173
+ return false;
174
+ }
175
+
176
+ /**
177
+ * Pure helper to normalize synchronization errors into a standard response shape.
178
+ * @param {any} err
179
+ * @returns {{ ok: false, error: string }}
180
+ */
181
+ export function normalizeSyncError(err) {
182
+ const errorMsg = (err && err.message) ? err.message : String(err);
183
+ return { ok: false, error: errorMsg };
184
+ }
@@ -811,7 +811,7 @@ import { aggregateRecords, decorateRecords, filterRecords, queryRecords, checkNe
811
811
  _component.prototype.count = function (filters) {
812
812
  const hasFilters = filters && Object.keys(filters).length > 0;
813
813
  if (!hasFilters) {
814
- if (this.totalCount != null) return Promise.resolve(this.totalCount);
814
+ if (this.windowed && this.totalCount != null) return Promise.resolve(this.totalCount);
815
815
  return _countRecords(this._name);
816
816
  }
817
817
  return _getAllRecords(this._name).then(records => filterRecords(records, filters).length);
@@ -1 +1 @@
1
- (function(){"use strict";function q(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function N(t){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return t?window.lnCore._debugIsContained(t):window.lnCore._debugSink!==null;if(t&&t.closest){const e=t.closest("[data-ln-debug]");return!(!e||typeof document<"u"&&e===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const t=console.warn;console.warn=function(...e){if(typeof e[0]=="string"&&(e[0].startsWith("[ln-")||e[0].startsWith("[lnCore"))){let r=null;for(let o=1;o<e.length;o++)if(e[o]&&e[o].nodeType===1){r=e[o];break}if(!N(r))return}t.apply(console,e)}}function P(t,e,n){const r=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",e,t,r),t.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:r}))}function M(t,e){if(!document.body){document.addEventListener("DOMContentLoaded",function(){M(t,e)}),console.warn("["+e+'] Script loaded before <body> — add "defer" to your <script> tag');return}t()}function Z(t,e,{get:n,set:r}){Object.defineProperty(t,"value",{get:function(){return n?n.call(this):e.get.call(this)},set:function(o){r?r.call(this,o,l=>e.set.call(this,l)):e.set.call(this,o)},configurable:!0})}const j={};function tt(t,e){j[t]=e}function et(t){return j[t]||{ingress:e=>e,egress:e=>e}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=tt,window.lnCore.getDataMapper=et);function L(t){const e=t?t.closest("[lang]"):null,n=(e?e.getAttribute("lang")||e.lang:null)||(typeof document<"u"&&document.documentElement?document.documentElement.getAttribute("lang")||document.documentElement.lang:null)||(typeof navigator<"u"?navigator.language:null);return n?n.trim():"en-US"}function H(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,M(function(){new MutationObserver(function(){P(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const W={};function U(t,e){if(!t||typeof e!="object")return;const n=t.toLowerCase().split("-")[0];W[n]=e}function T(t){if(!t)return null;const e=t.toLowerCase().split("-")[0];return W[e]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=U,window.lnCore.getLocaleFallback=T,window.lnCore.ensureLocaleObserver=H);const F={};function nt(t,e){F[t]||(F[t]=document.querySelector('[data-ln-template="'+t+'"]'));const n=F[t];return n?n.content.cloneNode(!0):(console.warn("["+(e||"ln-core")+'] Template "'+t+'" not found'),null)}function K(t,e){if(!t||!e)return t;const n=t.querySelectorAll("[data-ln-field]");for(let s=0;s<n.length;s++){const u=n[s],c=u.getAttribute("data-ln-field");e[c]!=null&&(u.textContent=e[c])}const r=t.querySelectorAll("[data-ln-attr]");for(let s=0;s<r.length;s++){const u=r[s],c=u.getAttribute("data-ln-attr").split(",");for(let i=0;i<c.length;i++){const a=c[i].trim().split(":");if(a.length!==2)continue;const d=a[0].trim(),h=a[1].trim();e[h]!=null&&u.setAttribute(d,e[h])}}const o=t.querySelectorAll("[data-ln-show]");for(let s=0;s<o.length;s++){const u=o[s],c=u.getAttribute("data-ln-show");c in e&&u.classList.toggle("hidden",!e[c])}const l=t.querySelectorAll("[data-ln-class]");for(let s=0;s<l.length;s++){const u=l[s],c=u.getAttribute("data-ln-class").split(",");for(let i=0;i<c.length;i++){const a=c[i].trim().split(":");if(a.length!==2)continue;const d=a[0].trim(),h=a[1].trim();h in e&&u.classList.toggle(d,!!e[h])}}return t}function it(t,e){t.matches&&t.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",t,e??null),t.dispatchEvent(new CustomEvent("ln-fill",{detail:e??null,bubbles:!0})));const n=t.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let r=0;r<n.length;r++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",n[r],e??null),n[r].dispatchEvent(new CustomEvent("ln-fill",{detail:e??null,bubbles:!0}));return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(t){if(!(!t.target.matches||!t.target.matches("[data-ln-fillable]")))if(t.detail)K(t.target,t.detail);else{const e=t.target.querySelectorAll("[data-ln-field]");for(let n=0;n<e.length;n++)e[n].textContent=""}})));function Y(t,e){if(!t||!e)return t;const n=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const l=n.currentNode;l.textContent.indexOf("{{")!==-1&&(l.textContent=l.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(s,u){return e[u]!==void 0?e[u]:""}))}const r=function(l,s){return e[s]!==void 0?e[s]:""},o=Array.from(t.querySelectorAll("*"));t.nodeType===1&&o.push(t);for(let l=0;l<o.length;l++){const s=o[l],u=s.attributes;for(let c=0;c<u.length;c++){const i=u[c];i.value.indexOf("{{")!==-1&&s.setAttribute(i.name,i.value.replace(/\{\{\s*(\w+)\s*\}\}/g,r))}}return t}function rt(t,e,n,r,o,l){const s={};for(let c=0;c<t.children.length;c++){const i=t.children[c],a=i.getAttribute("data-ln-render-key");a&&(s[a]=i)}const u=document.createDocumentFragment();for(let c=0;c<e.length;c++){const i=e[c],a=String(r(i));let d=s[a];if(d)o(d,i,c);else{const h=nt(n,l);if(!h||(Y(h,i),d=h.firstElementChild,!d))continue;d.setAttribute("data-ln-render-key",a),o(d,i,c)}u.appendChild(d)}t.textContent="",t.appendChild(u)}function ot(t,e){const n={},r=t.querySelectorAll("["+e+"]");for(let o=0;o<r.length;o++)n[r[o].getAttribute(e)]=r[o].textContent,r[o].remove();return n}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=Y,window.lnCore.fill=K,window.lnCore.lnFill=it,window.lnCore.renderList=rt);function Q(t,e,n,r,o){if(!t||e===null)return!0;const l=r||"ln-component",s=t.type;if(s==="trigger"||s==="marker"||s==="string"||s==="list"||!s||e===""&&t.fallback!==void 0)return!0;const u=c=>{o?console.warn(c,o):console.warn(c)};if(s==="boolean"){const c=e.trim().toLowerCase();return c!==""&&c!=="true"&&c!=="false"&&c!=="1"&&c!=="0"?(u(`[${l}] Invalid value "${e}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(s==="enum"){const c=t.values||[];return c.includes(e)?!0:(u(`[${l}] Invalid value "${e}" for attribute "${n}". Allowed: ${c.join(", ")}. Fallback: "${t.fallback}".`),!1)}if(s==="integer"){if(!/^-?\d+$/.test(e))return u(`[${l}] Invalid integer "${e}" for attribute "${n}". Fallback: ${t.fallback}.`),!1;const c=parseInt(e,10);return t.min!==void 0&&c<t.min?(u(`[${l}] Value ${c} for attribute "${n}" is less than min (${t.min}).`),!1):t.max!==void 0&&c>t.max?(u(`[${l}] Value ${c} for attribute "${n}" is greater than max (${t.max}).`),!1):!0}if(s==="float")return isNaN(Number(e))?(u(`[${l}] Invalid float "${e}" for attribute "${n}". Fallback: ${t.fallback}.`),!1):!0;if(s==="json")try{return JSON.parse(e),!0}catch(c){return u(`[${l}] Invalid JSON for attribute "${n}": ${c.message}. Fallback: ${t.fallback}.`),!1}return!0}function lt(t){const e={};for(const n in t){const r=t[n];r&&r.effect&&(e[n]=r.effect)}return Object.keys(e).length?e:null}function st(t){if(t.onAttrChange&&!t.declared)return null;const e=new Set;if(t.effects)for(const n in t.effects)e.add(n);if(t.onAttrChange&&t.declared)for(const n of t.declared)e.add(n);return e}function R(t,e,n,r){if(t.nodeType!==1)return;const l=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]",s=Array.from(t.querySelectorAll(l));t.matches&&t.matches(l)&&s.push(t);for(const u of s)if(!u[n]){window.lnCore._persistSink&&u.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(u,e);try{u[n]=new r(u)}catch(c){console.error("["+n+"] init failed",u,c)}}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function at(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function ct(t){typeof window<"u"?(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[],window.lnCore._bootHolds>0?window.lnCore._bootQueue.push(t):setTimeout(t,0)):t()}function G(){window.lnCore=window.lnCore||{};const t=window.lnCore._attrRegistry=window.lnCore._attrRegistry||{byAttr:new Map,reactive:[],persist:[]};return t.byReactive=t.byReactive||new Map,t.reactiveWildcard=t.reactiveWildcard||[],t}function ut(t){const e=G(),n=t.observed||[];for(let r=0;r<n.length;r++){const o=n[r];e.byAttr.has(o)||e.byAttr.set(o,[]),e.byAttr.get(o).push(t)}if(e.byDeclaredAttr=e.byDeclaredAttr||new Map,t.attributes)for(const r in t.attributes){e.byDeclaredAttr.has(r)||e.byDeclaredAttr.set(r,[]);const o=e.byDeclaredAttr.get(r);o.some(l=>l.componentTag===t.componentTag)||o.push({spec:t.attributes[r],componentTag:t.componentTag})}if(t.onAttrChange||t.effects){e.reactive.push(t);const r=st(t);if(r===null)e.reactiveWildcard.push(t);else for(const o of r)e.byReactive.has(o)||e.byReactive.set(o,[]),e.byReactive.get(o).push(t)}t.persist&&e.persist.push(t)}function J(t,e,n,r){for(let o=0;o<t.length;o++){const l=t[o];if(!e[l.attribute])continue;const s=l.effects&&l.effects[n];s?s(e,n,r):l.onAttrChange&&(!l.declared||l.declared.has(n))&&l.onAttrChange(e,n,r)}}function dt(t){const e=t.target,n=t.attributeName;if(t.oldValue===e.getAttribute(n))return;const r=G(),o=r.byAttr.get(n);if(q()&&r.byDeclaredAttr&&r.byDeclaredAttr.has(n)&&N(e)){const l=r.byDeclaredAttr.get(n),s=e.getAttribute(n);for(let u=0;u<l.length;u++)Q(l[u].spec,s,n,l[u].componentTag,e)}if(window.lnCore._debugSink&&(n.indexOf("data-ln-")===0||o)&&window.lnCore._debugSink("attr",n,e,{oldValue:t.oldValue,newValue:e.getAttribute(n)}),n.indexOf("data-ln-")===0){const l=r.byReactive.get(n);l&&J(l,e,n,t.oldValue),r.reactiveWildcard.length&&J(r.reactiveWildcard,e,n,t.oldValue)}if(o)for(let l=0;l<o.length;l++){const s=o[l];if(s.handler){s.handler(e,n,t.oldValue);continue}s.onAttributeChange&&e[s.attribute]?s.onAttributeChange(e,n):(R(e,s.selector,s.attribute,s.ComponentFn),s.onInit&&s.onInit(e))}}function ft(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,M(function(){new MutationObserver(function(e){for(let n=0;n<e.length;n++)try{dt(e[n])}catch(r){console.error("[ln-core] mutation handler failed",e[n].target,r)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function X(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function ht(t){const e=X();if(e.length){if(t.target)for(let n=0;n<e.length;n++){const r=e[n];if(r.onSubtreeChange){const o=r.query,l=t.target.nodeType===1?t.target.matches(o)?t.target:t.target.closest(o):t.target.parentElement?t.target.parentElement.closest(o):null;l&&r.onSubtreeChange(l,t)}}for(let n=0;n<t.addedNodes.length;n++){const r=t.addedNodes[n];if(r.nodeType===1)for(let o=0;o<e.length;o++){const l=e[o];R(r,l.selector,l.attribute,l.ComponentFn),l.onInit&&l.onInit(r)}}for(let n=0;n<t.removedNodes.length;n++){const r=t.removedNodes[n];if(r.nodeType===1)for(let o=0;o<e.length;o++){const l=e[o],s=l.query,u=Array.from(r.querySelectorAll(s));r.matches&&r.matches(s)&&u.push(r);for(let c=0;c<u.length;c++){const i=u[c];if(!document.contains(i)){const a=i[l.attribute];if(a&&typeof a.destroy=="function")try{a.destroy()}catch(d){console.error("["+l.attribute+"] destroy failed",i,d)}delete i[l.attribute]}}}}}}function mt(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,M(function(){new MutationObserver(function(e){for(let n=0;n<e.length;n++){const r=e[n];if(r.type==="childList")try{ht(r)}catch(o){console.error("[ln-core] lifecycle handler failed",r.target,o)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function gt(t,e,n,r,o={}){const l=o.extraAttributes||[],s=o.onAttributeChange||null,u=o.onSubtreeChange||null,c=o.onInit||null,i=o.onAttrChange||null,a=o.effects||null,d=o.attributes||null,h=d?lt(d):a,b=d?new Set(Object.keys(d)):null,p=o.persist||null;function w(m){const g=m||document.body;if(R(g,t,e,n),d&&q())for(const y in d){const A=d[y],v=Array.from(g.querySelectorAll("["+y+"]"));g.matches&&g.matches("["+y+"]")&&v.push(g);for(let D=0;D<v.length;D++){const k=v[D];N(k)&&Q(A,k.getAttribute(y),y,r,k)}}c&&c(g)}const C=[];if(t.indexOf("[")!==-1){const m=/\[([\w-]+)/g;let g;for(;(g=m.exec(t))!==null;)C.push(g[1])}else C.push(t);ut({selector:t,attribute:e,componentTag:r,attributes:d,ComponentFn:n,onInit:c,observed:C.concat(l),onAttributeChange:s,onAttrChange:i,effects:h,declared:b,persist:p}),ft();const O=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]";X().push({selector:t,attribute:e,ComponentFn:n,onInit:c,onSubtreeChange:u,query:O}),mt(),window[e]=w;function f(){at()>0?ct(function(){w(document.body)}):w(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",f):f(),w}function z(t){return(t||"").replace(/^#/,"")}function $(t){const e=t===void 0?location.hash:t,n={},r=z(e);if(!r)return n;const o=r.split("&");for(let l=0;l<o.length;l++){const s=o[l];if(!s)continue;const u=s.indexOf(":"),c=u>-1?s.slice(0,u):s,i=u>-1?s.slice(u+1):"";if(c)try{n[c]=decodeURIComponent(i)}catch{n[c]=i}}return n}function pt(t){if(!t)return null;const e=$();return t in e?e[t]:null}function wt(t,e){if(!t)return;const n=$();e==null?delete n[t]:n[t]=String(e);const o=Object.keys(n).map(function(l){const s=n[l];return s===""?l:l+":"+encodeURIComponent(s)}).join("&");z(location.hash)!==o&&(location.hash=o)}function bt(t){return t.button===1||t.ctrlKey||t.metaKey||t.shiftKey?!1:(t.preventDefault(),!0)}function yt(t,e){if(!t||!t.hasAttribute("data-ln-hash"))return null;const n=t.getAttribute("data-ln-hash");if(n&&n.trim()!=="")return n.trim();const r=t.getAttribute("data-ln-sort")||t.getAttribute("data-ln-search-for")||t.getAttribute("data-ln-search")||t.getAttribute("data-ln-filter")||t.id;return r?e?r+"-"+e:r:e||null}function Ct(t,e){return!e||e==="none"||t===null||t===void 0?null:String(t)+"."+e}function _t(t){return!t||typeof t!="string"?null:t.endsWith(".asc")?{fieldOrColumn:t.slice(0,-4),direction:"asc"}:t.endsWith(".desc")?{fieldOrColumn:t.slice(0,-5),direction:"desc"}:null}function At(t,e){return!t||!Array.isArray(e)||e.length===0?null:t+":"+e.map(encodeURIComponent).join(",")}function vt(t){if(!t||typeof t!="string")return null;const e=t.indexOf(":");if(e===-1)return null;const n=t.slice(0,e),r=t.slice(e+1),o=r?r.split(",").map(function(l){try{return decodeURIComponent(l)}catch{return l}}).filter(Boolean):[];return{key:n,values:o}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=$,window.lnCore.hashGet=pt,window.lnCore.hashSet=wt,window.lnCore.hashLinkClick=bt,window.lnCore.resolveHashNamespace=yt,window.lnCore.hashSortEncode=Ct,window.lnCore.hashSortDecode=_t,window.lnCore.hashFilterEncode=At,window.lnCore.hashFilterDecode=vt);function _(t){if(t==null||t==="")return null;if(t instanceof Date)return isNaN(t.getTime())?null:t;const e=Number(t);if(!isNaN(e)&&e>0){const n=e<1e11?e*1e3:e,r=new Date(n);return isNaN(r.getTime())?null:r}if(typeof t=="string"){const n=t.trim();if(!n)return null;const r=/^(\d{4})-(\d{2})-(\d{2})$/.exec(n);if(r){const l=+r[1],s=+r[2],u=+r[3],c=new Date(l,s-1,u);return c.getFullYear()!==l||c.getMonth()!==s-1||c.getDate()!==u?null:c}const o=new Date(n);return isNaN(o.getTime())?null:o}return null}function E(t){if(!t||!(t instanceof Date)||isNaN(t.getTime()))return"";const e=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0");return e+"-"+n+"-"+r}const B=/^(short|medium|long)(\s+datetime)?$/,St={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},"short datetime":{dateStyle:"short",timeStyle:"short"},"medium datetime":{dateStyle:"medium",timeStyle:"short"},"long datetime":{dateStyle:"long",timeStyle:"short"}};function Et(t){return!t||t===""?{dateStyle:"medium"}:String(t).trim().match(B)?St[t.trim()]:null}function x(t){if(!t||typeof t!="string")return null;const e=t.trim();if(e.length<6)return null;let n,r;if(e.indexOf(".")!==-1)n=".",r=e.split(".");else if(e.indexOf("/")!==-1)n="/",r=e.split("/");else if(e.indexOf("-")!==-1)n="-",r=e.split("-");else return null;if(r.length!==3)return null;const o=[];for(let i=0;i<3;i++){const a=parseInt(r[i],10);if(isNaN(a))return null;o.push(a)}let l,s,u;n==="."?(l=o[0],s=o[1],u=o[2]):n==="/"?(s=o[0],l=o[1],u=o[2]):r[0].length===4?(u=o[0],s=o[1],l=o[2]):(l=o[0],s=o[1],u=o[2]),u<100&&(u+=u<50?2e3:1900);const c=new Date(u,s-1,l);return c.getFullYear()!==u||c.getMonth()!==s-1||c.getDate()!==l?null:c}function V(t,e,n,r){if(!t||!(t instanceof Date)||isNaN(t.getTime())||!e||typeof e!="string")return"";const o=t.getDate(),l=t.getMonth(),s=t.getFullYear(),u=t.getHours(),c=t.getMinutes();let i,a;const d=(n||"").toLowerCase().split("-")[0];let h=!1;try{const w=new Intl.DateTimeFormat(n,{month:"long"}).resolvedOptions().locale.toLowerCase().split("-")[0];h=!!(r&&w!==d)}catch{h=!!r}if(h&&r&&r.monthsLong)i=r.monthsLong[l];else try{i=new Intl.DateTimeFormat(n,{month:"long"}).format(t)}catch{i=String(l+1)}if(h&&r&&r.monthsShort)a=r.monthsShort[l];else try{a=new Intl.DateTimeFormat(n,{month:"short"}).format(t)}catch{a=String(l+1)}const b={yyyy:String(s),yy:String(s).slice(-2),MMMM:i,MMM:a,MM:String(l+1).padStart(2,"0"),M:String(l+1),dd:String(o).padStart(2,"0"),d:String(o),HH:String(u).padStart(2,"0"),mm:String(c).padStart(2,"0")};return e.replace(/yyyy|yy|MMMM|MMM|MM|M|dd|d|HH|mm/g,function(p){return b[p]!==void 0?b[p]:p})}function I(t,e,n,r){if(!t||!(t instanceof Date)||isNaN(t.getTime()))return"";const o=Et(e);if(o)try{const l=new Intl.DateTimeFormat(n,o),s=(n||"").toLowerCase().split("-")[0],u=l.resolvedOptions().locale.toLowerCase().split("-")[0];return r&&u!==s?V(t,"dd.MM.yyyy",n,r):l.format(t)}catch{return V(t,"dd.MM.yyyy",n,r)}return V(t,e||"dd.MM.yyyy",n,r)}(function(){const t="data-ln-date",e="lnDate";if(window[e]!==void 0)return;function n(i){const a=i[e];if(a){if(a.isTextElement)a._initTextElement();else if(a.value){const d=_(a.value);d&&a._displayFormatted(d)}}}const r={"data-ln-date":{type:"enum",values:["short","medium","long","full","iso"],fallback:"medium",effect:n,description:"Date display style preset or activator"},"data-ln-date-format":{type:"string",effect:n,description:"Custom Intl.DateTimeFormat pattern or options"},"data-ln-date-locale":{type:"string",effect:n,description:"BCP 47 language tag override for date formatting"},"data-ln-value":{type:"string",effect:n,description:"Raw ISO date string or timestamp for non-time elements (td, span)"},"data-ln-date-dict":{type:"marker",description:"Container for date translation dictionary"},"data-ln-date-dict-key":{type:"string",description:"Dictionary key for relative time or custom date formatting"},"data-ln-date-field":{type:"string",description:"Field name mapping for date record binding"},"data-ln-date-label":{type:"string",description:"Accessible label text for the date input"}},o=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value");function l(i,a,d){P(i.dom,"ln-date:change",{value:a,formatted:i.dom.value,date:d}),i.dom.dispatchEvent(new Event("change",{bubbles:!0}))}function s(i,a,d,h){i._setHiddenRaw(a),o.set.call(i._picker,a),i._lastISO=a,h!==void 0?(i._isFormatting=!0,i.dom.value=h,i._isFormatting=!1):d&&i._displayFormatted(d),l(i,a,d)}function u(i){i._setHiddenRaw(""),o.set.call(i._picker,""),i._isFormatting=!0,i.dom.value="",i._isFormatting=!1,i._lastISO="",l(i,"",null)}function c(i){if(i[e])return i[e];i[e]=this,this.dom=i;const a=this;if(this._onLocaleChange=function(){if(a.isTextElement)a._formatTextContent();else if(a.value){const f=_(a.value);f&&a._displayFormatted(f)}},H(),document.addEventListener("ln-core:locale-change",this._onLocaleChange),i.tagName!=="INPUT")return this.isTextElement=!0,this._initTextElement(),this;this.isTextElement=!1;const d=i.value,h=i.name,b=i.closest(".form-element, form")||i.parentNode;if(b){const f=b.querySelectorAll("[data-ln-date-dict]");for(let m=0;m<f.length;m++){const g=f[m].getAttribute("data-ln-date-dict");if(g){const y=ot(f[m],"data-ln-date-dict-key");y["months-long"]&&(y.monthsLong=y["months-long"].split(",").map(A=>A.trim())),y["months-short"]&&(y.monthsShort=y["months-short"].split(",").map(A=>A.trim())),U(g,y)}}}const p=document.createElement("span");p.setAttribute("data-ln-date-field",""),i.parentNode.insertBefore(p,i),p.appendChild(i),this._wrapper=p;const w=document.createElement("input");w.type="hidden",w.name=h,i.removeAttribute("name"),i.hasAttribute("data-ln-fill-as")&&w.setAttribute("data-ln-fill-as",i.getAttribute("data-ln-fill-as")),i.insertAdjacentElement("afterend",w),this._hidden=w;const C=document.createElement("input");C.type="date",C.tabIndex=-1,C.setAttribute("tabindex","-1"),C.setAttribute("aria-hidden","true"),C.setAttribute("aria-label",i.getAttribute("data-ln-date-label")||"Date picker"),C.style.cssText="position:absolute;opacity:0;width:0;height:0;overflow:hidden;pointer-events:none",w.insertAdjacentElement("afterend",C),this._picker=C,i.type="text";const S=document.createElement("button");S.type="button",S.setAttribute("aria-label",i.getAttribute("data-ln-date-label")||"Open date picker"),S.innerHTML='<svg class="ln-icon" aria-hidden="true"><use href="#ln-icon-calendar"></use></svg>',C.insertAdjacentElement("afterend",S),this._btn=S,this._lastISO="",Object.defineProperty(w,"value",{get:function(){return o.get.call(w)},set:function(f){if(o.set.call(w,f),f&&f!==""){const m=_(f);m&&s(a,f,m)}else f===""&&u(a)}}),Z(i,o,{get:function(){return o.get.call(i)},set:function(f,m){if(a._isFormatting){m(f);return}if(!f||f===""){m(""),u(a);return}const g=_(f)||x(f);if(g){const y=E(g),A=i.getAttribute(t)||"",v=L(i),D=T(v),k=I(g,A,v,D);m(k),s(a,y,g,k)}else m(String(f)),u(a)}}),this._onPickerChange=function(){const f=C.value;if(f){const m=_(f);m&&s(a,f,m)}else u(a)},C.addEventListener("change",this._onPickerChange),this._onBlur=function(){const f=a.dom.value.trim();if(f===""){a._lastISO!==""&&u(a);return}if(a._lastISO){const g=_(a._lastISO);if(g){const y=a.dom.getAttribute(t)||"",A=L(a.dom),v=T(A);if(f===I(g,y,A,v))return}}const m=x(f);if(m){const g=E(m);s(a,g,m)}else if(a._lastISO){const g=_(a._lastISO);g&&a._displayFormatted(g)}else a.dom.value=""},i.addEventListener("blur",this._onBlur),this._onBtnClick=function(){a._openPicker()},S.addEventListener("click",this._onBtnClick);const O=i.form;if(O&&(this._form=O,this._onFormReset=function(){setTimeout(function(){const f=a.dom.value;if(f){const m=_(f)||x(f);if(m){const g=E(m);s(a,g,m);return}}u(a)},0)},O.addEventListener("reset",this._onFormReset)),d&&d!==""){const f=_(d);f&&s(a,d,f)}return this}c.prototype._initTextElement=function(){const i=this.dom,a=i.getAttribute("data-ln-value"),d=i.getAttribute("data-ln-date"),h=i.getAttribute("datetime");let b=null;i.tagName==="TIME"&&h!==null&&h!==""?b=h:a!==null&&a!==""?b=a:h!==null&&h!==""?b=h:d!==null&&d!==""&&d!=="true"&&!B.test(d)?b=d:b=i.textContent.trim();const p=_(b)||x(b);if(p&&!isNaN(p.getTime())){const w=E(p);this._rawValue=w,i.tagName!=="TIME"&&!i.hasAttribute("data-ln-value")&&i.setAttribute("data-ln-value",w),this._formatTextContent()}else this._rawValue=null},c.prototype._formatTextContent=function(){if(this._rawValue){const i=_(this._rawValue);if(i){let d=this.dom.getAttribute("data-ln-date-format");if(!d){const p=this.dom.getAttribute("data-ln-date");p&&B.test(p)&&(d=p)}const h=L(this.dom),b=T(h);this.dom.textContent=I(i,d||"medium",h,b)}}},c.prototype._openPicker=function(){if(typeof this._picker.showPicker=="function")try{this._picker.showPicker()}catch{this._picker.click()}else this._picker.click()},c.prototype._setHiddenRaw=function(i){o.set.call(this._hidden,i)},c.prototype._displayFormatted=function(i){const a=this.dom.getAttribute(t)||"",d=L(this.dom),h=T(d);this._isFormatting=!0,this.dom.value=I(i,a,d,h),this._isFormatting=!1},Object.defineProperty(c.prototype,"value",{get:function(){return this.isTextElement?this._rawValue||"":o.get.call(this._hidden)},set:function(i){if(this.isTextElement){if(!i||i===""){this._rawValue=null,this.dom.removeAttribute("data-ln-value"),this.dom.tagName==="TIME"&&this.dom.removeAttribute("datetime"),this.dom.textContent="";return}const d=_(i)||x(i);if(!d)return;const h=E(d);this._rawValue=h,this.dom.tagName==="TIME"?this.dom.setAttribute("datetime",h):this.dom.setAttribute("data-ln-value",h),this._formatTextContent();return}if(!i||i===""){u(this);return}const a=_(i);a&&s(this,i,a)}}),Object.defineProperty(c.prototype,"date",{get:function(){const i=this.value;return i?_(i):null},set:function(i){if(!i||!(i instanceof Date)||isNaN(i.getTime())){this.value="";return}this.value=E(i)}}),Object.defineProperty(c.prototype,"formatted",{get:function(){return this.isTextElement?this.dom.textContent:this.dom.value}}),c.prototype.destroy=function(){if(!this.dom[e])return;if(this._onLocaleChange&&document.removeEventListener("ln-core:locale-change",this._onLocaleChange),this.isTextElement){delete this.dom[e];return}this._form&&this._onFormReset&&this._form.removeEventListener("reset",this._onFormReset),this._picker.removeEventListener("change",this._onPickerChange),this.dom.removeEventListener("blur",this._onBlur),this._btn.removeEventListener("click",this._onBtnClick);const i=this.value;this._hidden.remove(),this._picker.remove(),this._btn.remove(),this._wrapper&&this._wrapper.parentNode&&(this._wrapper.parentNode.insertBefore(this.dom,this._wrapper),this._wrapper.remove()),delete this.dom.value,this.dom.name=this._hidden.name,this.dom.type="date",i&&(this.dom.value=i),delete this.dom[e]},gt(t,e,c,"ln-date",{attributes:r,extraAttributes:["datetime","lang"],onAttributeChange:n})})()})();
1
+ (function(){"use strict";function P(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function I(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let r=null;for(let o=1;o<t.length;o++)if(t[o]&&t[o].nodeType===1){r=t[o];break}if(!I(r))return}e.apply(console,t)}}function H(e,t,n){const r=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,r),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:r}))}function M(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){M(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function ae(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function ce(e,t){const n=!!(t&&t.typed),r=t&&t.exclude,o={},a=e.elements,s={};if(n)for(let c=0;c<a.length;c++){const l=a[c];l.name&&l.type==="checkbox"&&!l.disabled&&(s[l.name]=(s[l.name]||0)+1)}for(let c=0;c<a.length;c++){const l=a[c];if(!(!l.name||l.disabled||l.type==="file"||l.type==="submit"||l.type==="button")&&!(r&&l.matches&&l.matches(r)))if(l.type==="checkbox")n&&s[l.name]===1?o[l.name]=l.checked:(o[l.name]||(o[l.name]=[]),l.checked&&o[l.name].push(l.value));else if(l.type==="radio")l.checked&&(o[l.name]=l.value);else if(l.type==="select-multiple"){o[l.name]=[];for(let i=0;i<l.options.length;i++)l.options[i].selected&&o[l.name].push(l.options[i].value)}else if(n&&l.type==="hidden")o[l.name]=l.value;else if(n&&(l.type==="number"||l.type==="range")){const i=Number(l.value);o[l.name]=l.value===""||isNaN(i)?null:i}else o[l.name]=l.value}return o}function ue(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function de(e,t){const n=e.elements,r=[],o={};for(let a=0;a<n.length;a++){const s=n[a];s.name&&s.type==="checkbox"&&(o[s.name]=(o[s.name]||0)+1)}for(let a=0;a<n.length;a++){const s=n[a];if(s.type==="file"||s.type==="submit"||s.type==="button")continue;const c=s.getAttribute("data-ln-fill-as")||s.name;if(!c||!(c in t))continue;const l=t[c];if(s.type==="checkbox"){if(Array.isArray(l))s.checked=l.indexOf(s.value)!==-1;else if(o[s.name]>1){const i=String(l).split(",").map(function(u){return u.trim()});s.checked=i.indexOf(s.value)!==-1}else s.checked=ue(l);r.push(s)}else if(s.type==="radio")s.checked=s.value===String(l),r.push(s);else if(s.type==="select-multiple"){if(Array.isArray(l))for(let i=0;i<s.options.length;i++)s.options[i].selected=l.indexOf(s.options[i].value)!==-1;r.push(s)}else s.value=l,s.tagName==="SELECT"&&l!=null&&s.setAttribute("data-ln-value",l),r.push(s)}return r}function fe(e,t,{get:n,set:r}){Object.defineProperty(e,"value",{get:function(){return n?n.call(this):t.get.call(this)},set:function(o){r?r.call(this,o,a=>t.set.call(this,a)):t.set.call(this,o)},configurable:!0})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=de,window.lnCore.serializeForm=ce,window.lnCore.resolveFormMethod=ae);const W={};function he(e,t){W[e]=t}function me(e){return W[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=he,window.lnCore.getDataMapper=me);function L(e){const t=e?e.closest("[lang]"):null,n=(t?t.getAttribute("lang")||t.lang:null)||(typeof document<"u"&&document.documentElement?document.documentElement.getAttribute("lang")||document.documentElement.lang:null)||(typeof navigator<"u"?navigator.language:null);return n?n.trim():"en-US"}function U(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,M(function(){new MutationObserver(function(){H(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const K={};function Y(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];K[n]=t}function E(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return K[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=Y,window.lnCore.getLocaleFallback=E,window.lnCore.ensureLocaleObserver=U);const F={};function pe(e,t){F[e]||(F[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=F[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function J(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let s=0;s<n.length;s++){const c=n[s],l=c.getAttribute("data-ln-field");t[l]!=null&&(c.textContent=t[l])}const r=e.querySelectorAll("[data-ln-attr]");for(let s=0;s<r.length;s++){const c=r[s],l=c.getAttribute("data-ln-attr").split(",");for(let i=0;i<l.length;i++){const u=l[i].trim().split(":");if(u.length!==2)continue;const d=u[0].trim(),h=u[1].trim();t[h]!=null&&c.setAttribute(d,t[h])}}const o=e.querySelectorAll("[data-ln-show]");for(let s=0;s<o.length;s++){const c=o[s],l=c.getAttribute("data-ln-show");l in t&&c.classList.toggle("hidden",!t[l])}const a=e.querySelectorAll("[data-ln-class]");for(let s=0;s<a.length;s++){const c=a[s],l=c.getAttribute("data-ln-class").split(",");for(let i=0;i<l.length;i++){const u=l[i].trim().split(":");if(u.length!==2)continue;const d=u[0].trim(),h=u[1].trim();h in t&&c.classList.toggle(d,!!t[h])}}return e}function we(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const n=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let r=0;r<n.length;r++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",n[r],t??null),n[r].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)J(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let n=0;n<t.length;n++)t[n].textContent=""}})));function Q(e,t){if(!e||!t)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const a=n.currentNode;a.textContent.indexOf("{{")!==-1&&(a.textContent=a.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(s,c){return t[c]!==void 0?t[c]:""}))}const r=function(a,s){return t[s]!==void 0?t[s]:""},o=Array.from(e.querySelectorAll("*"));e.nodeType===1&&o.push(e);for(let a=0;a<o.length;a++){const s=o[a],c=s.attributes;for(let l=0;l<c.length;l++){const i=c[l];i.value.indexOf("{{")!==-1&&s.setAttribute(i.name,i.value.replace(/\{\{\s*(\w+)\s*\}\}/g,r))}}return e}function ge(e,t,n,r,o,a){const s={};for(let l=0;l<e.children.length;l++){const i=e.children[l],u=i.getAttribute("data-ln-render-key");u&&(s[u]=i)}const c=document.createDocumentFragment();for(let l=0;l<t.length;l++){const i=t[l],u=String(r(i));let d=s[u];if(d)o(d,i,l);else{const h=pe(n,a);if(!h||(Q(h,i),d=h.firstElementChild,!d))continue;d.setAttribute("data-ln-render-key",u),o(d,i,l)}c.appendChild(d)}e.textContent="",e.appendChild(c)}function be(e,t){const n={},r=e.querySelectorAll("["+t+"]");for(let o=0;o<r.length;o++)n[r[o].getAttribute(t)]=r[o].textContent,r[o].remove();return n}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=Q,window.lnCore.fill=J,window.lnCore.lnFill=we,window.lnCore.renderList=ge);function R(e,t,n){const r=e.getAttribute(t);return r===null?n:r}function z(e,t,n){const r=parseInt(e.getAttribute(t),10);return isNaN(r)?n:r}function G(e,t,n=!1){const r=e.getAttribute(t);if(r===null)return!!n;const o=r.trim().toLowerCase();return!(o==="false"||o==="0")}function X(e,t){return(e.getAttribute(t)||"").split(",").map(n=>n.trim()).filter(Boolean)}const B=new Map;function Z(e,t){const n=(e?e.join("|"):"")+"::"+t;if(B.has(n))return B.get(n);const r=new Set(e||[]),o=function(a,s){const c=a.getAttribute(s);return c!==null&&r.has(c)?c:t};return B.set(n,o),o}function ee(e,t,n){const r=parseFloat(e.getAttribute(t));return isNaN(r)?n:r}function te(e,t,n){const r=e.getAttribute(t);if(!r)return n;try{return JSON.parse(r)}catch{return n}}function ne(e,t,n,r,o){if(!e||t===null)return!0;const a=r||"ln-component",s=e.type;if(s==="trigger"||s==="marker"||s==="string"||s==="list"||!s||t===""&&e.fallback!==void 0)return!0;const c=l=>{o?console.warn(l,o):console.warn(l)};if(s==="boolean"){const l=t.trim().toLowerCase();return l!==""&&l!=="true"&&l!=="false"&&l!=="1"&&l!=="0"?(c(`[${a}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(s==="enum"){const l=e.values||[];return l.includes(t)?!0:(c(`[${a}] Invalid value "${t}" for attribute "${n}". Allowed: ${l.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(s==="integer"){if(!/^-?\d+$/.test(t))return c(`[${a}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const l=parseInt(t,10);return e.min!==void 0&&l<e.min?(c(`[${a}] Value ${l} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&l>e.max?(c(`[${a}] Value ${l} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(s==="float")return isNaN(Number(t))?(c(`[${a}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(s==="json")try{return JSON.parse(t),!0}catch(l){return c(`[${a}] Invalid JSON for attribute "${n}": ${l.message}. Fallback: ${e.fallback}.`),!1}return!0}function ye(e,t,n){for(const r in n){const[o,a,s]=n[r];Object.defineProperty(e,r,{get:function(){return o(t,a,s)},enumerable:!0,configurable:!0})}return e}function Ce(e){const t={};for(const n in e){const r=e[n];if(!r||!r.prop)continue;let o=r.read;if(!o&&r.type)switch(r.type){case"enum":o=Z(r.values,r.fallback);break;case"integer":o=z;break;case"float":o=ee;break;case"boolean":o=G;break;case"list":o=X;break;case"json":o=te;break;case"string":default:o=R;break}o||(o=R),t[r.prop]=[o,n,r.fallback]}return t}function _e(e){const t={};for(const n in e){const r=e[n];r&&r.effect&&(t[n]=r.effect)}return Object.keys(t).length?t:null}function ve(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const n in e.effects)t.add(n);if(e.onAttrChange&&e.declared)for(const n of e.declared)t.add(n);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=ye,window.lnCore.attrSpec=Ce,window.lnCore.attrStr=R,window.lnCore.attrInt=z,window.lnCore.attrBool=G,window.lnCore.attrList=X,window.lnCore.attrEnum=Z,window.lnCore.attrFloat=ee,window.lnCore.attrJson=te);function $(e,t,n,r){if(e.nodeType!==1)return;const a=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",s=Array.from(e.querySelectorAll(a));e.matches&&e.matches(a)&&s.push(e);for(const c of s)if(!c[n]){window.lnCore._persistSink&&c.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(c,t);try{c[n]=new r(c)}catch(l){console.error("["+n+"] init failed",c,l)}}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function Ae(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function xe(e){typeof window<"u"?(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[],window.lnCore._bootHolds>0?window.lnCore._bootQueue.push(e):setTimeout(e,0)):e()}function re(){window.lnCore=window.lnCore||{};const e=window.lnCore._attrRegistry=window.lnCore._attrRegistry||{byAttr:new Map,reactive:[],persist:[]};return e.byReactive=e.byReactive||new Map,e.reactiveWildcard=e.reactiveWildcard||[],e}function Se(e){const t=re(),n=e.observed||[];for(let r=0;r<n.length;r++){const o=n[r];t.byAttr.has(o)||t.byAttr.set(o,[]),t.byAttr.get(o).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const r in e.attributes){t.byDeclaredAttr.has(r)||t.byDeclaredAttr.set(r,[]);const o=t.byDeclaredAttr.get(r);o.some(a=>a.componentTag===e.componentTag)||o.push({spec:e.attributes[r],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const r=ve(e);if(r===null)t.reactiveWildcard.push(e);else for(const o of r)t.byReactive.has(o)||t.byReactive.set(o,[]),t.byReactive.get(o).push(e)}e.persist&&t.persist.push(e)}function oe(e,t,n,r){for(let o=0;o<e.length;o++){const a=e[o];if(!t[a.attribute])continue;const s=a.effects&&a.effects[n];s?s(t,n,r):a.onAttrChange&&(!a.declared||a.declared.has(n))&&a.onAttrChange(t,n,r)}}function ke(e){const t=e.target,n=e.attributeName;if(e.oldValue===t.getAttribute(n))return;const r=re(),o=r.byAttr.get(n);if(P()&&r.byDeclaredAttr&&r.byDeclaredAttr.has(n)&&I(t)){const a=r.byDeclaredAttr.get(n),s=t.getAttribute(n);for(let c=0;c<a.length;c++)ne(a[c].spec,s,n,a[c].componentTag,t)}if(window.lnCore._debugSink&&(n.indexOf("data-ln-")===0||o)&&window.lnCore._debugSink("attr",n,t,{oldValue:e.oldValue,newValue:t.getAttribute(n)}),n.indexOf("data-ln-")===0){const a=r.byReactive.get(n);a&&oe(a,t,n,e.oldValue),r.reactiveWildcard.length&&oe(r.reactiveWildcard,t,n,e.oldValue)}if(o)for(let a=0;a<o.length;a++){const s=o[a];if(s.handler){s.handler(t,n,e.oldValue);continue}s.onAttributeChange&&t[s.attribute]?s.onAttributeChange(t,n):($(t,s.selector,s.attribute,s.ComponentFn),s.onInit&&s.onInit(t))}}function Ee(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,M(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{ke(t[n])}catch(r){console.error("[ln-core] mutation handler failed",t[n].target,r)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function ie(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function Oe(e){const t=ie();if(t.length){if(e.target)for(let n=0;n<t.length;n++){const r=t[n];if(r.onSubtreeChange){const o=r.query,a=e.target.nodeType===1?e.target.matches(o)?e.target:e.target.closest(o):e.target.parentElement?e.target.parentElement.closest(o):null;a&&r.onSubtreeChange(a,e)}}for(let n=0;n<e.addedNodes.length;n++){const r=e.addedNodes[n];if(r.nodeType===1)for(let o=0;o<t.length;o++){const a=t[o];$(r,a.selector,a.attribute,a.ComponentFn),a.onInit&&a.onInit(r)}}for(let n=0;n<e.removedNodes.length;n++){const r=e.removedNodes[n];if(r.nodeType===1)for(let o=0;o<t.length;o++){const a=t[o],s=a.query,c=Array.from(r.querySelectorAll(s));r.matches&&r.matches(s)&&c.push(r);for(let l=0;l<c.length;l++){const i=c[l];if(!document.contains(i)){const u=i[a.attribute];if(u&&typeof u.destroy=="function")try{u.destroy()}catch(d){console.error("["+a.attribute+"] destroy failed",i,d)}delete i[a.attribute]}}}}}}function Te(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,M(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++){const r=t[n];if(r.type==="childList")try{Oe(r)}catch(o){console.error("[ln-core] lifecycle handler failed",r.target,o)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function le(e,t,n,r,o={}){const a=o.extraAttributes||[],s=o.onAttributeChange||null,c=o.onSubtreeChange||null,l=o.onInit||null,i=o.onAttrChange||null,u=o.effects||null,d=o.attributes||null,h=d?_e(d):u,b=d?new Set(Object.keys(d)):null,w=o.persist||null;function g(m){const p=m||document.body;if($(p,e,t,n),d&&P())for(const y in d){const v=d[y],A=Array.from(p.querySelectorAll("["+y+"]"));p.matches&&p.matches("["+y+"]")&&A.push(p);for(let D=0;D<A.length;D++){const k=A[D];I(k)&&ne(v,k.getAttribute(y),y,r,k)}}l&&l(p)}const C=[];if(e.indexOf("[")!==-1){const m=/\[([\w-]+)/g;let p;for(;(p=m.exec(e))!==null;)C.push(p[1])}else C.push(e);Se({selector:e,attribute:t,componentTag:r,attributes:d,ComponentFn:n,onInit:l,observed:C.concat(a),onAttributeChange:s,onAttrChange:i,effects:h,declared:b,persist:w}),Ee();const T=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]";ie().push({selector:e,attribute:t,ComponentFn:n,onInit:l,onSubtreeChange:c,query:T}),Te(),window[t]=g,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=le);function f(){Ae()>0?xe(function(){g(document.body)}):g(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",f):f(),g}function se(e){return(e||"").replace(/^#/,"")}function V(e){const t=e===void 0?location.hash:e,n={},r=se(t);if(!r)return n;const o=r.split("&");for(let a=0;a<o.length;a++){const s=o[a];if(!s)continue;const c=s.indexOf(":"),l=c>-1?s.slice(0,c):s,i=c>-1?s.slice(c+1):"";if(l)try{n[l]=decodeURIComponent(i)}catch{n[l]=i}}return n}function De(e){if(!e)return null;const t=V();return e in t?t[e]:null}function Me(e,t){if(!e)return;const n=V();t==null?delete n[e]:n[e]=String(t);const o=Object.keys(n).map(function(a){const s=n[a];return s===""?a:a+":"+encodeURIComponent(s)}).join("&");se(location.hash)!==o&&(location.hash=o)}function Le(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function Ne(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const n=e.getAttribute("data-ln-hash");if(n&&n.trim()!=="")return n.trim();const r=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return r?t?r+"-"+t:r:t||null}function Ie(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Fe(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function Re(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Be(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const n=e.slice(0,t),r=e.slice(t+1),o=r?r.split(",").map(function(a){try{return decodeURIComponent(a)}catch{return a}}).filter(Boolean):[];return{key:n,values:o}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=V,window.lnCore.hashGet=De,window.lnCore.hashSet=Me,window.lnCore.hashLinkClick=Le,window.lnCore.resolveHashNamespace=Ne,window.lnCore.hashSortEncode=Ie,window.lnCore.hashSortDecode=Fe,window.lnCore.hashFilterEncode=Re,window.lnCore.hashFilterDecode=Be);function $e(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.uuid=$e);function _(e){if(e==null||e==="")return null;if(e instanceof Date)return isNaN(e.getTime())?null:e;const t=Number(e);if(!isNaN(t)&&t>0){const n=t<1e11?t*1e3:t,r=new Date(n);return isNaN(r.getTime())?null:r}if(typeof e=="string"){const n=e.trim();if(!n)return null;const r=/^(\d{4})-(\d{2})-(\d{2})$/.exec(n);if(r){const a=+r[1],s=+r[2],c=+r[3],l=new Date(a,s-1,c);return l.getFullYear()!==a||l.getMonth()!==s-1||l.getDate()!==c?null:l}const o=new Date(n);return isNaN(o.getTime())?null:o}return null}function S(e){if(!e||!(e instanceof Date)||isNaN(e.getTime()))return"";const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return t+"-"+n+"-"+r}const j=/^(short|medium|long)(\s+datetime)?$/,Ve={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},"short datetime":{dateStyle:"short",timeStyle:"short"},"medium datetime":{dateStyle:"medium",timeStyle:"short"},"long datetime":{dateStyle:"long",timeStyle:"short"}};function je(e){return!e||e===""?{dateStyle:"medium"}:String(e).trim().match(j)?Ve[e.trim()]:null}function O(e){if(!e||typeof e!="string")return null;const t=e.trim();if(t.length<6)return null;let n,r;if(t.indexOf(".")!==-1)n=".",r=t.split(".");else if(t.indexOf("/")!==-1)n="/",r=t.split("/");else if(t.indexOf("-")!==-1)n="-",r=t.split("-");else return null;if(r.length!==3)return null;const o=[];for(let i=0;i<3;i++){const u=parseInt(r[i],10);if(isNaN(u))return null;o.push(u)}let a,s,c;n==="."?(a=o[0],s=o[1],c=o[2]):n==="/"?(s=o[0],a=o[1],c=o[2]):r[0].length===4?(c=o[0],s=o[1],a=o[2]):(a=o[0],s=o[1],c=o[2]),c<100&&(c+=c<50?2e3:1900);const l=new Date(c,s-1,a);return l.getFullYear()!==c||l.getMonth()!==s-1||l.getDate()!==a?null:l}function q(e,t,n,r){if(!e||!(e instanceof Date)||isNaN(e.getTime())||!t||typeof t!="string")return"";const o=e.getDate(),a=e.getMonth(),s=e.getFullYear(),c=e.getHours(),l=e.getMinutes();let i,u;const d=(n||"").toLowerCase().split("-")[0];let h=!1;try{const g=new Intl.DateTimeFormat(n,{month:"long"}).resolvedOptions().locale.toLowerCase().split("-")[0];h=!!(r&&g!==d)}catch{h=!!r}if(h&&r&&r.monthsLong)i=r.monthsLong[a];else try{i=new Intl.DateTimeFormat(n,{month:"long"}).format(e)}catch{i=String(a+1)}if(h&&r&&r.monthsShort)u=r.monthsShort[a];else try{u=new Intl.DateTimeFormat(n,{month:"short"}).format(e)}catch{u=String(a+1)}const b={yyyy:String(s),yy:String(s).slice(-2),MMMM:i,MMM:u,MM:String(a+1).padStart(2,"0"),M:String(a+1),dd:String(o).padStart(2,"0"),d:String(o),HH:String(c).padStart(2,"0"),mm:String(l).padStart(2,"0")};return t.replace(/yyyy|yy|MMMM|MMM|MM|M|dd|d|HH|mm/g,function(w){return b[w]!==void 0?b[w]:w})}function N(e,t,n,r){if(!e||!(e instanceof Date)||isNaN(e.getTime()))return"";const o=je(t);if(o)try{const a=new Intl.DateTimeFormat(n,o),s=(n||"").toLowerCase().split("-")[0],c=a.resolvedOptions().locale.toLowerCase().split("-")[0];return r&&c!==s?q(e,"dd.MM.yyyy",n,r):a.format(e)}catch{return q(e,"dd.MM.yyyy",n,r)}return q(e,t||"dd.MM.yyyy",n,r)}(function(){const e="data-ln-date",t="lnDate";if(window[t]!==void 0)return;function n(i){const u=i[t];if(u){if(u.isTextElement)u._initTextElement();else if(u.value){const d=_(u.value);d&&u._displayFormatted(d)}}}const r={"data-ln-date":{type:"enum",values:["short","medium","long","full","iso"],fallback:"medium",effect:n,description:"Date display style preset or activator"},"data-ln-date-format":{type:"string",effect:n,description:"Custom Intl.DateTimeFormat pattern or options"},"data-ln-date-locale":{type:"string",effect:n,description:"BCP 47 language tag override for date formatting"},"data-ln-value":{type:"string",effect:n,description:"Raw ISO date string or timestamp for non-time elements (td, span)"},"data-ln-date-dict":{type:"marker",description:"Container for date translation dictionary"},"data-ln-date-dict-key":{type:"string",description:"Dictionary key for relative time or custom date formatting"},"data-ln-date-field":{type:"string",description:"Field name mapping for date record binding"},"data-ln-date-label":{type:"string",description:"Accessible label text for the date input"}},o=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value");function a(i,u,d){H(i.dom,"ln-date:change",{value:u,formatted:i.dom.value,date:d}),i.dom.dispatchEvent(new Event("change",{bubbles:!0}))}function s(i,u,d,h){i._setHiddenRaw(u),o.set.call(i._picker,u),i._lastISO=u,h!==void 0?(i._isFormatting=!0,i.dom.value=h,i._isFormatting=!1):d&&i._displayFormatted(d),a(i,u,d)}function c(i){i._setHiddenRaw(""),o.set.call(i._picker,""),i._isFormatting=!0,i.dom.value="",i._isFormatting=!1,i._lastISO="",a(i,"",null)}function l(i){if(i[t])return i[t];i[t]=this,this.dom=i;const u=this;if(this._onLocaleChange=function(){if(u.isTextElement)u._formatTextContent();else if(u.value){const f=_(u.value);f&&u._displayFormatted(f)}},U(),document.addEventListener("ln-core:locale-change",this._onLocaleChange),i.tagName!=="INPUT")return this.isTextElement=!0,this._initTextElement(),this;this.isTextElement=!1;const d=i.value,h=i.name,b=i.closest(".form-element, form")||i.parentNode;if(b){const f=b.querySelectorAll("[data-ln-date-dict]");for(let m=0;m<f.length;m++){const p=f[m].getAttribute("data-ln-date-dict");if(p){const y=be(f[m],"data-ln-date-dict-key");y["months-long"]&&(y.monthsLong=y["months-long"].split(",").map(v=>v.trim())),y["months-short"]&&(y.monthsShort=y["months-short"].split(",").map(v=>v.trim())),Y(p,y)}}}const w=document.createElement("span");w.setAttribute("data-ln-date-field",""),i.parentNode.insertBefore(w,i),w.appendChild(i),this._wrapper=w;const g=document.createElement("input");g.type="hidden",g.name=h,i.removeAttribute("name"),i.hasAttribute("data-ln-fill-as")&&g.setAttribute("data-ln-fill-as",i.getAttribute("data-ln-fill-as")),i.insertAdjacentElement("afterend",g),this._hidden=g;const C=document.createElement("input");C.type="date",C.tabIndex=-1,C.setAttribute("tabindex","-1"),C.setAttribute("aria-hidden","true"),C.setAttribute("aria-label",i.getAttribute("data-ln-date-label")||"Date picker"),C.style.cssText="position:absolute;opacity:0;width:0;height:0;overflow:hidden;pointer-events:none",g.insertAdjacentElement("afterend",C),this._picker=C,i.type="text";const x=document.createElement("button");x.type="button",x.setAttribute("aria-label",i.getAttribute("data-ln-date-label")||"Open date picker"),x.innerHTML='<svg class="ln-icon" aria-hidden="true"><use href="#ln-icon-calendar"></use></svg>',C.insertAdjacentElement("afterend",x),this._btn=x,this._lastISO="",Object.defineProperty(g,"value",{get:function(){return o.get.call(g)},set:function(f){if(o.set.call(g,f),f&&f!==""){const m=_(f);m&&s(u,f,m)}else f===""&&c(u)}}),fe(i,o,{get:function(){return o.get.call(i)},set:function(f,m){if(u._isFormatting){m(f);return}if(!f||f===""){m(""),c(u);return}const p=_(f)||O(f);if(p){const y=S(p),v=i.getAttribute(e)||"",A=L(i),D=E(A),k=N(p,v,A,D);m(k),s(u,y,p,k)}else m(String(f)),c(u)}}),this._onPickerChange=function(){const f=C.value;if(f){const m=_(f);m&&s(u,f,m)}else c(u)},C.addEventListener("change",this._onPickerChange),this._onBlur=function(){const f=u.dom.value.trim();if(f===""){u._lastISO!==""&&c(u);return}if(u._lastISO){const p=_(u._lastISO);if(p){const y=u.dom.getAttribute(e)||"",v=L(u.dom),A=E(v);if(f===N(p,y,v,A))return}}const m=O(f);if(m){const p=S(m);s(u,p,m)}else if(u._lastISO){const p=_(u._lastISO);p&&u._displayFormatted(p)}else u.dom.value=""},i.addEventListener("blur",this._onBlur),this._onBtnClick=function(){u._openPicker()},x.addEventListener("click",this._onBtnClick);const T=i.form;if(T&&(this._form=T,this._onFormReset=function(){setTimeout(function(){const f=u.dom.value;if(f){const m=_(f)||O(f);if(m){const p=S(m);s(u,p,m);return}}c(u)},0)},T.addEventListener("reset",this._onFormReset)),d&&d!==""){const f=_(d);f&&s(u,d,f)}return this}l.prototype._initTextElement=function(){const i=this.dom,u=i.getAttribute("data-ln-value"),d=i.getAttribute("data-ln-date"),h=i.getAttribute("datetime");let b=null;i.tagName==="TIME"&&h!==null&&h!==""?b=h:u!==null&&u!==""?b=u:h!==null&&h!==""?b=h:d!==null&&d!==""&&d!=="true"&&!j.test(d)?b=d:b=i.textContent.trim();const w=_(b)||O(b);if(w&&!isNaN(w.getTime())){const g=S(w);this._rawValue=g,i.tagName!=="TIME"&&!i.hasAttribute("data-ln-value")&&i.setAttribute("data-ln-value",g),this._formatTextContent()}else this._rawValue=null},l.prototype._formatTextContent=function(){if(this._rawValue){const i=_(this._rawValue);if(i){let d=this.dom.getAttribute("data-ln-date-format");if(!d){const w=this.dom.getAttribute("data-ln-date");w&&j.test(w)&&(d=w)}const h=L(this.dom),b=E(h);this.dom.textContent=N(i,d||"medium",h,b)}}},l.prototype._openPicker=function(){if(typeof this._picker.showPicker=="function")try{this._picker.showPicker()}catch{this._picker.click()}else this._picker.click()},l.prototype._setHiddenRaw=function(i){o.set.call(this._hidden,i)},l.prototype._displayFormatted=function(i){const u=this.dom.getAttribute(e)||"",d=L(this.dom),h=E(d);this._isFormatting=!0,this.dom.value=N(i,u,d,h),this._isFormatting=!1},Object.defineProperty(l.prototype,"value",{get:function(){return this.isTextElement?this._rawValue||"":o.get.call(this._hidden)},set:function(i){if(this.isTextElement){if(!i||i===""){this._rawValue=null,this.dom.removeAttribute("data-ln-value"),this.dom.tagName==="TIME"&&this.dom.removeAttribute("datetime"),this.dom.textContent="";return}const d=_(i)||O(i);if(!d)return;const h=S(d);this._rawValue=h,this.dom.tagName==="TIME"?this.dom.setAttribute("datetime",h):this.dom.setAttribute("data-ln-value",h),this._formatTextContent();return}if(!i||i===""){c(this);return}const u=_(i);u&&s(this,i,u)}}),Object.defineProperty(l.prototype,"date",{get:function(){const i=this.value;return i?_(i):null},set:function(i){if(!i||!(i instanceof Date)||isNaN(i.getTime())){this.value="";return}this.value=S(i)}}),Object.defineProperty(l.prototype,"formatted",{get:function(){return this.isTextElement?this.dom.textContent:this.dom.value}}),l.prototype.destroy=function(){if(!this.dom[t])return;if(this._onLocaleChange&&document.removeEventListener("ln-core:locale-change",this._onLocaleChange),this.isTextElement){delete this.dom[t];return}this._form&&this._onFormReset&&this._form.removeEventListener("reset",this._onFormReset),this._picker.removeEventListener("change",this._onPickerChange),this.dom.removeEventListener("blur",this._onBlur),this._btn.removeEventListener("click",this._onBtnClick);const i=this.value;this._hidden.remove(),this._picker.remove(),this._btn.remove(),this._wrapper&&this._wrapper.parentNode&&(this._wrapper.parentNode.insertBefore(this.dom,this._wrapper),this._wrapper.remove()),delete this.dom.value,this.dom.name=this._hidden.name,this.dom.type="date",i&&(this.dom.value=i),delete this.dom[t]},le(e,t,l,"ln-date",{attributes:r,extraAttributes:["datetime","lang"],onAttributeChange:n})})()})();