@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,5 +1,120 @@
1
1
  'use strict';
2
2
 
3
+ var assets = require('./assets-XY-cBmal.js');
4
+
5
+ /**
6
+ * Verify whether a value is a Promise by duck-testing for a 'then' function
7
+ */
8
+ function isPromise(value) {
9
+ if (!value)
10
+ return false;
11
+ return typeof value === 'object' && typeof value.then === 'function';
12
+ }
13
+
14
+ /**
15
+ * Resolve the result of a function that may be async or not, as a Promise.
16
+ */
17
+ function resolvePossiblyAsyncFunction(func, args = []) {
18
+ const res = func(...args);
19
+ if (isPromise(res)) {
20
+ return res;
21
+ }
22
+ return Promise.resolve(res);
23
+ }
24
+
25
+ const GLOBAL_STATE_KEY = Symbol('__lmvzAriaValidationRuntimeState');
26
+ const ARIA_VALIDATION_RUNTIME_CHANGED_EVENT = 'lmvz:aria-validation-runtime-changed';
27
+ function getRuntimeState() {
28
+ const globalState = globalThis;
29
+ if (!globalState[GLOBAL_STATE_KEY]) {
30
+ globalState[GLOBAL_STATE_KEY] = {
31
+ enabled: false,
32
+ };
33
+ }
34
+ return globalState[GLOBAL_STATE_KEY];
35
+ }
36
+ function notifyRuntimeChange() {
37
+ if (typeof window === 'undefined')
38
+ return;
39
+ window.dispatchEvent(new CustomEvent(ARIA_VALIDATION_RUNTIME_CHANGED_EVENT));
40
+ }
41
+ async function fetchRuntime() {
42
+ const state = getRuntimeState();
43
+ if (!state.enabled)
44
+ return null;
45
+ if (state.runtime)
46
+ return state.runtime;
47
+ if (!state.loadPromise) {
48
+ state.loadPromise = Promise.resolve().then(function () { return require('./index-ww_DCXU7.js'); }).catch(() => null);
49
+ }
50
+ const runtime = await state.loadPromise;
51
+ if (runtime) {
52
+ state.runtime = runtime;
53
+ }
54
+ return runtime;
55
+ }
56
+ async function initializeValidation(...args) {
57
+ const runtime = await fetchRuntime();
58
+ const s = getRuntimeState();
59
+ if (!s.enabled)
60
+ return;
61
+ if (!runtime) {
62
+ console.warn('Failed to load aria validation runtime');
63
+ return;
64
+ }
65
+ runtime.initializeValidationStream(...args);
66
+ }
67
+ const isAriaValidationEnabled = () => getRuntimeState().enabled;
68
+ const useVerboseLogging = () => getRuntimeState().verboseLogging ?? false;
69
+ const enableAriaValidation = (options = {}) => {
70
+ const state = getRuntimeState();
71
+ if (state.enabled)
72
+ return;
73
+ Object.assign(state, options);
74
+ state.enabled = true;
75
+ initializeValidation().then(() => {
76
+ notifyRuntimeChange();
77
+ });
78
+ };
79
+ const disableAriaValidation = () => {
80
+ const state = getRuntimeState();
81
+ if (!state.enabled)
82
+ return;
83
+ state.enabled = false;
84
+ notifyRuntimeChange();
85
+ };
86
+ function queueValidation(...args) {
87
+ const { enabled, runtime, loadPromise, lazyCondition } = getRuntimeState();
88
+ if (!enabled)
89
+ return;
90
+ if (!lazyCondition)
91
+ return q();
92
+ resolvePossiblyAsyncFunction(lazyCondition).then((shouldEnqueue) => {
93
+ if (!shouldEnqueue)
94
+ return;
95
+ q();
96
+ });
97
+ function q() {
98
+ if (runtime)
99
+ return runtime.enqueueValidation(...args);
100
+ if (!loadPromise) {
101
+ 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.');
102
+ return;
103
+ }
104
+ loadPromise
105
+ .then((loadedRuntime) => {
106
+ if (!loadedRuntime?.enqueueValidation) {
107
+ console.error('Failed to load aria validation runtime');
108
+ return;
109
+ }
110
+ loadedRuntime.enqueueValidation(...args);
111
+ })
112
+ .catch(() => {
113
+ console.error('Failed to enqueue validation due to an error while loading the runtime');
114
+ });
115
+ }
116
+ }
117
+
3
118
  /**
4
119
  * Tests if a value is a `function`.
5
120
  *
@@ -275,19 +390,19 @@ function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
275
390
  * @category constructors
276
391
  * @since 2.0.0
277
392
  */
278
- const make$u = isEquivalent => (self, that) => self === that || isEquivalent(self, that);
393
+ const make$w = isEquivalent => (self, that) => self === that || isEquivalent(self, that);
279
394
  /**
280
395
  * @category mapping
281
396
  * @since 2.0.0
282
397
  */
283
- const mapInput$1 = /*#__PURE__*/dual(2, (self, f) => make$u((x, y) => self(f(x), f(y))));
398
+ const mapInput$1 = /*#__PURE__*/dual(2, (self, f) => make$w((x, y) => self(f(x), f(y))));
284
399
  /**
285
400
  * Creates a new `Equivalence` for an array of values based on a given `Equivalence` for the elements of the array.
286
401
  *
287
402
  * @category combinators
288
403
  * @since 2.0.0
289
404
  */
