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