@lmvz-ds/components 0.17.3 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/README.md +3 -0
- package/cjs/{aria-loader-W9Zvc9e-.js → aria-loader-CfFuAbJn.js} +2 -2
- package/cjs/icons-swqMn6s2.js +163 -0
- package/cjs/{index-BNm4PQrX.js → index--7IqZZqn.js} +12179 -516
- package/cjs/index.cjs.js +6 -85
- package/cjs/lmvz-action.cjs.entry.js +1 -1
- package/cjs/lmvz-button.cjs.entry.js +4 -4
- package/cjs/lmvz-card.cjs.entry.js +24 -4
- package/cjs/lmvz-chip.cjs.entry.js +1 -1
- package/cjs/lmvz-components.cjs.js +1 -1
- package/cjs/lmvz-header_2.cjs.entry.js +5 -5
- package/cjs/lmvz-icon.cjs.entry.js +24 -13
- package/cjs/lmvz-input.cjs.entry.js +5 -5
- package/cjs/lmvz-menuitem.cjs.entry.js +4 -4
- package/cjs/lmvz-select.cjs.entry.js +4 -4
- package/cjs/loader.cjs.js +1 -1
- package/cjs/logger-Bn2yoZGP.js +7189 -0
- package/cjs/{reactive-controller-host-B_davRfI.js → reactive-controller-host-CtaVAiYJ.js} +27 -23
- package/collection/api/ds.constants.js +0 -66
- package/collection/collection-manifest.json +1 -1
- package/collection/components/lmvz-action/lmvz-action.js +1 -1
- package/collection/components/lmvz-button/lmvz-button.css +2 -2
- package/collection/components/lmvz-button/lmvz-button.js +5 -5
- package/collection/components/lmvz-card/lmvz-card.css +5 -5
- package/collection/components/lmvz-card/lmvz-card.js +1 -1
- package/collection/components/lmvz-chip/lmvz-chip.js +1 -1
- package/collection/components/lmvz-header/lmvz-header.js +2 -2
- package/collection/components/lmvz-icon/lmvz-icon.css +13 -13
- package/collection/components/lmvz-icon/lmvz-icon.js +49 -18
- package/collection/components/lmvz-input/lmvz-input.css +1 -1
- package/collection/components/lmvz-input/lmvz-input.js +6 -6
- package/collection/components/lmvz-menuitem/lmvz-menuitem.css +2 -2
- package/collection/components/lmvz-menuitem/lmvz-menuitem.js +1 -1
- package/collection/components/lmvz-select/lmvz-select.css +3 -3
- package/collection/components/lmvz-select/lmvz-select.js +1 -1
- package/collection/index.js +1 -2
- package/collection/integration/header-integration/header-integration.js +51 -0
- package/collection/utils/aria/aria-validation-controller.js +27 -23
- package/collection/utils/http.js +10 -13
- package/collection/utils/icons/icons-registry.js +34 -0
- package/collection/utils/icons/icons.js +49 -0
- package/collection/utils/icons/icons.unit.js +73 -0
- package/collection/utils/icons/public.js +2 -0
- package/collection/utils/public.js +1 -1
- package/components/index.d.ts +9 -9
- package/components/index.d.ts.bak +10 -10
- package/components/index.js +1 -1
- package/components/lmvz-action.d.ts +1 -1
- package/components/lmvz-action.d.ts.bak +11 -0
- package/components/lmvz-action.js +1 -1
- package/components/lmvz-button.d.ts +1 -1
- package/components/lmvz-button.d.ts.bak +11 -0
- package/components/lmvz-button.js +1 -1
- package/components/lmvz-card.d.ts +1 -1
- package/components/lmvz-card.d.ts.bak +11 -0
- package/components/lmvz-card.js +1 -1
- package/components/lmvz-chip.d.ts +1 -1
- package/components/lmvz-chip.d.ts.bak +11 -0
- package/components/lmvz-chip.js +1 -1
- package/components/lmvz-header.d.ts +1 -1
- package/components/lmvz-header.d.ts.bak +11 -0
- package/components/lmvz-header.js +1 -1
- package/components/lmvz-icon.d.ts +1 -1
- package/components/lmvz-icon.d.ts.bak +11 -0
- package/components/lmvz-icon.js +1 -1
- package/components/lmvz-input.d.ts +1 -1
- package/components/lmvz-input.d.ts.bak +11 -0
- package/components/lmvz-input.js +1 -1
- package/components/lmvz-menuitem.d.ts +1 -1
- package/components/lmvz-menuitem.d.ts.bak +11 -0
- package/components/lmvz-menuitem.js +1 -1
- package/components/lmvz-select.d.ts +1 -1
- package/components/lmvz-select.d.ts.bak +11 -0
- package/components/lmvz-select.js +1 -1
- package/components/{p-Clo63DJF.js → p-CBLAeife.js} +1 -1
- package/components/p-DXOTa5VF.js +12 -0
- package/components/p-fiRXhuXK.js +1 -0
- package/esm/{aria-loader-D9aySMw6.js → aria-loader-BF_AYtbb.js} +2 -2
- package/esm/icons-Ca8oMiRa.js +157 -0
- package/esm/{index-n6jVNpyp.js → index-7Ru1khgk.js} +11972 -309
- package/esm/index.js +4 -80
- package/esm/lmvz-action.entry.js +1 -1
- package/esm/lmvz-button.entry.js +4 -4
- package/esm/lmvz-card.entry.js +23 -4
- package/esm/lmvz-chip.entry.js +1 -1
- package/esm/lmvz-components.js +1 -1
- package/esm/lmvz-header_2.entry.js +5 -5
- package/esm/lmvz-icon.entry.js +24 -13
- package/esm/lmvz-input.entry.js +5 -5
- package/esm/lmvz-menuitem.entry.js +4 -4
- package/esm/lmvz-select.entry.js +4 -4
- package/esm/loader.js +1 -1
- package/esm/logger-fiRXhuXK.js +6990 -0
- package/esm/{reactive-controller-host-ByKmPKq1.js → reactive-controller-host-sR2jJxNG.js} +27 -23
- package/hydrate/index.js +78 -3842
- package/hydrate/index.mjs +78 -3842
- package/lmvz-components/index.esm.js +1 -1
- package/lmvz-components/lmvz-components.esm.js +1 -1
- package/lmvz-components/p-0f645295.entry.js +1 -0
- package/lmvz-components/{p-986acfd0.entry.js → p-1506fa34.entry.js} +1 -1
- package/lmvz-components/p-658c5c34.entry.js +1 -0
- package/lmvz-components/{p-1bda378c.entry.js → p-80675ee5.entry.js} +1 -1
- package/lmvz-components/p-872e2106.entry.js +1 -0
- package/lmvz-components/p-93038c98.entry.js +1 -0
- package/lmvz-components/{p-CU4XwA2K.js → p-B3dnXEPG.js} +1 -1
- package/lmvz-components/p-Bh2Epkwf.js +1 -0
- package/lmvz-components/{p-DPHHQR5F.js → p-Bkfdgg0T.js} +1 -1
- package/lmvz-components/p-DXOTa5VF.js +12 -0
- package/lmvz-components/p-bbab5471.entry.js +1 -0
- package/lmvz-components/p-c7e368c4.entry.js +1 -0
- package/lmvz-components/{p-b704eca8.entry.js → p-ff6a0267.entry.js} +1 -1
- package/lmvz-components/p-fiRXhuXK.js +1 -0
- package/manifest.json +64 -283
- package/package.json +4 -2
- package/types/api/ds.constants.d.ts +22 -1
- package/types/api/ds.types.d.ts +3 -38
- package/types/api/index.d.ts +0 -1
- package/types/components/lmvz-action/lmvz-action.d.ts +1 -0
- package/types/components/lmvz-button/lmvz-button.d.ts +2 -2
- package/types/components/lmvz-card/lmvz-card.d.ts +1 -0
- package/types/components/lmvz-chip/lmvz-chip.d.ts +1 -0
- package/types/components/lmvz-header/lmvz-header.d.ts +1 -0
- package/types/components/lmvz-icon/lmvz-icon.d.ts +4 -1
- package/types/components/lmvz-input/lmvz-input.d.ts +1 -0
- package/types/components/lmvz-menuitem/lmvz-menuitem.d.ts +1 -0
- package/types/components/lmvz-select/lmvz-select.d.ts +1 -0
- package/types/components.d.ts +747 -931
- package/types/index.d.ts +2 -2
- package/types/utils/aria/aria-validation-controller.d.ts +1 -0
- package/types/utils/aria/element-activation-controller.d.ts +1 -0
- package/types/utils/aria/list-keyboard-controller.d.ts +1 -0
- package/types/utils/assets.d.ts +1 -0
- package/types/utils/component.d.ts +2 -4
- package/types/utils/environment.d.ts +1 -0
- package/types/utils/http.d.ts +11 -8
- package/types/utils/http.unit.d.ts +1 -0
- package/types/utils/icons/icons-registry.d.ts +13 -0
- package/types/utils/icons/icons.d.ts +8 -0
- package/types/utils/icons/icons.unit.d.ts +8 -0
- package/types/utils/icons/public.d.ts +4 -0
- package/types/utils/public.d.ts +2 -1
- package/types/utils/reactive-controller-host.d.ts +1 -0
- package/assets/.DS_Store +0 -0
- package/assets/icons/.DS_Store +0 -0
- package/assets/icons/actions.svg +0 -5
- package/assets/icons/adduser.svg +0 -3
- package/assets/icons/alert.svg +0 -3
- package/assets/icons/apple.svg +0 -3
- package/assets/icons/arrow-down.svg +0 -3
- package/assets/icons/arrow-left.svg +0 -3
- package/assets/icons/arrow-right.svg +0 -3
- package/assets/icons/arrow-up.svg +0 -3
- package/assets/icons/book.svg +0 -3
- package/assets/icons/bookmark.svg +0 -3
- package/assets/icons/checkmark.svg +0 -3
- package/assets/icons/chevron-left.svg +0 -3
- package/assets/icons/chevron-right.svg +0 -3
- package/assets/icons/chevron-up.svg +0 -3
- package/assets/icons/close-l.svg +0 -3
- package/assets/icons/close-sm.svg +0 -3
- package/assets/icons/cog.svg +0 -4
- package/assets/icons/computer.svg +0 -3
- package/assets/icons/dashboard.svg +0 -6
- package/assets/icons/delete.svg +0 -3
- package/assets/icons/download.svg +0 -3
- package/assets/icons/edit.svg +0 -3
- package/assets/icons/external.svg +0 -3
- package/assets/icons/facebook.svg +0 -3
- package/assets/icons/favorite.svg +0 -3
- package/assets/icons/filter.svg +0 -3
- package/assets/icons/group.svg +0 -3
- package/assets/icons/hide.svg +0 -3
- package/assets/icons/home.svg +0 -3
- package/assets/icons/info.svg +0 -3
- package/assets/icons/instagram.svg +0 -3
- package/assets/icons/letter.svg +0 -3
- package/assets/icons/linkedin.svg +0 -5
- package/assets/icons/logout.svg +0 -3
- package/assets/icons/map.svg +0 -3
- package/assets/icons/minus.svg +0 -3
- package/assets/icons/navigation.svg +0 -3
- package/assets/icons/plus.svg +0 -3
- package/assets/icons/qr-scan.svg +0 -3
- package/assets/icons/question.svg +0 -10
- package/assets/icons/reader.svg +0 -3
- package/assets/icons/reset.svg +0 -3
- package/assets/icons/school.svg +0 -3
- package/assets/icons/search.svg +0 -3
- package/assets/icons/send.svg +0 -3
- package/assets/icons/settings.svg +0 -3
- package/assets/icons/share.svg +0 -10
- package/assets/icons/shopping-cart.svg +0 -3
- package/assets/icons/show.svg +0 -3
- package/assets/icons/snapchat.svg +0 -3
- package/assets/icons/sort.svg +0 -3
- package/assets/icons/speech-bubble.svg +0 -3
- package/assets/icons/star.svg +0 -3
- package/assets/icons/student.svg +0 -3
- package/assets/icons/upload.svg +0 -3
- package/assets/icons/user.svg +0 -3
- package/assets/icons/warn-circle.svg +0 -3
- package/assets/icons/warn-triangle.svg +0 -3
- package/assets/icons/whatsapp.svg +0 -4
- package/assets/icons/world.svg +0 -10
- package/assets/icons/x.svg +0 -3
- package/assets/icons/youtube.svg +0 -3
- package/cjs/Effect-YVFLBEfy.js +0 -19037
- package/cjs/assets-DxYhun-q.js +0 -26
- package/cjs/icons-DgYgcKGK.js +0 -653
- package/collection/api/index.js +0 -1
- package/collection/assets/.DS_Store +0 -0
- package/collection/assets/icons/.DS_Store +0 -0
- package/collection/assets/icons/actions.svg +0 -5
- package/collection/assets/icons/adduser.svg +0 -3
- package/collection/assets/icons/alert.svg +0 -3
- package/collection/assets/icons/apple.svg +0 -3
- package/collection/assets/icons/arrow-down.svg +0 -3
- package/collection/assets/icons/arrow-left.svg +0 -3
- package/collection/assets/icons/arrow-right.svg +0 -3
- package/collection/assets/icons/arrow-up.svg +0 -3
- package/collection/assets/icons/book.svg +0 -3
- package/collection/assets/icons/bookmark.svg +0 -3
- package/collection/assets/icons/checkmark.svg +0 -3
- package/collection/assets/icons/chevron-left.svg +0 -3
- package/collection/assets/icons/chevron-right.svg +0 -3
- package/collection/assets/icons/chevron-up.svg +0 -3
- package/collection/assets/icons/close-l.svg +0 -3
- package/collection/assets/icons/close-sm.svg +0 -3
- package/collection/assets/icons/cog.svg +0 -4
- package/collection/assets/icons/computer.svg +0 -3
- package/collection/assets/icons/dashboard.svg +0 -6
- package/collection/assets/icons/delete.svg +0 -3
- package/collection/assets/icons/download.svg +0 -3
- package/collection/assets/icons/edit.svg +0 -3
- package/collection/assets/icons/external.svg +0 -3
- package/collection/assets/icons/facebook.svg +0 -3
- package/collection/assets/icons/favorite.svg +0 -3
- package/collection/assets/icons/filter.svg +0 -3
- package/collection/assets/icons/group.svg +0 -3
- package/collection/assets/icons/hide.svg +0 -3
- package/collection/assets/icons/home.svg +0 -3
- package/collection/assets/icons/info.svg +0 -3
- package/collection/assets/icons/instagram.svg +0 -3
- package/collection/assets/icons/letter.svg +0 -3
- package/collection/assets/icons/linkedin.svg +0 -5
- package/collection/assets/icons/logout.svg +0 -3
- package/collection/assets/icons/map.svg +0 -3
- package/collection/assets/icons/minus.svg +0 -3
- package/collection/assets/icons/navigation.svg +0 -3
- package/collection/assets/icons/plus.svg +0 -3
- package/collection/assets/icons/qr-scan.svg +0 -3
- package/collection/assets/icons/question.svg +0 -10
- package/collection/assets/icons/reader.svg +0 -3
- package/collection/assets/icons/reset.svg +0 -3
- package/collection/assets/icons/school.svg +0 -3
- package/collection/assets/icons/search.svg +0 -3
- package/collection/assets/icons/send.svg +0 -3
- package/collection/assets/icons/settings.svg +0 -3
- package/collection/assets/icons/share.svg +0 -10
- package/collection/assets/icons/shopping-cart.svg +0 -3
- package/collection/assets/icons/show.svg +0 -3
- package/collection/assets/icons/snapchat.svg +0 -3
- package/collection/assets/icons/sort.svg +0 -3
- package/collection/assets/icons/speech-bubble.svg +0 -3
- package/collection/assets/icons/star.svg +0 -3
- package/collection/assets/icons/student.svg +0 -3
- package/collection/assets/icons/upload.svg +0 -3
- package/collection/assets/icons/user.svg +0 -3
- package/collection/assets/icons/warn-circle.svg +0 -3
- package/collection/assets/icons/warn-triangle.svg +0 -3
- package/collection/assets/icons/whatsapp.svg +0 -4
- package/collection/assets/icons/world.svg +0 -10
- package/collection/assets/icons/x.svg +0 -3
- package/collection/assets/icons/youtube.svg +0 -3
- package/collection/components/lmvz-icon/icons.js +0 -36
- package/collection/components/lmvz-icon/public.js +0 -1
- package/collection/components/lmvz-icon/test/icons.unit.js +0 -98
- package/collection/integration/header-integration.js +0 -46
- package/collection/utils/effect.js +0 -6
- package/collection/utils/validation/svg.js +0 -24
- package/components/p-CYcWxAp5.js +0 -1
- package/components/p-DHtXOUVf.js +0 -1
- package/components/p-VkiNs_yz.js +0 -12
- package/esm/Effect-DkwJP3kx.js +0 -18828
- package/esm/assets-_WDisN-f.js +0 -23
- package/esm/icons-Crg18Lio.js +0 -649
- package/lmvz-components/p-121f74d8.entry.js +0 -1
- package/lmvz-components/p-373a9cbf.entry.js +0 -1
- package/lmvz-components/p-43e295ba.entry.js +0 -1
- package/lmvz-components/p-5f150890.entry.js +0 -1
- package/lmvz-components/p-6d5fa8c4.entry.js +0 -1
- package/lmvz-components/p-BT8PQPMJ.js +0 -1
- package/lmvz-components/p-BxiCs9Wn.js +0 -1
- package/lmvz-components/p-CXQcJLbG.js +0 -12
- package/lmvz-components/p-DkwJP3kx.js +0 -1
- package/lmvz-components/p-abbfa6aa.entry.js +0 -1
- package/types/components/lmvz-icon/icons.d.ts +0 -8
- package/types/components/lmvz-icon/public.d.ts +0 -1
- package/types/components/lmvz-icon/test/icons.unit.d.ts +0 -1
- package/types/utils/effect.d.ts +0 -3
- package/types/utils/validation/svg.d.ts +0 -11
package/hydrate/index.mjs
CHANGED
|
@@ -4151,7 +4151,7 @@ var braceExpand = (pattern, options = {}) => {
|
|
|
4151
4151
|
minimatch.braceExpand = braceExpand;
|
|
4152
4152
|
var makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
|
|
4153
4153
|
minimatch.makeRe = makeRe;
|
|
4154
|
-
var match
|
|
4154
|
+
var match = (list, pattern, options = {}) => {
|
|
4155
4155
|
const mm = new Minimatch(pattern, options);
|
|
4156
4156
|
list = list.filter((f) => mm.match(f));
|
|
4157
4157
|
if (mm.options.nonull && !list.length) {
|
|
@@ -4159,7 +4159,7 @@ var match$1 = (list, pattern, options = {}) => {
|
|
|
4159
4159
|
}
|
|
4160
4160
|
return list;
|
|
4161
4161
|
};
|
|
4162
|
-
minimatch.match = match
|
|
4162
|
+
minimatch.match = match;
|
|
4163
4163
|
var globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
|
|
4164
4164
|
var regExpEscape2 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
4165
4165
|
var _Minimatch_instances, matchGlobstar_fn, matchGlobStarBodySections_fn, matchOne_fn;
|
|
@@ -5357,7 +5357,7 @@ class LmvzAction {
|
|
|
5357
5357
|
this.actionClick.emit(event);
|
|
5358
5358
|
}
|
|
5359
5359
|
render() {
|
|
5360
|
-
return (hAsync(Host, { key: '
|
|
5360
|
+
return (hAsync(Host, { key: '00da873d80f00dc57e5a0d60f2b58a6c505e41f1', onClick: this._onClick.bind(this) }, hAsync("slot", { key: '7938b5e172ef2b027180aac801b0d9962cd68fa5' })));
|
|
5361
5361
|
}
|
|
5362
5362
|
static get style() { return lmvzActionCss(); }
|
|
5363
5363
|
static get cmpMeta() { return {
|
|
@@ -5481,7 +5481,10 @@ function resolvePossiblyAsyncFunction(func, args = []) {
|
|
|
5481
5481
|
return Promise.resolve(res);
|
|
5482
5482
|
}
|
|
5483
5483
|
|
|
5484
|
-
const
|
|
5484
|
+
const hasProcessStdout = typeof process === "object" && process !== null && typeof process.stdout === "object" && process.stdout !== null;
|
|
5485
|
+
hasProcessStdout && process.stdout.isTTY === true;
|
|
5486
|
+
|
|
5487
|
+
const GLOBAL_STATE_KEY = Symbol('LMVZ__ariaValidationRuntimeState');
|
|
5485
5488
|
const ARIA_VALIDATION_RUNTIME_CHANGED_EVENT = 'lmvz:aria-validation-runtime-changed';
|
|
5486
5489
|
function getRuntimeState() {
|
|
5487
5490
|
const globalState = globalThis;
|
|
@@ -5582,25 +5585,6 @@ class AriaValidationController {
|
|
|
5582
5585
|
this.host.validationSlot?.addEventListener('slotchange', this.enqueueValidation.bind(this));
|
|
5583
5586
|
}
|
|
5584
5587
|
observeVisibilityOnce() {
|
|
5585
|
-
window.setTimeout(() => {
|
|
5586
|
-
if (!this.host.validationEl)
|
|
5587
|
-
return;
|
|
5588
|
-
this.visibilityObserver = new IntersectionObserver((entries) => {
|
|
5589
|
-
for (const entry of entries) {
|
|
5590
|
-
if (entry.target !== this.host.validationEl)
|
|
5591
|
-
continue;
|
|
5592
|
-
if (!entry.isIntersecting)
|
|
5593
|
-
continue;
|
|
5594
|
-
this.checkLazyValidation();
|
|
5595
|
-
this.discardVisibilityObserver();
|
|
5596
|
-
}
|
|
5597
|
-
}, {
|
|
5598
|
-
root: this.host.validationEl?.parentElement,
|
|
5599
|
-
rootMargin: '0px',
|
|
5600
|
-
threshold: 0.01,
|
|
5601
|
-
});
|
|
5602
|
-
this.visibilityObserver.observe(this.host.validationEl);
|
|
5603
|
-
});
|
|
5604
5588
|
}
|
|
5605
5589
|
checkLazyValidation() {
|
|
5606
5590
|
if (!this.elementLoaded)
|
|
@@ -5661,10 +5645,6 @@ class AriaValidationController {
|
|
|
5661
5645
|
});
|
|
5662
5646
|
}
|
|
5663
5647
|
discardVisibilityObserver() {
|
|
5664
|
-
if (!this.visibilityObserver)
|
|
5665
|
-
return;
|
|
5666
|
-
this.visibilityObserver.disconnect();
|
|
5667
|
-
this.visibilityObserver = undefined;
|
|
5668
5648
|
}
|
|
5669
5649
|
}
|
|
5670
5650
|
|
|
@@ -5869,7 +5849,7 @@ class ReactiveControllerHost {
|
|
|
5869
5849
|
}
|
|
5870
5850
|
}
|
|
5871
5851
|
|
|
5872
|
-
const lmvzButtonCss = () => ` @layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.theme { @font-face { font-family: Router; src: local('Router-Book'), url('/assets/fonts/Router-Book.woff') format('woff'), local('Router'); font-weight: 400 normal; } @font-face { font-family: Router; src: local('Router-Medium'), url('/assets/fonts/Router-Medium.woff') format('woff'), local('Router'); font-weight: 500; } @font-face { font-family: Router; src: local('Router-Bold'), url('/assets/fonts/Router-Bold.woff') format('woff'), local('Router'); font-weight: 700 bold; } } @layer lmvz-ds.reset { body { margin: 0; } h1, h2, h3, h4, h5, h6 { margin: 0; } } :host { button { --lmvz-button-color: var(--lmvz-component-color, var(--lmvz-semantic-color-int-on-primary, #ffffff)); --lmvz-button-padding-inline: var(--lmvz-button-padding, var(--lmvz-component-input-md-padding-x, clamp(0.75rem, 0.69rem + 0.26vw, 1rem))); --lmvz-button-padding-block: var(--lmvz-button-padding, var(--lmvz-component-input-md-padding-y, clamp(0.75rem, 0.69rem + 0.26vw, 1rem))); --lmvz-button-gap: var(--lmvz-component-input-md-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); --lmvz-button-font: var(--lmvz-typography-body-lg, 400 clamp(1rem, 0.97rem + 0.13vw, 1.13rem) / 1.4 Router); --lmvz-button-radius: var(--lmvz-component-input-radius-default, 999px); --lmvz-button-border-width: 0; --lmvz-button-border-color: transparent; --lmvz-button-background: var(--lmvz-semantic-color-int-primary, #000000); display: inline-flex; align-items: center; justify-content: center; gap: var(--lmvz-button-gap); padding-block: var(--lmvz-button-padding-block); padding-inline: var(--lmvz-button-padding-inline); border-radius: var(--lmvz-button-radius); border: var(--lmvz-button-border-width) solid var(--lmvz-button-border-color); background-color: var(--lmvz-button-background); color: var(--lmvz-button-color); cursor: pointer; font: var(--lmvz-button-font); text-align: center; text-decoration: none; white-space: nowrap; transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease; } button > * { font: inherit; color: inherit; } button:focus-visible { outline: var(--lmvz-semantic-border-width-default, 1px) solid var(--lmvz-semantic-color-status-
|
|
5852
|
+
const lmvzButtonCss = () => ` @layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.theme { @font-face { font-family: Router; src: local('Router-Book'), url('/assets/fonts/Router-Book.woff') format('woff'), local('Router'); font-weight: 400 normal; } @font-face { font-family: Router; src: local('Router-Medium'), url('/assets/fonts/Router-Medium.woff') format('woff'), local('Router'); font-weight: 500; } @font-face { font-family: Router; src: local('Router-Bold'), url('/assets/fonts/Router-Bold.woff') format('woff'), local('Router'); font-weight: 700 bold; } } @layer lmvz-ds.reset { body { margin: 0; } h1, h2, h3, h4, h5, h6 { margin: 0; } } :host { button { --lmvz-button-color: var(--lmvz-component-color, var(--lmvz-semantic-color-int-on-primary, #ffffff)); --lmvz-button-padding-inline: var(--lmvz-button-padding, var(--lmvz-component-input-md-padding-x, clamp(0.75rem, 0.69rem + 0.26vw, 1rem))); --lmvz-button-padding-block: var(--lmvz-button-padding, var(--lmvz-component-input-md-padding-y, clamp(0.75rem, 0.69rem + 0.26vw, 1rem))); --lmvz-button-gap: var(--lmvz-component-input-md-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); --lmvz-button-font: var(--lmvz-typography-body-lg, 400 clamp(1rem, 0.97rem + 0.13vw, 1.13rem) / 1.4 Router); --lmvz-button-radius: var(--lmvz-component-input-radius-default, 999px); --lmvz-button-border-width: 0; --lmvz-button-border-color: transparent; --lmvz-button-background: var(--lmvz-semantic-color-int-primary, #000000); display: inline-flex; align-items: center; justify-content: center; gap: var(--lmvz-button-gap); padding-block: var(--lmvz-button-padding-block); padding-inline: var(--lmvz-button-padding-inline); border-radius: var(--lmvz-button-radius); border: var(--lmvz-button-border-width) solid var(--lmvz-button-border-color); background-color: var(--lmvz-button-background); color: var(--lmvz-button-color); cursor: pointer; font: var(--lmvz-button-font); text-align: center; text-decoration: none; white-space: nowrap; transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease; } button > * { font: inherit; color: inherit; } button:focus-visible { outline: var(--lmvz-semantic-border-width-default, 1px) solid var(--lmvz-semantic-color-status-active, #f1f9fe); outline-offset: var(--lmvz-component-input-sm-padding-x, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); } button:is([disabled], .disabled) { cursor: not-allowed; pointer-events: none; opacity: var(--lmvz-component-input-disabled-opacity, 40%); } button:not([disabled]):hover { --lmvz-button-background: var(--lmvz-semantic-color-int-primary-hover, #2e2e2e); } button:not([disabled]):active { --lmvz-button-background: var(--lmvz-semantic-color-int-primary-active, #545454); } button.secondary { --lmvz-button-background: var(--lmvz-semantic-color-int-secondary, #f0f0f0); --lmvz-button-color: var(--lmvz-semantic-color-int-on-secondary, #000000); --lmvz-button-border-width: var(--lmvz-semantic-border-width-default, 1px); --lmvz-button-border-color: var(--lmvz-semantic-color-border-default, #e0e0e0); } button.secondary:not([disabled], .disabled):hover { --lmvz-button-background: var(--lmvz-semantic-color-int-secondary-hover, #e0e0e0); --lmvz-button-border-color: var(--lmvz-semantic-color-border-hover, #c7c7c7); } button.secondary:not([disabled], .disabled):active { --lmvz-button-background: var(--lmvz-semantic-color-int-secondary-active, #d4d4d4); --lmvz-button-border-color: var(--lmvz-semantic-color-border-active, #0f8acc); } button.tertiary { --lmvz-button-background: var(--lmvz-semantic-color-int-tertiary, #ffffff); --lmvz-button-color: var(--lmvz-semantic-color-int-on-tertiary, #545454); } button.tertiary:not([disabled], .disabled):hover { --lmvz-button-background: var(--lmvz-semantic-color-int-tertiary-hover, #f0f0f0); } button.tertiary:not([disabled], .disabled):active { --lmvz-button-background: var(--lmvz-semantic-color-int-tertiary-active, #e0e0e0); } button.small { --lmvz-button-padding-inline: var(--lmvz-component-input-sm-padding-x, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); --lmvz-button-padding-block: var(--lmvz-component-input-sm-padding-y, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); --lmvz-button-gap: var(--lmvz-component-input-sm-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); --lmvz-button-font: var(--lmvz-typography-body-md, 400 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.4 Router); } button.large { --lmvz-button-padding-inline: var(--lmvz-component-input-lg-padding-x, clamp(0.88rem, 0.78rem + 0.39vw, 1.25rem)); --lmvz-button-padding-block: var(--lmvz-component-input-lg-padding-y, clamp(0.88rem, 0.78rem + 0.39vw, 1.25rem)); --lmvz-button-gap: var(--lmvz-component-input-lg-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); --lmvz-button-font: var(--lmvz-typography-body-lg, 400 clamp(1rem, 0.97rem + 0.13vw, 1.13rem) / 1.4 Router); } display: contents; } ::slotted(*) { --lmvz-component-color: var(--lmvz-button-color); } `;
|
|
5873
5853
|
|
|
5874
5854
|
class LmvzButton extends ReactiveControllerHost {
|
|
5875
5855
|
get el() { return getElement(this); }
|
|
@@ -5926,7 +5906,7 @@ class LmvzButton extends ReactiveControllerHost {
|
|
|
5926
5906
|
};
|
|
5927
5907
|
render() {
|
|
5928
5908
|
this.renderHiddenButton();
|
|
5929
|
-
return (hAsync(Host, { key: '
|
|
5909
|
+
return (hAsync(Host, { key: '1448b16151418790d0a78eda2248b7d61fd8e32b', "aria-disabled": this.disabled ? 'true' : null }, hAsync("button", { key: '2cf7ccc0692179b68aaea534a7a4d11dbcbe27b5', ref: (e) => (this.validationEl = e), disabled: this.disabled, class: classNames(this.variant, { [this.scale ?? '']: !!this.scale, disabled: this.disabled }), ...this.inheritedAttributes }, hAsync("slot", { key: '8fd9f99f8c79657fd3dbeafb2fd88ca667bc0d44' }))));
|
|
5930
5910
|
}
|
|
5931
5911
|
static get delegatesFocus() { return true; }
|
|
5932
5912
|
static get style() { return lmvzButtonCss(); }
|
|
@@ -5967,7 +5947,7 @@ function joinPath(...parts) {
|
|
|
5967
5947
|
return parts.filter(Boolean).join('/').replace('//', '/').replace('/./', '/');
|
|
5968
5948
|
}
|
|
5969
5949
|
|
|
5970
|
-
const lmvzCardCss = () => `@layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.theme { @font-face { font-family: Router; src: local('Router-Book'), url('/assets/fonts/Router-Book.woff') format('woff'), local('Router'); font-weight: 400 normal; } @font-face { font-family: Router; src: local('Router-Medium'), url('/assets/fonts/Router-Medium.woff') format('woff'), local('Router'); font-weight: 500; } @font-face { font-family: Router; src: local('Router-Bold'), url('/assets/fonts/Router-Bold.woff') format('woff'), local('Router'); font-weight: 700 bold; } } @layer lmvz-ds.reset { body { margin: 0; } h1, h2, h3, h4, h5, h6 { margin: 0; } } .sc-lmvz-card-h { button { --lmvz-button-color: var(--lmvz-component-color, var(--lmvz-semantic-color-int-on-primary, #ffffff)); --lmvz-button-padding-inline: var(--lmvz-button-padding, var(--lmvz-component-input-md-padding-x, clamp(0.75rem, 0.69rem + 0.26vw, 1rem))); --lmvz-button-padding-block: var(--lmvz-button-padding, var(--lmvz-component-input-md-padding-y, clamp(0.75rem, 0.69rem + 0.26vw, 1rem))); --lmvz-button-gap: var(--lmvz-component-input-md-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); --lmvz-button-font: var(--lmvz-typography-body-lg, 400 clamp(1rem, 0.97rem + 0.13vw, 1.13rem) / 1.4 Router); --lmvz-button-radius: var(--lmvz-component-input-radius-default, 999px); --lmvz-button-border-width: 0; --lmvz-button-border-color: transparent; --lmvz-button-background: var(--lmvz-semantic-color-int-primary, #000000); display: inline-flex; align-items: center; justify-content: center; gap: var(--lmvz-button-gap); padding-block: var(--lmvz-button-padding-block); padding-inline: var(--lmvz-button-padding-inline); border-radius: var(--lmvz-button-radius); border: var(--lmvz-button-border-width) solid var(--lmvz-button-border-color); background-color: var(--lmvz-button-background); color: var(--lmvz-button-color); cursor: pointer; font: var(--lmvz-button-font); text-align: center; text-decoration: none; white-space: nowrap; transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease; } button > * { font: inherit; color: inherit; } button:focus-visible { outline: var(--lmvz-semantic-border-width-default, 1px) solid var(--lmvz-semantic-color-status-
|
|
5950
|
+
const lmvzCardCss = () => `@layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.theme { @font-face { font-family: Router; src: local('Router-Book'), url('/assets/fonts/Router-Book.woff') format('woff'), local('Router'); font-weight: 400 normal; } @font-face { font-family: Router; src: local('Router-Medium'), url('/assets/fonts/Router-Medium.woff') format('woff'), local('Router'); font-weight: 500; } @font-face { font-family: Router; src: local('Router-Bold'), url('/assets/fonts/Router-Bold.woff') format('woff'), local('Router'); font-weight: 700 bold; } } @layer lmvz-ds.reset { body { margin: 0; } h1, h2, h3, h4, h5, h6 { margin: 0; } } .sc-lmvz-card-h { button { --lmvz-button-color: var(--lmvz-component-color, var(--lmvz-semantic-color-int-on-primary, #ffffff)); --lmvz-button-padding-inline: var(--lmvz-button-padding, var(--lmvz-component-input-md-padding-x, clamp(0.75rem, 0.69rem + 0.26vw, 1rem))); --lmvz-button-padding-block: var(--lmvz-button-padding, var(--lmvz-component-input-md-padding-y, clamp(0.75rem, 0.69rem + 0.26vw, 1rem))); --lmvz-button-gap: var(--lmvz-component-input-md-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); --lmvz-button-font: var(--lmvz-typography-body-lg, 400 clamp(1rem, 0.97rem + 0.13vw, 1.13rem) / 1.4 Router); --lmvz-button-radius: var(--lmvz-component-input-radius-default, 999px); --lmvz-button-border-width: 0; --lmvz-button-border-color: transparent; --lmvz-button-background: var(--lmvz-semantic-color-int-primary, #000000); display: inline-flex; align-items: center; justify-content: center; gap: var(--lmvz-button-gap); padding-block: var(--lmvz-button-padding-block); padding-inline: var(--lmvz-button-padding-inline); border-radius: var(--lmvz-button-radius); border: var(--lmvz-button-border-width) solid var(--lmvz-button-border-color); background-color: var(--lmvz-button-background); color: var(--lmvz-button-color); cursor: pointer; font: var(--lmvz-button-font); text-align: center; text-decoration: none; white-space: nowrap; transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease; } button > * { font: inherit; color: inherit; } button:focus-visible { outline: var(--lmvz-semantic-border-width-default, 1px) solid var(--lmvz-semantic-color-status-active, #f1f9fe); outline-offset: var(--lmvz-component-input-sm-padding-x, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); } button:is([disabled], .disabled) { cursor: not-allowed; pointer-events: none; opacity: var(--lmvz-component-input-disabled-opacity, 40%); } button:not([disabled]):hover { --lmvz-button-background: var(--lmvz-semantic-color-int-primary-hover, #2e2e2e); } button:not([disabled]):active { --lmvz-button-background: var(--lmvz-semantic-color-int-primary-active, #545454); } button.secondary { --lmvz-button-background: var(--lmvz-semantic-color-int-secondary, #f0f0f0); --lmvz-button-color: var(--lmvz-semantic-color-int-on-secondary, #000000); --lmvz-button-border-width: var(--lmvz-semantic-border-width-default, 1px); --lmvz-button-border-color: var(--lmvz-semantic-color-border-default, #e0e0e0); } button.secondary:not([disabled], .disabled):hover { --lmvz-button-background: var(--lmvz-semantic-color-int-secondary-hover, #e0e0e0); --lmvz-button-border-color: var(--lmvz-semantic-color-border-hover, #c7c7c7); } button.secondary:not([disabled], .disabled):active { --lmvz-button-background: var(--lmvz-semantic-color-int-secondary-active, #d4d4d4); --lmvz-button-border-color: var(--lmvz-semantic-color-border-active, #0f8acc); } button.tertiary { --lmvz-button-background: var(--lmvz-semantic-color-int-tertiary, #ffffff); --lmvz-button-color: var(--lmvz-semantic-color-int-on-tertiary, #545454); } button.tertiary:not([disabled], .disabled):hover { --lmvz-button-background: var(--lmvz-semantic-color-int-tertiary-hover, #f0f0f0); } button.tertiary:not([disabled], .disabled):active { --lmvz-button-background: var(--lmvz-semantic-color-int-tertiary-active, #e0e0e0); } button.small { --lmvz-button-padding-inline: var(--lmvz-component-input-sm-padding-x, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); --lmvz-button-padding-block: var(--lmvz-component-input-sm-padding-y, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); --lmvz-button-gap: var(--lmvz-component-input-sm-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); --lmvz-button-font: var(--lmvz-typography-body-md, 400 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.4 Router); } button.large { --lmvz-button-padding-inline: var(--lmvz-component-input-lg-padding-x, clamp(0.88rem, 0.78rem + 0.39vw, 1.25rem)); --lmvz-button-padding-block: var(--lmvz-component-input-lg-padding-y, clamp(0.88rem, 0.78rem + 0.39vw, 1.25rem)); --lmvz-button-gap: var(--lmvz-component-input-lg-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); --lmvz-button-font: var(--lmvz-typography-body-lg, 400 clamp(1rem, 0.97rem + 0.13vw, 1.13rem) / 1.4 Router); } display: flex; min-width: var(--lmvz-card-component-card-minwidth, 20.4375rem); max-width: var(--lmvz-card-component-card-maxwidth, 21.6875rem); flex-direction: column; align-items: flex-start; border-radius: var(--lmvz-semantic-border-radius-lg, 14px); border: var(--lmvz-semantic-border-width-default, 1px) solid var(--lmvz-semantic-color-border-default, #e0e0e0); background: var(--lmvz-semantic-color-surface-primary, #ffffff); } *.sc-lmvz-card { color: var(--lmvz-semantic-color-on-surface-primary, #000000); font: var(--lmvz-typography-body-md, 400 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.4 Router); } .top.sc-lmvz-card { display: flex; padding: var(--lmvz-dimension-8-12, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); flex-direction: column; justify-content: center; align-items: center; align-self: stretch; } .bottom.sc-lmvz-card { display: flex; min-width: 150px; padding: var(--lmvz-dimension-4-6, clamp(0.25rem, 0.22rem + 0.13vw, 0.38rem)) var(--lmvz-dimension-10-14, clamp(0.63rem, 0.56rem + 0.26vw, 0.88rem)) var(--lmvz-dimension-10-14, clamp(0.63rem, 0.56rem + 0.26vw, 0.88rem)) var(--lmvz-dimension-10-14, clamp(0.63rem, 0.56rem + 0.26vw, 0.88rem)); flex-direction: column; align-items: flex-start; align-self: stretch; } .title.sc-lmvz-card { margin: 0; display: flex; justify-content: center; align-items: center; align-self: stretch; padding-bottom: var(--lmvz-global-s4, 4px); overflow-wrap: break-word; font: var(--lmvz-typography-heading-2xl, 500 clamp(2.25rem, 2.13rem + 0.52vw, 2.75rem) / 1.2 Router); } .description.sc-lmvz-card { display: flex; margin: 0; padding-bottom: var(--lmvz-component-body-sm-padding-bottom, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); align-items: flex-start; align-self: stretch; white-space: pre-line; font: var(--lmvz-typography-body-md, 400 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.4 Router); } .image-wrapper.sc-lmvz-card { aspect-ratio: 4 / 3; width: 100%; background-size: cover; background-position: center; flex: 1 0 0; align-self: stretch; border-radius: var(--lmvz-semantic-border-radius-md, 6px); } .actions.sc-lmvz-card { margin-top: var(--lmvz-component-form-wrapper-gap-y, clamp(1.13rem, 0.97rem + 0.65vw, 1.75rem)); display: flex; align-items: center; gap: var(--lmvz-component-input-md-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); align-self: stretch; } button.primary.sc-lmvz-card, lmvz-button.primary.sc-lmvz-card { display: flex; justify-content: center; align-items: center; gap: var(--lmvz-component-input-md-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); flex: 1 0 0; }`;
|
|
5971
5951
|
|
|
5972
5952
|
class LmvzCard {
|
|
5973
5953
|
constructor(hostRef) {
|
|
@@ -5992,7 +5972,7 @@ class LmvzCard {
|
|
|
5992
5972
|
const imgStyle = {
|
|
5993
5973
|
backgroundImage: `url(${this.imageUrl ?? this.fallbackImage})`,
|
|
5994
5974
|
};
|
|
5995
|
-
return (hAsync(Host, { key: '
|
|
5975
|
+
return (hAsync(Host, { key: 'fceb19eb0d7ad6c6aecfa6fbd5bb6425c7c3e312', role: "article" }, hAsync("div", { key: '4cb516b5dee1f2f84f21984fa350f61fd83c771c', class: "top" }, hAsync("div", { key: '713b2a3245d885a9b99f6c7d54a35053699c1be8', class: "image-wrapper", style: imgStyle }, hAsync("div", { key: 'e8ea65e7f5d11a2335cab950d6bf02208d0b18a1', class: "chip-slot" }, hAsync("slot", { key: 'e9a039742107fdf56216186ddcdf367c4432790b', name: "chip" })))), hAsync("div", { key: '9549e46a1872e0edf298b79435d298aa1ae96a37', class: "bottom" }, hAsync("header", { key: '3bbfb72ecec519d16380ae7e00da4b1ccb6f1cf3' }, hAsync("h2", { key: 'f5a33e498893e61b407c10ab36c9a93b7eecf9f1', class: "title" }, this.cardTitle)), hAsync("p", { key: '19709bb100d014369c836a5a7174772f2d095d2e', class: "description" }, this.description), hAsync("div", { key: '06b5acab3c80cc91865f3aa39da32d42f470348e', class: "actions" }, hAsync("button", { key: '4e954452ac9771359c881aa6b43f11e89e38aecf', class: "primary", onClick: this._onPrimaryClick.bind(this), "data-testid": "primary" }, this.primaryActionLabel), hAsync("button", { key: 'b6a682bf95eb26468c450bed494290565288a515', class: "tertiary", "aria-label": "More actions", onClick: this._onOverflowClick }, hAsync("span", { key: '70a526d1fafd8b7051f6e7107b35d6f594e10d68', class: "icon-placeholder" }, "..."))))));
|
|
5996
5976
|
}
|
|
5997
5977
|
static get assetsDirs() { return ["../../assets"]; }
|
|
5998
5978
|
static get style() { return lmvzCardCss(); }
|
|
@@ -6019,7 +5999,7 @@ class LmvzChip {
|
|
|
6019
5999
|
}
|
|
6020
6000
|
text;
|
|
6021
6001
|
render() {
|
|
6022
|
-
return hAsync(Host, { key: '
|
|
6002
|
+
return hAsync(Host, { key: '134d510fe3a04b989b0005bf31358149a9661cb2' }, this.text);
|
|
6023
6003
|
}
|
|
6024
6004
|
static get style() { return lmvzChipCss(); }
|
|
6025
6005
|
static get cmpMeta() { return {
|
|
@@ -6034,8 +6014,6 @@ class LmvzChip {
|
|
|
6034
6014
|
}; }
|
|
6035
6015
|
}
|
|
6036
6016
|
|
|
6037
|
-
const logoSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDYiIGhlaWdodD0iNzIiIHZpZXdCb3g9IjAgMCA0NiA3MiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwXzI3Ml80MDUpIj4KPHBhdGggZD0iTTEyLjUgMjAuNjVDMTMuMSAyMC42NSAxNC4yIDIwLjM1IDE0LjcgMjAuMzVDMTYuMSAyMC4zNSAxNy4yIDIxLjQ1IDE3LjIgMjIuODVDMTcuMiAyNC4yNSAxNi4xIDI1LjM1IDE0LjcgMjUuMzVIMi44QzEuMiAyNS4zNSAwIDI0LjE1IDAgMjIuNTVDMCAyMS45NSAwLjIgMjAuNjUgMC4yIDIwLjA1VjUuODQ5OTlDMC4yIDUuMTQ5OTkgMCAzLjk0OTk5IDAgMy4zNDk5OUMwIDEuNzQ5OTkgMS4yIDAuNTQ5OTg4IDIuOCAwLjU0OTk4OEM0LjMgMC41NDk5ODggNS42IDEuNzQ5OTkgNS42IDMuMzQ5OTlDNS42IDMuOTQ5OTkgNS40IDUuMTQ5OTkgNS40IDUuODQ5OTlWMjAuNTVIMTIuNVYyMC42NVpNMjIuMSAyMi43NUMyMi4xIDIyLjE1IDIyLjMgMjAuOTUgMjIuMyAyMC4yNVY1Ljg0OTk5QzIyLjMgNS4xNDk5OSAyMi4xIDMuOTQ5OTkgMjIuMSAzLjQ0OTk5QzIyLjEgMS45NDk5OSAyMy4yIDAuNzQ5OTg4IDI0LjYgMC43NDk5ODhIMjUuMkMyNi40IDAuNzQ5OTg4IDI3LjIgMS41NDk5OSAyNy42IDIuNjQ5OTlMMjggMy40NDk5OUwzMi45IDE0LjA1QzMzLjMgMTQuOTUgMzMuNyAxNi4wNSAzNCAxNi43NUMzNC4zIDE2LjA1IDM0LjcgMTQuOTUgMzUuMSAxNC4wNUw0MCAzLjU0OTk5TDQwLjMgMi41NDk5OUM0MC43IDEuNTQ5OTkgNDEuNSAwLjY0OTk4OCA0Mi42IDAuNjQ5OTg4SDQzLjJDNDQuNyAwLjY0OTk4OCA0NS43IDEuODQ5OTkgNDUuNyAzLjM0OTk5QzQ1LjcgMy45NDk5OSA0NS41IDUuMTQ5OTkgNDUuNSA1Ljc0OTk5VjIwLjE1QzQ1LjUgMjAuODUgNDUuNyAyMi4wNSA0NS43IDIyLjY1QzQ1LjcgMjQuMjUgNDQuNSAyNS40NSA0MyAyNS40NUM0MS40IDI1LjQ1IDQwLjMgMjQuMjUgNDAuMyAyMi42NUM0MC4zIDIxLjk1IDQwLjQgMjAuNzUgNDAuNCAyMC4xNUw0MC42IDE0LjA1QzQwLjYgMTMuMTUgNDAuNyAxMS43NSA0MC43IDEwLjY1TDM3IDE5LjA1QzM2LjcgMTkuNzUgMzYuNiAxOS45NSAzNi40IDIwLjM1QzM2IDIxLjI1IDM1LjMgMjEuODUgMzMuOSAyMS44NUMzMi41IDIxLjg1IDMxLjggMjEuMjUgMzEuNCAyMC40NUMzMS4yIDIwLjA1IDMxLjIgMTkuNzUgMzAuOCAxOS4wNUwyNyAxMC43NUMyNyAxMC43NSAyNy4xIDEzLjE1IDI3LjIgMTQuMDVMMjcuNCAyMC4xNUMyNy40IDIwLjg1IDI3LjUgMjEuOTUgMjcuNSAyMi42NUMyNy41IDI0LjI1IDI2LjQgMjUuNDUgMjQuOCAyNS40NUMyMy4zIDI1LjU1IDIyLjEgMjQuMjUgMjIuMSAyMi43NVpNMjguNyAzMi45NUMyOS4xIDMyLjk1IDMwLjIgMzMuMTUgMzAuNyAzMy4xNUg0MS44QzQyLjMgMzMuMTUgNDMuMiAzMi45NSA0My43IDMyLjk1QzQ0LjkgMzIuOTUgNDUuOCAzMy44NSA0NS44IDM1LjA1QzQ1LjggMzYuMTUgNDQuOSAzNy4xNSA0My43IDM3LjE1QzQzLjMgMzcuMTUgNDIuMyAzNi45NSA0MS44IDM2Ljk1SDMwLjhDMzAuMyAzNi45NSAyOS4yIDM3LjE1IDI4LjggMzcuMTVDMjcuNiAzNy4xNSAyNi43IDM2LjI1IDI2LjcgMzUuMDVDMjYuNiAzMy45NSAyNy41IDMyLjk1IDI4LjcgMzIuOTVaTTIuMSA2Ny4yNUMyLjUgNjcuMjUgMy42IDY3LjQ1IDQuMSA2Ny40NUgxOC41QzE5IDY3LjQ1IDE5LjkgNjcuMjUgMjAuNCA2Ny4yNUMyMS42IDY3LjI1IDIyLjUgNjguMTUgMjIuNSA2OS4zNUMyMi41IDcwLjQ1IDIxLjYgNzEuNDUgMjAuNCA3MS40NUMyMCA3MS40NSAxOSA3MS4yNSAxOC41IDcxLjI1SDQuMUMzLjYgNzEuMjUgMi41IDcxLjQ1IDIuMSA3MS40NUMwLjkgNzEuNDUgMCA3MC41NSAwIDY5LjM1QzAgNjguMjUgMC45IDY3LjI1IDIuMSA2Ny4yNVpNMjEuOSAzNS42NUMyMS45IDM1Ljk1IDIxLjggMzYuMzUgMjEuNiAzNi43NUMyMS4zIDM3LjQ1IDIwLjkgMzguMzUgMjAuNyAzOC44NUwxNC43IDU0LjY1QzE0LjUgNTUuMDUgMTQuNCA1NS41NSAxNC4yIDU2LjM1QzEzLjggNTcuNjUgMTIuNiA1OC4yNSAxMS4yIDU4LjI1SDEwLjhDOS40IDU4LjI1IDguMiA1Ny43NSA3LjggNTYuMzVDNy42IDU1LjU1IDcuNCA1NS4xNSA3LjIgNTQuNjVMMS4yIDM4Ljg1QzEgMzguMzUgMC42IDM3LjU1IDAuMiAzNi44NUMwLjEgMzYuNDUgMCAzNS45NSAwIDM1LjY1QzAgMzQuMTUgMS4yIDMyLjg1IDIuOCAzMi44NUMzLjkgMzIuODUgNSAzMy41NSA1LjMgMzQuNzVDNS41IDM1LjU1IDUuNSAzNi4xNSA2IDM3LjU1TDEwLjIgNDkuNDVDMTAuNSA1MC4zNSAxMC45IDUxLjQ1IDExLjEgNTIuMzVDMTEuMyA1MS40NSAxMS42IDUwLjQ1IDExLjkgNDkuNTVMMTYgMzcuNTVDMTYuNSAzNi4wNSAxNi40IDM1LjY1IDE2LjcgMzQuODVDMTcuMSAzMy42NSAxOC4xIDMyLjg1IDE5LjMgMzIuODVDMjAuOSAzMi44NSAyMS45IDM0LjE1IDIxLjkgMzUuNjVaTTI5LjcgNzEuNDVDMjguMiA3MS40NSAyNy4yIDcwLjQ1IDI3LjIgNjkuMTVDMjcuMiA2OC43NSAyNy4yIDY4LjI1IDI3LjggNjcuNDVMMzcuNCA1My40NUMzNy45IDUyLjc1IDM4LjUgNTIuMDUgMzkuMSA1MS4zNUgzMi4yQzMxLjUgNTEuMzUgMzAuNyA1MS42NSAzMC4xIDUxLjY1QzI4LjcgNTEuNjUgMjcuNiA1MC43NSAyNy42IDQ5LjM1QzI3LjYgNDcuOTUgMjguNyA0Ni45NSAzMC4xIDQ2Ljk1SDQyLjdDNDQuMiA0Ni45NSA0NS4yIDQ3Ljg1IDQ1LjIgNDkuMjVDNDUuMiA0OS42NSA0NSA1MC4zNSA0NC41IDUxLjA1TDM1LjIgNjQuODVDMzQuNyA2NS42NSAzNC4xIDY2LjQ1IDMzLjUgNjcuMDVINDEuMUM0MS45IDY3LjA1IDQyLjcgNjYuNzUgNDMuMyA2Ni43NUM0NC43IDY2Ljc1IDQ1LjcgNjcuNzUgNDUuNyA2OS4wNUM0NS43IDcwLjU1IDQ0LjUgNzEuNTUgNDMuMiA3MS41NUgyOS43VjcxLjQ1WiIgZmlsbD0iYmxhY2siLz4KPC9nPgo8ZGVmcz4KPGNsaXBQYXRoIGlkPSJjbGlwMF8yNzJfNDA1Ij4KPHJlY3Qgd2lkdGg9IjQ2IiBoZWlnaHQ9IjcyIiBmaWxsPSJ3aGl0ZSIvPgo8L2NsaXBQYXRoPgo8L2RlZnM+Cjwvc3ZnPgo=';
|
|
6038
|
-
|
|
6039
6017
|
class ListKeyboardNavigationController {
|
|
6040
6018
|
host;
|
|
6041
6019
|
elements = [];
|
|
@@ -6082,6 +6060,8 @@ class ListKeyboardNavigationController {
|
|
|
6082
6060
|
}
|
|
6083
6061
|
}
|
|
6084
6062
|
|
|
6063
|
+
const logoSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDYiIGhlaWdodD0iNzIiIHZpZXdCb3g9IjAgMCA0NiA3MiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwXzI3Ml80MDUpIj4KPHBhdGggZD0iTTEyLjUgMjAuNjVDMTMuMSAyMC42NSAxNC4yIDIwLjM1IDE0LjcgMjAuMzVDMTYuMSAyMC4zNSAxNy4yIDIxLjQ1IDE3LjIgMjIuODVDMTcuMiAyNC4yNSAxNi4xIDI1LjM1IDE0LjcgMjUuMzVIMi44QzEuMiAyNS4zNSAwIDI0LjE1IDAgMjIuNTVDMCAyMS45NSAwLjIgMjAuNjUgMC4yIDIwLjA1VjUuODQ5OTlDMC4yIDUuMTQ5OTkgMCAzLjk0OTk5IDAgMy4zNDk5OUMwIDEuNzQ5OTkgMS4yIDAuNTQ5OTg4IDIuOCAwLjU0OTk4OEM0LjMgMC41NDk5ODggNS42IDEuNzQ5OTkgNS42IDMuMzQ5OTlDNS42IDMuOTQ5OTkgNS40IDUuMTQ5OTkgNS40IDUuODQ5OTlWMjAuNTVIMTIuNVYyMC42NVpNMjIuMSAyMi43NUMyMi4xIDIyLjE1IDIyLjMgMjAuOTUgMjIuMyAyMC4yNVY1Ljg0OTk5QzIyLjMgNS4xNDk5OSAyMi4xIDMuOTQ5OTkgMjIuMSAzLjQ0OTk5QzIyLjEgMS45NDk5OSAyMy4yIDAuNzQ5OTg4IDI0LjYgMC43NDk5ODhIMjUuMkMyNi40IDAuNzQ5OTg4IDI3LjIgMS41NDk5OSAyNy42IDIuNjQ5OTlMMjggMy40NDk5OUwzMi45IDE0LjA1QzMzLjMgMTQuOTUgMzMuNyAxNi4wNSAzNCAxNi43NUMzNC4zIDE2LjA1IDM0LjcgMTQuOTUgMzUuMSAxNC4wNUw0MCAzLjU0OTk5TDQwLjMgMi41NDk5OUM0MC43IDEuNTQ5OTkgNDEuNSAwLjY0OTk4OCA0Mi42IDAuNjQ5OTg4SDQzLjJDNDQuNyAwLjY0OTk4OCA0NS43IDEuODQ5OTkgNDUuNyAzLjM0OTk5QzQ1LjcgMy45NDk5OSA0NS41IDUuMTQ5OTkgNDUuNSA1Ljc0OTk5VjIwLjE1QzQ1LjUgMjAuODUgNDUuNyAyMi4wNSA0NS43IDIyLjY1QzQ1LjcgMjQuMjUgNDQuNSAyNS40NSA0MyAyNS40NUM0MS40IDI1LjQ1IDQwLjMgMjQuMjUgNDAuMyAyMi42NUM0MC4zIDIxLjk1IDQwLjQgMjAuNzUgNDAuNCAyMC4xNUw0MC42IDE0LjA1QzQwLjYgMTMuMTUgNDAuNyAxMS43NSA0MC43IDEwLjY1TDM3IDE5LjA1QzM2LjcgMTkuNzUgMzYuNiAxOS45NSAzNi40IDIwLjM1QzM2IDIxLjI1IDM1LjMgMjEuODUgMzMuOSAyMS44NUMzMi41IDIxLjg1IDMxLjggMjEuMjUgMzEuNCAyMC40NUMzMS4yIDIwLjA1IDMxLjIgMTkuNzUgMzAuOCAxOS4wNUwyNyAxMC43NUMyNyAxMC43NSAyNy4xIDEzLjE1IDI3LjIgMTQuMDVMMjcuNCAyMC4xNUMyNy40IDIwLjg1IDI3LjUgMjEuOTUgMjcuNSAyMi42NUMyNy41IDI0LjI1IDI2LjQgMjUuNDUgMjQuOCAyNS40NUMyMy4zIDI1LjU1IDIyLjEgMjQuMjUgMjIuMSAyMi43NVpNMjguNyAzMi45NUMyOS4xIDMyLjk1IDMwLjIgMzMuMTUgMzAuNyAzMy4xNUg0MS44QzQyLjMgMzMuMTUgNDMuMiAzMi45NSA0My43IDMyLjk1QzQ0LjkgMzIuOTUgNDUuOCAzMy44NSA0NS44IDM1LjA1QzQ1LjggMzYuMTUgNDQuOSAzNy4xNSA0My43IDM3LjE1QzQzLjMgMzcuMTUgNDIuMyAzNi45NSA0MS44IDM2Ljk1SDMwLjhDMzAuMyAzNi45NSAyOS4yIDM3LjE1IDI4LjggMzcuMTVDMjcuNiAzNy4xNSAyNi43IDM2LjI1IDI2LjcgMzUuMDVDMjYuNiAzMy45NSAyNy41IDMyLjk1IDI4LjcgMzIuOTVaTTIuMSA2Ny4yNUMyLjUgNjcuMjUgMy42IDY3LjQ1IDQuMSA2Ny40NUgxOC41QzE5IDY3LjQ1IDE5LjkgNjcuMjUgMjAuNCA2Ny4yNUMyMS42IDY3LjI1IDIyLjUgNjguMTUgMjIuNSA2OS4zNUMyMi41IDcwLjQ1IDIxLjYgNzEuNDUgMjAuNCA3MS40NUMyMCA3MS40NSAxOSA3MS4yNSAxOC41IDcxLjI1SDQuMUMzLjYgNzEuMjUgMi41IDcxLjQ1IDIuMSA3MS40NUMwLjkgNzEuNDUgMCA3MC41NSAwIDY5LjM1QzAgNjguMjUgMC45IDY3LjI1IDIuMSA2Ny4yNVpNMjEuOSAzNS42NUMyMS45IDM1Ljk1IDIxLjggMzYuMzUgMjEuNiAzNi43NUMyMS4zIDM3LjQ1IDIwLjkgMzguMzUgMjAuNyAzOC44NUwxNC43IDU0LjY1QzE0LjUgNTUuMDUgMTQuNCA1NS41NSAxNC4yIDU2LjM1QzEzLjggNTcuNjUgMTIuNiA1OC4yNSAxMS4yIDU4LjI1SDEwLjhDOS40IDU4LjI1IDguMiA1Ny43NSA3LjggNTYuMzVDNy42IDU1LjU1IDcuNCA1NS4xNSA3LjIgNTQuNjVMMS4yIDM4Ljg1QzEgMzguMzUgMC42IDM3LjU1IDAuMiAzNi44NUMwLjEgMzYuNDUgMCAzNS45NSAwIDM1LjY1QzAgMzQuMTUgMS4yIDMyLjg1IDIuOCAzMi44NUMzLjkgMzIuODUgNSAzMy41NSA1LjMgMzQuNzVDNS41IDM1LjU1IDUuNSAzNi4xNSA2IDM3LjU1TDEwLjIgNDkuNDVDMTAuNSA1MC4zNSAxMC45IDUxLjQ1IDExLjEgNTIuMzVDMTEuMyA1MS40NSAxMS42IDUwLjQ1IDExLjkgNDkuNTVMMTYgMzcuNTVDMTYuNSAzNi4wNSAxNi40IDM1LjY1IDE2LjcgMzQuODVDMTcuMSAzMy42NSAxOC4xIDMyLjg1IDE5LjMgMzIuODVDMjAuOSAzMi44NSAyMS45IDM0LjE1IDIxLjkgMzUuNjVaTTI5LjcgNzEuNDVDMjguMiA3MS40NSAyNy4yIDcwLjQ1IDI3LjIgNjkuMTVDMjcuMiA2OC43NSAyNy4yIDY4LjI1IDI3LjggNjcuNDVMMzcuNCA1My40NUMzNy45IDUyLjc1IDM4LjUgNTIuMDUgMzkuMSA1MS4zNUgzMi4yQzMxLjUgNTEuMzUgMzAuNyA1MS42NSAzMC4xIDUxLjY1QzI4LjcgNTEuNjUgMjcuNiA1MC43NSAyNy42IDQ5LjM1QzI3LjYgNDcuOTUgMjguNyA0Ni45NSAzMC4xIDQ2Ljk1SDQyLjdDNDQuMiA0Ni45NSA0NS4yIDQ3Ljg1IDQ1LjIgNDkuMjVDNDUuMiA0OS42NSA0NSA1MC4zNSA0NC41IDUxLjA1TDM1LjIgNjQuODVDMzQuNyA2NS42NSAzNC4xIDY2LjQ1IDMzLjUgNjcuMDVINDEuMUM0MS45IDY3LjA1IDQyLjcgNjYuNzUgNDMuMyA2Ni43NUM0NC43IDY2Ljc1IDQ1LjcgNjcuNzUgNDUuNyA2OS4wNUM0NS43IDcwLjU1IDQ0LjUgNzEuNTUgNDMuMiA3MS41NUgyOS43VjcxLjQ1WiIgZmlsbD0iYmxhY2siLz4KPC9nPgo8ZGVmcz4KPGNsaXBQYXRoIGlkPSJjbGlwMF8yNzJfNDA1Ij4KPHJlY3Qgd2lkdGg9IjQ2IiBoZWlnaHQ9IjcyIiBmaWxsPSJ3aGl0ZSIvPgo8L2NsaXBQYXRoPgo8L2RlZnM+Cjwvc3ZnPgo=';
|
|
6064
|
+
|
|
6085
6065
|
const lmvzHeaderCss = () => `:host{display:flex;width:100vw;flex-direction:row;align-items:center;box-sizing:border-box;background-color:var(--lmvz-semantic-color-surface-primary, #ffffff);--lmvz-header-x-spacing-level-1:var(--lmvz-dimension-8-28, clamp(0.5rem, 0.2rem + 1.29vw, 1.75rem));--lmvz-header-x-spacing-level-2:var(--lmvz-component-buttongroup-wrapper-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem));padding:var(--lmvz-dimension-8-16, clamp(0.5rem, 0.38rem + 0.52vw, 1rem)) var(--lmvz-header-x-spacing-level-1);gap:var(--lmvz-header-x-spacing-level-1);.brand{display:inline-flex;justify-content:center;align-items:center}#fallback-logo-lmvz{height:34px;width:auto}nav{flex-grow:1}.primary-menubar{display:flex;flex-direction:row;align-items:center}.secondary-menubar{display:flex;flex-direction:row;align-items:center;margin-left:var(--lmvz-header-x-spacing-level-2);padding-left:var(--lmvz-header-x-spacing-level-2);border-left:1px solid var(--lmvz-semantic-color-border-default, #e0e0e0)}}`;
|
|
6086
6066
|
|
|
6087
6067
|
class LmvzHeader extends ReactiveControllerHost {
|
|
@@ -6166,7 +6146,7 @@ class LmvzHeader extends ReactiveControllerHost {
|
|
|
6166
6146
|
}
|
|
6167
6147
|
}
|
|
6168
6148
|
render() {
|
|
6169
|
-
return (hAsync(Host, { key: '
|
|
6149
|
+
return (hAsync(Host, { key: '58cf99b555112f6209b6d16047bda2cc0bbf5cde', onFocus: this.delegateFocus.bind(this) }, hAsync("div", { key: 'd9bda5c2a6b9abd6e5ea849fb31a0543c8c36bb7', class: "brand" }, hAsync("slot", { key: 'e1c2c2a0bd69875ecd46ef9f7406ccb52409b570', name: "brand" }, hAsync("img", { key: '8dfca875ffc837f2c413527ea106d640a9b9bb97', id: "fallback-logo-lmvz", src: logoSvg, alt: "Lehrmittelverlag Z\u00FCrich" }))), hAsync("nav", { key: '24ceb7f3ef54399ecb9b7b78418d3be9bb547f60', "aria-label": "Hauptnavigation" }, hAsync("div", { key: 'c9fb6b1850330493e0a26bf20ea04013725025f6', role: "menubar", class: "primary-menubar" }, hAsync("slot", { key: '19640032a28d0a9bd7f5396f7c1acd477135f864', name: "nav-primary", ref: (el) => (this.primarySlot = el) }), hAsync("div", { key: 'c11f19e15c0fea300a771060e2e4c77cce76c20f', role: "menu", id: "nav-secondary", class: "secondary-menubar", hidden: !this.lmvzActiveNav, ref: (el) => (this.secondaryNav = el) }, hAsync("slot", { key: '2df2cf852595a78391bcd7c3dd8b8d6db3847aaa', name: this.secondarySlotName, ref: (el) => (this.secondarySlot = el) })))), hAsync("div", { key: 'c256862d4f5ea38c120218372d9ad73ae19efd74', class: "actions" }, hAsync("slot", { key: '91b5eb2d9ab06005384a28cddee3d6c92afd418c', name: "actions" }))));
|
|
6170
6150
|
}
|
|
6171
6151
|
static get watchers() { return {
|
|
6172
6152
|
"lmvzActiveNav": [{
|
|
@@ -6187,3812 +6167,67 @@ class LmvzHeader extends ReactiveControllerHost {
|
|
|
6187
6167
|
}; }
|
|
6188
6168
|
}
|
|
6189
6169
|
|
|
6190
|
-
|
|
6191
|
-
|
|
6192
|
-
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
*
|
|
6223
|
-
* **Example** (Using arity to determine data-first or data-last style)
|
|
6224
|
-
*
|
|
6225
|
-
* ```ts
|
|
6226
|
-
* import { dual, pipe } from "effect/Function"
|
|
6227
|
-
*
|
|
6228
|
-
* const sum = dual<
|
|
6229
|
-
* (that: number) => (self: number) => number,
|
|
6230
|
-
* (self: number, that: number) => number
|
|
6231
|
-
* >(2, (self, that) => self + that)
|
|
6232
|
-
*
|
|
6233
|
-
* console.log(sum(2, 3)) // 5
|
|
6234
|
-
* console.log(pipe(2, sum(3))) // 5
|
|
6235
|
-
* ```
|
|
6236
|
-
*
|
|
6237
|
-
* **Example** (Using call signatures to define the overloads)
|
|
6238
|
-
*
|
|
6239
|
-
* ```ts
|
|
6240
|
-
* import { dual, pipe } from "effect/Function"
|
|
6241
|
-
*
|
|
6242
|
-
* const sum: {
|
|
6243
|
-
* (that: number): (self: number) => number
|
|
6244
|
-
* (self: number, that: number): number
|
|
6245
|
-
* } = dual(2, (self: number, that: number): number => self + that)
|
|
6246
|
-
*
|
|
6247
|
-
* console.log(sum(2, 3)) // 5
|
|
6248
|
-
* console.log(pipe(2, sum(3))) // 5
|
|
6249
|
-
* ```
|
|
6250
|
-
*
|
|
6251
|
-
* **Example** (Using a predicate to determine data-first or data-last style)
|
|
6252
|
-
*
|
|
6253
|
-
* ```ts
|
|
6254
|
-
* import { dual, pipe } from "effect/Function"
|
|
6255
|
-
*
|
|
6256
|
-
* const sum = dual<
|
|
6257
|
-
* (that: number) => (self: number) => number,
|
|
6258
|
-
* (self: number, that: number) => number
|
|
6259
|
-
* >(
|
|
6260
|
-
* (args) => args.length === 2,
|
|
6261
|
-
* (self, that) => self + that
|
|
6262
|
-
* )
|
|
6263
|
-
*
|
|
6264
|
-
* console.log(sum(2, 3)) // 5
|
|
6265
|
-
* console.log(pipe(2, sum(3))) // 5
|
|
6266
|
-
* ```
|
|
6267
|
-
*
|
|
6268
|
-
* @since 2.0.0
|
|
6269
|
-
*/
|
|
6270
|
-
const dual = function (arity, body) {
|
|
6271
|
-
if (typeof arity === "function") {
|
|
6272
|
-
return function () {
|
|
6273
|
-
if (arity(arguments)) {
|
|
6274
|
-
// @ts-expect-error
|
|
6275
|
-
return body.apply(this, arguments);
|
|
6276
|
-
}
|
|
6277
|
-
return self => body(self, ...arguments);
|
|
6278
|
-
};
|
|
6279
|
-
}
|
|
6280
|
-
switch (arity) {
|
|
6281
|
-
case 0:
|
|
6282
|
-
case 1:
|
|
6283
|
-
throw new RangeError(`Invalid arity ${arity}`);
|
|
6284
|
-
case 2:
|
|
6285
|
-
return function (a, b) {
|
|
6286
|
-
if (arguments.length >= 2) {
|
|
6287
|
-
return body(a, b);
|
|
6288
|
-
}
|
|
6289
|
-
return function (self) {
|
|
6290
|
-
return body(self, a);
|
|
6291
|
-
};
|
|
6292
|
-
};
|
|
6293
|
-
case 3:
|
|
6294
|
-
return function (a, b, c) {
|
|
6295
|
-
if (arguments.length >= 3) {
|
|
6296
|
-
return body(a, b, c);
|
|
6297
|
-
}
|
|
6298
|
-
return function (self) {
|
|
6299
|
-
return body(self, a, b);
|
|
6300
|
-
};
|
|
6301
|
-
};
|
|
6302
|
-
case 4:
|
|
6303
|
-
return function (a, b, c, d) {
|
|
6304
|
-
if (arguments.length >= 4) {
|
|
6305
|
-
return body(a, b, c, d);
|
|
6306
|
-
}
|
|
6307
|
-
return function (self) {
|
|
6308
|
-
return body(self, a, b, c);
|
|
6309
|
-
};
|
|
6310
|
-
};
|
|
6311
|
-
case 5:
|
|
6312
|
-
return function (a, b, c, d, e) {
|
|
6313
|
-
if (arguments.length >= 5) {
|
|
6314
|
-
return body(a, b, c, d, e);
|
|
6170
|
+
const lmvzIconCss = () => `.sc-lmvz-icon-h{--lmvz-icon-color:var(--lmvz-component-color, var(--lmvz-semantic-color-on-surface-input-primary, #000000));display:inline-block;line-height:0;svg{display:block}svg path{stroke:var(--lmvz-icon-color);fill:none}}[size='xs'].sc-lmvz-icon-h{svg{width:var(--lmvz-component-icon-size-xs, clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem));height:var(--lmvz-component-icon-size-xs, clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem))}}[size='sm'].sc-lmvz-icon-h{svg{width:var(--lmvz-component-icon-size-sm, clamp(0.88rem, 0.84rem + 0.13vw, 1rem));height:var(--lmvz-component-icon-size-sm, clamp(0.88rem, 0.84rem + 0.13vw, 1rem))}}[size='md'].sc-lmvz-icon-h{svg{width:var(--lmvz-component-icon-size-md, clamp(1rem, 0.94rem + 0.26vw, 1.25rem));height:var(--lmvz-component-icon-size-md, clamp(1rem, 0.94rem + 0.26vw, 1.25rem))}}[size='lg'].sc-lmvz-icon-h{svg{width:var(--lmvz-component-icon-size-lg, clamp(1.5rem, 1.44rem + 0.26vw, 1.75rem));height:var(--lmvz-component-icon-size-lg, clamp(1.5rem, 1.44rem + 0.26vw, 1.75rem))}}[size='inherit'].sc-lmvz-icon-h{svg{width:inherit;height:inherit}}[weight='light'].sc-lmvz-icon-h{svg path{stroke-width:1}}[weight='medium'].sc-lmvz-icon-h{svg path{stroke-width:1.5}}[weight='bold'].sc-lmvz-icon-h{svg path{stroke-width:2}}[weight='filled'].sc-lmvz-icon-h{svg path{stroke-width:2;fill:var(--lmvz-icon-color)}}`;
|
|
6171
|
+
|
|
6172
|
+
class LmvzIcon extends ReactiveControllerHost {
|
|
6173
|
+
intersectionObserver;
|
|
6174
|
+
ariaValidationController = new AriaValidationController(this);
|
|
6175
|
+
get el() { return getElement(this); }
|
|
6176
|
+
validationEl;
|
|
6177
|
+
icon;
|
|
6178
|
+
weight = 'medium';
|
|
6179
|
+
size = 'md';
|
|
6180
|
+
iconset;
|
|
6181
|
+
iconData;
|
|
6182
|
+
visible = false;
|
|
6183
|
+
ariaLabel;
|
|
6184
|
+
get ariaHidden() {
|
|
6185
|
+
return !this.ariaLabel;
|
|
6186
|
+
}
|
|
6187
|
+
constructor(hostRef) {
|
|
6188
|
+
super();
|
|
6189
|
+
registerInstance(this, hostRef);
|
|
6190
|
+
this.addController(this.ariaValidationController);
|
|
6191
|
+
}
|
|
6192
|
+
connectedCallback() {
|
|
6193
|
+
this.waitUntilVisible(() => {
|
|
6194
|
+
this.visible = true;
|
|
6195
|
+
this.loadIconPathData();
|
|
6196
|
+
});
|
|
6197
|
+
super.connectedCallback();
|
|
6198
|
+
}
|
|
6199
|
+
disconnectedCallback() {
|
|
6200
|
+
if (this.intersectionObserver && typeof this.intersectionObserver.disconnect === 'function') {
|
|
6201
|
+
this.intersectionObserver.disconnect();
|
|
6315
6202
|
}
|
|
6316
|
-
|
|
6317
|
-
|
|
6318
|
-
|
|
6319
|
-
|
|
6320
|
-
|
|
6321
|
-
|
|
6322
|
-
if (arguments.length >= arity) {
|
|
6323
|
-
// @ts-expect-error
|
|
6324
|
-
return body.apply(this, arguments);
|
|
6325
|
-
}
|
|
6326
|
-
const args = arguments;
|
|
6327
|
-
return function (self) {
|
|
6328
|
-
return body(self, ...args);
|
|
6329
|
-
};
|
|
6330
|
-
};
|
|
6331
|
-
}
|
|
6332
|
-
};
|
|
6333
|
-
/**
|
|
6334
|
-
* The identity function, i.e. A function that returns its input argument.
|
|
6335
|
-
*
|
|
6336
|
-
* @example
|
|
6337
|
-
* ```ts
|
|
6338
|
-
* import * as assert from "node:assert"
|
|
6339
|
-
* import { identity } from "effect/Function"
|
|
6340
|
-
*
|
|
6341
|
-
* assert.deepStrictEqual(identity(5), 5)
|
|
6342
|
-
* ```
|
|
6343
|
-
*
|
|
6344
|
-
* @since 2.0.0
|
|
6345
|
-
*/
|
|
6346
|
-
const identity = a => a;
|
|
6347
|
-
/**
|
|
6348
|
-
* Creates a constant value that never changes.
|
|
6349
|
-
*
|
|
6350
|
-
* This is useful when you want to pass a value to a higher-order function (a function that takes another function as its argument)
|
|
6351
|
-
* and want that inner function to always use the same value, no matter how many times it is called.
|
|
6352
|
-
*
|
|
6353
|
-
* @example
|
|
6354
|
-
* ```ts
|
|
6355
|
-
* import * as assert from "node:assert"
|
|
6356
|
-
* import { constant } from "effect/Function"
|
|
6357
|
-
*
|
|
6358
|
-
* const constNull = constant(null)
|
|
6359
|
-
*
|
|
6360
|
-
* assert.deepStrictEqual(constNull(), null)
|
|
6361
|
-
* assert.deepStrictEqual(constNull(), null)
|
|
6362
|
-
* ```
|
|
6363
|
-
*
|
|
6364
|
-
* @since 2.0.0
|
|
6365
|
-
*/
|
|
6366
|
-
const constant = value => () => value;
|
|
6367
|
-
/**
|
|
6368
|
-
* A thunk that returns always `true`.
|
|
6369
|
-
*
|
|
6370
|
-
* @example
|
|
6371
|
-
* ```ts
|
|
6372
|
-
* import * as assert from "node:assert"
|
|
6373
|
-
* import { constTrue } from "effect/Function"
|
|
6374
|
-
*
|
|
6375
|
-
* assert.deepStrictEqual(constTrue(), true)
|
|
6376
|
-
* ```
|
|
6377
|
-
*
|
|
6378
|
-
* @since 2.0.0
|
|
6379
|
-
*/
|
|
6380
|
-
const constTrue = /*#__PURE__*/constant(true);
|
|
6381
|
-
/**
|
|
6382
|
-
* A thunk that returns always `false`.
|
|
6383
|
-
*
|
|
6384
|
-
* @example
|
|
6385
|
-
* ```ts
|
|
6386
|
-
* import * as assert from "node:assert"
|
|
6387
|
-
* import { constFalse } from "effect/Function"
|
|
6388
|
-
*
|
|
6389
|
-
* assert.deepStrictEqual(constFalse(), false)
|
|
6390
|
-
* ```
|
|
6391
|
-
*
|
|
6392
|
-
* @since 2.0.0
|
|
6393
|
-
*/
|
|
6394
|
-
const constFalse = /*#__PURE__*/constant(false);
|
|
6395
|
-
/**
|
|
6396
|
-
* A thunk that returns always `undefined`.
|
|
6397
|
-
*
|
|
6398
|
-
* @example
|
|
6399
|
-
* ```ts
|
|
6400
|
-
* import * as assert from "node:assert"
|
|
6401
|
-
* import { constUndefined } from "effect/Function"
|
|
6402
|
-
*
|
|
6403
|
-
* assert.deepStrictEqual(constUndefined(), undefined)
|
|
6404
|
-
* ```
|
|
6405
|
-
*
|
|
6406
|
-
* @since 2.0.0
|
|
6407
|
-
*/
|
|
6408
|
-
const constUndefined = /*#__PURE__*/constant(undefined);
|
|
6409
|
-
function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
|
|
6410
|
-
switch (arguments.length) {
|
|
6411
|
-
case 1:
|
|
6412
|
-
return a;
|
|
6413
|
-
case 2:
|
|
6414
|
-
return ab(a);
|
|
6415
|
-
case 3:
|
|
6416
|
-
return bc(ab(a));
|
|
6417
|
-
case 4:
|
|
6418
|
-
return cd(bc(ab(a)));
|
|
6419
|
-
case 5:
|
|
6420
|
-
return de(cd(bc(ab(a))));
|
|
6421
|
-
case 6:
|
|
6422
|
-
return ef(de(cd(bc(ab(a)))));
|
|
6423
|
-
case 7:
|
|
6424
|
-
return fg(ef(de(cd(bc(ab(a))))));
|
|
6425
|
-
case 8:
|
|
6426
|
-
return gh(fg(ef(de(cd(bc(ab(a)))))));
|
|
6427
|
-
case 9:
|
|
6428
|
-
return hi(gh(fg(ef(de(cd(bc(ab(a))))))));
|
|
6429
|
-
default:
|
|
6430
|
-
{
|
|
6431
|
-
let ret = arguments[0];
|
|
6432
|
-
for (let i = 1; i < arguments.length; i++) {
|
|
6433
|
-
ret = arguments[i](ret);
|
|
6203
|
+
this.intersectionObserver = undefined;
|
|
6204
|
+
super.disconnectedCallback();
|
|
6205
|
+
}
|
|
6206
|
+
async loadIconPathData() {
|
|
6207
|
+
{
|
|
6208
|
+
return;
|
|
6434
6209
|
}
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
* @category constructors
|
|
6449
|
-
* @since 2.0.0
|
|
6450
|
-
*/
|
|
6451
|
-
const make$2 = isEquivalent => (self, that) => self === that || isEquivalent(self, that);
|
|
6452
|
-
|
|
6453
|
-
/**
|
|
6454
|
-
* The `GlobalValue` module ensures that a single instance of a value is created globally,
|
|
6455
|
-
* even when modules are imported multiple times (e.g., due to mixing CommonJS and ESM builds)
|
|
6456
|
-
* or during hot-reloading in development environments like Next.js or Remix.
|
|
6457
|
-
*
|
|
6458
|
-
* It achieves this by using a versioned global store, identified by a unique `Symbol` tied to
|
|
6459
|
-
* the current version of the `effect` library. The store holds values that are keyed by an identifier,
|
|
6460
|
-
* allowing the reuse of previously computed instances across imports or reloads.
|
|
6461
|
-
*
|
|
6462
|
-
* This pattern is particularly useful in scenarios where frequent reloading can cause services or
|
|
6463
|
-
* single-instance objects to be recreated unnecessarily, such as in development environments with hot-reloading.
|
|
6464
|
-
*
|
|
6465
|
-
* @since 2.0.0
|
|
6466
|
-
*/
|
|
6467
|
-
const globalStoreId = `effect/GlobalValue`;
|
|
6468
|
-
let globalStore;
|
|
6469
|
-
/**
|
|
6470
|
-
* Retrieves or computes a global value associated with the given `id`. If the value for this `id`
|
|
6471
|
-
* has already been computed, it will be returned from the global store. If it does not exist yet,
|
|
6472
|
-
* the provided `compute` function will be executed to compute the value, store it, and then return it.
|
|
6473
|
-
*
|
|
6474
|
-
* This ensures that even in cases where the module is imported multiple times (e.g., in mixed environments
|
|
6475
|
-
* like CommonJS and ESM, or during hot-reloading in development), the value is computed only once and reused
|
|
6476
|
-
* thereafter.
|
|
6477
|
-
*
|
|
6478
|
-
* @example
|
|
6479
|
-
* ```ts
|
|
6480
|
-
* import { globalValue } from "effect/GlobalValue"
|
|
6481
|
-
*
|
|
6482
|
-
* // This cache will persist as long as the module is running,
|
|
6483
|
-
* // even if reloaded or imported elsewhere
|
|
6484
|
-
* const myCache = globalValue(
|
|
6485
|
-
* Symbol.for("myCache"),
|
|
6486
|
-
* () => new WeakMap<object, number>()
|
|
6487
|
-
* )
|
|
6488
|
-
* ```
|
|
6489
|
-
*
|
|
6490
|
-
* @since 2.0.0
|
|
6491
|
-
*/
|
|
6492
|
-
const globalValue = (id, compute) => {
|
|
6493
|
-
if (!globalStore) {
|
|
6494
|
-
// @ts-expect-error
|
|
6495
|
-
globalThis[globalStoreId] ??= new Map();
|
|
6496
|
-
// @ts-expect-error
|
|
6497
|
-
globalStore = globalThis[globalStoreId];
|
|
6498
|
-
}
|
|
6499
|
-
if (!globalStore.has(id)) {
|
|
6500
|
-
globalStore.set(id, compute());
|
|
6501
|
-
}
|
|
6502
|
-
return globalStore.get(id);
|
|
6503
|
-
};
|
|
6504
|
-
|
|
6505
|
-
/**
|
|
6506
|
-
* This module provides a collection of functions for working with predicates and refinements.
|
|
6507
|
-
*
|
|
6508
|
-
* A `Predicate<A>` is a function that takes a value of type `A` and returns a boolean.
|
|
6509
|
-
* It is used to check if a value satisfies a certain condition.
|
|
6510
|
-
*
|
|
6511
|
-
* A `Refinement<A, B>` is a special type of predicate that not only checks a condition
|
|
6512
|
-
* but also provides a type guard, allowing TypeScript to narrow the type of the input
|
|
6513
|
-
* value from `A` to a more specific type `B` within a conditional block.
|
|
6514
|
-
*
|
|
6515
|
-
* The module includes:
|
|
6516
|
-
* - Basic predicates and refinements for common types (e.g., `isString`, `isNumber`).
|
|
6517
|
-
* - Combinators to create new predicates from existing ones (e.g., `and`, `or`, `not`).
|
|
6518
|
-
* - Advanced combinators for working with data structures (e.g., `tuple`, `struct`).
|
|
6519
|
-
* - Type-level utilities for inspecting predicate and refinement types.
|
|
6520
|
-
*
|
|
6521
|
-
* @since 2.0.0
|
|
6522
|
-
*/
|
|
6523
|
-
/**
|
|
6524
|
-
* A refinement that checks if a value is a `Function`.
|
|
6525
|
-
*
|
|
6526
|
-
* @example
|
|
6527
|
-
* ```ts
|
|
6528
|
-
* import * as assert from "node:assert"
|
|
6529
|
-
* import { isFunction } from "effect/Predicate"
|
|
6530
|
-
*
|
|
6531
|
-
* assert.strictEqual(isFunction(() => {}), true)
|
|
6532
|
-
* assert.strictEqual(isFunction(isFunction), true)
|
|
6533
|
-
*
|
|
6534
|
-
* assert.strictEqual(isFunction("function"), false)
|
|
6535
|
-
* ```
|
|
6536
|
-
*
|
|
6537
|
-
* @category guards
|
|
6538
|
-
* @since 2.0.0
|
|
6539
|
-
*/
|
|
6540
|
-
const isFunction = isFunction$1;
|
|
6541
|
-
/**
|
|
6542
|
-
* Checks if the input is an object or an array.
|
|
6543
|
-
* @internal
|
|
6544
|
-
*/
|
|
6545
|
-
const isRecordOrArray = input => typeof input === "object" && input !== null;
|
|
6546
|
-
/**
|
|
6547
|
-
* A refinement that checks if a value is an `object`. Note that in JavaScript,
|
|
6548
|
-
* arrays and functions are also considered objects.
|
|
6549
|
-
*
|
|
6550
|
-
* @example
|
|
6551
|
-
* ```ts
|
|
6552
|
-
* import * as assert from "node:assert"
|
|
6553
|
-
* import { isObject } from "effect/Predicate"
|
|
6554
|
-
*
|
|
6555
|
-
* assert.strictEqual(isObject({}), true)
|
|
6556
|
-
* assert.strictEqual(isObject([]), true)
|
|
6557
|
-
* assert.strictEqual(isObject(() => {}), true)
|
|
6558
|
-
*
|
|
6559
|
-
* assert.strictEqual(isObject(null), false)
|
|
6560
|
-
* assert.strictEqual(isObject("hello"), false)
|
|
6561
|
-
* ```
|
|
6562
|
-
*
|
|
6563
|
-
* @category guards
|
|
6564
|
-
* @since 2.0.0
|
|
6565
|
-
* @see isRecord to check for plain objects (excluding arrays and functions).
|
|
6566
|
-
*/
|
|
6567
|
-
const isObject = input => isRecordOrArray(input) || isFunction(input);
|
|
6568
|
-
/**
|
|
6569
|
-
* A refinement that checks if a value is an object-like value and has a specific property key.
|
|
6570
|
-
*
|
|
6571
|
-
* @example
|
|
6572
|
-
* ```ts
|
|
6573
|
-
* import * as assert from "node:assert"
|
|
6574
|
-
* import { hasProperty } from "effect/Predicate"
|
|
6575
|
-
*
|
|
6576
|
-
* assert.strictEqual(hasProperty({ a: 1 }, "a"), true)
|
|
6577
|
-
* assert.strictEqual(hasProperty({ a: 1 }, "b"), false)
|
|
6578
|
-
*
|
|
6579
|
-
* const value: unknown = { name: "Alice" };
|
|
6580
|
-
* if (hasProperty(value, "name")) {
|
|
6581
|
-
* // The type of `value` is narrowed to `{ name: unknown }`
|
|
6582
|
-
* // and we can safely access `value.name`
|
|
6583
|
-
* console.log(value.name)
|
|
6584
|
-
* }
|
|
6585
|
-
* ```
|
|
6586
|
-
*
|
|
6587
|
-
* @category guards
|
|
6588
|
-
* @since 2.0.0
|
|
6589
|
-
*/
|
|
6590
|
-
const hasProperty = /*#__PURE__*/dual(2, (self, property) => isObject(self) && property in self);
|
|
6591
|
-
/**
|
|
6592
|
-
* A refinement that checks if a value is an object with a `_tag` property
|
|
6593
|
-
* that matches the given tag. This is a powerful tool for working with
|
|
6594
|
-
* discriminated union types.
|
|
6595
|
-
*
|
|
6596
|
-
* @example
|
|
6597
|
-
* ```ts
|
|
6598
|
-
* import * as assert from "node:assert"
|
|
6599
|
-
* import { isTagged } from "effect/Predicate"
|
|
6600
|
-
*
|
|
6601
|
-
* type Shape = { _tag: "circle"; radius: number } | { _tag: "square"; side: number }
|
|
6602
|
-
*
|
|
6603
|
-
* const isCircle = isTagged("circle")
|
|
6604
|
-
*
|
|
6605
|
-
* const shape1: Shape = { _tag: "circle", radius: 10 }
|
|
6606
|
-
* const shape2: Shape = { _tag: "square", side: 5 }
|
|
6607
|
-
*
|
|
6608
|
-
* assert.strictEqual(isCircle(shape1), true)
|
|
6609
|
-
* assert.strictEqual(isCircle(shape2), false)
|
|
6610
|
-
*
|
|
6611
|
-
* if (isCircle(shape1)) {
|
|
6612
|
-
* // shape1 is now narrowed to { _tag: "circle"; radius: number }
|
|
6613
|
-
* assert.strictEqual(shape1.radius, 10)
|
|
6614
|
-
* }
|
|
6615
|
-
* ```
|
|
6616
|
-
*
|
|
6617
|
-
* @category guards
|
|
6618
|
-
* @since 2.0.0
|
|
6619
|
-
*/
|
|
6620
|
-
const isTagged = /*#__PURE__*/dual(2, (self, tag) => hasProperty(self, "_tag") && self["_tag"] === tag);
|
|
6621
|
-
|
|
6622
|
-
/**
|
|
6623
|
-
* @since 2.0.0
|
|
6624
|
-
*/
|
|
6625
|
-
/** @internal */
|
|
6626
|
-
const getBugErrorMessage = message => `BUG: ${message} - please report an issue at https://github.com/Effect-TS/effect/issues`;
|
|
6627
|
-
|
|
6628
|
-
/**
|
|
6629
|
-
* @since 2.0.0
|
|
6630
|
-
*/
|
|
6631
|
-
/**
|
|
6632
|
-
* @category constructors
|
|
6633
|
-
* @since 2.0.0
|
|
6634
|
-
*/
|
|
6635
|
-
let SingleShotGen$1 = class SingleShotGen {
|
|
6636
|
-
self;
|
|
6637
|
-
called = false;
|
|
6638
|
-
constructor(self) {
|
|
6639
|
-
this.self = self;
|
|
6640
|
-
}
|
|
6641
|
-
/**
|
|
6642
|
-
* @since 2.0.0
|
|
6643
|
-
*/
|
|
6644
|
-
next(a) {
|
|
6645
|
-
return this.called ? {
|
|
6646
|
-
value: a,
|
|
6647
|
-
done: true
|
|
6648
|
-
} : (this.called = true, {
|
|
6649
|
-
value: this.self,
|
|
6650
|
-
done: false
|
|
6651
|
-
});
|
|
6652
|
-
}
|
|
6653
|
-
/**
|
|
6654
|
-
* @since 2.0.0
|
|
6655
|
-
*/
|
|
6656
|
-
return(a) {
|
|
6657
|
-
return {
|
|
6658
|
-
value: a,
|
|
6659
|
-
done: true
|
|
6660
|
-
};
|
|
6661
|
-
}
|
|
6662
|
-
/**
|
|
6663
|
-
* @since 2.0.0
|
|
6664
|
-
*/
|
|
6665
|
-
throw(e) {
|
|
6666
|
-
throw e;
|
|
6667
|
-
}
|
|
6668
|
-
/**
|
|
6669
|
-
* @since 2.0.0
|
|
6670
|
-
*/
|
|
6671
|
-
[Symbol.iterator]() {
|
|
6672
|
-
return new SingleShotGen(this.self);
|
|
6673
|
-
}
|
|
6674
|
-
};
|
|
6675
|
-
/**
|
|
6676
|
-
* @since 3.0.6
|
|
6677
|
-
*/
|
|
6678
|
-
const YieldWrapTypeId = /*#__PURE__*/Symbol.for("effect/Utils/YieldWrap");
|
|
6679
|
-
/**
|
|
6680
|
-
* @since 3.0.6
|
|
6681
|
-
*/
|
|
6682
|
-
class YieldWrap {
|
|
6683
|
-
/**
|
|
6684
|
-
* @since 3.0.6
|
|
6685
|
-
*/
|
|
6686
|
-
#value;
|
|
6687
|
-
constructor(value) {
|
|
6688
|
-
this.#value = value;
|
|
6689
|
-
}
|
|
6690
|
-
/**
|
|
6691
|
-
* @since 3.0.6
|
|
6692
|
-
*/
|
|
6693
|
-
[YieldWrapTypeId]() {
|
|
6694
|
-
return this.#value;
|
|
6695
|
-
}
|
|
6696
|
-
}
|
|
6697
|
-
/**
|
|
6698
|
-
* Note: this is an experimental feature made available to allow custom matchers in tests, not to be directly used yet in user code
|
|
6699
|
-
*
|
|
6700
|
-
* @since 3.1.1
|
|
6701
|
-
* @status experimental
|
|
6702
|
-
* @category modifiers
|
|
6703
|
-
*/
|
|
6704
|
-
const structuralRegionState = /*#__PURE__*/globalValue("effect/Utils/isStructuralRegion", () => ({
|
|
6705
|
-
enabled: false,
|
|
6706
|
-
tester: undefined
|
|
6707
|
-
}));
|
|
6708
|
-
|
|
6709
|
-
/**
|
|
6710
|
-
* @since 2.0.0
|
|
6711
|
-
*/
|
|
6712
|
-
/** @internal */
|
|
6713
|
-
const randomHashCache = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/Hash/randomHashCache"), () => new WeakMap());
|
|
6714
|
-
/**
|
|
6715
|
-
* @since 2.0.0
|
|
6716
|
-
* @category symbols
|
|
6717
|
-
*/
|
|
6718
|
-
const symbol$1 = /*#__PURE__*/Symbol.for("effect/Hash");
|
|
6719
|
-
/**
|
|
6720
|
-
* @since 2.0.0
|
|
6721
|
-
* @category hashing
|
|
6722
|
-
*/
|
|
6723
|
-
const hash = self => {
|
|
6724
|
-
if (structuralRegionState.enabled === true) {
|
|
6725
|
-
return 0;
|
|
6726
|
-
}
|
|
6727
|
-
switch (typeof self) {
|
|
6728
|
-
case "number":
|
|
6729
|
-
return number(self);
|
|
6730
|
-
case "bigint":
|
|
6731
|
-
return string(self.toString(10));
|
|
6732
|
-
case "boolean":
|
|
6733
|
-
return string(String(self));
|
|
6734
|
-
case "symbol":
|
|
6735
|
-
return string(String(self));
|
|
6736
|
-
case "string":
|
|
6737
|
-
return string(self);
|
|
6738
|
-
case "undefined":
|
|
6739
|
-
return string("undefined");
|
|
6740
|
-
case "function":
|
|
6741
|
-
case "object":
|
|
6742
|
-
{
|
|
6743
|
-
if (self === null) {
|
|
6744
|
-
return string("null");
|
|
6745
|
-
} else if (self instanceof Date) {
|
|
6746
|
-
if (Number.isNaN(self.getTime())) {
|
|
6747
|
-
return string("Invalid Date");
|
|
6748
|
-
}
|
|
6749
|
-
return hash(self.toISOString());
|
|
6750
|
-
} else if (self instanceof URL) {
|
|
6751
|
-
return hash(self.href);
|
|
6752
|
-
} else if (isHash(self)) {
|
|
6753
|
-
return self[symbol$1]();
|
|
6754
|
-
} else {
|
|
6755
|
-
return random(self);
|
|
6210
|
+
}
|
|
6211
|
+
componentDidRender() {
|
|
6212
|
+
this.validationEl = this.el.querySelector('svg');
|
|
6213
|
+
this.ariaValidationController.revalidateAria();
|
|
6214
|
+
super.componentDidRender();
|
|
6215
|
+
}
|
|
6216
|
+
render() {
|
|
6217
|
+
return hAsync(Host, { key: 'b36586af32709b492336fe4ec1fe1fe1fe7a9e4b', role: "img", "aria-hidden": `${this.ariaHidden}`, innerHTML: this.iconData });
|
|
6218
|
+
}
|
|
6219
|
+
waitUntilVisible(callback, rootMargin = 50) {
|
|
6220
|
+
{
|
|
6221
|
+
callback();
|
|
6222
|
+
return;
|
|
6756
6223
|
}
|
|
6757
|
-
}
|
|
6758
|
-
default:
|
|
6759
|
-
throw new Error(`BUG: unhandled typeof ${typeof self} - please report an issue at https://github.com/Effect-TS/effect/issues`);
|
|
6760
|
-
}
|
|
6761
|
-
};
|
|
6762
|
-
/**
|
|
6763
|
-
* @since 2.0.0
|
|
6764
|
-
* @category hashing
|
|
6765
|
-
*/
|
|
6766
|
-
const random = self => {
|
|
6767
|
-
if (!randomHashCache.has(self)) {
|
|
6768
|
-
randomHashCache.set(self, number(Math.floor(Math.random() * Number.MAX_SAFE_INTEGER)));
|
|
6769
|
-
}
|
|
6770
|
-
return randomHashCache.get(self);
|
|
6771
|
-
};
|
|
6772
|
-
/**
|
|
6773
|
-
* @since 2.0.0
|
|
6774
|
-
* @category hashing
|
|
6775
|
-
*/
|
|
6776
|
-
const combine = b => self => self * 53 ^ b;
|
|
6777
|
-
/**
|
|
6778
|
-
* @since 2.0.0
|
|
6779
|
-
* @category hashing
|
|
6780
|
-
*/
|
|
6781
|
-
const optimize = n => n & 0xbfffffff | n >>> 1 & 0x40000000;
|
|
6782
|
-
/**
|
|
6783
|
-
* @since 2.0.0
|
|
6784
|
-
* @category guards
|
|
6785
|
-
*/
|
|
6786
|
-
const isHash = u => hasProperty(u, symbol$1);
|
|
6787
|
-
/**
|
|
6788
|
-
* @since 2.0.0
|
|
6789
|
-
* @category hashing
|
|
6790
|
-
*/
|
|
6791
|
-
const number = n => {
|
|
6792
|
-
if (n !== n || n === Infinity) {
|
|
6793
|
-
return 0;
|
|
6794
|
-
}
|
|
6795
|
-
let h = n | 0;
|
|
6796
|
-
if (h !== n) {
|
|
6797
|
-
h ^= n * 0xffffffff;
|
|
6798
|
-
}
|
|
6799
|
-
while (n > 0xffffffff) {
|
|
6800
|
-
h ^= n /= 0xffffffff;
|
|
6801
|
-
}
|
|
6802
|
-
return optimize(h);
|
|
6803
|
-
};
|
|
6804
|
-
/**
|
|
6805
|
-
* @since 2.0.0
|
|
6806
|
-
* @category hashing
|
|
6807
|
-
*/
|
|
6808
|
-
const string = str => {
|
|
6809
|
-
let h = 5381,
|
|
6810
|
-
i = str.length;
|
|
6811
|
-
while (i) {
|
|
6812
|
-
h = h * 33 ^ str.charCodeAt(--i);
|
|
6813
|
-
}
|
|
6814
|
-
return optimize(h);
|
|
6815
|
-
};
|
|
6816
|
-
/**
|
|
6817
|
-
* @since 2.0.0
|
|
6818
|
-
* @category hashing
|
|
6819
|
-
*/
|
|
6820
|
-
const structureKeys = (o, keys) => {
|
|
6821
|
-
let h = 12289;
|
|
6822
|
-
for (let i = 0; i < keys.length; i++) {
|
|
6823
|
-
h ^= pipe(string(keys[i]), combine(hash(o[keys[i]])));
|
|
6824
|
-
}
|
|
6825
|
-
return optimize(h);
|
|
6826
|
-
};
|
|
6827
|
-
/**
|
|
6828
|
-
* @since 2.0.0
|
|
6829
|
-
* @category hashing
|
|
6830
|
-
*/
|
|
6831
|
-
const structure = o => structureKeys(o, Object.keys(o));
|
|
6832
|
-
/**
|
|
6833
|
-
* @since 2.0.0
|
|
6834
|
-
* @category hashing
|
|
6835
|
-
*/
|
|
6836
|
-
const array = arr => {
|
|
6837
|
-
let h = 6151;
|
|
6838
|
-
for (let i = 0; i < arr.length; i++) {
|
|
6839
|
-
h = pipe(h, combine(hash(arr[i])));
|
|
6840
|
-
}
|
|
6841
|
-
return optimize(h);
|
|
6842
|
-
};
|
|
6843
|
-
/**
|
|
6844
|
-
* @since 2.0.0
|
|
6845
|
-
* @category hashing
|
|
6846
|
-
*/
|
|
6847
|
-
const cached = function () {
|
|
6848
|
-
if (arguments.length === 1) {
|
|
6849
|
-
const self = arguments[0];
|
|
6850
|
-
return function (hash) {
|
|
6851
|
-
Object.defineProperty(self, symbol$1, {
|
|
6852
|
-
value() {
|
|
6853
|
-
return hash;
|
|
6854
|
-
},
|
|
6855
|
-
enumerable: false
|
|
6856
|
-
});
|
|
6857
|
-
return hash;
|
|
6858
|
-
};
|
|
6859
|
-
}
|
|
6860
|
-
const self = arguments[0];
|
|
6861
|
-
const hash = arguments[1];
|
|
6862
|
-
Object.defineProperty(self, symbol$1, {
|
|
6863
|
-
value() {
|
|
6864
|
-
return hash;
|
|
6865
|
-
},
|
|
6866
|
-
enumerable: false
|
|
6867
|
-
});
|
|
6868
|
-
return hash;
|
|
6869
|
-
};
|
|
6870
|
-
|
|
6871
|
-
/**
|
|
6872
|
-
* @since 2.0.0
|
|
6873
|
-
* @category symbols
|
|
6874
|
-
*/
|
|
6875
|
-
const symbol = /*#__PURE__*/Symbol.for("effect/Equal");
|
|
6876
|
-
function equals() {
|
|
6877
|
-
if (arguments.length === 1) {
|
|
6878
|
-
return self => compareBoth(self, arguments[0]);
|
|
6879
|
-
}
|
|
6880
|
-
return compareBoth(arguments[0], arguments[1]);
|
|
6881
|
-
}
|
|
6882
|
-
function compareBoth(self, that) {
|
|
6883
|
-
if (self === that) {
|
|
6884
|
-
return true;
|
|
6885
|
-
}
|
|
6886
|
-
const selfType = typeof self;
|
|
6887
|
-
if (selfType !== typeof that) {
|
|
6888
|
-
return false;
|
|
6889
|
-
}
|
|
6890
|
-
if (selfType === "object" || selfType === "function") {
|
|
6891
|
-
if (self !== null && that !== null) {
|
|
6892
|
-
if (isEqual(self) && isEqual(that)) {
|
|
6893
|
-
if (hash(self) === hash(that) && self[symbol](that)) {
|
|
6894
|
-
return true;
|
|
6895
|
-
} else {
|
|
6896
|
-
return structuralRegionState.enabled && structuralRegionState.tester ? structuralRegionState.tester(self, that) : false;
|
|
6897
|
-
}
|
|
6898
|
-
} else if (self instanceof Date && that instanceof Date) {
|
|
6899
|
-
const t1 = self.getTime();
|
|
6900
|
-
const t2 = that.getTime();
|
|
6901
|
-
return t1 === t2 || Number.isNaN(t1) && Number.isNaN(t2);
|
|
6902
|
-
} else if (self instanceof URL && that instanceof URL) {
|
|
6903
|
-
return self.href === that.href;
|
|
6904
|
-
}
|
|
6905
|
-
}
|
|
6906
|
-
if (structuralRegionState.enabled) {
|
|
6907
|
-
if (self === null || that === null) {
|
|
6908
|
-
return false;
|
|
6909
|
-
}
|
|
6910
|
-
if (Array.isArray(self) && Array.isArray(that)) {
|
|
6911
|
-
return self.length === that.length && self.every((v, i) => compareBoth(v, that[i]));
|
|
6912
|
-
}
|
|
6913
|
-
if (Object.getPrototypeOf(self) === Object.prototype && Object.getPrototypeOf(that) === Object.prototype) {
|
|
6914
|
-
const keysSelf = Object.keys(self);
|
|
6915
|
-
const keysThat = Object.keys(that);
|
|
6916
|
-
if (keysSelf.length === keysThat.length) {
|
|
6917
|
-
for (const key of keysSelf) {
|
|
6918
|
-
// @ts-expect-error
|
|
6919
|
-
if (!(key in that && compareBoth(self[key], that[key]))) {
|
|
6920
|
-
return structuralRegionState.tester ? structuralRegionState.tester(self, that) : false;
|
|
6921
|
-
}
|
|
6922
|
-
}
|
|
6923
|
-
return true;
|
|
6924
|
-
}
|
|
6925
|
-
}
|
|
6926
|
-
return structuralRegionState.tester ? structuralRegionState.tester(self, that) : false;
|
|
6927
|
-
}
|
|
6928
|
-
}
|
|
6929
|
-
return structuralRegionState.enabled && structuralRegionState.tester ? structuralRegionState.tester(self, that) : false;
|
|
6930
|
-
}
|
|
6931
|
-
/**
|
|
6932
|
-
* @since 2.0.0
|
|
6933
|
-
* @category guards
|
|
6934
|
-
*/
|
|
6935
|
-
const isEqual = u => hasProperty(u, symbol);
|
|
6936
|
-
|
|
6937
|
-
/**
|
|
6938
|
-
* @since 2.0.0
|
|
6939
|
-
* @category symbols
|
|
6940
|
-
*/
|
|
6941
|
-
const NodeInspectSymbol = /*#__PURE__*/Symbol.for("nodejs.util.inspect.custom");
|
|
6942
|
-
/**
|
|
6943
|
-
* @since 2.0.0
|
|
6944
|
-
*/
|
|
6945
|
-
const toJSON = x => {
|
|
6946
|
-
try {
|
|
6947
|
-
if (hasProperty(x, "toJSON") && isFunction(x["toJSON"]) && x["toJSON"].length === 0) {
|
|
6948
|
-
return x.toJSON();
|
|
6949
|
-
} else if (Array.isArray(x)) {
|
|
6950
|
-
return x.map(toJSON);
|
|
6951
|
-
}
|
|
6952
|
-
} catch {
|
|
6953
|
-
return {};
|
|
6954
|
-
}
|
|
6955
|
-
return redact(x);
|
|
6956
|
-
};
|
|
6957
|
-
/**
|
|
6958
|
-
* @since 2.0.0
|
|
6959
|
-
*/
|
|
6960
|
-
const format = x => JSON.stringify(x, null, 2);
|
|
6961
|
-
/**
|
|
6962
|
-
* @since 2.0.0
|
|
6963
|
-
*/
|
|
6964
|
-
const stringifyCircular = (obj, whitespace) => {
|
|
6965
|
-
let cache = [];
|
|
6966
|
-
const retVal = JSON.stringify(obj, (_key, value) => typeof value === "object" && value !== null ? cache.includes(value) ? undefined // circular reference
|
|
6967
|
-
: cache.push(value) && (redactableState.fiberRefs !== undefined && isRedactable(value) ? value[symbolRedactable](redactableState.fiberRefs) : value) : value, whitespace);
|
|
6968
|
-
cache = undefined;
|
|
6969
|
-
return retVal;
|
|
6970
|
-
};
|
|
6971
|
-
/**
|
|
6972
|
-
* @since 3.10.0
|
|
6973
|
-
* @category redactable
|
|
6974
|
-
*/
|
|
6975
|
-
const symbolRedactable = /*#__PURE__*/Symbol.for("effect/Inspectable/Redactable");
|
|
6976
|
-
/**
|
|
6977
|
-
* @since 3.10.0
|
|
6978
|
-
* @category redactable
|
|
6979
|
-
*/
|
|
6980
|
-
const isRedactable = u => typeof u === "object" && u !== null && symbolRedactable in u;
|
|
6981
|
-
const redactableState = /*#__PURE__*/globalValue("effect/Inspectable/redactableState", () => ({
|
|
6982
|
-
fiberRefs: undefined
|
|
6983
|
-
}));
|
|
6984
|
-
/**
|
|
6985
|
-
* @since 3.10.0
|
|
6986
|
-
* @category redactable
|
|
6987
|
-
*/
|
|
6988
|
-
const redact = u => {
|
|
6989
|
-
if (isRedactable(u) && redactableState.fiberRefs !== undefined) {
|
|
6990
|
-
return u[symbolRedactable](redactableState.fiberRefs);
|
|
6991
|
-
}
|
|
6992
|
-
return u;
|
|
6993
|
-
};
|
|
6994
|
-
|
|
6995
|
-
/**
|
|
6996
|
-
* @since 2.0.0
|
|
6997
|
-
*/
|
|
6998
|
-
/**
|
|
6999
|
-
* @since 2.0.0
|
|
7000
|
-
*/
|
|
7001
|
-
const pipeArguments = (self, args) => {
|
|
7002
|
-
switch (args.length) {
|
|
7003
|
-
case 0:
|
|
7004
|
-
return self;
|
|
7005
|
-
case 1:
|
|
7006
|
-
return args[0](self);
|
|
7007
|
-
case 2:
|
|
7008
|
-
return args[1](args[0](self));
|
|
7009
|
-
case 3:
|
|
7010
|
-
return args[2](args[1](args[0](self)));
|
|
7011
|
-
case 4:
|
|
7012
|
-
return args[3](args[2](args[1](args[0](self))));
|
|
7013
|
-
case 5:
|
|
7014
|
-
return args[4](args[3](args[2](args[1](args[0](self)))));
|
|
7015
|
-
case 6:
|
|
7016
|
-
return args[5](args[4](args[3](args[2](args[1](args[0](self))))));
|
|
7017
|
-
case 7:
|
|
7018
|
-
return args[6](args[5](args[4](args[3](args[2](args[1](args[0](self)))))));
|
|
7019
|
-
case 8:
|
|
7020
|
-
return args[7](args[6](args[5](args[4](args[3](args[2](args[1](args[0](self))))))));
|
|
7021
|
-
case 9:
|
|
7022
|
-
return args[8](args[7](args[6](args[5](args[4](args[3](args[2](args[1](args[0](self)))))))));
|
|
7023
|
-
default:
|
|
7024
|
-
{
|
|
7025
|
-
let ret = self;
|
|
7026
|
-
for (let i = 0, len = args.length; i < len; i++) {
|
|
7027
|
-
ret = args[i](ret);
|
|
7028
|
-
}
|
|
7029
|
-
return ret;
|
|
7030
|
-
}
|
|
7031
|
-
}
|
|
7032
|
-
};
|
|
7033
|
-
|
|
7034
|
-
/** @internal */
|
|
7035
|
-
/** @internal */
|
|
7036
|
-
const OP_COMMIT = "Commit";
|
|
7037
|
-
/** @internal */
|
|
7038
|
-
const OP_FAILURE = "Failure";
|
|
7039
|
-
/** @internal */
|
|
7040
|
-
const OP_WITH_RUNTIME = "WithRuntime";
|
|
7041
|
-
|
|
7042
|
-
let moduleVersion = "3.21.1";
|
|
7043
|
-
const getCurrentVersion = () => moduleVersion;
|
|
7044
|
-
|
|
7045
|
-
/** @internal */
|
|
7046
|
-
const EffectTypeId$1 = /*#__PURE__*/Symbol.for("effect/Effect");
|
|
7047
|
-
/** @internal */
|
|
7048
|
-
const StreamTypeId = /*#__PURE__*/Symbol.for("effect/Stream");
|
|
7049
|
-
/** @internal */
|
|
7050
|
-
const SinkTypeId = /*#__PURE__*/Symbol.for("effect/Sink");
|
|
7051
|
-
/** @internal */
|
|
7052
|
-
const ChannelTypeId = /*#__PURE__*/Symbol.for("effect/Channel");
|
|
7053
|
-
/** @internal */
|
|
7054
|
-
const effectVariance = {
|
|
7055
|
-
/* c8 ignore next */
|
|
7056
|
-
_R: _ => _,
|
|
7057
|
-
/* c8 ignore next */
|
|
7058
|
-
_E: _ => _,
|
|
7059
|
-
/* c8 ignore next */
|
|
7060
|
-
_A: _ => _,
|
|
7061
|
-
_V: /*#__PURE__*/getCurrentVersion()
|
|
7062
|
-
};
|
|
7063
|
-
const sinkVariance = {
|
|
7064
|
-
/* c8 ignore next */
|
|
7065
|
-
_A: _ => _,
|
|
7066
|
-
/* c8 ignore next */
|
|
7067
|
-
_In: _ => _,
|
|
7068
|
-
/* c8 ignore next */
|
|
7069
|
-
_L: _ => _,
|
|
7070
|
-
/* c8 ignore next */
|
|
7071
|
-
_E: _ => _,
|
|
7072
|
-
/* c8 ignore next */
|
|
7073
|
-
_R: _ => _
|
|
7074
|
-
};
|
|
7075
|
-
const channelVariance = {
|
|
7076
|
-
/* c8 ignore next */
|
|
7077
|
-
_Env: _ => _,
|
|
7078
|
-
/* c8 ignore next */
|
|
7079
|
-
_InErr: _ => _,
|
|
7080
|
-
/* c8 ignore next */
|
|
7081
|
-
_InElem: _ => _,
|
|
7082
|
-
/* c8 ignore next */
|
|
7083
|
-
_InDone: _ => _,
|
|
7084
|
-
/* c8 ignore next */
|
|
7085
|
-
_OutErr: _ => _,
|
|
7086
|
-
/* c8 ignore next */
|
|
7087
|
-
_OutElem: _ => _,
|
|
7088
|
-
/* c8 ignore next */
|
|
7089
|
-
_OutDone: _ => _
|
|
7090
|
-
};
|
|
7091
|
-
/** @internal */
|
|
7092
|
-
const EffectPrototype = {
|
|
7093
|
-
[EffectTypeId$1]: effectVariance,
|
|
7094
|
-
[StreamTypeId]: effectVariance,
|
|
7095
|
-
[SinkTypeId]: sinkVariance,
|
|
7096
|
-
[ChannelTypeId]: channelVariance,
|
|
7097
|
-
[symbol](that) {
|
|
7098
|
-
return this === that;
|
|
7099
|
-
},
|
|
7100
|
-
[symbol$1]() {
|
|
7101
|
-
return cached(this, random(this));
|
|
7102
|
-
},
|
|
7103
|
-
[Symbol.iterator]() {
|
|
7104
|
-
return new SingleShotGen$1(new YieldWrap(this));
|
|
7105
|
-
},
|
|
7106
|
-
pipe() {
|
|
7107
|
-
return pipeArguments(this, arguments);
|
|
7108
|
-
}
|
|
7109
|
-
};
|
|
7110
|
-
/** @internal */
|
|
7111
|
-
const StructuralPrototype = {
|
|
7112
|
-
[symbol$1]() {
|
|
7113
|
-
return cached(this, structure(this));
|
|
7114
|
-
},
|
|
7115
|
-
[symbol](that) {
|
|
7116
|
-
const selfKeys = Object.keys(this);
|
|
7117
|
-
const thatKeys = Object.keys(that);
|
|
7118
|
-
if (selfKeys.length !== thatKeys.length) {
|
|
7119
|
-
return false;
|
|
7120
|
-
}
|
|
7121
|
-
for (const key of selfKeys) {
|
|
7122
|
-
if (!(key in that && equals(this[key], that[key]))) {
|
|
7123
|
-
return false;
|
|
7124
|
-
}
|
|
7125
|
-
}
|
|
7126
|
-
return true;
|
|
7127
|
-
}
|
|
7128
|
-
};
|
|
7129
|
-
/** @internal */
|
|
7130
|
-
const CommitPrototype = {
|
|
7131
|
-
...EffectPrototype,
|
|
7132
|
-
_op: OP_COMMIT
|
|
7133
|
-
};
|
|
7134
|
-
/** @internal */
|
|
7135
|
-
const StructuralCommitPrototype = {
|
|
7136
|
-
...CommitPrototype,
|
|
7137
|
-
...StructuralPrototype
|
|
7138
|
-
};
|
|
7139
|
-
|
|
7140
|
-
/**
|
|
7141
|
-
* @since 2.0.0
|
|
7142
|
-
*/
|
|
7143
|
-
const TypeId$2 = /*#__PURE__*/Symbol.for("effect/Option");
|
|
7144
|
-
const CommonProto$1 = {
|
|
7145
|
-
...EffectPrototype,
|
|
7146
|
-
[TypeId$2]: {
|
|
7147
|
-
_A: _ => _
|
|
7148
|
-
},
|
|
7149
|
-
[NodeInspectSymbol]() {
|
|
7150
|
-
return this.toJSON();
|
|
7151
|
-
},
|
|
7152
|
-
toString() {
|
|
7153
|
-
return format(this.toJSON());
|
|
7154
|
-
}
|
|
7155
|
-
};
|
|
7156
|
-
const SomeProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(CommonProto$1), {
|
|
7157
|
-
_tag: "Some",
|
|
7158
|
-
_op: "Some",
|
|
7159
|
-
[symbol](that) {
|
|
7160
|
-
return isOption(that) && isSome$1(that) && equals(this.value, that.value);
|
|
7161
|
-
},
|
|
7162
|
-
[symbol$1]() {
|
|
7163
|
-
return cached(this, combine(hash(this._tag))(hash(this.value)));
|
|
7164
|
-
},
|
|
7165
|
-
toJSON() {
|
|
7166
|
-
return {
|
|
7167
|
-
_id: "Option",
|
|
7168
|
-
_tag: this._tag,
|
|
7169
|
-
value: toJSON(this.value)
|
|
7170
|
-
};
|
|
7171
|
-
}
|
|
7172
|
-
});
|
|
7173
|
-
const NoneHash = /*#__PURE__*/hash("None");
|
|
7174
|
-
const NoneProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(CommonProto$1), {
|
|
7175
|
-
_tag: "None",
|
|
7176
|
-
_op: "None",
|
|
7177
|
-
[symbol](that) {
|
|
7178
|
-
return isOption(that) && isNone$1(that);
|
|
7179
|
-
},
|
|
7180
|
-
[symbol$1]() {
|
|
7181
|
-
return NoneHash;
|
|
7182
|
-
},
|
|
7183
|
-
toJSON() {
|
|
7184
|
-
return {
|
|
7185
|
-
_id: "Option",
|
|
7186
|
-
_tag: this._tag
|
|
7187
|
-
};
|
|
7188
|
-
}
|
|
7189
|
-
});
|
|
7190
|
-
/** @internal */
|
|
7191
|
-
const isOption = input => hasProperty(input, TypeId$2);
|
|
7192
|
-
/** @internal */
|
|
7193
|
-
const isNone$1 = fa => fa._tag === "None";
|
|
7194
|
-
/** @internal */
|
|
7195
|
-
const isSome$1 = fa => fa._tag === "Some";
|
|
7196
|
-
/** @internal */
|
|
7197
|
-
const none$1 = /*#__PURE__*/Object.create(NoneProto);
|
|
7198
|
-
/** @internal */
|
|
7199
|
-
const some$1 = value => {
|
|
7200
|
-
const a = Object.create(SomeProto);
|
|
7201
|
-
a.value = value;
|
|
7202
|
-
return a;
|
|
7203
|
-
};
|
|
7204
|
-
|
|
7205
|
-
/**
|
|
7206
|
-
* @since 2.0.0
|
|
7207
|
-
*/
|
|
7208
|
-
/**
|
|
7209
|
-
* @internal
|
|
7210
|
-
*/
|
|
7211
|
-
const TypeId$1 = /*#__PURE__*/Symbol.for("effect/Either");
|
|
7212
|
-
const CommonProto = {
|
|
7213
|
-
...EffectPrototype,
|
|
7214
|
-
[TypeId$1]: {
|
|
7215
|
-
_R: _ => _
|
|
7216
|
-
},
|
|
7217
|
-
[NodeInspectSymbol]() {
|
|
7218
|
-
return this.toJSON();
|
|
7219
|
-
},
|
|
7220
|
-
toString() {
|
|
7221
|
-
return format(this.toJSON());
|
|
7222
|
-
}
|
|
7223
|
-
};
|
|
7224
|
-
const RightProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(CommonProto), {
|
|
7225
|
-
_tag: "Right",
|
|
7226
|
-
_op: "Right",
|
|
7227
|
-
[symbol](that) {
|
|
7228
|
-
return isEither(that) && isRight$1(that) && equals(this.right, that.right);
|
|
7229
|
-
},
|
|
7230
|
-
[symbol$1]() {
|
|
7231
|
-
return combine(hash(this._tag))(hash(this.right));
|
|
7232
|
-
},
|
|
7233
|
-
toJSON() {
|
|
7234
|
-
return {
|
|
7235
|
-
_id: "Either",
|
|
7236
|
-
_tag: this._tag,
|
|
7237
|
-
right: toJSON(this.right)
|
|
7238
|
-
};
|
|
7239
|
-
}
|
|
7240
|
-
});
|
|
7241
|
-
const LeftProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(CommonProto), {
|
|
7242
|
-
_tag: "Left",
|
|
7243
|
-
_op: "Left",
|
|
7244
|
-
[symbol](that) {
|
|
7245
|
-
return isEither(that) && isLeft(that) && equals(this.left, that.left);
|
|
7246
|
-
},
|
|
7247
|
-
[symbol$1]() {
|
|
7248
|
-
return combine(hash(this._tag))(hash(this.left));
|
|
7249
|
-
},
|
|
7250
|
-
toJSON() {
|
|
7251
|
-
return {
|
|
7252
|
-
_id: "Either",
|
|
7253
|
-
_tag: this._tag,
|
|
7254
|
-
left: toJSON(this.left)
|
|
7255
|
-
};
|
|
7256
|
-
}
|
|
7257
|
-
});
|
|
7258
|
-
/** @internal */
|
|
7259
|
-
const isEither = input => hasProperty(input, TypeId$1);
|
|
7260
|
-
/** @internal */
|
|
7261
|
-
const isLeft = ma => ma._tag === "Left";
|
|
7262
|
-
/** @internal */
|
|
7263
|
-
const isRight$1 = ma => ma._tag === "Right";
|
|
7264
|
-
/** @internal */
|
|
7265
|
-
const left$1 = left => {
|
|
7266
|
-
const a = Object.create(LeftProto);
|
|
7267
|
-
a.left = left;
|
|
7268
|
-
return a;
|
|
7269
|
-
};
|
|
7270
|
-
/** @internal */
|
|
7271
|
-
const right$1 = right => {
|
|
7272
|
-
const a = Object.create(RightProto);
|
|
7273
|
-
a.right = right;
|
|
7274
|
-
return a;
|
|
7275
|
-
};
|
|
7276
|
-
/** @internal */
|
|
7277
|
-
const getRight$1 = self => isLeft(self) ? none$1 : some$1(self.right);
|
|
7278
|
-
|
|
7279
|
-
/**
|
|
7280
|
-
* @since 2.0.0
|
|
7281
|
-
*/
|
|
7282
|
-
/**
|
|
7283
|
-
* Constructs a new `Either` holding a `Right` value. This usually represents a successful value due to the right bias
|
|
7284
|
-
* of this structure.
|
|
7285
|
-
*
|
|
7286
|
-
* @category constructors
|
|
7287
|
-
* @since 2.0.0
|
|
7288
|
-
*/
|
|
7289
|
-
const right = right$1;
|
|
7290
|
-
/**
|
|
7291
|
-
* Constructs a new `Either` holding a `Left` value. This usually represents a failure, due to the right-bias of this
|
|
7292
|
-
* structure.
|
|
7293
|
-
*
|
|
7294
|
-
* @category constructors
|
|
7295
|
-
* @since 2.0.0
|
|
7296
|
-
*/
|
|
7297
|
-
const left = left$1;
|
|
7298
|
-
/**
|
|
7299
|
-
* Determine if a `Either` is a `Right`.
|
|
7300
|
-
*
|
|
7301
|
-
* @example
|
|
7302
|
-
* ```ts
|
|
7303
|
-
* import * as assert from "node:assert"
|
|
7304
|
-
* import { Either } from "effect"
|
|
7305
|
-
*
|
|
7306
|
-
* assert.deepStrictEqual(Either.isRight(Either.right(1)), true)
|
|
7307
|
-
* assert.deepStrictEqual(Either.isRight(Either.left("a")), false)
|
|
7308
|
-
* ```
|
|
7309
|
-
*
|
|
7310
|
-
* @category guards
|
|
7311
|
-
* @since 2.0.0
|
|
7312
|
-
*/
|
|
7313
|
-
const isRight = isRight$1;
|
|
7314
|
-
/**
|
|
7315
|
-
* Extracts the value of an `Either` or throws if the `Either` is `Left`.
|
|
7316
|
-
*
|
|
7317
|
-
* If a default error is sufficient for your use case and you don't need to configure the thrown error, see {@link getOrThrow}.
|
|
7318
|
-
*
|
|
7319
|
-
* @example
|
|
7320
|
-
* ```ts
|
|
7321
|
-
* import * as assert from "node:assert"
|
|
7322
|
-
* import { Either } from "effect"
|
|
7323
|
-
*
|
|
7324
|
-
* assert.deepStrictEqual(
|
|
7325
|
-
* Either.getOrThrowWith(Either.right(1), () => new Error('Unexpected Left')),
|
|
7326
|
-
* 1
|
|
7327
|
-
* )
|
|
7328
|
-
* assert.throws(() => Either.getOrThrowWith(Either.left("error"), () => new Error('Unexpected Left')))
|
|
7329
|
-
* ```
|
|
7330
|
-
*
|
|
7331
|
-
* @category getters
|
|
7332
|
-
* @since 2.0.0
|
|
7333
|
-
*/
|
|
7334
|
-
const getOrThrowWith = /*#__PURE__*/dual(2, (self, onLeft) => {
|
|
7335
|
-
if (isRight(self)) {
|
|
7336
|
-
return self.right;
|
|
7337
|
-
}
|
|
7338
|
-
throw onLeft(self.left);
|
|
7339
|
-
});
|
|
7340
|
-
|
|
7341
|
-
/**
|
|
7342
|
-
* Represents the absence of a value by creating an empty `Option`.
|
|
7343
|
-
*
|
|
7344
|
-
* `Option.none` returns an `Option<never>`, which is a subtype of `Option<A>`.
|
|
7345
|
-
* This means you can use it in place of any `Option<A>` regardless of the type
|
|
7346
|
-
* `A`.
|
|
7347
|
-
*
|
|
7348
|
-
* **Example** (Creating an Option with No Value)
|
|
7349
|
-
*
|
|
7350
|
-
* ```ts
|
|
7351
|
-
* import { Option } from "effect"
|
|
7352
|
-
*
|
|
7353
|
-
* // An Option holding no value
|
|
7354
|
-
* //
|
|
7355
|
-
* // ┌─── Option<never>
|
|
7356
|
-
* // ▼
|
|
7357
|
-
* const noValue = Option.none()
|
|
7358
|
-
*
|
|
7359
|
-
* console.log(noValue)
|
|
7360
|
-
* // Output: { _id: 'Option', _tag: 'None' }
|
|
7361
|
-
* ```
|
|
7362
|
-
*
|
|
7363
|
-
* @see {@link some} for the opposite operation.
|
|
7364
|
-
*
|
|
7365
|
-
* @category Constructors
|
|
7366
|
-
* @since 2.0.0
|
|
7367
|
-
*/
|
|
7368
|
-
const none = () => none$1;
|
|
7369
|
-
/**
|
|
7370
|
-
* Wraps the given value into an `Option` to represent its presence.
|
|
7371
|
-
*
|
|
7372
|
-
* **Example** (Creating an Option with a Value)
|
|
7373
|
-
*
|
|
7374
|
-
* ```ts
|
|
7375
|
-
* import { Option } from "effect"
|
|
7376
|
-
*
|
|
7377
|
-
* // An Option holding the number 1
|
|
7378
|
-
* //
|
|
7379
|
-
* // ┌─── Option<number>
|
|
7380
|
-
* // ▼
|
|
7381
|
-
* const value = Option.some(1)
|
|
7382
|
-
*
|
|
7383
|
-
* console.log(value)
|
|
7384
|
-
* // Output: { _id: 'Option', _tag: 'Some', value: 1 }
|
|
7385
|
-
* ```
|
|
7386
|
-
*
|
|
7387
|
-
* @see {@link none} for the opposite operation.
|
|
7388
|
-
*
|
|
7389
|
-
* @category Constructors
|
|
7390
|
-
* @since 2.0.0
|
|
7391
|
-
*/
|
|
7392
|
-
const some = some$1;
|
|
7393
|
-
/**
|
|
7394
|
-
* Checks whether an `Option` represents the absence of a value (`None`).
|
|
7395
|
-
*
|
|
7396
|
-
* @example
|
|
7397
|
-
* ```ts
|
|
7398
|
-
* import { Option } from "effect"
|
|
7399
|
-
*
|
|
7400
|
-
* console.log(Option.isNone(Option.some(1)))
|
|
7401
|
-
* // Output: false
|
|
7402
|
-
*
|
|
7403
|
-
* console.log(Option.isNone(Option.none()))
|
|
7404
|
-
* // Output: true
|
|
7405
|
-
* ```
|
|
7406
|
-
*
|
|
7407
|
-
* @see {@link isSome} for the opposite check.
|
|
7408
|
-
*
|
|
7409
|
-
* @category Guards
|
|
7410
|
-
* @since 2.0.0
|
|
7411
|
-
*/
|
|
7412
|
-
const isNone = isNone$1;
|
|
7413
|
-
/**
|
|
7414
|
-
* Checks whether an `Option` contains a value (`Some`).
|
|
7415
|
-
*
|
|
7416
|
-
* @example
|
|
7417
|
-
* ```ts
|
|
7418
|
-
* import { Option } from "effect"
|
|
7419
|
-
*
|
|
7420
|
-
* console.log(Option.isSome(Option.some(1)))
|
|
7421
|
-
* // Output: true
|
|
7422
|
-
*
|
|
7423
|
-
* console.log(Option.isSome(Option.none()))
|
|
7424
|
-
* // Output: false
|
|
7425
|
-
* ```
|
|
7426
|
-
*
|
|
7427
|
-
* @see {@link isNone} for the opposite check.
|
|
7428
|
-
*
|
|
7429
|
-
* @category Guards
|
|
7430
|
-
* @since 2.0.0
|
|
7431
|
-
*/
|
|
7432
|
-
const isSome = isSome$1;
|
|
7433
|
-
/**
|
|
7434
|
-
* Performs pattern matching on an `Option` to handle both `Some` and `None`
|
|
7435
|
-
* cases.
|
|
7436
|
-
*
|
|
7437
|
-
* **Details**
|
|
7438
|
-
*
|
|
7439
|
-
* This function allows you to match against an `Option` and handle both
|
|
7440
|
-
* scenarios: when the `Option` is `None` (i.e., contains no value), and when
|
|
7441
|
-
* the `Option` is `Some` (i.e., contains a value). It executes one of the
|
|
7442
|
-
* provided functions based on the case:
|
|
7443
|
-
*
|
|
7444
|
-
* - If the `Option` is `None`, the `onNone` function is executed and its result
|
|
7445
|
-
* is returned.
|
|
7446
|
-
* - If the `Option` is `Some`, the `onSome` function is executed with the
|
|
7447
|
-
* contained value, and its result is returned.
|
|
7448
|
-
*
|
|
7449
|
-
* This function provides a concise and functional way to handle optional values
|
|
7450
|
-
* without resorting to `if` or manual checks, making your code more declarative
|
|
7451
|
-
* and readable.
|
|
7452
|
-
*
|
|
7453
|
-
* **Example** (Pattern Matching with Option)
|
|
7454
|
-
*
|
|
7455
|
-
* ```ts
|
|
7456
|
-
* import { Option } from "effect"
|
|
7457
|
-
*
|
|
7458
|
-
* const foo = Option.some(1)
|
|
7459
|
-
*
|
|
7460
|
-
* const message = Option.match(foo, {
|
|
7461
|
-
* onNone: () => "Option is empty",
|
|
7462
|
-
* onSome: (value) => `Option has a value: ${value}`
|
|
7463
|
-
* })
|
|
7464
|
-
*
|
|
7465
|
-
* console.log(message)
|
|
7466
|
-
* // Output: "Option has a value: 1"
|
|
7467
|
-
* ```
|
|
7468
|
-
*
|
|
7469
|
-
* @category Pattern matching
|
|
7470
|
-
* @since 2.0.0
|
|
7471
|
-
*/
|
|
7472
|
-
const match = /*#__PURE__*/dual(2, (self, {
|
|
7473
|
-
onNone,
|
|
7474
|
-
onSome
|
|
7475
|
-
}) => isNone(self) ? onNone() : onSome(self.value));
|
|
7476
|
-
/**
|
|
7477
|
-
* Converts an `Either` into an `Option` by discarding the error and extracting
|
|
7478
|
-
* the right value.
|
|
7479
|
-
*
|
|
7480
|
-
* **Details**
|
|
7481
|
-
*
|
|
7482
|
-
* This function takes an `Either` and returns an `Option` based on its value:
|
|
7483
|
-
*
|
|
7484
|
-
* - If the `Either` is a `Right`, its value is wrapped in a `Some` and
|
|
7485
|
-
* returned.
|
|
7486
|
-
* - If the `Either` is a `Left`, the error is discarded, and `None` is
|
|
7487
|
-
* returned.
|
|
7488
|
-
*
|
|
7489
|
-
* This is particularly useful when you only care about the success case
|
|
7490
|
-
* (`Right`) of an `Either` and want to handle the result using `Option`. By
|
|
7491
|
-
* using this function, you can convert `Either` into a simpler structure for
|
|
7492
|
-
* cases where error handling is not required.
|
|
7493
|
-
*
|
|
7494
|
-
* @example
|
|
7495
|
-
* ```ts
|
|
7496
|
-
* import { Either, Option } from "effect"
|
|
7497
|
-
*
|
|
7498
|
-
* console.log(Option.getRight(Either.right("ok")))
|
|
7499
|
-
* // Output: { _id: 'Option', _tag: 'Some', value: 'ok' }
|
|
7500
|
-
*
|
|
7501
|
-
* console.log(Option.getRight(Either.left("err")))
|
|
7502
|
-
* // Output: { _id: 'Option', _tag: 'None' }
|
|
7503
|
-
* ```
|
|
7504
|
-
*
|
|
7505
|
-
* @see {@link getLeft} for the opposite operation.
|
|
7506
|
-
*
|
|
7507
|
-
* @category Conversions
|
|
7508
|
-
* @since 2.0.0
|
|
7509
|
-
*/
|
|
7510
|
-
const getRight = getRight$1;
|
|
7511
|
-
/**
|
|
7512
|
-
* Returns the value contained in the `Option` if it is `Some`, otherwise
|
|
7513
|
-
* evaluates and returns the result of `onNone`.
|
|
7514
|
-
*
|
|
7515
|
-
* **Details**
|
|
7516
|
-
*
|
|
7517
|
-
* This function allows you to provide a fallback value or computation for when
|
|
7518
|
-
* an `Option` is `None`. If the `Option` contains a value (`Some`), that value
|
|
7519
|
-
* is returned. If it is empty (`None`), the `onNone` function is executed, and
|
|
7520
|
-
* its result is returned instead.
|
|
7521
|
-
*
|
|
7522
|
-
* This utility is helpful for safely handling `Option` values by ensuring you
|
|
7523
|
-
* always receive a meaningful result, whether or not the `Option` contains a
|
|
7524
|
-
* value. It is particularly useful for providing default values or alternative
|
|
7525
|
-
* logic when working with optional values.
|
|
7526
|
-
*
|
|
7527
|
-
* @example
|
|
7528
|
-
* ```ts
|
|
7529
|
-
* import { Option } from "effect"
|
|
7530
|
-
*
|
|
7531
|
-
* console.log(Option.some(1).pipe(Option.getOrElse(() => 0)))
|
|
7532
|
-
* // Output: 1
|
|
7533
|
-
*
|
|
7534
|
-
* console.log(Option.none().pipe(Option.getOrElse(() => 0)))
|
|
7535
|
-
* // Output: 0
|
|
7536
|
-
* ```
|
|
7537
|
-
*
|
|
7538
|
-
* @see {@link getOrNull} for a version that returns `null` instead of executing a function.
|
|
7539
|
-
* @see {@link getOrUndefined} for a version that returns `undefined` instead of executing a function.
|
|
7540
|
-
*
|
|
7541
|
-
* @category Getters
|
|
7542
|
-
* @since 2.0.0
|
|
7543
|
-
*/
|
|
7544
|
-
const getOrElse = /*#__PURE__*/dual(2, (self, onNone) => isNone(self) ? onNone() : self.value);
|
|
7545
|
-
/**
|
|
7546
|
-
* Returns the value contained in the `Option` if it is `Some`; otherwise,
|
|
7547
|
-
* returns `undefined`.
|
|
7548
|
-
*
|
|
7549
|
-
* **Details**
|
|
7550
|
-
*
|
|
7551
|
-
* This function provides a way to extract the value of an `Option` while
|
|
7552
|
-
* falling back to `undefined` if the `Option` is `None`.
|
|
7553
|
-
*
|
|
7554
|
-
* It is particularly useful in scenarios where `undefined` is an acceptable
|
|
7555
|
-
* placeholder for the absence of a value, such as when interacting with APIs or
|
|
7556
|
-
* systems that use `undefined` as a default for missing values.
|
|
7557
|
-
*
|
|
7558
|
-
* @example
|
|
7559
|
-
* ```ts
|
|
7560
|
-
* import { Option } from "effect"
|
|
7561
|
-
*
|
|
7562
|
-
* console.log(Option.getOrUndefined(Option.some(1)))
|
|
7563
|
-
* // Output: 1
|
|
7564
|
-
*
|
|
7565
|
-
* console.log(Option.getOrUndefined(Option.none()))
|
|
7566
|
-
* // Output: undefined
|
|
7567
|
-
* ```
|
|
7568
|
-
*
|
|
7569
|
-
* @category Getters
|
|
7570
|
-
* @since 2.0.0
|
|
7571
|
-
*/
|
|
7572
|
-
const getOrUndefined = /*#__PURE__*/getOrElse(constUndefined);
|
|
7573
|
-
|
|
7574
|
-
/**
|
|
7575
|
-
* This module provides utility functions for working with arrays in TypeScript.
|
|
7576
|
-
*
|
|
7577
|
-
* @since 2.0.0
|
|
7578
|
-
*/
|
|
7579
|
-
/**
|
|
7580
|
-
* Creates a new `Array` from an iterable collection of values.
|
|
7581
|
-
* If the input is already an array, it returns the input as-is.
|
|
7582
|
-
* Otherwise, it converts the iterable collection to an array.
|
|
7583
|
-
*
|
|
7584
|
-
* **Example**
|
|
7585
|
-
*
|
|
7586
|
-
* ```ts
|
|
7587
|
-
* import { Array } from "effect"
|
|
7588
|
-
*
|
|
7589
|
-
* const result = Array.fromIterable(new Set([1, 2, 3]))
|
|
7590
|
-
* console.log(result) // [1, 2, 3]
|
|
7591
|
-
* ```
|
|
7592
|
-
*
|
|
7593
|
-
* @category constructors
|
|
7594
|
-
* @since 2.0.0
|
|
7595
|
-
*/
|
|
7596
|
-
const fromIterable = collection => Array.isArray(collection) ? collection : Array.from(collection);
|
|
7597
|
-
/**
|
|
7598
|
-
* Reverse an `Iterable`, creating a new `Array`.
|
|
7599
|
-
*
|
|
7600
|
-
* **Example**
|
|
7601
|
-
*
|
|
7602
|
-
* ```ts
|
|
7603
|
-
* import { Array } from "effect"
|
|
7604
|
-
*
|
|
7605
|
-
* const result = Array.reverse([1, 2, 3, 4])
|
|
7606
|
-
* console.log(result) // [4, 3, 2, 1]
|
|
7607
|
-
* ```
|
|
7608
|
-
*
|
|
7609
|
-
* @category elements
|
|
7610
|
-
* @since 2.0.0
|
|
7611
|
-
*/
|
|
7612
|
-
const reverse$1 = self => Array.from(self).reverse();
|
|
7613
|
-
/**
|
|
7614
|
-
* Reduces an array from the left.
|
|
7615
|
-
*
|
|
7616
|
-
* **Example**
|
|
7617
|
-
*
|
|
7618
|
-
* ```ts
|
|
7619
|
-
* import { Array } from "effect"
|
|
7620
|
-
*
|
|
7621
|
-
* const result = Array.reduce([1, 2, 3], 0, (acc, n) => acc + n)
|
|
7622
|
-
* console.log(result) // 6
|
|
7623
|
-
* ```
|
|
7624
|
-
*
|
|
7625
|
-
* @category folding
|
|
7626
|
-
* @since 2.0.0
|
|
7627
|
-
*/
|
|
7628
|
-
const reduce$2 = /*#__PURE__*/dual(3, (self, b, f) => fromIterable(self).reduce((b, a, i) => f(b, a, i), b));
|
|
7629
|
-
|
|
7630
|
-
/**
|
|
7631
|
-
* This module provides types and utility functions to create and work with branded types,
|
|
7632
|
-
* which are TypeScript types with an added type tag to prevent accidental usage of a value in the wrong context.
|
|
7633
|
-
*
|
|
7634
|
-
* The `refined` and `nominal` functions are both used to create branded types in TypeScript.
|
|
7635
|
-
* The main difference between them is that `refined` allows for validation of the data, while `nominal` does not.
|
|
7636
|
-
*
|
|
7637
|
-
* 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.
|
|
7638
|
-
* This is useful when you want to distinguish between two values of the same type that have different meanings.
|
|
7639
|
-
* The `nominal` function does not perform any validation of the input data.
|
|
7640
|
-
*
|
|
7641
|
-
* On the other hand, the `refined` function is used to create a new branded type that has the same underlying type as the input,
|
|
7642
|
-
* but with a different name, and it also allows for validation of the input data.
|
|
7643
|
-
* The `refined` function takes a predicate that is used to validate the input data.
|
|
7644
|
-
* If the input data fails the validation, a `BrandErrors` is returned, which provides information about the specific validation failure.
|
|
7645
|
-
*
|
|
7646
|
-
* @since 2.0.0
|
|
7647
|
-
*/
|
|
7648
|
-
/**
|
|
7649
|
-
* @since 2.0.0
|
|
7650
|
-
* @category symbols
|
|
7651
|
-
*/
|
|
7652
|
-
const RefinedConstructorsTypeId = /*#__PURE__*/Symbol.for("effect/Brand/Refined");
|
|
7653
|
-
/**
|
|
7654
|
-
* Returns a `BrandErrors` that contains a single `RefinementError`.
|
|
7655
|
-
*
|
|
7656
|
-
* @since 2.0.0
|
|
7657
|
-
* @category constructors
|
|
7658
|
-
*/
|
|
7659
|
-
const error = (message, meta) => [{
|
|
7660
|
-
message,
|
|
7661
|
-
meta
|
|
7662
|
-
}];
|
|
7663
|
-
function refined(...args) {
|
|
7664
|
-
const either = args.length === 2 ? unbranded => args[0](unbranded) ? right(unbranded) : left(args[1](unbranded)) : unbranded => {
|
|
7665
|
-
return match(args[0](unbranded), {
|
|
7666
|
-
onNone: () => right(unbranded),
|
|
7667
|
-
onSome: left
|
|
7668
|
-
});
|
|
7669
|
-
};
|
|
7670
|
-
return Object.assign(unbranded => getOrThrowWith(either(unbranded), identity), {
|
|
7671
|
-
[RefinedConstructorsTypeId]: RefinedConstructorsTypeId,
|
|
7672
|
-
option: args => getRight(either(args)),
|
|
7673
|
-
either,
|
|
7674
|
-
is: args => isRight(either(args))
|
|
7675
|
-
});
|
|
7676
|
-
}
|
|
7677
|
-
|
|
7678
|
-
/**
|
|
7679
|
-
* @since 2.0.0
|
|
7680
|
-
*/
|
|
7681
|
-
const TypeId = /*#__PURE__*/Symbol.for("effect/Chunk");
|
|
7682
|
-
function copy(src, srcPos, dest, destPos, len) {
|
|
7683
|
-
for (let i = srcPos; i < Math.min(src.length, srcPos + len); i++) {
|
|
7684
|
-
dest[destPos + i - srcPos] = src[i];
|
|
7685
|
-
}
|
|
7686
|
-
return dest;
|
|
7687
|
-
}
|
|
7688
|
-
const emptyArray = [];
|
|
7689
|
-
/**
|
|
7690
|
-
* Compares the two chunks of equal length using the specified function
|
|
7691
|
-
*
|
|
7692
|
-
* @category equivalence
|
|
7693
|
-
* @since 2.0.0
|
|
7694
|
-
*/
|
|
7695
|
-
const getEquivalence = isEquivalent => make$2((self, that) => self.length === that.length && toReadonlyArray(self).every((value, i) => isEquivalent(value, unsafeGet(that, i))));
|
|
7696
|
-
const _equivalence = /*#__PURE__*/getEquivalence(equals);
|
|
7697
|
-
const ChunkProto = {
|
|
7698
|
-
[TypeId]: {
|
|
7699
|
-
_A: _ => _
|
|
7700
|
-
},
|
|
7701
|
-
toString() {
|
|
7702
|
-
return format(this.toJSON());
|
|
7703
|
-
},
|
|
7704
|
-
toJSON() {
|
|
7705
|
-
return {
|
|
7706
|
-
_id: "Chunk",
|
|
7707
|
-
values: toReadonlyArray(this).map(toJSON)
|
|
7708
|
-
};
|
|
7709
|
-
},
|
|
7710
|
-
[NodeInspectSymbol]() {
|
|
7711
|
-
return this.toJSON();
|
|
7712
|
-
},
|
|
7713
|
-
[symbol](that) {
|
|
7714
|
-
return isChunk(that) && _equivalence(this, that);
|
|
7715
|
-
},
|
|
7716
|
-
[symbol$1]() {
|
|
7717
|
-
return cached(this, array(toReadonlyArray(this)));
|
|
7718
|
-
},
|
|
7719
|
-
[Symbol.iterator]() {
|
|
7720
|
-
switch (this.backing._tag) {
|
|
7721
|
-
case "IArray":
|
|
7722
|
-
{
|
|
7723
|
-
return this.backing.array[Symbol.iterator]();
|
|
7724
|
-
}
|
|
7725
|
-
case "IEmpty":
|
|
7726
|
-
{
|
|
7727
|
-
return emptyArray[Symbol.iterator]();
|
|
7728
|
-
}
|
|
7729
|
-
default:
|
|
7730
|
-
{
|
|
7731
|
-
return toReadonlyArray(this)[Symbol.iterator]();
|
|
7732
|
-
}
|
|
7733
|
-
}
|
|
7734
|
-
},
|
|
7735
|
-
pipe() {
|
|
7736
|
-
return pipeArguments(this, arguments);
|
|
7737
|
-
}
|
|
7738
|
-
};
|
|
7739
|
-
const makeChunk = backing => {
|
|
7740
|
-
const chunk = Object.create(ChunkProto);
|
|
7741
|
-
chunk.backing = backing;
|
|
7742
|
-
switch (backing._tag) {
|
|
7743
|
-
case "IEmpty":
|
|
7744
|
-
{
|
|
7745
|
-
chunk.length = 0;
|
|
7746
|
-
chunk.depth = 0;
|
|
7747
|
-
chunk.left = chunk;
|
|
7748
|
-
chunk.right = chunk;
|
|
7749
|
-
break;
|
|
7750
|
-
}
|
|
7751
|
-
case "IConcat":
|
|
7752
|
-
{
|
|
7753
|
-
chunk.length = backing.left.length + backing.right.length;
|
|
7754
|
-
chunk.depth = 1 + Math.max(backing.left.depth, backing.right.depth);
|
|
7755
|
-
chunk.left = backing.left;
|
|
7756
|
-
chunk.right = backing.right;
|
|
7757
|
-
break;
|
|
7758
|
-
}
|
|
7759
|
-
case "IArray":
|
|
7760
|
-
{
|
|
7761
|
-
chunk.length = backing.array.length;
|
|
7762
|
-
chunk.depth = 0;
|
|
7763
|
-
chunk.left = _empty$2;
|
|
7764
|
-
chunk.right = _empty$2;
|
|
7765
|
-
break;
|
|
7766
|
-
}
|
|
7767
|
-
case "ISingleton":
|
|
7768
|
-
{
|
|
7769
|
-
chunk.length = 1;
|
|
7770
|
-
chunk.depth = 0;
|
|
7771
|
-
chunk.left = _empty$2;
|
|
7772
|
-
chunk.right = _empty$2;
|
|
7773
|
-
break;
|
|
7774
|
-
}
|
|
7775
|
-
case "ISlice":
|
|
7776
|
-
{
|
|
7777
|
-
chunk.length = backing.length;
|
|
7778
|
-
chunk.depth = backing.chunk.depth + 1;
|
|
7779
|
-
chunk.left = _empty$2;
|
|
7780
|
-
chunk.right = _empty$2;
|
|
7781
|
-
break;
|
|
7782
|
-
}
|
|
7783
|
-
}
|
|
7784
|
-
return chunk;
|
|
7785
|
-
};
|
|
7786
|
-
/**
|
|
7787
|
-
* Checks if `u` is a `Chunk<unknown>`
|
|
7788
|
-
*
|
|
7789
|
-
* @category constructors
|
|
7790
|
-
* @since 2.0.0
|
|
7791
|
-
*/
|
|
7792
|
-
const isChunk = u => hasProperty(u, TypeId);
|
|
7793
|
-
const _empty$2 = /*#__PURE__*/makeChunk({
|
|
7794
|
-
_tag: "IEmpty"
|
|
7795
|
-
});
|
|
7796
|
-
/**
|
|
7797
|
-
* @category constructors
|
|
7798
|
-
* @since 2.0.0
|
|
7799
|
-
*/
|
|
7800
|
-
const empty$3 = () => _empty$2;
|
|
7801
|
-
/**
|
|
7802
|
-
* Builds a `NonEmptyChunk` from an non-empty collection of elements.
|
|
7803
|
-
*
|
|
7804
|
-
* @category constructors
|
|
7805
|
-
* @since 2.0.0
|
|
7806
|
-
*/
|
|
7807
|
-
const make$1 = (...as) => unsafeFromNonEmptyArray(as);
|
|
7808
|
-
/**
|
|
7809
|
-
* Builds a `NonEmptyChunk` from a single element.
|
|
7810
|
-
*
|
|
7811
|
-
* @category constructors
|
|
7812
|
-
* @since 2.0.0
|
|
7813
|
-
*/
|
|
7814
|
-
const of = a => makeChunk({
|
|
7815
|
-
_tag: "ISingleton",
|
|
7816
|
-
a
|
|
7817
|
-
});
|
|
7818
|
-
const copyToArray = (self, array, initial) => {
|
|
7819
|
-
switch (self.backing._tag) {
|
|
7820
|
-
case "IArray":
|
|
7821
|
-
{
|
|
7822
|
-
copy(self.backing.array, 0, array, initial, self.length);
|
|
7823
|
-
break;
|
|
7824
|
-
}
|
|
7825
|
-
case "IConcat":
|
|
7826
|
-
{
|
|
7827
|
-
copyToArray(self.left, array, initial);
|
|
7828
|
-
copyToArray(self.right, array, initial + self.left.length);
|
|
7829
|
-
break;
|
|
7830
|
-
}
|
|
7831
|
-
case "ISingleton":
|
|
7832
|
-
{
|
|
7833
|
-
array[initial] = self.backing.a;
|
|
7834
|
-
break;
|
|
7835
|
-
}
|
|
7836
|
-
case "ISlice":
|
|
7837
|
-
{
|
|
7838
|
-
let i = 0;
|
|
7839
|
-
let j = initial;
|
|
7840
|
-
while (i < self.length) {
|
|
7841
|
-
array[j] = unsafeGet(self, i);
|
|
7842
|
-
i += 1;
|
|
7843
|
-
j += 1;
|
|
7844
|
-
}
|
|
7845
|
-
break;
|
|
7846
|
-
}
|
|
7847
|
-
}
|
|
7848
|
-
};
|
|
7849
|
-
const toReadonlyArray_ = self => {
|
|
7850
|
-
switch (self.backing._tag) {
|
|
7851
|
-
case "IEmpty":
|
|
7852
|
-
{
|
|
7853
|
-
return emptyArray;
|
|
7854
|
-
}
|
|
7855
|
-
case "IArray":
|
|
7856
|
-
{
|
|
7857
|
-
return self.backing.array;
|
|
7858
|
-
}
|
|
7859
|
-
default:
|
|
7860
|
-
{
|
|
7861
|
-
const arr = new Array(self.length);
|
|
7862
|
-
copyToArray(self, arr, 0);
|
|
7863
|
-
self.backing = {
|
|
7864
|
-
_tag: "IArray",
|
|
7865
|
-
array: arr
|
|
7866
|
-
};
|
|
7867
|
-
self.left = _empty$2;
|
|
7868
|
-
self.right = _empty$2;
|
|
7869
|
-
self.depth = 0;
|
|
7870
|
-
return arr;
|
|
7871
|
-
}
|
|
7872
|
-
}
|
|
7873
|
-
};
|
|
7874
|
-
/**
|
|
7875
|
-
* Converts a `Chunk` into a `ReadonlyArray`. If the provided `Chunk` is
|
|
7876
|
-
* non-empty (`NonEmptyChunk`), the function will return a
|
|
7877
|
-
* `NonEmptyReadonlyArray`, ensuring the non-empty property is preserved.
|
|
7878
|
-
*
|
|
7879
|
-
* @category conversions
|
|
7880
|
-
* @since 2.0.0
|
|
7881
|
-
*/
|
|
7882
|
-
const toReadonlyArray = toReadonlyArray_;
|
|
7883
|
-
const reverseChunk = self => {
|
|
7884
|
-
switch (self.backing._tag) {
|
|
7885
|
-
case "IEmpty":
|
|
7886
|
-
case "ISingleton":
|
|
7887
|
-
return self;
|
|
7888
|
-
case "IArray":
|
|
7889
|
-
{
|
|
7890
|
-
return makeChunk({
|
|
7891
|
-
_tag: "IArray",
|
|
7892
|
-
array: reverse$1(self.backing.array)
|
|
7893
|
-
});
|
|
7894
|
-
}
|
|
7895
|
-
case "IConcat":
|
|
7896
|
-
{
|
|
7897
|
-
return makeChunk({
|
|
7898
|
-
_tag: "IConcat",
|
|
7899
|
-
left: reverse(self.backing.right),
|
|
7900
|
-
right: reverse(self.backing.left)
|
|
7901
|
-
});
|
|
7902
|
-
}
|
|
7903
|
-
case "ISlice":
|
|
7904
|
-
return unsafeFromArray(reverse$1(toReadonlyArray(self)));
|
|
7905
|
-
}
|
|
7906
|
-
};
|
|
7907
|
-
/**
|
|
7908
|
-
* Reverses the order of elements in a `Chunk`.
|
|
7909
|
-
* Importantly, if the input chunk is a `NonEmptyChunk`, the reversed chunk will also be a `NonEmptyChunk`.
|
|
7910
|
-
*
|
|
7911
|
-
* **Example**
|
|
7912
|
-
*
|
|
7913
|
-
* ```ts
|
|
7914
|
-
* import { Chunk } from "effect"
|
|
7915
|
-
*
|
|
7916
|
-
* const chunk = Chunk.make(1, 2, 3)
|
|
7917
|
-
* const result = Chunk.reverse(chunk)
|
|
7918
|
-
*
|
|
7919
|
-
* console.log(result)
|
|
7920
|
-
* // { _id: 'Chunk', values: [ 3, 2, 1 ] }
|
|
7921
|
-
* ```
|
|
7922
|
-
*
|
|
7923
|
-
* @since 2.0.0
|
|
7924
|
-
* @category elements
|
|
7925
|
-
*/
|
|
7926
|
-
const reverse = reverseChunk;
|
|
7927
|
-
/**
|
|
7928
|
-
* Wraps an array into a chunk without copying, unsafe on mutable arrays
|
|
7929
|
-
*
|
|
7930
|
-
* @since 2.0.0
|
|
7931
|
-
* @category unsafe
|
|
7932
|
-
*/
|
|
7933
|
-
const unsafeFromArray = self => self.length === 0 ? empty$3() : self.length === 1 ? of(self[0]) : makeChunk({
|
|
7934
|
-
_tag: "IArray",
|
|
7935
|
-
array: self
|
|
7936
|
-
});
|
|
7937
|
-
/**
|
|
7938
|
-
* Wraps an array into a chunk without copying, unsafe on mutable arrays
|
|
7939
|
-
*
|
|
7940
|
-
* @since 2.0.0
|
|
7941
|
-
* @category unsafe
|
|
7942
|
-
*/
|
|
7943
|
-
const unsafeFromNonEmptyArray = self => unsafeFromArray(self);
|
|
7944
|
-
/**
|
|
7945
|
-
* Gets an element unsafely, will throw on out of bounds
|
|
7946
|
-
*
|
|
7947
|
-
* @since 2.0.0
|
|
7948
|
-
* @category unsafe
|
|
7949
|
-
*/
|
|
7950
|
-
const unsafeGet = /*#__PURE__*/dual(2, (self, index) => {
|
|
7951
|
-
switch (self.backing._tag) {
|
|
7952
|
-
case "IEmpty":
|
|
7953
|
-
{
|
|
7954
|
-
throw new Error(`Index out of bounds`);
|
|
7955
|
-
}
|
|
7956
|
-
case "ISingleton":
|
|
7957
|
-
{
|
|
7958
|
-
if (index !== 0) {
|
|
7959
|
-
throw new Error(`Index out of bounds`);
|
|
7960
|
-
}
|
|
7961
|
-
return self.backing.a;
|
|
7962
|
-
}
|
|
7963
|
-
case "IArray":
|
|
7964
|
-
{
|
|
7965
|
-
if (index >= self.length || index < 0) {
|
|
7966
|
-
throw new Error(`Index out of bounds`);
|
|
7967
|
-
}
|
|
7968
|
-
return self.backing.array[index];
|
|
7969
|
-
}
|
|
7970
|
-
case "IConcat":
|
|
7971
|
-
{
|
|
7972
|
-
return index < self.left.length ? unsafeGet(self.left, index) : unsafeGet(self.right, index - self.left.length);
|
|
7973
|
-
}
|
|
7974
|
-
case "ISlice":
|
|
7975
|
-
{
|
|
7976
|
-
return unsafeGet(self.backing.chunk, index + self.backing.offset);
|
|
7977
|
-
}
|
|
7978
|
-
}
|
|
7979
|
-
});
|
|
7980
|
-
/**
|
|
7981
|
-
* Prepend an element to the front of a `Chunk`, creating a new `NonEmptyChunk`.
|
|
7982
|
-
*
|
|
7983
|
-
* @category concatenating
|
|
7984
|
-
* @since 2.0.0
|
|
7985
|
-
*/
|
|
7986
|
-
const prepend = /*#__PURE__*/dual(2, (self, elem) => appendAll(of(elem), self));
|
|
7987
|
-
/**
|
|
7988
|
-
* Concatenates two chunks, combining their elements.
|
|
7989
|
-
* If either chunk is non-empty, the result is also a non-empty chunk.
|
|
7990
|
-
*
|
|
7991
|
-
* **Example**
|
|
7992
|
-
*
|
|
7993
|
-
* ```ts
|
|
7994
|
-
* import { Chunk } from "effect"
|
|
7995
|
-
*
|
|
7996
|
-
* const result = Chunk.make(1, 2).pipe(Chunk.appendAll(Chunk.make("a", "b")), Chunk.toArray)
|
|
7997
|
-
*
|
|
7998
|
-
* console.log(result)
|
|
7999
|
-
* // [ 1, 2, "a", "b" ]
|
|
8000
|
-
* ```
|
|
8001
|
-
*
|
|
8002
|
-
* @category concatenating
|
|
8003
|
-
* @since 2.0.0
|
|
8004
|
-
*/
|
|
8005
|
-
const appendAll = /*#__PURE__*/dual(2, (self, that) => {
|
|
8006
|
-
if (self.backing._tag === "IEmpty") {
|
|
8007
|
-
return that;
|
|
8008
|
-
}
|
|
8009
|
-
if (that.backing._tag === "IEmpty") {
|
|
8010
|
-
return self;
|
|
8011
|
-
}
|
|
8012
|
-
const diff = that.depth - self.depth;
|
|
8013
|
-
if (Math.abs(diff) <= 1) {
|
|
8014
|
-
return makeChunk({
|
|
8015
|
-
_tag: "IConcat",
|
|
8016
|
-
left: self,
|
|
8017
|
-
right: that
|
|
8018
|
-
});
|
|
8019
|
-
} else if (diff < -1) {
|
|
8020
|
-
if (self.left.depth >= self.right.depth) {
|
|
8021
|
-
const nr = appendAll(self.right, that);
|
|
8022
|
-
return makeChunk({
|
|
8023
|
-
_tag: "IConcat",
|
|
8024
|
-
left: self.left,
|
|
8025
|
-
right: nr
|
|
8026
|
-
});
|
|
8027
|
-
} else {
|
|
8028
|
-
const nrr = appendAll(self.right.right, that);
|
|
8029
|
-
if (nrr.depth === self.depth - 3) {
|
|
8030
|
-
const nr = makeChunk({
|
|
8031
|
-
_tag: "IConcat",
|
|
8032
|
-
left: self.right.left,
|
|
8033
|
-
right: nrr
|
|
8034
|
-
});
|
|
8035
|
-
return makeChunk({
|
|
8036
|
-
_tag: "IConcat",
|
|
8037
|
-
left: self.left,
|
|
8038
|
-
right: nr
|
|
8039
|
-
});
|
|
8040
|
-
} else {
|
|
8041
|
-
const nl = makeChunk({
|
|
8042
|
-
_tag: "IConcat",
|
|
8043
|
-
left: self.left,
|
|
8044
|
-
right: self.right.left
|
|
8045
|
-
});
|
|
8046
|
-
return makeChunk({
|
|
8047
|
-
_tag: "IConcat",
|
|
8048
|
-
left: nl,
|
|
8049
|
-
right: nrr
|
|
8050
|
-
});
|
|
8051
|
-
}
|
|
8052
|
-
}
|
|
8053
|
-
} else {
|
|
8054
|
-
if (that.right.depth >= that.left.depth) {
|
|
8055
|
-
const nl = appendAll(self, that.left);
|
|
8056
|
-
return makeChunk({
|
|
8057
|
-
_tag: "IConcat",
|
|
8058
|
-
left: nl,
|
|
8059
|
-
right: that.right
|
|
8060
|
-
});
|
|
8061
|
-
} else {
|
|
8062
|
-
const nll = appendAll(self, that.left.left);
|
|
8063
|
-
if (nll.depth === that.depth - 3) {
|
|
8064
|
-
const nl = makeChunk({
|
|
8065
|
-
_tag: "IConcat",
|
|
8066
|
-
left: nll,
|
|
8067
|
-
right: that.left.right
|
|
8068
|
-
});
|
|
8069
|
-
return makeChunk({
|
|
8070
|
-
_tag: "IConcat",
|
|
8071
|
-
left: nl,
|
|
8072
|
-
right: that.right
|
|
8073
|
-
});
|
|
8074
|
-
} else {
|
|
8075
|
-
const nr = makeChunk({
|
|
8076
|
-
_tag: "IConcat",
|
|
8077
|
-
left: that.left.right,
|
|
8078
|
-
right: that.right
|
|
8079
|
-
});
|
|
8080
|
-
return makeChunk({
|
|
8081
|
-
_tag: "IConcat",
|
|
8082
|
-
left: nll,
|
|
8083
|
-
right: nr
|
|
8084
|
-
});
|
|
8085
|
-
}
|
|
8086
|
-
}
|
|
8087
|
-
}
|
|
8088
|
-
});
|
|
8089
|
-
/**
|
|
8090
|
-
* Determines if the chunk is empty.
|
|
8091
|
-
*
|
|
8092
|
-
* @since 2.0.0
|
|
8093
|
-
* @category elements
|
|
8094
|
-
*/
|
|
8095
|
-
const isEmpty = self => self.length === 0;
|
|
8096
|
-
/**
|
|
8097
|
-
* Determines if the chunk is not empty.
|
|
8098
|
-
*
|
|
8099
|
-
* @since 2.0.0
|
|
8100
|
-
* @category elements
|
|
8101
|
-
*/
|
|
8102
|
-
const isNonEmpty = self => self.length > 0;
|
|
8103
|
-
/**
|
|
8104
|
-
* Returns the first element of this chunk.
|
|
8105
|
-
*
|
|
8106
|
-
* It will throw an error if the chunk is empty.
|
|
8107
|
-
*
|
|
8108
|
-
* @since 2.0.0
|
|
8109
|
-
* @category unsafe
|
|
8110
|
-
*/
|
|
8111
|
-
const unsafeHead = self => unsafeGet(self, 0);
|
|
8112
|
-
/**
|
|
8113
|
-
* Returns the first element of this non empty chunk.
|
|
8114
|
-
*
|
|
8115
|
-
* @since 2.0.0
|
|
8116
|
-
* @category elements
|
|
8117
|
-
*/
|
|
8118
|
-
const headNonEmpty = unsafeHead;
|
|
8119
|
-
|
|
8120
|
-
/** @internal */
|
|
8121
|
-
const SIZE = 5;
|
|
8122
|
-
/** @internal */
|
|
8123
|
-
const BUCKET_SIZE = /*#__PURE__*/Math.pow(2, SIZE);
|
|
8124
|
-
/** @internal */
|
|
8125
|
-
const MASK = BUCKET_SIZE - 1;
|
|
8126
|
-
/** @internal */
|
|
8127
|
-
const MAX_INDEX_NODE = BUCKET_SIZE / 2;
|
|
8128
|
-
/** @internal */
|
|
8129
|
-
const MIN_ARRAY_NODE = BUCKET_SIZE / 4;
|
|
8130
|
-
|
|
8131
|
-
/**
|
|
8132
|
-
* Hamming weight.
|
|
8133
|
-
*
|
|
8134
|
-
* Taken from: http://jsperf.com/hamming-weight
|
|
8135
|
-
*
|
|
8136
|
-
* @internal
|
|
8137
|
-
*/
|
|
8138
|
-
function popcount(x) {
|
|
8139
|
-
x -= x >> 1 & 0x55555555;
|
|
8140
|
-
x = (x & 0x33333333) + (x >> 2 & 0x33333333);
|
|
8141
|
-
x = x + (x >> 4) & 0x0f0f0f0f;
|
|
8142
|
-
x += x >> 8;
|
|
8143
|
-
x += x >> 16;
|
|
8144
|
-
return x & 0x7f;
|
|
8145
|
-
}
|
|
8146
|
-
/** @internal */
|
|
8147
|
-
function hashFragment(shift, h) {
|
|
8148
|
-
return h >>> shift & MASK;
|
|
8149
|
-
}
|
|
8150
|
-
/** @internal */
|
|
8151
|
-
function toBitmap(x) {
|
|
8152
|
-
return 1 << x;
|
|
8153
|
-
}
|
|
8154
|
-
/** @internal */
|
|
8155
|
-
function fromBitmap(bitmap, bit) {
|
|
8156
|
-
return popcount(bitmap & bit - 1);
|
|
8157
|
-
}
|
|
8158
|
-
|
|
8159
|
-
const make = (value, previous) => ({
|
|
8160
|
-
value,
|
|
8161
|
-
previous
|
|
8162
|
-
});
|
|
8163
|
-
|
|
8164
|
-
/** @internal */
|
|
8165
|
-
function arrayUpdate(mutate, at, v, arr) {
|
|
8166
|
-
let out = arr;
|
|
8167
|
-
if (!mutate) {
|
|
8168
|
-
const len = arr.length;
|
|
8169
|
-
out = new Array(len);
|
|
8170
|
-
for (let i = 0; i < len; ++i) out[i] = arr[i];
|
|
8171
|
-
}
|
|
8172
|
-
out[at] = v;
|
|
8173
|
-
return out;
|
|
8174
|
-
}
|
|
8175
|
-
/** @internal */
|
|
8176
|
-
function arraySpliceOut(mutate, at, arr) {
|
|
8177
|
-
const newLen = arr.length - 1;
|
|
8178
|
-
let i = 0;
|
|
8179
|
-
let g = 0;
|
|
8180
|
-
let out = arr;
|
|
8181
|
-
if (mutate) {
|
|
8182
|
-
i = g = at;
|
|
8183
|
-
} else {
|
|
8184
|
-
out = new Array(newLen);
|
|
8185
|
-
while (i < at) out[g++] = arr[i++];
|
|
8186
|
-
}
|
|
8187
|
-
++i;
|
|
8188
|
-
while (i <= newLen) out[g++] = arr[i++];
|
|
8189
|
-
if (mutate) {
|
|
8190
|
-
out.length = newLen;
|
|
8191
|
-
}
|
|
8192
|
-
return out;
|
|
8193
|
-
}
|
|
8194
|
-
/** @internal */
|
|
8195
|
-
function arraySpliceIn(mutate, at, v, arr) {
|
|
8196
|
-
const len = arr.length;
|
|
8197
|
-
if (mutate) {
|
|
8198
|
-
let i = len;
|
|
8199
|
-
while (i >= at) arr[i--] = arr[i];
|
|
8200
|
-
arr[at] = v;
|
|
8201
|
-
return arr;
|
|
8202
|
-
}
|
|
8203
|
-
let i = 0,
|
|
8204
|
-
g = 0;
|
|
8205
|
-
const out = new Array(len + 1);
|
|
8206
|
-
while (i < at) out[g++] = arr[i++];
|
|
8207
|
-
out[at] = v;
|
|
8208
|
-
while (i < len) out[++g] = arr[i++];
|
|
8209
|
-
return out;
|
|
8210
|
-
}
|
|
8211
|
-
|
|
8212
|
-
/** @internal */
|
|
8213
|
-
class EmptyNode {
|
|
8214
|
-
_tag = "EmptyNode";
|
|
8215
|
-
modify(edit, _shift, f, hash, key, size) {
|
|
8216
|
-
const v = f(none());
|
|
8217
|
-
if (isNone(v)) return new EmptyNode();
|
|
8218
|
-
++size.value;
|
|
8219
|
-
return new LeafNode(edit, hash, key, v);
|
|
8220
|
-
}
|
|
8221
|
-
}
|
|
8222
|
-
/** @internal */
|
|
8223
|
-
function isEmptyNode(a) {
|
|
8224
|
-
return isTagged(a, "EmptyNode");
|
|
8225
|
-
}
|
|
8226
|
-
/** @internal */
|
|
8227
|
-
function isLeafNode(node) {
|
|
8228
|
-
return isEmptyNode(node) || node._tag === "LeafNode" || node._tag === "CollisionNode";
|
|
8229
|
-
}
|
|
8230
|
-
/** @internal */
|
|
8231
|
-
function canEditNode(node, edit) {
|
|
8232
|
-
return isEmptyNode(node) ? false : edit === node.edit;
|
|
8233
|
-
}
|
|
8234
|
-
/** @internal */
|
|
8235
|
-
class LeafNode {
|
|
8236
|
-
edit;
|
|
8237
|
-
hash;
|
|
8238
|
-
key;
|
|
8239
|
-
value;
|
|
8240
|
-
_tag = "LeafNode";
|
|
8241
|
-
constructor(edit, hash, key, value) {
|
|
8242
|
-
this.edit = edit;
|
|
8243
|
-
this.hash = hash;
|
|
8244
|
-
this.key = key;
|
|
8245
|
-
this.value = value;
|
|
8246
|
-
}
|
|
8247
|
-
modify(edit, shift, f, hash, key, size) {
|
|
8248
|
-
if (equals(key, this.key)) {
|
|
8249
|
-
const v = f(this.value);
|
|
8250
|
-
if (v === this.value) return this;else if (isNone(v)) {
|
|
8251
|
-
--size.value;
|
|
8252
|
-
return new EmptyNode();
|
|
8253
|
-
}
|
|
8254
|
-
if (canEditNode(this, edit)) {
|
|
8255
|
-
this.value = v;
|
|
8256
|
-
return this;
|
|
8257
|
-
}
|
|
8258
|
-
return new LeafNode(edit, hash, key, v);
|
|
8259
|
-
}
|
|
8260
|
-
const v = f(none());
|
|
8261
|
-
if (isNone(v)) return this;
|
|
8262
|
-
++size.value;
|
|
8263
|
-
return mergeLeaves(edit, shift, this.hash, this, hash, new LeafNode(edit, hash, key, v));
|
|
8264
|
-
}
|
|
8265
|
-
}
|
|
8266
|
-
/** @internal */
|
|
8267
|
-
class CollisionNode {
|
|
8268
|
-
edit;
|
|
8269
|
-
hash;
|
|
8270
|
-
children;
|
|
8271
|
-
_tag = "CollisionNode";
|
|
8272
|
-
constructor(edit, hash, children) {
|
|
8273
|
-
this.edit = edit;
|
|
8274
|
-
this.hash = hash;
|
|
8275
|
-
this.children = children;
|
|
8276
|
-
}
|
|
8277
|
-
modify(edit, shift, f, hash, key, size) {
|
|
8278
|
-
if (hash === this.hash) {
|
|
8279
|
-
const canEdit = canEditNode(this, edit);
|
|
8280
|
-
const list = this.updateCollisionList(canEdit, edit, this.hash, this.children, f, key, size);
|
|
8281
|
-
if (list === this.children) return this;
|
|
8282
|
-
return list.length > 1 ? new CollisionNode(edit, this.hash, list) : list[0]; // collapse single element collision list
|
|
8283
|
-
}
|
|
8284
|
-
const v = f(none());
|
|
8285
|
-
if (isNone(v)) return this;
|
|
8286
|
-
++size.value;
|
|
8287
|
-
return mergeLeaves(edit, shift, this.hash, this, hash, new LeafNode(edit, hash, key, v));
|
|
8288
|
-
}
|
|
8289
|
-
updateCollisionList(mutate, edit, hash, list, f, key, size) {
|
|
8290
|
-
const len = list.length;
|
|
8291
|
-
for (let i = 0; i < len; ++i) {
|
|
8292
|
-
const child = list[i];
|
|
8293
|
-
if ("key" in child && equals(key, child.key)) {
|
|
8294
|
-
const value = child.value;
|
|
8295
|
-
const newValue = f(value);
|
|
8296
|
-
if (newValue === value) return list;
|
|
8297
|
-
if (isNone(newValue)) {
|
|
8298
|
-
--size.value;
|
|
8299
|
-
return arraySpliceOut(mutate, i, list);
|
|
8300
|
-
}
|
|
8301
|
-
return arrayUpdate(mutate, i, new LeafNode(edit, hash, key, newValue), list);
|
|
8302
|
-
}
|
|
8303
|
-
}
|
|
8304
|
-
const newValue = f(none());
|
|
8305
|
-
if (isNone(newValue)) return list;
|
|
8306
|
-
++size.value;
|
|
8307
|
-
return arrayUpdate(mutate, len, new LeafNode(edit, hash, key, newValue), list);
|
|
8308
|
-
}
|
|
8309
|
-
}
|
|
8310
|
-
/** @internal */
|
|
8311
|
-
class IndexedNode {
|
|
8312
|
-
edit;
|
|
8313
|
-
mask;
|
|
8314
|
-
children;
|
|
8315
|
-
_tag = "IndexedNode";
|
|
8316
|
-
constructor(edit, mask, children) {
|
|
8317
|
-
this.edit = edit;
|
|
8318
|
-
this.mask = mask;
|
|
8319
|
-
this.children = children;
|
|
8320
|
-
}
|
|
8321
|
-
modify(edit, shift, f, hash, key, size) {
|
|
8322
|
-
const mask = this.mask;
|
|
8323
|
-
const children = this.children;
|
|
8324
|
-
const frag = hashFragment(shift, hash);
|
|
8325
|
-
const bit = toBitmap(frag);
|
|
8326
|
-
const indx = fromBitmap(mask, bit);
|
|
8327
|
-
const exists = mask & bit;
|
|
8328
|
-
const canEdit = canEditNode(this, edit);
|
|
8329
|
-
if (!exists) {
|
|
8330
|
-
const _newChild = new EmptyNode().modify(edit, shift + SIZE, f, hash, key, size);
|
|
8331
|
-
if (!_newChild) return this;
|
|
8332
|
-
return children.length >= MAX_INDEX_NODE ? expand(edit, frag, _newChild, mask, children) : new IndexedNode(edit, mask | bit, arraySpliceIn(canEdit, indx, _newChild, children));
|
|
8333
|
-
}
|
|
8334
|
-
const current = children[indx];
|
|
8335
|
-
const child = current.modify(edit, shift + SIZE, f, hash, key, size);
|
|
8336
|
-
if (current === child) return this;
|
|
8337
|
-
let bitmap = mask;
|
|
8338
|
-
let newChildren;
|
|
8339
|
-
if (isEmptyNode(child)) {
|
|
8340
|
-
// remove
|
|
8341
|
-
bitmap &= ~bit;
|
|
8342
|
-
if (!bitmap) return new EmptyNode();
|
|
8343
|
-
if (children.length <= 2 && isLeafNode(children[indx ^ 1])) {
|
|
8344
|
-
return children[indx ^ 1]; // collapse
|
|
8345
|
-
}
|
|
8346
|
-
newChildren = arraySpliceOut(canEdit, indx, children);
|
|
8347
|
-
} else {
|
|
8348
|
-
// modify
|
|
8349
|
-
newChildren = arrayUpdate(canEdit, indx, child, children);
|
|
8350
|
-
}
|
|
8351
|
-
if (canEdit) {
|
|
8352
|
-
this.mask = bitmap;
|
|
8353
|
-
this.children = newChildren;
|
|
8354
|
-
return this;
|
|
8355
|
-
}
|
|
8356
|
-
return new IndexedNode(edit, bitmap, newChildren);
|
|
8357
|
-
}
|
|
8358
|
-
}
|
|
8359
|
-
/** @internal */
|
|
8360
|
-
class ArrayNode {
|
|
8361
|
-
edit;
|
|
8362
|
-
size;
|
|
8363
|
-
children;
|
|
8364
|
-
_tag = "ArrayNode";
|
|
8365
|
-
constructor(edit, size, children) {
|
|
8366
|
-
this.edit = edit;
|
|
8367
|
-
this.size = size;
|
|
8368
|
-
this.children = children;
|
|
8369
|
-
}
|
|
8370
|
-
modify(edit, shift, f, hash, key, size) {
|
|
8371
|
-
let count = this.size;
|
|
8372
|
-
const children = this.children;
|
|
8373
|
-
const frag = hashFragment(shift, hash);
|
|
8374
|
-
const child = children[frag];
|
|
8375
|
-
const newChild = (child || new EmptyNode()).modify(edit, shift + SIZE, f, hash, key, size);
|
|
8376
|
-
if (child === newChild) return this;
|
|
8377
|
-
const canEdit = canEditNode(this, edit);
|
|
8378
|
-
let newChildren;
|
|
8379
|
-
if (isEmptyNode(child) && !isEmptyNode(newChild)) {
|
|
8380
|
-
// add
|
|
8381
|
-
++count;
|
|
8382
|
-
newChildren = arrayUpdate(canEdit, frag, newChild, children);
|
|
8383
|
-
} else if (!isEmptyNode(child) && isEmptyNode(newChild)) {
|
|
8384
|
-
// remove
|
|
8385
|
-
--count;
|
|
8386
|
-
if (count <= MIN_ARRAY_NODE) {
|
|
8387
|
-
return pack(edit, count, frag, children);
|
|
8388
|
-
}
|
|
8389
|
-
newChildren = arrayUpdate(canEdit, frag, new EmptyNode(), children);
|
|
8390
|
-
} else {
|
|
8391
|
-
// modify
|
|
8392
|
-
newChildren = arrayUpdate(canEdit, frag, newChild, children);
|
|
8393
|
-
}
|
|
8394
|
-
if (canEdit) {
|
|
8395
|
-
this.size = count;
|
|
8396
|
-
this.children = newChildren;
|
|
8397
|
-
return this;
|
|
8398
|
-
}
|
|
8399
|
-
return new ArrayNode(edit, count, newChildren);
|
|
8400
|
-
}
|
|
8401
|
-
}
|
|
8402
|
-
function pack(edit, count, removed, elements) {
|
|
8403
|
-
const children = new Array(count - 1);
|
|
8404
|
-
let g = 0;
|
|
8405
|
-
let bitmap = 0;
|
|
8406
|
-
for (let i = 0, len = elements.length; i < len; ++i) {
|
|
8407
|
-
if (i !== removed) {
|
|
8408
|
-
const elem = elements[i];
|
|
8409
|
-
if (elem && !isEmptyNode(elem)) {
|
|
8410
|
-
children[g++] = elem;
|
|
8411
|
-
bitmap |= 1 << i;
|
|
8412
|
-
}
|
|
8413
|
-
}
|
|
8414
|
-
}
|
|
8415
|
-
return new IndexedNode(edit, bitmap, children);
|
|
8416
|
-
}
|
|
8417
|
-
function expand(edit, frag, child, bitmap, subNodes) {
|
|
8418
|
-
const arr = [];
|
|
8419
|
-
let bit = bitmap;
|
|
8420
|
-
let count = 0;
|
|
8421
|
-
for (let i = 0; bit; ++i) {
|
|
8422
|
-
if (bit & 1) arr[i] = subNodes[count++];
|
|
8423
|
-
bit >>>= 1;
|
|
8424
|
-
}
|
|
8425
|
-
arr[frag] = child;
|
|
8426
|
-
return new ArrayNode(edit, count + 1, arr);
|
|
8427
|
-
}
|
|
8428
|
-
function mergeLeavesInner(edit, shift, h1, n1, h2, n2) {
|
|
8429
|
-
if (h1 === h2) return new CollisionNode(edit, h1, [n2, n1]);
|
|
8430
|
-
const subH1 = hashFragment(shift, h1);
|
|
8431
|
-
const subH2 = hashFragment(shift, h2);
|
|
8432
|
-
if (subH1 === subH2) {
|
|
8433
|
-
return child => new IndexedNode(edit, toBitmap(subH1) | toBitmap(subH2), [child]);
|
|
8434
|
-
} else {
|
|
8435
|
-
const children = subH1 < subH2 ? [n1, n2] : [n2, n1];
|
|
8436
|
-
return new IndexedNode(edit, toBitmap(subH1) | toBitmap(subH2), children);
|
|
8437
|
-
}
|
|
8438
|
-
}
|
|
8439
|
-
function mergeLeaves(edit, shift, h1, n1, h2, n2) {
|
|
8440
|
-
let stack = undefined;
|
|
8441
|
-
let currentShift = shift;
|
|
8442
|
-
while (true) {
|
|
8443
|
-
const res = mergeLeavesInner(edit, currentShift, h1, n1, h2, n2);
|
|
8444
|
-
if (typeof res === "function") {
|
|
8445
|
-
stack = make(res, stack);
|
|
8446
|
-
currentShift = currentShift + SIZE;
|
|
8447
|
-
} else {
|
|
8448
|
-
let final = res;
|
|
8449
|
-
while (stack != null) {
|
|
8450
|
-
final = stack.value(final);
|
|
8451
|
-
stack = stack.previous;
|
|
8452
|
-
}
|
|
8453
|
-
return final;
|
|
8454
|
-
}
|
|
8455
|
-
}
|
|
8456
|
-
}
|
|
8457
|
-
|
|
8458
|
-
const HashMapSymbolKey = "effect/HashMap";
|
|
8459
|
-
/** @internal */
|
|
8460
|
-
const HashMapTypeId = /*#__PURE__*/Symbol.for(HashMapSymbolKey);
|
|
8461
|
-
const HashMapProto = {
|
|
8462
|
-
[HashMapTypeId]: HashMapTypeId,
|
|
8463
|
-
[Symbol.iterator]() {
|
|
8464
|
-
return new HashMapIterator(this, (k, v) => [k, v]);
|
|
8465
|
-
},
|
|
8466
|
-
[symbol$1]() {
|
|
8467
|
-
let hash$1 = hash(HashMapSymbolKey);
|
|
8468
|
-
for (const item of this) {
|
|
8469
|
-
hash$1 ^= pipe(hash(item[0]), combine(hash(item[1])));
|
|
8470
|
-
}
|
|
8471
|
-
return cached(this, hash$1);
|
|
8472
|
-
},
|
|
8473
|
-
[symbol](that) {
|
|
8474
|
-
if (isHashMap(that)) {
|
|
8475
|
-
if (that._size !== this._size) {
|
|
8476
|
-
return false;
|
|
8477
|
-
}
|
|
8478
|
-
for (const item of this) {
|
|
8479
|
-
const elem = pipe(that, getHash(item[0], hash(item[0])));
|
|
8480
|
-
if (isNone(elem)) {
|
|
8481
|
-
return false;
|
|
8482
|
-
} else {
|
|
8483
|
-
if (!equals(item[1], elem.value)) {
|
|
8484
|
-
return false;
|
|
8485
|
-
}
|
|
8486
|
-
}
|
|
8487
|
-
}
|
|
8488
|
-
return true;
|
|
8489
|
-
}
|
|
8490
|
-
return false;
|
|
8491
|
-
},
|
|
8492
|
-
toString() {
|
|
8493
|
-
return format(this.toJSON());
|
|
8494
|
-
},
|
|
8495
|
-
toJSON() {
|
|
8496
|
-
return {
|
|
8497
|
-
_id: "HashMap",
|
|
8498
|
-
values: Array.from(this).map(toJSON)
|
|
8499
|
-
};
|
|
8500
|
-
},
|
|
8501
|
-
[NodeInspectSymbol]() {
|
|
8502
|
-
return this.toJSON();
|
|
8503
|
-
},
|
|
8504
|
-
pipe() {
|
|
8505
|
-
return pipeArguments(this, arguments);
|
|
8506
|
-
}
|
|
8507
|
-
};
|
|
8508
|
-
const makeImpl$1 = (editable, edit, root, size) => {
|
|
8509
|
-
const map = Object.create(HashMapProto);
|
|
8510
|
-
map._editable = editable;
|
|
8511
|
-
map._edit = edit;
|
|
8512
|
-
map._root = root;
|
|
8513
|
-
map._size = size;
|
|
8514
|
-
return map;
|
|
8515
|
-
};
|
|
8516
|
-
class HashMapIterator {
|
|
8517
|
-
map;
|
|
8518
|
-
f;
|
|
8519
|
-
v;
|
|
8520
|
-
constructor(map, f) {
|
|
8521
|
-
this.map = map;
|
|
8522
|
-
this.f = f;
|
|
8523
|
-
this.v = visitLazy(this.map._root, this.f, undefined);
|
|
8524
|
-
}
|
|
8525
|
-
next() {
|
|
8526
|
-
if (isNone(this.v)) {
|
|
8527
|
-
return {
|
|
8528
|
-
done: true,
|
|
8529
|
-
value: undefined
|
|
8530
|
-
};
|
|
8531
|
-
}
|
|
8532
|
-
const v0 = this.v.value;
|
|
8533
|
-
this.v = applyCont(v0.cont);
|
|
8534
|
-
return {
|
|
8535
|
-
done: false,
|
|
8536
|
-
value: v0.value
|
|
8537
|
-
};
|
|
8538
|
-
}
|
|
8539
|
-
[Symbol.iterator]() {
|
|
8540
|
-
return new HashMapIterator(this.map, this.f);
|
|
8541
|
-
}
|
|
8542
|
-
}
|
|
8543
|
-
const applyCont = cont => cont ? visitLazyChildren(cont[0], cont[1], cont[2], cont[3], cont[4]) : none();
|
|
8544
|
-
const visitLazy = (node, f, cont = undefined) => {
|
|
8545
|
-
switch (node._tag) {
|
|
8546
|
-
case "LeafNode":
|
|
8547
|
-
{
|
|
8548
|
-
if (isSome(node.value)) {
|
|
8549
|
-
return some({
|
|
8550
|
-
value: f(node.key, node.value.value),
|
|
8551
|
-
cont
|
|
8552
|
-
});
|
|
8553
|
-
}
|
|
8554
|
-
return applyCont(cont);
|
|
8555
|
-
}
|
|
8556
|
-
case "CollisionNode":
|
|
8557
|
-
case "ArrayNode":
|
|
8558
|
-
case "IndexedNode":
|
|
8559
|
-
{
|
|
8560
|
-
const children = node.children;
|
|
8561
|
-
return visitLazyChildren(children.length, children, 0, f, cont);
|
|
8562
|
-
}
|
|
8563
|
-
default:
|
|
8564
|
-
{
|
|
8565
|
-
return applyCont(cont);
|
|
8566
|
-
}
|
|
8567
|
-
}
|
|
8568
|
-
};
|
|
8569
|
-
const visitLazyChildren = (len, children, i, f, cont) => {
|
|
8570
|
-
while (i < len) {
|
|
8571
|
-
const child = children[i++];
|
|
8572
|
-
if (child && !isEmptyNode(child)) {
|
|
8573
|
-
return visitLazy(child, f, [len, children, i, f, cont]);
|
|
8574
|
-
}
|
|
8575
|
-
}
|
|
8576
|
-
return applyCont(cont);
|
|
8577
|
-
};
|
|
8578
|
-
const _empty$1 = /*#__PURE__*/makeImpl$1(false, 0, /*#__PURE__*/new EmptyNode(), 0);
|
|
8579
|
-
/** @internal */
|
|
8580
|
-
const empty$2 = () => _empty$1;
|
|
8581
|
-
/** @internal */
|
|
8582
|
-
const isHashMap = u => hasProperty(u, HashMapTypeId);
|
|
8583
|
-
/** @internal */
|
|
8584
|
-
const getHash = /*#__PURE__*/dual(3, (self, key, hash) => {
|
|
8585
|
-
let node = self._root;
|
|
8586
|
-
let shift = 0;
|
|
8587
|
-
while (true) {
|
|
8588
|
-
switch (node._tag) {
|
|
8589
|
-
case "LeafNode":
|
|
8590
|
-
{
|
|
8591
|
-
return equals(key, node.key) ? node.value : none();
|
|
8592
|
-
}
|
|
8593
|
-
case "CollisionNode":
|
|
8594
|
-
{
|
|
8595
|
-
if (hash === node.hash) {
|
|
8596
|
-
const children = node.children;
|
|
8597
|
-
for (let i = 0, len = children.length; i < len; ++i) {
|
|
8598
|
-
const child = children[i];
|
|
8599
|
-
if ("key" in child && equals(key, child.key)) {
|
|
8600
|
-
return child.value;
|
|
8601
|
-
}
|
|
8602
|
-
}
|
|
8603
|
-
}
|
|
8604
|
-
return none();
|
|
8605
|
-
}
|
|
8606
|
-
case "IndexedNode":
|
|
8607
|
-
{
|
|
8608
|
-
const frag = hashFragment(shift, hash);
|
|
8609
|
-
const bit = toBitmap(frag);
|
|
8610
|
-
if (node.mask & bit) {
|
|
8611
|
-
node = node.children[fromBitmap(node.mask, bit)];
|
|
8612
|
-
shift += SIZE;
|
|
8613
|
-
break;
|
|
8614
|
-
}
|
|
8615
|
-
return none();
|
|
8616
|
-
}
|
|
8617
|
-
case "ArrayNode":
|
|
8618
|
-
{
|
|
8619
|
-
node = node.children[hashFragment(shift, hash)];
|
|
8620
|
-
if (node) {
|
|
8621
|
-
shift += SIZE;
|
|
8622
|
-
break;
|
|
8623
|
-
}
|
|
8624
|
-
return none();
|
|
8625
|
-
}
|
|
8626
|
-
default:
|
|
8627
|
-
return none();
|
|
8628
|
-
}
|
|
8629
|
-
}
|
|
8630
|
-
});
|
|
8631
|
-
/** @internal */
|
|
8632
|
-
const set = /*#__PURE__*/dual(3, (self, key, value) => modifyAt(self, key, () => some(value)));
|
|
8633
|
-
/** @internal */
|
|
8634
|
-
const setTree = /*#__PURE__*/dual(3, (self, newRoot, newSize) => {
|
|
8635
|
-
if (self._editable) {
|
|
8636
|
-
self._root = newRoot;
|
|
8637
|
-
self._size = newSize;
|
|
8638
|
-
return self;
|
|
8639
|
-
}
|
|
8640
|
-
return newRoot === self._root ? self : makeImpl$1(self._editable, self._edit, newRoot, newSize);
|
|
8641
|
-
});
|
|
8642
|
-
/** @internal */
|
|
8643
|
-
const keys = self => new HashMapIterator(self, key => key);
|
|
8644
|
-
/** @internal */
|
|
8645
|
-
const size$2 = self => self._size;
|
|
8646
|
-
/** @internal */
|
|
8647
|
-
const beginMutation$1 = self => makeImpl$1(true, self._edit + 1, self._root, self._size);
|
|
8648
|
-
/** @internal */
|
|
8649
|
-
const modifyAt = /*#__PURE__*/dual(3, (self, key, f) => modifyHash(self, key, hash(key), f));
|
|
8650
|
-
/** @internal */
|
|
8651
|
-
const modifyHash = /*#__PURE__*/dual(4, (self, key, hash, f) => {
|
|
8652
|
-
const size = {
|
|
8653
|
-
value: self._size
|
|
8654
|
-
};
|
|
8655
|
-
const newRoot = self._root.modify(self._editable ? self._edit : NaN, 0, f, hash, key, size);
|
|
8656
|
-
return pipe(self, setTree(newRoot, size.value));
|
|
8657
|
-
});
|
|
8658
|
-
/** @internal */
|
|
8659
|
-
const forEach$1 = /*#__PURE__*/dual(2, (self, f) => reduce$1(self, void 0, (_, value, key) => f(value, key)));
|
|
8660
|
-
/** @internal */
|
|
8661
|
-
const reduce$1 = /*#__PURE__*/dual(3, (self, zero, f) => {
|
|
8662
|
-
const root = self._root;
|
|
8663
|
-
if (root._tag === "LeafNode") {
|
|
8664
|
-
return isSome(root.value) ? f(zero, root.value.value, root.key) : zero;
|
|
8665
|
-
}
|
|
8666
|
-
if (root._tag === "EmptyNode") {
|
|
8667
|
-
return zero;
|
|
8668
|
-
}
|
|
8669
|
-
const toVisit = [root.children];
|
|
8670
|
-
let children;
|
|
8671
|
-
while (children = toVisit.pop()) {
|
|
8672
|
-
for (let i = 0, len = children.length; i < len;) {
|
|
8673
|
-
const child = children[i++];
|
|
8674
|
-
if (child && !isEmptyNode(child)) {
|
|
8675
|
-
if (child._tag === "LeafNode") {
|
|
8676
|
-
if (isSome(child.value)) {
|
|
8677
|
-
zero = f(zero, child.value.value, child.key);
|
|
8678
|
-
}
|
|
8679
|
-
} else {
|
|
8680
|
-
toVisit.push(child.children);
|
|
8681
|
-
}
|
|
8682
|
-
}
|
|
8683
|
-
}
|
|
8684
|
-
}
|
|
8685
|
-
return zero;
|
|
8686
|
-
});
|
|
8687
|
-
|
|
8688
|
-
const HashSetSymbolKey = "effect/HashSet";
|
|
8689
|
-
/** @internal */
|
|
8690
|
-
const HashSetTypeId = /*#__PURE__*/Symbol.for(HashSetSymbolKey);
|
|
8691
|
-
const HashSetProto = {
|
|
8692
|
-
[HashSetTypeId]: HashSetTypeId,
|
|
8693
|
-
[Symbol.iterator]() {
|
|
8694
|
-
return keys(this._keyMap);
|
|
8695
|
-
},
|
|
8696
|
-
[symbol$1]() {
|
|
8697
|
-
return cached(this, combine(hash(this._keyMap))(hash(HashSetSymbolKey)));
|
|
8698
|
-
},
|
|
8699
|
-
[symbol](that) {
|
|
8700
|
-
if (isHashSet(that)) {
|
|
8701
|
-
return size$2(this._keyMap) === size$2(that._keyMap) && equals(this._keyMap, that._keyMap);
|
|
8702
|
-
}
|
|
8703
|
-
return false;
|
|
8704
|
-
},
|
|
8705
|
-
toString() {
|
|
8706
|
-
return format(this.toJSON());
|
|
8707
|
-
},
|
|
8708
|
-
toJSON() {
|
|
8709
|
-
return {
|
|
8710
|
-
_id: "HashSet",
|
|
8711
|
-
values: Array.from(this).map(toJSON)
|
|
8712
|
-
};
|
|
8713
|
-
},
|
|
8714
|
-
[NodeInspectSymbol]() {
|
|
8715
|
-
return this.toJSON();
|
|
8716
|
-
},
|
|
8717
|
-
pipe() {
|
|
8718
|
-
return pipeArguments(this, arguments);
|
|
8719
|
-
}
|
|
8720
|
-
};
|
|
8721
|
-
/** @internal */
|
|
8722
|
-
const makeImpl = keyMap => {
|
|
8723
|
-
const set = Object.create(HashSetProto);
|
|
8724
|
-
set._keyMap = keyMap;
|
|
8725
|
-
return set;
|
|
8726
|
-
};
|
|
8727
|
-
/** @internal */
|
|
8728
|
-
const isHashSet = u => hasProperty(u, HashSetTypeId);
|
|
8729
|
-
const _empty = /*#__PURE__*/makeImpl(/*#__PURE__*/empty$2());
|
|
8730
|
-
/** @internal */
|
|
8731
|
-
const empty$1 = () => _empty;
|
|
8732
|
-
/** @internal */
|
|
8733
|
-
const size$1 = self => size$2(self._keyMap);
|
|
8734
|
-
/** @internal */
|
|
8735
|
-
const beginMutation = self => makeImpl(beginMutation$1(self._keyMap));
|
|
8736
|
-
/** @internal */
|
|
8737
|
-
const endMutation = self => {
|
|
8738
|
-
self._keyMap._editable = false;
|
|
8739
|
-
return self;
|
|
8740
|
-
};
|
|
8741
|
-
/** @internal */
|
|
8742
|
-
const mutate = /*#__PURE__*/dual(2, (self, f) => {
|
|
8743
|
-
const transient = beginMutation(self);
|
|
8744
|
-
f(transient);
|
|
8745
|
-
return endMutation(transient);
|
|
8746
|
-
});
|
|
8747
|
-
/** @internal */
|
|
8748
|
-
const add$1 = /*#__PURE__*/dual(2, (self, value) => self._keyMap._editable ? (set(value, true)(self._keyMap), self) : makeImpl(set(value, true)(self._keyMap)));
|
|
8749
|
-
/** @internal */
|
|
8750
|
-
const union$1 = /*#__PURE__*/dual(2, (self, that) => mutate(empty$1(), set => {
|
|
8751
|
-
forEach(self, value => add$1(set, value));
|
|
8752
|
-
for (const value of that) {
|
|
8753
|
-
add$1(set, value);
|
|
8754
|
-
}
|
|
8755
|
-
}));
|
|
8756
|
-
/** @internal */
|
|
8757
|
-
const forEach = /*#__PURE__*/dual(2, (self, f) => forEach$1(self._keyMap, (_, k) => f(k)));
|
|
8758
|
-
|
|
8759
|
-
/**
|
|
8760
|
-
* # HashSet
|
|
8761
|
-
*
|
|
8762
|
-
* An immutable `HashSet` provides a collection of unique values with efficient
|
|
8763
|
-
* lookup, insertion and removal. Once created, a `HashSet` cannot be modified;
|
|
8764
|
-
* any operation that would alter the set instead returns a new `HashSet` with
|
|
8765
|
-
* the changes. This immutability offers benefits like predictable state
|
|
8766
|
-
* management and easier reasoning about your code.
|
|
8767
|
-
*
|
|
8768
|
-
* ## What Problem Does It Solve?
|
|
8769
|
-
*
|
|
8770
|
-
* `HashSet` solves the problem of maintaining an unsorted collection where each
|
|
8771
|
-
* value appears exactly once, with fast operations for checking membership and
|
|
8772
|
-
* adding/removing values.
|
|
8773
|
-
*
|
|
8774
|
-
* ## When to Use
|
|
8775
|
-
*
|
|
8776
|
-
* Use `HashSet` when you need:
|
|
8777
|
-
*
|
|
8778
|
-
* - A collection with no duplicate values
|
|
8779
|
-
* - Efficient membership testing (**`O(1)`** average complexity)
|
|
8780
|
-
* - Set operations like union, intersection, and difference
|
|
8781
|
-
* - An immutable data structure that preserves functional programming patterns
|
|
8782
|
-
*
|
|
8783
|
-
* ## Advanced Features
|
|
8784
|
-
*
|
|
8785
|
-
* HashSet provides operations for:
|
|
8786
|
-
*
|
|
8787
|
-
* - Transforming sets with map and flatMap
|
|
8788
|
-
* - Filtering elements with filter
|
|
8789
|
-
* - Combining sets with union, intersection and difference
|
|
8790
|
-
* - Performance optimizations via mutable operations in controlled contexts
|
|
8791
|
-
*
|
|
8792
|
-
* ## Performance Characteristics
|
|
8793
|
-
*
|
|
8794
|
-
* - **Lookup** operations ({@link module:HashSet.has}): **`O(1)`** average time
|
|
8795
|
-
* complexity
|
|
8796
|
-
* - **Insertion** operations ({@link module:HashSet.add}): **`O(1)`** average time
|
|
8797
|
-
* complexity
|
|
8798
|
-
* - **Removal** operations ({@link module:HashSet.remove}): **`O(1)`** average
|
|
8799
|
-
* time complexity
|
|
8800
|
-
* - **Set** operations ({@link module:HashSet.union},
|
|
8801
|
-
* {@link module:HashSet.intersection}): **`O(n)`** where n is the size of the
|
|
8802
|
-
* smaller set
|
|
8803
|
-
* - **Iteration**: **`O(n)`** where n is the size of the set
|
|
8804
|
-
*
|
|
8805
|
-
* The HashSet data structure implements the following traits:
|
|
8806
|
-
*
|
|
8807
|
-
* - {@link Iterable}: allows iterating over the values in the set
|
|
8808
|
-
* - {@link Equal}: allows comparing two sets for value-based equality
|
|
8809
|
-
* - {@link Pipeable}: allows chaining operations with the pipe operator
|
|
8810
|
-
* - {@link Inspectable}: allows inspecting the contents of the set
|
|
8811
|
-
*
|
|
8812
|
-
* ## Operations Reference
|
|
8813
|
-
*
|
|
8814
|
-
* | Category | Operation | Description | Complexity |
|
|
8815
|
-
* | ------------ | ----------------------------------- | ------------------------------------------- | ---------- |
|
|
8816
|
-
* | constructors | {@link module:HashSet.empty} | Creates an empty HashSet | O(1) |
|
|
8817
|
-
* | constructors | {@link module:HashSet.fromIterable} | Creates a HashSet from an iterable | O(n) |
|
|
8818
|
-
* | constructors | {@link module:HashSet.make} | Creates a HashSet from multiple values | O(n) |
|
|
8819
|
-
* | | | | |
|
|
8820
|
-
* | elements | {@link module:HashSet.has} | Checks if a value exists in the set | O(1) avg |
|
|
8821
|
-
* | elements | {@link module:HashSet.some} | Checks if any element satisfies a predicate | O(n) |
|
|
8822
|
-
* | elements | {@link module:HashSet.every} | Checks if all elements satisfy a predicate | O(n) |
|
|
8823
|
-
* | elements | {@link module:HashSet.isSubset} | Checks if a set is a subset of another | O(n) |
|
|
8824
|
-
* | | | | |
|
|
8825
|
-
* | getters | {@link module:HashSet.values} | Gets an iterator of all values | O(1) |
|
|
8826
|
-
* | getters | {@link module:HashSet.toValues} | Gets an array of all values | O(n) |
|
|
8827
|
-
* | getters | {@link module:HashSet.size} | Gets the number of elements | O(1) |
|
|
8828
|
-
* | | | | |
|
|
8829
|
-
* | mutations | {@link module:HashSet.add} | Adds a value to the set | O(1) avg |
|
|
8830
|
-
* | mutations | {@link module:HashSet.remove} | Removes a value from the set | O(1) avg |
|
|
8831
|
-
* | mutations | {@link module:HashSet.toggle} | Toggles a value's presence | O(1) avg |
|
|
8832
|
-
* | | | | |
|
|
8833
|
-
* | operations | {@link module:HashSet.difference} | Computes set difference (A - B) | O(n) |
|
|
8834
|
-
* | operations | {@link module:HashSet.intersection} | Computes set intersection (A ∩ B) | O(n) |
|
|
8835
|
-
* | operations | {@link module:HashSet.union} | Computes set union (A ∪ B) | O(n) |
|
|
8836
|
-
* | | | | |
|
|
8837
|
-
* | mapping | {@link module:HashSet.map} | Transforms each element | O(n) |
|
|
8838
|
-
* | | | | |
|
|
8839
|
-
* | sequencing | {@link module:HashSet.flatMap} | Transforms and flattens elements | O(n) |
|
|
8840
|
-
* | | | | |
|
|
8841
|
-
* | traversing | {@link module:HashSet.forEach} | Applies a function to each element | O(n) |
|
|
8842
|
-
* | | | | |
|
|
8843
|
-
* | folding | {@link module:HashSet.reduce} | Reduces the set to a single value | O(n) |
|
|
8844
|
-
* | | | | |
|
|
8845
|
-
* | filtering | {@link module:HashSet.filter} | Keeps elements that satisfy a predicate | O(n) |
|
|
8846
|
-
* | | | | |
|
|
8847
|
-
* | partitioning | {@link module:HashSet.partition} | Splits into two sets by a predicate | O(n) |
|
|
8848
|
-
*
|
|
8849
|
-
* ## Notes
|
|
8850
|
-
*
|
|
8851
|
-
* ### Composability with the Effect Ecosystem:
|
|
8852
|
-
*
|
|
8853
|
-
* This `HashSet` is designed to work seamlessly within the Effect ecosystem. It
|
|
8854
|
-
* implements the {@link Iterable}, {@link Equal}, {@link Pipeable}, and
|
|
8855
|
-
* {@link Inspectable} traits from Effect. This ensures compatibility with other
|
|
8856
|
-
* Effect data structures and functionalities. For example, you can easily use
|
|
8857
|
-
* Effect's `pipe` method to chain operations on the `HashSet`.
|
|
8858
|
-
*
|
|
8859
|
-
* **Equality of Elements with Effect's {@link Equal `Equal`} Trait:**
|
|
8860
|
-
*
|
|
8861
|
-
* This `HashSet` relies on Effect's {@link Equal} trait to determine the
|
|
8862
|
-
* uniqueness of elements within the set. The way equality is checked depends on
|
|
8863
|
-
* the type of the elements:
|
|
8864
|
-
*
|
|
8865
|
-
* - **Primitive Values:** For primitive JavaScript values like strings, numbers,
|
|
8866
|
-
* booleans, `null`, and `undefined`, equality is determined by their value
|
|
8867
|
-
* (similar to the `===` operator).
|
|
8868
|
-
* - **Objects and Custom Types:** For objects and other custom types, equality is
|
|
8869
|
-
* determined by whether those types implement the {@link Equal} interface
|
|
8870
|
-
* themselves. If an element type implements `Equal`, the `HashSet` will
|
|
8871
|
-
* delegate to that implementation to perform the equality check. This allows
|
|
8872
|
-
* you to define custom logic for determining when two instances of your
|
|
8873
|
-
* objects should be considered equal based on their properties, rather than
|
|
8874
|
-
* just their object identity.
|
|
8875
|
-
*
|
|
8876
|
-
* ```ts
|
|
8877
|
-
* import { Equal, Hash, HashSet } from "effect"
|
|
8878
|
-
*
|
|
8879
|
-
* class Person implements Equal.Equal {
|
|
8880
|
-
* constructor(
|
|
8881
|
-
* readonly id: number, // Unique identifier
|
|
8882
|
-
* readonly name: string,
|
|
8883
|
-
* readonly age: number
|
|
8884
|
-
* ) {}
|
|
8885
|
-
*
|
|
8886
|
-
* // Define equality based on id, name, and age
|
|
8887
|
-
* [Equal.symbol](that: Equal.Equal): boolean {
|
|
8888
|
-
* if (that instanceof Person) {
|
|
8889
|
-
* return (
|
|
8890
|
-
* Equal.equals(this.id, that.id) &&
|
|
8891
|
-
* Equal.equals(this.name, that.name) &&
|
|
8892
|
-
* Equal.equals(this.age, that.age)
|
|
8893
|
-
* )
|
|
8894
|
-
* }
|
|
8895
|
-
* return false
|
|
8896
|
-
* }
|
|
8897
|
-
*
|
|
8898
|
-
* // Generate a hash code based on the unique id
|
|
8899
|
-
* [Hash.symbol](): number {
|
|
8900
|
-
* return Hash.hash(this.id)
|
|
8901
|
-
* }
|
|
8902
|
-
* }
|
|
8903
|
-
*
|
|
8904
|
-
* // Creating a HashSet with objects that implement the Equal interface
|
|
8905
|
-
* const set = HashSet.empty().pipe(
|
|
8906
|
-
* HashSet.add(new Person(1, "Alice", 30)),
|
|
8907
|
-
* HashSet.add(new Person(1, "Alice", 30))
|
|
8908
|
-
* )
|
|
8909
|
-
*
|
|
8910
|
-
* // HashSet recognizes them as equal, so only one element is stored
|
|
8911
|
-
* console.log(HashSet.size(set))
|
|
8912
|
-
* // Output: 1
|
|
8913
|
-
* ```
|
|
8914
|
-
*
|
|
8915
|
-
* **Simplifying Equality and Hashing with `Data` and `Schema`:**
|
|
8916
|
-
*
|
|
8917
|
-
* Effect's {@link Data} and {@link Schema `Schema.Data`} modules offer powerful
|
|
8918
|
-
* ways to automatically handle the implementation of both the {@link Equal} and
|
|
8919
|
-
* {@link Hash} traits for your custom data structures.
|
|
8920
|
-
*
|
|
8921
|
-
* - **`Data` Module:** By using constructors like `Data.struct`, `Data.tuple`,
|
|
8922
|
-
* `Data.array`, or `Data.case` to define your data types, Effect
|
|
8923
|
-
* automatically generates the necessary implementations for value-based
|
|
8924
|
-
* equality and consistent hashing. This significantly reduces boilerplate and
|
|
8925
|
-
* ensures correctness.
|
|
8926
|
-
*
|
|
8927
|
-
* ```ts
|
|
8928
|
-
* import { HashSet, Data, Equal } from "effect"
|
|
8929
|
-
* import assert from "node:assert/strict"
|
|
8930
|
-
*
|
|
8931
|
-
* // Data.* implements the `Equal` traits for us
|
|
8932
|
-
* const person1 = Data.struct({ id: 1, name: "Alice", age: 30 })
|
|
8933
|
-
* const person2 = Data.struct({ id: 1, name: "Alice", age: 30 })
|
|
8934
|
-
*
|
|
8935
|
-
* assert(Equal.equals(person1, person2))
|
|
8936
|
-
*
|
|
8937
|
-
* const set = HashSet.empty().pipe(
|
|
8938
|
-
* HashSet.add(person1),
|
|
8939
|
-
* HashSet.add(person2)
|
|
8940
|
-
* )
|
|
8941
|
-
*
|
|
8942
|
-
* // HashSet recognizes them as equal, so only one element is stored
|
|
8943
|
-
* console.log(HashSet.size(set)) // Output: 1
|
|
8944
|
-
* ```
|
|
8945
|
-
*
|
|
8946
|
-
* - **`Schema` Module:** When defining data schemas using the {@link Schema}
|
|
8947
|
-
* module, you can use `Schema.Data` to automatically include the `Equal` and
|
|
8948
|
-
* `Hash` traits in the decoded objects. This is particularly important when
|
|
8949
|
-
* working with `HashSet`. **For decoded objects to be correctly recognized as
|
|
8950
|
-
* equal within a `HashSet`, ensure that the schema for those objects is
|
|
8951
|
-
* defined using `Schema.Data`.**
|
|
8952
|
-
*
|
|
8953
|
-
* ```ts
|
|
8954
|
-
* import { Equal, HashSet, Schema } from "effect"
|
|
8955
|
-
* import assert from "node:assert/strict"
|
|
8956
|
-
*
|
|
8957
|
-
* // Schema.Data implements the `Equal` traits for us
|
|
8958
|
-
* const PersonSchema = Schema.Data(
|
|
8959
|
-
* Schema.Struct({
|
|
8960
|
-
* id: Schema.Number,
|
|
8961
|
-
* name: Schema.String,
|
|
8962
|
-
* age: Schema.Number
|
|
8963
|
-
* })
|
|
8964
|
-
* )
|
|
8965
|
-
*
|
|
8966
|
-
* const Person = Schema.decode(PersonSchema)
|
|
8967
|
-
*
|
|
8968
|
-
* const person1 = Person({ id: 1, name: "Alice", age: 30 })
|
|
8969
|
-
* const person2 = Person({ id: 1, name: "Alice", age: 30 })
|
|
8970
|
-
*
|
|
8971
|
-
* assert(Equal.equals(person1, person2)) // Output: true
|
|
8972
|
-
*
|
|
8973
|
-
* const set = HashSet.empty().pipe(
|
|
8974
|
-
* HashSet.add(person1),
|
|
8975
|
-
* HashSet.add(person2)
|
|
8976
|
-
* )
|
|
8977
|
-
*
|
|
8978
|
-
* // HashSet thanks to Schema.Data implementation of the `Equal` trait, recognizes the two Person as equal, so only one element is stored
|
|
8979
|
-
* console.log(HashSet.size(set)) // Output: 1
|
|
8980
|
-
* ```
|
|
8981
|
-
*
|
|
8982
|
-
* ### Interoperability with the JavaScript Runtime:
|
|
8983
|
-
*
|
|
8984
|
-
* To interoperate with the regular JavaScript runtime, Effect's `HashSet`
|
|
8985
|
-
* provides methods to access its elements in formats readily usable by
|
|
8986
|
-
* JavaScript APIs: {@link values `HashSet.values`},
|
|
8987
|
-
* {@link toValues `HashSet.toValues`}
|
|
8988
|
-
*
|
|
8989
|
-
* ```ts
|
|
8990
|
-
* import { HashSet } from "effect"
|
|
8991
|
-
*
|
|
8992
|
-
* const hashSet: HashSet.HashSet<number> = HashSet.make(1, 2, 3)
|
|
8993
|
-
*
|
|
8994
|
-
* // Using HashSet.values to convert HashSet.HashSet<A> to IterableIterator<A>
|
|
8995
|
-
* const iterable: IterableIterator<number> = HashSet.values(hashSet)
|
|
8996
|
-
*
|
|
8997
|
-
* console.log(...iterable) // Logs: 1 2 3
|
|
8998
|
-
*
|
|
8999
|
-
* // Using HashSet.toValues to convert HashSet.HashSet<A> to Array<A>
|
|
9000
|
-
* const array: Array<number> = HashSet.toValues(hashSet)
|
|
9001
|
-
*
|
|
9002
|
-
* console.log(array) // Logs: [ 1, 2, 3 ]
|
|
9003
|
-
* ```
|
|
9004
|
-
*
|
|
9005
|
-
* Be mindful of performance implications (both time and space complexity) when
|
|
9006
|
-
* frequently converting between Effect's immutable HashSet and mutable
|
|
9007
|
-
* JavaScript data structures, especially for large collections.
|
|
9008
|
-
*
|
|
9009
|
-
* @module HashSet
|
|
9010
|
-
* @since 2.0.0
|
|
9011
|
-
*/
|
|
9012
|
-
/**
|
|
9013
|
-
* Creates an empty `HashSet`.
|
|
9014
|
-
*
|
|
9015
|
-
* Time complexity: **`O(1)`**
|
|
9016
|
-
*
|
|
9017
|
-
* @memberof HashSet
|
|
9018
|
-
* @since 2.0.0
|
|
9019
|
-
* @category constructors
|
|
9020
|
-
* @example
|
|
9021
|
-
*
|
|
9022
|
-
* ```ts
|
|
9023
|
-
* import { HashSet, pipe } from "effect"
|
|
9024
|
-
*
|
|
9025
|
-
* console.log(
|
|
9026
|
-
* pipe(
|
|
9027
|
-
* // Provide a type argument to create a HashSet of a specific type
|
|
9028
|
-
* HashSet.empty<number>(),
|
|
9029
|
-
* HashSet.add(1),
|
|
9030
|
-
* HashSet.add(1), // Notice the duplicate
|
|
9031
|
-
* HashSet.add(2),
|
|
9032
|
-
* HashSet.toValues
|
|
9033
|
-
* )
|
|
9034
|
-
* ) // Output: [1, 2]
|
|
9035
|
-
* ```
|
|
9036
|
-
*
|
|
9037
|
-
* @see Other `HashSet` constructors are {@link module:HashSet.make} {@link module:HashSet.fromIterable}
|
|
9038
|
-
*/
|
|
9039
|
-
const empty = empty$1;
|
|
9040
|
-
/**
|
|
9041
|
-
* Calculates the number of values in the `HashSet`.
|
|
9042
|
-
*
|
|
9043
|
-
* Time complexity: **`O(1)`**
|
|
9044
|
-
*
|
|
9045
|
-
* @memberof HashSet
|
|
9046
|
-
* @since 2.0.0
|
|
9047
|
-
* @category getters
|
|
9048
|
-
* @example
|
|
9049
|
-
*
|
|
9050
|
-
* ```ts
|
|
9051
|
-
* import { HashSet, pipe } from "effect"
|
|
9052
|
-
* import assert from "node:assert/strict"
|
|
9053
|
-
*
|
|
9054
|
-
* assert.deepStrictEqual(pipe(HashSet.empty(), HashSet.size), 0)
|
|
9055
|
-
*
|
|
9056
|
-
* assert.deepStrictEqual(
|
|
9057
|
-
* pipe(HashSet.make(1, 2, 2, 3, 4, 3), HashSet.size),
|
|
9058
|
-
* 4
|
|
9059
|
-
* )
|
|
9060
|
-
* ```
|
|
9061
|
-
*
|
|
9062
|
-
* @see Other `HashSet` getters are {@link module:HashSet.values} {@link module:HashSet.toValues}
|
|
9063
|
-
*/
|
|
9064
|
-
const size = size$1;
|
|
9065
|
-
/**
|
|
9066
|
-
* Adds a value to the `HashSet`.
|
|
9067
|
-
*
|
|
9068
|
-
* Time complexity: **`O(1)`** average
|
|
9069
|
-
*
|
|
9070
|
-
* @remarks
|
|
9071
|
-
* Remember that a `HashSet` is a collection of unique values, so adding a value
|
|
9072
|
-
* that already exists in the `HashSet` will not add a duplicate.
|
|
9073
|
-
*
|
|
9074
|
-
* Remember that HashSet is an immutable data structure, so the `add` function,
|
|
9075
|
-
* like all other functions that modify the HashSet, will return a new HashSet
|
|
9076
|
-
* with the added value.
|
|
9077
|
-
* @memberof HashSet
|
|
9078
|
-
* @since 2.0.0
|
|
9079
|
-
* @example
|
|
9080
|
-
*
|
|
9081
|
-
* ```ts
|
|
9082
|
-
* // Syntax
|
|
9083
|
-
* import { HashSet, pipe } from "effect"
|
|
9084
|
-
*
|
|
9085
|
-
* // with data-last, a.k.a. pipeable API
|
|
9086
|
-
* pipe(HashSet.empty(), HashSet.add(0), HashSet.add(0))
|
|
9087
|
-
*
|
|
9088
|
-
* // or piped with the pipe function
|
|
9089
|
-
* HashSet.empty().pipe(HashSet.add(0))
|
|
9090
|
-
*
|
|
9091
|
-
* // or with data-first API
|
|
9092
|
-
* HashSet.add(HashSet.empty(), 0)
|
|
9093
|
-
* ```
|
|
9094
|
-
*
|
|
9095
|
-
* @see Other `HashSet` mutations are {@link module:HashSet.remove} {@link module:HashSet.toggle} {@link module:HashSet.beginMutation} {@link module:HashSet.endMutation} {@link module:HashSet.mutate}
|
|
9096
|
-
*/
|
|
9097
|
-
const add = add$1;
|
|
9098
|
-
/**
|
|
9099
|
-
* Computes the set union `( self ∪ that )` between this `HashSet` and the
|
|
9100
|
-
* specified `Iterable<A>`.
|
|
9101
|
-
*
|
|
9102
|
-
* Time complexity: **`O(n)`** where n is the number of elements in the set
|
|
9103
|
-
*
|
|
9104
|
-
* **NOTE**: the hash and equal of the values in both the set and the iterable
|
|
9105
|
-
* must be the same.
|
|
9106
|
-
*
|
|
9107
|
-
* @memberof HashSet
|
|
9108
|
-
* @since 2.0.0
|
|
9109
|
-
* @example
|
|
9110
|
-
*
|
|
9111
|
-
* ```ts
|
|
9112
|
-
* // Syntax
|
|
9113
|
-
* import { HashSet, pipe } from "effect"
|
|
9114
|
-
*
|
|
9115
|
-
* // with data-last, a.k.a. pipeable API
|
|
9116
|
-
* pipe(HashSet.make(1, 2, 3), HashSet.union(HashSet.make(3, 4, 5)))
|
|
9117
|
-
*
|
|
9118
|
-
* // or piped with the pipe function
|
|
9119
|
-
* HashSet.make(1, 2, 3).pipe(HashSet.union(HashSet.make(3, 4, 5)))
|
|
9120
|
-
*
|
|
9121
|
-
* // or with data-first API
|
|
9122
|
-
* HashSet.union(HashSet.make(1, 2, 3), HashSet.make(3, 4, 5))
|
|
9123
|
-
* ```
|
|
9124
|
-
*
|
|
9125
|
-
* @see Other `HashSet` operations are {@link module:HashSet.difference} {@link module:HashSet.intersection}
|
|
9126
|
-
*/
|
|
9127
|
-
const union = union$1;
|
|
9128
|
-
|
|
9129
|
-
/** @internal */
|
|
9130
|
-
const OP_DIE = "Die";
|
|
9131
|
-
/** @internal */
|
|
9132
|
-
const OP_EMPTY = "Empty";
|
|
9133
|
-
/** @internal */
|
|
9134
|
-
const OP_FAIL = "Fail";
|
|
9135
|
-
/** @internal */
|
|
9136
|
-
const OP_INTERRUPT = "Interrupt";
|
|
9137
|
-
/** @internal */
|
|
9138
|
-
const OP_PARALLEL = "Parallel";
|
|
9139
|
-
/** @internal */
|
|
9140
|
-
const OP_SEQUENTIAL = "Sequential";
|
|
9141
|
-
|
|
9142
|
-
// -----------------------------------------------------------------------------
|
|
9143
|
-
// Models
|
|
9144
|
-
// -----------------------------------------------------------------------------
|
|
9145
|
-
/** @internal */
|
|
9146
|
-
const CauseSymbolKey = "effect/Cause";
|
|
9147
|
-
/** @internal */
|
|
9148
|
-
const CauseTypeId = /*#__PURE__*/Symbol.for(CauseSymbolKey);
|
|
9149
|
-
const variance = {
|
|
9150
|
-
/* c8 ignore next */
|
|
9151
|
-
_E: _ => _
|
|
9152
|
-
};
|
|
9153
|
-
/** @internal */
|
|
9154
|
-
const proto = {
|
|
9155
|
-
[CauseTypeId]: variance,
|
|
9156
|
-
[symbol$1]() {
|
|
9157
|
-
return pipe(hash(CauseSymbolKey), combine(hash(flattenCause(this))), cached(this));
|
|
9158
|
-
},
|
|
9159
|
-
[symbol](that) {
|
|
9160
|
-
return isCause(that) && causeEquals(this, that);
|
|
9161
|
-
},
|
|
9162
|
-
pipe() {
|
|
9163
|
-
return pipeArguments(this, arguments);
|
|
9164
|
-
},
|
|
9165
|
-
toJSON() {
|
|
9166
|
-
switch (this._tag) {
|
|
9167
|
-
case "Empty":
|
|
9168
|
-
return {
|
|
9169
|
-
_id: "Cause",
|
|
9170
|
-
_tag: this._tag
|
|
9171
|
-
};
|
|
9172
|
-
case "Die":
|
|
9173
|
-
return {
|
|
9174
|
-
_id: "Cause",
|
|
9175
|
-
_tag: this._tag,
|
|
9176
|
-
defect: toJSON(this.defect)
|
|
9177
|
-
};
|
|
9178
|
-
case "Interrupt":
|
|
9179
|
-
return {
|
|
9180
|
-
_id: "Cause",
|
|
9181
|
-
_tag: this._tag,
|
|
9182
|
-
fiberId: this.fiberId.toJSON()
|
|
9183
|
-
};
|
|
9184
|
-
case "Fail":
|
|
9185
|
-
return {
|
|
9186
|
-
_id: "Cause",
|
|
9187
|
-
_tag: this._tag,
|
|
9188
|
-
failure: toJSON(this.error)
|
|
9189
|
-
};
|
|
9190
|
-
case "Sequential":
|
|
9191
|
-
case "Parallel":
|
|
9192
|
-
return {
|
|
9193
|
-
_id: "Cause",
|
|
9194
|
-
_tag: this._tag,
|
|
9195
|
-
left: toJSON(this.left),
|
|
9196
|
-
right: toJSON(this.right)
|
|
9197
|
-
};
|
|
9198
|
-
}
|
|
9199
|
-
},
|
|
9200
|
-
toString() {
|
|
9201
|
-
return pretty(this);
|
|
9202
|
-
},
|
|
9203
|
-
[NodeInspectSymbol]() {
|
|
9204
|
-
return this.toJSON();
|
|
9205
|
-
}
|
|
9206
|
-
};
|
|
9207
|
-
/** @internal */
|
|
9208
|
-
const fail$1 = error => {
|
|
9209
|
-
const o = Object.create(proto);
|
|
9210
|
-
o._tag = OP_FAIL;
|
|
9211
|
-
o.error = error;
|
|
9212
|
-
return o;
|
|
9213
|
-
};
|
|
9214
|
-
/** @internal */
|
|
9215
|
-
const parallel = (left, right) => {
|
|
9216
|
-
const o = Object.create(proto);
|
|
9217
|
-
o._tag = OP_PARALLEL;
|
|
9218
|
-
o.left = left;
|
|
9219
|
-
o.right = right;
|
|
9220
|
-
return o;
|
|
9221
|
-
};
|
|
9222
|
-
/** @internal */
|
|
9223
|
-
const sequential = (left, right) => {
|
|
9224
|
-
const o = Object.create(proto);
|
|
9225
|
-
o._tag = OP_SEQUENTIAL;
|
|
9226
|
-
o.left = left;
|
|
9227
|
-
o.right = right;
|
|
9228
|
-
return o;
|
|
9229
|
-
};
|
|
9230
|
-
// -----------------------------------------------------------------------------
|
|
9231
|
-
// Refinements
|
|
9232
|
-
// -----------------------------------------------------------------------------
|
|
9233
|
-
/** @internal */
|
|
9234
|
-
const isCause = u => hasProperty(u, CauseTypeId);
|
|
9235
|
-
/** @internal */
|
|
9236
|
-
const isInterruptedOnly = self => reduceWithContext(undefined, IsInterruptedOnlyCauseReducer)(self);
|
|
9237
|
-
/** @internal */
|
|
9238
|
-
const causeEquals = (left, right) => {
|
|
9239
|
-
let leftStack = of(left);
|
|
9240
|
-
let rightStack = of(right);
|
|
9241
|
-
while (isNonEmpty(leftStack) && isNonEmpty(rightStack)) {
|
|
9242
|
-
const [leftParallel, leftSequential] = pipe(headNonEmpty(leftStack), reduce([empty(), empty$3()], ([parallel, sequential], cause) => {
|
|
9243
|
-
const [par, seq] = evaluateCause(cause);
|
|
9244
|
-
return some([pipe(parallel, union(par)), pipe(sequential, appendAll(seq))]);
|
|
9245
|
-
}));
|
|
9246
|
-
const [rightParallel, rightSequential] = pipe(headNonEmpty(rightStack), reduce([empty(), empty$3()], ([parallel, sequential], cause) => {
|
|
9247
|
-
const [par, seq] = evaluateCause(cause);
|
|
9248
|
-
return some([pipe(parallel, union(par)), pipe(sequential, appendAll(seq))]);
|
|
9249
|
-
}));
|
|
9250
|
-
if (!equals(leftParallel, rightParallel)) {
|
|
9251
|
-
return false;
|
|
9252
|
-
}
|
|
9253
|
-
leftStack = leftSequential;
|
|
9254
|
-
rightStack = rightSequential;
|
|
9255
|
-
}
|
|
9256
|
-
return true;
|
|
9257
|
-
};
|
|
9258
|
-
// -----------------------------------------------------------------------------
|
|
9259
|
-
// Flattening
|
|
9260
|
-
// -----------------------------------------------------------------------------
|
|
9261
|
-
/**
|
|
9262
|
-
* Flattens a cause to a sequence of sets of causes, where each set represents
|
|
9263
|
-
* causes that fail in parallel and sequential sets represent causes that fail
|
|
9264
|
-
* after each other.
|
|
9265
|
-
*
|
|
9266
|
-
* @internal
|
|
9267
|
-
*/
|
|
9268
|
-
const flattenCause = cause => {
|
|
9269
|
-
return flattenCauseLoop(of(cause), empty$3());
|
|
9270
|
-
};
|
|
9271
|
-
/** @internal */
|
|
9272
|
-
const flattenCauseLoop = (causes, flattened) => {
|
|
9273
|
-
// eslint-disable-next-line no-constant-condition
|
|
9274
|
-
while (1) {
|
|
9275
|
-
const [parallel, sequential] = pipe(causes, reduce$2([empty(), empty$3()], ([parallel, sequential], cause) => {
|
|
9276
|
-
const [par, seq] = evaluateCause(cause);
|
|
9277
|
-
return [pipe(parallel, union(par)), pipe(sequential, appendAll(seq))];
|
|
9278
|
-
}));
|
|
9279
|
-
const updated = size(parallel) > 0 ? pipe(flattened, prepend(parallel)) : flattened;
|
|
9280
|
-
if (isEmpty(sequential)) {
|
|
9281
|
-
return reverse(updated);
|
|
9282
|
-
}
|
|
9283
|
-
causes = sequential;
|
|
9284
|
-
flattened = updated;
|
|
9285
|
-
}
|
|
9286
|
-
throw new Error(getBugErrorMessage("Cause.flattenCauseLoop"));
|
|
9287
|
-
};
|
|
9288
|
-
// -----------------------------------------------------------------------------
|
|
9289
|
-
// Evaluation
|
|
9290
|
-
// -----------------------------------------------------------------------------
|
|
9291
|
-
/**
|
|
9292
|
-
* Takes one step in evaluating a cause, returning a set of causes that fail
|
|
9293
|
-
* in parallel and a list of causes that fail sequentially after those causes.
|
|
9294
|
-
*
|
|
9295
|
-
* @internal
|
|
9296
|
-
*/
|
|
9297
|
-
const evaluateCause = self => {
|
|
9298
|
-
let cause = self;
|
|
9299
|
-
const stack = [];
|
|
9300
|
-
let _parallel = empty();
|
|
9301
|
-
let _sequential = empty$3();
|
|
9302
|
-
while (cause !== undefined) {
|
|
9303
|
-
switch (cause._tag) {
|
|
9304
|
-
case OP_EMPTY:
|
|
9305
|
-
{
|
|
9306
|
-
if (stack.length === 0) {
|
|
9307
|
-
return [_parallel, _sequential];
|
|
9308
|
-
}
|
|
9309
|
-
cause = stack.pop();
|
|
9310
|
-
break;
|
|
9311
|
-
}
|
|
9312
|
-
case OP_FAIL:
|
|
9313
|
-
{
|
|
9314
|
-
_parallel = add(_parallel, make$1(cause._tag, cause.error));
|
|
9315
|
-
if (stack.length === 0) {
|
|
9316
|
-
return [_parallel, _sequential];
|
|
9317
|
-
}
|
|
9318
|
-
cause = stack.pop();
|
|
9319
|
-
break;
|
|
9320
|
-
}
|
|
9321
|
-
case OP_DIE:
|
|
9322
|
-
{
|
|
9323
|
-
_parallel = add(_parallel, make$1(cause._tag, cause.defect));
|
|
9324
|
-
if (stack.length === 0) {
|
|
9325
|
-
return [_parallel, _sequential];
|
|
9326
|
-
}
|
|
9327
|
-
cause = stack.pop();
|
|
9328
|
-
break;
|
|
9329
|
-
}
|
|
9330
|
-
case OP_INTERRUPT:
|
|
9331
|
-
{
|
|
9332
|
-
_parallel = add(_parallel, make$1(cause._tag, cause.fiberId));
|
|
9333
|
-
if (stack.length === 0) {
|
|
9334
|
-
return [_parallel, _sequential];
|
|
9335
|
-
}
|
|
9336
|
-
cause = stack.pop();
|
|
9337
|
-
break;
|
|
9338
|
-
}
|
|
9339
|
-
case OP_SEQUENTIAL:
|
|
9340
|
-
{
|
|
9341
|
-
switch (cause.left._tag) {
|
|
9342
|
-
case OP_EMPTY:
|
|
9343
|
-
{
|
|
9344
|
-
cause = cause.right;
|
|
9345
|
-
break;
|
|
9346
|
-
}
|
|
9347
|
-
case OP_SEQUENTIAL:
|
|
9348
|
-
{
|
|
9349
|
-
cause = sequential(cause.left.left, sequential(cause.left.right, cause.right));
|
|
9350
|
-
break;
|
|
9351
|
-
}
|
|
9352
|
-
case OP_PARALLEL:
|
|
9353
|
-
{
|
|
9354
|
-
cause = parallel(sequential(cause.left.left, cause.right), sequential(cause.left.right, cause.right));
|
|
9355
|
-
break;
|
|
9356
|
-
}
|
|
9357
|
-
default:
|
|
9358
|
-
{
|
|
9359
|
-
_sequential = prepend(_sequential, cause.right);
|
|
9360
|
-
cause = cause.left;
|
|
9361
|
-
break;
|
|
9362
|
-
}
|
|
9363
|
-
}
|
|
9364
|
-
break;
|
|
9365
|
-
}
|
|
9366
|
-
case OP_PARALLEL:
|
|
9367
|
-
{
|
|
9368
|
-
stack.push(cause.right);
|
|
9369
|
-
cause = cause.left;
|
|
9370
|
-
break;
|
|
9371
|
-
}
|
|
9372
|
-
}
|
|
9373
|
-
}
|
|
9374
|
-
throw new Error(getBugErrorMessage("Cause.evaluateCauseLoop"));
|
|
9375
|
-
};
|
|
9376
|
-
/** @internal */
|
|
9377
|
-
const IsInterruptedOnlyCauseReducer = {
|
|
9378
|
-
emptyCase: constTrue,
|
|
9379
|
-
failCase: constFalse,
|
|
9380
|
-
dieCase: constFalse,
|
|
9381
|
-
interruptCase: constTrue,
|
|
9382
|
-
sequentialCase: (_, left, right) => left && right,
|
|
9383
|
-
parallelCase: (_, left, right) => left && right
|
|
9384
|
-
};
|
|
9385
|
-
const OP_SEQUENTIAL_CASE = "SequentialCase";
|
|
9386
|
-
const OP_PARALLEL_CASE = "ParallelCase";
|
|
9387
|
-
/** @internal */
|
|
9388
|
-
const reduce = /*#__PURE__*/dual(3, (self, zero, pf) => {
|
|
9389
|
-
let accumulator = zero;
|
|
9390
|
-
let cause = self;
|
|
9391
|
-
const causes = [];
|
|
9392
|
-
while (cause !== undefined) {
|
|
9393
|
-
const option = pf(accumulator, cause);
|
|
9394
|
-
accumulator = isSome(option) ? option.value : accumulator;
|
|
9395
|
-
switch (cause._tag) {
|
|
9396
|
-
case OP_SEQUENTIAL:
|
|
9397
|
-
{
|
|
9398
|
-
causes.push(cause.right);
|
|
9399
|
-
cause = cause.left;
|
|
9400
|
-
break;
|
|
9401
|
-
}
|
|
9402
|
-
case OP_PARALLEL:
|
|
9403
|
-
{
|
|
9404
|
-
causes.push(cause.right);
|
|
9405
|
-
cause = cause.left;
|
|
9406
|
-
break;
|
|
9407
|
-
}
|
|
9408
|
-
default:
|
|
9409
|
-
{
|
|
9410
|
-
cause = undefined;
|
|
9411
|
-
break;
|
|
9412
|
-
}
|
|
9413
|
-
}
|
|
9414
|
-
if (cause === undefined && causes.length > 0) {
|
|
9415
|
-
cause = causes.pop();
|
|
9416
|
-
}
|
|
9417
|
-
}
|
|
9418
|
-
return accumulator;
|
|
9419
|
-
});
|
|
9420
|
-
/** @internal */
|
|
9421
|
-
const reduceWithContext = /*#__PURE__*/dual(3, (self, context, reducer) => {
|
|
9422
|
-
const input = [self];
|
|
9423
|
-
const output = [];
|
|
9424
|
-
while (input.length > 0) {
|
|
9425
|
-
const cause = input.pop();
|
|
9426
|
-
switch (cause._tag) {
|
|
9427
|
-
case OP_EMPTY:
|
|
9428
|
-
{
|
|
9429
|
-
output.push(right(reducer.emptyCase(context)));
|
|
9430
|
-
break;
|
|
9431
|
-
}
|
|
9432
|
-
case OP_FAIL:
|
|
9433
|
-
{
|
|
9434
|
-
output.push(right(reducer.failCase(context, cause.error)));
|
|
9435
|
-
break;
|
|
9436
|
-
}
|
|
9437
|
-
case OP_DIE:
|
|
9438
|
-
{
|
|
9439
|
-
output.push(right(reducer.dieCase(context, cause.defect)));
|
|
9440
|
-
break;
|
|
9441
|
-
}
|
|
9442
|
-
case OP_INTERRUPT:
|
|
9443
|
-
{
|
|
9444
|
-
output.push(right(reducer.interruptCase(context, cause.fiberId)));
|
|
9445
|
-
break;
|
|
9446
|
-
}
|
|
9447
|
-
case OP_SEQUENTIAL:
|
|
9448
|
-
{
|
|
9449
|
-
input.push(cause.right);
|
|
9450
|
-
input.push(cause.left);
|
|
9451
|
-
output.push(left({
|
|
9452
|
-
_tag: OP_SEQUENTIAL_CASE
|
|
9453
|
-
}));
|
|
9454
|
-
break;
|
|
9455
|
-
}
|
|
9456
|
-
case OP_PARALLEL:
|
|
9457
|
-
{
|
|
9458
|
-
input.push(cause.right);
|
|
9459
|
-
input.push(cause.left);
|
|
9460
|
-
output.push(left({
|
|
9461
|
-
_tag: OP_PARALLEL_CASE
|
|
9462
|
-
}));
|
|
9463
|
-
break;
|
|
9464
|
-
}
|
|
9465
|
-
}
|
|
9466
|
-
}
|
|
9467
|
-
const accumulator = [];
|
|
9468
|
-
while (output.length > 0) {
|
|
9469
|
-
const either = output.pop();
|
|
9470
|
-
switch (either._tag) {
|
|
9471
|
-
case "Left":
|
|
9472
|
-
{
|
|
9473
|
-
switch (either.left._tag) {
|
|
9474
|
-
case OP_SEQUENTIAL_CASE:
|
|
9475
|
-
{
|
|
9476
|
-
const left = accumulator.pop();
|
|
9477
|
-
const right = accumulator.pop();
|
|
9478
|
-
const value = reducer.sequentialCase(context, left, right);
|
|
9479
|
-
accumulator.push(value);
|
|
9480
|
-
break;
|
|
9481
|
-
}
|
|
9482
|
-
case OP_PARALLEL_CASE:
|
|
9483
|
-
{
|
|
9484
|
-
const left = accumulator.pop();
|
|
9485
|
-
const right = accumulator.pop();
|
|
9486
|
-
const value = reducer.parallelCase(context, left, right);
|
|
9487
|
-
accumulator.push(value);
|
|
9488
|
-
break;
|
|
9489
|
-
}
|
|
9490
|
-
}
|
|
9491
|
-
break;
|
|
9492
|
-
}
|
|
9493
|
-
case "Right":
|
|
9494
|
-
{
|
|
9495
|
-
accumulator.push(either.right);
|
|
9496
|
-
break;
|
|
9497
|
-
}
|
|
9498
|
-
}
|
|
9499
|
-
}
|
|
9500
|
-
if (accumulator.length === 0) {
|
|
9501
|
-
throw new Error("BUG: Cause.reduceWithContext - please report an issue at https://github.com/Effect-TS/effect/issues");
|
|
9502
|
-
}
|
|
9503
|
-
return accumulator.pop();
|
|
9504
|
-
});
|
|
9505
|
-
// -----------------------------------------------------------------------------
|
|
9506
|
-
// Pretty Printing
|
|
9507
|
-
// -----------------------------------------------------------------------------
|
|
9508
|
-
/** @internal */
|
|
9509
|
-
const pretty = (cause, options) => {
|
|
9510
|
-
if (isInterruptedOnly(cause)) {
|
|
9511
|
-
return "All fibers interrupted without errors.";
|
|
9512
|
-
}
|
|
9513
|
-
return prettyErrors(cause).map(function (e) {
|
|
9514
|
-
if (options?.renderErrorCause !== true || e.cause === undefined) {
|
|
9515
|
-
return e.stack;
|
|
9516
|
-
}
|
|
9517
|
-
return `${e.stack} {\n${renderErrorCause(e.cause, " ")}\n}`;
|
|
9518
|
-
}).join("\n");
|
|
9519
|
-
};
|
|
9520
|
-
const renderErrorCause = (cause, prefix) => {
|
|
9521
|
-
const lines = cause.stack.split("\n");
|
|
9522
|
-
let stack = `${prefix}[cause]: ${lines[0]}`;
|
|
9523
|
-
for (let i = 1, len = lines.length; i < len; i++) {
|
|
9524
|
-
stack += `\n${prefix}${lines[i]}`;
|
|
9525
|
-
}
|
|
9526
|
-
if (cause.cause) {
|
|
9527
|
-
stack += ` {\n${renderErrorCause(cause.cause, `${prefix} `)}\n${prefix}}`;
|
|
9528
|
-
}
|
|
9529
|
-
return stack;
|
|
9530
|
-
};
|
|
9531
|
-
/** @internal */
|
|
9532
|
-
const makePrettyError = originalError => {
|
|
9533
|
-
const originalErrorIsObject = typeof originalError === "object" && originalError !== null;
|
|
9534
|
-
const prevLimit = Error.stackTraceLimit;
|
|
9535
|
-
Error.stackTraceLimit = 1;
|
|
9536
|
-
const error = new Error(prettyErrorMessage(originalError), originalErrorIsObject && "cause" in originalError && typeof originalError.cause !== "undefined" ? {
|
|
9537
|
-
cause: makePrettyError(originalError.cause)
|
|
9538
|
-
} : undefined);
|
|
9539
|
-
Error.stackTraceLimit = prevLimit;
|
|
9540
|
-
if (error.message === "") {
|
|
9541
|
-
error.message = "An error has occurred";
|
|
9542
|
-
}
|
|
9543
|
-
Error.stackTraceLimit = prevLimit;
|
|
9544
|
-
error.name = originalError instanceof Error ? originalError.name : "Error";
|
|
9545
|
-
if (originalErrorIsObject) {
|
|
9546
|
-
if (spanSymbol in originalError) {
|
|
9547
|
-
error.span = originalError[spanSymbol];
|
|
9548
|
-
}
|
|
9549
|
-
Object.keys(originalError).forEach(key => {
|
|
9550
|
-
if (!(key in error)) {
|
|
9551
|
-
// @ts-expect-error
|
|
9552
|
-
error[key] = originalError[key];
|
|
9553
|
-
}
|
|
9554
|
-
});
|
|
9555
|
-
}
|
|
9556
|
-
error.stack = prettyErrorStack(`${error.name}: ${error.message}`, originalError instanceof Error && originalError.stack ? originalError.stack : "", error.span);
|
|
9557
|
-
return error;
|
|
9558
|
-
};
|
|
9559
|
-
/**
|
|
9560
|
-
* A utility function for generating human-readable error messages from a generic error of type `unknown`.
|
|
9561
|
-
*
|
|
9562
|
-
* Rules:
|
|
9563
|
-
*
|
|
9564
|
-
* 1) If the input `u` is already a string, it's considered a message.
|
|
9565
|
-
* 2) If `u` is an Error instance with a message defined, it uses the message.
|
|
9566
|
-
* 3) If `u` has a user-defined `toString()` method, it uses that method.
|
|
9567
|
-
* 4) Otherwise, it uses `Inspectable.stringifyCircular` to produce a string representation and uses it as the error message,
|
|
9568
|
-
* with "Error" added as a prefix.
|
|
9569
|
-
*
|
|
9570
|
-
* @internal
|
|
9571
|
-
*/
|
|
9572
|
-
const prettyErrorMessage = u => {
|
|
9573
|
-
// 1)
|
|
9574
|
-
if (typeof u === "string") {
|
|
9575
|
-
return u;
|
|
9576
|
-
}
|
|
9577
|
-
// 2)
|
|
9578
|
-
if (typeof u === "object" && u !== null && u instanceof Error) {
|
|
9579
|
-
return u.message;
|
|
9580
|
-
}
|
|
9581
|
-
// 3)
|
|
9582
|
-
try {
|
|
9583
|
-
if (hasProperty(u, "toString") && isFunction(u["toString"]) && u["toString"] !== Object.prototype.toString && u["toString"] !== globalThis.Array.prototype.toString) {
|
|
9584
|
-
return u["toString"]();
|
|
9585
|
-
}
|
|
9586
|
-
} catch {
|
|
9587
|
-
// something's off, rollback to json
|
|
9588
|
-
}
|
|
9589
|
-
// 4)
|
|
9590
|
-
return stringifyCircular(u);
|
|
9591
|
-
};
|
|
9592
|
-
const locationRegex = /\((.*)\)/g;
|
|
9593
|
-
/** @internal */
|
|
9594
|
-
const spanToTrace = /*#__PURE__*/globalValue("effect/Tracer/spanToTrace", () => new WeakMap());
|
|
9595
|
-
const prettyErrorStack = (message, stack, span) => {
|
|
9596
|
-
const out = [message];
|
|
9597
|
-
const lines = stack.startsWith(message) ? stack.slice(message.length).split("\n") : stack.split("\n");
|
|
9598
|
-
for (let i = 1; i < lines.length; i++) {
|
|
9599
|
-
if (lines[i].includes(" at new BaseEffectError") || lines[i].includes(" at new YieldableError")) {
|
|
9600
|
-
i++;
|
|
9601
|
-
continue;
|
|
9602
|
-
}
|
|
9603
|
-
if (lines[i].includes("Generator.next")) {
|
|
9604
|
-
break;
|
|
9605
|
-
}
|
|
9606
|
-
if (lines[i].includes("effect_internal_function")) {
|
|
9607
|
-
break;
|
|
9608
|
-
}
|
|
9609
|
-
out.push(lines[i].replace(/at .*effect_instruction_i.*\((.*)\)/, "at $1").replace(/EffectPrimitive\.\w+/, "<anonymous>"));
|
|
9610
|
-
}
|
|
9611
|
-
if (span) {
|
|
9612
|
-
let current = span;
|
|
9613
|
-
let i = 0;
|
|
9614
|
-
while (current && current._tag === "Span" && i < 10) {
|
|
9615
|
-
const stackFn = spanToTrace.get(current);
|
|
9616
|
-
if (typeof stackFn === "function") {
|
|
9617
|
-
const stack = stackFn();
|
|
9618
|
-
if (typeof stack === "string") {
|
|
9619
|
-
const locationMatchAll = stack.matchAll(locationRegex);
|
|
9620
|
-
let match = false;
|
|
9621
|
-
for (const [, location] of locationMatchAll) {
|
|
9622
|
-
match = true;
|
|
9623
|
-
out.push(` at ${current.name} (${location})`);
|
|
9624
|
-
}
|
|
9625
|
-
if (!match) {
|
|
9626
|
-
out.push(` at ${current.name} (${stack.replace(/^at /, "")})`);
|
|
9627
|
-
}
|
|
9628
|
-
} else {
|
|
9629
|
-
out.push(` at ${current.name}`);
|
|
9630
|
-
}
|
|
9631
|
-
} else {
|
|
9632
|
-
out.push(` at ${current.name}`);
|
|
9633
|
-
}
|
|
9634
|
-
current = getOrUndefined(current.parent);
|
|
9635
|
-
i++;
|
|
9636
|
-
}
|
|
9637
|
-
}
|
|
9638
|
-
return out.join("\n");
|
|
9639
|
-
};
|
|
9640
|
-
/** @internal */
|
|
9641
|
-
const spanSymbol = /*#__PURE__*/Symbol.for("effect/SpanAnnotation");
|
|
9642
|
-
/** @internal */
|
|
9643
|
-
const prettyErrors = cause => reduceWithContext(cause, void 0, {
|
|
9644
|
-
emptyCase: () => [],
|
|
9645
|
-
dieCase: (_, unknownError) => {
|
|
9646
|
-
return [makePrettyError(unknownError)];
|
|
9647
|
-
},
|
|
9648
|
-
failCase: (_, error) => {
|
|
9649
|
-
return [makePrettyError(error)];
|
|
9650
|
-
},
|
|
9651
|
-
interruptCase: () => [],
|
|
9652
|
-
parallelCase: (_, l, r) => [...l, ...r],
|
|
9653
|
-
sequentialCase: (_, l, r) => [...l, ...r]
|
|
9654
|
-
});
|
|
9655
|
-
|
|
9656
|
-
/** @internal */
|
|
9657
|
-
class SingleShotGen {
|
|
9658
|
-
self;
|
|
9659
|
-
called = false;
|
|
9660
|
-
constructor(self) {
|
|
9661
|
-
this.self = self;
|
|
9662
|
-
}
|
|
9663
|
-
next(a) {
|
|
9664
|
-
return this.called ? {
|
|
9665
|
-
value: a,
|
|
9666
|
-
done: true
|
|
9667
|
-
} : (this.called = true, {
|
|
9668
|
-
value: this.self,
|
|
9669
|
-
done: false
|
|
9670
|
-
});
|
|
9671
|
-
}
|
|
9672
|
-
return(a) {
|
|
9673
|
-
return {
|
|
9674
|
-
value: a,
|
|
9675
|
-
done: true
|
|
9676
|
-
};
|
|
9677
|
-
}
|
|
9678
|
-
throw(e) {
|
|
9679
|
-
throw e;
|
|
9680
|
-
}
|
|
9681
|
-
[Symbol.iterator]() {
|
|
9682
|
-
return new SingleShotGen(this.self);
|
|
9683
|
-
}
|
|
9684
|
-
}
|
|
9685
|
-
|
|
9686
|
-
/** @internal */
|
|
9687
|
-
const EffectTypeId = /*#__PURE__*/Symbol.for("effect/Effect");
|
|
9688
|
-
class EffectPrimitive {
|
|
9689
|
-
_op;
|
|
9690
|
-
effect_instruction_i0 = undefined;
|
|
9691
|
-
effect_instruction_i1 = undefined;
|
|
9692
|
-
effect_instruction_i2 = undefined;
|
|
9693
|
-
trace = undefined;
|
|
9694
|
-
[EffectTypeId] = effectVariance;
|
|
9695
|
-
constructor(_op) {
|
|
9696
|
-
this._op = _op;
|
|
9697
|
-
}
|
|
9698
|
-
[symbol](that) {
|
|
9699
|
-
return this === that;
|
|
9700
|
-
}
|
|
9701
|
-
[symbol$1]() {
|
|
9702
|
-
return cached(this, random(this));
|
|
9703
|
-
}
|
|
9704
|
-
pipe() {
|
|
9705
|
-
return pipeArguments(this, arguments);
|
|
9706
|
-
}
|
|
9707
|
-
toJSON() {
|
|
9708
|
-
return {
|
|
9709
|
-
_id: "Effect",
|
|
9710
|
-
_op: this._op,
|
|
9711
|
-
effect_instruction_i0: toJSON(this.effect_instruction_i0),
|
|
9712
|
-
effect_instruction_i1: toJSON(this.effect_instruction_i1),
|
|
9713
|
-
effect_instruction_i2: toJSON(this.effect_instruction_i2)
|
|
9714
|
-
};
|
|
9715
|
-
}
|
|
9716
|
-
toString() {
|
|
9717
|
-
return format(this.toJSON());
|
|
9718
|
-
}
|
|
9719
|
-
[NodeInspectSymbol]() {
|
|
9720
|
-
return this.toJSON();
|
|
9721
|
-
}
|
|
9722
|
-
[Symbol.iterator]() {
|
|
9723
|
-
return new SingleShotGen(new YieldWrap(this));
|
|
9724
|
-
}
|
|
9725
|
-
}
|
|
9726
|
-
/** @internal */
|
|
9727
|
-
class EffectPrimitiveFailure {
|
|
9728
|
-
_op;
|
|
9729
|
-
effect_instruction_i0 = undefined;
|
|
9730
|
-
effect_instruction_i1 = undefined;
|
|
9731
|
-
effect_instruction_i2 = undefined;
|
|
9732
|
-
trace = undefined;
|
|
9733
|
-
[EffectTypeId] = effectVariance;
|
|
9734
|
-
constructor(_op) {
|
|
9735
|
-
this._op = _op;
|
|
9736
|
-
// @ts-expect-error
|
|
9737
|
-
this._tag = _op;
|
|
9738
|
-
}
|
|
9739
|
-
[symbol](that) {
|
|
9740
|
-
return exitIsExit(that) && that._op === "Failure" &&
|
|
9741
|
-
// @ts-expect-error
|
|
9742
|
-
equals(this.effect_instruction_i0, that.effect_instruction_i0);
|
|
9743
|
-
}
|
|
9744
|
-
[symbol$1]() {
|
|
9745
|
-
return pipe(
|
|
9746
|
-
// @ts-expect-error
|
|
9747
|
-
string(this._tag),
|
|
9748
|
-
// @ts-expect-error
|
|
9749
|
-
combine(hash(this.effect_instruction_i0)), cached(this));
|
|
9750
|
-
}
|
|
9751
|
-
get cause() {
|
|
9752
|
-
return this.effect_instruction_i0;
|
|
9753
|
-
}
|
|
9754
|
-
pipe() {
|
|
9755
|
-
return pipeArguments(this, arguments);
|
|
9756
|
-
}
|
|
9757
|
-
toJSON() {
|
|
9758
|
-
return {
|
|
9759
|
-
_id: "Exit",
|
|
9760
|
-
_tag: this._op,
|
|
9761
|
-
cause: this.cause.toJSON()
|
|
9762
|
-
};
|
|
9763
|
-
}
|
|
9764
|
-
toString() {
|
|
9765
|
-
return format(this.toJSON());
|
|
9766
|
-
}
|
|
9767
|
-
[NodeInspectSymbol]() {
|
|
9768
|
-
return this.toJSON();
|
|
9769
|
-
}
|
|
9770
|
-
[Symbol.iterator]() {
|
|
9771
|
-
return new SingleShotGen(new YieldWrap(this));
|
|
9772
|
-
}
|
|
9773
|
-
}
|
|
9774
|
-
/** @internal */
|
|
9775
|
-
const isEffect = u => hasProperty(u, EffectTypeId);
|
|
9776
|
-
/* @internal */
|
|
9777
|
-
const withFiberRuntime = withRuntime => {
|
|
9778
|
-
const effect = new EffectPrimitive(OP_WITH_RUNTIME);
|
|
9779
|
-
effect.effect_instruction_i0 = withRuntime;
|
|
9780
|
-
return effect;
|
|
9781
|
-
};
|
|
9782
|
-
const originalSymbol = /*#__PURE__*/Symbol.for("effect/OriginalAnnotation");
|
|
9783
|
-
/* @internal */
|
|
9784
|
-
const capture = (obj, span) => {
|
|
9785
|
-
if (isSome(span)) {
|
|
9786
|
-
return new Proxy(obj, {
|
|
9787
|
-
has(target, p) {
|
|
9788
|
-
return p === spanSymbol || p === originalSymbol || p in target;
|
|
9789
|
-
},
|
|
9790
|
-
get(target, p) {
|
|
9791
|
-
if (p === spanSymbol) {
|
|
9792
|
-
return span.value;
|
|
9793
|
-
}
|
|
9794
|
-
if (p === originalSymbol) {
|
|
9795
|
-
return obj;
|
|
9796
|
-
}
|
|
9797
|
-
// @ts-expect-error
|
|
9798
|
-
return target[p];
|
|
9799
|
-
}
|
|
9800
|
-
});
|
|
9801
|
-
}
|
|
9802
|
-
return obj;
|
|
9803
|
-
};
|
|
9804
|
-
/* @internal */
|
|
9805
|
-
const fail = error => isObject(error) && !(spanSymbol in error) ? withFiberRuntime(fiber => failCause(fail$1(capture(error, currentSpanFromFiber(fiber))))) : failCause(fail$1(error));
|
|
9806
|
-
/* @internal */
|
|
9807
|
-
const failCause = cause => {
|
|
9808
|
-
const effect = new EffectPrimitiveFailure(OP_FAILURE);
|
|
9809
|
-
effect.effect_instruction_i0 = cause;
|
|
9810
|
-
return effect;
|
|
9811
|
-
};
|
|
9812
|
-
// -----------------------------------------------------------------------------
|
|
9813
|
-
// Errors
|
|
9814
|
-
// -----------------------------------------------------------------------------
|
|
9815
|
-
/** @internal */
|
|
9816
|
-
const YieldableError = /*#__PURE__*/function () {
|
|
9817
|
-
class YieldableError extends globalThis.Error {
|
|
9818
|
-
commit() {
|
|
9819
|
-
return fail(this);
|
|
9820
|
-
}
|
|
9821
|
-
toJSON() {
|
|
9822
|
-
const obj = {
|
|
9823
|
-
...this
|
|
9824
|
-
};
|
|
9825
|
-
if (this.message) obj.message = this.message;
|
|
9826
|
-
if (this.cause) obj.cause = this.cause;
|
|
9827
|
-
return obj;
|
|
9828
|
-
}
|
|
9829
|
-
[NodeInspectSymbol]() {
|
|
9830
|
-
if (this.toString !== globalThis.Error.prototype.toString) {
|
|
9831
|
-
return this.stack ? `${this.toString()}\n${this.stack.split("\n").slice(1).join("\n")}` : this.toString();
|
|
9832
|
-
} else if ("Bun" in globalThis) {
|
|
9833
|
-
return pretty(fail$1(this), {
|
|
9834
|
-
renderErrorCause: true
|
|
9835
|
-
});
|
|
9836
|
-
}
|
|
9837
|
-
return this;
|
|
9838
|
-
}
|
|
9839
|
-
}
|
|
9840
|
-
// @effect-diagnostics-next-line floatingEffect:off
|
|
9841
|
-
Object.assign(YieldableError.prototype, StructuralCommitPrototype);
|
|
9842
|
-
return YieldableError;
|
|
9843
|
-
}();
|
|
9844
|
-
// -----------------------------------------------------------------------------
|
|
9845
|
-
// Exit
|
|
9846
|
-
// -----------------------------------------------------------------------------
|
|
9847
|
-
/** @internal */
|
|
9848
|
-
const exitIsExit = u => isEffect(u) && "_tag" in u && (u._tag === "Success" || u._tag === "Failure");
|
|
9849
|
-
// -----------------------------------------------------------------------------
|
|
9850
|
-
// Tracing
|
|
9851
|
-
// -----------------------------------------------------------------------------
|
|
9852
|
-
/** @internal */
|
|
9853
|
-
const currentSpanFromFiber = fiber => {
|
|
9854
|
-
const span = fiber.currentSpan;
|
|
9855
|
-
return span !== undefined && span._tag === "Span" ? some(span) : none();
|
|
9856
|
-
};
|
|
9857
|
-
|
|
9858
|
-
const hasProcessStdout = typeof process === "object" && process !== null && typeof process.stdout === "object" && process.stdout !== null;
|
|
9859
|
-
hasProcessStdout && process.stdout.isTTY === true;
|
|
9860
|
-
|
|
9861
|
-
/**
|
|
9862
|
-
* Provides a constructor for a Case Class.
|
|
9863
|
-
*
|
|
9864
|
-
* @since 2.0.0
|
|
9865
|
-
* @category constructors
|
|
9866
|
-
*/
|
|
9867
|
-
const Error$1 = /*#__PURE__*/function () {
|
|
9868
|
-
const plainArgsSymbol = /*#__PURE__*/Symbol.for("effect/Data/Error/plainArgs");
|
|
9869
|
-
const O = {
|
|
9870
|
-
BaseEffectError: class extends YieldableError {
|
|
9871
|
-
constructor(args) {
|
|
9872
|
-
super(args?.message, args?.cause ? {
|
|
9873
|
-
cause: args.cause
|
|
9874
|
-
} : undefined);
|
|
9875
|
-
if (args) {
|
|
9876
|
-
Object.assign(this, args);
|
|
9877
|
-
// @effect-diagnostics-next-line floatingEffect:off
|
|
9878
|
-
Object.defineProperty(this, plainArgsSymbol, {
|
|
9879
|
-
value: args,
|
|
9880
|
-
enumerable: false
|
|
9881
|
-
});
|
|
9882
|
-
}
|
|
9883
|
-
}
|
|
9884
|
-
toJSON() {
|
|
9885
|
-
return {
|
|
9886
|
-
...this[plainArgsSymbol],
|
|
9887
|
-
...this
|
|
9888
|
-
};
|
|
9889
|
-
}
|
|
9890
|
-
}
|
|
9891
|
-
};
|
|
9892
|
-
return O.BaseEffectError;
|
|
9893
|
-
}();
|
|
9894
|
-
/**
|
|
9895
|
-
* @since 2.0.0
|
|
9896
|
-
* @category constructors
|
|
9897
|
-
*/
|
|
9898
|
-
const TaggedError = tag => {
|
|
9899
|
-
const O = {
|
|
9900
|
-
BaseEffectError: class extends Error$1 {
|
|
9901
|
-
_tag = tag;
|
|
9902
|
-
}
|
|
9903
|
-
};
|
|
9904
|
-
O.BaseEffectError.prototype.name = tag;
|
|
9905
|
-
return O.BaseEffectError;
|
|
9906
|
-
};
|
|
9907
|
-
|
|
9908
|
-
class FetchError extends TaggedError('FetchError') {
|
|
9909
|
-
}
|
|
9910
|
-
class NotFoundError extends TaggedError('NotFoundError') {
|
|
9911
|
-
}
|
|
9912
|
-
class ResponseTextError extends TaggedError('ResponseTextError') {
|
|
9913
|
-
constructor(error) {
|
|
9914
|
-
super(new Error(`Failed to read response text`, { cause: error }));
|
|
9915
|
-
}
|
|
9916
|
-
}
|
|
9917
|
-
|
|
9918
|
-
refined(isValidSVG, () => error('SVG data is malformed'));
|
|
9919
|
-
class BrandValidationError extends TaggedError('BrandValidationError') {
|
|
9920
|
-
constructor(error, type) {
|
|
9921
|
-
super(new Error(`Brand validation failed for type ${type}.`, { cause: error }));
|
|
9922
|
-
}
|
|
9923
|
-
}
|
|
9924
|
-
function isValidSVG(svg) {
|
|
9925
|
-
if (typeof svg !== 'string') {
|
|
9926
|
-
return false;
|
|
9927
|
-
}
|
|
9928
|
-
try {
|
|
9929
|
-
const parser = new DOMParser();
|
|
9930
|
-
const doc = parser.parseFromString(svg, 'image/svg+xml');
|
|
9931
|
-
return doc.documentElement.nodeName === 'svg';
|
|
9932
|
-
}
|
|
9933
|
-
catch {
|
|
9934
|
-
return false;
|
|
9935
|
-
}
|
|
9936
|
-
}
|
|
9937
|
-
|
|
9938
|
-
const lmvzIconCss = () => `.sc-lmvz-icon-h{--lmvz-icon-color:var(--lmvz-component-color, var(--lmvz-semantic-color-on-surface-input-primary, #000000));display:inline-block;line-height:0;svg{display:block}svg>path{stroke:var(--lmvz-icon-color);fill:none}}[size='xs'].sc-lmvz-icon-h{svg{width:var(--lmvz-component-icon-size-xs, clamp(0.75rem, 0.69rem + 0.26vw, 1rem));height:var(--lmvz-component-icon-size-xs, clamp(0.75rem, 0.69rem + 0.26vw, 1rem))}}[size='sm'].sc-lmvz-icon-h{svg{width:var(--lmvz-component-icon-size-sm, clamp(0.88rem, 0.81rem + 0.26vw, 1.13rem));height:var(--lmvz-component-icon-size-sm, clamp(0.88rem, 0.81rem + 0.26vw, 1.13rem))}}[size='md'].sc-lmvz-icon-h{svg{width:var(--lmvz-component-icon-size-md, clamp(1rem, 0.88rem + 0.52vw, 1.5rem));height:var(--lmvz-component-icon-size-md, clamp(1rem, 0.88rem + 0.52vw, 1.5rem))}}[size='lg'].sc-lmvz-icon-h{svg{width:var(--lmvz-component-icon-size-lg, clamp(1.5rem, 1.38rem + 0.52vw, 2rem));height:var(--lmvz-component-icon-size-lg, clamp(1.5rem, 1.38rem + 0.52vw, 2rem))}}[size='inherit'].sc-lmvz-icon-h{svg{width:inherit;height:inherit}}[weight='light'].sc-lmvz-icon-h{svg>path{stroke-width:1}}[weight='medium'].sc-lmvz-icon-h{svg>path{stroke-width:1.5}}[weight='bold'].sc-lmvz-icon-h{svg>path{stroke-width:2}}[weight='filled'].sc-lmvz-icon-h{svg>path{stroke-width:2;fill:var(--lmvz-icon-color)}}`;
|
|
9939
|
-
|
|
9940
|
-
class LmvzIcon extends ReactiveControllerHost {
|
|
9941
|
-
intersectionObserver;
|
|
9942
|
-
ariaValidationController = new AriaValidationController(this);
|
|
9943
|
-
get el() { return getElement(this); }
|
|
9944
|
-
validationEl;
|
|
9945
|
-
icon;
|
|
9946
|
-
weight = 'medium';
|
|
9947
|
-
size = 'md';
|
|
9948
|
-
iconData;
|
|
9949
|
-
visible = false;
|
|
9950
|
-
ariaLabel;
|
|
9951
|
-
get ariaHidden() {
|
|
9952
|
-
return !this.ariaLabel;
|
|
9953
|
-
}
|
|
9954
|
-
constructor(hostRef) {
|
|
9955
|
-
super();
|
|
9956
|
-
registerInstance(this, hostRef);
|
|
9957
|
-
this.addController(this.ariaValidationController);
|
|
9958
6224
|
}
|
|
9959
|
-
connectedCallback() {
|
|
9960
|
-
this.waitUntilVisible(() => {
|
|
9961
|
-
this.visible = true;
|
|
9962
|
-
this.loadIconPathData();
|
|
9963
|
-
});
|
|
9964
|
-
super.connectedCallback();
|
|
9965
|
-
}
|
|
9966
|
-
disconnectedCallback() {
|
|
9967
|
-
if (this.intersectionObserver) {
|
|
9968
|
-
this.intersectionObserver.disconnect();
|
|
9969
|
-
this.intersectionObserver = undefined;
|
|
9970
|
-
}
|
|
9971
|
-
super.disconnectedCallback();
|
|
9972
|
-
}
|
|
9973
|
-
async loadIconPathData() {
|
|
9974
|
-
{
|
|
9975
|
-
return;
|
|
9976
|
-
}
|
|
9977
|
-
}
|
|
9978
|
-
componentDidRender() {
|
|
9979
|
-
this.validationEl = this.el.querySelector('svg');
|
|
9980
|
-
this.ariaValidationController.revalidateAria();
|
|
9981
|
-
super.componentDidRender();
|
|
9982
|
-
}
|
|
9983
|
-
render() {
|
|
9984
|
-
return hAsync(Host, { key: 'f5c2f8025d0e9598d903e72770ebca6cad01961c', role: "img", "aria-hidden": `${this.ariaHidden}`, innerHTML: this.iconData });
|
|
9985
|
-
}
|
|
9986
|
-
waitUntilVisible(callback, rootMargin = 50) {
|
|
9987
|
-
{
|
|
9988
|
-
callback();
|
|
9989
|
-
return;
|
|
9990
|
-
}
|
|
9991
|
-
}
|
|
9992
|
-
static get assetsDirs() { return ["../../assets/icons"]; }
|
|
9993
6225
|
static get watchers() { return {
|
|
9994
6226
|
"icon": [{
|
|
9995
6227
|
"loadIconPathData": 0
|
|
6228
|
+
}],
|
|
6229
|
+
"iconset": [{
|
|
6230
|
+
"loadIconPathData": 0
|
|
9996
6231
|
}]
|
|
9997
6232
|
}; }
|
|
9998
6233
|
static get style() { return lmvzIconCss(); }
|
|
@@ -10003,17 +6238,18 @@ class LmvzIcon extends ReactiveControllerHost {
|
|
|
10003
6238
|
"icon": [513],
|
|
10004
6239
|
"weight": [513],
|
|
10005
6240
|
"size": [513],
|
|
6241
|
+
"iconset": [513],
|
|
10006
6242
|
"ariaLabel": [513, "aria-label"],
|
|
10007
6243
|
"iconData": [32],
|
|
10008
6244
|
"visible": [32]
|
|
10009
6245
|
},
|
|
10010
6246
|
"$listeners$": undefined,
|
|
10011
6247
|
"$lazyBundleId$": "-",
|
|
10012
|
-
"$attrsToReflect$": [["icon", "icon"], ["weight", "weight"], ["size", "size"], ["ariaLabel", "aria-label"]]
|
|
6248
|
+
"$attrsToReflect$": [["icon", "icon"], ["weight", "weight"], ["size", "size"], ["iconset", "iconset"], ["ariaLabel", "aria-label"]]
|
|
10013
6249
|
}; }
|
|
10014
6250
|
}
|
|
10015
6251
|
|
|
10016
|
-
const lmvzInputCss = () => `@layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.theme { @font-face { font-family: Router; src: local('Router-Book'), url('/assets/fonts/Router-Book.woff') format('woff'), local('Router'); font-weight: 400 normal; } @font-face { font-family: Router; src: local('Router-Medium'), url('/assets/fonts/Router-Medium.woff') format('woff'), local('Router'); font-weight: 500; } @font-face { font-family: Router; src: local('Router-Bold'), url('/assets/fonts/Router-Bold.woff') format('woff'), local('Router'); font-weight: 700 bold; } } .sc-lmvz-input-h { display: block; font-family: var(--lmvz-global-font-family-default, Router); --input-radius: var(--lmvz-component-input-radius-default, 999px); --input-bg: var(--lmvz-semantic-color-surface-input-primary, #ffffff); --input-border-color: var(--lmvz-semantic-color-border-default, #e0e0e0); --input-border-color-hover: var(--lmvz-semantic-color-border-hover, #c7c7c7); --input-border-color-focus: var(--lmvz-semantic-color-status-on-
|
|
6252
|
+
const lmvzInputCss = () => `@layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.theme { @font-face { font-family: Router; src: local('Router-Book'), url('/assets/fonts/Router-Book.woff') format('woff'), local('Router'); font-weight: 400 normal; } @font-face { font-family: Router; src: local('Router-Medium'), url('/assets/fonts/Router-Medium.woff') format('woff'), local('Router'); font-weight: 500; } @font-face { font-family: Router; src: local('Router-Bold'), url('/assets/fonts/Router-Bold.woff') format('woff'), local('Router'); font-weight: 700 bold; } } .sc-lmvz-input-h { display: block; font-family: var(--lmvz-global-font-family-default, Router); --input-radius: var(--lmvz-component-input-radius-default, 999px); --input-bg: var(--lmvz-semantic-color-surface-input-primary, #ffffff); --input-border-color: var(--lmvz-semantic-color-border-default, #e0e0e0); --input-border-color-hover: var(--lmvz-semantic-color-border-hover, #c7c7c7); --input-border-color-focus: var(--lmvz-semantic-color-status-on-active, #0e7ab4); --input-border-width: var(--lmvz-semantic-border-width-default, 1px); --input-height: 48px; --input-padding-x: 16px; --label-color: var(--lmvz-semantic-color-on-surface-input-secondary, #7a7a7a); --input-text-color: var(--lmvz-semantic-color-on-surface-input-primary, #000000); --helper-text-color: var(--lmvz-semantic-color-on-surface-input-secondary, #7a7a7a); --error-text-color: var(--lmvz-semantic-color-status-on-danger, #e52a31); --label-floating-scale: 0.85; --label-minimized-top: -6px; --label-minimized-bg: var(--input-bg); --label-minimized-padding-x: 4px; --input-disabled-opacity: var(--lmvz-component-input-disabled-opacity, 40%); } .input-container.sc-lmvz-input { display: flex; flex-direction: column; position: relative; width: 100%; } .input-wrapper.sc-lmvz-input { background-color: var(--input-bg); border: var(--input-border-width) solid var(--input-border-color); border-radius: var(--input-radius); display: flex; align-items: center; height: var(--input-height); padding: 0 var(--input-padding-x); position: relative; transition: border-color 0.2s ease; gap: 8px; } [disabled].sc-lmvz-input-h .input-wrapper.sc-lmvz-input { opacity: var(--input-disabled-opacity); cursor: not-allowed; pointer-events: none; } .input-container.sc-lmvz-input:focus-within .input-wrapper.sc-lmvz-input { border-color: var(--input-border-color-focus); outline: 2px solid var(--input-border-color-focus); outline-offset: 2px; } .input-container.sc-lmvz-input:has(input:focus-visible) .input-wrapper.sc-lmvz-input { box-shadow: 0 0 0 3px rgb(0 86 214 / 20%); } [error].sc-lmvz-input-h .input-wrapper.sc-lmvz-input { border-color: var(--error-text-color); } [error].sc-lmvz-input-h:focus-within .input-wrapper.sc-lmvz-input { border-color: var(--error-text-color); outline-color: var(--error-text-color); } .sc-lmvz-input-h:not([disabled]) .input-wrapper.sc-lmvz-input:hover { border-color: var(--input-border-color-hover); } .label-input-group.sc-lmvz-input { position: relative; flex-grow: 1; display: flex; align-items: center; height: 100%; } label.sc-lmvz-input { position: absolute; left: 0; top: 50%; transform: translateY(-50%); color: var(--label-color); font-size: 14px; font-family: Router, sans-serif; font-weight: 400; pointer-events: none; transition: all 0.2s ease-out; background-color: transparent; padding: 0; margin: 0; line-height: normal; white-space: nowrap; } label.floating.sc-lmvz-input { top: 0; transform: translateY(-50%) scale(0.85); transform-origin: left top; background-color: var(--label-minimized-bg); padding: 0 var(--label-minimized-padding-x); left: -2px; color: var(--input-text-color); font-weight: 500; } .required-indicator.sc-lmvz-input { color: var(--error-text-color); margin-left: 2px; } input.sc-lmvz-input { border: none; background: transparent; width: 100%; height: 100%; color: var(--input-text-color); font-family: inherit; font-size: 14px; outline: none; padding: 0; margin: 0; font-weight: 400; } input.sc-lmvz-input::placeholder { color: var(--label-color); } div.sc-lmvz-input:empty { display: none; } [role='status'].sc-lmvz-input { padding-top: 8px; padding-left: 12px; font-size: 12px; color: var(--helper-text-color); font-family: Router, sans-serif; font-weight: 500; } [role='alert'].sc-lmvz-input { padding-top: 8px; padding-left: 12px; font-size: 12px; color: var(--error-text-color); font-family: Router, sans-serif; font-weight: 500; } .sc-lmvz-input-s > lmvz-button { --lmvz-button-padding: 4px; }`;
|
|
10017
6253
|
|
|
10018
6254
|
let inputIdCounter = 0;
|
|
10019
6255
|
class LmvzInput extends ReactiveControllerHost {
|
|
@@ -10171,9 +6407,9 @@ class LmvzInput extends ReactiveControllerHost {
|
|
|
10171
6407
|
render() {
|
|
10172
6408
|
const hasValue = Boolean(this.value);
|
|
10173
6409
|
const shouldFloatLabel = hasValue || Boolean(this.placeholder);
|
|
10174
|
-
return (hAsync("div", { key: '
|
|
6410
|
+
return (hAsync("div", { key: '9de2e4dd202edc937e96ff6ebdc8d0270851c4ca', class: classNames('input-container', {
|
|
10175
6411
|
'interaction-filled': hasValue,
|
|
10176
|
-
}) }, hAsync("div", { key: '
|
|
6412
|
+
}) }, hAsync("div", { key: '0c9f92778e1c52dca13ed9175a09d757fc6eedc9', class: "input-wrapper" }, hAsync("slot", { key: '9cf29c45afdb127917a68ed6752faf3d50004c7d', name: "before-input" }), hAsync("div", { key: 'e7e6c54b6ee6db108ac3f8ddb676bb9fcf10517e', class: "label-input-group" }, hAsync("label", { key: '68eb29e585741971aae58c7693d011ba587f1c1b', htmlFor: this.inputId, class: classNames({ floating: shouldFloatLabel }) }, this.label, this.required && (hAsync("span", { key: '274d992a43c2de45af7172608fb1581c6ee771d2', class: "required-indicator", "aria-hidden": "true" }, ' ', "*"))), hAsync("input", { key: 'a26b95dee9781e0e13db16d6e09681e36cab0230', id: this.inputId, ref: (el) => (this.nativeInputElement = el), type: this.type, min: this.min, max: this.max, step: this.step, value: this.value, name: this.name, placeholder: this.placeholder, disabled: this.disabled, readOnly: this.readonly, required: this.required, form: this.form, autocomplete: this.autocomplete, inputmode: this.inputmode, autocorrect: this.autocorrect, autocapitalize: this.autocapitalize, spellcheck: this.spellcheck, autofocus: this.autofocus, minlength: this.minlength, maxlength: this.maxlength, pattern: this.pattern, "aria-invalid": this.error ? 'true' : 'false', "aria-required": this.required ? 'true' : 'false', "aria-describedby": this.describedBy, "aria-errormessage": this.errorId, onInput: this.handleInput, onChange: this.handleChange, onFocus: this.handleFocus, onBlur: this.handleBlur })), hAsync("slot", { key: '5b77b87ba1da3b8e71c7f6825eecf2216a93e4f9', name: "after-input" })), hAsync("div", { key: 'cac334a1e88d4136e923ef1355196997bfe97099', id: this.helperId, role: "status" }, this.helperText || null), hAsync("div", { key: 'b3ea662fa0a57ed0d8c3f35e36aad6b2513af8ab', id: this.errorId, role: "alert" }, (this.showErrorMessage && this.errorMessage) || null)));
|
|
10177
6413
|
}
|
|
10178
6414
|
static get formAssociated() { return true; }
|
|
10179
6415
|
static get watchers() { return {
|
|
@@ -10228,7 +6464,7 @@ class LmvzInput extends ReactiveControllerHost {
|
|
|
10228
6464
|
}; }
|
|
10229
6465
|
}
|
|
10230
6466
|
|
|
10231
|
-
const lmvzMenuitemCss = () => `@layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.theme { @font-face { font-family: Router; src: local('Router-Book'), url('/assets/fonts/Router-Book.woff') format('woff'), local('Router'); font-weight: 400 normal; } @font-face { font-family: Router; src: local('Router-Medium'), url('/assets/fonts/Router-Medium.woff') format('woff'), local('Router'); font-weight: 500; } @font-face { font-family: Router; src: local('Router-Bold'), url('/assets/fonts/Router-Bold.woff') format('woff'), local('Router'); font-weight: 700 bold; } } .sc-lmvz-menuitem-h { display: inline-flex; flex-direction: row; align-items: center; justify-content: center; gap: var(--lmvz-component-input-md-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); border-radius: var(--lmvz-semantic-border-radius-lg, 14px); font: var(--lmvz-typography-body-md, 400 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.4 Router); padding: var(--lmvz-component-input-md-padding-y, clamp(0.75rem, 0.69rem + 0.26vw, 1rem)) var(--lmvz-component-input-md-padding-x, clamp(0.75rem, 0.69rem + 0.26vw, 1rem)); cursor: pointer; --lmvz-menuitem-color: var(--lmvz-semantic-color-int-on-tertiary, #545454); --lmvz-menuitem-background: var(--lmvz-semantic-color-int-tertiary, #ffffff); background: var(--lmvz-menuitem-background); color: var(--lmvz-menuitem-color); } .sc-lmvz-menuitem-h:hover { --lmvz-menuitem-background: var(--lmvz-semantic-color-int-tertiary-hover, #f0f0f0); } .sc-lmvz-menuitem-h:active { --lmvz-menuitem-background: var(--lmvz-semantic-color-int-tertiary-active, #e0e0e0); } .sc-lmvz-menuitem-h:focus-visible { z-index: 1; } [aria-expanded='true'].sc-lmvz-menuitem-h { --lmvz-menuitem-background: var(--lmvz-semantic-color-status-
|
|
6467
|
+
const lmvzMenuitemCss = () => `@layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.theme { @font-face { font-family: Router; src: local('Router-Book'), url('/assets/fonts/Router-Book.woff') format('woff'), local('Router'); font-weight: 400 normal; } @font-face { font-family: Router; src: local('Router-Medium'), url('/assets/fonts/Router-Medium.woff') format('woff'), local('Router'); font-weight: 500; } @font-face { font-family: Router; src: local('Router-Bold'), url('/assets/fonts/Router-Bold.woff') format('woff'), local('Router'); font-weight: 700 bold; } } .sc-lmvz-menuitem-h { display: inline-flex; flex-direction: row; align-items: center; justify-content: center; gap: var(--lmvz-component-input-md-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); border-radius: var(--lmvz-semantic-border-radius-lg, 14px); font: var(--lmvz-typography-body-md, 400 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.4 Router); padding: var(--lmvz-component-input-md-padding-y, clamp(0.75rem, 0.69rem + 0.26vw, 1rem)) var(--lmvz-component-input-md-padding-x, clamp(0.75rem, 0.69rem + 0.26vw, 1rem)); cursor: pointer; --lmvz-menuitem-color: var(--lmvz-semantic-color-int-on-tertiary, #545454); --lmvz-menuitem-background: var(--lmvz-semantic-color-int-tertiary, #ffffff); background: var(--lmvz-menuitem-background); color: var(--lmvz-menuitem-color); } .sc-lmvz-menuitem-h:hover { --lmvz-menuitem-background: var(--lmvz-semantic-color-int-tertiary-hover, #f0f0f0); } .sc-lmvz-menuitem-h:active { --lmvz-menuitem-background: var(--lmvz-semantic-color-int-tertiary-active, #e0e0e0); } .sc-lmvz-menuitem-h:focus-visible { z-index: 1; } [aria-expanded='true'].sc-lmvz-menuitem-h { --lmvz-menuitem-background: var(--lmvz-semantic-color-status-on-active, #0e7ab4); --lmvz-menuitem-color: var(--lmvz-semantic-color-status-on-active, #0e7ab4); }`;
|
|
10232
6468
|
|
|
10233
6469
|
class LmvzMenuItem extends ReactiveControllerHost {
|
|
10234
6470
|
get el() { return getElement(this); }
|
|
@@ -10251,7 +6487,7 @@ class LmvzMenuItem extends ReactiveControllerHost {
|
|
|
10251
6487
|
this.addController(new ElementActivationController(this));
|
|
10252
6488
|
}
|
|
10253
6489
|
render() {
|
|
10254
|
-
return (hAsync(Host, { key: '
|
|
6490
|
+
return (hAsync(Host, { key: '510ac59b18468ce9c65b866ae2767185f1b3da92' }, hAsync("slot", { key: '7e032e0dab83f9bfbaa96ad2b78d8a5a58f978ab', ref: (e) => (this.validationSlot = e) })));
|
|
10255
6491
|
}
|
|
10256
6492
|
static get style() { return lmvzMenuitemCss(); }
|
|
10257
6493
|
static get cmpMeta() { return {
|
|
@@ -10269,7 +6505,7 @@ class LmvzMenuItem extends ReactiveControllerHost {
|
|
|
10269
6505
|
|
|
10270
6506
|
const chevronDownSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTIwLjMzMzQgOC42NjY2M0wxMi4wMDAxIDE3TDMuNjY2NzUgOC42NjY2MyIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+Cjwvc3ZnPgo=';
|
|
10271
6507
|
|
|
10272
|
-
const lmvzSelectCss = () => `@layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.theme { @font-face { font-family: Router; src: local('Router-Book'), url('/assets/fonts/Router-Book.woff') format('woff'), local('Router'); font-weight: 400 normal; } @font-face { font-family: Router; src: local('Router-Medium'), url('/assets/fonts/Router-Medium.woff') format('woff'), local('Router'); font-weight: 500; } @font-face { font-family: Router; src: local('Router-Bold'), url('/assets/fonts/Router-Bold.woff') format('woff'), local('Router'); font-weight: 700 bold; } } .sc-lmvz-select-h { display: block; font-family: var(--lmvz-global-font-family-default, Router); --lmvz-internal-select-floating-label-top-offset: 0.375rem; padding-top: var(--lmvz-internal-select-floating-label-top-offset); --lmvz-select-radius: var(--lmvz-component-input-radius-default, 999px); --lmvz-select-bg: var(--lmvz-semantic-color-int-secondary, #f0f0f0); --lmvz-select-bg-hover: var(--lmvz-semantic-color-int-secondary-hover, #e0e0e0); --lmvz-select-text-color: var(--lmvz-semantic-color-int-on-secondary, #000000); --lmvz-select-label-color: var(--lmvz-semantic-color-on-surface-input-primary, #000000); --lmvz-select-padding-x: var(--lmvz-component-input-md-padding-x, clamp(0.75rem, 0.69rem + 0.26vw, 1rem)); --lmvz-select-gap: var(--lmvz-component-input-md-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); --lmvz-select-height: 40px; --lmvz-select-label-font-size: var(--lmvz-component-component-typography-body-sm-font-size, 0.75rem); --lmvz-select-label-top-offset: calc(var(--lmvz-internal-select-floating-label-top-offset) * -1); --lmvz-select-label-minimized-padding-x: 4px; --lmvz-select-disabled-opacity: var(--lmvz-component-input-disabled-opacity, 40%); --lmvz-select-helper-color: var(--lmvz-semantic-color-on-surface-input-secondary, #7a7a7a); --lmvz-select-focus-color: var(--lmvz-semantic-color-status-on-
|
|
6508
|
+
const lmvzSelectCss = () => `@layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.theme { @font-face { font-family: Router; src: local('Router-Book'), url('/assets/fonts/Router-Book.woff') format('woff'), local('Router'); font-weight: 400 normal; } @font-face { font-family: Router; src: local('Router-Medium'), url('/assets/fonts/Router-Medium.woff') format('woff'), local('Router'); font-weight: 500; } @font-face { font-family: Router; src: local('Router-Bold'), url('/assets/fonts/Router-Bold.woff') format('woff'), local('Router'); font-weight: 700 bold; } } .sc-lmvz-select-h { display: block; font-family: var(--lmvz-global-font-family-default, Router); --lmvz-internal-select-floating-label-top-offset: 0.375rem; padding-top: var(--lmvz-internal-select-floating-label-top-offset); --lmvz-select-radius: var(--lmvz-component-input-radius-default, 999px); --lmvz-select-bg: var(--lmvz-semantic-color-int-secondary, #f0f0f0); --lmvz-select-bg-hover: var(--lmvz-semantic-color-int-secondary-hover, #e0e0e0); --lmvz-select-text-color: var(--lmvz-semantic-color-int-on-secondary, #000000); --lmvz-select-label-color: var(--lmvz-semantic-color-on-surface-input-primary, #000000); --lmvz-select-padding-x: var(--lmvz-component-input-md-padding-x, clamp(0.75rem, 0.69rem + 0.26vw, 1rem)); --lmvz-select-gap: var(--lmvz-component-input-md-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); --lmvz-select-height: 40px; --lmvz-select-label-font-size: var(--lmvz-component-component-typography-body-sm-font-size, 0.75rem); --lmvz-select-label-top-offset: calc(var(--lmvz-internal-select-floating-label-top-offset) * -1); --lmvz-select-label-minimized-padding-x: 4px; --lmvz-select-disabled-opacity: var(--lmvz-component-input-disabled-opacity, 40%); --lmvz-select-helper-color: var(--lmvz-semantic-color-on-surface-input-secondary, #7a7a7a); --lmvz-select-focus-color: var(--lmvz-semantic-color-status-on-active, #0e7ab4); --lmvz-select-error-color: var(--lmvz-semantic-color-status-on-danger, #e52a31); } .select-wrapper.sc-lmvz-select { position: relative; height: var(--lmvz-select-height); } label.sc-lmvz-select { position: absolute; top: 50%; left: var(--lmvz-select-padding-x); font-size: var(--lmvz-select-label-font-size); color: var(--lmvz-select-label-color); line-height: normal; white-space: nowrap; pointer-events: none; z-index: 2; transform: translateY(-50%); transform-origin: left top; transition: top 0.2s ease-out, transform 0.2s ease-out, opacity 0.2s ease-out, padding 0.2s ease-out; } label.assistive-label.sc-lmvz-select { opacity: 0; padding: 0; } label.floating-label.sc-lmvz-select { top: var(--lmvz-select-label-top-offset); transform: translateY(0) scale(0.85); left: calc(var(--lmvz-select-padding-x) - 2px); background-color: var(--lmvz-select-bg); padding: 0 var(--lmvz-select-label-minimized-padding-x); opacity: 1; font-weight: 500; } label.sc-lmvz-select > span[aria-hidden='true'].sc-lmvz-select, div[aria-hidden='true'].sc-lmvz-select > span.sc-lmvz-select:first-child > span[aria-hidden='true'].sc-lmvz-select { color: var(--lmvz-select-error-color); margin-left: 2px; display: inline-block; line-height: 0; vertical-align: middle; } div[aria-hidden].sc-lmvz-select { display: flex; align-items: center; gap: var(--lmvz-select-gap); height: 100%; padding: 0 var(--lmvz-select-padding-x); border-radius: var(--lmvz-select-radius); background-color: var(--lmvz-select-bg); cursor: pointer; position: relative; z-index: 1; transition: background-color 0.15s ease; } .sc-lmvz-select-h:not([disabled]) .select-wrapper.sc-lmvz-select:hover div[aria-hidden].sc-lmvz-select { background-color: var(--lmvz-select-bg-hover); } .select-wrapper.sc-lmvz-select:focus-within div[aria-hidden].sc-lmvz-select { outline: 2px solid var(--lmvz-select-focus-color); outline-offset: 2px; } div[aria-hidden].sc-lmvz-select > span.sc-lmvz-select:first-child { flex: 1 0 0; font-size: var(--lmvz-component-component-typography-body-md-font-size, 0.875rem); font-weight: var(--lmvz-global-font-weight-500, 500); color: var(--lmvz-select-text-color); line-height: 1.4; letter-spacing: var(--lmvz-component-body-md-letter-spacing, 0); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } div[aria-hidden].sc-lmvz-select > span.sc-lmvz-select:last-child { flex-shrink: 0; display: flex; align-items: center; justify-content: center; } img.sc-lmvz-select { display: block; width: var(--lmvz-component-icon-size-xs, clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem)); height: var(--lmvz-component-icon-size-xs, clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem)); } select.sc-lmvz-select { appearance: none; position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 2; border: none; background: transparent; margin: 0; padding: 0; } [disabled].sc-lmvz-select-h .select-wrapper.sc-lmvz-select { opacity: var(--lmvz-select-disabled-opacity); pointer-events: none; cursor: not-allowed; } [role='status'].sc-lmvz-select { margin-top: 4px; padding-left: var(--lmvz-select-padding-x); font-size: var(--lmvz-select-label-font-size); color: var(--lmvz-select-helper-color); line-height: normal; }`;
|
|
10273
6509
|
|
|
10274
6510
|
let selectIdCounter = 0;
|
|
10275
6511
|
class LmvzSelect extends ReactiveControllerHost {
|
|
@@ -10321,7 +6557,7 @@ class LmvzSelect extends ReactiveControllerHost {
|
|
|
10321
6557
|
render() {
|
|
10322
6558
|
const hasValue = this.hasValue;
|
|
10323
6559
|
const shouldShowLabel = hasValue;
|
|
10324
|
-
return (hAsync(Host, { key: '
|
|
6560
|
+
return (hAsync(Host, { key: '7f4650d5971bb93dba48385df734e6b7a0b4f7eb' }, hAsync("div", { key: '79d6234cd15f64c8bff787d715107e7e86145333', class: "select-wrapper" }, hAsync("label", { key: '14d93469c6d309b68427ff7bfc2bd531c8f0ecf6', htmlFor: this.selectId, class: shouldShowLabel ? 'floating-label' : 'assistive-label' }, this.label, this.required && shouldShowLabel && hAsync("span", { key: 'c8be809e09d768d6f73ccccdfbf0bf495869ac72', "aria-hidden": "true" }, " *")), hAsync("div", { key: '1db5d44b44100342a4ca5feff648b61a0bdadb1a', "aria-hidden": "true" }, hAsync("span", { key: '3fdc95aab9997a10f4ba42dabc3758aea0797a22' }, hasValue ? this.selectedLabel : this.label, this.required && !hasValue && hAsync("span", { key: '11aef8194551059130b6be5351587219a1e80f00', "aria-hidden": "true" }, " *")), hAsync("span", { key: '8fc52ff3e46d7b52d8d5069a74ebf7bb0d981081' }, hAsync("img", { key: '129dd4038772eba9313e1e322866c70408f4e2ad', src: chevronDownSvg, alt: "" }))), hAsync("select", { key: '6eb6cf496e60b3c1bd9556e596cbef34d4da5a09', id: this.selectId, ref: (el) => (this.nativeSelectEl = el), name: this.name, disabled: this.disabled, required: this.required, "aria-label": this.label, onChange: this.handleChange }, !hasValue && hAsync("option", { key: '70d660e0bc7e4c127234ce77decf35d6fea7fe8d', value: "", disabled: true, selected: true, hidden: true }), hAsync("slot", { key: 'e6cbc238c9c0cf8e8c31d0347a1f621272a94ca6' }))), this.helperText && hAsync("div", { key: '432d405ee7338da46509ff207599b882a19ea44e', role: "status" }, this.helperText)));
|
|
10325
6561
|
}
|
|
10326
6562
|
static get watchers() { return {
|
|
10327
6563
|
"value": [{
|