@lmvz-ds/components 0.12.4 → 0.12.5-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/dist/cjs/app-globals-V2Kpy_OQ.js.map +1 -0
  2. package/dist/cjs/assets-Cswkqk_c.js +18971 -0
  3. package/dist/cjs/assets-Cswkqk_c.js.map +1 -0
  4. package/dist/cjs/axe-C2rxi-K2.js +32837 -0
  5. package/dist/cjs/axe-C2rxi-K2.js.map +1 -0
  6. package/dist/cjs/header-integration.lmvz-button.lmvz-header.lmvz-icon.lmvz-input.lmvz-menuitem-BTL_B6qg.js +3665 -0
  7. package/dist/cjs/header-integration.lmvz-button.lmvz-header.lmvz-icon.lmvz-input.lmvz-menuitem-BTL_B6qg.js.map +1 -0
  8. package/dist/cjs/header-integration_6.cjs.entry.js +18 -0
  9. package/dist/cjs/header-integration_6.cjs.entry.js.map +1 -0
  10. package/dist/cjs/icons-jn_Uak9B.js +1063 -0
  11. package/dist/cjs/icons-jn_Uak9B.js.map +1 -0
  12. package/dist/cjs/index-DpBPf1cE.js +2112 -0
  13. package/dist/cjs/index-DpBPf1cE.js.map +1 -0
  14. package/dist/cjs/index.cjs.js.map +1 -0
  15. package/dist/cjs/lmvz-action.cjs.entry.js.map +1 -0
  16. package/dist/cjs/lmvz-card.cjs.entry.js.map +1 -0
  17. package/dist/cjs/lmvz-chip.cjs.entry.js.map +1 -0
  18. package/dist/cjs/lmvz-components.cjs.js.map +1 -0
  19. package/dist/cjs/loader.cjs.js.map +1 -0
  20. package/dist/collection/api/ds.constants.js.map +1 -0
  21. package/dist/collection/api/index.js.map +1 -0
  22. package/dist/collection/components/lmvz-action/lmvz-action.js.map +1 -0
  23. package/dist/collection/components/lmvz-button/lmvz-button.js.map +1 -0
  24. package/dist/collection/components/lmvz-card/lmvz-card.js.map +1 -0
  25. package/dist/collection/components/lmvz-chip/lmvz-chip.js.map +1 -0
  26. package/dist/collection/components/lmvz-header/lmvz-header.js.map +1 -0
  27. package/dist/collection/components/lmvz-icon/icons.js.map +1 -0
  28. package/dist/collection/components/lmvz-icon/lmvz-icon.js.map +1 -0
  29. package/dist/collection/components/lmvz-icon/public.js.map +1 -0
  30. package/dist/collection/components/lmvz-icon/test/icons.unit.js.map +1 -0
  31. package/dist/collection/components/lmvz-input/lmvz-input.js.map +1 -0
  32. package/dist/collection/components/lmvz-menuitem/lmvz-menuitem.js.map +1 -0
  33. package/dist/collection/index.js.map +1 -0
  34. package/dist/collection/integration/header-integration.js +22 -4
  35. package/dist/collection/integration/header-integration.js.map +1 -0
  36. package/dist/collection/utils/assets.js.map +1 -0
  37. package/dist/collection/utils/component.js.map +1 -0
  38. package/dist/collection/utils/effect.js.map +1 -0
  39. package/dist/collection/utils/element-activation-controller.js.map +1 -0
  40. package/dist/collection/utils/environment.js.map +1 -0
  41. package/dist/collection/utils/http.js.map +1 -0
  42. package/dist/collection/utils/http.test.js.map +1 -0
  43. package/dist/collection/utils/list-keyboard-controller.js.map +1 -0
  44. package/dist/collection/utils/public.js.map +1 -0
  45. package/dist/collection/utils/reactive-controller-host.js.map +1 -0
  46. package/dist/collection/utils/typing.js.map +1 -0
  47. package/dist/collection/utils/validation/aria-validation-controller.js.map +1 -0
  48. package/dist/collection/utils/validation/svg.js.map +1 -0
  49. package/dist/components/header-integration.d.ts +11 -0
  50. package/dist/components/header-integration.js +2 -0
  51. package/dist/components/header-integration.js.map +1 -0
  52. package/dist/components/index.js.map +1 -0
  53. package/dist/components/lmvz-action.js.map +1 -0
  54. package/dist/components/lmvz-button.js.map +1 -0
  55. package/dist/components/lmvz-card.js.map +1 -0
  56. package/dist/components/lmvz-chip.js.map +1 -0
  57. package/dist/components/lmvz-header.js.map +1 -0
  58. package/dist/components/lmvz-icon.js.map +1 -0
  59. package/dist/components/lmvz-input.js.map +1 -0
  60. package/dist/components/lmvz-menuitem.js.map +1 -0
  61. package/dist/components/p-B3JVFwO1.js.map +1 -0
  62. package/dist/components/p-B85MJLTf.js.map +1 -0
  63. package/dist/components/p-CN0JX9-m.js.map +1 -0
  64. package/dist/components/p-Cd4nH2vx.js +2 -0
  65. package/dist/components/p-Cd4nH2vx.js.map +1 -0
  66. package/dist/components/p-CdofjRtQ.js.map +1 -0
  67. package/dist/components/p-CkTUjPwD.js +2 -0
  68. package/dist/components/p-CkTUjPwD.js.map +1 -0
  69. package/dist/components/p-CpI4KFOu.js +2 -0
  70. package/dist/components/p-CpI4KFOu.js.map +1 -0
  71. package/dist/components/p-D1HbKFuh.js.map +1 -0
  72. package/dist/components/p-D7xthqTT.js +2 -0
  73. package/dist/components/p-D7xthqTT.js.map +1 -0
  74. package/dist/components/p-DBeynNeU.js +2 -0
  75. package/dist/components/p-DBeynNeU.js.map +1 -0
  76. package/dist/components/p-DMLRPGid.js.map +1 -0
  77. package/dist/components/p-UiqQVZhU.js +2 -0
  78. package/dist/components/p-UiqQVZhU.js.map +1 -0
  79. package/dist/components/p-Xq267cFM.js +2 -0
  80. package/dist/components/p-Xq267cFM.js.map +1 -0
  81. package/dist/components/p-glDDybgu.js +2 -0
  82. package/dist/components/p-glDDybgu.js.map +1 -0
  83. package/dist/esm/app-globals-DQuL1Twl.js.map +1 -0
  84. package/dist/esm/assets-K2FHD9qn.js +18770 -0
  85. package/dist/esm/assets-K2FHD9qn.js.map +1 -0
  86. package/dist/esm/axe-CZ0Rtkog.js +32835 -0
  87. package/dist/esm/axe-CZ0Rtkog.js.map +1 -0
  88. package/dist/esm/header-integration.lmvz-button.lmvz-header.lmvz-icon.lmvz-input.lmvz-menuitem-CW3FGLZC.js +3657 -0
  89. package/dist/esm/header-integration.lmvz-button.lmvz-header.lmvz-icon.lmvz-input.lmvz-menuitem-CW3FGLZC.js.map +1 -0
  90. package/dist/esm/header-integration_6.entry.js +7 -0
  91. package/dist/esm/header-integration_6.entry.js.map +1 -0
  92. package/dist/esm/icons-BITzEzmq.js +1032 -0
  93. package/dist/esm/icons-BITzEzmq.js.map +1 -0
  94. package/dist/esm/index-D2eyw7iv.js +2101 -0
  95. package/dist/esm/index-D2eyw7iv.js.map +1 -0
  96. package/dist/esm/index.js.map +1 -0
  97. package/dist/esm/lmvz-action.entry.js.map +1 -0
  98. package/dist/esm/lmvz-card.entry.js.map +1 -0
  99. package/dist/esm/lmvz-chip.entry.js.map +1 -0
  100. package/dist/esm/lmvz-components.js.map +1 -0
  101. package/dist/esm/loader.js.map +1 -0
  102. package/dist/lmvz-components/index.esm.js.map +1 -0
  103. package/dist/lmvz-components/lmvz-components.esm.js.map +1 -0
  104. package/dist/lmvz-components/p-366a01f8.entry.js +2 -0
  105. package/dist/lmvz-components/p-366a01f8.entry.js.map +1 -0
  106. package/dist/lmvz-components/p-84ee7919.entry.js +2 -0
  107. package/dist/lmvz-components/p-84ee7919.entry.js.map +1 -0
  108. package/dist/lmvz-components/p-BLwPC3DQ.js +2 -0
  109. package/dist/lmvz-components/p-BLwPC3DQ.js.map +1 -0
  110. package/dist/lmvz-components/p-D2eyw7iv.js +3 -0
  111. package/dist/lmvz-components/p-D2eyw7iv.js.map +1 -0
  112. package/dist/lmvz-components/p-DANVVVBd.js +7 -0
  113. package/dist/lmvz-components/p-DANVVVBd.js.map +1 -0
  114. package/dist/lmvz-components/p-DQuL1Twl.js.map +1 -0
  115. package/dist/lmvz-components/p-DlDurXvX.js +2 -0
  116. package/dist/lmvz-components/p-DlDurXvX.js.map +1 -0
  117. package/dist/lmvz-components/p-Hc4uxoTU.js +13 -0
  118. package/dist/lmvz-components/p-Hc4uxoTU.js.map +1 -0
  119. package/dist/lmvz-components/p-a4200b26.entry.js +2 -0
  120. package/dist/lmvz-components/p-a4200b26.entry.js.map +1 -0
  121. package/dist/lmvz-components/p-d3243bae.entry.js +2 -0
  122. package/dist/lmvz-components/p-d3243bae.entry.js.map +1 -0
  123. package/dist/manifest.json +26 -2
  124. package/package.json +10 -9
