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