290
- const array$1 = item => make$u((self, that) => {
405
+ const array$1 = item => make$w((self, that) => {
291
406
  if (self.length !== that.length) {
292
407
  return false;
293
408
  }
@@ -1032,10 +1147,13 @@ function compareBoth(self, that) {
1032
1147
  }
1033
1148
  }
1034
1149
  if (structuralRegionState.enabled) {
1150
+ if (self === null || that === null) {
1151
+ return false;
1152
+ }
1035
1153
  if (Array.isArray(self) && Array.isArray(that)) {
1036
1154
  return self.length === that.length && self.every((v, i) => compareBoth(v, that[i]));
1037
1155
  }
1038
- if (Object.getPrototypeOf(self) === Object.prototype && Object.getPrototypeOf(self) === Object.prototype) {
1156
+ if (Object.getPrototypeOf(self) === Object.prototype && Object.getPrototypeOf(that) === Object.prototype) {
1039
1157
  const keysSelf = Object.keys(self);
1040
1158
  const keysThat = Object.keys(that);
1041
1159
  if (keysSelf.length === keysThat.length) {
@@ -1218,7 +1336,7 @@ const OP_YIELD = "Yield";
1218
1336
  /** @internal */
1219
1337
  const OP_REVERT_FLAGS = "RevertFlags";
1220
1338
 
1221
- let moduleVersion = "3.19.14";
1339
+ let moduleVersion = "3.21.0";
1222
1340
  const getCurrentVersion = () => moduleVersion;
1223
1341
 
1224
1342
  /** @internal */
@@ -1602,17 +1720,17 @@ const isNonEmptyArray$1 = self => self.length > 0;
1602
1720
  * @category constructors
1603
1721
  * @since 2.0.0
1604
1722
  */
1605
- const make$t = compare => (self, that) => self === that ? 0 : compare(self, that);
1723
+ const make$v = compare => (self, that) => self === that ? 0 : compare(self, that);
1606
1724
  /**
1607
1725
  * @category instances
1608
1726
  * @since 2.0.0
1609
1727
  */
1610
- const number = /*#__PURE__*/make$t((self, that) => self < that ? -1 : 1);
1728
+ const number = /*#__PURE__*/make$v((self, that) => self < that ? -1 : 1);
1611
1729
  /**
1612
1730
  * @category mapping
1613
1731
  * @since 2.0.0
1614
1732
  */
1615
- const mapInput = /*#__PURE__*/dual(2, (self, f) => make$t((b1, b2) => self(f(b1), f(b2))));
1733
+ const mapInput = /*#__PURE__*/dual(2, (self, f) => make$v((b1, b2) => self(f(b1), f(b2))));
1616
1734
  /**
1617
1735
  * Test whether one value is _strictly greater than_ another.
1618
1736
  *
@@ -2094,7 +2212,7 @@ const mergeWith = f => (o1, o2) => {
2094
2212
  * @category constructors
2095
2213
  * @since 2.0.0
2096
2214
  */
2097
- const make$s = (...elements) => elements;
2215
+ const make$u = (...elements) => elements;
2098
2216
 
2099
2217
  /**
2100
2218
  * This module provides utility functions for working with arrays in TypeScript.
@@ -2458,7 +2576,7 @@ const sort = /*#__PURE__*/dual(2, (self, O) => {
2458
2576
  * @category zipping
2459
2577
  * @since 2.0.0
2460
2578
  */
2461
- const zip$3 = /*#__PURE__*/dual(2, (self, that) => zipWith$2(self, that, make$s));
2579
+ const zip$3 = /*#__PURE__*/dual(2, (self, that) => zipWith$2(self, that, make$u));
2462
2580
  /**
2463
2581
  * Apply a function to pairs of elements at the same index in two `Iterable`s, collecting the results in a new `Array`. If one
2464
2582
  * input `Iterable` is short, excess elements of the longer `Iterable` are discarded.
@@ -2913,6 +3031,54 @@ const Order$1 = number;
2913
3031
  */
2914
3032
  const escape = string => string.replace(/[/\\^$*+?.()|[\]{}]/g, "\\$&");
2915
3033
 
3034
+ /**
3035
+ * This module provides types and utility functions to create and work with branded types,
3036
+ * which are TypeScript types with an added type tag to prevent accidental usage of a value in the wrong context.
3037
+ *
3038
+ * The `refined` and `nominal` functions are both used to create branded types in TypeScript.
3039
+ * The main difference between them is that `refined` allows for validation of the data, while `nominal` does not.
3040
+ *
3041
+ * 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.
3042
+ * This is useful when you want to distinguish between two values of the same type that have different meanings.
3043
+ * The `nominal` function does not perform any validation of the input data.
3044
+ *
3045
+ * On the other hand, the `refined` function is used to create a new branded type that has the same underlying type as the input,
3046
+ * but with a different name, and it also allows for validation of the input data.
3047
+ * The `refined` function takes a predicate that is used to validate the input data.
3048
+ * If the input data fails the validation, a `BrandErrors` is returned, which provides information about the specific validation failure.
3049
+ *
3050
+ * @since 2.0.0
3051
+ */
3052
+ /**
3053
+ * @since 2.0.0
3054
+ * @category symbols
3055
+ */
3056
+ const RefinedConstructorsTypeId = /*#__PURE__*/Symbol.for("effect/Brand/Refined");
3057
+ /**
3058
+ * Returns a `BrandErrors` that contains a single `RefinementError`.
3059
+ *
3060
+ * @since 2.0.0
3061
+ * @category constructors
3062
+ */
3063
+ const error = (message, meta) => [{
3064
+ message,
3065
+ meta
3066
+ }];
3067
+ function refined(...args) {
3068
+ const either = args.length === 2 ? unbranded => args[0](unbranded) ? right(unbranded) : left(args[1](unbranded)) : unbranded => {
3069
+ return match$6(args[0](unbranded), {
3070
+ onNone: () => right(unbranded),
3071
+ onSome: left
3072
+ });
3073
+ };
3074
+ return Object.assign(unbranded => getOrThrowWith(either(unbranded), identity), {
3075
+ [RefinedConstructorsTypeId]: RefinedConstructorsTypeId,
3076
+ option: args => getRight(either(args)),
3077
+ either,
3078
+ is: args => isRight(either(args))
3079
+ });
3080
+ }
3081
+
2916
3082
  /** @internal */
2917
3083
  const TagTypeId = /*#__PURE__*/Symbol.for("effect/Context/Tag");
2918
3084
  /** @internal */
@@ -2947,7 +3113,7 @@ const TagProto = {
2947
3113
  return self;
2948
3114
  },
2949
3115
  context(self) {
2950
- return make$r(this, self);
3116
+ return make$t(this, self);
2951
3117
  }
2952
3118
  };
2953
3119
  const ReferenceProto = {
@@ -3057,7 +3223,7 @@ const _empty$6 = /*#__PURE__*/makeContext(/*#__PURE__*/new Map());
3057
3223
  /** @internal */
3058
3224
  const empty$l = () => _empty$6;
3059
3225
  /** @internal */
3060
- const make$r = (tag, service) => makeContext(new Map([[tag.key, service]]));
3226
+ const make$t = (tag, service) => makeContext(new Map([[tag.key, service]]));
3061
3227
  /** @internal */
3062
3228
  const add$3 = /*#__PURE__*/dual(3, (self, tag, service) => {
3063
3229
  const map = new Map(self.unsafeMap);
@@ -3176,7 +3342,7 @@ const empty$k = empty$l;
3176
3342
  * @since 2.0.0
3177
3343
  * @category constructors
3178
3344
  */
3179
- const make$q = make$r;
3345
+ const make$s = make$t;
3180
3346
  /**
3181
3347
  * Adds a service to a given `Context`.
3182
3348
  *
@@ -3395,7 +3561,7 @@ const emptyArray = [];
3395
3561
  * @category equivalence
3396
3562
  * @since 2.0.0
3397
3563
  */
3398
- const getEquivalence$1 = isEquivalent => make$u((self, that) => self.length === that.length && toReadonlyArray(self).every((value, i) => isEquivalent(value, unsafeGet(that, i))));
3564
+ const getEquivalence$1 = isEquivalent => make$w((self, that) => self.length === that.length && toReadonlyArray(self).every((value, i) => isEquivalent(value, unsafeGet(that, i))));
3399
3565
  const _equivalence$1 = /*#__PURE__*/getEquivalence$1(equals$1);
3400
3566
  const ChunkProto = {
3401
3567
  [TypeId$a]: {
@@ -3507,7 +3673,7 @@ const empty$j = () => _empty$5;
3507
3673
  * @category constructors
3508
3674
  * @since 2.0.0
3509
3675
  */
3510
- const make$p = (...as) => unsafeFromNonEmptyArray(as);
3676
+ const make$r = (...as) => unsafeFromNonEmptyArray(as);
3511
3677
  /**
3512
3678
  * Builds a `NonEmptyChunk` from a single element.
3513
3679
  *
@@ -4116,7 +4282,7 @@ const DurationProto = {
4116
4282
  return pipeArguments(this, arguments);
4117
4283
  }
4118
4284
  };
4119
- const make$o = input => {
4285
+ const make$q = input => {
4120
4286
  const duration = Object.create(DurationProto);
4121
4287
  if (isNumber(input)) {
4122
4288
  if (isNaN(input) || input <= 0) {
@@ -4173,52 +4339,52 @@ const isZero = self => {
4173
4339
  * @since 2.0.0
4174
4340
  * @category constructors
4175
4341
  */
4176
- const zero = /*#__PURE__*/make$o(0);
4342
+ const zero = /*#__PURE__*/make$q(0);
4177
4343
  /**
4178
4344
  * @since 2.0.0
4179
4345
  * @category constructors
4180
4346
  */
4181
- const infinity = /*#__PURE__*/make$o(Infinity);
4347
+ const infinity = /*#__PURE__*/make$q(Infinity);
4182
4348
  /**
4183
4349
  * @since 2.0.0
4184
4350
  * @category constructors
4185
4351
  */
4186
- const nanos = nanos => make$o(nanos);
4352
+ const nanos = nanos => make$q(nanos);
4187
4353
  /**
4188
4354
  * @since 2.0.0
4189
4355
  * @category constructors
4190
4356
  */
4191
- const micros = micros => make$o(micros * bigint1e3);
4357
+ const micros = micros => make$q(micros * bigint1e3);
4192
4358
  /**
4193
4359
  * @since 2.0.0
4194
4360
  * @category constructors
4195
4361
  */
4196
- const millis = millis => make$o(millis);
4362
+ const millis = millis => make$q(millis);
4197
4363
  /**
4198
4364
  * @since 2.0.0
4199
4365
  * @category constructors
4200
4366
  */
4201
- const seconds = seconds => make$o(seconds * 1000);
4367
+ const seconds = seconds => make$q(seconds * 1000);
4202
4368
  /**
4203
4369
  * @since 2.0.0
4204
4370
  * @category constructors
4205
4371
  */
4206
- const minutes = minutes => make$o(minutes * 60_000);
4372
+ const minutes = minutes => make$q(minutes * 60_000);
4207
4373
  /**
4208
4374
  * @since 2.0.0
4209
4375
  * @category constructors
4210
4376
  */
4211
- const hours = hours => make$o(hours * 3_600_000);
4377
+ const hours = hours => make$q(hours * 3_600_000);
4212
4378
  /**
4213
4379
  * @since 2.0.0
4214
4380
  * @category constructors
4215
4381
  */
4216
- const days = days => make$o(days * 86_400_000);
4382
+ const days = days => make$q(days * 86_400_000);
4217
4383
  /**
4218
4384
  * @since 2.0.0
4219
4385
  * @category constructors
4220
4386
  */
4221
- const weeks = weeks => make$o(weeks * 604_800_000);
4387
+ const weeks = weeks => make$q(weeks * 604_800_000);
4222
4388
  /**
4223
4389
  * @since 2.0.0
4224
4390
  * @category getters
@@ -4437,7 +4603,7 @@ function fromBitmap(bitmap, bit) {
4437
4603
  return popcount(bitmap & bit - 1);
4438
4604
  }
4439
4605
 
4440
- const make$n = (value, previous) => ({
4606
+ const make$p = (value, previous) => ({
4441
4607
  value,
4442
4608
  previous
4443
4609
  });
@@ -4723,7 +4889,7 @@ function mergeLeaves(edit, shift, h1, n1, h2, n2) {
4723
4889
  while (true) {
4724
4890
  const res = mergeLeavesInner(edit, currentShift, h1, n1, h2, n2);
4725
4891
  if (typeof res === "function") {
4726
- stack = make$n(res, stack);
4892
+ stack = make$p(res, stack);
4727
4893
  currentShift = currentShift + SIZE;
4728
4894
  } else {
4729
4895
  let final = res;
@@ -5047,7 +5213,7 @@ const fromIterable$3 = elements => {
5047
5213
  return endMutation(set);
5048
5214
  };
5049
5215
  /** @internal */
5050
- const make$m = (...elements) => {
5216
+ const make$o = (...elements) => {
5051
5217
  const set = beginMutation(empty$h());
5052
5218
  for (const value of elements) {
5053
5219
  add$1(set, value);
@@ -5555,7 +5721,7 @@ const fromIterable$2 = fromIterable$3;
5555
5721
  *
5556
5722
  * @see Other `HashSet` constructors are {@link module:HashSet.fromIterable} {@link module:HashSet.empty}
5557
5723
  */
5558
- const make$l = make$m;
5724
+ const make$n = make$o;
5559
5725
  /**
5560
5726
  * Checks if the specified value exists in the `HashSet`.
5561
5727
  *
@@ -5784,7 +5950,7 @@ const MutableRefProto = {
5784
5950
  * @since 2.0.0
5785
5951
  * @category constructors
5786
5952
  */
5787
- const make$k = value => {
5953
+ const make$m = value => {
5788
5954
  const ref = Object.create(MutableRefProto);
5789
5955
  ref.current = value;
5790
5956
  return ref;
@@ -5940,7 +6106,7 @@ const ids = self => {
5940
6106
  }
5941
6107
  case OP_RUNTIME:
5942
6108
  {
5943
- return make$l(self.id);
6109
+ return make$n(self.id);
5944
6110
  }
5945
6111
  case OP_COMPOSITE:
5946
6112
  {
@@ -5948,7 +6114,7 @@ const ids = self => {
5948
6114
  }
5949
6115
  }
5950
6116
  };
5951
- const _fiberCounter = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/Fiber/Id/_fiberCounter"), () => make$k(0));
6117
+ const _fiberCounter = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/Fiber/Id/_fiberCounter"), () => make$m(0));
5952
6118
  /** @internal */
5953
6119
  const threadName$1 = self => {
5954
6120
  const identifiers = Array.from(ids(self)).map(n => `#${n}`).join(",");
@@ -6739,7 +6905,7 @@ const DifferProto = {
6739
6905
  }
6740
6906
  };
6741
6907
  /** @internal */
6742
- const make$j = params => {
6908
+ const make$l = params => {
6743
6909
  const differ = Object.create(DifferProto);
6744
6910
  differ.empty = params.empty;
6745
6911
  differ.diff = params.diff;
@@ -6748,21 +6914,21 @@ const make$j = params => {
6748
6914
  return differ;
6749
6915
  };
6750
6916
  /** @internal */
6751
- const environment = () => make$j({
6917
+ const environment = () => make$l({
6752
6918
  empty: empty$d(),
6753
6919
  combine: (first, second) => combine$4(second)(first),
6754
6920
  diff: (oldValue, newValue) => diff$6(oldValue, newValue),
6755
6921
  patch: (patch, oldValue) => patch$7(oldValue)(patch)
6756
6922
  });
6757
6923
  /** @internal */
6758
- const hashSet = () => make$j({
6924
+ const hashSet = () => make$l({
6759
6925
  empty: empty$c(),
6760
6926
  combine: (first, second) => combine$3(second)(first),
6761
6927
  diff: (oldValue, newValue) => diff$5(oldValue, newValue),
6762
6928
  patch: (patch, oldValue) => patch$6(oldValue)(patch)
6763
6929
  });
6764
6930
  /** @internal */
6765
- const readonlyArray = differ => make$j({
6931
+ const readonlyArray = differ => make$l({
6766
6932
  empty: empty$b(),
6767
6933
  combine: (first, second) => combine$2(first, second),
6768
6934
  diff: (oldValue, newValue) => diff$4({
@@ -6775,7 +6941,7 @@ const readonlyArray = differ => make$j({
6775
6941
  /** @internal */
6776
6942
  const update$2 = () => updateWith((_, a) => a);
6777
6943
  /** @internal */
6778
- const updateWith = f => make$j({
6944
+ const updateWith = f => make$l({
6779
6945
  empty: identity,
6780
6946
  combine: (first, second) => {
6781
6947
  if (first === identity) {
@@ -6804,15 +6970,15 @@ const active = patch => patch & BIT_MASK;
6804
6970
  /** @internal */
6805
6971
  const enabled = patch => patch >> BIT_SHIFT & BIT_MASK;
6806
6972
  /** @internal */
6807
- const make$i = (active, enabled) => (active & BIT_MASK) + ((enabled & active & BIT_MASK) << BIT_SHIFT);
6973
+ const make$k = (active, enabled) => (active & BIT_MASK) + ((enabled & active & BIT_MASK) << BIT_SHIFT);
6808
6974
  /** @internal */
6809
- const empty$a = /*#__PURE__*/make$i(0, 0);
6975
+ const empty$a = /*#__PURE__*/make$k(0, 0);
6810
6976
  /** @internal */
6811
- const enable$2 = flag => make$i(flag, flag);
6977
+ const enable$2 = flag => make$k(flag, flag);
6812
6978
  /** @internal */
6813
- const disable$1 = flag => make$i(flag, 0);
6979
+ const disable$1 = flag => make$k(flag, 0);
6814
6980
  /** @internal */
6815
- const exclude$1 = /*#__PURE__*/dual(2, (self, flag) => make$i(active(self) & ~flag, enabled(self)));
6981
+ const exclude$1 = /*#__PURE__*/dual(2, (self, flag) => make$k(active(self) & ~flag, enabled(self)));
6816
6982
  /** @internal */
6817
6983
  const andThen = /*#__PURE__*/dual(2, (self, that) => self | that);
6818
6984
  /** @internal */
@@ -6841,18 +7007,18 @@ const interruption = self => isEnabled(self, Interruption);
6841
7007
  /** @internal */
6842
7008
  const isEnabled = /*#__PURE__*/dual(2, (self, flag) => (self & flag) !== 0);
6843
7009
  /** @internal */
6844
- const make$h = (...flags) => flags.reduce((a, b) => a | b, 0);
7010
+ const make$j = (...flags) => flags.reduce((a, b) => a | b, 0);
6845
7011
  /** @internal */
6846
- const none$1 = /*#__PURE__*/make$h(None$1);
7012
+ const none$1 = /*#__PURE__*/make$j(None$1);
6847
7013
  /** @internal */
6848
7014
  const runtimeMetrics = self => isEnabled(self, RuntimeMetrics);
6849
7015
  const windDown = self => isEnabled(self, WindDown);
6850
7016
  /** @internal */
6851
- const diff$3 = /*#__PURE__*/dual(2, (self, that) => make$i(self ^ that, that));
7017
+ const diff$3 = /*#__PURE__*/dual(2, (self, that) => make$k(self ^ that, that));
6852
7018
  /** @internal */
6853
7019
  const patch$4 = /*#__PURE__*/dual(2, (self, patch) => self & (invert(active(patch)) | enabled(patch)) | active(patch) & enabled(patch));
6854
7020
  /** @internal */
6855
- const differ$1 = /*#__PURE__*/make$j({
7021
+ const differ$1 = /*#__PURE__*/make$l({
6856
7022
  empty: empty$a,
6857
7023
  diff: (oldValue, newValue) => diff$3(oldValue, newValue),
6858
7024
  combine: (first, second) => andThen(second)(first),
@@ -7419,7 +7585,7 @@ const evaluateCause = self => {
7419
7585
  }
7420
7586
  case OP_FAIL$1:
7421
7587
  {
7422
- _parallel = add(_parallel, make$p(cause._tag, cause.error));
7588
+ _parallel = add(_parallel, make$r(cause._tag, cause.error));
7423
7589
  if (stack.length === 0) {
7424
7590
  return [_parallel, _sequential];
7425
7591
  }
@@ -7428,7 +7594,7 @@ const evaluateCause = self => {
7428
7594
  }
7429
7595
  case OP_DIE:
7430
7596
  {
7431
- _parallel = add(_parallel, make$p(cause._tag, cause.defect));
7597
+ _parallel = add(_parallel, make$r(cause._tag, cause.defect));
7432
7598
  if (stack.length === 0) {
7433
7599
  return [_parallel, _sequential];
7434
7600
  }
@@ -7437,7 +7603,7 @@ const evaluateCause = self => {
7437
7603
  }
7438
7604
  case OP_INTERRUPT:
7439
7605
  {
7440
- _parallel = add(_parallel, make$p(cause._tag, cause.fiberId));
7606
+ _parallel = add(_parallel, make$r(cause._tag, cause.fiberId));
7441
7607
  if (stack.length === 0) {
7442
7608
  return [_parallel, _sequential];
7443
7609
  }
@@ -7655,34 +7821,33 @@ const renderErrorCause = (cause, prefix) => {
7655
7821
  return stack;
7656
7822
  };
7657
7823
  /** @internal */
7658
- class PrettyError extends globalThis.Error {
7659
- span = undefined;
7660
- constructor(originalError) {
7661
- const originalErrorIsObject = typeof originalError === "object" && originalError !== null;
7662
- const prevLimit = Error.stackTraceLimit;
7663
- Error.stackTraceLimit = 1;
7664
- super(prettyErrorMessage(originalError), originalErrorIsObject && "cause" in originalError && typeof originalError.cause !== "undefined" ? {
7665
- cause: new PrettyError(originalError.cause)
7666
- } : undefined);
7667
- if (this.message === "") {
7668
- this.message = "An error has occurred";
7824
+ const makePrettyError = originalError => {
7825
+ const originalErrorIsObject = typeof originalError === "object" && originalError !== null;
7826
+ const prevLimit = Error.stackTraceLimit;
7827
+ Error.stackTraceLimit = 1;
7828
+ const error = new Error(prettyErrorMessage(originalError), originalErrorIsObject && "cause" in originalError && typeof originalError.cause !== "undefined" ? {
7829
+ cause: makePrettyError(originalError.cause)
7830
+ } : undefined);
7831
+ Error.stackTraceLimit = prevLimit;
7832
+ if (error.message === "") {
7833
+ error.message = "An error has occurred";
7834
+ }
7835
+ Error.stackTraceLimit = prevLimit;
7836
+ error.name = originalError instanceof Error ? originalError.name : "Error";
7837
+ if (originalErrorIsObject) {
7838
+ if (spanSymbol in originalError) {
7839
+ error.span = originalError[spanSymbol];
7669
7840
  }
7670
- Error.stackTraceLimit = prevLimit;
7671
- this.name = originalError instanceof Error ? originalError.name : "Error";
7672
- if (originalErrorIsObject) {
7673
- if (spanSymbol in originalError) {
7674
- this.span = originalError[spanSymbol];
7841
+ Object.keys(originalError).forEach(key => {
7842
+ if (!(key in error)) {
7843
+ // @ts-expect-error
7844
+ error[key] = originalError[key];
7675
7845
  }
7676
- Object.keys(originalError).forEach(key => {
7677
- if (!(key in this)) {
7678
- // @ts-expect-error
7679
- this[key] = originalError[key];
7680
- }
7681
- });
7682
- }
7683
- this.stack = prettyErrorStack(`${this.name}: ${this.message}`, originalError instanceof Error && originalError.stack ? originalError.stack : "", this.span);
7846
+ });
7684
7847
  }
7685
- }
7848
+ error.stack = prettyErrorStack(`${error.name}: ${error.message}`, originalError instanceof Error && originalError.stack ? originalError.stack : "", error.span);
7849
+ return error;
7850
+ };
7686
7851
  /**
7687
7852
  * A utility function for generating human-readable error messages from a generic error of type `unknown`.
7688
7853
  *
@@ -7770,10 +7935,10 @@ const spanSymbol = /*#__PURE__*/Symbol.for("effect/SpanAnnotation");
7770
7935
  const prettyErrors = cause => reduceWithContext(cause, void 0, {
7771
7936
  emptyCase: () => [],
7772
7937
  dieCase: (_, unknownError) => {
7773
- return [new PrettyError(unknownError)];
7938
+ return [makePrettyError(unknownError)];
7774
7939
  },
7775
7940
  failCase: (_, error) => {
7776
- return [new PrettyError(error)];
7941
+ return [makePrettyError(error)];
7777
7942
  },
7778
7943
  interruptCase: () => [],
7779
7944
  parallelCase: (_, l, r) => [...l, ...r],
@@ -7797,7 +7962,7 @@ const deferredVariance = {
7797
7962
  _A: _ => _
7798
7963
  };
7799
7964
  /** @internal */
7800
- const pending = joiners => {
7965
+ const pending$1 = joiners => {
7801
7966
  return {
7802
7967
  _tag: OP_STATE_PENDING,
7803
7968
  joiners
@@ -8848,7 +9013,7 @@ const deferredUnsafeMake = fiberId => {
8848
9013
  const _deferred = {
8849
9014
  ...CommitPrototype,
8850
9015
  [DeferredTypeId]: deferredVariance,
8851
- state: make$k(pending([])),
9016
+ state: make$m(pending$1([])),
8852
9017
  commit() {
8853
9018
  return deferredAwait(this);
8854
9019
  },
@@ -8955,7 +9120,7 @@ const currentSpanFromFiber = fiber => {
8955
9120
  * @since 2.0.0
8956
9121
  * @category constructors
8957
9122
  */
8958
- const make$g = deferredMake;
9123
+ const make$i = deferredMake;
8959
9124
  const _await$1 = deferredAwait;
8960
9125
  /**
8961
9126
  * Exits the `Deferred` with the specified `Exit` value, which will be
@@ -9427,7 +9592,7 @@ const MutableQueueProto = {
9427
9592
  return pipeArguments(this, arguments);
9428
9593
  }
9429
9594
  };
9430
- const make$f = capacity => {
9595
+ const make$h = capacity => {
9431
9596
  const queue = Object.create(MutableQueueProto);
9432
9597
  queue.queue = empty$7();
9433
9598
  queue.capacity = capacity;
@@ -9439,14 +9604,14 @@ const make$f = capacity => {
9439
9604
  * @since 2.0.0
9440
9605
  * @category constructors
9441
9606
  */
9442
- const bounded = capacity => make$f(capacity);
9607
+ const bounded = capacity => make$h(capacity);
9443
9608
  /**
9444
9609
  * Creates a new unbounded `MutableQueue`.
9445
9610
  *
9446
9611
  * @since 2.0.0
9447
9612
  * @category constructors
9448
9613
  */
9449
- const unbounded = () => make$f(undefined);
9614
+ const unbounded = () => make$h(undefined);
9450
9615
  /**
9451
9616
  * Returns the current number of elements in the queue.
9452
9617
  *
@@ -9615,7 +9780,7 @@ class ClockImpl {
9615
9780
  }
9616
9781
  }
9617
9782
  /** @internal */
9618
- const make$e = () => new ClockImpl();
9783
+ const make$g = () => new ClockImpl();
9619
9784
 
9620
9785
  /** @internal */
9621
9786
  const OP_AND = "And";
@@ -9862,7 +10027,7 @@ const FlatConfigProviderSymbolKey = "effect/ConfigProviderFlat";
9862
10027
  /** @internal */
9863
10028
  const FlatConfigProviderTypeId = /*#__PURE__*/Symbol.for(FlatConfigProviderSymbolKey);
9864
10029
  /** @internal */
9865
- const make$d = options => ({
10030
+ const make$f = options => ({
9866
10031
  [ConfigProviderTypeId]: ConfigProviderTypeId,
9867
10032
  pipe() {
9868
10033
  return pipeArguments(this, arguments);
@@ -9877,7 +10042,7 @@ const makeFlat = options => ({
9877
10042
  enumerateChildren: options.enumerateChildren
9878
10043
  });
9879
10044
  /** @internal */
9880
- const fromFlat = flat => make$d({
10045
+ const fromFlat = flat => make$f({
9881
10046
  load: config => flatMap$2(fromFlatLoop(flat, empty$m(), config, false), chunk => match$6(head$1(chunk), {
9882
10047
  onNone: () => fail$3(MissingData(empty$m(), `Expected a single value having structure: ${config}`)),
9883
10048
  onSome: succeed$4
@@ -10212,7 +10377,7 @@ const swap = (buffer, index1, index2) => {
10212
10377
  buffer[index2] = tmp;
10213
10378
  return buffer;
10214
10379
  };
10215
- const make$c = seed => new RandomImpl(hash(seed));
10380
+ const make$e = seed => new RandomImpl(hash(seed));
10216
10381
 
10217
10382
  /**
10218
10383
  * @since 2.0.0
@@ -10220,7 +10385,7 @@ const make$c = seed => new RandomImpl(hash(seed));
10220
10385
  /** @internal */
10221
10386
  const TracerTypeId = /*#__PURE__*/Symbol.for("effect/Tracer");
10222
10387
  /** @internal */
10223
- const make$b = options => ({
10388
+ const make$d = options => ({
10224
10389
  [TracerTypeId]: TracerTypeId,
10225
10390
  ...options
10226
10391
  });
@@ -10289,13 +10454,17 @@ class NativeSpan {
10289
10454
  }
10290
10455
  }
10291
10456
  /** @internal */
10292
- const nativeTracer = /*#__PURE__*/make$b({
10457
+ const nativeTracer = /*#__PURE__*/make$d({
10293
10458
  span: (name, parent, context, links, startTime, kind) => new NativeSpan(name, parent, context, links, startTime, kind),
10294
10459
  context: f => f()
10295
10460
  });
10461
+ /** @internal */
10462
+ const DisablePropagation = /*#__PURE__*/Reference()("effect/Tracer/DisablePropagation", {
10463
+ defaultValue: constFalse
10464
+ });
10296
10465
 
10297
10466
  /** @internal */
10298
- 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));
10467
+ 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));
10299
10468
  /**
10300
10469
  * The `FiberRef` holding the default `Effect` services.
10301
10470
  *
@@ -10547,7 +10716,7 @@ const Fatal = logLevelFatal;
10547
10716
  * @since 2.0.0
10548
10717
  * @category constructors
10549
10718
  */
10550
- const Error$1 = logLevelError;
10719
+ const Error$2 = logLevelError;
10551
10720
  /**
10552
10721
  * @since 2.0.0
10553
10722
  * @category constructors
@@ -10594,7 +10763,7 @@ const fromLiteral = literal => {
10594
10763
  case "Debug":
10595
10764
  return Debug;
10596
10765
  case "Error":
10597
- return Error$1;
10766
+ return Error$2;
10598
10767
  case "Fatal":
10599
10768
  return Fatal;
10600
10769
  case "Info":
@@ -10671,9 +10840,9 @@ class RefImpl extends Class {
10671
10840
  }
10672
10841
  }
10673
10842
  /** @internal */
10674
- const unsafeMake$2 = value => new RefImpl(make$k(value));
10843
+ const unsafeMake$2 = value => new RefImpl(make$m(value));
10675
10844
  /** @internal */
10676
- const make$a = value => sync$1(() => unsafeMake$2(value));
10845
+ const make$c = value => sync$1(() => unsafeMake$2(value));
10677
10846
  /** @internal */
10678
10847
  const get = self => self.get;
10679
10848
  /** @internal */
@@ -10812,7 +10981,7 @@ class MetricLabelImpl {
10812
10981
  }
10813
10982
  }
10814
10983
  /** @internal */
10815
- const make$9 = (key, value) => {
10984
+ const make$b = (key, value) => {
10816
10985
  return new MetricLabelImpl(key, value);
10817
10986
  };
10818
10987
  /** @internal */
@@ -10885,7 +11054,7 @@ const logWithLevel = level => (...message) => {
10885
11054
  /** @internal */
10886
11055
  const logWarning$1 = /*#__PURE__*/logWithLevel(Warning);
10887
11056
  /** @internal */
10888
- const logError$1 = /*#__PURE__*/logWithLevel(Error$1);
11057
+ const logError$1 = /*#__PURE__*/logWithLevel(Error$2);
10889
11058
  /* @internal */
10890
11059
  const mapErrorCause = /*#__PURE__*/dual(2, (self, f) => matchCauseEffect$2(self, {
10891
11060
  onFailure: c => failCauseSync(() => f(c)),
@@ -10930,6 +11099,7 @@ const updateFiberRefs = f => withFiberRuntime$1(state => {
10930
11099
  });
10931
11100
  /* @internal */
10932
11101
  const when$1 = /*#__PURE__*/dual(2, (self, condition) => suspend$2(() => condition() ? map$3(self, some) : succeed$4(none$4())));
11102
+ const filterDisablePropagation = /*#__PURE__*/flatMap$5(span => get$7(span.context, DisablePropagation) ? span._tag === "Span" ? filterDisablePropagation(span.parent) : none$4() : some(span));
10933
11103
 
10934
11104
  /** @internal */
10935
11105
  const OP_SEQUENTIAL = "Sequential";
@@ -11883,6 +12053,61 @@ const runFork$1 = (effect, options) => {
11883
12053
  /**
11884
12054
  * @since 2.0.0
11885
12055
  */
12056
+ /**
12057
+ * @since 3.20.0
12058
+ * @category models
12059
+ */
12060
+ class SchedulerRunner {
12061
+ scheduleDrain;
12062
+ running = false;
12063
+ tasks = /*#__PURE__*/new PriorityBuckets();
12064
+ constructor(scheduleDrain) {
12065
+ this.scheduleDrain = scheduleDrain;
12066
+ }
12067
+ starveInternal = depth => {
12068
+ const tasks = this.tasks.buckets;
12069
+ this.tasks.buckets = [];
12070
+ for (const [_, toRun] of tasks) {
12071
+ for (let i = 0; i < toRun.length; i++) {
12072
+ toRun[i]();
12073
+ }
12074
+ }
12075
+ if (this.tasks.buckets.length === 0) {
12076
+ this.running = false;
12077
+ } else {
12078
+ this.starve(depth);
12079
+ }
12080
+ };
12081
+ starve(depth = 0) {
12082
+ this.scheduleDrain(depth, this.starveInternal);
12083
+ }
12084
+ scheduleTask(task, priority) {
12085
+ this.tasks.scheduleTask(task, priority);
12086
+ if (!this.running) {
12087
+ this.running = true;
12088
+ this.starve();
12089
+ }
12090
+ }
12091
+ /**
12092
+ * @since 3.20.0
12093
+ * @category constructors
12094
+ */
12095
+ static cached(scheduleDrain) {
12096
+ const fallback = new SchedulerRunner(scheduleDrain);
12097
+ const runners = new WeakMap();
12098
+ return fiber => {
12099
+ if (fiber === undefined) {
12100
+ return fallback;
12101
+ }
12102
+ let runner = runners.get(fiber);
12103
+ if (runner === undefined) {
12104
+ runner = new SchedulerRunner(scheduleDrain);
12105
+ runners.set(fiber, runner);
12106
+ }
12107
+ return runner;
12108
+ };
12109
+ }
12110
+ }
11886
12111
  /**
11887
12112
  * @since 2.0.0
11888
12113
  * @category utils
@@ -11921,14 +12146,13 @@ class PriorityBuckets {
11921
12146
  */
11922
12147
  class MixedScheduler {
11923
12148
  maxNextTickBeforeTimer;
11924
- /**
11925
- * @since 2.0.0
11926
- */
11927
- running = false;
11928
- /**
11929
- * @since 2.0.0
11930
- */
11931
- tasks = /*#__PURE__*/new PriorityBuckets();
12149
+ getRunner = /*#__PURE__*/SchedulerRunner.cached((depth, drain) => {
12150
+ if (depth >= this.maxNextTickBeforeTimer) {
12151
+ setTimeout(() => drain(0), 0);
12152
+ } else {
12153
+ Promise.resolve(void 0).then(() => drain(depth + 1));
12154
+ }
12155
+ });
11932
12156
  constructor(
11933
12157
  /**
11934
12158
  * @since 2.0.0
@@ -11936,33 +12160,6 @@ class MixedScheduler {
11936
12160
  maxNextTickBeforeTimer) {
11937
12161
  this.maxNextTickBeforeTimer = maxNextTickBeforeTimer;
11938
12162
  }
11939
- /**
11940
- * @since 2.0.0
11941
- */
11942
- starveInternal(depth) {
11943
- const tasks = this.tasks.buckets;
11944
- this.tasks.buckets = [];
11945
- for (const [_, toRun] of tasks) {
11946
- for (let i = 0; i < toRun.length; i++) {
11947
- toRun[i]();
11948
- }
11949
- }
11950
- if (this.tasks.buckets.length === 0) {
11951
- this.running = false;
11952
- } else {
11953
- this.starve(depth);
11954
- }
11955
- }
11956
- /**
11957
- * @since 2.0.0
11958
- */
11959
- starve(depth = 0) {
11960
- if (depth >= this.maxNextTickBeforeTimer) {
11961
- setTimeout(() => this.starveInternal(0), 0);
11962
- } else {
11963
- Promise.resolve(void 0).then(() => this.starveInternal(depth + 1));
11964
- }
11965
- }
11966
12163
  /**
11967
12164
  * @since 2.0.0
11968
12165
  */
@@ -11972,12 +12169,8 @@ class MixedScheduler {
11972
12169
  /**
11973
12170
  * @since 2.0.0
11974
12171
  */
11975
- scheduleTask(task, priority) {
11976
- this.tasks.scheduleTask(task, priority);
11977
- if (!this.running) {
11978
- this.running = true;
11979
- this.starve();
11980
- }
12172
+ scheduleTask(task, priority, fiber) {
12173
+ this.getRunner(fiber).scheduleTask(task, priority);
11981
12174
  }
11982
12175
  }
11983
12176
  /**
@@ -12517,7 +12710,7 @@ const metricHookVariance = {
12517
12710
  _Out: _ => _
12518
12711
  };
12519
12712
  /** @internal */
12520
- const make$8 = options => ({
12713
+ const make$a = options => ({
12521
12714
  [MetricHookTypeId]: metricHookVariance,
12522
12715
  pipe() {
12523
12716
  return pipeArguments(this, arguments);
@@ -12534,7 +12727,7 @@ const counter$1 = key => {
12534
12727
  sum = sum + value;
12535
12728
  }
12536
12729
  };
12537
- return make$8({
12730
+ return make$a({
12538
12731
  get: () => counter$2(sum),
12539
12732
  update,
12540
12733
  modify: update
@@ -12550,7 +12743,7 @@ const frequency = key => {
12550
12743
  const slotCount = values.get(word) ?? 0;
12551
12744
  values.set(word, slotCount + 1);
12552
12745
  };
12553
- return make$8({
12746
+ return make$a({
12554
12747
  get: () => frequency$1(values),
12555
12748
  update,
12556
12749
  modify: update
@@ -12559,7 +12752,7 @@ const frequency = key => {
12559
12752
  /** @internal */
12560
12753
  const gauge = (_key, startAt) => {
12561
12754
  let value = startAt;
12562
- return make$8({
12755
+ return make$a({
12563
12756
  get: () => gauge$1(value),
12564
12757
  update: v => {
12565
12758
  value = v;
@@ -12629,7 +12822,7 @@ const histogram$1 = key => {
12629
12822
  }
12630
12823
  return builder;
12631
12824
  };
12632
- return make$8({
12825
+ return make$a({
12633
12826
  get: () => histogram$2({
12634
12827
  buckets: getBuckets(),
12635
12828
  count,
@@ -12696,7 +12889,7 @@ const summary = key => {
12696
12889
  count = count + 1;
12697
12890
  sum = sum + value;
12698
12891
  };
12699
- return make$8({
12892
+ return make$a({
12700
12893
  get: () => summary$1({
12701
12894
  error,
12702
12895
  quantiles: snapshot(Date.now()),
@@ -12963,7 +13156,7 @@ class MetricRegistryImpl {
12963
13156
  }
12964
13157
  }
12965
13158
  /** @internal */
12966
- const make$7 = () => {
13159
+ const make$9 = () => {
12967
13160
  return new MetricRegistryImpl();
12968
13161
  };
12969
13162
 
@@ -12980,9 +13173,9 @@ const metricVariance = {
12980
13173
  _Out: _ => _
12981
13174
  };
12982
13175
  /** @internal */
12983
- const globalMetricRegistry = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/Metric/globalMetricRegistry"), () => make$7());
13176
+ const globalMetricRegistry = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/Metric/globalMetricRegistry"), () => make$9());
12984
13177
  /** @internal */
12985
- const make$6 = function (keyType, unsafeUpdate, unsafeValue, unsafeModify) {
13178
+ const make$8 = function (keyType, unsafeUpdate, unsafeValue, unsafeModify) {
12986
13179
  const metric = Object.assign(effect => tap$1(effect, a => update(metric, a)), {
12987
13180
  [MetricTypeId]: metricVariance,
12988
13181
  keyType,
@@ -13021,21 +13214,21 @@ const fromMetricKey = key => {
13021
13214
  hookCache.set(extraTags, hook);
13022
13215
  return hook;
13023
13216
  };
13024
- return make$6(key.keyType, (input, extraTags) => hook(extraTags).update(input), extraTags => hook(extraTags).get(), (input, extraTags) => hook(extraTags).modify(input));
13217
+ return make$8(key.keyType, (input, extraTags) => hook(extraTags).update(input), extraTags => hook(extraTags).get(), (input, extraTags) => hook(extraTags).modify(input));
13025
13218
  };
13026
13219
  /** @internal */
13027
13220
  const histogram = (name, boundaries, description) => fromMetricKey(histogram$3(name, boundaries, description));
13028
13221
  /** @internal */
13029
- const tagged = /*#__PURE__*/dual(3, (self, key, value) => taggedWithLabels(self, [make$9(key, value)]));
13222
+ const tagged = /*#__PURE__*/dual(3, (self, key, value) => taggedWithLabels(self, [make$b(key, value)]));
13030
13223
  /** @internal */
13031
13224
  const taggedWithLabels = /*#__PURE__*/dual(2, (self, extraTags) => {
13032
- 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)));
13225
+ 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)));
13033
13226
  });
13034
13227
  /* @internal */
13035
13228
  const update = /*#__PURE__*/dual(2, (self, input) => fiberRefGetWith(currentMetricLabels, tags => sync$1(() => self.unsafeUpdate(input, tags))));
13036
13229
 
13037
13230
  /** @internal */
13038
- const complete = /*#__PURE__*/dual(2, (self, result) => fiberRefGetWith(currentRequestMap, map => sync$1(() => {
13231
+ const complete$1 = /*#__PURE__*/dual(2, (self, result) => fiberRefGetWith(currentRequestMap, map => sync$1(() => {
13039
13232
  if (map.has(self)) {
13040
13233
  const entry = map.get(self);
13041
13234
  if (!entry.state.completed) {
@@ -13178,7 +13371,7 @@ const none = /*#__PURE__*/globalValue("effect/Supervisor/none", () => fromEffect
13178
13371
  * @since 2.0.0
13179
13372
  * @category constructors
13180
13373
  */
13181
- const make$5 = make$j;
13374
+ const make$7 = make$l;
13182
13375
 
13183
13376
  /** @internal */
13184
13377
  const OP_EMPTY = "Empty";
@@ -13270,7 +13463,7 @@ const toSet = self => {
13270
13463
  if (isZip(self)) {
13271
13464
  return pipe(toSet(self.left), union(toSet(self.right)));
13272
13465
  } else {
13273
- return make$l(self);
13466
+ return make$n(self);
13274
13467
  }
13275
13468
  }
13276
13469
  };
@@ -13292,7 +13485,7 @@ const diff = (oldValue, newValue) => {
13292
13485
  return combine(added, removed);
13293
13486
  };
13294
13487
  /** @internal */
13295
- const differ = /*#__PURE__*/make$5({
13488
+ const differ = /*#__PURE__*/make$7({
13296
13489
  empty: empty$2,
13297
13490
  patch,
13298
13491
  combine,
@@ -13553,6 +13746,10 @@ class FiberRuntime extends Class {
13553
13746
  get await() {
13554
13747
  return async_(resume => {
13555
13748
  const cb = exit => resume(succeed$4(exit));
13749
+ if (this._exitValue !== null) {
13750
+ cb(this._exitValue);
13751
+ return;
13752
+ }
13556
13753
  this.tell(stateful((fiber, _) => {
13557
13754
  if (fiber._exitValue !== null) {
13558
13755
  cb(this._exitValue);
@@ -13772,7 +13969,7 @@ class FiberRuntime extends Class {
13772
13969
  * **NOTE**: This method must be invoked by the fiber itself.
13773
13970
  */
13774
13971
  drainQueueLaterOnExecutor() {
13775
- this.currentScheduler.scheduleTask(this.run, this.getFiberRef(currentSchedulingPriority));
13972
+ this.currentScheduler.scheduleTask(this.run, this.getFiberRef(currentSchedulingPriority), this);
13776
13973
  }
13777
13974
  /**
13778
13975
  * Drains the fiber's message queue while the fiber is actively running,
@@ -14436,7 +14633,7 @@ const tracerLogger = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/Lo
14436
14633
  logLevel,
14437
14634
  message
14438
14635
  }) => {
14439
- const span = getOption(getOrDefault$1(context, currentContext), spanTag);
14636
+ const span = filterDisablePropagation(getOption(getOrDefault$1(context, currentContext), spanTag));
14440
14637
  if (span._tag === "None" || span.value._tag === "ExternalSpan") {
14441
14638
  return;
14442
14639
  }
@@ -14455,7 +14652,7 @@ const tracerLogger = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/Lo
14455
14652
  span.value.event(toStringUnknown(Array.isArray(message) && message.length === 1 ? message[0] : message), clockService.unsafeCurrentTimeNanos(), attributes);
14456
14653
  }));
14457
14654
  /** @internal */
14458
- const currentLoggers = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentLoggers"), () => fiberRefUnsafeMakeHashSet(make$l(defaultLogger, tracerLogger)));
14655
+ const currentLoggers = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentLoggers"), () => fiberRefUnsafeMakeHashSet(make$n(defaultLogger, tracerLogger)));
14459
14656
  // === all
14460
14657
  const allResolveInput = input => {
14461
14658
  if (Array.isArray(input) || isIterable(input)) {
@@ -14563,7 +14760,7 @@ const forEachConcurrentDiscard = (self, f, batching, processAll, n) => uninterru
14563
14760
  const interruptAll = () => fibers.forEach(fiber => {
14564
14761
  fiber.currentScheduler.scheduleTask(() => {
14565
14762
  fiber.unsafeInterruptAsFork(parent.id());
14566
- }, 0);
14763
+ }, 0, fiber);
14567
14764
  });
14568
14765
  const startOrder = new Array();
14569
14766
  const joinOrder = new Array();
@@ -14587,7 +14784,7 @@ const forEachConcurrentDiscard = (self, f, batching, processAll, n) => uninterru
14587
14784
  fiber.unsafeInterruptAsFork(parent.id());
14588
14785
  }
14589
14786
  fiber.resume(runnable);
14590
- }, 0);
14787
+ }, 0, fiber);
14591
14788
  return fiber;
14592
14789
  };
14593
14790
  const onInterruptSignal = () => {
@@ -14638,7 +14835,7 @@ const forEachConcurrentDiscard = (self, f, batching, processAll, n) => uninterru
14638
14835
  if (interrupted) {
14639
14836
  fiber.currentScheduler.scheduleTask(() => {
14640
14837
  fiber.unsafeInterruptAsFork(parent.id());
14641
- }, 0);
14838
+ }, 0, fiber);
14642
14839
  }
14643
14840
  fiber.addObserver(wrapped => {
14644
14841
  let exit;
@@ -14897,7 +15094,7 @@ const scopeMake = (strategy = sequential$1) => sync$1(() => scopeUnsafeMake(stra
14897
15094
  /* @internal */
14898
15095
  const scopeExtend = /*#__PURE__*/dual(2, (effect, scope) => mapInputContext(effect,
14899
15096
  // @ts-expect-error
14900
- merge$1(make$q(scopeTag, scope))));
15097
+ merge$1(make$s(scopeTag, scope))));
14901
15098
  // circular with Supervisor
14902
15099
  /** @internal */
14903
15100
  const fiberRefUnsafeMakeSupervisor = initial => fiberRefUnsafeMakePatch(initial, {
@@ -14952,7 +15149,7 @@ const race$1 = /*#__PURE__*/dual(2, (self, that) => fiberIdWith$1(parentFiberId
14952
15149
  /** @internal */
14953
15150
  const raceFibersWith = /*#__PURE__*/dual(3, (self, other, options) => withFiberRuntime$1((parentFiber, parentStatus) => {
14954
15151
  const parentRuntimeFlags = parentStatus.runtimeFlags;
14955
- const raceIndicator = make$k(true);
15152
+ const raceIndicator = make$m(true);
14956
15153
  const leftFiber = unsafeMakeChildFiber(self, parentFiber, parentRuntimeFlags, options.selfScope);
14957
15154
  const rightFiber = unsafeMakeChildFiber(other, parentFiber, parentRuntimeFlags, options.otherScope);
14958
15155
  return async_(cb => {
@@ -15018,9 +15215,478 @@ const invokeWithInterrupt = (self, entries, onInterrupt) => fiberIdWith$1(id =>
15018
15215
  }
15019
15216
  return [];
15020
15217
  });
15021
- return forEachSequentialDiscard(residual, entry => complete(entry.request, exitInterrupt$1(id)));
15218
+ return forEachSequentialDiscard(residual, entry => complete$1(entry.request, exitInterrupt$1(id)));
15022
15219
  })));
15023
15220
 
15221
+ /** @internal */
15222
+ const complete = (key, exit, entryStats, timeToLiveMillis) => struct({
15223
+ _tag: "Complete",
15224
+ key,
15225
+ exit,
15226
+ entryStats,
15227
+ timeToLiveMillis
15228
+ });
15229
+ /** @internal */
15230
+ const pending = (key, deferred) => struct({
15231
+ _tag: "Pending",
15232
+ key,
15233
+ deferred
15234
+ });
15235
+ /** @internal */
15236
+ const refreshing = (deferred, complete) => struct({
15237
+ _tag: "Refreshing",
15238
+ deferred,
15239
+ complete
15240
+ });
15241
+ /** @internal */
15242
+ const MapKeyTypeId = /*#__PURE__*/Symbol.for("effect/Cache/MapKey");
15243
+ class MapKeyImpl {
15244
+ current;
15245
+ [MapKeyTypeId] = MapKeyTypeId;
15246
+ previous = undefined;
15247
+ next = undefined;
15248
+ constructor(current) {
15249
+ this.current = current;
15250
+ }
15251
+ [symbol$1]() {
15252
+ return pipe(hash(this.current), combine$7(hash(this.previous)), combine$7(hash(this.next)), cached(this));
15253
+ }
15254
+ [symbol](that) {
15255
+ if (this === that) {
15256
+ return true;
15257
+ }
15258
+ return isMapKey(that) && equals$1(this.current, that.current) && equals$1(this.previous, that.previous) && equals$1(this.next, that.next);
15259
+ }
15260
+ }
15261
+ /** @internal */
15262
+ const makeMapKey = current => new MapKeyImpl(current);
15263
+ /** @internal */
15264
+ const isMapKey = u => hasProperty(u, MapKeyTypeId);
15265
+ class KeySetImpl {
15266
+ head = undefined;
15267
+ tail = undefined;
15268
+ add(key) {
15269
+ if (key !== this.tail) {
15270
+ if (this.tail === undefined) {
15271
+ this.head = key;
15272
+ this.tail = key;
15273
+ } else {
15274
+ const previous = key.previous;
15275
+ const next = key.next;
15276
+ if (next !== undefined) {
15277
+ key.next = undefined;
15278
+ if (previous !== undefined) {
15279
+ previous.next = next;
15280
+ next.previous = previous;
15281
+ } else {
15282
+ this.head = next;
15283
+ this.head.previous = undefined;
15284
+ }
15285
+ }
15286
+ this.tail.next = key;
15287
+ key.previous = this.tail;
15288
+ this.tail = key;
15289
+ }
15290
+ }
15291
+ }
15292
+ remove() {
15293
+ const key = this.head;
15294
+ if (key !== undefined) {
15295
+ const next = key.next;
15296
+ if (next !== undefined) {
15297
+ key.next = undefined;
15298
+ this.head = next;
15299
+ this.head.previous = undefined;
15300
+ } else {
15301
+ this.head = undefined;
15302
+ this.tail = undefined;
15303
+ }
15304
+ }
15305
+ return key;
15306
+ }
15307
+ }
15308
+ /** @internal */
15309
+ const makeKeySet = () => new KeySetImpl();
15310
+ /**
15311
+ * Constructs a new `CacheState` from the specified values.
15312
+ *
15313
+ * @internal
15314
+ */
15315
+ const makeCacheState = (map, keys, accesses, updating, hits, misses) => ({
15316
+ map,
15317
+ keys,
15318
+ accesses,
15319
+ updating,
15320
+ hits,
15321
+ misses
15322
+ });
15323
+ /**
15324
+ * Constructs an initial cache state.
15325
+ *
15326
+ * @internal
15327
+ */
15328
+ const initialCacheState = () => makeCacheState(empty$8(), makeKeySet(), unbounded(), make$m(false), 0, 0);
15329
+ /** @internal */
15330
+ const CacheSymbolKey = "effect/Cache";
15331
+ /** @internal */
15332
+ const CacheTypeId = /*#__PURE__*/Symbol.for(CacheSymbolKey);
15333
+ const cacheVariance = {
15334
+ /* c8 ignore next */
15335
+ _Key: _ => _,
15336
+ /* c8 ignore next */
15337
+ _Error: _ => _,
15338
+ /* c8 ignore next */
15339
+ _Value: _ => _
15340
+ };
15341
+ /** @internal */
15342
+ const ConsumerCacheSymbolKey = "effect/ConsumerCache";
15343
+ /** @internal */
15344
+ const ConsumerCacheTypeId = /*#__PURE__*/Symbol.for(ConsumerCacheSymbolKey);
15345
+ const consumerCacheVariance = {
15346
+ /* c8 ignore next */
15347
+ _Key: _ => _,
15348
+ /* c8 ignore next */
15349
+ _Error: _ => _,
15350
+ /* c8 ignore next */
15351
+ _Value: _ => _
15352
+ };
15353
+ /** @internal */
15354
+ const makeCacheStats = options => options;
15355
+ /** @internal */
15356
+ const makeEntryStats = loadedMillis => ({
15357
+ loadedMillis
15358
+ });
15359
+ class CacheImpl {
15360
+ capacity;
15361
+ context;
15362
+ fiberId;
15363
+ lookup;
15364
+ timeToLive;
15365
+ [CacheTypeId] = cacheVariance;
15366
+ [ConsumerCacheTypeId] = consumerCacheVariance;
15367
+ cacheState;
15368
+ constructor(capacity, context, fiberId, lookup, timeToLive) {
15369
+ this.capacity = capacity;
15370
+ this.context = context;
15371
+ this.fiberId = fiberId;
15372
+ this.lookup = lookup;
15373
+ this.timeToLive = timeToLive;
15374
+ this.cacheState = initialCacheState();
15375
+ }
15376
+ get(key) {
15377
+ return map$3(this.getEither(key), merge$3);
15378
+ }
15379
+ get cacheStats() {
15380
+ return sync$1(() => makeCacheStats({
15381
+ hits: this.cacheState.hits,
15382
+ misses: this.cacheState.misses,
15383
+ size: size(this.cacheState.map)
15384
+ }));
15385
+ }
15386
+ getOption(key) {
15387
+ return suspend$2(() => match$6(get$2(this.cacheState.map, key), {
15388
+ onNone: () => {
15389
+ const mapKey = makeMapKey(key);
15390
+ this.trackAccess(mapKey);
15391
+ this.trackMiss();
15392
+ return succeed$4(none$4());
15393
+ },
15394
+ onSome: value => this.resolveMapValue(value)
15395
+ }));
15396
+ }
15397
+ getOptionComplete(key) {
15398
+ return suspend$2(() => match$6(get$2(this.cacheState.map, key), {
15399
+ onNone: () => {
15400
+ const mapKey = makeMapKey(key);
15401
+ this.trackAccess(mapKey);
15402
+ this.trackMiss();
15403
+ return succeed$4(none$4());
15404
+ },
15405
+ onSome: value => this.resolveMapValue(value, true)
15406
+ }));
15407
+ }
15408
+ contains(key) {
15409
+ return sync$1(() => has(this.cacheState.map, key));
15410
+ }
15411
+ entryStats(key) {
15412
+ return sync$1(() => {
15413
+ const option = get$2(this.cacheState.map, key);
15414
+ if (isSome(option)) {
15415
+ switch (option.value._tag) {
15416
+ case "Complete":
15417
+ {
15418
+ const loaded = option.value.entryStats.loadedMillis;
15419
+ return some(makeEntryStats(loaded));
15420
+ }
15421
+ case "Pending":
15422
+ {
15423
+ return none$4();
15424
+ }
15425
+ case "Refreshing":
15426
+ {
15427
+ const loaded = option.value.complete.entryStats.loadedMillis;
15428
+ return some(makeEntryStats(loaded));
15429
+ }
15430
+ }
15431
+ }
15432
+ return none$4();
15433
+ });
15434
+ }
15435
+ getEither(key) {
15436
+ return suspend$2(() => {
15437
+ const k = key;
15438
+ let mapKey = undefined;
15439
+ let deferred = undefined;
15440
+ let value = getOrUndefined(get$2(this.cacheState.map, k));
15441
+ if (value === undefined) {
15442
+ deferred = unsafeMake$4(this.fiberId);
15443
+ mapKey = makeMapKey(k);
15444
+ if (has(this.cacheState.map, k)) {
15445
+ value = getOrUndefined(get$2(this.cacheState.map, k));
15446
+ } else {
15447
+ set$1(this.cacheState.map, k, pending(mapKey, deferred));
15448
+ }
15449
+ }
15450
+ if (value === undefined) {
15451
+ this.trackAccess(mapKey);
15452
+ this.trackMiss();
15453
+ return map$3(this.lookupValueOf(key, deferred), right);
15454
+ } else {
15455
+ return flatMap$2(this.resolveMapValue(value), match$6({
15456
+ onNone: () => this.getEither(key),
15457
+ onSome: value => succeed$4(left(value))
15458
+ }));
15459
+ }
15460
+ });
15461
+ }
15462
+ invalidate(key) {
15463
+ return sync$1(() => {
15464
+ remove$1(this.cacheState.map, key);
15465
+ });
15466
+ }
15467
+ invalidateWhen(key, when) {
15468
+ return sync$1(() => {
15469
+ const value = get$2(this.cacheState.map, key);
15470
+ if (isSome(value) && value.value._tag === "Complete") {
15471
+ if (value.value.exit._tag === "Success") {
15472
+ if (when(value.value.exit.value)) {
15473
+ remove$1(this.cacheState.map, key);
15474
+ }
15475
+ }
15476
+ }
15477
+ });
15478
+ }
15479
+ get invalidateAll() {
15480
+ return sync$1(() => {
15481
+ this.cacheState.map = empty$8();
15482
+ });
15483
+ }
15484
+ refresh(key) {
15485
+ return clockWith(clock => suspend$2(() => {
15486
+ const k = key;
15487
+ const deferred = unsafeMake$4(this.fiberId);
15488
+ let value = getOrUndefined(get$2(this.cacheState.map, k));
15489
+ if (value === undefined) {
15490
+ if (has(this.cacheState.map, k)) {
15491
+ value = getOrUndefined(get$2(this.cacheState.map, k));
15492
+ } else {
15493
+ set$1(this.cacheState.map, k, pending(makeMapKey(k), deferred));
15494
+ }
15495
+ }
15496
+ if (value === undefined) {
15497
+ return asVoid$1(this.lookupValueOf(key, deferred));
15498
+ } else {
15499
+ switch (value._tag) {
15500
+ case "Complete":
15501
+ {
15502
+ if (this.hasExpired(clock, value.timeToLiveMillis)) {
15503
+ const found = getOrUndefined(get$2(this.cacheState.map, k));
15504
+ if (equals$1(found, value)) {
15505
+ remove$1(this.cacheState.map, k);
15506
+ }
15507
+ return asVoid$1(this.get(key));
15508
+ }
15509
+ // Only trigger the lookup if we're still the current value, `completedResult`
15510
+ return pipe(this.lookupValueOf(key, deferred), when$1(() => {
15511
+ const current = getOrUndefined(get$2(this.cacheState.map, k));
15512
+ if (equals$1(current, value)) {
15513
+ const mapValue = refreshing(deferred, value);
15514
+ set$1(this.cacheState.map, k, mapValue);
15515
+ return true;
15516
+ }
15517
+ return false;
15518
+ }), asVoid$1);
15519
+ }
15520
+ case "Pending":
15521
+ {
15522
+ return _await$1(value.deferred);
15523
+ }
15524
+ case "Refreshing":
15525
+ {
15526
+ return _await$1(value.deferred);
15527
+ }
15528
+ }
15529
+ }
15530
+ }));
15531
+ }
15532
+ set(key, value) {
15533
+ return clockWith(clock => sync$1(() => {
15534
+ const now = clock.unsafeCurrentTimeMillis();
15535
+ const k = key;
15536
+ const lookupResult = succeed$2(value);
15537
+ const mapValue = complete(makeMapKey(k), lookupResult, makeEntryStats(now), now + toMillis(decode(this.timeToLive(lookupResult))));
15538
+ set$1(this.cacheState.map, k, mapValue);
15539
+ }));
15540
+ }
15541
+ get size() {
15542
+ return sync$1(() => {
15543
+ return size(this.cacheState.map);
15544
+ });
15545
+ }
15546
+ get values() {
15547
+ return sync$1(() => {
15548
+ const values = [];
15549
+ for (const entry of this.cacheState.map) {
15550
+ if (entry[1]._tag === "Complete" && entry[1].exit._tag === "Success") {
15551
+ values.push(entry[1].exit.value);
15552
+ }
15553
+ }
15554
+ return values;
15555
+ });
15556
+ }
15557
+ get entries() {
15558
+ return sync$1(() => {
15559
+ const values = [];
15560
+ for (const entry of this.cacheState.map) {
15561
+ if (entry[1]._tag === "Complete" && entry[1].exit._tag === "Success") {
15562
+ values.push([entry[0], entry[1].exit.value]);
15563
+ }
15564
+ }
15565
+ return values;
15566
+ });
15567
+ }
15568
+ get keys() {
15569
+ return sync$1(() => {
15570
+ const keys = [];
15571
+ for (const entry of this.cacheState.map) {
15572
+ if (entry[1]._tag === "Complete" && entry[1].exit._tag === "Success") {
15573
+ keys.push(entry[0]);
15574
+ }
15575
+ }
15576
+ return keys;
15577
+ });
15578
+ }
15579
+ resolveMapValue(value, ignorePending = false) {
15580
+ return clockWith(clock => {
15581
+ switch (value._tag) {
15582
+ case "Complete":
15583
+ {
15584
+ this.trackAccess(value.key);
15585
+ if (this.hasExpired(clock, value.timeToLiveMillis)) {
15586
+ remove$1(this.cacheState.map, value.key.current);
15587
+ return succeed$4(none$4());
15588
+ }
15589
+ this.trackHit();
15590
+ return map$3(value.exit, some);
15591
+ }
15592
+ case "Pending":
15593
+ {
15594
+ this.trackAccess(value.key);
15595
+ this.trackHit();
15596
+ if (ignorePending) {
15597
+ return succeed$4(none$4());
15598
+ }
15599
+ return map$3(_await$1(value.deferred), some);
15600
+ }
15601
+ case "Refreshing":
15602
+ {
15603
+ this.trackAccess(value.complete.key);
15604
+ this.trackHit();
15605
+ if (this.hasExpired(clock, value.complete.timeToLiveMillis)) {
15606
+ if (ignorePending) {
15607
+ return succeed$4(none$4());
15608
+ }
15609
+ return map$3(_await$1(value.deferred), some);
15610
+ }
15611
+ return map$3(value.complete.exit, some);
15612
+ }
15613
+ }
15614
+ });
15615
+ }
15616
+ trackHit() {
15617
+ this.cacheState.hits = this.cacheState.hits + 1;
15618
+ }
15619
+ trackMiss() {
15620
+ this.cacheState.misses = this.cacheState.misses + 1;
15621
+ }
15622
+ trackAccess(key) {
15623
+ offer(this.cacheState.accesses, key);
15624
+ if (compareAndSet(this.cacheState.updating, false, true)) {
15625
+ let loop = true;
15626
+ while (loop) {
15627
+ const key = poll(this.cacheState.accesses, EmptyMutableQueue);
15628
+ if (key === EmptyMutableQueue) {
15629
+ loop = false;
15630
+ } else {
15631
+ this.cacheState.keys.add(key);
15632
+ }
15633
+ }
15634
+ let size$1 = size(this.cacheState.map);
15635
+ loop = size$1 > this.capacity;
15636
+ while (loop) {
15637
+ const key = this.cacheState.keys.remove();
15638
+ if (key !== undefined) {
15639
+ if (has(this.cacheState.map, key.current)) {
15640
+ remove$1(this.cacheState.map, key.current);
15641
+ size$1 = size$1 - 1;
15642
+ loop = size$1 > this.capacity;
15643
+ }
15644
+ } else {
15645
+ loop = false;
15646
+ }
15647
+ }
15648
+ set$3(this.cacheState.updating, false);
15649
+ }
15650
+ }
15651
+ hasExpired(clock, timeToLiveMillis) {
15652
+ return clock.unsafeCurrentTimeMillis() > timeToLiveMillis;
15653
+ }
15654
+ lookupValueOf(input, deferred) {
15655
+ return clockWith(clock => suspend$2(() => {
15656
+ const key = input;
15657
+ return pipe(this.lookup(input), provideContext$1(this.context), exit$1, flatMap$2(exit => {
15658
+ const now = clock.unsafeCurrentTimeMillis();
15659
+ const stats = makeEntryStats(now);
15660
+ const value = complete(makeMapKey(key), exit, stats, now + toMillis(decode(this.timeToLive(exit))));
15661
+ set$1(this.cacheState.map, key, value);
15662
+ return zipRight$2(done$4(deferred, exit), exit);
15663
+ }), onInterrupt(() => zipRight$2(interrupt$1(deferred), sync$1(() => {
15664
+ remove$1(this.cacheState.map, key);
15665
+ }))));
15666
+ }));
15667
+ }
15668
+ }
15669
+ /** @internal */
15670
+ const make$6 = options => {
15671
+ const timeToLive = decode(options.timeToLive);
15672
+ return makeWith({
15673
+ capacity: options.capacity,
15674
+ lookup: options.lookup,
15675
+ timeToLive: () => timeToLive
15676
+ });
15677
+ };
15678
+ /** @internal */
15679
+ const makeWith = options => map$3(all$1([context(), fiberId]), ([context, fiberId]) => new CacheImpl(options.capacity, context, fiberId, options.lookup, exit => decode(options.timeToLive(exit))));
15680
+
15681
+ /**
15682
+ * Constructs a new cache with the specified capacity, time to live, and
15683
+ * lookup function.
15684
+ *
15685
+ * @since 2.0.0
15686
+ * @category constructors
15687
+ */
15688
+ const make$5 = make$6;
15689
+
15024
15690
  /** @internal */
15025
15691
  const IntervalSymbolKey = "effect/ScheduleInterval";
15026
15692
  /** @internal */
@@ -15327,20 +15993,24 @@ class Semaphore {
15327
15993
  take = n => asyncInterrupt(resume => {
15328
15994
  if (this.free < n) {
15329
15995
  const observer = () => {
15330
- if (this.free < n) {
15331
- return;
15332
- }
15996
+ if (this.free < n) return;
15333
15997
  this.waiters.delete(observer);
15334
- this.taken += n;
15335
- resume(succeed$4(n));
15998
+ resume(suspend$2(() => {
15999
+ if (this.free < n) return this.take(n);
16000
+ this.taken += n;
16001
+ return succeed$4(n);
16002
+ }));
15336
16003
  };
15337
16004
  this.waiters.add(observer);
15338
16005
  return sync$1(() => {
15339
16006
  this.waiters.delete(observer);
15340
16007
  });
15341
16008
  }
15342
- this.taken += n;
15343
- return resume(succeed$4(n));
16009
+ resume(suspend$2(() => {
16010
+ if (this.free < n) return this.take(n);
16011
+ this.taken += n;
16012
+ return succeed$4(n);
16013
+ }));
15344
16014
  });
15345
16015
  updateTakenUnsafe(fiber, f) {
15346
16016
  this.taken = f(this.taken);
@@ -15352,7 +16022,7 @@ class Semaphore {
15352
16022
  item.value();
15353
16023
  item = iter.next();
15354
16024
  }
15355
- }, fiber.getFiberRef(currentSchedulingPriority));
16025
+ }, fiber.getFiberRef(currentSchedulingPriority), fiber);
15356
16026
  }
15357
16027
  return succeed$4(this.free);
15358
16028
  }
@@ -15616,7 +16286,7 @@ const make = options => new RuntimeImpl(options.context, options.runtimeFlags, o
15616
16286
  /** @internal */
15617
16287
  const runtime$1 = () => withFiberRuntime$1((state, status) => succeed$4(new RuntimeImpl(state.getFiberRef(currentContext), status.runtimeFlags, state.getFiberRefs())));
15618
16288
  /** @internal */
15619
- const defaultRuntimeFlags = /*#__PURE__*/make$h(Interruption, CooperativeYielding, RuntimeMetrics);
16289
+ const defaultRuntimeFlags = /*#__PURE__*/make$j(Interruption, CooperativeYielding, RuntimeMetrics);
15620
16290
  /** @internal */
15621
16291
  const defaultRuntime = /*#__PURE__*/make({
15622
16292
  context: /*#__PURE__*/empty$k(),
@@ -15691,7 +16361,7 @@ class MemoMapImpl {
15691
16361
  })));
15692
16362
  return succeed$4([cached, map]);
15693
16363
  }
15694
- return pipe(make$a(0), flatMap$2(observers => pipe(deferredMake(), flatMap$2(deferred => pipe(make$a(() => void_$2), map$3(finalizerRef => {
16364
+ return pipe(make$c(0), flatMap$2(observers => pipe(deferredMake(), flatMap$2(deferred => pipe(make$c(() => void_$2), map$3(finalizerRef => {
15695
16365
  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 => {
15696
16366
  switch (exit._tag) {
15697
16367
  case OP_FAILURE:
@@ -15833,6 +16503,53 @@ const effect_provide = /*#__PURE__*/dual(2, (self, source) => {
15833
16503
  }
15834
16504
  });
15835
16505
 
16506
+ /**
16507
+ * Provides a constructor for a Case Class.
16508
+ *
16509
+ * @since 2.0.0
16510
+ * @category constructors
16511
+ */
16512
+ const Error$1 = /*#__PURE__*/function () {
16513
+ const plainArgsSymbol = /*#__PURE__*/Symbol.for("effect/Data/Error/plainArgs");
16514
+ const O = {
16515
+ BaseEffectError: class extends YieldableError {
16516
+ constructor(args) {
16517
+ super(args?.message, args?.cause ? {
16518
+ cause: args.cause
16519
+ } : undefined);
16520
+ if (args) {
16521
+ Object.assign(this, args);
16522
+ // @effect-diagnostics-next-line floatingEffect:off
16523
+ Object.defineProperty(this, plainArgsSymbol, {
16524
+ value: args,
16525
+ enumerable: false
16526
+ });
16527
+ }
16528
+ }
16529
+ toJSON() {
16530
+ return {
16531
+ ...this[plainArgsSymbol],
16532
+ ...this
16533
+ };
16534
+ }
16535
+ }
16536
+ };
16537
+ return O.BaseEffectError;
16538
+ }();
16539
+ /**
16540
+ * @since 2.0.0
16541
+ * @category constructors
16542
+ */
16543
+ const TaggedError = tag => {
16544
+ const O = {
16545
+ BaseEffectError: class extends Error$1 {
16546
+ _tag = tag;
16547
+ }
16548
+ };
16549
+ O.BaseEffectError.prototype.name = tag;
16550
+ return O.BaseEffectError;
16551
+ };
16552
+
15836
16553
  /** @internal */
15837
16554
  const ScheduleSymbolKey = "effect/Schedule";
15838
16555
  /** @internal */
@@ -15961,7 +16678,7 @@ const checkEffect = /*#__PURE__*/dual(2, (self, test) => makeWithState(self.init
15961
16678
  return map$3(test(input, out), cont => cont ? [state, out, decision] : [state, out, done]);
15962
16679
  })));
15963
16680
  /** @internal */
15964
- const driver = self => pipe(make$a([none$4(), self.initial]), map$3(ref => new ScheduleDriverImpl(self, ref)));
16681
+ const driver = self => pipe(make$c([none$4(), self.initial]), map$3(ref => new ScheduleDriverImpl(self, ref)));
15965
16682
  /** @internal */
15966
16683
  const intersect = /*#__PURE__*/dual(2, (self, that) => intersectWith(self, that, intersect$1));
15967
16684
  /** @internal */
@@ -18789,18 +19506,98 @@ const zipRight = zipRightOptions;
18789
19506
  */
18790
19507
  const zipWith = zipWithOptions;
18791
19508
 
19509
+ class FetchError extends TaggedError('FetchError') {
19510
+ }
19511
+ class NotFoundError extends TaggedError('NotFoundError') {
19512
+ }
19513
+ const httpClient = (input, init) => gen$1(function* () {
19514
+ const response = yield* tryPromise({
19515
+ try: () => fetch(input, init),
19516
+ catch: error => new FetchError({ cause: error }),
19517
+ });
19518
+ if (response.status === 404) {
19519
+ return yield* fail$1(new NotFoundError({ url: response.url }));
19520
+ }
19521
+ return response;
19522
+ });
19523
+ class ResponseTextError extends TaggedError('ResponseTextError') {
19524
+ constructor(error) {
19525
+ super(new Error(`Failed to read response text`, { cause: error }));
19526
+ }
19527
+ }
19528
+ const responseAsText = (res) => tryPromise({
19529
+ try: () => res.text(),
19530
+ catch: error => new ResponseTextError(error),
19531
+ });
19532
+
19533
+ const SVGString = refined(isValidSVG, () => error('SVG data is malformed'));
19534
+ class BrandValidationError extends TaggedError('BrandValidationError') {
19535
+ constructor(error, type) {
19536
+ super(new Error(`Brand validation failed for type ${type}.`, { cause: error }));
19537
+ }
19538
+ }
19539
+ const createValidSVGString = (svg) => try_({
19540
+ try: () => SVGString(svg),
19541
+ catch: error => new BrandValidationError(error, 'SVGString'),
19542
+ });
19543
+ function isValidSVG(svg) {
19544
+ if (typeof svg !== 'string') {
19545
+ return false;
19546
+ }
19547
+ try {
19548
+ const parser = new DOMParser();
19549
+ const doc = parser.parseFromString(svg, 'image/svg+xml');
19550
+ return doc.documentElement.nodeName === 'svg';
19551
+ }
19552
+ catch {
19553
+ return false;
19554
+ }
19555
+ }
19556
+
19557
+ const emptyDefaultSvg = () => SVGString(`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"></svg>`);
19558
+ const createIconCache = () => make$5({
19559
+ capacity: 200,
19560
+ timeToLive: infinity,
19561
+ lookup: (key) => gen(function* () {
19562
+ const name = key;
19563
+ const assetPath = assets.createAssetUrlSafely(`${name}.svg`, 'icons');
19564
+ const res = yield* httpClient(assetPath);
19565
+ const responseString = yield* responseAsText(res);
19566
+ return yield* createValidSVGString(responseString);
19567
+ }),
19568
+ });
19569
+ let cacheInstance = null;
19570
+ function fetchIconSvg(name) {
19571
+ const key = name;
19572
+ return gen(function* () {
19573
+ if (!cacheInstance) {
19574
+ cacheInstance = yield* createIconCache();
19575
+ }
19576
+ return yield* cacheInstance.get(key);
19577
+ });
19578
+ }
19579
+ function clearIconCache() {
19580
+ return gen(function* () {
19581
+ if (cacheInstance) {
19582
+ yield* cacheInstance.invalidateAll;
19583
+ }
19584
+ else {
19585
+ logWarning('Attempted to clear icon cache before it was initialized');
19586
+ }
19587
+ });
19588
+ }
19589
+
19590
+ exports.ARIA_VALIDATION_RUNTIME_CHANGED_EVENT = ARIA_VALIDATION_RUNTIME_CHANGED_EVENT;
18792
19591
  exports.Class = Class;
18793
19592
  exports.EmptyMutableQueue = EmptyMutableQueue;
18794
- exports.YieldableError = YieldableError;
18795
- exports._await = _await$1;
18796
- exports._await$1 = _await;
19593
+ exports._await = _await;
19594
+ exports._await$1 = _await$1;
18797
19595
  exports._void = _void;
18798
19596
  exports.acquireUseRelease = acquireUseRelease;
18799
19597
  exports.addFinalizer = addFinalizer;
18800
19598
  exports.addFinalizerExit = addFinalizerExit;
18801
- exports.all = all$1;
18802
- exports.all$1 = all$2;
18803
- exports.all$2 = all;
19599
+ exports.all = all$2;
19600
+ exports.all$1 = all;
18804
19601
  exports.append = append$1;
18805
19602
  exports.appendAll = appendAll$1;
18806
19603
  exports.as = as;
@@ -18808,20 +19605,15 @@ exports.asVoid = asVoid$1;
18808
19605
  exports.asVoid$1 = asVoid;
18809
19606
  exports.async = async;
18810
19607
  exports.bounded = bounded;
18811
- exports.cached = cached;
18812
19608
  exports.capacity = capacity;
18813
19609
  exports.catchAll = catchAll;
18814
19610
  exports.catchAll$1 = catchAll$1;
18815
19611
  exports.catchAllCause = catchAllCause;
18816
19612
  exports.catchSomeCause = catchSomeCause;
18817
- exports.clockWith = clockWith;
19613
+ exports.clearIconCache = clearIconCache;
18818
19614
  exports.close = close;
18819
- exports.combine = combine$7;
18820
19615
  exports.combineAll = combineAll;
18821
- exports.compareAndSet = compareAndSet;
18822
19616
  exports.constVoid = constVoid;
18823
- exports.context = context;
18824
- exports.decode = decode;
18825
19617
  exports.deferredAwait = deferredAwait;
18826
19618
  exports.deferredInterruptWith = deferredInterruptWith;
18827
19619
  exports.deferredMake = deferredMake;
@@ -18831,24 +19623,24 @@ exports.deferredUnsafeMake = deferredUnsafeMake;
18831
19623
  exports.die = die$2;
18832
19624
  exports.die$1 = die;
18833
19625
  exports.dieMessage = dieMessage;
18834
- exports.done = done$4;
19626
+ exports.disableAriaValidation = disableAriaValidation;
18835
19627
  exports.dual = dual;
18836
- exports.empty = empty$8;
18837
- exports.empty$1 = empty$m;
18838
- exports.empty$2 = empty$j;
19628
+ exports.empty = empty$m;
19629
+ exports.empty$1 = empty$j;
19630
+ exports.emptyDefaultSvg = emptyDefaultSvg;
19631
+ exports.enableAriaValidation = enableAriaValidation;
18839
19632
  exports.ensuring = ensuring;
18840
19633
  exports.equals = equals$1;
18841
- exports.exit = exit$1;
18842
- exports.exit$1 = exit;
19634
+ exports.exit = exit;
18843
19635
  exports.extend = extend;
18844
- exports.fail = fail$1;
18845
- exports.fail$1 = fail$4;
18846
- exports.fail$2 = fail$2;
18847
- exports.fail$3 = fail;
19636
+ exports.fail = fail$4;
19637
+ exports.fail$1 = fail$2;
19638
+ exports.fail$2 = fail;
18848
19639
  exports.failCause = failCause$2;
18849
19640
  exports.failCause$1 = failCause;
18850
19641
  exports.failCause$2 = failCause$3;
18851
19642
  exports.failureOrCause = failureOrCause;
19643
+ exports.fetchIconSvg = fetchIconSvg;
18852
19644
  exports.fiberId = fiberId;
18853
19645
  exports.fiberIdWith = fiberIdWith;
18854
19646
  exports.filter = filter;
@@ -18865,32 +19657,24 @@ exports.forkDaemon = forkDaemon;
18865
19657
  exports.forkIn = forkIn;
18866
19658
  exports.fromIterable = fromIterable$6;
18867
19659
  exports.fromIterable$1 = fromIterable$5;
18868
- exports.gen = gen$1;
18869
- exports.gen$1 = gen;
18870
- exports.get = get$2;
18871
- exports.get$1 = get;
18872
- exports.get$2 = get$4;
19660
+ exports.gen = gen;
19661
+ exports.get = get;
19662
+ exports.get$1 = get$4;
18873
19663
  exports.getOrElse = getOrElse;
18874
- exports.getOrThrowWith = getOrThrowWith;
18875
- exports.getOrUndefined = getOrUndefined;
18876
- exports.getRight = getRight;
18877
- exports.has = has;
18878
19664
  exports.hasProperty = hasProperty;
18879
- exports.hash = hash;
18880
19665
  exports.head = head;
18881
19666
  exports.identity = identity;
18882
19667
  exports.ignore = ignore;
18883
- exports.infinity = infinity;
18884
19668
  exports.inheritAll = inheritAll;
18885
- exports.interrupt = interrupt$1;
18886
- exports.interrupt$1 = interrupt$3;
18887
- exports.interrupt$2 = interrupt$2;
18888
- exports.interrupt$3 = interrupt;
19669
+ exports.interrupt = interrupt$3;
19670
+ exports.interrupt$1 = interrupt$2;
19671
+ exports.interrupt$2 = interrupt;
18889
19672
  exports.interruptAsFiber = interruptAsFiber;
18890
19673
  exports.interruptFiber = interruptFiber;
18891
19674
  exports.interruptible = interruptible;
18892
19675
  exports.interruptors = interruptors;
18893
19676
  exports.intoDeferred = intoDeferred;
19677
+ exports.isAriaValidationEnabled = isAriaValidationEnabled;
18894
19678
  exports.isDieType = isDieType;
18895
19679
  exports.isDone = isDone$4;
18896
19680
  exports.isEffect = isEffect;
@@ -18899,32 +19683,29 @@ exports.isEmpty$1 = isEmpty$2;
18899
19683
  exports.isFailure = isFailure;
18900
19684
  exports.isInterrupted = isInterrupted;
18901
19685
  exports.isInterruptedOnly = isInterruptedOnly;
18902
- exports.isRight = isRight;
18903
19686
  exports.isSome = isSome;
18904
19687
  exports.isSuccess = isSuccess;
18905
19688
  exports.join = join;
18906
19689
  exports.left = left;
18907
19690
  exports.length = length;
18908
19691
  exports.logError = logError;
18909
- exports.logWarning = logWarning;
18910
- exports.make = make$k;
18911
- exports.make$1 = make$a;
18912
- exports.make$2 = make$g;
19692
+ exports.make = make$c;
19693
+ exports.make$1 = make$m;
19694
+ exports.make$2 = make$i;
18913
19695
  exports.make$3 = make$1;
18914
19696
  exports.makeSemaphore = makeSemaphore;
18915
- exports.map = map$3;
18916
- exports.map$1 = map$4;
19697
+ exports.map = map$4;
19698
+ exports.map$1 = map$3;
18917
19699
  exports.map$2 = map;
18918
19700
  exports.map$3 = map$2;
18919
19701
  exports.map$4 = map$7;
18920
19702
  exports.mapError = mapError;
18921
- exports.match = match$6;
18922
- exports.match$1 = match$7;
18923
- exports.match$2 = match$3;
19703
+ exports.match = match$7;
19704
+ exports.match$1 = match$3;
19705
+ exports.match$2 = match$6;
18924
19706
  exports.match$3 = match;
18925
19707
  exports.matchCause = matchCause;
18926
19708
  exports.matchCauseEffect = matchCauseEffect;
18927
- exports.merge = merge$3;
18928
19709
  exports.modify = modify;
18929
19710
  exports.none = none$4;
18930
19711
  exports.of = of$1;
@@ -18937,12 +19718,11 @@ exports.poll = poll;
18937
19718
  exports.pollUpTo = pollUpTo;
18938
19719
  exports.prepend = prepend$1;
18939
19720
  exports.provide = provide;
18940
- exports.provideContext = provideContext$1;
19721
+ exports.queueValidation = queueValidation;
18941
19722
  exports.race = race;
18942
19723
  exports.raceFirst = raceFirst;
18943
19724
  exports.raceWith = raceWith;
18944
19725
  exports.reduce = reduce$6;
18945
- exports.remove = remove$1;
18946
19726
  exports.repeat = repeat;
18947
19727
  exports.right = right;
18948
19728
  exports.runFork = runFork;
@@ -18951,42 +19731,33 @@ exports.runtime = runtime;
18951
19731
  exports.scope = scope;
18952
19732
  exports.scopedWith = scopedWith;
18953
19733
  exports.sequential = sequential;
18954
- exports.set = set$1;
18955
- exports.set$1 = set$3;
18956
- exports.size = size;
18957
- exports.size$1 = size$1;
19734
+ exports.set = set$3;
19735
+ exports.size = size$1;
18958
19736
  exports.some = some;
18959
19737
  exports.splitAt = splitAt$1;
18960
19738
  exports.splitWhere = splitWhere;
18961
- exports.struct = struct;
18962
19739
  exports.succeed = succeed;
18963
19740
  exports.succeed$1 = succeed$4;
18964
19741
  exports.succeed$2 = succeed$2;
18965
19742
  exports.succeed$3 = succeed$3;
18966
19743
  exports.suspend = suspend$2;
18967
19744
  exports.suspend$1 = suspend;
18968
- exports.symbol = symbol$1;
18969
- exports.symbol$1 = symbol;
18970
19745
  exports.sync = sync$1;
18971
19746
  exports.sync$1 = sync;
18972
19747
  exports.tap = tap;
18973
19748
  exports.tapError = tapError;
18974
19749
  exports.tapErrorCause = tapErrorCause;
18975
- exports.toMillis = toMillis;
18976
- exports.tryPromise = tryPromise;
18977
- exports.try_ = try_;
18978
19750
  exports.unbounded = unbounded;
18979
19751
  exports.uninterruptible = uninterruptible$1;
18980
19752
  exports.uninterruptible$1 = uninterruptible;
18981
19753
  exports.uninterruptibleMask = uninterruptibleMask;
18982
19754
  exports.unsafeFromArray = unsafeFromArray;
18983
19755
  exports.unsafeGet = unsafeGet;
18984
- exports.unsafeMake = unsafeMake$4;
18985
19756
  exports.update = update$1;
19757
+ exports.useVerboseLogging = useVerboseLogging;
18986
19758
  exports.void_ = void_$2;
18987
19759
  exports.void_$1 = void_$1;
18988
- exports.when = when$1;
18989
- exports.when$1 = when;
19760
+ exports.when = when;
18990
19761
  exports.whenEffect = whenEffect;
18991
19762
  exports.withFiberRuntime = withFiberRuntime$1;
18992
19763
  exports.withFiberRuntime$1 = withFiberRuntime;
@@ -18997,3 +19768,6 @@ exports.zipRight = zipRight$2;
18997
19768
  exports.zipRight$1 = zipRight$1;
18998
19769
  exports.zipRight$2 = zipRight;
18999
19770
  exports.zipWith = zipWith;
19771
+ //# sourceMappingURL=icons-BOM23oli.js.map
19772
+
19773
+ //# sourceMappingURL=icons-BOM23oli.js.map