@lmvz-ds/components 0.14.1 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (264) hide show
  1. package/dist/cjs/app-globals-V2Kpy_OQ.js +3 -0
  2. package/dist/cjs/app-globals-V2Kpy_OQ.js.map +1 -0
  3. package/dist/cjs/{assets-BnJmIx_h.js → assets-XY-cBmal.js} +5 -2
  4. package/dist/cjs/assets-XY-cBmal.js.map +1 -0
  5. package/dist/cjs/header-integration_7.cjs.entry.js +1024 -0
  6. package/dist/cjs/header-integration_7.cjs.entry.js.map +1 -0
  7. package/dist/cjs/{Effect-CpZhfb0D.js → icons-BOM23oli.js} +1010 -236
  8. package/dist/cjs/icons-BOM23oli.js.map +1 -0
  9. package/dist/cjs/{index-9ZJx0550.js → index-B1Puzu82.js} +11 -651
  10. package/dist/cjs/index-B1Puzu82.js.map +1 -0
  11. package/dist/cjs/{index-QRnWYctw.js → index-ww_DCXU7.js} +431 -426
  12. package/dist/cjs/index-ww_DCXU7.js.map +1 -0
  13. package/dist/cjs/index.cjs.js +13 -12
  14. package/dist/cjs/index.cjs.js.map +1 -0
  15. package/dist/cjs/lmvz-action.cjs.entry.js +5 -2
  16. package/dist/cjs/lmvz-action.cjs.entry.js.map +1 -0
  17. package/dist/cjs/lmvz-card.cjs.entry.js +7 -4
  18. package/dist/cjs/lmvz-card.cjs.entry.js.map +1 -0
  19. package/dist/cjs/lmvz-chip.cjs.entry.js +5 -2
  20. package/dist/cjs/lmvz-chip.cjs.entry.js.map +1 -0
  21. package/dist/cjs/lmvz-components.cjs.js +6 -3
  22. package/dist/cjs/lmvz-components.cjs.js.map +1 -0
  23. package/dist/cjs/loader.cjs.js +5 -2
  24. package/dist/cjs/loader.cjs.js.map +1 -0
  25. package/dist/collection/api/ds.constants.js +1 -0
  26. package/dist/collection/api/ds.constants.js.map +1 -0
  27. package/dist/collection/api/index.js +1 -0
  28. package/dist/collection/api/index.js.map +1 -0
  29. package/dist/collection/collection-manifest.json +2 -1
  30. package/dist/collection/components/lmvz-action/lmvz-action.js +2 -1
  31. package/dist/collection/components/lmvz-action/lmvz-action.js.map +1 -0
  32. package/dist/collection/components/lmvz-button/lmvz-button.css +4 -0
  33. package/dist/collection/components/lmvz-button/lmvz-button.js +3 -2
  34. package/dist/collection/components/lmvz-button/lmvz-button.js.map +1 -0
  35. package/dist/collection/components/lmvz-card/lmvz-card.css +4 -0
  36. package/dist/collection/components/lmvz-card/lmvz-card.js +4 -3
  37. package/dist/collection/components/lmvz-card/lmvz-card.js.map +1 -0
  38. package/dist/collection/components/lmvz-chip/lmvz-chip.js +3 -2
  39. package/dist/collection/components/lmvz-chip/lmvz-chip.js.map +1 -0
  40. package/dist/collection/components/lmvz-header/lmvz-header.js +17 -10
  41. package/dist/collection/components/lmvz-header/lmvz-header.js.map +1 -0
  42. package/dist/collection/components/lmvz-icon/icons.js +1 -0
  43. package/dist/collection/components/lmvz-icon/icons.js.map +1 -0
  44. package/dist/collection/components/lmvz-icon/lmvz-icon.js +8 -7
  45. package/dist/collection/components/lmvz-icon/lmvz-icon.js.map +1 -0
  46. package/dist/collection/components/lmvz-icon/public.js +1 -0
  47. package/dist/collection/components/lmvz-icon/public.js.map +1 -0
  48. package/dist/collection/components/lmvz-icon/test/icons.unit.js +1 -0
  49. package/dist/collection/components/lmvz-icon/test/icons.unit.js.map +1 -0
  50. package/dist/collection/components/lmvz-input/lmvz-input.js +35 -28
  51. package/dist/collection/components/lmvz-input/lmvz-input.js.map +1 -0
  52. package/dist/collection/components/lmvz-menuitem/lmvz-menuitem.js +5 -2
  53. package/dist/collection/components/lmvz-menuitem/lmvz-menuitem.js.map +1 -0
  54. package/dist/collection/components/lmvz-select/lmvz-select.css +197 -0
  55. package/dist/collection/components/lmvz-select/lmvz-select.js +224 -0
  56. package/dist/collection/components/lmvz-select/lmvz-select.js.map +1 -0
  57. package/dist/collection/index.js +1 -0
  58. package/dist/collection/index.js.map +1 -0
  59. package/dist/collection/integration/header-integration.js +5 -4
  60. package/dist/collection/integration/header-integration.js.map +1 -0
  61. package/dist/collection/utils/aria/aria-validation-controller.js +1 -0
  62. package/dist/collection/utils/aria/aria-validation-controller.js.map +1 -0
  63. package/dist/collection/utils/aria/element-activation-controller.js +1 -0
  64. package/dist/collection/utils/aria/element-activation-controller.js.map +1 -0
  65. package/dist/collection/utils/aria/list-keyboard-controller.js +7 -4
  66. package/dist/collection/utils/aria/list-keyboard-controller.js.map +1 -0
  67. package/dist/collection/utils/assets.js +1 -0
  68. package/dist/collection/utils/assets.js.map +1 -0
  69. package/dist/collection/utils/component.js +7 -4
  70. package/dist/collection/utils/component.js.map +1 -0
  71. package/dist/collection/utils/effect.js +1 -0
  72. package/dist/collection/utils/effect.js.map +1 -0
  73. package/dist/collection/utils/environment.js +1 -0
  74. package/dist/collection/utils/environment.js.map +1 -0
  75. package/dist/collection/utils/http.js +1 -0
  76. package/dist/collection/utils/http.js.map +1 -0
  77. package/dist/collection/utils/http.unit.js +1 -0
  78. package/dist/collection/utils/http.unit.js.map +1 -0
  79. package/dist/collection/utils/public.js +1 -0
  80. package/dist/collection/utils/public.js.map +1 -0
  81. package/dist/collection/utils/reactive-controller-host.js +1 -0
  82. package/dist/collection/utils/reactive-controller-host.js.map +1 -0
  83. package/dist/collection/utils/validation/svg.js +1 -0
  84. package/dist/collection/utils/validation/svg.js.map +1 -0
  85. package/dist/components/header-integration.d.ts +11 -0
  86. package/dist/components/header-integration.js +2 -0
  87. package/dist/components/header-integration.js.map +1 -0
  88. package/dist/components/index.d.ts +4 -0
  89. package/dist/components/index.js +2 -1
  90. package/dist/components/index.js.map +1 -0
  91. package/dist/components/lmvz-action.js +2 -1
  92. package/dist/components/lmvz-action.js.map +1 -0
  93. package/dist/components/lmvz-button.js +2 -1
  94. package/dist/components/lmvz-button.js.map +1 -0
  95. package/dist/components/lmvz-card.js +2 -1
  96. package/dist/components/lmvz-card.js.map +1 -0
  97. package/dist/components/lmvz-chip.js +2 -1
  98. package/dist/components/lmvz-chip.js.map +1 -0
  99. package/dist/components/lmvz-header.js +2 -1
  100. package/dist/components/lmvz-header.js.map +1 -0
  101. package/dist/components/lmvz-icon.js +2 -1
  102. package/dist/components/lmvz-icon.js.map +1 -0
  103. package/dist/components/lmvz-input.js +2 -1
  104. package/dist/components/lmvz-input.js.map +1 -0
  105. package/dist/components/lmvz-menuitem.js +2 -1
  106. package/dist/components/lmvz-menuitem.js.map +1 -0
  107. package/dist/components/lmvz-select.d.ts +11 -0
  108. package/dist/components/lmvz-select.js +2 -0
  109. package/dist/components/lmvz-select.js.map +1 -0
  110. package/dist/components/p-B2g3aN-E.js +2 -0
  111. package/dist/components/p-B2g3aN-E.js.map +1 -0
  112. package/dist/components/p-BXdOuZTp.js +2 -0
  113. package/dist/components/p-BXdOuZTp.js.map +1 -0
  114. package/dist/components/p-BfTCfPZ1.js +3 -2
  115. package/dist/components/p-BfTCfPZ1.js.map +1 -0
  116. package/dist/components/p-BpCjj39Z.js +2 -0
  117. package/dist/components/p-BpCjj39Z.js.map +1 -0
  118. package/dist/components/p-BsHYIl56.js +2 -0
  119. package/dist/components/p-BsHYIl56.js.map +1 -0
  120. package/dist/components/p-C5rqq3bf.js +2 -0
  121. package/dist/components/p-C5rqq3bf.js.map +1 -0
  122. package/dist/components/p-CI0tffvo.js +2 -0
  123. package/dist/components/p-CI0tffvo.js.map +1 -0
  124. package/dist/components/p-CN0JX9-m.js +2 -1
  125. package/dist/components/p-CN0JX9-m.js.map +1 -0
  126. package/dist/components/p-ClmDNIy4.js +2 -0
  127. package/dist/components/p-ClmDNIy4.js.map +1 -0
  128. package/dist/components/p-DQEkWkMh.js +2 -0
  129. package/dist/components/p-DQEkWkMh.js.map +1 -0
  130. package/dist/components/p-X5fEFT9T.js +2 -0
  131. package/dist/components/p-X5fEFT9T.js.map +1 -0
  132. package/dist/components/p-vIq2biqy.js +13 -0
  133. package/dist/components/p-vIq2biqy.js.map +1 -0
  134. package/dist/esm/app-globals-DQuL1Twl.js +3 -0
  135. package/dist/esm/app-globals-DQuL1Twl.js.map +1 -0
  136. package/dist/esm/{assets-CvV1KMMV.js → assets-BD98wsl7.js} +4 -1
  137. package/dist/esm/assets-BD98wsl7.js.map +1 -0
  138. package/dist/esm/header-integration_7.entry.js +1016 -0
  139. package/dist/esm/header-integration_7.entry.js.map +1 -0
  140. package/dist/esm/{Effect-DyamyJqO.js → icons-D1lxdRXP.js} +975 -174
  141. package/dist/esm/icons-D1lxdRXP.js.map +1 -0
  142. package/dist/esm/{index-CekEw3_K.js → index-DoNkkDv1.js} +6 -1
  143. package/dist/esm/index-DoNkkDv1.js.map +1 -0
  144. package/dist/esm/{index-smGPjoDX.js → index-WeqgWisK.js} +11 -651
  145. package/dist/esm/index-WeqgWisK.js.map +1 -0
  146. package/dist/esm/index.js +7 -5
  147. package/dist/esm/index.js.map +1 -0
  148. package/dist/esm/lmvz-action.entry.js +5 -2
  149. package/dist/esm/lmvz-action.entry.js.map +1 -0
  150. package/dist/esm/lmvz-card.entry.js +7 -4
  151. package/dist/esm/lmvz-card.entry.js.map +1 -0
  152. package/dist/esm/lmvz-chip.entry.js +5 -2
  153. package/dist/esm/lmvz-chip.entry.js.map +1 -0
  154. package/dist/esm/lmvz-components.js +7 -4
  155. package/dist/esm/lmvz-components.js.map +1 -0
  156. package/dist/esm/loader.js +6 -3
  157. package/dist/esm/loader.js.map +1 -0
  158. package/dist/ext-libs.d.ts +1 -0
  159. package/dist/lmvz-components/index.esm.js +2 -1
  160. package/dist/lmvz-components/index.esm.js.map +1 -0
  161. package/dist/lmvz-components/lmvz-components.esm.js +2 -1
  162. package/dist/lmvz-components/lmvz-components.esm.js.map +1 -0
  163. package/dist/lmvz-components/p-33485219.entry.js +2 -0
  164. package/dist/lmvz-components/p-33485219.entry.js.map +1 -0
  165. package/dist/lmvz-components/p-76032c32.entry.js +2 -0
  166. package/dist/lmvz-components/p-76032c32.entry.js.map +1 -0
  167. package/dist/lmvz-components/p-7aeec9a8.entry.js +7 -0
  168. package/dist/lmvz-components/p-7aeec9a8.entry.js.map +1 -0
  169. package/dist/lmvz-components/p-84e0a9dd.entry.js +2 -0
  170. package/dist/lmvz-components/p-84e0a9dd.entry.js.map +1 -0
  171. package/dist/lmvz-components/p-CkJb8WVZ.js +2 -0
  172. package/dist/lmvz-components/p-CkJb8WVZ.js.map +1 -0
  173. package/dist/lmvz-components/p-DQuL1Twl.js +2 -1
  174. package/dist/lmvz-components/p-DQuL1Twl.js.map +1 -0
  175. package/dist/lmvz-components/p-WeqgWisK.js +3 -0
  176. package/dist/lmvz-components/p-WeqgWisK.js.map +1 -0
  177. package/dist/lmvz-components/p-Z9X0_ik0.js +2 -0
  178. package/dist/lmvz-components/p-Z9X0_ik0.js.map +1 -0
  179. package/dist/lmvz-components/p-eP0oxQ44.js +13 -0
  180. package/dist/lmvz-components/p-eP0oxQ44.js.map +1 -0
  181. package/dist/manifest.json +392 -68
  182. package/dist/stencil.config.base.js +45 -0
  183. package/dist/stencil.config.base.js.map +1 -0
  184. package/dist/stencil.config.dev.js +22 -0
  185. package/dist/stencil.config.dev.js.map +1 -0
  186. package/dist/stencil.config.integration.js +27 -0
  187. package/dist/stencil.config.integration.js.map +1 -0
  188. package/dist/stencil.config.js +16 -0
  189. package/dist/stencil.config.js.map +1 -0
  190. package/dist/stencil.config.prod.js +30 -0
  191. package/dist/stencil.config.prod.js.map +1 -0
  192. package/dist/types/Users/patrick.nemenz/workspace/lmvz/lmvz-ds/packages/components/.stencil/stencil.config.base.d.ts +2 -0
  193. package/dist/types/Users/patrick.nemenz/workspace/lmvz/lmvz-ds/packages/components/.stencil/stencil.config.d.ts +2 -0
  194. package/dist/types/Users/patrick.nemenz/workspace/lmvz/lmvz-ds/packages/components/.stencil/stencil.config.dev.d.ts +2 -0
  195. package/dist/types/Users/patrick.nemenz/workspace/lmvz/lmvz-ds/packages/components/.stencil/stencil.config.integration.d.ts +2 -0
  196. package/dist/types/Users/patrick.nemenz/workspace/lmvz/lmvz-ds/packages/components/.stencil/stencil.config.prod.d.ts +2 -0
  197. package/dist/types/components/lmvz-action/lmvz-action.d.ts +1 -1
  198. package/dist/types/components/lmvz-button/lmvz-button.d.ts +2 -2
  199. package/dist/types/components/lmvz-card/lmvz-card.d.ts +1 -1
  200. package/dist/types/components/lmvz-header/lmvz-header.d.ts +4 -4
  201. package/dist/types/components/lmvz-icon/lmvz-icon.d.ts +4 -4
  202. package/dist/types/components/lmvz-input/lmvz-input.d.ts +4 -4
  203. package/dist/types/components/lmvz-menuitem/lmvz-menuitem.d.ts +3 -3
  204. package/dist/types/components/lmvz-select/lmvz-select.d.ts +24 -0
  205. package/dist/types/components.d.ts +173 -3
  206. package/dist/types/index.d.ts +1 -1
  207. package/dist/types/integration/header-integration.d.ts +5 -0
  208. package/dist/types/utils/aria/aria-validation-controller.d.ts +1 -1
  209. package/dist/types/utils/aria/element-activation-controller.d.ts +1 -1
  210. package/dist/types/utils/component.d.ts +2 -2
  211. package/dist/types/utils/http.d.ts +3 -3
  212. package/dist/types/utils/validation/svg.d.ts +1 -1
  213. package/hydrate/index.js +998 -436
  214. package/hydrate/index.mjs +998 -436
  215. package/package.json +37 -73
  216. package/readme.md +2 -2
  217. package/dist/cjs/aria-loader-BBKbBZLq.js +0 -76
  218. package/dist/cjs/component-CRc6eHcV.js +0 -138
  219. package/dist/cjs/element-activation-controller-DC_6T0Rt.js +0 -31
  220. package/dist/cjs/icons-Brr4vqiE.js +0 -653
  221. package/dist/cjs/index-Bp6Dd2i1.js +0 -94
  222. package/dist/cjs/lmvz-button.cjs.entry.js +0 -73
  223. package/dist/cjs/lmvz-header.cjs.entry.js +0 -142
  224. package/dist/cjs/lmvz-icon.cjs.entry.js +0 -87
  225. package/dist/cjs/lmvz-input.cjs.entry.js +0 -177
  226. package/dist/cjs/lmvz-menuitem.cjs.entry.js +0 -34
  227. package/dist/cjs/reactive-controller-host-DWpVosFu.js +0 -189
  228. package/dist/collection/utils/typing.js +0 -1
  229. package/dist/components/p-B3JVFwO1.js +0 -1
  230. package/dist/components/p-BaPwpeMs.js +0 -1
  231. package/dist/components/p-CSRpdnrt.js +0 -1
  232. package/dist/components/p-DK2hpvEW.js +0 -12
  233. package/dist/components/p-DcMNH3fv.js +0 -1
  234. package/dist/components/p-DugBvwmd.js +0 -1
  235. package/dist/esm/aria-loader-DB71Xewa.js +0 -69
  236. package/dist/esm/component-B3JVFwO1.js +0 -132
  237. package/dist/esm/element-activation-controller-CN0JX9-m.js +0 -29
  238. package/dist/esm/icons-C69Um2xB.js +0 -649
  239. package/dist/esm/index-BfTCfPZ1.js +0 -92
  240. package/dist/esm/lmvz-button.entry.js +0 -71
  241. package/dist/esm/lmvz-header.entry.js +0 -140
  242. package/dist/esm/lmvz-icon.entry.js +0 -85
  243. package/dist/esm/lmvz-input.entry.js +0 -175
  244. package/dist/esm/lmvz-menuitem.entry.js +0 -32
  245. package/dist/esm/reactive-controller-host-1nFoJEdT.js +0 -186
  246. package/dist/lmvz-components/p-0e5aa1a3.entry.js +0 -1
  247. package/dist/lmvz-components/p-18c18de4.entry.js +0 -1
  248. package/dist/lmvz-components/p-5775a56c.entry.js +0 -1
  249. package/dist/lmvz-components/p-814ee542.entry.js +0 -1
  250. package/dist/lmvz-components/p-9faac8f3.entry.js +0 -1
  251. package/dist/lmvz-components/p-B3JVFwO1.js +0 -1
  252. package/dist/lmvz-components/p-B3j8zrhV.js +0 -1
  253. package/dist/lmvz-components/p-BEoSvNlI.js +0 -1
  254. package/dist/lmvz-components/p-BTpia82J.js +0 -1
  255. package/dist/lmvz-components/p-BfTCfPZ1.js +0 -6
  256. package/dist/lmvz-components/p-CN0JX9-m.js +0 -1
  257. package/dist/lmvz-components/p-D7GrtdQF.js +0 -1
  258. package/dist/lmvz-components/p-DyamyJqO.js +0 -1
  259. package/dist/lmvz-components/p-c61f7daa.entry.js +0 -1
  260. package/dist/lmvz-components/p-c6bae21b.entry.js +0 -1
  261. package/dist/lmvz-components/p-cM67HC0Z.js +0 -12
  262. package/dist/lmvz-components/p-d4b68381.entry.js +0 -1
  263. package/dist/lmvz-components/p-smGPjoDX.js +0 -2
  264. package/dist/types/utils/typing.d.ts +0 -3