@@ -0,0 +1,1032 @@
1
+ import { bs as getOrThrowWith, aO as right, aN as left, a9 as identity, bt as isRight, bu as getRight, b5 as match$1, z as deferredMake, Q as deferredAwait, N as deferredSucceed, bv as deferredFailCause, W as deferredUnsafeMake, bw as deferredInterrupt, bx as deferredDone, by as deferredIsDone, bz as exitIsFailure, bA as exitIsSuccess, bB as exitMatch, bC as exitFailCause, bD as exitSucceed, bE as exitFail, bF as exitZipRight, bG as exitCollectAll, bH as exitVoid, bI as exitDie, bJ as exitMap, bK as exitZip, w as dual, A as pipeArguments, bL as NodeInspectSymbol, bM as toJSON, bN as format, $ as prepend, a4 as empty$1, bO as reverse, bP as decode, x as map$1, bQ as all$1, bR as context, a6 as fiberId, bS as merge, v as sync, bT as size, B as suspend, bU as get, R as succeed$2, G as none, bV as has, at as isSome, H as some, bW as getOrUndefined, bX as set, bY as struct, t as flatMap, bZ as remove$1, b_ as empty$2, b$ as clockWith, c0 as compareAndSet, K as set$1, y as make$4, c1 as symbol, s as pipe, c2 as cached, c3 as combine, c4 as hash, c5 as symbol$1, a7 as hasProperty, b8 as equals, L as asVoid, c6 as when, c7 as toMillis, X as onInterrupt, O as zipRight$1, c8 as exit, c9 as provideContext, ca as TaggedError, aU as gen, cb as tryPromise, cc as try_, cd as logWarning, ce as infinity, cf as syncCreateAssetUrlSafely } from './assets-K2FHD9qn.js';
2
+
3
+ /**
4
+ * This module provides types and utility functions to create and work with branded types,
5
+ * which are TypeScript types with an added type tag to prevent accidental usage of a value in the wrong context.
6
+ *
7
+ * The `refined` and `nominal` functions are both used to create branded types in TypeScript.
8
+ * The main difference between them is that `refined` allows for validation of the data, while `nominal` does not.
9
+ *
10
+ * The `nominal` function is used to create a new branded type that has the same underlying type as the input, but with a different name.
11
+ * This is useful when you want to distinguish between two values of the same type that have different meanings.
12
+ * The `nominal` function does not perform any validation of the input data.
13
+ *
14
+ * On the other hand, the `refined` function is used to create a new branded type that has the same underlying type as the input,
15
+ * but with a different name, and it also allows for validation of the input data.
16
+ * The `refined` function takes a predicate that is used to validate the input data.
17
+ * If the input data fails the validation, a `BrandErrors` is returned, which provides information about the specific validation failure.
18
+ *
19
+ * @since 2.0.0
20
+ */
21
+ /**
22
+ * @since 2.0.0
23
+ * @category symbols
24
+ */
25
+ const RefinedConstructorsTypeId = /*#__PURE__*/Symbol.for("effect/Brand/Refined");
26
+ /**
27
+ * Returns a `BrandErrors` that contains a single `RefinementError`.
28
+ *
29
+ * @since 2.0.0
30
+ * @category constructors
31
+ */
32
+ const error = (message, meta) => [{
33
+ message,
34
+ meta
35
+ }];
36
+ function refined(...args) {
37
+ const either = args.length === 2 ? unbranded => args[0](unbranded) ? right(unbranded) : left(args[1](unbranded)) : unbranded => {
38
+ return match$1(args[0](unbranded), {
39
+ onNone: () => right(unbranded),
40
+ onSome: left
41
+ });
42
+ };
43
+ return Object.assign(unbranded => getOrThrowWith(either(unbranded), identity), {
44
+ [RefinedConstructorsTypeId]: RefinedConstructorsTypeId,
45
+ option: args => getRight(either(args)),
46
+ either,
47
+ is: args => isRight(either(args))
48
+ });
49
+ }
50
+
51
+ /**
52
+ * Creates a new `Deferred`.
53
+ *
54
+ * @since 2.0.0
55
+ * @category constructors
56
+ */
57
+ const make$3 = deferredMake;
58
+ const _await = deferredAwait;
59
+ /**
60
+ * Exits the `Deferred` with the specified `Exit` value, which will be
61
+ * propagated to all fibers waiting on the value of the `Deferred`.
62
+ *
63
+ * @since 2.0.0
64
+ * @category utils
65
+ */
66
+ const done = deferredDone;
67
+ /**
68
+ * Fails the `Deferred` with the specified `Cause`, which will be propagated to
69
+ * all fibers waiting on the value of the `Deferred`.
70
+ *
71
+ * @since 2.0.0
72
+ * @category utils
73
+ */
74
+ const failCause$1 = deferredFailCause;
75
+ /**
76
+ * Completes the `Deferred` with interruption. This will interrupt all fibers
77
+ * waiting on the value of the `Deferred` with the `FiberId` of the fiber
78
+ * calling this method.
79
+ *
80
+ * @since 2.0.0
81
+ * @category utils
82
+ */
83
+ const interrupt = deferredInterrupt;
84
+ /**
85
+ * Returns `true` if this `Deferred` has already been completed with a value or
86
+ * an error, `false` otherwise.
87
+ *
88
+ * @since 2.0.0
89
+ * @category getters
90
+ */
91
+ const isDone = deferredIsDone;
92
+ /**
93
+ * Completes the `Deferred` with the specified value.
94
+ *
95
+ * @since 2.0.0
96
+ * @category utils
97
+ */
98
+ const succeed$1 = deferredSucceed;
99
+ /**
100
+ * Unsafely creates a new `Deferred` from the specified `FiberId`.
101
+ *
102
+ * @since 2.0.0
103
+ * @category unsafe
104
+ */
105
+ const unsafeMake = deferredUnsafeMake;
106
+
107
+ /**
108
+ * Returns `true` if the specified `Exit` is a `Failure`, `false` otherwise.
109
+ *
110
+ * @since 2.0.0
111
+ * @category refinements
112
+ */
113
+ const isFailure = exitIsFailure;
114
+ /**
115
+ * Returns `true` if the specified `Exit` is a `Success`, `false` otherwise.
116
+ *
117
+ * @since 2.0.0
118
+ * @category refinements
119
+ */
120
+ const isSuccess = exitIsSuccess;
121
+ /**
122
+ * Collects all of the specified exit values into a `Some<Exit<List<A>, E>>`. If
123
+ * the provided iterable contains no elements, `None` will be returned.
124
+ *
125
+ * @since 2.0.0
126
+ * @category constructors
127
+ */
128
+ const all = exitCollectAll;
129
+ /**
130
+ * Constructs a new `Exit.Failure` from the specified unrecoverable defect.
131
+ *
132
+ * @since 2.0.0
133
+ * @category constructors
134
+ */
135
+ const die = exitDie;
136
+ /**
137
+ * Constructs a new `Exit.Failure` from the specified recoverable error of type
138
+ * `E`.
139
+ *
140
+ * @since 2.0.0
141
+ * @category constructors
142
+ */
143
+ const fail = exitFail;
144
+ /**
145
+ * Constructs a new `Exit.Failure` from the specified `Cause` of type `E`.
146
+ *
147
+ * @since 2.0.0
148
+ * @category constructors
149
+ */
150
+ const failCause = exitFailCause;
151
+ /**
152
+ * Maps over the `Success` value of the specified exit using the provided
153
+ * function.
154
+ *
155
+ * @since 2.0.0
156
+ * @category mapping
157
+ */
158
+ const map = exitMap;
159
+ /**
160
+ * @since 2.0.0
161
+ * @category folding
162
+ */
163
+ const match = exitMatch;
164
+ /**
165
+ * Constructs a new `Exit.Success` containing the specified value of type `A`.
166
+ *
167
+ * @since 2.0.0
168
+ * @category constructors
169
+ */
170
+ const succeed = exitSucceed;
171
+ const void_ = exitVoid;
172
+ /**
173
+ * Sequentially zips the this result with the specified result or else returns
174
+ * the failed `Cause<E | E2>`.
175
+ *
176
+ * @since 2.0.0
177
+ * @category zipping
178
+ */
179
+ const zip = exitZip;
180
+ /**
181
+ * Sequentially zips the this result with the specified result discarding the
182
+ * first element of the tuple or else returns the failed `Cause<E | E2>`.
183
+ *
184
+ * @since 2.0.0
185
+ * @category zipping
186
+ */
187
+ const zipRight = exitZipRight;
188
+
189
+ /**
190
+ * @since 2.0.0
191
+ */
192
+ const TypeId$1 = /*#__PURE__*/Symbol.for("effect/MutableList");
193
+ const MutableListProto = {
194
+ [TypeId$1]: TypeId$1,
195
+ [Symbol.iterator]() {
196
+ let done = false;
197
+ let head = this.head;
198
+ return {
199
+ next() {
200
+ if (done) {
201
+ return this.return();
202
+ }
203
+ if (head == null) {
204
+ done = true;
205
+ return this.return();
206
+ }
207
+ const value = head.value;
208
+ head = head.next;
209
+ return {
210
+ done,
211
+ value
212
+ };
213
+ },
214
+ return(value) {
215
+ if (!done) {
216
+ done = true;
217
+ }
218
+ return {
219
+ done: true,
220
+ value
221
+ };
222
+ }
223
+ };
224
+ },
225
+ toString() {
226
+ return format(this.toJSON());
227
+ },
228
+ toJSON() {
229
+ return {
230
+ _id: "MutableList",
231
+ values: Array.from(this).map(toJSON)
232
+ };
233
+ },
234
+ [NodeInspectSymbol]() {
235
+ return this.toJSON();
236
+ },
237
+ pipe() {
238
+ return pipeArguments(this, arguments);
239
+ }
240
+ };
241
+ /** @internal */
242
+ const makeNode = value => ({
243
+ value,
244
+ removed: false,
245
+ prev: undefined,
246
+ next: undefined
247
+ });
248
+ /**
249
+ * Creates an empty `MutableList`.
250
+ *
251
+ * @since 2.0.0
252
+ * @category constructors
253
+ */
254
+ const empty = () => {
255
+ const list = Object.create(MutableListProto);
256
+ list.head = undefined;
257
+ list.tail = undefined;
258
+ list._length = 0;
259
+ return list;
260
+ };
261
+ /**
262
+ * Returns `true` if the list contains zero elements, `false`, otherwise.
263
+ *
264
+ * @since 2.0.0
265
+ * @category getters
266
+ */
267
+ const isEmpty$1 = self => length$1(self) === 0;
268
+ /**
269
+ * Returns the length of the list.
270
+ *
271
+ * @since 2.0.0
272
+ * @category getters
273
+ */
274
+ const length$1 = self => self._length;
275
+ /**
276
+ * Appends the specified element to the end of the `MutableList`.
277
+ *
278
+ * @category concatenating
279
+ * @since 2.0.0
280
+ */
281
+ const append = /*#__PURE__*/dual(2, (self, value) => {
282
+ const node = makeNode(value);
283
+ if (self.head === undefined) {
284
+ self.head = node;
285
+ }
286
+ if (self.tail === undefined) {
287
+ self.tail = node;
288
+ } else {
289
+ self.tail.next = node;
290
+ node.prev = self.tail;
291
+ self.tail = node;
292
+ }
293
+ self._length += 1;
294
+ return self;
295
+ });
296
+ /**
297
+ * Removes the first value from the list and returns it, if it exists.
298
+ *
299
+ * @since 0.0.1
300
+ */
301
+ const shift = self => {
302
+ const head = self.head;
303
+ if (head !== undefined) {
304
+ remove(self, head);
305
+ return head.value;
306
+ }
307
+ return undefined;
308
+ };
309
+ const remove = (self, node) => {
310
+ if (node.removed) {
311
+ return;
312
+ }
313
+ node.removed = true;
314
+ if (node.prev !== undefined && node.next !== undefined) {
315
+ node.prev.next = node.next;
316
+ node.next.prev = node.prev;
317
+ } else if (node.prev !== undefined) {
318
+ self.tail = node.prev;
319
+ node.prev.next = undefined;
320
+ } else if (node.next !== undefined) {
321
+ self.head = node.next;
322
+ node.next.prev = undefined;
323
+ } else {
324
+ self.tail = undefined;
325
+ self.head = undefined;
326
+ }
327
+ if (self._length > 0) {
328
+ self._length -= 1;
329
+ }
330
+ };
331
+
332
+ /**
333
+ * @since 2.0.0
334
+ */
335
+ const TypeId = /*#__PURE__*/Symbol.for("effect/MutableQueue");
336
+ /**
337
+ * @since 2.0.0
338
+ * @category symbol
339
+ */
340
+ const EmptyMutableQueue = /*#__PURE__*/Symbol.for("effect/mutable/MutableQueue/Empty");
341
+ const MutableQueueProto = {
342
+ [TypeId]: TypeId,
343
+ [Symbol.iterator]() {
344
+ return Array.from(this.queue)[Symbol.iterator]();
345
+ },
346
+ toString() {
347
+ return format(this.toJSON());
348
+ },
349
+ toJSON() {
350
+ return {
351
+ _id: "MutableQueue",
352
+ values: Array.from(this).map(toJSON)
353
+ };
354
+ },
355
+ [NodeInspectSymbol]() {
356
+ return this.toJSON();
357
+ },
358
+ pipe() {
359
+ return pipeArguments(this, arguments);
360
+ }
361
+ };
362
+ const make$2 = capacity => {
363
+ const queue = Object.create(MutableQueueProto);
364
+ queue.queue = empty();
365
+ queue.capacity = capacity;
366
+ return queue;
367
+ };
368
+ /**
369
+ * Creates a new bounded `MutableQueue`.
370
+ *
371
+ * @since 2.0.0
372
+ * @category constructors
373
+ */
374
+ const bounded = capacity => make$2(capacity);
375
+ /**
376
+ * Creates a new unbounded `MutableQueue`.
377
+ *
378
+ * @since 2.0.0
379
+ * @category constructors
380
+ */
381
+ const unbounded = () => make$2(undefined);
382
+ /**
383
+ * Returns the current number of elements in the queue.
384
+ *
385
+ * @since 2.0.0
386
+ * @category getters
387
+ */
388
+ const length = self => length$1(self.queue);
389
+ /**
390
+ * Returns `true` if the queue is empty, `false` otherwise.
391
+ *
392
+ * @since 2.0.0
393
+ * @category getters
394
+ */
395
+ const isEmpty = self => isEmpty$1(self.queue);
396
+ /**
397
+ * The **maximum** number of elements that a queue can hold.
398
+ *
399
+ * **Note**: unbounded queues can still implement this interface with
400
+ * `capacity = Infinity`.
401
+ *
402
+ * @since 2.0.0
403
+ * @category getters
404
+ */
405
+ const capacity = self => self.capacity === undefined ? Infinity : self.capacity;
406
+ /**
407
+ * Offers an element to the queue.
408
+ *
409
+ * Returns whether the enqueue was successful or not.
410
+ *
411
+ * @since 2.0.0
412
+ */
413
+ const offer = /*#__PURE__*/dual(2, (self, value) => {
414
+ const queueLength = length$1(self.queue);
415
+ if (self.capacity !== undefined && queueLength === self.capacity) {
416
+ return false;
417
+ }
418
+ append(value)(self.queue);
419
+ return true;
420
+ });
421
+ /**
422
+ * Enqueues a collection of values into the queue.
423
+ *
424
+ * Returns a `Chunk` of the values that were **not** able to be enqueued.
425
+ *
426
+ * @since 2.0.0
427
+ */
428
+ const offerAll = /*#__PURE__*/dual(2, (self, values) => {
429
+ const iterator = values[Symbol.iterator]();
430
+ let next;
431
+ let remainder = empty$1();
432
+ let offering = true;
433
+ while (offering && (next = iterator.next()) && !next.done) {
434
+ offering = offer(next.value)(self);
435
+ }
436
+ while (next != null && !next.done) {
437
+ remainder = prepend(next.value)(remainder);
438
+ next = iterator.next();
439
+ }
440
+ return reverse(remainder);
441
+ });
442
+ /**
443
+ * Dequeues an element from the queue.
444
+ *
445
+ * Returns either an element from the queue, or the `def` param.
446
+ *
447
+ * **Note**: if there is no meaningful default for your type, you can always
448
+ * use `poll(MutableQueue.EmptyMutableQueue)`.
449
+ *
450
+ * @since 2.0.0
451
+ */
452
+ const poll = /*#__PURE__*/dual(2, (self, def) => {
453
+ if (isEmpty$1(self.queue)) {
454
+ return def;
455
+ }
456
+ return shift(self.queue);
457
+ });
458
+ /**
459
+ * Dequeues up to `n` elements from the queue.
460
+ *
461
+ * Returns a `List` of up to `n` elements.
462
+ *
463
+ * @since 2.0.0
464
+ */
465
+ const pollUpTo = /*#__PURE__*/dual(2, (self, n) => {
466
+ let result = empty$1();
467
+ let count = 0;
468
+ while (count < n) {
469
+ const element = poll(EmptyMutableQueue)(self);
470
+ if (element === EmptyMutableQueue) {
471
+ break;
472
+ }
473
+ result = prepend(element)(result);
474
+ count += 1;
475
+ }
476
+ return reverse(result);
477
+ });
478
+
479
+ /** @internal */
480
+ const complete = (key, exit, entryStats, timeToLiveMillis) => struct({
481
+ _tag: "Complete",
482
+ key,
483
+ exit,
484
+ entryStats,
485
+ timeToLiveMillis
486
+ });
487
+ /** @internal */
488
+ const pending = (key, deferred) => struct({
489
+ _tag: "Pending",
490
+ key,
491
+ deferred
492
+ });
493
+ /** @internal */
494
+ const refreshing = (deferred, complete) => struct({
495
+ _tag: "Refreshing",
496
+ deferred,
497
+ complete
498
+ });
499
+ /** @internal */
500
+ const MapKeyTypeId = /*#__PURE__*/Symbol.for("effect/Cache/MapKey");
501
+ class MapKeyImpl {
502
+ current;
503
+ [MapKeyTypeId] = MapKeyTypeId;
504
+ previous = undefined;
505
+ next = undefined;
506
+ constructor(current) {
507
+ this.current = current;
508
+ }
509
+ [symbol]() {
510
+ return pipe(hash(this.current), combine(hash(this.previous)), combine(hash(this.next)), cached(this));
511
+ }
512
+ [symbol$1](that) {
513
+ if (this === that) {
514
+ return true;
515
+ }
516
+ return isMapKey(that) && equals(this.current, that.current) && equals(this.previous, that.previous) && equals(this.next, that.next);
517
+ }
518
+ }
519
+ /** @internal */
520
+ const makeMapKey = current => new MapKeyImpl(current);
521
+ /** @internal */
522
+ const isMapKey = u => hasProperty(u, MapKeyTypeId);
523
+ class KeySetImpl {
524
+ head = undefined;
525
+ tail = undefined;
526
+ add(key) {
527
+ if (key !== this.tail) {
528
+ if (this.tail === undefined) {
529
+ this.head = key;
530
+ this.tail = key;
531
+ } else {
532
+ const previous = key.previous;
533
+ const next = key.next;
534
+ if (next !== undefined) {
535
+ key.next = undefined;
536
+ if (previous !== undefined) {
537
+ previous.next = next;
538
+ next.previous = previous;
539
+ } else {
540
+ this.head = next;
541
+ this.head.previous = undefined;
542
+ }
543
+ }
544
+ this.tail.next = key;
545
+ key.previous = this.tail;
546
+ this.tail = key;
547
+ }
548
+ }
549
+ }
550
+ remove() {
551
+ const key = this.head;
552
+ if (key !== undefined) {
553
+ const next = key.next;
554
+ if (next !== undefined) {
555
+ key.next = undefined;
556
+ this.head = next;
557
+ this.head.previous = undefined;
558
+ } else {
559
+ this.head = undefined;
560
+ this.tail = undefined;
561
+ }
562
+ }
563
+ return key;
564
+ }
565
+ }
566
+ /** @internal */
567
+ const makeKeySet = () => new KeySetImpl();
568
+ /**
569
+ * Constructs a new `CacheState` from the specified values.
570
+ *
571
+ * @internal
572
+ */
573
+ const makeCacheState = (map, keys, accesses, updating, hits, misses) => ({
574
+ map,
575
+ keys,
576
+ accesses,
577
+ updating,
578
+ hits,
579
+ misses
580
+ });
581
+ /**
582
+ * Constructs an initial cache state.
583
+ *
584
+ * @internal
585
+ */
586
+ const initialCacheState = () => makeCacheState(empty$2(), makeKeySet(), unbounded(), make$4(false), 0, 0);
587
+ /** @internal */
588
+ const CacheSymbolKey = "effect/Cache";
589
+ /** @internal */
590
+ const CacheTypeId = /*#__PURE__*/Symbol.for(CacheSymbolKey);
591
+ const cacheVariance = {
592
+ /* c8 ignore next */
593
+ _Key: _ => _,
594
+ /* c8 ignore next */
595
+ _Error: _ => _,
596
+ /* c8 ignore next */
597
+ _Value: _ => _
598
+ };
599
+ /** @internal */
600
+ const ConsumerCacheSymbolKey = "effect/ConsumerCache";
601
+ /** @internal */
602
+ const ConsumerCacheTypeId = /*#__PURE__*/Symbol.for(ConsumerCacheSymbolKey);
603
+ const consumerCacheVariance = {
604
+ /* c8 ignore next */
605
+ _Key: _ => _,
606
+ /* c8 ignore next */
607
+ _Error: _ => _,
608
+ /* c8 ignore next */
609
+ _Value: _ => _
610
+ };
611
+ /** @internal */
612
+ const makeCacheStats = options => options;
613
+ /** @internal */
614
+ const makeEntryStats = loadedMillis => ({
615
+ loadedMillis
616
+ });
617
+ class CacheImpl {
618
+ capacity;
619
+ context;
620
+ fiberId;
621
+ lookup;
622
+ timeToLive;
623
+ [CacheTypeId] = cacheVariance;
624
+ [ConsumerCacheTypeId] = consumerCacheVariance;
625
+ cacheState;
626
+ constructor(capacity, context, fiberId, lookup, timeToLive) {
627
+ this.capacity = capacity;
628
+ this.context = context;
629
+ this.fiberId = fiberId;
630
+ this.lookup = lookup;
631
+ this.timeToLive = timeToLive;
632
+ this.cacheState = initialCacheState();
633
+ }
634
+ get(key) {
635
+ return map$1(this.getEither(key), merge);
636
+ }
637
+ get cacheStats() {
638
+ return sync(() => makeCacheStats({
639
+ hits: this.cacheState.hits,
640
+ misses: this.cacheState.misses,
641
+ size: size(this.cacheState.map)
642
+ }));
643
+ }
644
+ getOption(key) {
645
+ return suspend(() => match$1(get(this.cacheState.map, key), {
646
+ onNone: () => {
647
+ const mapKey = makeMapKey(key);
648
+ this.trackAccess(mapKey);
649
+ this.trackMiss();
650
+ return succeed$2(none());
651
+ },
652
+ onSome: value => this.resolveMapValue(value)
653
+ }));
654
+ }
655
+ getOptionComplete(key) {
656
+ return suspend(() => match$1(get(this.cacheState.map, key), {
657
+ onNone: () => {
658
+ const mapKey = makeMapKey(key);
659
+ this.trackAccess(mapKey);
660
+ this.trackMiss();
661
+ return succeed$2(none());
662
+ },
663
+ onSome: value => this.resolveMapValue(value, true)
664
+ }));
665
+ }
666
+ contains(key) {
667
+ return sync(() => has(this.cacheState.map, key));
668
+ }
669
+ entryStats(key) {
670
+ return sync(() => {
671
+ const option = get(this.cacheState.map, key);
672
+ if (isSome(option)) {
673
+ switch (option.value._tag) {
674
+ case "Complete":
675
+ {
676
+ const loaded = option.value.entryStats.loadedMillis;
677
+ return some(makeEntryStats(loaded));
678
+ }
679
+ case "Pending":
680
+ {
681
+ return none();
682
+ }
683
+ case "Refreshing":
684
+ {
685
+ const loaded = option.value.complete.entryStats.loadedMillis;
686
+ return some(makeEntryStats(loaded));
687
+ }
688
+ }
689
+ }
690
+ return none();
691
+ });
692
+ }
693
+ getEither(key) {
694
+ return suspend(() => {
695
+ const k = key;
696
+ let mapKey = undefined;
697
+ let deferred = undefined;
698
+ let value = getOrUndefined(get(this.cacheState.map, k));
699
+ if (value === undefined) {
700
+ deferred = unsafeMake(this.fiberId);
701
+ mapKey = makeMapKey(k);
702
+ if (has(this.cacheState.map, k)) {
703
+ value = getOrUndefined(get(this.cacheState.map, k));
704
+ } else {
705
+ set(this.cacheState.map, k, pending(mapKey, deferred));
706
+ }
707
+ }
708
+ if (value === undefined) {
709
+ this.trackAccess(mapKey);
710
+ this.trackMiss();
711
+ return map$1(this.lookupValueOf(key, deferred), right);
712
+ } else {
713
+ return flatMap(this.resolveMapValue(value), match$1({
714
+ onNone: () => this.getEither(key),
715
+ onSome: value => succeed$2(left(value))
716
+ }));
717
+ }
718
+ });
719
+ }
720
+ invalidate(key) {
721
+ return sync(() => {
722
+ remove$1(this.cacheState.map, key);
723
+ });
724
+ }
725
+ invalidateWhen(key, when) {
726
+ return sync(() => {
727
+ const value = get(this.cacheState.map, key);
728
+ if (isSome(value) && value.value._tag === "Complete") {
729
+ if (value.value.exit._tag === "Success") {
730
+ if (when(value.value.exit.value)) {
731
+ remove$1(this.cacheState.map, key);
732
+ }
733
+ }
734
+ }
735
+ });
736
+ }
737
+ get invalidateAll() {
738
+ return sync(() => {
739
+ this.cacheState.map = empty$2();
740
+ });
741
+ }
742
+ refresh(key) {
743
+ return clockWith(clock => suspend(() => {
744
+ const k = key;
745
+ const deferred = unsafeMake(this.fiberId);
746
+ let value = getOrUndefined(get(this.cacheState.map, k));
747
+ if (value === undefined) {
748
+ if (has(this.cacheState.map, k)) {
749
+ value = getOrUndefined(get(this.cacheState.map, k));
750
+ } else {
751
+ set(this.cacheState.map, k, pending(makeMapKey(k), deferred));
752
+ }
753
+ }
754
+ if (value === undefined) {
755
+ return asVoid(this.lookupValueOf(key, deferred));
756
+ } else {
757
+ switch (value._tag) {
758
+ case "Complete":
759
+ {
760
+ if (this.hasExpired(clock, value.timeToLiveMillis)) {
761
+ const found = getOrUndefined(get(this.cacheState.map, k));
762
+ if (equals(found, value)) {
763
+ remove$1(this.cacheState.map, k);
764
+ }
765
+ return asVoid(this.get(key));
766
+ }
767
+ // Only trigger the lookup if we're still the current value, `completedResult`
768
+ return pipe(this.lookupValueOf(key, deferred), when(() => {
769
+ const current = getOrUndefined(get(this.cacheState.map, k));
770
+ if (equals(current, value)) {
771
+ const mapValue = refreshing(deferred, value);
772
+ set(this.cacheState.map, k, mapValue);
773
+ return true;
774
+ }
775
+ return false;
776
+ }), asVoid);
777
+ }
778
+ case "Pending":
779
+ {
780
+ return _await(value.deferred);
781
+ }
782
+ case "Refreshing":
783
+ {
784
+ return _await(value.deferred);
785
+ }
786
+ }
787
+ }
788
+ }));
789
+ }
790
+ set(key, value) {
791
+ return clockWith(clock => sync(() => {
792
+ const now = clock.unsafeCurrentTimeMillis();
793
+ const k = key;
794
+ const lookupResult = succeed(value);
795
+ const mapValue = complete(makeMapKey(k), lookupResult, makeEntryStats(now), now + toMillis(decode(this.timeToLive(lookupResult))));
796
+ set(this.cacheState.map, k, mapValue);
797
+ }));
798
+ }
799
+ get size() {
800
+ return sync(() => {
801
+ return size(this.cacheState.map);
802
+ });
803
+ }
804
+ get values() {
805
+ return sync(() => {
806
+ const values = [];
807
+ for (const entry of this.cacheState.map) {
808
+ if (entry[1]._tag === "Complete" && entry[1].exit._tag === "Success") {
809
+ values.push(entry[1].exit.value);
810
+ }
811
+ }
812
+ return values;
813
+ });
814
+ }
815
+ get entries() {
816
+ return sync(() => {
817
+ const values = [];
818
+ for (const entry of this.cacheState.map) {
819
+ if (entry[1]._tag === "Complete" && entry[1].exit._tag === "Success") {
820
+ values.push([entry[0], entry[1].exit.value]);
821
+ }
822
+ }
823
+ return values;
824
+ });
825
+ }
826
+ get keys() {
827
+ return sync(() => {
828
+ const keys = [];
829
+ for (const entry of this.cacheState.map) {
830
+ if (entry[1]._tag === "Complete" && entry[1].exit._tag === "Success") {
831
+ keys.push(entry[0]);
832
+ }
833
+ }
834
+ return keys;
835
+ });
836
+ }
837
+ resolveMapValue(value, ignorePending = false) {
838
+ return clockWith(clock => {
839
+ switch (value._tag) {
840
+ case "Complete":
841
+ {
842
+ this.trackAccess(value.key);
843
+ if (this.hasExpired(clock, value.timeToLiveMillis)) {
844
+ remove$1(this.cacheState.map, value.key.current);
845
+ return succeed$2(none());
846
+ }
847
+ this.trackHit();
848
+ return map$1(value.exit, some);
849
+ }
850
+ case "Pending":
851
+ {
852
+ this.trackAccess(value.key);
853
+ this.trackHit();
854
+ if (ignorePending) {
855
+ return succeed$2(none());
856
+ }
857
+ return map$1(_await(value.deferred), some);
858
+ }
859
+ case "Refreshing":
860
+ {
861
+ this.trackAccess(value.complete.key);
862
+ this.trackHit();
863
+ if (this.hasExpired(clock, value.complete.timeToLiveMillis)) {
864
+ if (ignorePending) {
865
+ return succeed$2(none());
866
+ }
867
+ return map$1(_await(value.deferred), some);
868
+ }
869
+ return map$1(value.complete.exit, some);
870
+ }
871
+ }
872
+ });
873
+ }
874
+ trackHit() {
875
+ this.cacheState.hits = this.cacheState.hits + 1;
876
+ }
877
+ trackMiss() {
878
+ this.cacheState.misses = this.cacheState.misses + 1;
879
+ }
880
+ trackAccess(key) {
881
+ offer(this.cacheState.accesses, key);
882
+ if (compareAndSet(this.cacheState.updating, false, true)) {
883
+ let loop = true;
884
+ while (loop) {
885
+ const key = poll(this.cacheState.accesses, EmptyMutableQueue);
886
+ if (key === EmptyMutableQueue) {
887
+ loop = false;
888
+ } else {
889
+ this.cacheState.keys.add(key);
890
+ }
891
+ }
892
+ let size$1 = size(this.cacheState.map);
893
+ loop = size$1 > this.capacity;
894
+ while (loop) {
895
+ const key = this.cacheState.keys.remove();
896
+ if (key !== undefined) {
897
+ if (has(this.cacheState.map, key.current)) {
898
+ remove$1(this.cacheState.map, key.current);
899
+ size$1 = size$1 - 1;
900
+ loop = size$1 > this.capacity;
901
+ }
902
+ } else {
903
+ loop = false;
904
+ }
905
+ }
906
+ set$1(this.cacheState.updating, false);
907
+ }
908
+ }
909
+ hasExpired(clock, timeToLiveMillis) {
910
+ return clock.unsafeCurrentTimeMillis() > timeToLiveMillis;
911
+ }
912
+ lookupValueOf(input, deferred) {
913
+ return clockWith(clock => suspend(() => {
914
+ const key = input;
915
+ return pipe(this.lookup(input), provideContext(this.context), exit, flatMap(exit => {
916
+ const now = clock.unsafeCurrentTimeMillis();
917
+ const stats = makeEntryStats(now);
918
+ const value = complete(makeMapKey(key), exit, stats, now + toMillis(decode(this.timeToLive(exit))));
919
+ set(this.cacheState.map, key, value);
920
+ return zipRight$1(done(deferred, exit), exit);
921
+ }), onInterrupt(() => zipRight$1(interrupt(deferred), sync(() => {
922
+ remove$1(this.cacheState.map, key);
923
+ }))));
924
+ }));
925
+ }
926
+ }
927
+ /** @internal */
928
+ const make$1 = options => {
929
+ const timeToLive = decode(options.timeToLive);
930
+ return makeWith({
931
+ capacity: options.capacity,
932
+ lookup: options.lookup,
933
+ timeToLive: () => timeToLive
934
+ });
935
+ };
936
+ /** @internal */
937
+ const makeWith = options => map$1(all$1([context(), fiberId]), ([context, fiberId]) => new CacheImpl(options.capacity, context, fiberId, options.lookup, exit => decode(options.timeToLive(exit))));
938
+
939
+ /**
940
+ * Constructs a new cache with the specified capacity, time to live, and
941
+ * lookup function.
942
+ *
943
+ * @since 2.0.0
944
+ * @category constructors
945
+ */
946
+ const make = make$1;
947
+
948
+ class FetchError extends TaggedError('FetchError') {
949
+ }
950
+ class NotFoundError extends TaggedError('NotFoundError') {
951
+ }
952
+ const httpClient = (input, init) => gen(function* () {
953
+ const response = yield* tryPromise({
954
+ try: () => fetch(input, init),
955
+ catch: error => new FetchError({ cause: error }),
956
+ });
957
+ if (response.status === 404) {
958
+ return yield* new NotFoundError({ url: response.url });
959
+ }
960
+ return response;
961
+ });
962
+ class ResponseTextError extends TaggedError('ResponseTextError') {
963
+ constructor(error) {
964
+ super(new Error(`Failed to read response text`, { cause: error }));
965
+ }
966
+ }
967
+ const responseAsText = (res) => tryPromise({
968
+ try: () => res.text(),
969
+ catch: error => new ResponseTextError(error),
970
+ });
971
+
972
+ const SVGString = refined(isValidSVG, () => error('SVG data is malformed'));
973
+ class BrandValidationError extends TaggedError('BrandValidationError') {
974
+ constructor(error, type) {
975
+ super(new Error(`Brand validation failed for type ${type}.`, { cause: error }));
976
+ }
977
+ }
978
+ const createValidSVGString = (svg) => try_({
979
+ try: () => SVGString(svg),
980
+ catch: error => new BrandValidationError(error, 'SVGString'),
981
+ });
982
+ function isValidSVG(svg) {
983
+ if (typeof svg !== 'string') {
984
+ return false;
985
+ }
986
+ try {
987
+ const parser = new DOMParser();
988
+ const doc = parser.parseFromString(svg, 'image/svg+xml');
989
+ return doc.documentElement.nodeName === 'svg';
990
+ }
991
+ catch {
992
+ return false;
993
+ }
994
+ }
995
+
996
+ const emptyDefaultSvg = () => SVGString(`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"></svg>`);
997
+ const createIconCache = () => make({
998
+ capacity: 200,
999
+ timeToLive: infinity,
1000
+ lookup: (key) => gen(function* () {
1001
+ const name = key;
1002
+ const assetPath = yield* syncCreateAssetUrlSafely(`${name}.svg`, 'icons');
1003
+ const res = yield* httpClient(assetPath);
1004
+ const responseString = yield* responseAsText(res);
1005
+ return yield* createValidSVGString(responseString);
1006
+ }),
1007
+ });
1008
+ let cacheInstance = null;
1009
+ function fetchIconSvg(name) {
1010
+ const key = name;
1011
+ return gen(function* () {
1012
+ if (!cacheInstance) {
1013
+ cacheInstance = yield* createIconCache();
1014
+ }
1015
+ return yield* cacheInstance.get(key);
1016
+ });
1017
+ }
1018
+ function clearIconCache() {
1019
+ return gen(function* () {
1020
+ if (cacheInstance) {
1021
+ yield* cacheInstance.invalidateAll;
1022
+ }
1023
+ else {
1024
+ logWarning('Attempted to clear icon cache before it was initialized');
1025
+ }
1026
+ });
1027
+ }
1028
+
1029
+ export { fetchIconSvg as A, emptyDefaultSvg as B, EmptyMutableQueue as E, _await as _, pollUpTo as a, offerAll as b, clearIconCache as c, bounded as d, capacity as e, isFailure as f, failCause as g, all as h, isEmpty as i, die as j, map as k, length as l, match as m, make$3 as n, offer as o, poll as p, isDone as q, succeed$1 as r, succeed as s, failCause$1 as t, unbounded as u, void_ as v, fail as w, zip as x, isSuccess as y, zipRight as z };
1030
+ //# sourceMappingURL=icons-BITzEzmq.js.map
1031
+
1032
+ //# sourceMappingURL=icons-BITzEzmq.js.map