@@ -1,3 +1,118 @@
1
+ import { c as createAssetUrlSafely } from './assets-BD98wsl7.js';
2
+
3
+ /**
4
+ * Verify whether a value is a Promise by duck-testing for a 'then' function
5
+ */
6
+ function isPromise(value) {
7
+ if (!value)
8
+ return false;
9
+ return typeof value === 'object' && typeof value.then === 'function';
10
+ }
11
+
12
+ /**
13
+ * Resolve the result of a function that may be async or not, as a Promise.
14
+ */
15
+ function resolvePossiblyAsyncFunction(func, args = []) {
16
+ const res = func(...args);
17
+ if (isPromise(res)) {
18
+ return res;
19
+ }
20
+ return Promise.resolve(res);
21
+ }
22
+
23
+ const GLOBAL_STATE_KEY = Symbol('__lmvzAriaValidationRuntimeState');
24
+ const ARIA_VALIDATION_RUNTIME_CHANGED_EVENT = 'lmvz:aria-validation-runtime-changed';
25
+ function getRuntimeState() {
26
+ const globalState = globalThis;
27
+ if (!globalState[GLOBAL_STATE_KEY]) {
28
+ globalState[GLOBAL_STATE_KEY] = {
29
+ enabled: false,
30
+ };
31
+ }
32
+ return globalState[GLOBAL_STATE_KEY];
33
+ }
34
+ function notifyRuntimeChange() {
35
+ if (typeof window === 'undefined')
36
+ return;
37
+ window.dispatchEvent(new CustomEvent(ARIA_VALIDATION_RUNTIME_CHANGED_EVENT));
38
+ }
39
+ async function fetchRuntime() {
40
+ const state = getRuntimeState();
41
+ if (!state.enabled)
42
+ return null;
43
+ if (state.runtime)
44
+ return state.runtime;
45
+ if (!state.loadPromise) {
46
+ state.loadPromise = import('./index-DoNkkDv1.js').catch(() => null);
47
+ }
48
+ const runtime = await state.loadPromise;
49
+ if (runtime) {
50
+ state.runtime = runtime;
51
+ }
52
+ return runtime;
53
+ }
54
+ async function initializeValidation(...args) {
55
+ const runtime = await fetchRuntime();
56
+ const s = getRuntimeState();
57
+ if (!s.enabled)
58
+ return;
59
+ if (!runtime) {
60
+ console.warn('Failed to load aria validation runtime');
61
+ return;
62
+ }
63
+ runtime.initializeValidationStream(...args);
64
+ }
65
+ const isAriaValidationEnabled = () => getRuntimeState().enabled;
66
+ const useVerboseLogging = () => getRuntimeState().verboseLogging ?? false;
67
+ const enableAriaValidation = (options = {}) => {
68
+ const state = getRuntimeState();
69
+ if (state.enabled)
70
+ return;
71
+ Object.assign(state, options);
72
+ state.enabled = true;
73
+ initializeValidation().then(() => {
74
+ notifyRuntimeChange();
75
+ });
76
+ };
77
+ const disableAriaValidation = () => {
78
+ const state = getRuntimeState();
79
+ if (!state.enabled)
80
+ return;
81
+ state.enabled = false;
82
+ notifyRuntimeChange();
83
+ };
84
+ function queueValidation(...args) {
85
+ const { enabled, runtime, loadPromise, lazyCondition } = getRuntimeState();
86
+ if (!enabled)
87
+ return;
88
+ if (!lazyCondition)
89
+ return q();
90
+ resolvePossiblyAsyncFunction(lazyCondition).then((shouldEnqueue) => {
91
+ if (!shouldEnqueue)
92
+ return;
93
+ q();
94
+ });
95
+ function q() {
96
+ if (runtime)
97
+ return runtime.enqueueValidation(...args);
98
+ if (!loadPromise) {
99
+ console.warn('neither runtime nor load promise found for aria validation. This should not happen, as enabling aria validation should have triggered the loading of the runtime.');
100
+ return;
101
+ }
102
+ loadPromise
103
+ .then((loadedRuntime) => {
104
+ if (!loadedRuntime?.enqueueValidation) {
105
+ console.error('Failed to load aria validation runtime');
106
+ return;
107
+ }
108
+ loadedRuntime.enqueueValidation(...args);
109
+ })
110
+ .catch(() => {
111
+ console.error('Failed to enqueue validation due to an error while loading the runtime');
112
+ });
113
+ }
114
+ }
115
+
1
116
  /**
2
117
  * Tests if a value is a `function`.
3
118
  *
@@ -273,19 +388,19 @@ function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
273
388
  * @category constructors
274
389
  * @since 2.0.0
275
390
  */
276
- const make$u = isEquivalent => (self, that) => self === that || isEquivalent(self, that);
391
+ const make$w = isEquivalent => (self, that) => self === that || isEquivalent(self, that);
277
392
  /**
278
393
  * @category mapping
279
394
  * @since 2.0.0
280
395
  */
281
- const mapInput$1 = /*#__PURE__*/dual(2, (self, f) => make$u((x, y) => self(f(x), f(y))));
396
+ const mapInput$1 = /*#__PURE__*/dual(2, (self, f) => make$w((x, y) => self(f(x), f(y))));
282
397
  /**
283
398
  * Creates a new `Equivalence` for an array of values based on a given `Equivalence` for the elements of the array.
284
399
  *
285
400
  * @category combinators
286
401
  * @since 2.0.0
287
402
  */
288
- const array$1 = item => make$u((self, that) => {
403
+ const array$1 = item => make$w((self, that) => {
289
404
  if (self.length !== that.length) {
290
405
  return false;
291
406
  }
@@ -1030,10 +1145,13 @@ function compareBoth(self, that) {
1030
1145
  }
1031
1146
  }
1032
1147
  if (structuralRegionState.enabled) {
1148
+ if (self === null || that === null) {
1149
+ return false;
1150
+ }
1033
1151
  if (Array.isArray(self) && Array.isArray(that)) {
1034
1152
  return self.length === that.length && self.every((v, i) => compareBoth(v, that[i]));
1035
1153
  }
1036
- if (Object.getPrototypeOf(self) === Object.prototype && Object.getPrototypeOf(self) === Object.prototype) {
1154
+ if (Object.getPrototypeOf(self) === Object.prototype && Object.getPrototypeOf(that) === Object.prototype) {
1037
1155
  const keysSelf = Object.keys(self);
1038
1156
  const keysThat = Object.keys(that);
1039
1157
  if (keysSelf.length === keysThat.length) {
@@ -1216,7 +1334,7 @@ const OP_YIELD = "Yield";
1216
1334
  /** @internal */
1217
1335
  const OP_REVERT_FLAGS = "RevertFlags";
1218
1336
 
1219
- let moduleVersion = "3.19.14";
1337
+ let moduleVersion = "3.21.0";
1220
1338
  const getCurrentVersion = () => moduleVersion;
1221
1339
 
1222
1340
  /** @internal */
@@ -1600,17 +1718,17 @@ const isNonEmptyArray$1 = self => self.length > 0;
1600
1718
  * @category constructors
1601
1719
  * @since 2.0.0
1602
1720
  */
1603
- const make$t = compare => (self, that) => self === that ? 0 : compare(self, that);
1721
+ const make$v = compare => (self, that) => self === that ? 0 : compare(self, that);
1604
1722
  /**
1605
1723
  * @category instances
1606
1724
  * @since 2.0.0
1607
1725
  */
1608
- const number = /*#__PURE__*/make$t((self, that) => self < that ? -1 : 1);
1726
+ const number = /*#__PURE__*/make$v((self, that) => self < that ? -1 : 1);
1609
1727
  /**
1610
1728
  * @category mapping
1611
1729
  * @since 2.0.0
1612
1730
  */
1613
- const mapInput = /*#__PURE__*/dual(2, (self, f) => make$t((b1, b2) => self(f(b1), f(b2))));
1731
+ const mapInput = /*#__PURE__*/dual(2, (self, f) => make$v((b1, b2) => self(f(b1), f(b2))));
1614
1732
  /**
1615
1733
  * Test whether one value is _strictly greater than_ another.
1616
1734
  *
@@ -2092,7 +2210,7 @@ const mergeWith = f => (o1, o2) => {
2092
2210
  * @category constructors
2093
2211
  * @since 2.0.0
2094
2212
  */
2095
- const make$s = (...elements) => elements;
2213
+ const make$u = (...elements) => elements;
2096
2214
 
2097
2215
  /**
2098
2216
  * This module provides utility functions for working with arrays in TypeScript.
@@ -2456,7 +2574,7 @@ const sort = /*#__PURE__*/dual(2, (self, O) => {
2456
2574
  * @category zipping
2457
2575
  * @since 2.0.0
2458
2576
  */
2459
- const zip$3 = /*#__PURE__*/dual(2, (self, that) => zipWith$2(self, that, make$s));
2577
+ const zip$3 = /*#__PURE__*/dual(2, (self, that) => zipWith$2(self, that, make$u));
2460
2578
  /**
2461
2579
  * Apply a function to pairs of elements at the same index in two `Iterable`s, collecting the results in a new `Array`. If one
2462
2580
  * input `Iterable` is short, excess elements of the longer `Iterable` are discarded.
@@ -2911,6 +3029,54 @@ const Order$1 = number;
2911
3029
  */
2912
3030
  const escape = string => string.replace(/[/\\^$*+?.()|[\]{}]/g, "\\$&");
2913
3031
 
3032
+ /**
3033
+ * This module provides types and utility functions to create and work with branded types,
3034
+ * which are TypeScript types with an added type tag to prevent accidental usage of a value in the wrong context.
3035
+ *
3036
+ * The `refined` and `nominal` functions are both used to create branded types in TypeScript.
3037
+ * The main difference between them is that `refined` allows for validation of the data, while `nominal` does not.
3038
+ *
3039
+ * 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.
3040
+ * This is useful when you want to distinguish between two values of the same type that have different meanings.
3041
+ * The `nominal` function does not perform any validation of the input data.
3042
+ *
3043
+ * On the other hand, the `refined` function is used to create a new branded type that has the same underlying type as the input,
3044
+ * but with a different name, and it also allows for validation of the input data.
3045
+ * The `refined` function takes a predicate that is used to validate the input data.
3046
+ * If the input data fails the validation, a `BrandErrors` is returned, which provides information about the specific validation failure.
3047
+ *
3048
+ * @since 2.0.0
3049
+ */
3050
+ /**
3051
+ * @since 2.0.0
3052
+ * @category symbols
3053
+ */
3054
+ const RefinedConstructorsTypeId = /*#__PURE__*/Symbol.for("effect/Brand/Refined");
3055
+ /**
3056
+ * Returns a `BrandErrors` that contains a single `RefinementError`.
3057
+ *
3058
+ * @since 2.0.0
3059
+ * @category constructors
3060
+ */
3061
+ const error = (message, meta) => [{
3062
+ message,
3063
+ meta
3064
+ }];
3065
+ function refined(...args) {
3066
+ const either = args.length === 2 ? unbranded => args[0](unbranded) ? right(unbranded) : left(args[1](unbranded)) : unbranded => {
3067
+ return match$6(args[0](unbranded), {
3068
+ onNone: () => right(unbranded),
3069
+ onSome: left
3070
+ });
3071
+ };
3072
+ return Object.assign(unbranded => getOrThrowWith(either(unbranded), identity), {
3073
+ [RefinedConstructorsTypeId]: RefinedConstructorsTypeId,
3074
+ option: args => getRight(either(args)),
3075
+ either,
3076
+ is: args => isRight(either(args))
3077
+ });
3078
+ }
3079
+
2914
3080
  /** @internal */
2915
3081
  const TagTypeId = /*#__PURE__*/Symbol.for("effect/Context/Tag");
2916
3082
  /** @internal */
@@ -2945,7 +3111,7 @@ const TagProto = {
2945
3111
  return self;
2946
3112
  },
2947
3113
  context(self) {
2948
- return make$r(this, self);
3114
+ return make$t(this, self);
2949
3115
  }
2950
3116
  };
2951
3117
  const ReferenceProto = {
@@ -3055,7 +3221,7 @@ const _empty$6 = /*#__PURE__*/makeContext(/*#__PURE__*/new Map());
3055
3221
  /** @internal */
3056
3222
  const empty$l = () => _empty$6;
3057
3223
  /** @internal */
3058
- const make$r = (tag, service) => makeContext(new Map([[tag.key, service]]));
3224
+ const make$t = (tag, service) => makeContext(new Map([[tag.key, service]]));
3059
3225
  /** @internal */
3060
3226
  const add$3 = /*#__PURE__*/dual(3, (self, tag, service) => {
3061
3227
  const map = new Map(self.unsafeMap);
@@ -3174,7 +3340,7 @@ const empty$k = empty$l;
3174
3340
  * @since 2.0.0
3175
3341
  * @category constructors
3176
3342
  */
3177
- const make$q = make$r;
3343
+ const make$s = make$t;
3178
3344
  /**
3179
3345
  * Adds a service to a given `Context`.
3180
3346
  *
@@ -3393,7 +3559,7 @@ const emptyArray = [];
3393
3559
  * @category equivalence
3394
3560
  * @since 2.0.0
3395
3561
  */
3396
- const getEquivalence$1 = isEquivalent => make$u((self, that) => self.length === that.length && toReadonlyArray(self).every((value, i) => isEquivalent(value, unsafeGet(that, i))));
3562
+ const getEquivalence$1 = isEquivalent => make$w((self, that) => self.length === that.length && toReadonlyArray(self).every((value, i) => isEquivalent(value, unsafeGet(that, i))));
3397
3563
  const _equivalence$1 = /*#__PURE__*/getEquivalence$1(equals$1);
3398
3564
  const ChunkProto = {
3399
3565
  [TypeId$a]: {
@@ -3505,7 +3671,7 @@ const empty$j = () => _empty$5;
3505
3671
  * @category constructors
3506
3672
  * @since 2.0.0
3507
3673
  */
3508
- const make$p = (...as) => unsafeFromNonEmptyArray(as);
3674
+ const make$r = (...as) => unsafeFromNonEmptyArray(as);
3509
3675
  /**
3510
3676
  * Builds a `NonEmptyChunk` from a single element.
3511
3677
  *
@@ -4114,7 +4280,7 @@ const DurationProto = {
4114
4280
  return pipeArguments(this, arguments);
4115
4281
  }
4116
4282
  };
4117
- const make$o = input => {
4283
+ const make$q = input => {
4118
4284
  const duration = Object.create(DurationProto);
4119
4285
  if (isNumber(input)) {
4120
4286
  if (isNaN(input) || input <= 0) {
@@ -4171,52 +4337,52 @@ const isZero = self => {
4171
4337
  * @since 2.0.0
4172
4338
  * @category constructors
4173
4339
  */
4174
- const zero = /*#__PURE__*/make$o(0);
4340
+ const zero = /*#__PURE__*/make$q(0);
4175
4341
  /**
4176
4342
  * @since 2.0.0
4177
4343
  * @category constructors
4178
4344
  */
4179
- const infinity = /*#__PURE__*/make$o(Infinity);
4345
+ const infinity = /*#__PURE__*/make$q(Infinity);
4180
4346
  /**
4181
4347
  * @since 2.0.0
4182
4348
  * @category constructors
4183
4349
  */
4184
- const nanos = nanos => make$o(nanos);
4350
+ const nanos = nanos => make$q(nanos);
4185
4351
  /**
4186
4352
  * @since 2.0.0
4187
4353
  * @category constructors
4188
4354
  */
4189
- const micros = micros => make$o(micros * bigint1e3);
4355
+ const micros = micros => make$q(micros * bigint1e3);
4190
4356
  /**
4191
4357
  * @since 2.0.0
4192
4358
  * @category constructors
4193
4359
  */
4194
- const millis = millis => make$o(millis);
4360
+ const millis = millis => make$q(millis);
4195
4361
  /**
4196
4362
  * @since 2.0.0
4197
4363
  * @category constructors
4198
4364
  */
4199
- const seconds = seconds => make$o(seconds * 1000);
4365
+ const seconds = seconds => make$q(seconds * 1000);
4200
4366
  /**
4201
4367
  * @since 2.0.0
4202
4368
  * @category constructors
4203
4369
  */
4204
- const minutes = minutes => make$o(minutes * 60_000);
4370
+ const minutes = minutes => make$q(minutes * 60_000);
4205
4371
  /**
4206
4372
  * @since 2.0.0
4207
4373
  * @category constructors
4208
4374
  */
4209
- const hours = hours => make$o(hours * 3_600_000);
4375
+ const hours = hours => make$q(hours * 3_600_000);
4210
4376
  /**
4211
4377
  * @since 2.0.0
4212
4378
  * @category constructors
4213
4379
  */
4214
- const days = days => make$o(days * 86_400_000);
4380
+ const days = days => make$q(days * 86_400_000);
4215
4381
  /**
4216
4382
  * @since 2.0.0
4217
4383
  * @category constructors
4218
4384
  */
4219
- const weeks = weeks => make$o(weeks * 604_800_000);
4385
+ const weeks = weeks => make$q(weeks * 604_800_000);
4220
4386
  /**
4221
4387
  * @since 2.0.0
4222
4388
  * @category getters
@@ -4435,7 +4601,7 @@ function fromBitmap(bitmap, bit) {
4435
4601
  return popcount(bitmap & bit - 1);
4436
4602
  }
4437
4603
 
4438
- const make$n = (value, previous) => ({
4604
+ const make$p = (value, previous) => ({
4439
4605
  value,
4440
4606
  previous
4441
4607
  });
@@ -4721,7 +4887,7 @@ function mergeLeaves(edit, shift, h1, n1, h2, n2) {
4721
4887
  while (true) {
4722
4888
  const res = mergeLeavesInner(edit, currentShift, h1, n1, h2, n2);
4723
4889
  if (typeof res === "function") {
4724
- stack = make$n(res, stack);
4890
+ stack = make$p(res, stack);
4725
4891
  currentShift = currentShift + SIZE;
4726
4892
  } else {
4727
4893
  let final = res;
@@ -5045,7 +5211,7 @@ const fromIterable$3 = elements => {
5045
5211
  return endMutation(set);
5046
5212
  };
5047
5213
  /** @internal */
5048
- const make$m = (...elements) => {
5214
+ const make$o = (...elements) => {
5049
5215
  const set = beginMutation(empty$h());
5050
5216
  for (const value of elements) {
5051
5217
  add$1(set, value);
@@ -5553,7 +5719,7 @@ const fromIterable$2 = fromIterable$3;
5553
5719
  *
5554
5720
  * @see Other `HashSet` constructors are {@link module:HashSet.fromIterable} {@link module:HashSet.empty}
5555
5721
  */
5556
- const make$l = make$m;
5722
+ const make$n = make$o;
5557
5723
  /**
5558
5724
  * Checks if the specified value exists in the `HashSet`.
5559
5725
  *
@@ -5782,7 +5948,7 @@ const MutableRefProto = {
5782
5948
  * @since 2.0.0
5783
5949
  * @category constructors
5784
5950
  */
5785
- const make$k = value => {
5951
+ const make$m = value => {
5786
5952
  const ref = Object.create(MutableRefProto);
5787
5953
  ref.current = value;
5788
5954
  return ref;
@@ -5938,7 +6104,7 @@ const ids = self => {
5938
6104
  }
5939
6105
  case OP_RUNTIME:
5940
6106
  {
5941
- return make$l(self.id);
6107
+ return make$n(self.id);
5942
6108
  }
5943
6109
  case OP_COMPOSITE:
5944
6110
  {
@@ -5946,7 +6112,7 @@ const ids = self => {
5946
6112
  }
5947
6113
  }
5948
6114
  };
5949
- const _fiberCounter = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/Fiber/Id/_fiberCounter"), () => make$k(0));
6115
+ const _fiberCounter = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/Fiber/Id/_fiberCounter"), () => make$m(0));
5950
6116
  /** @internal */
5951
6117
  const threadName$1 = self => {
5952
6118
  const identifiers = Array.from(ids(self)).map(n => `#${n}`).join(",");
@@ -6737,7 +6903,7 @@ const DifferProto = {
6737
6903
  }
6738
6904
  };
6739
6905
  /** @internal */
6740
- const make$j = params => {
6906
+ const make$l = params => {
6741
6907
  const differ = Object.create(DifferProto);
6742
6908
  differ.empty = params.empty;
6743
6909
  differ.diff = params.diff;
@@ -6746,21 +6912,21 @@ const make$j = params => {
6746
6912
  return differ;
6747
6913
  };
6748
6914
  /** @internal */
6749
- const environment = () => make$j({
6915
+ const environment = () => make$l({
6750
6916
  empty: empty$d(),
6751
6917
  combine: (first, second) => combine$4(second)(first),
6752
6918
  diff: (oldValue, newValue) => diff$6(oldValue, newValue),
6753
6919
  patch: (patch, oldValue) => patch$7(oldValue)(patch)
6754
6920
  });
6755
6921
  /** @internal */
6756
- const hashSet = () => make$j({
6922
+ const hashSet = () => make$l({
6757
6923
  empty: empty$c(),
6758
6924
  combine: (first, second) => combine$3(second)(first),
6759
6925
  diff: (oldValue, newValue) => diff$5(oldValue, newValue),
6760
6926
  patch: (patch, oldValue) => patch$6(oldValue)(patch)
6761
6927
  });
6762
6928
  /** @internal */
6763
- const readonlyArray = differ => make$j({
6929
+ const readonlyArray = differ => make$l({
6764
6930
  empty: empty$b(),
6765
6931
  combine: (first, second) => combine$2(first, second),
6766
6932
  diff: (oldValue, newValue) => diff$4({
@@ -6773,7 +6939,7 @@ const readonlyArray = differ => make$j({
6773
6939
  /** @internal */
6774
6940
  const update$2 = () => updateWith((_, a) => a);
6775
6941
  /** @internal */
6776
- const updateWith = f => make$j({
6942
+ const updateWith = f => make$l({
6777
6943
  empty: identity,
6778
6944
  combine: (first, second) => {
6779
6945
  if (first === identity) {
@@ -6802,15 +6968,15 @@ const active = patch => patch & BIT_MASK;
6802
6968
  /** @internal */
6803
6969
  const enabled = patch => patch >> BIT_SHIFT & BIT_MASK;
6804
6970
  /** @internal */
6805
- const make$i = (active, enabled) => (active & BIT_MASK) + ((enabled & active & BIT_MASK) << BIT_SHIFT);
6971
+ const make$k = (active, enabled) => (active & BIT_MASK) + ((enabled & active & BIT_MASK) << BIT_SHIFT);
6806
6972
  /** @internal */
6807
- const empty$a = /*#__PURE__*/make$i(0, 0);
6973
+ const empty$a = /*#__PURE__*/make$k(0, 0);
6808
6974
  /** @internal */
6809
- const enable$2 = flag => make$i(flag, flag);
6975
+ const enable$2 = flag => make$k(flag, flag);
6810
6976
  /** @internal */
6811
- const disable$1 = flag => make$i(flag, 0);
6977
+ const disable$1 = flag => make$k(flag, 0);
6812
6978
  /** @internal */
6813
- const exclude$1 = /*#__PURE__*/dual(2, (self, flag) => make$i(active(self) & ~flag, enabled(self)));
6979
+ const exclude$1 = /*#__PURE__*/dual(2, (self, flag) => make$k(active(self) & ~flag, enabled(self)));
6814
6980
  /** @internal */
6815
6981
  const andThen = /*#__PURE__*/dual(2, (self, that) => self | that);
6816
6982
  /** @internal */
@@ -6839,18 +7005,18 @@ const interruption = self => isEnabled(self, Interruption);
6839
7005
  /** @internal */
6840
7006
  const isEnabled = /*#__PURE__*/dual(2, (self, flag) => (self & flag) !== 0);
6841
7007
  /** @internal */
6842
- const make$h = (...flags) => flags.reduce((a, b) => a | b, 0);
7008
+ const make$j = (...flags) => flags.reduce((a, b) => a | b, 0);
6843
7009
  /** @internal */
6844
- const none$1 = /*#__PURE__*/make$h(None$1);
7010
+ const none$1 = /*#__PURE__*/make$j(None$1);
6845
7011
  /** @internal */
6846
7012
  const runtimeMetrics = self => isEnabled(self, RuntimeMetrics);
6847
7013
  const windDown = self => isEnabled(self, WindDown);
6848
7014
  /** @internal */
6849
- const diff$3 = /*#__PURE__*/dual(2, (self, that) => make$i(self ^ that, that));
7015
+ const diff$3 = /*#__PURE__*/dual(2, (self, that) => make$k(self ^ that, that));
6850
7016
  /** @internal */
6851
7017
  const patch$4 = /*#__PURE__*/dual(2, (self, patch) => self & (invert(active(patch)) | enabled(patch)) | active(patch) & enabled(patch));
6852
7018
  /** @internal */
6853
- const differ$1 = /*#__PURE__*/make$j({
7019
+ const differ$1 = /*#__PURE__*/make$l({
6854
7020
  empty: empty$a,
6855
7021
  diff: (oldValue, newValue) => diff$3(oldValue, newValue),
6856
7022
  combine: (first, second) => andThen(second)(first),
@@ -7417,7 +7583,7 @@ const evaluateCause = self => {
7417
7583
  }
7418
7584
  case OP_FAIL$1:
7419
7585
  {
7420
- _parallel = add(_parallel, make$p(cause._tag, cause.error));
7586
+ _parallel = add(_parallel, make$r(cause._tag, cause.error));
7421
7587
  if (stack.length === 0) {
7422
7588
  return [_parallel, _sequential];
7423
7589
  }
@@ -7426,7 +7592,7 @@ const evaluateCause = self => {
7426
7592
  }
7427
7593
  case OP_DIE:
7428
7594
  {
7429
- _parallel = add(_parallel, make$p(cause._tag, cause.defect));
7595
+ _parallel = add(_parallel, make$r(cause._tag, cause.defect));
7430
7596
  if (stack.length === 0) {
7431
7597
  return [_parallel, _sequential];
7432
7598
  }
@@ -7435,7 +7601,7 @@ const evaluateCause = self => {
7435
7601
  }
7436
7602
  case OP_INTERRUPT:
7437
7603
  {
7438
- _parallel = add(_parallel, make$p(cause._tag, cause.fiberId));
7604
+ _parallel = add(_parallel, make$r(cause._tag, cause.fiberId));
7439
7605
  if (stack.length === 0) {
7440
7606
  return [_parallel, _sequential];
7441
7607
  }
@@ -7653,34 +7819,33 @@ const renderErrorCause = (cause, prefix) => {
7653
7819
  return stack;
7654
7820
  };
7655
7821
  /** @internal */
7656
- class PrettyError extends globalThis.Error {
7657
- span = undefined;
7658
- constructor(originalError) {
7659
- const originalErrorIsObject = typeof originalError === "object" && originalError !== null;
7660
- const prevLimit = Error.stackTraceLimit;
7661
- Error.stackTraceLimit = 1;
7662
- super(prettyErrorMessage(originalError), originalErrorIsObject && "cause" in originalError && typeof originalError.cause !== "undefined" ? {
7663
- cause: new PrettyError(originalError.cause)
7664
- } : undefined);
7665
- if (this.message === "") {
7666
- this.message = "An error has occurred";
7822
+ const makePrettyError = originalError => {
7823
+ const originalErrorIsObject = typeof originalError === "object" && originalError !== null;
7824
+ const prevLimit = Error.stackTraceLimit;
7825
+ Error.stackTraceLimit = 1;
7826
+ const error = new Error(prettyErrorMessage(originalError), originalErrorIsObject && "cause" in originalError && typeof originalError.cause !== "undefined" ? {
7827
+ cause: makePrettyError(originalError.cause)
7828
+ } : undefined);
7829
+ Error.stackTraceLimit = prevLimit;
7830
+ if (error.message === "") {
7831
+ error.message = "An error has occurred";
7832
+ }
7833
+ Error.stackTraceLimit = prevLimit;
7834
+ error.name = originalError instanceof Error ? originalError.name : "Error";
7835
+ if (originalErrorIsObject) {
7836
+ if (spanSymbol in originalError) {
7837
+ error.span = originalError[spanSymbol];
7667
7838
  }
7668
- Error.stackTraceLimit = prevLimit;
7669
- this.name = originalError instanceof Error ? originalError.name : "Error";
7670
- if (originalErrorIsObject) {
7671
- if (spanSymbol in originalError) {
7672
- this.span = originalError[spanSymbol];
7839
+ Object.keys(originalError).forEach(key => {
7840
+ if (!(key in error)) {
7841
+ // @ts-expect-error
7842
+ error[key] = originalError[key];
7673
7843
  }
7674
- Object.keys(originalError).forEach(key => {
7675
- if (!(key in this)) {
7676
- // @ts-expect-error
7677
- this[key] = originalError[key];
7678
- }
7679
- });
7680
- }
7681
- this.stack = prettyErrorStack(`${this.name}: ${this.message}`, originalError instanceof Error && originalError.stack ? originalError.stack : "", this.span);
7844
+ });
7682
7845
  }
7683
- }
7846
+ error.stack = prettyErrorStack(`${error.name}: ${error.message}`, originalError instanceof Error && originalError.stack ? originalError.stack : "", error.span);
7847
+ return error;
7848
+ };
7684
7849
  /**
7685
7850
  * A utility function for generating human-readable error messages from a generic error of type `unknown`.
7686
7851
  *
@@ -7768,10 +7933,10 @@ const spanSymbol = /*#__PURE__*/Symbol.for("effect/SpanAnnotation");
7768
7933
  const prettyErrors = cause => reduceWithContext(cause, void 0, {
7769
7934
  emptyCase: () => [],
7770
7935
  dieCase: (_, unknownError) => {
7771
- return [new PrettyError(unknownError)];
7936
+ return [makePrettyError(unknownError)];
7772
7937
  },
7773
7938
  failCase: (_, error) => {
7774
- return [new PrettyError(error)];
7939
+ return [makePrettyError(error)];
7775
7940
  },
7776
7941
  interruptCase: () => [],
7777
7942
  parallelCase: (_, l, r) => [...l, ...r],
@@ -7795,7 +7960,7 @@ const deferredVariance = {
7795
7960
  _A: _ => _
7796
7961
  };
7797
7962
  /** @internal */
7798
- const pending = joiners => {
7963
+ const pending$1 = joiners => {
7799
7964
  return {
7800
7965
  _tag: OP_STATE_PENDING,
7801
7966
  joiners
@@ -8846,7 +9011,7 @@ const deferredUnsafeMake = fiberId => {
8846
9011
  const _deferred = {
8847
9012
  ...CommitPrototype,
8848
9013
  [DeferredTypeId]: deferredVariance,
8849
- state: make$k(pending([])),
9014
+ state: make$m(pending$1([])),
8850
9015
  commit() {
8851
9016
  return deferredAwait(this);
8852
9017
  },
@@ -8953,7 +9118,7 @@ const currentSpanFromFiber = fiber => {
8953
9118
  * @since 2.0.0
8954
9119
  * @category constructors
8955
9120
  */
8956
- const make$g = deferredMake;
9121
+ const make$i = deferredMake;
8957
9122
  const _await$1 = deferredAwait;
8958
9123
  /**
8959
9124
  * Exits the `Deferred` with the specified `Exit` value, which will be
@@ -9425,7 +9590,7 @@ const MutableQueueProto = {
9425
9590
  return pipeArguments(this, arguments);
9426
9591
  }
9427
9592
  };
9428
- const make$f = capacity => {
9593
+ const make$h = capacity => {
9429
9594
  const queue = Object.create(MutableQueueProto);
9430
9595
  queue.queue = empty$7();
9431
9596
  queue.capacity = capacity;
@@ -9437,14 +9602,14 @@ const make$f = capacity => {
9437
9602
  * @since 2.0.0
9438
9603
  * @category constructors
9439
9604
  */
9440
- const bounded = capacity => make$f(capacity);
9605
+ const bounded = capacity => make$h(capacity);
9441
9606
  /**
9442
9607
  * Creates a new unbounded `MutableQueue`.
9443
9608
  *
9444
9609
  * @since 2.0.0
9445
9610
  * @category constructors
9446
9611
  */
9447
- const unbounded = () => make$f(undefined);
9612
+ const unbounded = () => make$h(undefined);
9448
9613
  /**
9449
9614
  * Returns the current number of elements in the queue.
9450
9615
  *
@@ -9613,7 +9778,7 @@ class ClockImpl {
9613
9778
  }
9614
9779
  }
9615
9780
  /** @internal */
9616
- const make$e = () => new ClockImpl();
9781
+ const make$g = () => new ClockImpl();
9617
9782
 
9618
9783
  /** @internal */
9619
9784
  const OP_AND = "And";
@@ -9860,7 +10025,7 @@ const FlatConfigProviderSymbolKey = "effect/ConfigProviderFlat";
9860
10025
  /** @internal */
9861
10026
  const FlatConfigProviderTypeId = /*#__PURE__*/Symbol.for(FlatConfigProviderSymbolKey);
9862
10027
  /** @internal */
9863
- const make$d = options => ({
10028
+ const make$f = options => ({
9864
10029
  [ConfigProviderTypeId]: ConfigProviderTypeId,
9865
10030
  pipe() {
9866
10031
  return pipeArguments(this, arguments);
@@ -9875,7 +10040,7 @@ const makeFlat = options => ({
9875
10040
  enumerateChildren: options.enumerateChildren
9876
10041
  });
9877
10042
  /** @internal */
9878
- const fromFlat = flat => make$d({
10043
+ const fromFlat = flat => make$f({
9879
10044
  load: config => flatMap$2(fromFlatLoop(flat, empty$m(), config, false), chunk => match$6(head$1(chunk), {
9880
10045
  onNone: () => fail$3(MissingData(empty$m(), `Expected a single value having structure: ${config}`)),
9881
10046
  onSome: succeed$4
@@ -10210,7 +10375,7 @@ const swap = (buffer, index1, index2) => {
10210
10375
  buffer[index2] = tmp;
10211
10376
  return buffer;
10212
10377
  };
10213
- const make$c = seed => new RandomImpl(hash(seed));
10378
+ const make$e = seed => new RandomImpl(hash(seed));
10214
10379
 
10215
10380
  /**
10216
10381
  * @since 2.0.0
@@ -10218,7 +10383,7 @@ const make$c = seed => new RandomImpl(hash(seed));
10218
10383
  /** @internal */
10219
10384
  const TracerTypeId = /*#__PURE__*/Symbol.for("effect/Tracer");
10220
10385
  /** @internal */
10221
- const make$b = options => ({
10386
+ const make$d = options => ({
10222
10387
  [TracerTypeId]: TracerTypeId,
10223
10388
  ...options
10224
10389
  });
@@ -10287,13 +10452,17 @@ class NativeSpan {
10287
10452
  }
10288
10453
  }
10289
10454
  /** @internal */
10290
- const nativeTracer = /*#__PURE__*/make$b({
10455
+ const nativeTracer = /*#__PURE__*/make$d({
10291
10456
  span: (name, parent, context, links, startTime, kind) => new NativeSpan(name, parent, context, links, startTime, kind),
10292
10457
  context: f => f()
10293
10458
  });
10459
+ /** @internal */
10460
+ const DisablePropagation = /*#__PURE__*/Reference()("effect/Tracer/DisablePropagation", {
10461
+ defaultValue: constFalse
10462
+ });
10294
10463
 
10295
10464
  /** @internal */
10296
- const liveServices = /*#__PURE__*/pipe(/*#__PURE__*/empty$k(), /*#__PURE__*/add$2(clockTag, /*#__PURE__*/make$e()), /*#__PURE__*/add$2(consoleTag, defaultConsole), /*#__PURE__*/add$2(randomTag, /*#__PURE__*/make$c(/*#__PURE__*/Math.random())), /*#__PURE__*/add$2(configProviderTag, /*#__PURE__*/fromEnv()), /*#__PURE__*/add$2(tracerTag, nativeTracer));
10465
+ const liveServices = /*#__PURE__*/pipe(/*#__PURE__*/empty$k(), /*#__PURE__*/add$2(clockTag, /*#__PURE__*/make$g()), /*#__PURE__*/add$2(consoleTag, defaultConsole), /*#__PURE__*/add$2(randomTag, /*#__PURE__*/make$e(/*#__PURE__*/Math.random())), /*#__PURE__*/add$2(configProviderTag, /*#__PURE__*/fromEnv()), /*#__PURE__*/add$2(tracerTag, nativeTracer));
10297
10466
  /**
10298
10467
  * The `FiberRef` holding the default `Effect` services.
10299
10468
  *
@@ -10545,7 +10714,7 @@ const Fatal = logLevelFatal;
10545
10714
  * @since 2.0.0
10546
10715
  * @category constructors
10547
10716
  */
10548
- const Error$1 = logLevelError;
10717
+ const Error$2 = logLevelError;
10549
10718
  /**
10550
10719
  * @since 2.0.0
10551
10720
  * @category constructors
@@ -10592,7 +10761,7 @@ const fromLiteral = literal => {
10592
10761
  case "Debug":
10593
10762
  return Debug;
10594
10763
  case "Error":
10595
- return Error$1;
10764
+ return Error$2;
10596
10765
  case "Fatal":
10597
10766
  return Fatal;
10598
10767
  case "Info":
@@ -10669,9 +10838,9 @@ class RefImpl extends Class {
10669
10838
  }
10670
10839
  }
10671
10840
  /** @internal */
10672
- const unsafeMake$2 = value => new RefImpl(make$k(value));
10841
+ const unsafeMake$2 = value => new RefImpl(make$m(value));
10673
10842
  /** @internal */
10674
- const make$a = value => sync$1(() => unsafeMake$2(value));
10843
+ const make$c = value => sync$1(() => unsafeMake$2(value));
10675
10844
  /** @internal */
10676
10845
  const get = self => self.get;
10677
10846
  /** @internal */
@@ -10810,7 +10979,7 @@ class MetricLabelImpl {
10810
10979
  }
10811
10980
  }
10812
10981
  /** @internal */
10813
- const make$9 = (key, value) => {
10982
+ const make$b = (key, value) => {
10814
10983
  return new MetricLabelImpl(key, value);
10815
10984
  };
10816
10985
  /** @internal */
@@ -10883,7 +11052,7 @@ const logWithLevel = level => (...message) => {
10883
11052
  /** @internal */
10884
11053
  const logWarning$1 = /*#__PURE__*/logWithLevel(Warning);
10885
11054
  /** @internal */
10886
- const logError$1 = /*#__PURE__*/logWithLevel(Error$1);
11055
+ const logError$1 = /*#__PURE__*/logWithLevel(Error$2);
10887
11056
  /* @internal */
10888
11057
  const mapErrorCause = /*#__PURE__*/dual(2, (self, f) => matchCauseEffect$2(self, {
10889
11058
  onFailure: c => failCauseSync(() => f(c)),
@@ -10928,6 +11097,7 @@ const updateFiberRefs = f => withFiberRuntime$1(state => {
10928
11097
  });
10929
11098
  /* @internal */
10930
11099
  const when$1 = /*#__PURE__*/dual(2, (self, condition) => suspend$2(() => condition() ? map$3(self, some) : succeed$4(none$4())));
11100
+ const filterDisablePropagation = /*#__PURE__*/flatMap$5(span => get$7(span.context, DisablePropagation) ? span._tag === "Span" ? filterDisablePropagation(span.parent) : none$4() : some(span));
10931
11101
 
10932
11102
  /** @internal */
10933
11103
  const OP_SEQUENTIAL = "Sequential";
@@ -11881,6 +12051,61 @@ const runFork$1 = (effect, options) => {
11881
12051
  /**
11882
12052
  * @since 2.0.0
11883
12053
  */
12054
+ /**
12055
+ * @since 3.20.0
12056
+ * @category models
12057
+ */
12058
+ class SchedulerRunner {
12059
+ scheduleDrain;
12060
+ running = false;
12061
+ tasks = /*#__PURE__*/new PriorityBuckets();
12062
+ constructor(scheduleDrain) {
12063
+ this.scheduleDrain = scheduleDrain;
12064
+ }
12065
+ starveInternal = depth => {
12066
+ const tasks = this.tasks.buckets;
12067
+ this.tasks.buckets = [];
12068
+ for (const [_, toRun] of tasks) {
12069
+ for (let i = 0; i < toRun.length; i++) {
12070
+ toRun[i]();
12071
+ }
12072
+ }
12073
+ if (this.tasks.buckets.length === 0) {
12074
+ this.running = false;
12075
+ } else {
12076
+ this.starve(depth);
12077
+ }
12078
+ };
12079
+ starve(depth = 0) {
12080
+ this.scheduleDrain(depth, this.starveInternal);
12081
+ }
12082
+ scheduleTask(task, priority) {
12083
+ this.tasks.scheduleTask(task, priority);
12084
+ if (!this.running) {
12085
+ this.running = true;
12086
+ this.starve();
12087
+ }
12088
+ }
12089
+ /**
12090
+ * @since 3.20.0
12091
+ * @category constructors
12092
+ */
12093
+ static cached(scheduleDrain) {
12094
+ const fallback = new SchedulerRunner(scheduleDrain);
12095
+ const runners = new WeakMap();
12096
+ return fiber => {
12097
+ if (fiber === undefined) {
12098
+ return fallback;
12099
+ }
12100
+ let runner = runners.get(fiber);
12101
+ if (runner === undefined) {
12102
+ runner = new SchedulerRunner(scheduleDrain);
12103
+ runners.set(fiber, runner);
12104
+ }
12105
+ return runner;
12106
+ };
12107
+ }
12108
+ }
11884
12109
  /**
11885
12110
  * @since 2.0.0
11886
12111
  * @category utils
@@ -11919,14 +12144,13 @@ class PriorityBuckets {
11919
12144
  */
11920
12145
  class MixedScheduler {
11921
12146
  maxNextTickBeforeTimer;
11922
- /**
11923
- * @since 2.0.0
11924
- */
11925
- running = false;
11926
- /**
11927
- * @since 2.0.0
11928
- */
11929
- tasks = /*#__PURE__*/new PriorityBuckets();
12147
+ getRunner = /*#__PURE__*/SchedulerRunner.cached((depth, drain) => {
12148
+ if (depth >= this.maxNextTickBeforeTimer) {
12149
+ setTimeout(() => drain(0), 0);
12150
+ } else {
12151
+ Promise.resolve(void 0).then(() => drain(depth + 1));
12152
+ }
12153
+ });
11930
12154
  constructor(
11931
12155
  /**
11932
12156
  * @since 2.0.0
@@ -11934,33 +12158,6 @@ class MixedScheduler {
11934
12158
  maxNextTickBeforeTimer) {
11935
12159
  this.maxNextTickBeforeTimer = maxNextTickBeforeTimer;
11936
12160
  }
11937
- /**
11938
- * @since 2.0.0
11939
- */
11940
- starveInternal(depth) {
11941
- const tasks = this.tasks.buckets;
11942
- this.tasks.buckets = [];
11943
- for (const [_, toRun] of tasks) {
11944
- for (let i = 0; i < toRun.length; i++) {
11945
- toRun[i]();
11946
- }
11947
- }
11948
- if (this.tasks.buckets.length === 0) {
11949
- this.running = false;
11950
- } else {
11951
- this.starve(depth);
11952
- }
11953
- }
11954
- /**
11955
- * @since 2.0.0
11956
- */
11957
- starve(depth = 0) {
11958
- if (depth >= this.maxNextTickBeforeTimer) {
11959
- setTimeout(() => this.starveInternal(0), 0);
11960
- } else {
11961
- Promise.resolve(void 0).then(() => this.starveInternal(depth + 1));
11962
- }
11963
- }
11964
12161
  /**
11965
12162
  * @since 2.0.0
11966
12163
  */
@@ -11970,12 +12167,8 @@ class MixedScheduler {
11970
12167
  /**
11971
12168
  * @since 2.0.0
11972
12169
  */
11973
- scheduleTask(task, priority) {
11974
- this.tasks.scheduleTask(task, priority);
11975
- if (!this.running) {
11976
- this.running = true;
11977
- this.starve();
11978
- }
12170
+ scheduleTask(task, priority, fiber) {
12171
+ this.getRunner(fiber).scheduleTask(task, priority);
11979
12172
  }
11980
12173
  }
11981
12174
  /**
@@ -12515,7 +12708,7 @@ const metricHookVariance = {
12515
12708
  _Out: _ => _
12516
12709
  };
12517
12710
  /** @internal */
12518
- const make$8 = options => ({
12711
+ const make$a = options => ({
12519
12712
  [MetricHookTypeId]: metricHookVariance,
12520
12713
  pipe() {
12521
12714
  return pipeArguments(this, arguments);
@@ -12532,7 +12725,7 @@ const counter$1 = key => {
12532
12725
  sum = sum + value;
12533
12726
  }
12534
12727
  };
12535
- return make$8({
12728
+ return make$a({
12536
12729
  get: () => counter$2(sum),
12537
12730
  update,
12538
12731
  modify: update
@@ -12548,7 +12741,7 @@ const frequency = key => {
12548
12741
  const slotCount = values.get(word) ?? 0;
12549
12742
  values.set(word, slotCount + 1);
12550
12743
  };
12551
- return make$8({
12744
+ return make$a({
12552
12745
  get: () => frequency$1(values),
12553
12746
  update,
12554
12747
  modify: update
@@ -12557,7 +12750,7 @@ const frequency = key => {
12557
12750
  /** @internal */
12558
12751
  const gauge = (_key, startAt) => {
12559
12752
  let value = startAt;
12560
- return make$8({
12753
+ return make$a({
12561
12754
  get: () => gauge$1(value),
12562
12755
  update: v => {
12563
12756
  value = v;
@@ -12627,7 +12820,7 @@ const histogram$1 = key => {
12627
12820
  }
12628
12821
  return builder;
12629
12822
  };
12630
- return make$8({
12823
+ return make$a({
12631
12824
  get: () => histogram$2({
12632
12825
  buckets: getBuckets(),
12633
12826
  count,
@@ -12694,7 +12887,7 @@ const summary = key => {
12694
12887
  count = count + 1;
12695
12888
  sum = sum + value;
12696
12889
  };
12697
- return make$8({
12890
+ return make$a({
12698
12891
  get: () => summary$1({
12699
12892
  error,
12700
12893
  quantiles: snapshot(Date.now()),
@@ -12961,7 +13154,7 @@ class MetricRegistryImpl {
12961
13154
  }
12962
13155
  }
12963
13156
  /** @internal */
12964
- const make$7 = () => {
13157
+ const make$9 = () => {
12965
13158
  return new MetricRegistryImpl();
12966
13159
  };
12967
13160
 
@@ -12978,9 +13171,9 @@ const metricVariance = {
12978
13171
  _Out: _ => _
12979
13172
  };
12980
13173
  /** @internal */
12981
- const globalMetricRegistry = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/Metric/globalMetricRegistry"), () => make$7());
13174
+ const globalMetricRegistry = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/Metric/globalMetricRegistry"), () => make$9());
12982
13175
  /** @internal */
12983
- const make$6 = function (keyType, unsafeUpdate, unsafeValue, unsafeModify) {
13176
+ const make$8 = function (keyType, unsafeUpdate, unsafeValue, unsafeModify) {
12984
13177
  const metric = Object.assign(effect => tap$1(effect, a => update(metric, a)), {
12985
13178
  [MetricTypeId]: metricVariance,
12986
13179
  keyType,
@@ -13019,21 +13212,21 @@ const fromMetricKey = key => {
13019
13212
  hookCache.set(extraTags, hook);
13020
13213
  return hook;
13021
13214
  };
13022
- return make$6(key.keyType, (input, extraTags) => hook(extraTags).update(input), extraTags => hook(extraTags).get(), (input, extraTags) => hook(extraTags).modify(input));
13215
+ return make$8(key.keyType, (input, extraTags) => hook(extraTags).update(input), extraTags => hook(extraTags).get(), (input, extraTags) => hook(extraTags).modify(input));
13023
13216
  };
13024
13217
  /** @internal */
13025
13218
  const histogram = (name, boundaries, description) => fromMetricKey(histogram$3(name, boundaries, description));
13026
13219
  /** @internal */
13027
- const tagged = /*#__PURE__*/dual(3, (self, key, value) => taggedWithLabels(self, [make$9(key, value)]));
13220
+ const tagged = /*#__PURE__*/dual(3, (self, key, value) => taggedWithLabels(self, [make$b(key, value)]));
13028
13221
  /** @internal */
13029
13222
  const taggedWithLabels = /*#__PURE__*/dual(2, (self, extraTags) => {
13030
- return make$6(self.keyType, (input, extraTags1) => self.unsafeUpdate(input, union$2(extraTags, extraTags1)), extraTags1 => self.unsafeValue(union$2(extraTags, extraTags1)), (input, extraTags1) => self.unsafeModify(input, union$2(extraTags, extraTags1)));
13223
+ return make$8(self.keyType, (input, extraTags1) => self.unsafeUpdate(input, union$2(extraTags, extraTags1)), extraTags1 => self.unsafeValue(union$2(extraTags, extraTags1)), (input, extraTags1) => self.unsafeModify(input, union$2(extraTags, extraTags1)));
13031
13224
  });
13032
13225
  /* @internal */
13033
13226
  const update = /*#__PURE__*/dual(2, (self, input) => fiberRefGetWith(currentMetricLabels, tags => sync$1(() => self.unsafeUpdate(input, tags))));
13034
13227
 
13035
13228
  /** @internal */
13036
- const complete = /*#__PURE__*/dual(2, (self, result) => fiberRefGetWith(currentRequestMap, map => sync$1(() => {
13229
+ const complete$1 = /*#__PURE__*/dual(2, (self, result) => fiberRefGetWith(currentRequestMap, map => sync$1(() => {
13037
13230
  if (map.has(self)) {
13038
13231
  const entry = map.get(self);
13039
13232
  if (!entry.state.completed) {
@@ -13176,7 +13369,7 @@ const none = /*#__PURE__*/globalValue("effect/Supervisor/none", () => fromEffect
13176
13369
  * @since 2.0.0
13177
13370
  * @category constructors
13178
13371
  */
13179
- const make$5 = make$j;
13372
+ const make$7 = make$l;
13180
13373
 
13181
13374
  /** @internal */
13182
13375
  const OP_EMPTY = "Empty";
@@ -13268,7 +13461,7 @@ const toSet = self => {
13268
13461
  if (isZip(self)) {
13269
13462
  return pipe(toSet(self.left), union(toSet(self.right)));
13270
13463
  } else {
13271
- return make$l(self);
13464
+ return make$n(self);
13272
13465
  }
13273
13466
  }
13274
13467
  };
@@ -13290,7 +13483,7 @@ const diff = (oldValue, newValue) => {
13290
13483
  return combine(added, removed);
13291
13484
  };
13292
13485
  /** @internal */
13293
- const differ = /*#__PURE__*/make$5({
13486
+ const differ = /*#__PURE__*/make$7({
13294
13487
  empty: empty$2,
13295
13488
  patch,
13296
13489
  combine,
@@ -13551,6 +13744,10 @@ class FiberRuntime extends Class {
13551
13744
  get await() {
13552
13745
  return async_(resume => {
13553
13746
  const cb = exit => resume(succeed$4(exit));
13747
+ if (this._exitValue !== null) {
13748
+ cb(this._exitValue);
13749
+ return;
13750
+ }
13554
13751
  this.tell(stateful((fiber, _) => {
13555
13752
  if (fiber._exitValue !== null) {
13556
13753
  cb(this._exitValue);
@@ -13770,7 +13967,7 @@ class FiberRuntime extends Class {
13770
13967
  * **NOTE**: This method must be invoked by the fiber itself.
13771
13968
  */
13772
13969
  drainQueueLaterOnExecutor() {
13773
- this.currentScheduler.scheduleTask(this.run, this.getFiberRef(currentSchedulingPriority));
13970
+ this.currentScheduler.scheduleTask(this.run, this.getFiberRef(currentSchedulingPriority), this);
13774
13971
  }
13775
13972
  /**
13776
13973
  * Drains the fiber's message queue while the fiber is actively running,
@@ -14434,7 +14631,7 @@ const tracerLogger = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/Lo
14434
14631
  logLevel,
14435
14632
  message
14436
14633
  }) => {
14437
- const span = getOption(getOrDefault$1(context, currentContext), spanTag);
14634
+ const span = filterDisablePropagation(getOption(getOrDefault$1(context, currentContext), spanTag));
14438
14635
  if (span._tag === "None" || span.value._tag === "ExternalSpan") {
14439
14636
  return;
14440
14637
  }
@@ -14453,7 +14650,7 @@ const tracerLogger = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/Lo
14453
14650
  span.value.event(toStringUnknown(Array.isArray(message) && message.length === 1 ? message[0] : message), clockService.unsafeCurrentTimeNanos(), attributes);
14454
14651
  }));
14455
14652
  /** @internal */
14456
- const currentLoggers = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentLoggers"), () => fiberRefUnsafeMakeHashSet(make$l(defaultLogger, tracerLogger)));
14653
+ const currentLoggers = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentLoggers"), () => fiberRefUnsafeMakeHashSet(make$n(defaultLogger, tracerLogger)));
14457
14654
  // === all
14458
14655
  const allResolveInput = input => {
14459
14656
  if (Array.isArray(input) || isIterable(input)) {
@@ -14561,7 +14758,7 @@ const forEachConcurrentDiscard = (self, f, batching, processAll, n) => uninterru
14561
14758
  const interruptAll = () => fibers.forEach(fiber => {
14562
14759
  fiber.currentScheduler.scheduleTask(() => {
14563
14760
  fiber.unsafeInterruptAsFork(parent.id());
14564
- }, 0);
14761
+ }, 0, fiber);
14565
14762
  });
14566
14763
  const startOrder = new Array();
14567
14764
  const joinOrder = new Array();
@@ -14585,7 +14782,7 @@ const forEachConcurrentDiscard = (self, f, batching, processAll, n) => uninterru
14585
14782
  fiber.unsafeInterruptAsFork(parent.id());
14586
14783
  }
14587
14784
  fiber.resume(runnable);
14588
- }, 0);
14785
+ }, 0, fiber);
14589
14786
  return fiber;
14590
14787
  };
14591
14788
  const onInterruptSignal = () => {
@@ -14636,7 +14833,7 @@ const forEachConcurrentDiscard = (self, f, batching, processAll, n) => uninterru
14636
14833
  if (interrupted) {
14637
14834
  fiber.currentScheduler.scheduleTask(() => {
14638
14835
  fiber.unsafeInterruptAsFork(parent.id());
14639
- }, 0);
14836
+ }, 0, fiber);
14640
14837
  }
14641
14838
  fiber.addObserver(wrapped => {
14642
14839
  let exit;
@@ -14895,7 +15092,7 @@ const scopeMake = (strategy = sequential$1) => sync$1(() => scopeUnsafeMake(stra
14895
15092
  /* @internal */
14896
15093
  const scopeExtend = /*#__PURE__*/dual(2, (effect, scope) => mapInputContext(effect,
14897
15094
  // @ts-expect-error
14898
- merge$1(make$q(scopeTag, scope))));
15095
+ merge$1(make$s(scopeTag, scope))));
14899
15096
  // circular with Supervisor
14900
15097
  /** @internal */
14901
15098
  const fiberRefUnsafeMakeSupervisor = initial => fiberRefUnsafeMakePatch(initial, {
@@ -14950,7 +15147,7 @@ const race$1 = /*#__PURE__*/dual(2, (self, that) => fiberIdWith$1(parentFiberId
14950
15147
  /** @internal */
14951
15148
  const raceFibersWith = /*#__PURE__*/dual(3, (self, other, options) => withFiberRuntime$1((parentFiber, parentStatus) => {
14952
15149
  const parentRuntimeFlags = parentStatus.runtimeFlags;
14953
- const raceIndicator = make$k(true);
15150
+ const raceIndicator = make$m(true);
14954
15151
  const leftFiber = unsafeMakeChildFiber(self, parentFiber, parentRuntimeFlags, options.selfScope);
14955
15152
  const rightFiber = unsafeMakeChildFiber(other, parentFiber, parentRuntimeFlags, options.otherScope);
14956
15153
  return async_(cb => {
@@ -15016,9 +15213,478 @@ const invokeWithInterrupt = (self, entries, onInterrupt) => fiberIdWith$1(id =>
15016
15213
  }
15017
15214
  return [];
15018
15215
  });
15019
- return forEachSequentialDiscard(residual, entry => complete(entry.request, exitInterrupt$1(id)));
15216
+ return forEachSequentialDiscard(residual, entry => complete$1(entry.request, exitInterrupt$1(id)));
15020
15217
  })));
15021
15218
 
15219
+ /** @internal */
15220
+ const complete = (key, exit, entryStats, timeToLiveMillis) => struct({
15221
+ _tag: "Complete",
15222
+ key,
15223
+ exit,
15224
+ entryStats,
15225
+ timeToLiveMillis
15226
+ });
15227
+ /** @internal */
15228
+ const pending = (key, deferred) => struct({
15229
+ _tag: "Pending",
15230
+ key,
15231
+ deferred
15232
+ });
15233
+ /** @internal */
15234
+ const refreshing = (deferred, complete) => struct({
15235
+ _tag: "Refreshing",
15236
+ deferred,
15237
+ complete
15238
+ });
15239
+ /** @internal */
15240
+ const MapKeyTypeId = /*#__PURE__*/Symbol.for("effect/Cache/MapKey");
15241
+ class MapKeyImpl {
15242
+ current;
15243
+ [MapKeyTypeId] = MapKeyTypeId;
15244
+ previous = undefined;
15245
+ next = undefined;
15246
+ constructor(current) {
15247
+ this.current = current;
15248
+ }
15249
+ [symbol$1]() {
15250
+ return pipe(hash(this.current), combine$7(hash(this.previous)), combine$7(hash(this.next)), cached(this));
15251
+ }
15252
+ [symbol](that) {
15253
+ if (this === that) {
15254
+ return true;
15255
+ }
15256
+ return isMapKey(that) && equals$1(this.current, that.current) && equals$1(this.previous, that.previous) && equals$1(this.next, that.next);
15257
+ }
15258
+ }
15259
+ /** @internal */
15260
+ const makeMapKey = current => new MapKeyImpl(current);
15261
+ /** @internal */
15262
+ const isMapKey = u => hasProperty(u, MapKeyTypeId);
15263
+ class KeySetImpl {
15264
+ head = undefined;
15265
+ tail = undefined;
15266
+ add(key) {
15267
+ if (key !== this.tail) {
15268
+ if (this.tail === undefined) {
15269
+ this.head = key;
15270
+ this.tail = key;
15271
+ } else {
15272
+ const previous = key.previous;
15273
+ const next = key.next;
15274
+ if (next !== undefined) {
15275
+ key.next = undefined;
15276
+ if (previous !== undefined) {
15277
+ previous.next = next;
15278
+ next.previous = previous;
15279
+ } else {
15280
+ this.head = next;
15281
+ this.head.previous = undefined;
15282
+ }
15283
+ }
15284
+ this.tail.next = key;
15285
+ key.previous = this.tail;
15286
+ this.tail = key;
15287
+ }
15288
+ }
15289
+ }
15290
+ remove() {
15291
+ const key = this.head;
15292
+ if (key !== undefined) {
15293
+ const next = key.next;
15294
+ if (next !== undefined) {
15295
+ key.next = undefined;
15296
+ this.head = next;
15297
+ this.head.previous = undefined;
15298
+ } else {
15299
+ this.head = undefined;
15300
+ this.tail = undefined;
15301
+ }
15302
+ }
15303
+ return key;
15304
+ }
15305
+ }
15306
+ /** @internal */
15307
+ const makeKeySet = () => new KeySetImpl();
15308
+ /**
15309
+ * Constructs a new `CacheState` from the specified values.
15310
+ *
15311
+ * @internal
15312
+ */
15313
+ const makeCacheState = (map, keys, accesses, updating, hits, misses) => ({
15314
+ map,
15315
+ keys,
15316
+ accesses,
15317
+ updating,
15318
+ hits,
15319
+ misses
15320
+ });
15321
+ /**
15322
+ * Constructs an initial cache state.
15323
+ *
15324
+ * @internal
15325
+ */
15326
+ const initialCacheState = () => makeCacheState(empty$8(), makeKeySet(), unbounded(), make$m(false), 0, 0);
15327
+ /** @internal */
15328
+ const CacheSymbolKey = "effect/Cache";
15329
+ /** @internal */
15330
+ const CacheTypeId = /*#__PURE__*/Symbol.for(CacheSymbolKey);
15331
+ const cacheVariance = {
15332
+ /* c8 ignore next */
15333
+ _Key: _ => _,
15334
+ /* c8 ignore next */
15335
+ _Error: _ => _,
15336
+ /* c8 ignore next */
15337
+ _Value: _ => _
15338
+ };
15339
+ /** @internal */
15340
+ const ConsumerCacheSymbolKey = "effect/ConsumerCache";
15341
+ /** @internal */
15342
+ const ConsumerCacheTypeId = /*#__PURE__*/Symbol.for(ConsumerCacheSymbolKey);
15343
+ const consumerCacheVariance = {
15344
+ /* c8 ignore next */
15345
+ _Key: _ => _,
15346
+ /* c8 ignore next */
15347
+ _Error: _ => _,
15348
+ /* c8 ignore next */
15349
+ _Value: _ => _
15350
+ };
15351
+ /** @internal */
15352
+ const makeCacheStats = options => options;
15353
+ /** @internal */
15354
+ const makeEntryStats = loadedMillis => ({
15355
+ loadedMillis
15356
+ });
15357
+ class CacheImpl {
15358
+ capacity;
15359
+ context;
15360
+ fiberId;
15361
+ lookup;
15362
+ timeToLive;
15363
+ [CacheTypeId] = cacheVariance;
15364
+ [ConsumerCacheTypeId] = consumerCacheVariance;
15365
+ cacheState;
15366
+ constructor(capacity, context, fiberId, lookup, timeToLive) {
15367
+ this.capacity = capacity;
15368
+ this.context = context;
15369
+ this.fiberId = fiberId;
15370
+ this.lookup = lookup;
15371
+ this.timeToLive = timeToLive;
15372
+ this.cacheState = initialCacheState();
15373
+ }
15374
+ get(key) {
15375
+ return map$3(this.getEither(key), merge$3);
15376
+ }
15377
+ get cacheStats() {
15378
+ return sync$1(() => makeCacheStats({
15379
+ hits: this.cacheState.hits,
15380
+ misses: this.cacheState.misses,
15381
+ size: size(this.cacheState.map)
15382
+ }));
15383
+ }
15384
+ getOption(key) {
15385
+ return suspend$2(() => match$6(get$2(this.cacheState.map, key), {
15386
+ onNone: () => {
15387
+ const mapKey = makeMapKey(key);
15388
+ this.trackAccess(mapKey);
15389
+ this.trackMiss();
15390
+ return succeed$4(none$4());
15391
+ },
15392
+ onSome: value => this.resolveMapValue(value)
15393
+ }));
15394
+ }
15395
+ getOptionComplete(key) {
15396
+ return suspend$2(() => match$6(get$2(this.cacheState.map, key), {
15397
+ onNone: () => {
15398
+ const mapKey = makeMapKey(key);
15399
+ this.trackAccess(mapKey);
15400
+ this.trackMiss();
15401
+ return succeed$4(none$4());
15402
+ },
15403
+ onSome: value => this.resolveMapValue(value, true)
15404
+ }));
15405
+ }
15406
+ contains(key) {
15407
+ return sync$1(() => has(this.cacheState.map, key));
15408
+ }
15409
+ entryStats(key) {
15410
+ return sync$1(() => {
15411
+ const option = get$2(this.cacheState.map, key);
15412
+ if (isSome(option)) {
15413
+ switch (option.value._tag) {
15414
+ case "Complete":
15415
+ {
15416
+ const loaded = option.value.entryStats.loadedMillis;
15417
+ return some(makeEntryStats(loaded));
15418
+ }
15419
+ case "Pending":
15420
+ {
15421
+ return none$4();
15422
+ }
15423
+ case "Refreshing":
15424
+ {
15425
+ const loaded = option.value.complete.entryStats.loadedMillis;
15426
+ return some(makeEntryStats(loaded));
15427
+ }
15428
+ }
15429
+ }
15430
+ return none$4();
15431
+ });
15432
+ }
15433
+ getEither(key) {
15434
+ return suspend$2(() => {
15435
+ const k = key;
15436
+ let mapKey = undefined;
15437
+ let deferred = undefined;
15438
+ let value = getOrUndefined(get$2(this.cacheState.map, k));
15439
+ if (value === undefined) {
15440
+ deferred = unsafeMake$4(this.fiberId);
15441
+ mapKey = makeMapKey(k);
15442
+ if (has(this.cacheState.map, k)) {
15443
+ value = getOrUndefined(get$2(this.cacheState.map, k));
15444
+ } else {
15445
+ set$1(this.cacheState.map, k, pending(mapKey, deferred));
15446
+ }
15447
+ }
15448
+ if (value === undefined) {
15449
+ this.trackAccess(mapKey);
15450
+ this.trackMiss();
15451
+ return map$3(this.lookupValueOf(key, deferred), right);
15452
+ } else {
15453
+ return flatMap$2(this.resolveMapValue(value), match$6({
15454
+ onNone: () => this.getEither(key),
15455
+ onSome: value => succeed$4(left(value))
15456
+ }));
15457
+ }
15458
+ });
15459
+ }
15460
+ invalidate(key) {
15461
+ return sync$1(() => {
15462
+ remove$1(this.cacheState.map, key);
15463
+ });
15464
+ }
15465
+ invalidateWhen(key, when) {
15466
+ return sync$1(() => {
15467
+ const value = get$2(this.cacheState.map, key);
15468
+ if (isSome(value) && value.value._tag === "Complete") {
15469
+ if (value.value.exit._tag === "Success") {
15470
+ if (when(value.value.exit.value)) {
15471
+ remove$1(this.cacheState.map, key);
15472
+ }
15473
+ }
15474
+ }
15475
+ });
15476
+ }
15477
+ get invalidateAll() {
15478
+ return sync$1(() => {
15479
+ this.cacheState.map = empty$8();
15480
+ });
15481
+ }
15482
+ refresh(key) {
15483
+ return clockWith(clock => suspend$2(() => {
15484
+ const k = key;
15485
+ const deferred = unsafeMake$4(this.fiberId);
15486
+ let value = getOrUndefined(get$2(this.cacheState.map, k));
15487
+ if (value === undefined) {
15488
+ if (has(this.cacheState.map, k)) {
15489
+ value = getOrUndefined(get$2(this.cacheState.map, k));
15490
+ } else {
15491
+ set$1(this.cacheState.map, k, pending(makeMapKey(k), deferred));
15492
+ }
15493
+ }
15494
+ if (value === undefined) {
15495
+ return asVoid$1(this.lookupValueOf(key, deferred));
15496
+ } else {
15497
+ switch (value._tag) {
15498
+ case "Complete":
15499
+ {
15500
+ if (this.hasExpired(clock, value.timeToLiveMillis)) {
15501
+ const found = getOrUndefined(get$2(this.cacheState.map, k));
15502
+ if (equals$1(found, value)) {
15503
+ remove$1(this.cacheState.map, k);
15504
+ }
15505
+ return asVoid$1(this.get(key));
15506
+ }
15507
+ // Only trigger the lookup if we're still the current value, `completedResult`
15508
+ return pipe(this.lookupValueOf(key, deferred), when$1(() => {
15509
+ const current = getOrUndefined(get$2(this.cacheState.map, k));
15510
+ if (equals$1(current, value)) {
15511
+ const mapValue = refreshing(deferred, value);
15512
+ set$1(this.cacheState.map, k, mapValue);
15513
+ return true;
15514
+ }
15515
+ return false;
15516
+ }), asVoid$1);
15517
+ }
15518
+ case "Pending":
15519
+ {
15520
+ return _await$1(value.deferred);
15521
+ }
15522
+ case "Refreshing":
15523
+ {
15524
+ return _await$1(value.deferred);
15525
+ }
15526
+ }
15527
+ }
15528
+ }));
15529
+ }
15530
+ set(key, value) {
15531
+ return clockWith(clock => sync$1(() => {
15532
+ const now = clock.unsafeCurrentTimeMillis();
15533
+ const k = key;
15534
+ const lookupResult = succeed$2(value);
15535
+ const mapValue = complete(makeMapKey(k), lookupResult, makeEntryStats(now), now + toMillis(decode(this.timeToLive(lookupResult))));
15536
+ set$1(this.cacheState.map, k, mapValue);
15537
+ }));
15538
+ }
15539
+ get size() {
15540
+ return sync$1(() => {
15541
+ return size(this.cacheState.map);
15542
+ });
15543
+ }
15544
+ get values() {
15545
+ return sync$1(() => {
15546
+ const values = [];
15547
+ for (const entry of this.cacheState.map) {
15548
+ if (entry[1]._tag === "Complete" && entry[1].exit._tag === "Success") {
15549
+ values.push(entry[1].exit.value);
15550
+ }
15551
+ }
15552
+ return values;
15553
+ });
15554
+ }
15555
+ get entries() {
15556
+ return sync$1(() => {
15557
+ const values = [];
15558
+ for (const entry of this.cacheState.map) {
15559
+ if (entry[1]._tag === "Complete" && entry[1].exit._tag === "Success") {
15560
+ values.push([entry[0], entry[1].exit.value]);
15561
+ }
15562
+ }
15563
+ return values;
15564
+ });
15565
+ }
15566
+ get keys() {
15567
+ return sync$1(() => {
15568
+ const keys = [];
15569
+ for (const entry of this.cacheState.map) {
15570
+ if (entry[1]._tag === "Complete" && entry[1].exit._tag === "Success") {
15571
+ keys.push(entry[0]);
15572
+ }
15573
+ }
15574
+ return keys;
15575
+ });
15576
+ }
15577
+ resolveMapValue(value, ignorePending = false) {
15578
+ return clockWith(clock => {
15579
+ switch (value._tag) {
15580
+ case "Complete":
15581
+ {
15582
+ this.trackAccess(value.key);
15583
+ if (this.hasExpired(clock, value.timeToLiveMillis)) {
15584
+ remove$1(this.cacheState.map, value.key.current);
15585
+ return succeed$4(none$4());
15586
+ }
15587
+ this.trackHit();
15588
+ return map$3(value.exit, some);
15589
+ }
15590
+ case "Pending":
15591
+ {
15592
+ this.trackAccess(value.key);
15593
+ this.trackHit();
15594
+ if (ignorePending) {
15595
+ return succeed$4(none$4());
15596
+ }
15597
+ return map$3(_await$1(value.deferred), some);
15598
+ }
15599
+ case "Refreshing":
15600
+ {
15601
+ this.trackAccess(value.complete.key);
15602
+ this.trackHit();
15603
+ if (this.hasExpired(clock, value.complete.timeToLiveMillis)) {
15604
+ if (ignorePending) {
15605
+ return succeed$4(none$4());
15606
+ }
15607
+ return map$3(_await$1(value.deferred), some);
15608
+ }
15609
+ return map$3(value.complete.exit, some);
15610
+ }
15611
+ }
15612
+ });
15613
+ }
15614
+ trackHit() {
15615
+ this.cacheState.hits = this.cacheState.hits + 1;
15616
+ }
15617
+ trackMiss() {
15618
+ this.cacheState.misses = this.cacheState.misses + 1;
15619
+ }
15620
+ trackAccess(key) {
15621
+ offer(this.cacheState.accesses, key);
15622
+ if (compareAndSet(this.cacheState.updating, false, true)) {
15623
+ let loop = true;
15624
+ while (loop) {
15625
+ const key = poll(this.cacheState.accesses, EmptyMutableQueue);
15626
+ if (key === EmptyMutableQueue) {
15627
+ loop = false;
15628
+ } else {
15629
+ this.cacheState.keys.add(key);
15630
+ }
15631
+ }
15632
+ let size$1 = size(this.cacheState.map);
15633
+ loop = size$1 > this.capacity;
15634
+ while (loop) {
15635
+ const key = this.cacheState.keys.remove();
15636
+ if (key !== undefined) {
15637
+ if (has(this.cacheState.map, key.current)) {
15638
+ remove$1(this.cacheState.map, key.current);
15639
+ size$1 = size$1 - 1;
15640
+ loop = size$1 > this.capacity;
15641
+ }
15642
+ } else {
15643
+ loop = false;
15644
+ }
15645
+ }
15646
+ set$3(this.cacheState.updating, false);
15647
+ }
15648
+ }
15649
+ hasExpired(clock, timeToLiveMillis) {
15650
+ return clock.unsafeCurrentTimeMillis() > timeToLiveMillis;
15651
+ }
15652
+ lookupValueOf(input, deferred) {
15653
+ return clockWith(clock => suspend$2(() => {
15654
+ const key = input;
15655
+ return pipe(this.lookup(input), provideContext$1(this.context), exit$1, flatMap$2(exit => {
15656
+ const now = clock.unsafeCurrentTimeMillis();
15657
+ const stats = makeEntryStats(now);
15658
+ const value = complete(makeMapKey(key), exit, stats, now + toMillis(decode(this.timeToLive(exit))));
15659
+ set$1(this.cacheState.map, key, value);
15660
+ return zipRight$2(done$4(deferred, exit), exit);
15661
+ }), onInterrupt(() => zipRight$2(interrupt$1(deferred), sync$1(() => {
15662
+ remove$1(this.cacheState.map, key);
15663
+ }))));
15664
+ }));
15665
+ }
15666
+ }
15667
+ /** @internal */
15668
+ const make$6 = options => {
15669
+ const timeToLive = decode(options.timeToLive);
15670
+ return makeWith({
15671
+ capacity: options.capacity,
15672
+ lookup: options.lookup,
15673
+ timeToLive: () => timeToLive
15674
+ });
15675
+ };
15676
+ /** @internal */
15677
+ const makeWith = options => map$3(all$1([context(), fiberId]), ([context, fiberId]) => new CacheImpl(options.capacity, context, fiberId, options.lookup, exit => decode(options.timeToLive(exit))));
15678
+
15679
+ /**
15680
+ * Constructs a new cache with the specified capacity, time to live, and
15681
+ * lookup function.
15682
+ *
15683
+ * @since 2.0.0
15684
+ * @category constructors
15685
+ */
15686
+ const make$5 = make$6;
15687
+
15022
15688
  /** @internal */
15023
15689
  const IntervalSymbolKey = "effect/ScheduleInterval";
15024
15690
  /** @internal */
@@ -15325,20 +15991,24 @@ class Semaphore {
15325
15991
  take = n => asyncInterrupt(resume => {
15326
15992
  if (this.free < n) {
15327
15993
  const observer = () => {
15328
- if (this.free < n) {
15329
- return;
15330
- }
15994
+ if (this.free < n) return;
15331
15995
  this.waiters.delete(observer);
15332
- this.taken += n;
15333
- resume(succeed$4(n));
15996
+ resume(suspend$2(() => {
15997
+ if (this.free < n) return this.take(n);
15998
+ this.taken += n;
15999
+ return succeed$4(n);
16000
+ }));
15334
16001
  };
15335
16002
  this.waiters.add(observer);
15336
16003
  return sync$1(() => {
15337
16004
  this.waiters.delete(observer);
15338
16005
  });
15339
16006
  }
15340
- this.taken += n;
15341
- return resume(succeed$4(n));
16007
+ resume(suspend$2(() => {
16008
+ if (this.free < n) return this.take(n);
16009
+ this.taken += n;
16010
+ return succeed$4(n);
16011
+ }));
15342
16012
  });
15343
16013
  updateTakenUnsafe(fiber, f) {
15344
16014
  this.taken = f(this.taken);
@@ -15350,7 +16020,7 @@ class Semaphore {
15350
16020
  item.value();
15351
16021
  item = iter.next();
15352
16022
  }
15353
- }, fiber.getFiberRef(currentSchedulingPriority));
16023
+ }, fiber.getFiberRef(currentSchedulingPriority), fiber);
15354
16024
  }
15355
16025
  return succeed$4(this.free);
15356
16026
  }
@@ -15614,7 +16284,7 @@ const make = options => new RuntimeImpl(options.context, options.runtimeFlags, o
15614
16284
  /** @internal */
15615
16285
  const runtime$1 = () => withFiberRuntime$1((state, status) => succeed$4(new RuntimeImpl(state.getFiberRef(currentContext), status.runtimeFlags, state.getFiberRefs())));
15616
16286
  /** @internal */
15617
- const defaultRuntimeFlags = /*#__PURE__*/make$h(Interruption, CooperativeYielding, RuntimeMetrics);
16287
+ const defaultRuntimeFlags = /*#__PURE__*/make$j(Interruption, CooperativeYielding, RuntimeMetrics);
15618
16288
  /** @internal */
15619
16289
  const defaultRuntime = /*#__PURE__*/make({
15620
16290
  context: /*#__PURE__*/empty$k(),
@@ -15689,7 +16359,7 @@ class MemoMapImpl {
15689
16359
  })));
15690
16360
  return succeed$4([cached, map]);
15691
16361
  }
15692
- return pipe(make$a(0), flatMap$2(observers => pipe(deferredMake(), flatMap$2(deferred => pipe(make$a(() => void_$2), map$3(finalizerRef => {
16362
+ return pipe(make$c(0), flatMap$2(observers => pipe(deferredMake(), flatMap$2(deferred => pipe(make$c(() => void_$2), map$3(finalizerRef => {
15693
16363
  const resource = uninterruptibleMask$2(restore => pipe(scopeMake(), flatMap$2(innerScope => pipe(restore(flatMap$2(makeBuilder(layer, innerScope, true), f => diffFiberRefs(f(this)))), exit$1, flatMap$2(exit => {
15694
16364
  switch (exit._tag) {
15695
16365
  case OP_FAILURE:
@@ -15831,6 +16501,53 @@ const effect_provide = /*#__PURE__*/dual(2, (self, source) => {
15831
16501
  }
15832
16502
  });
15833
16503
 
16504
+ /**
16505
+ * Provides a constructor for a Case Class.
16506
+ *
16507
+ * @since 2.0.0
16508
+ * @category constructors
16509
+ */
16510
+ const Error$1 = /*#__PURE__*/function () {
16511
+ const plainArgsSymbol = /*#__PURE__*/Symbol.for("effect/Data/Error/plainArgs");
16512
+ const O = {
16513
+ BaseEffectError: class extends YieldableError {
16514
+ constructor(args) {
16515
+ super(args?.message, args?.cause ? {
16516
+ cause: args.cause
16517
+ } : undefined);
16518
+ if (args) {
16519
+ Object.assign(this, args);
16520
+ // @effect-diagnostics-next-line floatingEffect:off
16521
+ Object.defineProperty(this, plainArgsSymbol, {
16522
+ value: args,
16523
+ enumerable: false
16524
+ });
16525
+ }
16526
+ }
16527
+ toJSON() {
16528
+ return {
16529
+ ...this[plainArgsSymbol],
16530
+ ...this
16531
+ };
16532
+ }
16533
+ }
16534
+ };
16535
+ return O.BaseEffectError;
16536
+ }();
16537
+ /**
16538
+ * @since 2.0.0
16539
+ * @category constructors
16540
+ */
16541
+ const TaggedError = tag => {
16542
+ const O = {
16543
+ BaseEffectError: class extends Error$1 {
16544
+ _tag = tag;
16545
+ }
16546
+ };
16547
+ O.BaseEffectError.prototype.name = tag;
16548
+ return O.BaseEffectError;
16549
+ };
16550
+
15834
16551
  /** @internal */
15835
16552
  const ScheduleSymbolKey = "effect/Schedule";
15836
16553
  /** @internal */
@@ -15959,7 +16676,7 @@ const checkEffect = /*#__PURE__*/dual(2, (self, test) => makeWithState(self.init
15959
16676
  return map$3(test(input, out), cont => cont ? [state, out, decision] : [state, out, done]);
15960
16677
  })));
15961
16678
  /** @internal */
15962
- const driver = self => pipe(make$a([none$4(), self.initial]), map$3(ref => new ScheduleDriverImpl(self, ref)));
16679
+ const driver = self => pipe(make$c([none$4(), self.initial]), map$3(ref => new ScheduleDriverImpl(self, ref)));
15963
16680
  /** @internal */
15964
16681
  const intersect = /*#__PURE__*/dual(2, (self, that) => intersectWith(self, that, intersect$1));
15965
16682
  /** @internal */
@@ -18787,4 +19504,88 @@ const zipRight = zipRightOptions;
18787
19504
  */
18788
19505
  const zipWith = zipWithOptions;
18789
19506
 
18790
- export { onInterrupt as $, flatMap$2 as A, clockWith as B, offer as C, compareAndSet as D, poll as E, EmptyMutableQueue as F, remove$1 as G, set$3 as H, size as I, isSome as J, some as K, empty$8 as L, make$k as M, unbounded as N, symbol$1 as O, pipe as P, cached as Q, combine$7 as R, hash as S, symbol as T, hasProperty as U, equals$1 as V, asVoid$1 as W, when$1 as X, succeed$2 as Y, toMillis as Z, _await$1 as _, right as a, empty$j as a$, zipRight$2 as a0, interrupt$1 as a1, done$4 as a2, exit$1 as a3, provideContext$1 as a4, context as a5, fiberId as a6, YieldableError as a7, gen$1 as a8, tryPromise as a9, Class as aA, pipeArguments as aB, catchAll$1 as aC, interrupt$2 as aD, get$4 as aE, length as aF, uninterruptible$1 as aG, withFiberRuntime$1 as aH, whenEffect as aI, deferredSucceed as aJ, forEachConcurrentDiscard as aK, deferredAwait as aL, fromIterable$6 as aM, empty$m as aN, splitAt$1 as aO, isEmpty$7 as aP, deferredUnsafeMake as aQ, fromIterable$5 as aR, pollUpTo as aS, deferredUnsafeDone as aT, prepend$1 as aU, isEmpty$2 as aV, filter as aW, appendAll$1 as aX, append$1 as aY, offerAll as aZ, deferredInterruptWith as a_, fail$1 as aa, try_ as ab, gen as ac, infinity as ad, logWarning as ae, make$a as af, modify as ag, get as ah, update$1 as ai, isInterrupted as aj, fail$4 as ak, failureOrCause as al, flipCauseOption as am, interrupt$3 as an, map$4 as ao, die$2 as ap, isDieType as aq, interruptors as ar, isInterruptedOnly as as, join as at, interruptFiber as au, _await as av, inheritAll as aw, interruptAsFiber as ax, dual as ay, deferredMake as az, left as b, raceWith as b$, bounded as b0, capacity as b1, void_$2 as b2, isFailure as b3, isEffect as b4, match$7 as b5, _void as b6, ignore as b7, zipWith as b8, exit as b9, make$g as bA, sequential as bB, acquireUseRelease as bC, forkIn as bD, isDone$4 as bE, succeed$3 as bF, size$1 as bG, combineAll as bH, intoDeferred as bI, zipLeft as bJ, tapErrorCause as bK, addFinalizer as bL, failCause as bM, flatten as bN, fiberIdWith as bO, interrupt as bP, failCause$3 as bQ, fail$2 as bR, matchCause as bS, scopedWith as bT, unsafeGet as bU, constVoid as bV, scope as bW, withFiberRuntime as bX, make$1 as bY, extend as bZ, close as b_, zipRight$1 as ba, sync as bb, provide as bc, matchCauseEffect as bd, zipRight as be, flatMap as bf, forkDaemon as bg, interruptible as bh, suspend as bi, ensuring as bj, uninterruptible as bk, map as bl, zip as bm, failCause$2 as bn, match$3 as bo, forEach as bp, all$2 as bq, getOrElse as br, void_$1 as bs, dieMessage as bt, catchAllCause as bu, die as bv, map$2 as bw, uninterruptibleMask as bx, all as by, fork as bz, catchAll as c, runtime as c0, tap as c1, addFinalizerExit as c2, makeSemaphore as c3, when as c4, race as c5, as as c6, repeat as c7, asVoid as c8, zip$1 as c9, raceFirst as ca, forever as cb, of$1 as cc, fail as cd, mapError as ce, reduce$6 as cf, map$7 as cg, match as ch, splitWhere as ci, isSuccess as cj, head as ck, filterMap as cl, catchSomeCause as cm, unsafeFromArray as cn, async as co, runFork as cp, isRight as d, getRight as e, decode as f, getOrThrowWith as g, map$3 as h, identity as i, all$1 as j, merge$3 as k, logError as l, match$6 as m, sync$1 as n, suspend$2 as o, get$2 as p, succeed$4 as q, runPromise as r, succeed as s, tapError as t, none$4 as u, getOrUndefined as v, unsafeMake$4 as w, has as x, set$1 as y, struct as z };
19507
+ class FetchError extends TaggedError('FetchError') {
19508
+ }
19509
+ class NotFoundError extends TaggedError('NotFoundError') {
19510
+ }
19511
+ const httpClient = (input, init) => gen$1(function* () {
19512
+ const response = yield* tryPromise({
19513
+ try: () => fetch(input, init),
19514
+ catch: error => new FetchError({ cause: error }),
19515
+ });
19516
+ if (response.status === 404) {
19517
+ return yield* fail$1(new NotFoundError({ url: response.url }));
19518
+ }
19519
+ return response;
19520
+ });
19521
+ class ResponseTextError extends TaggedError('ResponseTextError') {
19522
+ constructor(error) {
19523
+ super(new Error(`Failed to read response text`, { cause: error }));
19524
+ }
19525
+ }
19526
+ const responseAsText = (res) => tryPromise({
19527
+ try: () => res.text(),
19528
+ catch: error => new ResponseTextError(error),
19529
+ });
19530
+
19531
+ const SVGString = refined(isValidSVG, () => error('SVG data is malformed'));
19532
+ class BrandValidationError extends TaggedError('BrandValidationError') {
19533
+ constructor(error, type) {
19534
+ super(new Error(`Brand validation failed for type ${type}.`, { cause: error }));
19535
+ }
19536
+ }
19537
+ const createValidSVGString = (svg) => try_({
19538
+ try: () => SVGString(svg),
19539
+ catch: error => new BrandValidationError(error, 'SVGString'),
19540
+ });
19541
+ function isValidSVG(svg) {
19542
+ if (typeof svg !== 'string') {
19543
+ return false;
19544
+ }
19545
+ try {
19546
+ const parser = new DOMParser();
19547
+ const doc = parser.parseFromString(svg, 'image/svg+xml');
19548
+ return doc.documentElement.nodeName === 'svg';
19549
+ }
19550
+ catch {
19551
+ return false;
19552
+ }
19553
+ }
19554
+
19555
+ const emptyDefaultSvg = () => SVGString(`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"></svg>`);
19556
+ const createIconCache = () => make$5({
19557
+ capacity: 200,
19558
+ timeToLive: infinity,
19559
+ lookup: (key) => gen(function* () {
19560
+ const name = key;
19561
+ const assetPath = createAssetUrlSafely(`${name}.svg`, 'icons');
19562
+ const res = yield* httpClient(assetPath);
19563
+ const responseString = yield* responseAsText(res);
19564
+ return yield* createValidSVGString(responseString);
19565
+ }),
19566
+ });
19567
+ let cacheInstance = null;
19568
+ function fetchIconSvg(name) {
19569
+ const key = name;
19570
+ return gen(function* () {
19571
+ if (!cacheInstance) {
19572
+ cacheInstance = yield* createIconCache();
19573
+ }
19574
+ return yield* cacheInstance.get(key);
19575
+ });
19576
+ }
19577
+ function clearIconCache() {
19578
+ return gen(function* () {
19579
+ if (cacheInstance) {
19580
+ yield* cacheInstance.invalidateAll;
19581
+ }
19582
+ else {
19583
+ logWarning('Attempted to clear icon cache before it was initialized');
19584
+ }
19585
+ });
19586
+ }
19587
+
19588
+ export { asVoid$1 as $, ARIA_VALIDATION_RUNTIME_CHANGED_EVENT as A, isInterruptedOnly as B, join as C, interruptFiber as D, inheritAll as E, interruptAsFiber as F, pipe as G, flatMap$2 as H, sync$1 as I, dual as J, map$3 as K, make$m as L, unbounded as M, deferredMake as N, Class as O, pipeArguments as P, suspend$2 as Q, catchAll$1 as R, interrupt$2 as S, get$4 as T, none$4 as U, some as V, length as W, uninterruptible$1 as X, withFiberRuntime$1 as Y, set$3 as Z, _await as _, catchAll as a, map$2 as a$, whenEffect as a0, deferredSucceed as a1, zipRight$2 as a2, forEachConcurrentDiscard as a3, deferredAwait as a4, poll as a5, EmptyMutableQueue as a6, succeed$4 as a7, fromIterable$6 as a8, empty$m as a9, ignore as aA, zipWith as aB, exit as aC, zipRight$1 as aD, sync as aE, provide as aF, matchCauseEffect as aG, zipRight as aH, flatMap as aI, forkDaemon as aJ, interruptible as aK, suspend as aL, ensuring as aM, uninterruptible as aN, map as aO, zip as aP, succeed$2 as aQ, failCause$2 as aR, match$3 as aS, forEach as aT, isSome as aU, all$2 as aV, getOrElse as aW, void_$1 as aX, dieMessage as aY, catchAllCause as aZ, die as a_, splitAt$1 as aa, isEmpty$7 as ab, deferredUnsafeMake as ac, onInterrupt as ad, offer as ae, fromIterable$5 as af, pollUpTo as ag, deferredUnsafeDone as ah, prepend$1 as ai, isEmpty$2 as aj, filter as ak, appendAll$1 as al, append$1 as am, offerAll as an, deferredInterruptWith as ao, empty$j as ap, bounded as aq, capacity as ar, void_$2 as as, fiberId as at, isFailure as au, hasProperty as av, isEffect as aw, identity as ax, match$7 as ay, _void as az, emptyDefaultSvg as b, uninterruptibleMask as b0, all as b1, fork as b2, make$i as b3, sequential as b4, acquireUseRelease as b5, forkIn as b6, isDone$4 as b7, succeed$3 as b8, size$1 as b9, tap as bA, addFinalizerExit as bB, makeSemaphore as bC, when as bD, race as bE, as as bF, match$6 as bG, repeat as bH, asVoid as bI, equals$1 as bJ, zip$1 as bK, raceFirst as bL, forever as bM, of$1 as bN, fail as bO, mapError as bP, reduce$6 as bQ, map$7 as bR, match as bS, splitWhere as bT, isSuccess as bU, head as bV, filterMap as bW, catchSomeCause as bX, unsafeFromArray as bY, async as bZ, runFork as b_, combineAll as ba, _await$1 as bb, intoDeferred as bc, zipLeft as bd, tapErrorCause as be, addFinalizer as bf, failCause as bg, flatten as bh, fiberIdWith as bi, interrupt as bj, left as bk, right as bl, failCause$3 as bm, fail$2 as bn, matchCause as bo, scopedWith as bp, unsafeGet as bq, constVoid as br, scope as bs, gen as bt, withFiberRuntime as bu, make$1 as bv, extend as bw, close as bx, raceWith as by, runtime as bz, clearIconCache as c, disableAriaValidation as d, enableAriaValidation as e, fetchIconSvg as f, modify as g, get as h, isAriaValidationEnabled as i, update$1 as j, isInterrupted as k, logError as l, make$c as m, fail$4 as n, failureOrCause as o, flipCauseOption as p, queueValidation as q, runPromise as r, succeed as s, tapError as t, useVerboseLogging as u, interrupt$3 as v, map$4 as w, die$2 as x, isDieType as y, interruptors as z };
19589
+ //# sourceMappingURL=icons-D1lxdRXP.js.map
19590
+
19591
+ //# sourceMappingURL=icons-D1lxdRXP.js.map