@remit/web-client-dist 0.0.691 → 0.0.692
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/assets/{BriefPane-uBrSdO9E.js → BriefPane-B8ecM3zB.js} +1 -1
- package/assets/{CalendarEventEditor-CW-VkuRj.js → CalendarEventEditor-9IlkB0YL.js} +1 -1
- package/assets/{CalendarEventPopup-Dr1Zl88E.js → CalendarEventPopup-Dgio1io7.js} +1 -1
- package/assets/{CalendarLoadFailed-CqaZI6s0.js → CalendarLoadFailed-BrNZqBKA.js} +1 -1
- package/assets/{CalendarQuickCreate-BSauej6s.js → CalendarQuickCreate-By7rnSuh.js} +1 -1
- package/assets/{CalendarSession-UbavgUO4.js → CalendarSession-CjfkNnKN.js} +1 -1
- package/assets/{DesktopChrome-DSs02PMr.js → DesktopChrome-CjDc9EdH.js} +1 -1
- package/assets/{DropdownMenu-DlTVA419.js → DropdownMenu-D4QQzyrH.js} +1 -1
- package/assets/{EmptyState-3mzd9Rr2.js → EmptyState-DiS0VQW5.js} +1 -1
- package/assets/{ErrorState-Czrn8Njd.js → ErrorState-BmGgdm41.js} +1 -1
- package/assets/{FlaggedPane-Duxks4wd.js → FlaggedPane-kBIob-rC.js} +1 -1
- package/assets/{FullCompose-C6ydcOqj.js → FullCompose-ZjHfjPwG.js} +1 -1
- package/assets/{LabelApplyTrigger-BeYgQjx0.js → LabelApplyTrigger-OJ81BaYH.js} +1 -1
- package/assets/{MailShell-qe4eiESL.js → MailShell-BO8c-sH6.js} +1 -1
- package/assets/{MailViewChrome-DmD7yKe9.js → MailViewChrome-DfgW3Ikc.js} +1 -1
- package/assets/{MailboxPane-Cd7n8_0e.js → MailboxPane-BRUYtKC7.js} +1 -1
- package/assets/{MessageBody-Dx9mvb7l.js → MessageBody-BIp2OZY6.js} +1 -1
- package/assets/{MessageToolbar-D_XE8m4l.js → MessageToolbar-BzxIP4DM.js} +1 -1
- package/assets/{NavMenuButton-B9iy2p3f.js → NavMenuButton-CkmJu7iR.js} +1 -1
- package/assets/{OnboardingWizard-Cb8hwkpv.js → OnboardingWizard-reo_AB5t.js} +1 -1
- package/assets/{OutboxPane-CByBDVdV.js → OutboxPane-qaAt9-sk.js} +1 -1
- package/assets/{ReportLink-CVPckN6-.js → ReportLink-DVR5iYy8.js} +1 -1
- package/assets/_calendarObjectId-DNhcPvtT.js +1 -0
- package/assets/_mailboxId-ThNYujv3.js +1 -0
- package/assets/_messageId-CKJI1yyc.js +1 -0
- package/assets/_messageId-ChPDqFRo.js +1 -0
- package/assets/_messageId-zm_VBLaY.js +1 -0
- package/assets/_outboxMessageId-DcDyjoYW.js +1 -0
- package/assets/_recurrenceId-C0Y19B2U.js +1 -0
- package/assets/{_slotId-BLO1Rmfd.js → _slotId-BwEkuNG8.js} +1 -1
- package/assets/_threadId-CmA2aUrS.js +1 -0
- package/assets/_threadId-Cqj7hjyS.js +1 -0
- package/assets/_threadId-DI4EN6E1.js +1 -0
- package/assets/{_view._date-CZiRXVFR.js → _view._date-XDQ3AudE.js} +1 -1
- package/assets/{account-service-status-DLPjTYw9.js → account-service-status-DJyM-qfq.js} +1 -1
- package/assets/{accounts-Dl4YCzpm.js → accounts-Dei0QQHb.js} +1 -1
- package/assets/{advanced-CgXbUOtb.js → advanced-CmaLt1-e.js} +1 -1
- package/assets/{agenda-time-KJVZW5dD.js → agenda-time-9aN7iZnW.js} +1 -1
- package/assets/{app-chrome-1USNGfE3.js → app-chrome-DEclDxYQ.js} +1 -1
- package/assets/{appearance-C6nkCe1H.js → appearance-UFpWVtEM.js} +1 -1
- package/assets/{avatar-Bo0EUTkm.js → avatar-DZNFp-l_.js} +1 -1
- package/assets/{badge-C7MFP1pN.js → badge-DXTfgcBt.js} +1 -1
- package/assets/{bottom-sheet-C9u72VJg.js → bottom-sheet-CBxZPIwF.js} +1 -1
- package/assets/brief-MY0I_pcw.js +1 -0
- package/assets/{brief-CMzu4LMD.js → brief-fIZB7Fkj.js} +1 -1
- package/assets/{calendar-iY8BLzO2.js → calendar-BIfjhUb1.js} +1 -1
- package/assets/{calendar-B8lLrLAb.js → calendar-CmjULz3U.js} +1 -1
- package/assets/{calendar-event-popup-C92tAdsE.js → calendar-event-popup-By-Wnzww.js} +1 -1
- package/assets/{calendar-event-sidebar-CahohNiL.js → calendar-event-sidebar-DqoVNv2n.js} +1 -1
- package/assets/{calendar-failure-note-D746wu0r.js → calendar-failure-note-CmQObVh4.js} +1 -1
- package/assets/{calendar-guests-DnrOkTr7.js → calendar-guests-DivZiKa8.js} +1 -1
- package/assets/{calendar-suggestion-yCUw5guW.js → calendar-suggestion-CO8Q4tfB.js} +1 -1
- package/assets/{calendars-ZADJ8TZ1.js → calendars-Dpds3q2Z.js} +1 -1
- package/assets/{card-5b65wlka.js → card-BkVHxya_.js} +1 -1
- package/assets/{checkbox-CvgfSohd.js → checkbox-Cxv99wmn.js} +1 -1
- package/assets/{chevron-down-CR89KUgK.js → chevron-down-CuQovlNy.js} +1 -1
- package/assets/{chevron-left-DSaOqH7y.js → chevron-left-CO-V7AVZ.js} +1 -1
- package/assets/{circle-check-9HYVTIrG.js → circle-check-H4iBGaFc.js} +1 -1
- package/assets/{circle-check-big-p6il4Jr3.js → circle-check-big-Q5xMZBl1.js} +1 -1
- package/assets/{circle-question-mark-BVVFmkJG.js → circle-question-mark-Dt4vUSbc.js} +1 -1
- package/assets/{classification-BoqrRObl.js → classification-0ZO1lOyG.js} +1 -1
- package/assets/{clock-D6gctGNH.js → clock-Ctw4TG15.js} +1 -1
- package/assets/compose._-_outboxMessageId_-B1VRxkLN.js +1 -0
- package/assets/compose._-_outboxMessageId_-C46VmFN6.js +1 -0
- package/assets/compose._-_outboxMessageId_-CNjOOJSh.js +1 -0
- package/assets/compose._-_outboxMessageId_-P_jyR3kH.js +1 -0
- package/assets/{config-import-BtJdN8VN.js → config-import-_7OioB2-.js} +1 -1
- package/assets/{confirm-dialog-DYNhLVrG.js → confirm-dialog-C8W1RcOV.js} +1 -1
- package/assets/{copy-BwtY4IWi.js → copy-Eu3Pxnsn.js} +1 -1
- package/assets/{credential-steps-Czm9bF6Y.js → credential-steps-D8_QxBU3.js} +1 -1
- package/assets/{download-V38kBiT1.js → download-B9mjNNRB.js} +1 -1
- package/assets/{draft-C849UdJB.js → draft-OCADnKfj.js} +1 -1
- package/assets/edit-AzkegsLe.js +1 -0
- package/assets/edit-qD-xofN1.js +1 -0
- package/assets/{external-link-BVJU7bpX.js → external-link-Byo-O3sb.js} +1 -1
- package/assets/{file-braces-CEQVt7jm.js → file-braces-CskVbU-i.js} +1 -1
- package/assets/{filters-D9G5dAF4.js → filters-DEBkAOGr.js} +1 -1
- package/assets/{flagged-CwOw5Xxs.js → flagged-A9fk8Fz2.js} +1 -1
- package/assets/flagged-D6O3EhIo.js +1 -0
- package/assets/{folder-input-Bgx-bBiO.js → folder-input-hWCgPqfm.js} +1 -1
- package/assets/{folders-Bn_4Y9H0.js → folders-Dfg9m7Cm.js} +1 -1
- package/assets/{help-copy-Bo651f-_.js → help-copy-CnlNZ8sK.js} +1 -1
- package/assets/{import-BfiMMK8M.js → import-BIxL3HZr.js} +1 -1
- package/assets/index-BA_isERD.js +1 -0
- package/assets/index-BI3VHL-i.js +1 -0
- package/assets/index-C-PJeYPQ.js +1 -0
- package/assets/index-CKJI1yyc.js +1 -0
- package/assets/index-COXNp0IG.js +1 -0
- package/assets/index-CfV5o-lD.js +1 -0
- package/assets/index-ChPDqFRo.js +1 -0
- package/assets/index-CkmUVU7Z.js +1 -0
- package/assets/{index-BnBpXn45.js → index-CmOAOx38.js} +3 -3
- package/assets/{index-B7CBca9v.js → index-CpNGDsVT.js} +4 -4
- package/assets/index-CrZmkeYk.js +1 -0
- package/assets/index-zm_VBLaY.js +1 -0
- package/assets/{kbd-CE7JGsTx.js → kbd-BMGsOR5H.js} +1 -1
- package/assets/{label-chip-CbKg_yMt.js → label-chip-OfJL52HU.js} +1 -1
- package/assets/{labels-DWadctIQ.js → labels-jKncGvQ3.js} +1 -1
- package/assets/{mail-DtD-4wOO.js → mail-Bf1kTy2y.js} +1 -1
- package/assets/{mail-BG3D2i2e.js → mail-qvbIZwSA.js} +1 -1
- package/assets/{menu-B8nM2lya.js → menu-g1nN4c6m.js} +1 -1
- package/assets/{nav-link-CjSE3MDU.js → nav-link-Bdv8kjEd.js} +1 -1
- package/assets/new-Dcxxskrf.js +1 -0
- package/assets/onboarding-cRvBetgB.js +1 -0
- package/assets/{onboarding-completion-EUidFdVK.js → onboarding-completion-CjqVIsEV.js} +1 -1
- package/assets/outbox-CTC-6RuN.js +1 -0
- package/assets/{pencil-rhg9PvnD.js → pencil-C3mJE9QO.js} +1 -1
- package/assets/{people-DWWALdDd.js → people-ClLsRDo6.js} +1 -1
- package/assets/{plus-B2EF0VhA.js → plus-B9Kjb5MA.js} +1 -1
- package/assets/{popover-menu-nz-n7B2h.js → popover-menu-kMqLztgE.js} +1 -1
- package/assets/{refresh-cw-COcXRex1.js → refresh-cw-DdZ8vtf2.js} +1 -1
- package/assets/{reply-CzX8Q1T1.js → reply-BBXEHuds.js} +1 -1
- package/assets/{rich-text-BIDloC3-.js → rich-text-DTsRvBWK.js} +1 -1
- package/assets/{rich-text-spellcheck-worker-provider-BahuahVp.js → rich-text-spellcheck-worker-provider-Bf2g3xpp.js} +1 -1
- package/assets/{rotate-ccw-D5rIVkpa.js → rotate-ccw-DU-xqseJ.js} +1 -1
- package/assets/{roving-focus-DWCPniMZ.js → roving-focus-h-W142Au.js} +1 -1
- package/assets/{row-actions-CLp_pk6R.js → row-actions-CJJYnXCz.js} +1 -1
- package/assets/{search-mirror-CM2HNuGA.js → search-mirror-CqXcmXWg.js} +1 -1
- package/assets/{search-scope-fyP_uHeh.js → search-scope-BCz9qlCH.js} +1 -1
- package/assets/{search-token-index-YOjFNFJN.js → search-token-index-e0cXuR4s.js} +1 -1
- package/assets/{sections-DsqY4M13.js → sections-40tp2E7G.js} +1 -1
- package/assets/{segmented-control-IDK8fpO7.js → segmented-control-CMCgmRqX.js} +1 -1
- package/assets/{select-DWBegMNA.js → select-CpLCf4_c.js} +1 -1
- package/assets/{senders-ap9QQK-k.js → senders-DjPDuDhf.js} +1 -1
- package/assets/settings-CWQQ_e-3.js +1 -0
- package/assets/{settings-screen-BN-3qNrj.js → settings-screen-Bx-jomcC.js} +1 -1
- package/assets/{shield-check-CW6Yah30.js → shield-check-BbVUhw_R.js} +1 -1
- package/assets/{suggest-list-DMRnmTaR.js → suggest-list-gj7TdgNf.js} +1 -1
- package/assets/{suggested-vips-Gtwi6sFb.js → suggested-vips-D9pkriav.js} +1 -1
- package/assets/{suggestion._suggestionId-BHxPFUy0.js → suggestion._suggestionId-BsoCLJDm.js} +1 -1
- package/assets/{switch-B87JY9ce.js → switch-D9ilXr2Z.js} +1 -1
- package/assets/{task._calendarTaskId-r7Jl9ABh.js → task._calendarTaskId-c5dsQ5Rn.js} +1 -1
- package/assets/{undo-2-D-cmVG46.js → undo-2-B0kA9_bY.js} +1 -1
- package/assets/{useCalendarData-Djtg1pj2.js → useCalendarData-QcaY0Cgc.js} +1 -1
- package/assets/{useCalendarScheduling-D222yR_U.js → useCalendarScheduling-BXMaoFja.js} +1 -1
- package/assets/{useCalendarSuggestions-COzKAJgT.js → useCalendarSuggestions-iprVdeF2.js} +1 -1
- package/assets/{useCalendarTasks-D5yN61q_.js → useCalendarTasks-D9R56VL3.js} +1 -1
- package/assets/{useDebouncedValue-CahHw3v4.js → useDebouncedValue-M5m0kaQD.js} +1 -1
- package/assets/{useFilters-CmYwNOKM.js → useFilters-BybioZf1.js} +1 -1
- package/assets/{useLabels-BxK35B_o.js → useLabels-iMMBj-Ba.js} +1 -1
- package/assets/{useLayoutTier-xkhKNk1V.js → useLayoutTier-BpSsrmgl.js} +1 -1
- package/assets/{useMediaQuery-DOpCuIgp.js → useMediaQuery-uf6mjwPE.js} +1 -1
- package/assets/{useMessageBodyContent-DzlZ514L.js → useMessageBodyContent-CsZ9VCHu.js} +1 -1
- package/assets/{useQueries-BomGTQs-.js → useQueries-DeYJYa06.js} +1 -1
- package/assets/{useRefreshControl-BAZSbaBz.js → useRefreshControl-ByEWNZY9.js} +1 -1
- package/assets/{useResultFolderIndex-D9sJhyey.js → useResultFolderIndex-BksYikib.js} +1 -1
- package/assets/{useSignature-Boz2_w0h.js → useSignature-klArqmQ3.js} +1 -1
- package/assets/{warnings-BEW4lkgR.js → warnings-B1lLZh5p.js} +1 -1
- package/index.html +1 -1
- package/package.json +1 -1
- package/assets/_calendarObjectId-Dus6Z_aO.js +0 -1
- package/assets/_mailboxId-DA2rNZ6D.js +0 -1
- package/assets/_messageId-CBEFnj_-.js +0 -1
- package/assets/_messageId-CoU9lExJ.js +0 -1
- package/assets/_messageId-UN1wPrb5.js +0 -1
- package/assets/_outboxMessageId-Crw8NNd4.js +0 -1
- package/assets/_recurrenceId-DN3W2Byk.js +0 -1
- package/assets/_threadId-CGEJtUok.js +0 -1
- package/assets/_threadId-CrzKmCrt.js +0 -1
- package/assets/_threadId-D5at7_2j.js +0 -1
- package/assets/brief-DYSQ_oRb.js +0 -1
- package/assets/compose._-_outboxMessageId_-Cv8p7Ifc.js +0 -1
- package/assets/compose._-_outboxMessageId_-Dj0vXnYT.js +0 -1
- package/assets/compose._-_outboxMessageId_-Dsv-7Ma0.js +0 -1
- package/assets/compose._-_outboxMessageId_-_t-bMwDD.js +0 -1
- package/assets/edit-D9CdMYNH.js +0 -1
- package/assets/edit-Dhgn_BMZ.js +0 -1
- package/assets/flagged-aucGpj-Z.js +0 -1
- package/assets/index--IxFGldl.js +0 -1
- package/assets/index-BWpSJ9nc.js +0 -1
- package/assets/index-BkkdzHr6.js +0 -1
- package/assets/index-CBEFnj_-.js +0 -1
- package/assets/index-CoU9lExJ.js +0 -1
- package/assets/index-CqG3g67K.js +0 -1
- package/assets/index-DL3ZaCDr.js +0 -1
- package/assets/index-DlNRygfs.js +0 -1
- package/assets/index-Dw2xSkAT.js +0 -1
- package/assets/index-UN1wPrb5.js +0 -1
- package/assets/new-C7PkD0CK.js +0 -1
- package/assets/onboarding-BSC6mmKf.js +0 -1
- package/assets/outbox-DQD-mHZK.js +0 -1
- package/assets/settings-D2KYecr5.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/calendar-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/calendar-BIfjhUb1.js","assets/DesktopChrome-CjDc9EdH.js","assets/useLayoutTier-BpSsrmgl.js","assets/useMediaQuery-uf6mjwPE.js","assets/nav-link-Bdv8kjEd.js","assets/reply-BBXEHuds.js","assets/sections-40tp2E7G.js","assets/avatar-DZNFp-l_.js","assets/popover-menu-kMqLztgE.js","assets/roving-focus-h-W142Au.js","assets/mail-qvbIZwSA.js","assets/app-chrome-DEclDxYQ.js","assets/calendar-CmjULz3U.js","assets/ErrorState-BmGgdm41.js","assets/import-BIxL3HZr.js","assets/credential-steps-D8_QxBU3.js","assets/select-CpLCf4_c.js","assets/chevron-down-CuQovlNy.js","assets/badge-DXTfgcBt.js","assets/card-BkVHxya_.js","assets/config-import-_7OioB2-.js","assets/file-braces-CskVbU-i.js","assets/onboarding-completion-CjqVIsEV.js","assets/mail-Bf1kTy2y.js","assets/useMessageBodyContent-CsZ9VCHu.js","assets/pencil-C3mJE9QO.js","assets/MailShell-BO8c-sH6.js","assets/FullCompose-ZjHfjPwG.js","assets/index-CpNGDsVT.js","assets/useSignature-klArqmQ3.js","assets/account-form-helpers-DhckT_PN.js","assets/useDebouncedValue-M5m0kaQD.js","assets/suggest-list-gj7TdgNf.js","assets/confirm-dialog-C8W1RcOV.js","assets/search-scope-BCz9qlCH.js","assets/useRefreshControl-ByEWNZY9.js","assets/circle-check-big-Q5xMZBl1.js","assets/refresh-cw-DdZ8vtf2.js","assets/useQueries-DeYJYa06.js","assets/search-token-index-e0cXuR4s.js","assets/menu-g1nN4c6m.js","assets/useResultFolderIndex-BksYikib.js","assets/folder-failure-CqkVSsrb.js","assets/outbox-status-BlKn6P0x.js","assets/account-service-status-DJyM-qfq.js","assets/kbd-BMGsOR5H.js","assets/onboarding-cRvBetgB.js","assets/OnboardingWizard-reo_AB5t.js","assets/checkbox-Cxv99wmn.js","assets/_mailboxId-ThNYujv3.js","assets/MailboxPane-BRUYtKC7.js","assets/MailViewChrome-DfgW3Ikc.js","assets/MessageToolbar-BzxIP4DM.js","assets/MessageBody-BIp2OZY6.js","assets/undo-2-B0kA9_bY.js","assets/DropdownMenu-D4QQzyrH.js","assets/download-B9mjNNRB.js","assets/EmptyState-DiS0VQW5.js","assets/calendar-suggestion-CO8Q4tfB.js","assets/useCalendarSuggestions-iprVdeF2.js","assets/agenda-time-9aN7iZnW.js","assets/plus-B9Kjb5MA.js","assets/calendar-format-BwCpz-JZ.js","assets/calendar-failure-note-CmQObVh4.js","assets/clock-Ctw4TG15.js","assets/segmented-control-CMCgmRqX.js","assets/shield-check-BbVUhw_R.js","assets/useFilters-BybioZf1.js","assets/folder-input-hWCgPqfm.js","assets/label-chip-OfJL52HU.js","assets/LabelApplyTrigger-OJ81BaYH.js","assets/useLabels-iMMBj-Ba.js","assets/NavMenuButton-CkmJu7iR.js","assets/bottom-sheet-CBxZPIwF.js","assets/circle-question-mark-Dt4vUSbc.js","assets/circle-check-H4iBGaFc.js","assets/search-mirror-CqXcmXWg.js","assets/brief-fIZB7Fkj.js","assets/brief-MY0I_pcw.js","assets/BriefPane-B8ecM3zB.js","assets/wizard-selection-zWa1qc6-.js","assets/flagged-A9fk8Fz2.js","assets/flagged-D6O3EhIo.js","assets/FlaggedPane-kBIob-rC.js","assets/outbox-CTC-6RuN.js","assets/OutboxPane-qaAt9-sk.js","assets/row-actions-CJJYnXCz.js","assets/rotate-ccw-DU-xqseJ.js","assets/_slotId-BwEkuNG8.js","assets/settings-screen-Bx-jomcC.js","assets/chevron-left-CO-V7AVZ.js","assets/accounts-Dei0QQHb.js","assets/switch-D9ilXr2Z.js","assets/help-copy-CnlNZ8sK.js","assets/advanced-CmaLt1-e.js","assets/external-link-Byo-O3sb.js","assets/appearance-UFpWVtEM.js","assets/calendars-Dpds3q2Z.js","assets/useCalendarScheduling-BXMaoFja.js","assets/calendar-guests-DivZiKa8.js","assets/calendar-event-popup-By-Wnzww.js","assets/copy-Eu3Pxnsn.js","assets/classification-0ZO1lOyG.js","assets/ReportLink-DVR5iYy8.js","assets/filters-DEBkAOGr.js","assets/folders-Dfg9m7Cm.js","assets/labels-jKncGvQ3.js","assets/people-ClLsRDo6.js","assets/senders-DjPDuDhf.js","assets/warnings-B1lLZh5p.js","assets/_view._date-XDQ3AudE.js","assets/useCalendarTasks-D9R56VL3.js","assets/useCalendarData-QcaY0Cgc.js","assets/CalendarLoadFailed-BrNZqBKA.js","assets/CalendarQuickCreate-By7rnSuh.js","assets/draft-OCADnKfj.js","assets/CalendarSession-CjfkNnKN.js","assets/_view-CtgngRpB.css","assets/index-BI3VHL-i.js","assets/index-CfV5o-lD.js","assets/index-C-PJeYPQ.js","assets/index-CrZmkeYk.js","assets/new-Dcxxskrf.js","assets/CalendarEventEditor-9IlkB0YL.js","assets/calendar-event-sidebar-DqoVNv2n.js","assets/index-CKJI1yyc.js","assets/_messageId-CKJI1yyc.js","assets/compose._-_outboxMessageId_-CNjOOJSh.js","assets/index-zm_VBLaY.js","assets/_messageId-zm_VBLaY.js","assets/compose._-_outboxMessageId_-B1VRxkLN.js","assets/index-ChPDqFRo.js","assets/_messageId-ChPDqFRo.js","assets/compose._-_outboxMessageId_-C46VmFN6.js","assets/compose._-_outboxMessageId_-P_jyR3kH.js","assets/_outboxMessageId-DcDyjoYW.js","assets/index-CkmUVU7Z.js","assets/CalendarEventPopup-Dgio1io7.js","assets/edit-AzkegsLe.js","assets/suggestion._suggestionId-BsoCLJDm.js","assets/task._calendarTaskId-c5dsQ5Rn.js","assets/index-COXNp0IG.js","assets/edit-qD-xofN1.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
function r8(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in e)){const s=Object.getOwnPropertyDescriptor(r,o);s&&Object.defineProperty(e,o,s.get?s:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(o){if(o.ep)return;o.ep=!0;const s=n(o);fetch(o.href,s)}})();var $p=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ic(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var x1={exports:{}},bd={};var PP;function dG(){if(PP)return bd;PP=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,o,s){var a=null;if(s!==void 0&&(a=""+s),o.key!==void 0&&(a=""+o.key),"key"in o){s={};for(var u in o)u!=="key"&&(s[u]=o[u])}else s=o;return o=s.ref,{$$typeof:e,type:r,key:a,ref:o!==void 0?o:null,props:s}}return bd.Fragment=t,bd.jsx=n,bd.jsxs=n,bd}var NP;function fG(){return NP||(NP=1,x1.exports=dG()),x1.exports}var O=fG();const hG="Logging",pG="x-amz-user-agent",gG="NoHubcallbackProvidedException";var Ar;(function(e){e.DEBUG="DEBUG",e.ERROR="ERROR",e.INFO="INFO",e.WARN="WARN",e.VERBOSE="VERBOSE",e.NONE="NONE"})(Ar||(Ar={}));const kP={VERBOSE:1,DEBUG:2,INFO:3,WARN:4,ERROR:5,NONE:6};class Ln{constructor(t,n=Ar.WARN){this.name=t,this.level=n,this._pluggables=[]}_padding(t){return t<10?"0"+t:""+t}_ts(){const t=new Date;return[this._padding(t.getMinutes()),this._padding(t.getSeconds())].join(":")+"."+t.getMilliseconds()}configure(t){return t?(this._config=t,this._config):this._config}_log(t,...n){let r=this.level;Ln.LOG_LEVEL&&(r=Ln.LOG_LEVEL),typeof window<"u"&&window.LOG_LEVEL&&(r=window.LOG_LEVEL);const o=kP[r];if(!(kP[t]>=o))return;let a=console.log.bind(console);t===Ar.ERROR&&console.error&&(a=console.error.bind(console)),t===Ar.WARN&&console.warn&&(a=console.warn.bind(console)),Ln.BIND_ALL_LOG_LEVELS&&(t===Ar.INFO&&console.info&&(a=console.info.bind(console)),t===Ar.DEBUG&&console.debug&&(a=console.debug.bind(console)));const u=`[${t}] ${this._ts()} ${this.name}`;let c="";if(n.length===1&&typeof n[0]=="string")c=`${u} - ${n[0]}`,a(c);else if(n.length===1)c=`${u} ${n[0]}`,a(u,n[0]);else if(typeof n[0]=="string"){let f=n.slice(1);f.length===1&&(f=f[0]),c=`${u} - ${n[0]} ${f}`,a(`${u} - ${n[0]}`,f)}else c=`${u} ${n}`,a(u,n);for(const f of this._pluggables){const h={message:c,timestamp:Date.now()};f.pushLogs([h])}}log(...t){this._log(Ar.INFO,...t)}info(...t){this._log(Ar.INFO,...t)}warn(...t){this._log(Ar.WARN,...t)}error(...t){this._log(Ar.ERROR,...t)}debug(...t){this._log(Ar.DEBUG,...t)}verbose(...t){this._log(Ar.VERBOSE,...t)}addPluggable(t){t&&t.getCategoryName()===hG&&(this._pluggables.push(t),t.configure(this._config))}listPluggables(){return this._pluggables}}Ln.LOG_LEVEL=null;Ln.BIND_ALL_LOG_LEVELS=!1;class cr extends Error{constructor({message:t,name:n,recoverySuggestion:r,underlyingError:o,metadata:s}){if(super(t),this.name=n,this.underlyingError=o,this.recoverySuggestion=r,s){const{extendedRequestId:a,httpStatusCode:u,requestId:c}=s;this.metadata={extendedRequestId:a,httpStatusCode:u,requestId:c}}this.constructor=cr,Object.setPrototypeOf(this,cr.prototype)}}var Fi;(function(e){e.NoEndpointId="NoEndpointId",e.PlatformNotSupported="PlatformNotSupported",e.Unknown="Unknown",e.NetworkError="NetworkError"})(Fi||(Fi={}));const Nv=(e,t=cr)=>(n,r,o)=>{const{message:s,recoverySuggestion:a}=e[r];if(!n)throw new t({name:r,message:o?`${s} ${o}`:s,recoverySuggestion:a})},Fo=typeof Symbol<"u"?Symbol("amplify_default"):"@@amplify_default",Sd=new Ln("Hub");class o8{constructor(t){this.listeners=new Map,this.protectedChannels=["core","auth","api","analytics","interactions","pubsub","storage","ui","xr"],this.name=t}_remove(t,n){const r=this.listeners.get(t);if(!r){Sd.warn(`No listeners for ${t}`);return}this.listeners.set(t,[...r.filter(({callback:o})=>o!==n)])}dispatch(t,n,r,o){typeof t=="string"&&this.protectedChannels.indexOf(t)>-1&&(o===Fo||Sd.warn(`WARNING: ${t} is protected and dispatching on it can have unintended consequences`));const s={channel:t,payload:{...n},source:r,patternInfo:[]};try{this._toListeners(s)}catch(a){Sd.error(a)}}listen(t,n,r="noname"){let o;if(typeof n!="function")throw new cr({name:gG,message:"No callback supplied to Hub"});o=n;let s=this.listeners.get(t);return s||(s=[],this.listeners.set(t,s)),s.push({name:r,callback:o}),()=>{this._remove(t,o)}}_toListeners(t){const{channel:n,payload:r}=t,o=this.listeners.get(n);o&&o.forEach(s=>{Sd.debug(`Dispatching to ${n} with `,r);try{s.callback(t)}catch(a){Sd.error(a)}})}}const zo=new o8("__default__"),_m=new o8("internal-hub"),NA=()=>{if(typeof window=="object"&&typeof window.crypto=="object")return window.crypto;if(typeof crypto=="object")return crypto;throw new cr({name:"MissingPolyfill",message:"Cannot resolve the `crypto` function from the environment."})},mG=()=>{if(typeof window<"u"&&typeof window.btoa=="function")return window.btoa;if(typeof btoa=="function")return btoa;throw new cr({name:"Base64EncoderError",message:"Cannot resolve the `btoa` function from the environment."})},vG=()=>{if(typeof window<"u"&&typeof window.atob=="function")return window.atob;if(typeof atob=="function")return atob;throw new cr({name:"Base64EncoderError",message:"Cannot resolve the `atob` function from the environment."})},kA={convert(e,t){let n=e;return t?.urlSafe&&(n=n.replace(/-/g,"+").replace(/_/g,"/")),vG()(n)}};var Lo;(function(e){e.AuthTokenConfigException="AuthTokenConfigException",e.AuthUserPoolAndIdentityPoolException="AuthUserPoolAndIdentityPoolException",e.AuthUserPoolException="AuthUserPoolException",e.InvalidIdentityPoolIdException="InvalidIdentityPoolIdException",e.OAuthNotConfigureException="OAuthNotConfigureException"})(Lo||(Lo={}));const yG={[Lo.AuthTokenConfigException]:{message:"Auth Token Provider not configured.",recoverySuggestion:"Make sure to call Amplify.configure in your app."},[Lo.AuthUserPoolAndIdentityPoolException]:{message:"Auth UserPool or IdentityPool not configured.",recoverySuggestion:"Make sure to call Amplify.configure in your app with UserPoolId and IdentityPoolId."},[Lo.AuthUserPoolException]:{message:"Auth UserPool not configured.",recoverySuggestion:"Make sure to call Amplify.configure in your app with userPoolId and userPoolClientId."},[Lo.InvalidIdentityPoolIdException]:{message:"Invalid identity pool id provided.",recoverySuggestion:"Make sure a valid identityPoolId is given in the config."},[Lo.OAuthNotConfigureException]:{message:"oauth param not configured.",recoverySuggestion:"Make sure to call Amplify.configure with oauth parameter in your app."}},DA=Nv(yG);function We(e){let t=!0;e?t=!!e.userPoolId&&!!e.userPoolClientId:t=!1,DA(t,Lo.AuthUserPoolException)}function kv(e){const t=!!e?.loginWith?.oauth?.domain&&!!e?.loginWith?.oauth?.redirectSignOut&&!!e?.loginWith?.oauth?.redirectSignIn&&!!e?.loginWith?.oauth?.responseType;DA(t,Lo.OAuthNotConfigureException)}function Zg(e){const t=!!e?.identityPoolId;DA(t,Lo.InvalidIdentityPoolIdException)}function Ms(e){const t=e.split(".");if(t.length!==3)throw new Error("Invalid token");try{const r=t[1].replace(/-/g,"+").replace(/_/g,"/"),o=decodeURIComponent(kA.convert(r).split("").map(a=>`%${`00${a.charCodeAt(0).toString(16)}`.slice(-2)}`).join("")),s=JSON.parse(o);return{toString:()=>e,payload:s}}catch{throw new Error("Invalid token payload")}}const s8=e=>{const t=Reflect.ownKeys(e);for(const n of t){const r=e[n];(r&&typeof r=="object"||typeof r=="function")&&s8(r)}return Object.freeze(e)},bG=new Ln("parseAWSExports"),SG={API_KEY:"apiKey",AWS_IAM:"iam",AMAZON_COGNITO_USER_POOLS:"userPool",OPENID_CONNECT:"oidc",NONE:"none",AWS_LAMBDA:"lambda",LAMBDA:"lambda"},wG=(e={})=>{if(!Object.prototype.hasOwnProperty.call(e,"aws_project_region"))throw new cr({name:"InvalidParameterException",message:"Invalid config parameter.",recoverySuggestion:"Ensure passing the config object imported from `amplifyconfiguration.json`."});const{aws_appsync_apiKey:t,aws_appsync_authenticationType:n,aws_appsync_graphqlEndpoint:r,aws_appsync_region:o,aws_bots_config:s,aws_cognito_identity_pool_id:a,aws_cognito_sign_up_verification_method:u,aws_cognito_mfa_configuration:c,aws_cognito_mfa_types:f,aws_cognito_password_protection_settings:h,aws_cognito_verification_mechanisms:g,aws_cognito_signup_attributes:m,aws_cognito_social_providers:v,aws_cognito_username_attributes:w,aws_mandatory_sign_in:S,aws_mobile_analytics_app_id:C,aws_mobile_analytics_app_region:E,aws_user_files_s3_bucket:A,aws_user_files_s3_bucket_region:I,aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing:T,aws_user_pools_id:N,aws_user_pools_web_client_id:M,geo:R,oauth:k,predictions:L,aws_cloud_logic_custom:q,Notifications:$,modelIntrospection:D}=e,j={};C&&(j.Analytics={Pinpoint:{appId:C,region:E}});const{InAppMessaging:Z,Push:he}=$??{};if(Z?.AWSPinpoint||he?.AWSPinpoint){if(Z?.AWSPinpoint){const{appId:oe,region:fe}=Z.AWSPinpoint;j.Notifications={InAppMessaging:{Pinpoint:{appId:oe,region:fe}}}}if(he?.AWSPinpoint){const{appId:oe,region:fe}=he.AWSPinpoint;j.Notifications={...j.Notifications,PushNotification:{Pinpoint:{appId:oe,region:fe}}}}}if(Array.isArray(s)&&(j.Interactions={LexV1:Object.fromEntries(s.map(oe=>[oe.name,oe]))}),r){const oe=SG[n];oe||bG.debug(`Invalid authentication type ${n}. Falling back to IAM.`),j.API={GraphQL:{endpoint:r,apiKey:t,region:o,defaultAuthMode:oe??"iam"}},D&&(j.API.GraphQL.modelIntrospection=D)}const B=c?{status:c&&c.toLowerCase(),totpEnabled:f?.includes("TOTP")??!1,smsEnabled:f?.includes("SMS")??!1}:void 0,Q=h?{minLength:h.passwordPolicyMinLength,requireLowercase:h.passwordPolicyCharacters?.includes("REQUIRES_LOWERCASE")??!1,requireUppercase:h.passwordPolicyCharacters?.includes("REQUIRES_UPPERCASE")??!1,requireNumbers:h.passwordPolicyCharacters?.includes("REQUIRES_NUMBERS")??!1,requireSpecialCharacters:h.passwordPolicyCharacters?.includes("REQUIRES_SYMBOLS")??!1}:void 0,ue=Array.from(new Set([...g??[],...m??[]])).reduce((oe,fe)=>({...oe,[fe.toLowerCase()]:{required:!0}}),{}),we=w?.includes("EMAIL")??!1,U=w?.includes("PHONE_NUMBER")??!1;(a||N)&&(j.Auth={Cognito:{identityPoolId:a,allowGuestAccess:S!=="enable",signUpVerificationMethod:u,userAttributes:ue,userPoolClientId:M,userPoolId:N,mfa:B,passwordFormat:Q,loginWith:{username:!(we||U),email:we,phone:U}}});const X=k?Object.keys(k).length>0:!1,ie=v?v.length>0:!1;if(j.Auth&&X&&(j.Auth.Cognito.loginWith={...j.Auth.Cognito.loginWith,oauth:{...CG(k),...ie&&{providers:EG(v)}}}),A&&(j.Storage={S3:{bucket:A,region:I,dangerouslyConnectToHttpEndpointForTesting:T}}),R){const{amazon_location_service:oe}=R;j.Geo={LocationService:{maps:oe.maps,geofenceCollections:oe.geofenceCollections,searchIndices:oe.search_indices,region:oe.region}}}if(q&&(j.API={...j.API,REST:q.reduce((oe,fe)=>{const{name:Me,endpoint:xe,region:se,service:Se}=fe;return{...oe,[Me]:{endpoint:xe,...Se?{service:Se}:void 0,...se?{region:se}:void 0}}},{})}),L){const{VoiceId:oe}=L?.convert?.speechGenerator?.defaults??{};j.Predictions=oe?{...L,convert:{...L.convert,speechGenerator:{...L.convert.speechGenerator,defaults:{voiceId:oe}}}}:L}return j},DP=e=>e?.split(",")??[],CG=({domain:e,scope:t,redirectSignIn:n,redirectSignOut:r,responseType:o})=>({domain:e,scopes:t,redirectSignIn:DP(n),redirectSignOut:DP(r),responseType:o}),EG=e=>e.map(t=>{const n=t.toLowerCase();return n.charAt(0).toUpperCase()+n.slice(1)}),i8=Symbol("oauth-listener"),kn=[];for(let e=0;e<256;++e)kn.push((e+256).toString(16).slice(1));function _G(e,t=0){return(kn[e[t+0]]+kn[e[t+1]]+kn[e[t+2]]+kn[e[t+3]]+"-"+kn[e[t+4]]+kn[e[t+5]]+"-"+kn[e[t+6]]+kn[e[t+7]]+"-"+kn[e[t+8]]+kn[e[t+9]]+"-"+kn[e[t+10]]+kn[e[t+11]]+kn[e[t+12]]+kn[e[t+13]]+kn[e[t+14]]+kn[e[t+15]]).toLowerCase()}let A1;const xG=new Uint8Array(16);function AG(){if(!A1){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");A1=crypto.getRandomValues.bind(crypto)}return A1(xG)}const IG=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),LP={randomUUID:IG};function RG(e,t,n){e=e||{};const r=e.random??e.rng?.()??AG();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n=n||0,n<0||n+16>t.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let o=0;o<16;++o)t[n+o]=r[o];return t}return _G(r)}function Mu(e,t,n){return LP.randomUUID&&!t&&!e?LP.randomUUID():RG(e,t,n)}function TG(e){const{version:t}=e;return t?t.startsWith("1"):!1}function OG(e){if(!e)return;const{bucket_name:t,aws_region:n,buckets:r}=e;return{S3:{bucket:t,region:n,buckets:r&&jG(r)}}}function MG(e){if(!e)return;const{user_pool_id:t,user_pool_client_id:n,identity_pool_id:r,password_policy:o,mfa_configuration:s,mfa_methods:a,unauthenticated_identities_enabled:u,oauth:c,username_attributes:f,standard_required_attributes:h,groups:g,passwordless:m}=e,v={Cognito:{userPoolId:t,userPoolClientId:n,groups:g}};return r&&(v.Cognito={...v.Cognito,identityPoolId:r}),o&&(v.Cognito.passwordFormat={requireLowercase:o.require_lowercase,requireNumbers:o.require_numbers,requireUppercase:o.require_uppercase,requireSpecialCharacters:o.require_symbols,minLength:o.min_length??6}),s&&(v.Cognito.mfa={status:zG(s),smsEnabled:a?.includes("SMS"),totpEnabled:a?.includes("TOTP")}),u&&(v.Cognito.allowGuestAccess=u),c&&(v.Cognito.loginWith={oauth:{domain:c.domain,redirectSignIn:c.redirect_sign_in_uri,redirectSignOut:c.redirect_sign_out_uri,responseType:c.response_type==="token"?"token":"code",scopes:c.scopes,providers:FG(c.identity_providers)}}),f&&(v.Cognito.loginWith={...v.Cognito.loginWith,email:f.includes("email"),phone:f.includes("phone_number"),username:f.includes("username")}),h&&(v.Cognito.userAttributes=h.reduce((w,S)=>({...w,[S]:{required:!0}}),{})),m&&(v.Cognito.passwordless={emailOtpEnabled:m.email_otp_enabled,smsOtpEnabled:m.sms_otp_enabled,webAuthn:m.web_authn?{relyingPartyId:m.web_authn.relying_party_id,userVerification:m.web_authn.user_verification}:void 0,preferredChallenge:m.preferred_challenge}),v}function PG(e){if(!e?.amazon_pinpoint)return;const{amazon_pinpoint:t}=e;return{Pinpoint:{appId:t.app_id,region:t.aws_region}}}function NG(e){if(!e)return;const{aws_region:t,geofence_collections:n,maps:r,search_indices:o}=e;return{LocationService:{region:t,searchIndices:o,geofenceCollections:n,maps:r}}}function kG(e){if(!e)return;const{aws_region:t,default_authorization_type:n,url:r,api_key:o,model_introspection:s}=e;return{GraphQL:{endpoint:r,defaultAuthMode:a8(n),region:t,apiKey:o,modelIntrospection:s}}}function DG(e){if(!e?.events)return;const{url:t,aws_region:n,api_key:r,default_authorization_type:o}=e.events;return{Events:{endpoint:t,defaultAuthMode:a8(o),region:n,apiKey:r}}}function LG(e){if(!e)return;const{aws_region:t,channels:n,amazon_pinpoint_app_id:r}=e,o=n.includes("IN_APP_MESSAGING"),s=n.includes("APNS")||n.includes("FCM");if(!(o||s))return;const a={};return o&&(a.InAppMessaging={Pinpoint:{appId:r,region:t}}),s&&(a.PushNotification={Pinpoint:{appId:r,region:t}}),a}function UG(e){const t={};if(e.storage&&(t.Storage=OG(e.storage)),e.auth&&(t.Auth=MG(e.auth)),e.analytics&&(t.Analytics=PG(e.analytics)),e.geo&&(t.Geo=NG(e.geo)),e.data&&(t.API=kG(e.data)),e.custom){const n=DG(e.custom);n&&"Events"in n&&(t.API={...t.API,...n})}return e.notifications&&(t.Notifications=LG(e.notifications)),t}const $G={AMAZON_COGNITO_USER_POOLS:"userPool",API_KEY:"apiKey",AWS_IAM:"iam",AWS_LAMBDA:"lambda",OPENID_CONNECT:"oidc"};function a8(e){return $G[e]}const UP={GOOGLE:"Google",LOGIN_WITH_AMAZON:"Amazon",FACEBOOK:"Facebook",SIGN_IN_WITH_APPLE:"Apple"};function FG(e=[]){return e.reduce((t,n)=>(UP[n]!==void 0&&t.push(UP[n]),t),[])}function zG(e){return e==="OPTIONAL"?"optional":e==="REQUIRED"?"on":"off"}function jG(e){const t={};return e.forEach(({name:n,bucket_name:r,aws_region:o,paths:s})=>{if(n in t)throw new Error(`Duplicate friendly name found: ${n}. Name must be unique.`);const a=s?Object.entries(s).reduce((u,[c,f])=>(f!==void 0&&(u[c]=f),u),{}):void 0;t[n]={bucketName:r,region:o,paths:a}}),t}const l8=e=>Object.keys(e).some(t=>t.startsWith("aws_"))?wG(e):TG(e)?UG(e):e;var $P=function(){return $P=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},$P.apply(this,arguments)};function QUe(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function BG(e,t,n,r){function o(s){return s instanceof n?s:new n(function(a){a(s)})}return new(n||(n=Promise))(function(s,a){function u(h){try{f(r.next(h))}catch(g){a(g)}}function c(h){try{f(r.throw(h))}catch(g){a(g)}}function f(h){h.done?s(h.value):o(h.value).then(u,c)}f((r=r.apply(e,t||[])).next())})}function HG(e,t){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,o,s,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=u(0),a.throw=u(1),a.return=u(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(f){return function(h){return c([f,h])}}function c(f){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,f[0]&&(n=0)),n;)try{if(r=1,o&&(s=f[0]&2?o.return:f[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,f[1])).done)return s;switch(o=0,s&&(f=[f[0]&2,s.value]),f[0]){case 0:case 1:s=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,o=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!s||f[1]>s[0]&&f[1]<s[3])){n.label=f[1];break}if(f[0]===6&&n.label<s[1]){n.label=s[1],s=f;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(f);break}s[2]&&n.ops.pop(),n.trys.pop();continue}f=t.call(e,n)}catch(h){f=[6,h],o=0}finally{r=s=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function XUe(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r<o;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var Wr=64,qG=32,VG=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),WG=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],GG=Math.pow(2,53)-1,Yg=(function(){function e(){this.state=Int32Array.from(WG),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return e.prototype.update=function(t){if(this.finished)throw new Error("Attempted to update an already finished hash.");var n=0,r=t.byteLength;if(this.bytesHashed+=r,this.bytesHashed*8>GG)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;r>0;)this.buffer[this.bufferLength++]=t[n++],r--,this.bufferLength===Wr&&(this.hashBuffer(),this.bufferLength=0)},e.prototype.digest=function(){if(!this.finished){var t=this.bytesHashed*8,n=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),r=this.bufferLength;if(n.setUint8(this.bufferLength++,128),r%Wr>=Wr-8){for(var o=this.bufferLength;o<Wr;o++)n.setUint8(o,0);this.hashBuffer(),this.bufferLength=0}for(var o=this.bufferLength;o<Wr-8;o++)n.setUint8(o,0);n.setUint32(Wr-8,Math.floor(t/4294967296),!0),n.setUint32(Wr-4,t),this.hashBuffer(),this.finished=!0}for(var s=new Uint8Array(qG),o=0;o<8;o++)s[o*4]=this.state[o]>>>24&255,s[o*4+1]=this.state[o]>>>16&255,s[o*4+2]=this.state[o]>>>8&255,s[o*4+3]=this.state[o]>>>0&255;return s},e.prototype.hashBuffer=function(){for(var t=this,n=t.buffer,r=t.state,o=r[0],s=r[1],a=r[2],u=r[3],c=r[4],f=r[5],h=r[6],g=r[7],m=0;m<Wr;m++){if(m<16)this.temp[m]=(n[m*4]&255)<<24|(n[m*4+1]&255)<<16|(n[m*4+2]&255)<<8|n[m*4+3]&255;else{var v=this.temp[m-2],w=(v>>>17|v<<15)^(v>>>19|v<<13)^v>>>10;v=this.temp[m-15];var S=(v>>>7|v<<25)^(v>>>18|v<<14)^v>>>3;this.temp[m]=(w+this.temp[m-7]|0)+(S+this.temp[m-16]|0)}var C=(((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))+(c&f^~c&h)|0)+(g+(VG[m]+this.temp[m]|0)|0)|0,E=((o>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10))+(o&s^o&a^s&a)|0;g=h,h=f,f=c,c=u+C|0,u=a,a=s,s=o,o=C+E|0}r[0]+=o,r[1]+=s,r[2]+=a,r[3]+=u,r[4]+=c,r[5]+=f,r[6]+=h,r[7]+=g},e})();const KG=e=>new TextEncoder().encode(e);var ZG=typeof Buffer<"u"&&Buffer.from?function(e){return Buffer.from(e,"utf8")}:KG;function u8(e){return e instanceof Uint8Array?e:typeof e=="string"?ZG(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}function YG(e){return typeof e=="string"?e.length===0:e.byteLength===0}var qa=(function(){function e(t){this.secret=t,this.hash=new Yg,this.reset()}return e.prototype.update=function(t){if(!(YG(t)||this.error))try{this.hash.update(u8(t))}catch(n){this.error=n}},e.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},e.prototype.digest=function(){return BG(this,void 0,void 0,function(){return HG(this,function(t){return[2,this.digestSync()]})})},e.prototype.reset=function(){if(this.hash=new Yg,this.secret){this.outer=new Yg;var t=QG(this.secret),n=new Uint8Array(Wr);n.set(t);for(var r=0;r<Wr;r++)t[r]^=54,n[r]^=92;this.hash.update(t),this.outer.update(n);for(var r=0;r<t.byteLength;r++)t[r]=0}},e})();function QG(e){var t=u8(e);if(t.byteLength>Wr){var n=new Yg;n.update(t),t=n.digest()}var r=new Uint8Array(Wr);return r.set(t),r}for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();t.length===1&&(t=`0${t}`)}var un;(function(e){e.WebUnknown="0",e.React="1",e.NextJs="2",e.Angular="3",e.VueJs="4",e.Nuxt="5",e.Svelte="6",e.ServerSideUnknown="100",e.ReactSSR="101",e.NextJsSSR="102",e.AngularSSR="103",e.VueJsSSR="104",e.NuxtSSR="105",e.SvelteSSR="106",e.ReactNative="201",e.Expo="202"})(un||(un={}));var Jr;(function(e){e.AI="ai",e.API="api",e.Auth="auth",e.Analytics="analytics",e.DataStore="datastore",e.Geo="geo",e.InAppMessaging="inappmessaging",e.Interactions="interactions",e.Predictions="predictions",e.PubSub="pubsub",e.PushNotification="pushnotification",e.Storage="storage"})(Jr||(Jr={}));var ws;(function(e){e.CreateConversation="1",e.GetConversation="2",e.ListConversations="3",e.DeleteConversation="4",e.SendMessage="5",e.ListMessages="6",e.OnMessage="7",e.Generation="8",e.UpdateConversation="9"})(ws||(ws={}));var FP;(function(e){e.Record="1",e.IdentifyUser="2"})(FP||(FP={}));var zP;(function(e){e.GraphQl="1",e.Get="2",e.Post="3",e.Put="4",e.Patch="5",e.Del="6",e.Head="7"})(zP||(zP={}));var $e;(function(e){e.SignUp="1",e.ConfirmSignUp="2",e.ResendSignUpCode="3",e.SignIn="4",e.FetchMFAPreference="6",e.UpdateMFAPreference="7",e.SetUpTOTP="10",e.VerifyTOTPSetup="11",e.ConfirmSignIn="12",e.DeleteUserAttributes="15",e.DeleteUser="16",e.UpdateUserAttributes="17",e.FetchUserAttributes="18",e.ConfirmUserAttribute="22",e.SignOut="26",e.UpdatePassword="27",e.ResetPassword="28",e.ConfirmResetPassword="29",e.FederatedSignIn="30",e.RememberDevice="32",e.ForgetDevice="33",e.FetchDevices="34",e.SendUserAttributeVerificationCode="35",e.SignInWithRedirect="36",e.StartWebAuthnRegistration="37",e.CompleteWebAuthnRegistration="38",e.ListWebAuthnCredentials="39",e.DeleteWebAuthnCredential="40"})($e||($e={}));var jP;(function(e){e.Subscribe="1",e.GraphQl="2"})(jP||(jP={}));var nf;(function(e){e.SearchByText="0",e.SearchByCoordinates="1",e.SearchForSuggestions="2",e.SearchByPlaceId="3",e.SaveGeofences="4",e.GetGeofence="5",e.ListGeofences="6",e.DeleteGeofences="7"})(nf||(nf={}));var b_;(function(e){e.SyncMessages="1",e.IdentifyUser="2",e.NotifyMessageInteraction="3"})(b_||(b_={}));var BP;(function(e){e.None="0"})(BP||(BP={}));var HP;(function(e){e.Convert="1",e.Identify="2",e.Interpret="3"})(HP||(HP={}));var qP;(function(e){e.Subscribe="1"})(qP||(qP={}));var VP;(function(e){e.InitializePushNotifications="1",e.IdentifyUser="2"})(VP||(VP={}));var fo;(function(e){e.UploadData="1",e.DownloadData="2",e.List="3",e.Copy="4",e.Remove="5",e.GetProperties="6",e.GetUrl="7",e.GetDataAccess="8",e.ListCallerAccessGrants="9"})(fo||(fo={}));const XG="6.18.0",Dv=()=>typeof global<"u",ac=()=>typeof window<"u",c8=()=>typeof document<"u",LA=()=>typeof process<"u",yf=(e,t)=>!!Object.keys(e).find(n=>n.startsWith(t));var WP={};function JG(){const e=r=>r.startsWith("_react")||r.startsWith("__react"),t=r=>Object.keys(r).find(e),n=()=>Array.from(document.querySelectorAll("[id]"));return c8()&&n().some(t)}function eK(){return LA()&&typeof WP<"u"&&!!Object.keys(WP).find(e=>e.includes("react"))}function tK(){return ac()&&yf(window,"__VUE")}function nK(){return Dv()&&yf(global,"__VUE")}var GP={};function rK(){return ac()&&yf(window,"__SVELTE")}function oK(){return LA()&&typeof GP<"u"&&!!Object.keys(GP).find(e=>e.includes("svelte"))}function sK(){return ac()&&window.next&&typeof window.next=="object"}function iK(){return Dv()&&(yf(global,"__next")||yf(global,"__NEXT"))}function aK(){return ac()&&(window.__NUXT__!==void 0||window.$nuxt!==void 0)}function lK(){return Dv()&&typeof global.__NUXT_PATHS__<"u"}var KP={};function uK(){const e=!!(c8()&&document.querySelector("[ng-version]")),t=!!(ac()&&typeof window.ng<"u");return e||t}function cK(){return LA()&&typeof KP=="object"&&KP.npm_lifecycle_script?.startsWith("ng ")||!1}function dK(){return typeof navigator<"u"&&typeof navigator.product<"u"&&navigator.product==="ReactNative"}function fK(){return Dv()&&typeof global.expo<"u"}function hK(){return ac()}const pK=[{platform:un.Expo,detectionMethod:fK},{platform:un.ReactNative,detectionMethod:dK},{platform:un.NextJs,detectionMethod:sK},{platform:un.Nuxt,detectionMethod:aK},{platform:un.Angular,detectionMethod:uK},{platform:un.React,detectionMethod:JG},{platform:un.VueJs,detectionMethod:tK},{platform:un.Svelte,detectionMethod:rK},{platform:un.WebUnknown,detectionMethod:hK},{platform:un.NextJsSSR,detectionMethod:iK},{platform:un.NuxtSSR,detectionMethod:lK},{platform:un.ReactSSR,detectionMethod:eK},{platform:un.VueJsSSR,detectionMethod:nK},{platform:un.AngularSSR,detectionMethod:cK},{platform:un.SvelteSSR,detectionMethod:oK}];function gK(){return pK.find(e=>e.detectionMethod())?.platform||un.ServerSideUnknown}let rf;const I1=[];let S_=!1;const mK=10,vK=10,yK=1e3,d8=()=>{if(!rf){if(rf=gK(),S_)for(;I1.length;)I1.pop()?.();else I1.forEach(e=>{e()});ZP(un.ServerSideUnknown,mK),ZP(un.WebUnknown,vK)}return rf};function bK(){rf=void 0}function ZP(e,t){rf===e&&!S_&&setTimeout(()=>{bK(),S_=!0,setTimeout(d8,yK)},t)}const Ci={},gs=e=>{Ci[e.category]=e.apis.reduce((r,o)=>({...r,[o]:{refCount:r[o]?.refCount?r[o].refCount+1:1,additionalDetails:e.additionalDetails}}),Ci[e.category]??{});let t=!1;return()=>{t||(t=!0,e.apis.forEach(r=>{const o=Ci[e.category][r].refCount;o>1?Ci[e.category][r].refCount=o-1:(delete Ci[e.category][r],Object.keys(Ci[e.category]).length||delete Ci[e.category])}))}},SK=(e,t)=>Ci[e]?.[t]?.additionalDetails,wK="aws-amplify",CK=e=>e.replace(/\+.*/,""),EK=({category:e,action:t}={})=>{const n=[[wK,CK(XG)]];if(e&&n.push([e,t]),n.push(["framework",d8()]),e&&t){const r=SK(e,t);r&&r.forEach(o=>{n.push(o)})}return n},Lv=e=>EK(e).map(([r,o])=>r&&o?`${r}/${o}`:r).join(" "),Uv=()=>typeof window<"u"&&typeof window.document<"u",YP=new Ln("Auth");class _K{configure(t,n){this.authConfig=t,this.authOptions=n,t&&t.Cognito?.userPoolEndpoint&&YP.warn(QP("Amazon Cognito User Pool")),t&&t.Cognito?.identityPoolEndpoint&&YP.warn(QP("Amazon Cognito Identity Pool"))}async fetchAuthSession(t={}){let n,r;const o=await this.getTokens(t);return o?(r=o.accessToken?.payload?.sub,n=await this.authOptions?.credentialsProvider?.getCredentialsAndIdentityId({authConfig:this.authConfig,tokens:o,authenticated:!0,forceRefresh:t.forceRefresh})):n=await this.authOptions?.credentialsProvider?.getCredentialsAndIdentityId({authConfig:this.authConfig,authenticated:!1,forceRefresh:t.forceRefresh}),{tokens:o,credentials:n?.credentials,identityId:n?.identityId,userSub:r}}async clearCredentials(){await this.authOptions?.credentialsProvider?.clearCredentialsAndIdentityId()}async getTokens(t){return await this.authOptions?.tokenProvider?.getTokens(t)??void 0}}const QP=e=>`You are using a custom Amazon ${e} endpoint, ensure the endpoint is correct.`;class xK{constructor(){this.oAuthListener=void 0,this.isConfigured=!1,this.resourcesConfig={},this.libraryOptions={},this.Auth=new _K}configure(t,n){const r=l8(t);this.resourcesConfig=r,n&&(this.libraryOptions=n),this.resourcesConfig=s8(this.resourcesConfig),this.Auth.configure(this.resourcesConfig.Auth,this.libraryOptions.Auth),(this.resourcesConfig.Analytics?.Pinpoint||this.resourcesConfig.Notifications?.InAppMessaging?.Pinpoint||this.resourcesConfig.Notifications?.PushNotification?.Pinpoint)&&console.warn("AWS will end support for Amazon Pinpoint on October 30, 2026. The guidance is to use AWS End User Messaging for push notifications and SMS, Amazon Simple Email Service for sending emails, Amazon Connect for campaigns, journeys, endpoints, and engagement analytics. Pinpoint recommends Amazon Kinesis for event collection and mobile analytics."),zo.dispatch("core",{event:"configure",data:this.resourcesConfig},"Configure",Fo),this.notifyOAuthListener(),this.isConfigured=!0}getConfig(){return this.isConfigured||console.warn("Amplify has not been configured. Please call Amplify.configure() before using this service."),this.resourcesConfig}[i8](t){this.resourcesConfig.Auth?.Cognito.loginWith?.oauth?t(this.resourcesConfig.Auth?.Cognito):this.oAuthListener=t}notifyOAuthListener(){!this.resourcesConfig.Auth?.Cognito.loginWith?.oauth||!this.oAuthListener||(this.oAuthListener(this.resourcesConfig.Auth?.Cognito),this.oAuthListener=void 0)}}const Tt=new xK,f8=(e,t)=>e.Auth.fetchAuthSession(t),$v=e=>f8(Tt,e);function h8(){return Tt.Auth.clearCredentials()}const Fv=e=>{const{headers:t,statusCode:n}=e;return{...AK(e)?e.$metadata:{},httpStatusCode:n,requestId:t["x-amzn-requestid"]??t["x-amzn-request-id"]??t["x-amz-request-id"],extendedRequestId:t["x-amz-id-2"],cfId:t["x-amz-cf-id"]}},AK=e=>typeof e?.$metadata=="object",lc=async e=>{if(!e||e.statusCode<300)return;const t=await Xf(e),r=(a=>{const[u]=a.toString().split(/[,:]+/);return u.includes("#")?u.split("#")[1]:u})(e.headers["x-amzn-errortype"]??t.code??t.__type??"UnknownError"),o=t.message??t.Message??"Unknown error",s=new Error(o);return Object.assign(s,{name:r,$metadata:Fv(e)})},Xf=async e=>{if(!e.body)throw new Error("Missing response payload");const t=await e.body.json();return Object.assign(t,{$metadata:Fv(e)})},fn=(e,t,n,r)=>async(o,s)=>{const a={...r,...o},u=await a.endpointResolver(a,s),c=await t(s,u),f=await e(c,{...a});return n(f)},IK=300*1e3;function RK(e=IK){return r=>{const o=2**r*100+100*Math.random();return o>e?!1:o}}const p8=3,XP="amz-sdk-invocation-id",TK="amz-sdk-request",JP=300*1e3,g8=e=>{const n=RK(JP)(e);return n===!1?JP:n},OK=["AuthFailure","InvalidSignatureException","RequestExpired","RequestInTheFuture","RequestTimeTooSkewed","SignatureDoesNotMatch","BadRequestException"],MK=e=>!!e&&OK.includes(e),m8=e=>async(t,n)=>{const r=n??await e(t)??void 0,o=r?.code||r?.name,s=t?.statusCode;return{retryable:DK(n)||kK(s,o)||MK(o)||LK(s,o)}},PK=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException"],NK=["TimeoutError","RequestTimeout","RequestTimeoutException"],kK=(e,t)=>e===429||!!t&&PK.includes(t),DK=e=>[Fi.NetworkError,"ERR_NETWORK"].includes(e?.name),LK=(e,t)=>!!e&&[500,502,503,504].includes(e)||!!t&&NK.includes(t),v8="cognito-identity",y8={service:v8,retryDecider:m8(lc),computeDelay:g8,cache:"no-store"},UK=({maxAttempts:e=p8,retryDecider:t,computeDelay:n,abortSignal:r})=>{if(e<1)throw new Error("maxAttempts must be greater than 0");return(o,s)=>async function(u){let c,f=s.attemptsCount??0,h;const g=()=>{if(h)return eN(h,f),h;throw eN(c,f),c};for(;!r?.aborted&&f<e;){try{h=await o(u),c=void 0}catch(w){c=w,h=void 0}f=(s.attemptsCount??0)>f?s.attemptsCount??0:f+1,s.attemptsCount=f;const{isCredentialsExpiredError:m,retryable:v}=await t(h,c,s);if(v){if(s.isCredentialsExpired=!!m,!r?.aborted&&f<e){const w=n(f);await $K(w,r)}continue}else return g()}if(r?.aborted)throw new Error("Request aborted.");return g()}},$K=(e,t)=>{if(t?.aborted)return Promise.resolve();let n,r;const o=new Promise(s=>{r=s,n=setTimeout(s,e)});return t?.addEventListener("abort",function s(a){clearTimeout(n),t?.removeEventListener("abort",s),r()}),o},eN=(e,t)=>{Object.prototype.toString.call(e)==="[object Object]"&&(e.$metadata={...e.$metadata??{},attempts:t})},FK=Mu,zK=()=>e=>async function(n){return n.headers[XP]||(n.headers[XP]=FK()),e(n)},jK=({maxAttempts:e=p8})=>(t,n)=>async function(o){const s=n.attemptsCount??0;return o.headers[TK]=`attempt=${s+1}; max=${e}`,t(o)},BK=({userAgentHeader:e="x-amz-user-agent",userAgentValue:t=""})=>n=>async function(o){if(t.trim().length===0)return await n(o);{const s=e.toLowerCase();return o.headers[s]=o.headers[s]?`${o.headers[s]} ${t}`:t,await n(o)}},UA=(e,t)=>(n,r)=>{const o={};let s=a=>e(a,r);for(let a=t.length-1;a>=0;a--){const u=t[a];s=u(r)(s,o)}return s(n)},R1=e=>{let t;return()=>(t||(t=e()),t)},HK=e=>!["HEAD","GET"].includes(e.toUpperCase()),qK=async({url:e,method:t,headers:n,body:r},{abortSignal:o,cache:s,withCrossDomainCredentials:a})=>{let u;try{u=await fetch(e,{method:t,headers:n,body:HK(t)?r:void 0,signal:o,cache:s,credentials:a?"include":"same-origin"})}catch(g){throw g instanceof TypeError?new cr({name:Fi.NetworkError,message:"A network error has occurred.",underlyingError:g}):g}const c={};u.headers?.forEach((g,m)=>{c[m.toLowerCase()]=g});const f={statusCode:u.status,headers:c,body:null},h=Object.assign(u.body??{},{text:R1(()=>u.text()),blob:R1(()=>u.blob()),json:R1(()=>u.json())});return{...f,body:h}},b8=UA(qK,[BK,zK,UK,jK]),VK=()=>e=>async function(n){return n.headers["cache-control"]="no-store",e(n)},S8=UA(b8,[VK]),w8=e=>(t,n)=>{const r=WK(e),o=JSON.stringify(t);return GK(n,r,o)},WK=e=>({"content-type":"application/x-amz-json-1.1","x-amz-target":`AWSCognitoIdentityService.${e}`}),GK=({url:e},t,n)=>({headers:t,url:e,body:n,method:"POST"}),tN=e=>fn(S8,w8("GetCredentialsForIdentity"),KK,{...y8,...e,userAgentValue:Lv()}),KK=async e=>{if(e.statusCode>=300)throw await lc(e);const t=await Xf(e);return{IdentityId:t.IdentityId,Credentials:ZK(t.Credentials),$metadata:Fv(e)}},ZK=({Expiration:e,...t}={})=>({...t,Expiration:e&&new Date(e*1e3)}),YK=e=>fn(S8,w8("GetId"),QK,{...y8,...e,userAgentValue:Lv()}),QK=async e=>{if(e.statusCode>=300)throw await lc(e);return{IdentityId:(await Xf(e)).IdentityId,$metadata:Fv(e)}},C8={id:"aws",outputs:{dnsSuffix:"amazonaws.com"},regionRegex:"^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$",regions:["aws-global"]},XK={partitions:[C8,{id:"aws-cn",outputs:{dnsSuffix:"amazonaws.com.cn"},regionRegex:"^cn\\-\\w+\\-\\d+$",regions:["aws-cn-global"]}]},E8=e=>{const{partitions:t}=XK;for(const{regions:n,outputs:r,regionRegex:o}of t){const s=new RegExp(o);if(n.includes(e)||s.test(e))return r.dnsSuffix}return C8.outputs.dnsSuffix},Yi=URL,JK=({region:e})=>({url:new Yi(`https://${v8}.${e}.${E8(e)}`)});class Hd extends cr{constructor(){super({name:Fi.PlatformNotSupported,message:"Function not supported on current platform"})}}class _8{constructor(t){this.storage=t}async setItem(t,n){if(!this.storage)throw new Hd;this.storage.setItem(t,n)}async getItem(t){if(!this.storage)throw new Hd;return this.storage.getItem(t)}async removeItem(t){if(!this.storage)throw new Hd;this.storage.removeItem(t)}async clear(){if(!this.storage)throw new Hd;this.storage.clear()}}class x8{constructor(){this.storage=new Map}get length(){return this.storage.size}key(t){return t>this.length-1?null:Array.from(this.storage.keys())[t]}setItem(t,n){this.storage.set(t,n)}getItem(t){return this.storage.get(t)??null}removeItem(t){this.storage.delete(t)}clear(){this.storage.clear()}}const A8=new Ln("CoreStorageUtils"),eZ=()=>{try{if(typeof window<"u"&&window.localStorage)return window.localStorage}catch{A8.info("localStorage not found. InMemoryStorage is used as a fallback.")}return new x8},I8=()=>{try{if(typeof window<"u"&&window.sessionStorage)return window.sessionStorage.getItem("test"),window.sessionStorage;throw new Error("sessionStorage is not defined")}catch{return A8.info("sessionStorage not found. InMemoryStorage is used as a fallback."),new x8}};class tZ extends _8{constructor(){super(eZ())}}class nZ extends _8{constructor(){super(I8())}}class rZ{constructor(t){this._storage=t}get storage(){if(!this._storage)throw new Hd;return this._storage}setItem(t,n){this.storage.setItem(t,n)}getItem(t){return this.storage.getItem(t)}removeItem(t){this.storage.removeItem(t)}clear(){this.storage.clear()}}class oZ extends rZ{constructor(){super(I8())}}function Fp(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)r!=="__proto__"&&(e[r]=n[r])}return e}var sZ={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function w_(e,t){function n(o,s,a){if(!(typeof document>"u")){a=Fp({},t,a),typeof a.expires=="number"&&(a.expires=new Date(Date.now()+a.expires*864e5)),a.expires&&(a.expires=a.expires.toUTCString()),o=encodeURIComponent(o).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var u="";for(var c in a)a[c]&&(u+="; "+c,a[c]!==!0&&(u+="="+a[c].split(";")[0]));return document.cookie=o+"="+e.write(s,o)+u}}function r(o){if(!(typeof document>"u"||arguments.length&&!o)){for(var s=document.cookie?document.cookie.split("; "):[],a={},u=0;u<s.length;u++){var c=s[u].split("="),f=c.slice(1).join("=");try{var h=decodeURIComponent(c[0]);if(h in a||(a[h]=e.read(f,h)),o===h)break}catch{}}return o?a[o]:a}}return Object.create({set:n,get:r,remove:function(o,s){n(o,"",Fp({},s,{expires:-1}))},withAttributes:function(o){return w_(this.converter,Fp({},this.attributes,o))},withConverter:function(o){return w_(Fp({},this.converter,o),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var zp=w_(sZ,{path:"/"});class iZ{constructor(t={}){const{path:n,domain:r,expires:o,sameSite:s,secure:a}=t;if(this.domain=r,this.path=n||"/",this.expires=Object.prototype.hasOwnProperty.call(t,"expires")?o:365,this.secure=Object.prototype.hasOwnProperty.call(t,"secure")?a:!0,Object.prototype.hasOwnProperty.call(t,"sameSite")){if(!s||!["strict","lax","none"].includes(s))throw new Error('The sameSite value of cookieStorage must be "lax", "strict" or "none".');if(s==="none"&&!this.secure)throw new Error("sameSite = None requires the Secure attribute in latest browser versions.");this.sameSite=s}}async setItem(t,n){zp.set(t,n,this.getData())}async getItem(t){return zp.get(t)??null}async removeItem(t){zp.remove(t,this.getData())}async clear(){const t=zp.get(),n=Object.keys(t).map(r=>this.removeItem(r));await Promise.all(n)}getData(){return{path:this.path,expires:this.expires,domain:this.domain,secure:this.secure,...this.sameSite&&{sameSite:this.sameSite}}}}const Jf=new tZ;new nZ;const xs=new oZ,aZ=new Ln("I18n");let lZ=class{constructor(){this._options=null,this._lang=null,this._dict={}}setDefaultLanguage(){!this._lang&&typeof window<"u"&&window&&window.navigator&&(this._lang=window.navigator.language),aZ.debug(this._lang)}setLanguage(t){this._lang=t}get(t,n=void 0){if(this.setDefaultLanguage(),!this._lang)return typeof n<"u"?n:t;const r=this._lang;let o=this.getByLanguage(t,r);return o||(r.indexOf("-")>0&&(o=this.getByLanguage(t,r.split("-")[0])),o)?o:typeof n<"u"?n:t}getByLanguage(t,n,r=null){if(!n)return r;const o=this._dict[n];return o?o[t]:r}putVocabulariesForLanguage(t,n){let r=this._dict[t];r||(r=this._dict[t]={}),this._dict[t]={...r,...n}}putVocabularies(t){Object.keys(t).forEach(n=>{this.putVocabulariesForLanguage(n,t[n])})}};var xa;(function(e){e.NotConfigured="NotConfigured"})(xa||(xa={}));const uZ={[xa.NotConfigured]:{message:"i18n is not configured."}},jp=Nv(uZ),nN=new Ln("I18n");let Bp={language:null},ao=null,R8=class Ea{static configure(t){return nN.debug("configure I18n"),t&&(Bp=Object.assign({},Bp,t.I18n||t),Ea.createInstance()),Bp}static getModuleName(){return"I18n"}static createInstance(){nN.debug("create I18n instance"),!ao&&(ao=new lZ)}static setLanguage(t){Ea.checkConfig(),jp(!!ao,xa.NotConfigured),ao.setLanguage(t)}static get(t,n){return Ea.checkConfig(),jp(!!ao,xa.NotConfigured),ao.get(t,n)}static putVocabulariesForLanguage(t,n){Ea.checkConfig(),jp(!!ao,xa.NotConfigured),ao.putVocabulariesForLanguage(t,n)}static putVocabularies(t){Ea.checkConfig(),jp(!!ao,xa.NotConfigured),ao.putVocabularies(t)}static checkConfig(){return ao||Ea.createInstance(),!0}};R8.createInstance();const cZ=e=>{const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=[],r=new Uint8Array(e);NA().getRandomValues(r);for(const o of r)n.push(t[o%t.length]);return n.join("")};function dZ(e){return(e.match(/.{2}/g)||[]).map(n=>String.fromCharCode(parseInt(n,16))).join("")}function fZ(e){return e.split("").map(t=>t.charCodeAt(0).toString(16).padStart(2,"0")).join("")}const hZ=e=>{let t;return async(...n)=>t||(t=new Promise((r,o)=>{e(...n).then(s=>{r(s)}).catch(s=>{o(s)}).finally(()=>{t=void 0})}),t)};function rN({expiresAt:e,clockDrift:t,tolerance:n=5e3}){return Date.now()+t+n>e}const pZ=async()=>{const{userAgentData:e}=navigator;if(!e)return navigator.userAgent;const{platform:t="",platformVersion:n="",model:r="",architecture:o="",fullVersionList:s=[]}=await e.getHighEntropyValues(["platform","platformVersion","architecture","model","fullVersionList"]),a=s.map(c=>`${c.brand}/${c.version}`).join(";");return[t,n,o,r,t,a].filter(c=>c).join(" ")||navigator.userAgent};function gZ(e){return Array.from(e,t=>String.fromCodePoint(t)).join("")}const $u={convert(e,t={urlSafe:!1,skipPadding:!1}){const n=typeof e=="string"?e:gZ(e);let r=mG()(n);return t.urlSafe&&(r=r.replace(/\+/g,"-").replace(/\//g,"_")),t.skipPadding&&(r=r.replace(/=/g,"")),r}};function mZ(){return NA().getRandomValues(new Uint32Array(1))[0]}function vZ(e){const{words:t}=e,{sigBytes:n}=e,r=[];for(let o=0;o<n;o++){const s=t[o>>>2]>>>24-o%4*8&255;r.push((s>>>4).toString(16)),r.push((s&15).toString(16))}return r.join("")}class $A{constructor(t,n){this.words=[];let r=t;r=this.words=r||[],n!==void 0?this.sigBytes=n:this.sigBytes=r.length*4}random(t){const n=[];for(let r=0;r<t;r+=4)n.push(mZ());return new $A(n,t)}toString(){return vZ(this)}}var Ue;(function(e){e.EmptySignInUsername="EmptySignInUsername",e.EmptySignInPassword="EmptySignInPassword",e.CustomAuthSignInPassword="CustomAuthSignInPassword",e.EmptySignUpUsername="EmptySignUpUsername",e.EmptySignUpPassword="EmptySignUpPassword",e.EmptyConfirmSignUpUsername="EmptyConfirmSignUpUsername",e.EmptyConfirmSignUpCode="EmptyConfirmSignUpCode",e.EmptyResendSignUpCodeUsername="EmptyresendSignUpCodeUsername",e.EmptyChallengeResponse="EmptyChallengeResponse",e.EmptyConfirmResetPasswordUsername="EmptyConfirmResetPasswordUsername",e.EmptyConfirmResetPasswordNewPassword="EmptyConfirmResetPasswordNewPassword",e.EmptyConfirmResetPasswordConfirmationCode="EmptyConfirmResetPasswordConfirmationCode",e.EmptyResetPasswordUsername="EmptyResetPasswordUsername",e.EmptyVerifyTOTPSetupCode="EmptyVerifyTOTPSetupCode",e.EmptyConfirmUserAttributeCode="EmptyConfirmUserAttributeCode",e.IncorrectMFAMethod="IncorrectMFAMethod",e.EmptyUpdatePassword="EmptyUpdatePassword",e.InvalidPreferredChallenge="InvalidPreferredChallenge"})(Ue||(Ue={}));const T8={[Ue.EmptyChallengeResponse]:{message:"challengeResponse is required to confirmSignIn"},[Ue.EmptyConfirmResetPasswordUsername]:{message:"username is required to confirmResetPassword"},[Ue.EmptyConfirmSignUpCode]:{message:"code is required to confirmSignUp"},[Ue.EmptyConfirmSignUpUsername]:{message:"username is required to confirmSignUp"},[Ue.EmptyConfirmResetPasswordConfirmationCode]:{message:"confirmationCode is required to confirmResetPassword"},[Ue.EmptyConfirmResetPasswordNewPassword]:{message:"newPassword is required to confirmResetPassword"},[Ue.EmptyResendSignUpCodeUsername]:{message:"username is required to confirmSignUp"},[Ue.EmptyResetPasswordUsername]:{message:"username is required to resetPassword"},[Ue.EmptySignInPassword]:{message:"password is required to signIn"},[Ue.EmptySignInUsername]:{message:"username is required to signIn"},[Ue.EmptySignUpPassword]:{message:"password is required to signUp"},[Ue.EmptySignUpUsername]:{message:"username is required to signUp"},[Ue.CustomAuthSignInPassword]:{message:"A password is not needed when signing in with CUSTOM_WITHOUT_SRP",recoverySuggestion:"Do not include a password in your signIn call."},[Ue.IncorrectMFAMethod]:{message:"Incorrect MFA method was chosen. It should be either SMS, TOTP, or EMAIL",recoverySuggestion:"Try to pass SMS, TOTP, or EMAIL as the challengeResponse"},[Ue.EmptyVerifyTOTPSetupCode]:{message:"code is required to verifyTotpSetup"},[Ue.EmptyUpdatePassword]:{message:"oldPassword and newPassword are required to changePassword"},[Ue.EmptyConfirmUserAttributeCode]:{message:"confirmation code is required to confirmUserAttribute"},[Ue.InvalidPreferredChallenge]:{message:"The preferred challenge is not enabled in your backend configuration",recoverySuggestion:"Ensure the authentication method is enabled in your Amplify backend configuration"}};var En;(function(e){e.DEFAULT_MSG="Authentication Error",e.EMPTY_EMAIL="Email cannot be empty",e.EMPTY_PHONE="Phone number cannot be empty",e.EMPTY_USERNAME="Username cannot be empty",e.INVALID_USERNAME="The username should either be a string or one of the sign in types",e.EMPTY_PASSWORD="Password cannot be empty",e.EMPTY_CODE="Confirmation code cannot be empty",e.SIGN_UP_ERROR="Error creating account",e.NO_MFA="No valid MFA method provided",e.INVALID_MFA="Invalid MFA type",e.EMPTY_CHALLENGE="Challenge response cannot be empty",e.NO_USER_SESSION="Failed to get the session because the user is empty",e.NETWORK_ERROR="Network Error",e.DEVICE_CONFIG="Device tracking has not been configured in this User Pool",e.AUTOSIGNIN_ERROR="Please use your credentials to sign in",e.OAUTH_ERROR="Couldn't finish OAuth flow, check your User Pool HostedUI settings"})(En||(En={}));var jo;(function(e){e.SignInException="SignInException",e.OAuthSignInError="OAuthSignInException"})(jo||(jo={}));class Oe extends cr{constructor(t){super(t),this.constructor=Oe,Object.setPrototypeOf(this,Oe.prototype)}}function Kt(e,t){const{message:n,recoverySuggestion:r}=T8[t];if(!e)throw new Oe({name:t,message:n,recoverySuggestion:r})}function nt(e){const t=e?.split("_")[0];if(!e||e.indexOf("_")<0||!t||typeof t!="string")throw new Oe({name:"InvalidUserPoolId",message:"Invalid user pool id provided."});return t}function C_(e){if(!e||!e.includes(":"))throw new Oe({name:"InvalidIdentityPoolIdException",message:"Invalid identity pool id provided.",recoverySuggestion:"Make sure a valid identityPoolId is given in the config."});return e.split(":")[0]}function oN(e){return Object.entries(e).map(([t,n])=>({Name:t,Value:n}))}function yZ(e){const t={};return e?.forEach(n=>{n.Name&&(t[n.Name]=n.Value)}),t}var sN;(function(e){e.ConcurrentModificationException="ConcurrentModificationException",e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidParameterException="InvalidParameterException",e.NotAuthorizedException="NotAuthorizedException",e.ResourceNotFoundException="ResourceNotFoundException",e.SoftwareTokenMFANotFoundException="SoftwareTokenMFANotFoundException"})(sN||(sN={}));var iN;(function(e){e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidParameterException="InvalidParameterException",e.InvalidPasswordException="InvalidPasswordException",e.LimitExceededException="LimitExceededException",e.NotAuthorizedException="NotAuthorizedException",e.PasswordResetRequiredException="PasswordResetRequiredException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyRequestsException="TooManyRequestsException",e.UserNotConfirmedException="UserNotConfirmedException",e.UserNotFoundException="UserNotFoundException"})(iN||(iN={}));var aN;(function(e){e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidLambdaResponseException="InvalidLambdaResponseException",e.InvalidParameterException="InvalidParameterException",e.InvalidPasswordException="InvalidPasswordException",e.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",e.NotAuthorizedException="NotAuthorizedException",e.PasswordResetRequiredException="PasswordResetRequiredException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyRequestsException="TooManyRequestsException",e.UsernameExistsException="UsernameExistsException",e.UserNotConfirmedException="UserNotConfirmedException",e.UserNotFoundException="UserNotFoundException"})(aN||(aN={}));var lN;(function(e){e.CodeMismatchException="CodeMismatchException",e.ExpiredCodeException="ExpiredCodeException",e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidLambdaResponseException="InvalidLambdaResponseException",e.InvalidParameterException="InvalidParameterException",e.InvalidPasswordException="InvalidPasswordException",e.LimitExceededException="LimitExceededException",e.NotAuthorizedException="NotAuthorizedException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyFailedAttemptsException="TooManyFailedAttemptsException",e.TooManyRequestsException="TooManyRequestsException",e.UnexpectedLambdaException="UnexpectedLambdaException",e.UserLambdaValidationException="UserLambdaValidationException",e.UserNotConfirmedException="UserNotConfirmedException",e.UserNotFoundException="UserNotFoundException"})(lN||(lN={}));var uN;(function(e){e.AliasExistsException="AliasExistsException",e.CodeMismatchException="CodeMismatchException",e.ExpiredCodeException="ExpiredCodeException",e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidLambdaResponseException="InvalidLambdaResponseException",e.InvalidParameterException="InvalidParameterException",e.LimitExceededException="LimitExceededException",e.NotAuthorizedException="NotAuthorizedException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyFailedAttemptsException="TooManyFailedAttemptsException",e.TooManyRequestsException="TooManyRequestsException",e.UnexpectedLambdaException="UnexpectedLambdaException",e.UserLambdaValidationException="UserLambdaValidationException",e.UserNotFoundException="UserNotFoundException"})(uN||(uN={}));var cN;(function(e){e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidParameterException="InvalidParameterException",e.NotAuthorizedException="NotAuthorizedException",e.PasswordResetRequiredException="PasswordResetRequiredException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyRequestsException="TooManyRequestsException",e.UserNotConfirmedException="UserNotConfirmedException",e.UserNotFoundException="UserNotFoundException"})(cN||(cN={}));var dN;(function(e){e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidParameterException="InvalidParameterException",e.NotAuthorizedException="NotAuthorizedException",e.PasswordResetRequiredException="PasswordResetRequiredException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyRequestsException="TooManyRequestsException",e.UserNotConfirmedException="UserNotConfirmedException",e.UserNotFoundException="UserNotFoundException"})(dN||(dN={}));var fN;(function(e){e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidParameterException="InvalidParameterException",e.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",e.NotAuthorizedException="NotAuthorizedException",e.PasswordResetRequiredException="PasswordResetRequiredException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyRequestsException="TooManyRequestsException",e.UserNotConfirmedException="UserNotConfirmedException",e.UserNotFoundException="UserNotFoundException"})(fN||(fN={}));var hN;(function(e){e.CodeDeliveryFailureException="CodeDeliveryFailureException",e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidEmailRoleAccessPolicyException="InvalidEmailRoleAccessPolicyException",e.InvalidLambdaResponseException="InvalidLambdaResponseException",e.InvalidParameterException="InvalidParameterException",e.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",e.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",e.LimitExceededException="LimitExceededException",e.NotAuthorizedException="NotAuthorizedException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyRequestsException="TooManyRequestsException",e.UnexpectedLambdaException="UnexpectedLambdaException",e.UserLambdaValidationException="UserLambdaValidationException",e.UserNotFoundException="UserNotFoundException"})(hN||(hN={}));var pN;(function(e){e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidParameterException="InvalidParameterException",e.NotAuthorizedException="NotAuthorizedException",e.PasswordResetRequiredException="PasswordResetRequiredException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyRequestsException="TooManyRequestsException",e.UserNotConfirmedException="UserNotConfirmedException",e.UserNotFoundException="UserNotFoundException"})(pN||(pN={}));var gN;(function(e){e.ExternalServiceException="ExternalServiceException",e.InternalErrorException="InternalErrorException",e.InvalidParameterException="InvalidParameterException",e.LimitExceededException="LimitExceededException",e.NotAuthorizedException="NotAuthorizedException",e.ResourceConflictException="ResourceConflictException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyRequestsException="TooManyRequestsException"})(gN||(gN={}));var mN;(function(e){e.ExternalServiceException="ExternalServiceException",e.InternalErrorException="InternalErrorException",e.InvalidIdentityPoolConfigurationException="InvalidIdentityPoolConfigurationException",e.InvalidParameterException="InvalidParameterException",e.NotAuthorizedException="NotAuthorizedException",e.ResourceConflictException="ResourceConflictException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyRequestsException="TooManyRequestsException"})(mN||(mN={}));var vN;(function(e){e.CodeDeliveryFailureException="CodeDeliveryFailureException",e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidEmailRoleAccessPolicyException="InvalidEmailRoleAccessPolicyException",e.InvalidLambdaResponseException="InvalidLambdaResponseException",e.InvalidParameterException="InvalidParameterException",e.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",e.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",e.LimitExceededException="LimitExceededException",e.NotAuthorizedException="NotAuthorizedException",e.PasswordResetRequiredException="PasswordResetRequiredException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyRequestsException="TooManyRequestsException",e.UnexpectedLambdaException="UnexpectedLambdaException",e.UserLambdaValidationException="UserLambdaValidationException",e.UserNotConfirmedException="UserNotConfirmedException",e.UserNotFoundException="UserNotFoundException"})(vN||(vN={}));var yN;(function(e){e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidParameterException="InvalidParameterException",e.NotAuthorizedException="NotAuthorizedException",e.PasswordResetRequiredException="PasswordResetRequiredException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyRequestsException="TooManyRequestsException",e.UserNotConfirmedException="UserNotConfirmedException"})(yN||(yN={}));var xm;(function(e){e.PasswordResetRequiredException="PasswordResetRequiredException",e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidLambdaResponseException="InvalidLambdaResponseException",e.InvalidParameterException="InvalidParameterException",e.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",e.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",e.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",e.NotAuthorizedException="NotAuthorizedException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyRequestsException="TooManyRequestsException",e.UnexpectedLambdaException="UnexpectedLambdaException",e.UserLambdaValidationException="UserLambdaValidationException",e.UserNotConfirmedException="UserNotConfirmedException",e.UserNotFoundException="UserNotFoundException"})(xm||(xm={}));var bN;(function(e){e.CodeDeliveryFailureException="CodeDeliveryFailureException",e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidEmailRoleAccessPolicyException="InvalidEmailRoleAccessPolicyException",e.InvalidLambdaResponseException="InvalidLambdaResponseException",e.InvalidParameterException="InvalidParameterException",e.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",e.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",e.LimitExceededException="LimitExceededException",e.NotAuthorizedException="NotAuthorizedException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyRequestsException="TooManyRequestsException",e.UnexpectedLambdaException="UnexpectedLambdaException",e.UserLambdaValidationException="UserLambdaValidationException",e.UserNotFoundException="UserNotFoundException"})(bN||(bN={}));var SN;(function(e){e.AliasExistsException="AliasExistsException",e.CodeMismatchException="CodeMismatchException",e.ExpiredCodeException="ExpiredCodeException",e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidLambdaResponseException="InvalidLambdaResponseException",e.InvalidParameterException="InvalidParameterException",e.InvalidPasswordException="InvalidPasswordException",e.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",e.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",e.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",e.MFAMethodNotFoundException="MFAMethodNotFoundException",e.NotAuthorizedException="NotAuthorizedException",e.PasswordResetRequiredException="PasswordResetRequiredException",e.ResourceNotFoundException="ResourceNotFoundException",e.SoftwareTokenMFANotFoundException="SoftwareTokenMFANotFoundException",e.TooManyRequestsException="TooManyRequestsException",e.UnexpectedLambdaException="UnexpectedLambdaException",e.UserLambdaValidationException="UserLambdaValidationException",e.UserNotConfirmedException="UserNotConfirmedException",e.UserNotFoundException="UserNotFoundException"})(SN||(SN={}));var wN;(function(e){e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidParameterException="InvalidParameterException",e.NotAuthorizedException="NotAuthorizedException",e.PasswordResetRequiredException="PasswordResetRequiredException",e.ResourceNotFoundException="ResourceNotFoundException",e.UserNotConfirmedException="UserNotConfirmedException",e.UserNotFoundException="UserNotFoundException"})(wN||(wN={}));var E_;(function(e){e.CodeDeliveryFailureException="CodeDeliveryFailureException",e.InternalErrorException="InternalErrorException",e.InvalidEmailRoleAccessPolicyException="InvalidEmailRoleAccessPolicyException",e.InvalidLambdaResponseException="InvalidLambdaResponseException",e.InvalidParameterException="InvalidParameterException",e.InvalidPasswordException="InvalidPasswordException",e.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",e.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",e.NotAuthorizedException="NotAuthorizedException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyRequestsException="TooManyRequestsException",e.UnexpectedLambdaException="UnexpectedLambdaException",e.UserLambdaValidationException="UserLambdaValidationException",e.UsernameExistsException="UsernameExistsException"})(E_||(E_={}));var CN;(function(e){e.AliasExistsException="AliasExistsException",e.CodeDeliveryFailureException="CodeDeliveryFailureException",e.CodeMismatchException="CodeMismatchException",e.ExpiredCodeException="ExpiredCodeException",e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidEmailRoleAccessPolicyException="InvalidEmailRoleAccessPolicyException",e.InvalidLambdaResponseException="InvalidLambdaResponseException",e.InvalidParameterException="InvalidParameterException",e.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",e.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",e.NotAuthorizedException="NotAuthorizedException",e.PasswordResetRequiredException="PasswordResetRequiredException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyRequestsException="TooManyRequestsException",e.UnexpectedLambdaException="UnexpectedLambdaException",e.UserLambdaValidationException="UserLambdaValidationException",e.UserNotConfirmedException="UserNotConfirmedException",e.UserNotFoundException="UserNotFoundException"})(CN||(CN={}));var EN;(function(e){e.CodeMismatchException="CodeMismatchException",e.EnableSoftwareTokenMFAException="EnableSoftwareTokenMFAException",e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidParameterException="InvalidParameterException",e.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",e.NotAuthorizedException="NotAuthorizedException",e.PasswordResetRequiredException="PasswordResetRequiredException",e.ResourceNotFoundException="ResourceNotFoundException",e.SoftwareTokenMFANotFoundException="SoftwareTokenMFANotFoundException",e.TooManyRequestsException="TooManyRequestsException",e.UserNotConfirmedException="UserNotConfirmedException",e.UserNotFoundException="UserNotFoundException"})(EN||(EN={}));var _N;(function(e){e.AliasExistsException="AliasExistsException",e.CodeMismatchException="CodeMismatchException",e.ExpiredCodeException="ExpiredCodeException",e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidParameterException="InvalidParameterException",e.LimitExceededException="LimitExceededException",e.NotAuthorizedException="NotAuthorizedException",e.PasswordResetRequiredException="PasswordResetRequiredException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyRequestsException="TooManyRequestsException",e.UserNotConfirmedException="UserNotConfirmedException",e.UserNotFoundException="UserNotFoundException"})(_N||(_N={}));var xN;(function(e){e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidParameterException="InvalidParameterException",e.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",e.NotAuthorizedException="NotAuthorizedException",e.PasswordResetRequiredException="PasswordResetRequiredException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyRequestsException="TooManyRequestsException",e.UserNotConfirmedException="UserNotConfirmedException",e.UserNotFoundException="UserNotFoundException"})(xN||(xN={}));var AN;(function(e){e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidParameterException="InvalidParameterException",e.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",e.NotAuthorizedException="NotAuthorizedException",e.PasswordResetRequiredException="PasswordResetRequiredException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyRequestsException="TooManyRequestsException",e.UserNotConfirmedException="UserNotConfirmedException",e.UserNotFoundException="UserNotFoundException"})(AN||(AN={}));const zv="UserUnAuthenticatedException",bZ="UserAlreadyAuthenticatedException",SZ="DeviceMetadataNotFoundException",O8="AutoSignInException",wZ="InvalidRedirectException",CZ="InvalidAppSchemeException",EZ="InvalidPreferredRedirectUrlException",_Z=new Oe({name:wZ,message:"signInRedirect or signOutRedirect had an invalid format or was not found.",recoverySuggestion:"Please make sure the signIn/Out redirect in your oauth config is valid."});new Oe({name:CZ,message:"A valid non-http app scheme was not found in the config.",recoverySuggestion:"Please make sure a valid custom app scheme is present in the config."});new Oe({name:EZ,message:"The given preferredRedirectUrl does not match any items in the redirectSignOutUrls array from the config.",recoverySuggestion:"Please make sure a matching preferredRedirectUrl is provided."});const xZ="InvalidOriginException",AZ=new Oe({name:xZ,message:"redirect is coming from a different origin. The oauth flow needs to be initiated from the same origin",recoverySuggestion:"Please call signInWithRedirect from the same origin."}),IZ="OAuthSignOutException",RZ="TokenRefreshException",TZ="UnexpectedSignInInterruptionException";function uc(e){if(!e||!e.accessToken)throw new Oe({name:zv,message:"User needs to be authenticated to call this API.",recoverySuggestion:"Sign in before calling this API again."})}function OZ(e){if(!e||!e.idToken)throw new Oe({name:zv,message:"User needs to be authenticated to call this API.",recoverySuggestion:"Sign in before calling this API again."})}const MZ=new Oe({name:RZ,message:`Token refresh is not supported when authenticated with the 'implicit grant' (token) oauth flow.
|
|
3
3
|
Please change your oauth configuration to use 'code grant' flow.`,recoverySuggestion:`Please logout and change your Amplify configuration to use "code grant" flow.
|
|
4
4
|
E.g { responseType: 'code' }`}),PZ=new Oe({name:zv,message:"User needs to be authenticated to call this API.",recoverySuggestion:"Sign in before calling this API again."});function M8(e){if(DZ(e))throw MZ;if(!kZ(e))throw PZ}function P8(e){if(!e||!e.deviceKey||!e.deviceGroupKey||!e.randomPassword)throw new Oe({name:SZ,message:"Either deviceKey, deviceGroupKey or secretPassword were not found during the sign-in process.",recoverySuggestion:"Make sure to not clear storage after calling the signIn API."})}const NZ={inflightOAuth:"inflightOAuth",oauthSignIn:"oauthSignIn",oauthPKCE:"oauthPKCE",oauthState:"oauthState"};function N8(e){return e?.accessToken||e?.idToken}function kZ(e){return N8(e)&&e?.refreshToken}function DZ(e){return N8(e)&&!e?.refreshToken}const LZ=async e=>{const t=e.getConfig().Auth?.Cognito;We(t);const n=await e.Auth.getTokens({forceRefresh:!1});uc(n);const{"cognito:username":r,sub:o}=n.idToken?.payload??{},s={username:r,userId:o},a=UZ(n);return a&&(s.signInDetails=a),s};function UZ(e){return e?.signInDetails}const jv=async()=>LZ(Tt),vt=(e,t)=>Lv({category:Jr.Auth,action:e,...t}),_n=e=>(t,n)=>{const r=$Z(e),o=JSON.stringify(t);return FZ(n,r,o)},$Z=e=>({"content-type":"application/x-amz-json-1.1","x-amz-target":`AWSCognitoIdentityProviderService.${e}`}),FZ=({url:e},t,n)=>({headers:t,url:e,body:n,method:"POST"});function eo(e){if(!e||e.name==="Error"||e instanceof TypeError)throw new Oe({name:Fi.Unknown,message:"An unknown error has occurred.",underlyingError:e})}const Un=()=>async e=>{if(e.statusCode>=300){const t=await lc(e);throw eo(t),new Oe({name:t.name,message:t.message,metadata:t.$metadata})}return Xf(e)},zZ=()=>(e,t)=>async function(r){return r.headers={...r.headers,"cache-control":"no-store",...await Tt.libraryOptions?.Auth?.headers?.()},e(r)},xn=UA(b8,[zZ]),k8="cognito-idp",An={service:k8,retryDecider:m8(lc),computeDelay:g8,get userAgentValue(){return Lv()},cache:"no-store"},eh=e=>fn(xn,_n("InitiateAuth"),Un(),{...An,...e}),Tr=e=>fn(xn,_n("RespondToAuthChallenge"),Un(),{...An,...e}),jZ=e=>fn(xn,_n("VerifySoftwareToken"),Un(),{...An,...e}),BZ=e=>fn(xn,_n("AssociateSoftwareToken"),Un(),{...An,...e}),HZ=({region:e})=>({url:new Yi(`https://${k8}.${e}.${E8(e)}`)}),rt=({endpointOverride:e})=>t=>e?{url:new Yi(e)}:HZ(t),qZ=e=>fn(xn,_n("GetTokensFromRefreshToken"),Un(),{...An,...e}),VZ=async({tokens:e,authConfig:t,username:n,clientMetadata:r})=>{We(t?.Cognito);const{userPoolId:o,userPoolClientId:s,userPoolEndpoint:a}=t.Cognito,u=nt(o);M8(e);const c=qZ({endpointResolver:rt({endpointOverride:a})}),{AuthenticationResult:f}=await c({region:u},{ClientId:s,RefreshToken:e.refreshToken,DeviceKey:e.deviceMetadata?.deviceKey,ClientMetadata:r}),h=Ms(f?.AccessToken??""),g=f?.IdToken?Ms(f.IdToken):void 0,{iat:m}=h.payload;if(!m)throw new Oe({name:"iatNotFoundException",message:"iat not found in access token"});const v=m*1e3-new Date().getTime();return{accessToken:h,idToken:g,clockDrift:v,refreshToken:f?.RefreshToken??e.refreshToken,username:n}},WZ=hZ(VZ),GZ={accessToken:"accessToken",idToken:"idToken",oidcProvider:"oidcProvider",clockDrift:"clockDrift",refreshToken:"refreshToken",deviceKey:"deviceKey",randomPasswordKey:"randomPasswordKey",deviceGroupKey:"deviceGroupKey",signInDetails:"signInDetails",oauthMetadata:"oauthMetadata"};var Am;(function(e){e.InvalidAuthTokens="InvalidAuthTokens"})(Am||(Am={}));const KZ={[Am.InvalidAuthTokens]:{message:"Invalid tokens.",recoverySuggestion:"Make sure the tokens are valid."}},ZZ=Nv(KZ),IN="CognitoIdentityServiceProvider";class YZ{getKeyValueStorage(){if(!this.keyValueStorage)throw new Oe({name:"KeyValueStorageNotFoundException",message:"KeyValueStorage was not found in TokenStore"});return this.keyValueStorage}setKeyValueStorage(t){this.keyValueStorage=t}setAuthConfig(t){this.authConfig=t}async loadTokens(){try{const t=await this.getAuthKeys(),n=await this.getKeyValueStorage().getItem(t.accessToken);if(!n)throw new Oe({name:"NoSessionFoundException",message:"Auth session was not found. Make sure to call signIn."});const r=Ms(n),o=await this.getKeyValueStorage().getItem(t.idToken),s=o?Ms(o):void 0,a=await this.getKeyValueStorage().getItem(t.refreshToken)??void 0,u=await this.getKeyValueStorage().getItem(t.clockDrift)??"0",c=Number.parseInt(u),f=await this.getKeyValueStorage().getItem(t.signInDetails),h={accessToken:r,idToken:s,refreshToken:a,deviceMetadata:await this.getDeviceMetadata()??void 0,clockDrift:c,username:await this.getLastAuthUser()};return f&&(h.signInDetails=JSON.parse(f)),h}catch{return null}}async storeTokens(t){ZZ(t!==void 0,Am.InvalidAuthTokens);const n=t.username;await this.getKeyValueStorage().setItem(this.getLastAuthUserKey(),n);const r=await this.getAuthKeys();await this.getKeyValueStorage().setItem(r.accessToken,t.accessToken.toString()),t.idToken?await this.getKeyValueStorage().setItem(r.idToken,t.idToken.toString()):await this.getKeyValueStorage().removeItem(r.idToken),t.refreshToken?await this.getKeyValueStorage().setItem(r.refreshToken,t.refreshToken):await this.getKeyValueStorage().removeItem(r.refreshToken),t.deviceMetadata&&(t.deviceMetadata.deviceKey&&await this.getKeyValueStorage().setItem(r.deviceKey,t.deviceMetadata.deviceKey),t.deviceMetadata.deviceGroupKey&&await this.getKeyValueStorage().setItem(r.deviceGroupKey,t.deviceMetadata.deviceGroupKey),await this.getKeyValueStorage().setItem(r.randomPasswordKey,t.deviceMetadata.randomPassword)),t.signInDetails?await this.getKeyValueStorage().setItem(r.signInDetails,JSON.stringify(t.signInDetails)):await this.getKeyValueStorage().removeItem(r.signInDetails),await this.getKeyValueStorage().setItem(r.clockDrift,`${t.clockDrift}`)}async clearTokens(){const t=await this.getAuthKeys();await Promise.all([this.getKeyValueStorage().removeItem(t.accessToken),this.getKeyValueStorage().removeItem(t.idToken),this.getKeyValueStorage().removeItem(t.clockDrift),this.getKeyValueStorage().removeItem(t.refreshToken),this.getKeyValueStorage().removeItem(t.signInDetails),this.getKeyValueStorage().removeItem(this.getLastAuthUserKey()),this.getKeyValueStorage().removeItem(t.oauthMetadata)])}async getDeviceMetadata(t){const n=await this.getAuthKeys(t),r=await this.getKeyValueStorage().getItem(n.deviceKey),o=await this.getKeyValueStorage().getItem(n.deviceGroupKey),s=await this.getKeyValueStorage().getItem(n.randomPasswordKey);return s&&o&&r?{deviceKey:r,deviceGroupKey:o,randomPassword:s}:null}async clearDeviceMetadata(t){const n=await this.getAuthKeys(t);await Promise.all([this.getKeyValueStorage().removeItem(n.deviceKey),this.getKeyValueStorage().removeItem(n.deviceGroupKey),this.getKeyValueStorage().removeItem(n.randomPasswordKey)])}async getAuthKeys(t){We(this.authConfig?.Cognito);const n=t??await this.getLastAuthUser();return QZ(IN,`${this.authConfig.Cognito.userPoolClientId}.${n}`)}getLastAuthUserKey(){We(this.authConfig?.Cognito);const t=this.authConfig.Cognito.userPoolClientId;return`${IN}.${t}.LastAuthUser`}async getLastAuthUser(){return await this.getKeyValueStorage().getItem(this.getLastAuthUserKey())??"username"}async setOAuthMetadata(t){const{oauthMetadata:n}=await this.getAuthKeys();await this.getKeyValueStorage().setItem(n,JSON.stringify(t))}async getOAuthMetadata(){const{oauthMetadata:t}=await this.getAuthKeys(),n=await this.getKeyValueStorage().getItem(t);return n&&JSON.parse(n)}}const QZ=(e,t)=>FA(GZ)(`${e}`,t);function FA(e){const t=Object.values({...e});return(n,r)=>t.reduce((o,s)=>({...o,[s]:`${n}.${r}.${s}`}),{})}const RN="amplify-signin-with-hostedUI",To="CognitoIdentityServiceProvider";class D8{constructor(t){this.keyValueStorage=t}async clearOAuthInflightData(){We(this.cognitoConfig);const t=Oo(To,this.cognitoConfig.userPoolClientId);await Promise.all([this.keyValueStorage.removeItem(t.inflightOAuth),this.keyValueStorage.removeItem(t.oauthPKCE),this.keyValueStorage.removeItem(t.oauthState)])}async clearOAuthData(){We(this.cognitoConfig);const t=Oo(To,this.cognitoConfig.userPoolClientId);return await this.clearOAuthInflightData(),await this.keyValueStorage.removeItem(RN),this.keyValueStorage.removeItem(t.oauthSignIn)}loadOAuthState(){We(this.cognitoConfig);const t=Oo(To,this.cognitoConfig.userPoolClientId);return this.keyValueStorage.getItem(t.oauthState)}storeOAuthState(t){We(this.cognitoConfig);const n=Oo(To,this.cognitoConfig.userPoolClientId);return this.keyValueStorage.setItem(n.oauthState,t)}loadPKCE(){We(this.cognitoConfig);const t=Oo(To,this.cognitoConfig.userPoolClientId);return this.keyValueStorage.getItem(t.oauthPKCE)}storePKCE(t){We(this.cognitoConfig);const n=Oo(To,this.cognitoConfig.userPoolClientId);return this.keyValueStorage.setItem(n.oauthPKCE,t)}setAuthConfig(t){this.cognitoConfig=t}async loadOAuthInFlight(){We(this.cognitoConfig);const t=Oo(To,this.cognitoConfig.userPoolClientId);return await this.keyValueStorage.getItem(t.inflightOAuth)==="true"}async storeOAuthInFlight(t){We(this.cognitoConfig);const n=Oo(To,this.cognitoConfig.userPoolClientId);await this.keyValueStorage.setItem(n.inflightOAuth,`${t}`)}async loadOAuthSignIn(){We(this.cognitoConfig);const t=Oo(To,this.cognitoConfig.userPoolClientId),n=await this.keyValueStorage.getItem(RN),[r,o]=(await this.keyValueStorage.getItem(t.oauthSignIn))?.split(",")??[];return{isOAuthSignIn:r==="true"||n==="true",preferPrivateSession:o==="true"}}async storeOAuthSignIn(t,n=!1){We(this.cognitoConfig);const r=Oo(To,this.cognitoConfig.userPoolClientId);await this.keyValueStorage.setItem(r.oauthSignIn,`${t},${n}`)}}const Oo=(e,t)=>FA(NZ)(e,t),ir=new D8(Jf),__=[],XZ=e=>{__.push(e)},L8=()=>{for(;__.length;)__.pop()?.()};class JZ{constructor(){this.waitForInflightOAuth=Uv()?async()=>{if(await ir.loadOAuthInFlight())return this.inflightPromise?this.inflightPromise:(this.inflightPromise=new Promise((t,n)=>{XZ(t)}),this.inflightPromise)}:async()=>{}}setAuthConfig(t){ir.setAuthConfig(t.Cognito),this.authConfig=t}setTokenRefresher(t){this.tokenRefresher=t}setAuthTokenStore(t){this.tokenStore=t}getTokenStore(){if(!this.tokenStore)throw new Oe({name:"EmptyTokenStoreException",message:"TokenStore not set"});return this.tokenStore}getTokenRefresher(){if(!this.tokenRefresher)throw new Oe({name:"EmptyTokenRefresherException",message:"TokenRefresher not set"});return this.tokenRefresher}setClientMetadataProvider(t){this.clientMetadataProvider=t}async getTokens(t){let n;try{We(this.authConfig?.Cognito)}catch{return null}await this.waitForInflightOAuth(),this.inflightPromise=void 0,n=await this.getTokenStore().loadTokens();const r=await this.getTokenStore().getLastAuthUser();if(n===null)return null;const o=!!n?.idToken&&rN({expiresAt:(n.idToken?.payload?.exp??0)*1e3,clockDrift:n.clockDrift??0}),s=rN({expiresAt:(n.accessToken?.payload?.exp??0)*1e3,clockDrift:n.clockDrift??0});return(t?.forceRefresh||o||s)&&(n=await this.refreshTokens({tokens:n,username:r,clientMetadata:t?.clientMetadata??await this.clientMetadataProvider?.()}),n===null)?null:{accessToken:n?.accessToken,idToken:n?.idToken,signInDetails:n?.signInDetails}}async refreshTokens({tokens:t,username:n,clientMetadata:r}){try{const{signInDetails:o}=t,s=await this.getTokenRefresher()({tokens:t,authConfig:this.authConfig,username:n,clientMetadata:r});return s.signInDetails=o,await this.setTokens({tokens:s}),zo.dispatch("auth",{event:"tokenRefresh"},"Auth",Fo),s}catch(o){return this.handleErrors(o)}}handleErrors(t){if(eo(t),this.isAuthenticationError(t)&&this.clearTokens(),zo.dispatch("auth",{event:"tokenRefresh_failure",data:{error:t}},"Auth",Fo),t.name.startsWith("NotAuthorizedException"))return null;throw t}isAuthenticationError(t){return["NotAuthorizedException","TokenRevokedException","UserNotFoundException","PasswordResetRequiredException","UserNotConfirmedException","RefreshTokenReuseException"].some(r=>t?.name?.startsWith?.(r))}async setTokens({tokens:t}){return this.getTokenStore().storeTokens(t)}async clearTokens(){return this.getTokenStore().clearTokens()}getDeviceMetadata(t){return this.getTokenStore().getDeviceMetadata(t)}clearDeviceMetadata(t){return this.getTokenStore().clearDeviceMetadata(t)}setOAuthMetadata(t){return this.getTokenStore().setOAuthMetadata(t)}getOAuthMetadata(){return this.getTokenStore().getOAuthMetadata()}}class eY{constructor(){this.authTokenStore=new YZ,this.authTokenStore.setKeyValueStorage(Jf),this.tokenOrchestrator=new JZ,this.tokenOrchestrator.setAuthTokenStore(this.authTokenStore),this.tokenOrchestrator.setTokenRefresher(WZ)}getTokens(t={}){return this.tokenOrchestrator.getTokens(t)}setKeyValueStorage(t){this.authTokenStore.setKeyValueStorage(t)}setClientMetadataProvider(t){this.tokenOrchestrator.setClientMetadataProvider(t)}setAuthConfig(t){this.authTokenStore.setAuthConfig(t),this.tokenOrchestrator.setAuthConfig(t)}}const Qg=new eY,{tokenOrchestrator:dr}=Qg;async function js(e){if(e.AccessToken){const t=Ms(e.AccessToken),n=(t.payload.iat||0)*1e3,r=new Date().getTime(),o=n>0?n-r:0;let s,a,u;e.RefreshToken&&(a=e.RefreshToken),e.IdToken&&(s=Ms(e.IdToken)),e?.NewDeviceMetadata&&(u=e.NewDeviceMetadata);const c={accessToken:t,idToken:s,refreshToken:a,clockDrift:o,deviceMetadata:u,username:e.username};e?.signInDetails&&(c.signInDetails=e.signInDetails),await dr.setTokens({tokens:c})}else throw new cr({message:"Invalid tokens",name:"InvalidTokens",recoverySuggestion:"Check Cognito UserPool settings"})}const tY="Unable to get user session following successful sign-in.",Qi=async()=>{try{zo.dispatch("auth",{event:"signedIn",data:await jv()},"Auth",Fo)}catch(e){throw e.name===zv?new Oe({name:TZ,message:tY,recoverySuggestion:"This most likely is due to auth tokens not being persisted. If you are using cookie store, please ensure cookies can be correctly set from your server."}):e}};function U8(){return{active:!1}}const nY=(e,t)=>{switch(t.type){case"SET_USERNAME":return{...e,username:t.value};case"SET_SESSION":return{...e,session:t.value};case"START":return{...e,active:!0};case"RESET":return U8();default:return e}},rY=e=>{let t=e(U8(),{type:"RESET"});return{getState:()=>t,dispatch:n=>{t=e(t,n)}}},Pi=rY(nY),oY=180*1e3,Hp="CognitoSignInState",As={username:`${Hp}.username`,challengeName:`${Hp}.challengeName`,signInSession:`${Hp}.signInSession`,expiry:`${Hp}.expiry`},sY=(e,t)=>{switch(t.type){case"SET_SIGN_IN_SESSION":return qp({signInSession:t.value}),{...e,signInSession:t.value};case"SET_SIGN_IN_STATE":return qp(t.value),{...t.value};case"SET_CHALLENGE_NAME":return qp({challengeName:t.value}),{...e,challengeName:t.value};case"SET_USERNAME":return qp({username:t.value}),{...e,username:t.value};case"SET_INITIAL_STATE":return aY();case"RESET_STATE":return $8(),zA();default:return e}},iY=e=>{const t=Number(e),n=Date.now();return t<=n},bo=()=>{Bo.dispatch({type:"RESET_STATE"})},$8=()=>{for(const e of Object.values(As))xs.removeItem(e)},zA=()=>({username:void 0,challengeName:void 0,signInSession:void 0}),aY=()=>{const e=xs.getItem(As.expiry);if(!e||iY(e))return $8(),zA();const t=xs.getItem(As.username)??void 0,n=xs.getItem(As.challengeName)??void 0,r=xs.getItem(As.signInSession)??void 0;return{username:t,challengeName:n,signInSession:r}},lY=e=>{let t=e(zA(),{type:"SET_INITIAL_STATE"});return{getState:()=>t,dispatch:n=>{t=e(t,n)}}},Bo=lY(sY);function nl(e){Bo.dispatch({type:"SET_SIGN_IN_STATE",value:e})}const qp=({challengeName:e,signInSession:t,username:n})=>{n&&xs.setItem(As.username,n),e&&xs.setItem(As.challengeName,e),t&&(xs.setItem(As.signInSession,t),xs.setItem(As.expiry,String(Date.now()+oY)))},TN="Passkeys may not be supported on this device. Ensure your application is running in a secure context (HTTPS) and Web Authentication API is supported.";class Qr extends cr{constructor(t){super(t),this.constructor=Qr,Object.setPrototypeOf(this,Qr.prototype)}}var It;(function(e){e.PasskeyNotSupported="PasskeyNotSupported",e.PasskeyAlreadyExists="PasskeyAlreadyExists",e.InvalidPasskeyRegistrationOptions="InvalidPasskeyRegistrationOptions",e.InvalidPasskeyAuthenticationOptions="InvalidPasskeyAuthenticationOptions",e.RelyingPartyMismatch="RelyingPartyMismatch",e.PasskeyRegistrationFailed="PasskeyRegistrationFailed",e.PasskeyRetrievalFailed="PasskeyRetrievalFailed",e.PasskeyRegistrationCanceled="PasskeyRegistrationCanceled",e.PasskeyAuthenticationCanceled="PasskeyAuthenticationCanceled",e.PasskeyOperationAborted="PasskeyOperationAborted"})(It||(It={}));const T1="User may have canceled the ceremony or another interruption has occurred. Check underlying error for details.",ON="Ensure your user pool is configured to support the WEB_AUTHN as an authentication factor.",Fu={[It.PasskeyNotSupported]:{message:"Passkeys may not be supported on this device.",recoverySuggestion:TN},[It.InvalidPasskeyRegistrationOptions]:{message:"Invalid passkey registration options.",recoverySuggestion:ON},[It.InvalidPasskeyAuthenticationOptions]:{message:"Invalid passkey authentication options.",recoverySuggestion:ON},[It.PasskeyRegistrationFailed]:{message:"Device failed to create passkey.",recoverySuggestion:TN},[It.PasskeyRetrievalFailed]:{message:"Device failed to retrieve passkey.",recoverySuggestion:"Passkeys may not be available on this device. Try an alternative authentication factor like PASSWORD, EMAIL_OTP, or SMS_OTP."},[It.PasskeyAlreadyExists]:{message:"Passkey already exists in authenticator.",recoverySuggestion:"Proceed with existing passkey or try again after deleting the credential."},[It.PasskeyRegistrationCanceled]:{message:"Passkey registration ceremony has been canceled.",recoverySuggestion:T1},[It.PasskeyAuthenticationCanceled]:{message:"Passkey authentication ceremony has been canceled.",recoverySuggestion:T1},[It.PasskeyOperationAborted]:{message:"Passkey operation has been aborted.",recoverySuggestion:T1},[It.RelyingPartyMismatch]:{message:"Relying party does not match current domain.",recoverySuggestion:"Ensure relying party identifier matches current domain."}},cc=Nv(Fu,Qr),F8=e=>{if(e instanceof Error){if(e.name==="AbortError"){const{message:t,recoverySuggestion:n}=Fu[It.PasskeyOperationAborted];return new Qr({name:It.PasskeyOperationAborted,message:t,recoverySuggestion:n,underlyingError:e})}if(e.name==="SecurityError"){const{message:t,recoverySuggestion:n}=Fu[It.RelyingPartyMismatch];return new Qr({name:It.RelyingPartyMismatch,message:t,recoverySuggestion:n,underlyingError:e})}}return new Qr({name:Fi.Unknown,message:"An unknown error has occurred.",underlyingError:e})},uY=e=>{if(e instanceof Qr)return e;if(e instanceof Error&&e.name==="NotAllowedError"){const{message:t,recoverySuggestion:n}=Fu[It.PasskeyAuthenticationCanceled];return new Qr({name:It.PasskeyAuthenticationCanceled,message:t,recoverySuggestion:n,underlyingError:e})}return F8(e)},z8=()=>Uv()&&window.isSecureContext&&"credentials"in navigator&&typeof window.PublicKeyCredential=="function",Uo=e=>$u.convert(new Uint8Array(e),{urlSafe:!0,skipPadding:!0}),of=e=>Uint8Array.from(kA.convert(e,{urlSafe:!0}),t=>t.charCodeAt(0)).buffer,cY=e=>{const t=of(e.user.id),n=of(e.challenge),r=(e.excludeCredentials||[]).map(o=>({...o,id:of(o.id)}));return{...e,excludeCredentials:r,challenge:n,user:{...e.user,id:t}}},dY=e=>{const t={clientDataJSON:Uo(e.response.clientDataJSON),attestationObject:Uo(e.response.attestationObject),transports:e.response.getTransports(),publicKeyAlgorithm:e.response.getPublicKeyAlgorithm(),authenticatorData:Uo(e.response.getAuthenticatorData())},n=e.response.getPublicKey();n&&(t.publicKey=Uo(n));const r={type:e.type,id:e.id,rawId:Uo(e.rawId),clientExtensionResults:e.getClientExtensionResults(),response:t};return e.authenticatorAttachment&&(r.authenticatorAttachment=e.authenticatorAttachment),r},fY=e=>{const t=of(e.challenge),n=(e.allowCredentials||[]).map(r=>({...r,id:of(r.id)}));return{...e,challenge:t,allowCredentials:n}},hY=e=>{const t={clientDataJSON:Uo(e.response.clientDataJSON),authenticatorData:Uo(e.response.authenticatorData),signature:Uo(e.response.signature)};e.response.userHandle&&(t.userHandle=Uo(e.response.userHandle));const n={id:e.id,rawId:Uo(e.rawId),type:e.type,clientExtensionResults:e.getClientExtensionResults(),response:t};return e.authenticatorAttachment&&(n.authenticatorAttachment=e.authenticatorAttachment),n};function pY(e){cc([!!e,!!e?.challenge,!!e?.user,!!e?.rp,!!e?.pubKeyCredParams].every(Boolean),It.InvalidPasskeyRegistrationOptions)}function gY(e){cc(e&&e instanceof PublicKeyCredential&&e.response instanceof AuthenticatorAttestationResponse,It.PasskeyRegistrationFailed)}function mY(e){cc(e&&e instanceof PublicKeyCredential&&e.response instanceof AuthenticatorAssertionResponse,It.PasskeyRetrievalFailed)}const vY=async e=>{try{const t=z8();cc(t,It.PasskeyNotSupported);const n=fY(e),r=await navigator.credentials.get({publicKey:n});return mY(r),hY(r)}catch(t){throw uY(t)}},yY=e=>fn(xn,_n("ConfirmDevice"),Un(),{...An,...e}),Xg={convert(e){return new TextEncoder().encode(e)}};function be(e,t){e!=null&&this.fromString(e,t)}function Zn(){return new be(null,null)}let Li;const bY=0xdeadbeefcafe,MN=(bY&16777215)===15715070;function SY(e,t,n,r,o,s){for(;--s>=0;){const a=t*this[e++]+n[r]+o;o=Math.floor(a/67108864),n[r++]=a&67108863}return o}function wY(e,t,n,r,o,s){const a=t&32767,u=t>>15;for(;--s>=0;){let c=this[e]&32767;const f=this[e++]>>15,h=u*c+f*a;c=a*c+((h&32767)<<15)+n[r]+(o&1073741823),o=(c>>>30)+(h>>>15)+u*f+(o>>>30),n[r++]=c&1073741823}return o}function CY(e,t,n,r,o,s){const a=t&16383,u=t>>14;for(;--s>=0;){let c=this[e]&16383;const f=this[e++]>>14,h=u*c+f*a;c=a*c+((h&16383)<<14)+n[r]+o,o=(c>>28)+(h>>14)+u*f,n[r++]=c&268435455}return o}const PN=typeof navigator<"u";PN&&MN&&navigator.appName==="Microsoft Internet Explorer"?(be.prototype.am=wY,Li=30):PN&&MN&&navigator.appName!=="Netscape"?(be.prototype.am=SY,Li=26):(be.prototype.am=CY,Li=28);be.prototype.DB=Li;be.prototype.DM=(1<<Li)-1;be.prototype.DV=1<<Li;const jA=52;be.prototype.FV=Math.pow(2,jA);be.prototype.F1=jA-Li;be.prototype.F2=2*Li-jA;const EY="0123456789abcdefghijklmnopqrstuvwxyz",Bv=[];let dc,Kr;dc=48;for(Kr=0;Kr<=9;++Kr)Bv[dc++]=Kr;dc=97;for(Kr=10;Kr<36;++Kr)Bv[dc++]=Kr;dc=65;for(Kr=10;Kr<36;++Kr)Bv[dc++]=Kr;function NN(e){return EY.charAt(e)}function _Y(e,t){const n=Bv[e.charCodeAt(t)];return n??-1}function xY(e){for(let t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function AY(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0}function BA(e){const t=Zn();return t.fromInt(e),t}function IY(e,t){let n;if(t===16)n=4;else if(t===8)n=3;else if(t===2)n=1;else if(t===32)n=5;else if(t===4)n=2;else throw new Error("Only radix 2, 4, 8, 16, 32 are supported");this.t=0,this.s=0;let r=e.length,o=!1,s=0;for(;--r>=0;){const a=_Y(e,r);if(a<0){e.charAt(r)==="-"&&(o=!0);continue}o=!1,s===0?this[this.t++]=a:s+n>this.DB?(this[this.t-1]|=(a&(1<<this.DB-s)-1)<<s,this[this.t++]=a>>this.DB-s):this[this.t-1]|=a<<s,s+=n,s>=this.DB&&(s-=this.DB)}this.clamp(),o&&be.ZERO.subTo(this,this)}function RY(){const e=this.s&this.DM;for(;this.t>0&&this[this.t-1]==e;)--this.t}function TY(e){if(this.s<0)return"-"+this.negate().toString(e);let t;if(e==16)t=4;else if(e===8)t=3;else if(e===2)t=1;else if(e===32)t=5;else if(e===4)t=2;else throw new Error("Only radix 2, 4, 8, 16, 32 are supported");const n=(1<<t)-1;let r,o=!1,s="",a=this.t,u=this.DB-a*this.DB%t;if(a-- >0)for(u<this.DB&&(r=this[a]>>u)>0&&(o=!0,s=NN(r));a>=0;)u<t?(r=(this[a]&(1<<u)-1)<<t-u,r|=this[--a]>>(u+=this.DB-t)):(r=this[a]>>(u-=t)&n,u<=0&&(u+=this.DB,--a)),r>0&&(o=!0),o&&(s+=NN(r));return o?s:"0"}function OY(){const e=Zn();return be.ZERO.subTo(this,e),e}function MY(){return this.s<0?this.negate():this}function PY(e){let t=this.s-e.s;if(t!=0)return t;let n=this.t;if(t=n-e.t,t!=0)return this.s<0?-t:t;for(;--n>=0;)if((t=this[n]-e[n])!=0)return t;return 0}function HA(e){let t=1,n;return(n=e>>>16)!==0&&(e=n,t+=16),(n=e>>8)!==0&&(e=n,t+=8),(n=e>>4)!==0&&(e=n,t+=4),(n=e>>2)!==0&&(e=n,t+=2),(n=e>>1)!==0&&(e=n,t+=1),t}function NY(){return this.t<=0?0:this.DB*(this.t-1)+HA(this[this.t-1]^this.s&this.DM)}function kY(e,t){let n;for(n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s}function DY(e,t){for(let n=e;n<this.t;++n)t[n-e]=this[n];t.t=Math.max(this.t-e,0),t.s=this.s}function LY(e,t){const n=e%this.DB,r=this.DB-n,o=(1<<r)-1,s=Math.floor(e/this.DB);let a=this.s<<n&this.DM,u;for(u=this.t-1;u>=0;--u)t[u+s+1]=this[u]>>r|a,a=(this[u]&o)<<n;for(u=s-1;u>=0;--u)t[u]=0;t[s]=a,t.t=this.t+s+1,t.s=this.s,t.clamp()}function UY(e,t){t.s=this.s;const n=Math.floor(e/this.DB);if(n>=this.t){t.t=0;return}const r=e%this.DB,o=this.DB-r,s=(1<<r)-1;t[0]=this[n]>>r;for(let a=n+1;a<this.t;++a)t[a-n-1]|=(this[a]&s)<<o,t[a-n]=this[a]>>r;r>0&&(t[this.t-n-1]|=(this.s&s)<<o),t.t=this.t-n,t.clamp()}function $Y(e,t){let n=0,r=0;const o=Math.min(e.t,this.t);for(;n<o;)r+=this[n]-e[n],t[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r-=e.s;n<this.t;)r+=this[n],t[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<e.t;)r-=e[n],t[n++]=r&this.DM,r>>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t[n++]=this.DV+r:r>0&&(t[n++]=r),t.t=n,t.clamp()}function FY(e,t){const n=this.abs(),r=e.abs();let o=n.t;for(t.t=o+r.t;--o>=0;)t[o]=0;for(o=0;o<r.t;++o)t[o+n.t]=n.am(0,r[o],t,o,0,n.t);t.s=0,t.clamp(),this.s!==e.s&&be.ZERO.subTo(t,t)}function zY(e){const t=this.abs();let n=e.t=2*t.t;for(;--n>=0;)e[n]=0;for(n=0;n<t.t-1;++n){const r=t.am(n,t[n],e,2*n,0,1);(e[n+t.t]+=t.am(n+1,2*t[n],e,2*n+1,r,t.t-n-1))>=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()}function jY(e,t,n){const r=e.abs();if(r.t<=0)return;const o=this.abs();if(o.t<r.t){t?.fromInt(0),n!=null&&this.copyTo(n);return}n===null&&(n=Zn());const s=Zn(),a=this.s,u=e.s,c=this.DB-HA(r[r.t-1]);c>0?(r.lShiftTo(c,s),o.lShiftTo(c,n)):(r.copyTo(s),o.copyTo(n));const f=s.t,h=s[f-1];if(h===0)return;const g=h*(1<<this.F1)+(f>1?s[f-2]>>this.F2:0),m=this.FV/g,v=(1<<this.F1)/g,w=1<<this.F2;let S=n.t,C=S-f;const E=t===null?Zn():t;for(s.dlShiftTo(C,E),n.compareTo(E)>=0&&(n[n.t++]=1,n.subTo(E,n)),be.ONE.dlShiftTo(f,E),E.subTo(s,s);s.t<f;)s[s.t++]=0;for(;--C>=0;){let A=n[--S]===h?this.DM:Math.floor(n[S]*m+(n[S-1]+w)*v);if((n[S]+=s.am(0,A,n,C,0,f))<A)for(s.dlShiftTo(C,E),n.subTo(E,n);n[S]<--A;)n.subTo(E,n)}t!==null&&(n.drShiftTo(f,t),a!==u&&be.ZERO.subTo(t,t)),n.t=f,n.clamp(),c>0&&n.rShiftTo(c,n),a<0&&be.ZERO.subTo(n,n)}function BY(e){const t=Zn();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(be.ZERO)>0&&e.subTo(t,t),t}function HY(){if(this.t<1)return 0;const e=this[0];if((e&1)===0)return 0;let t=e&3;return t=t*(2-(e&15)*t)&15,t=t*(2-(e&255)*t)&255,t=t*(2-((e&65535)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function qY(e){return this.compareTo(e)===0}function VY(e,t){let n=0,r=0;const o=Math.min(e.t,this.t);for(;n<o;)r+=this[n]+e[n],t[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r+=e.s;n<this.t;)r+=this[n],t[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<e.t;)r+=e[n],t[n++]=r&this.DM,r>>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t[n++]=r:r<-1&&(t[n++]=this.DV+r),t.t=n,t.clamp()}function WY(e){const t=Zn();return this.addTo(e,t),t}function GY(e){const t=Zn();return this.subTo(e,t),t}function KY(e){const t=Zn();return this.multiplyTo(e,t),t}function ZY(e){const t=Zn();return this.divRemTo(e,t,null),t}function fc(e){this.m=e,this.mp=e.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function YY(e){const t=Zn();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(be.ZERO)>0&&this.m.subTo(t,t),t}function QY(e){const t=Zn();return e.copyTo(t),this.reduce(t),t}function XY(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(let t=0;t<this.m.t;++t){let n=e[t]&32767;const r=n*this.mpl+((n*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(n=t+this.m.t,e[n]+=this.m.am(0,r,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function JY(e,t){e.squareTo(t),this.reduce(t)}function eQ(e,t,n){e.multiplyTo(t,n),this.reduce(n)}fc.prototype.convert=YY;fc.prototype.revert=QY;fc.prototype.reduce=XY;fc.prototype.mulTo=eQ;fc.prototype.sqrTo=JY;function tQ(e,t,n){let r=e.bitLength(),o,s=BA(1);const a=new fc(t);if(r<=0)return s;r<18?o=1:r<48?o=3:r<144?o=4:r<768?o=5:o=6;const u=[];let c=3;const f=o-1,h=(1<<o)-1;if(u[1]=a.convert(this),o>1){const E=Zn();for(a.sqrTo(u[1],E);c<=h;)u[c]=Zn(),a.mulTo(E,u[c-2],u[c]),c+=2}let g=e.t-1,m,v=!0,w=Zn(),S;for(r=HA(e[g])-1;g>=0;){for(r>=f?m=e[g]>>r-f&h:(m=(e[g]&(1<<r+1)-1)<<f-r,g>0&&(m|=e[g-1]>>this.DB+r-f)),c=o;(m&1)===0;)m>>=1,--c;if((r-=c)<0&&(r+=this.DB,--g),v)u[m].copyTo(s),v=!1;else{for(;c>1;)a.sqrTo(s,w),a.sqrTo(w,s),c-=2;c>0?a.sqrTo(s,w):(S=s,s=w,w=S),a.mulTo(w,u[m],s)}for(;g>=0&&(e[g]&1<<r)===0;)a.sqrTo(s,w),S=s,s=w,w=S,--r<0&&(r=this.DB-1,--g)}const C=a.revert(s);return n(null,C),C}be.prototype.copyTo=xY;be.prototype.fromInt=AY;be.prototype.fromString=IY;be.prototype.clamp=RY;be.prototype.dlShiftTo=kY;be.prototype.drShiftTo=DY;be.prototype.lShiftTo=LY;be.prototype.rShiftTo=UY;be.prototype.subTo=$Y;be.prototype.multiplyTo=FY;be.prototype.squareTo=zY;be.prototype.divRemTo=jY;be.prototype.invDigit=HY;be.prototype.addTo=VY;be.prototype.toString=TY;be.prototype.negate=OY;be.prototype.abs=MY;be.prototype.compareTo=PY;be.prototype.bitLength=NY;be.prototype.mod=BY;be.prototype.equals=qY;be.prototype.add=WY;be.prototype.subtract=GY;be.prototype.multiply=KY;be.prototype.divide=ZY;be.prototype.modPow=tQ;be.ZERO=BA(0);be.ONE=BA(1);const nQ=async({a:e,g:t,k:n,x:r,B:o,N:s,U:a})=>new Promise((u,c)=>{t.modPow(r,s,(f,h)=>{if(f){c(f);return}o.subtract(n.multiply(h)).modPow(e.add(a.multiply(r)),s,(g,m)=>{if(g){c(g);return}u(m.mod(s))})})}),rQ="FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF",j8={},x_={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();t.length===1&&(t=`0${t}`),j8[e]=t,x_[t]=e}const zu=e=>{if(e.length%2!==0)throw new Error("Hex encoded strings must have an even number length");const t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2){const r=e.slice(n,n+2).toLowerCase();if(r in x_)t[n/2]=x_[r];else throw new Error(`Cannot decode unrecognized sequence ${r} as hexadecimal`)}return t},qA=e=>{let t="";for(let n=0;n<e.byteLength;n++)t+=j8[e[n]];return t},A_=e=>{const t=new qa;t.update(e);const n=t.digestSync(),r=qA(n);return new Array(64-r.length).join("0")+r},Jg=e=>A_(zu(e)),oQ=/^[89a-f]/i,Cs=e=>{if(!(e instanceof be))throw new Error("Not a BigInteger");const t=e.compareTo(be.ZERO)<0;let n=e.abs().toString(16);if(n=n.length%2!==0?`0${n}`:n,n=oQ.test(n)?`00${n}`:n,t){const r=n.split("").map(s=>{const a=~parseInt(s,16)&15;return"0123456789ABCDEF".charAt(a)}).join("");n=new be(r,16).add(be.ONE).toString(16),n.toUpperCase().startsWith("FF8")&&(n=n.substring(2))}return n},sQ=({A:e,B:t})=>{const n=new be(Jg(Cs(e)+Cs(t)),16);if(n.equals(be.ZERO))throw new Error("U cannot be zero.");return n},iQ=(e,t,n)=>{const r=new qa(t);r.update(e);const o=r.digestSync(),s=new qa(o);return s.update(n),s.digestSync().slice(0,16)},VA=e=>{const t=new $A().random(e).toString();return zu(t)},aQ=()=>$u.convert(VA(40));class lQ{constructor({userPoolName:t,a:n,g:r,A:o,N:s}){this.encoder=Xg,this.userPoolName=t,this.a=n,this.g=r,this.A=o,this.N=s,this.k=new be(Jg(`${Cs(s)}${Cs(r)}`),16)}getRandomPassword(){if(!this.randomPassword)throw new Oe({name:"EmptyBigIntegerRandomPassword",message:"random password is empty"});return this.randomPassword}getSaltToHashDevices(){if(!this.saltToHashDevices)throw new Oe({name:"EmptyBigIntegersaltToHashDevices",message:"saltToHashDevices is empty"});return this.saltToHashDevices}getVerifierDevices(){if(!this.verifierDevices)throw new Oe({name:"EmptyBigIntegerVerifierDevices",message:"verifyDevices is empty"});return this.verifierDevices}async generateHashDevice(t,n){this.randomPassword=aQ();const r=`${t}${n}:${this.randomPassword}`,o=A_(r),s=qA(VA(16));return this.saltToHashDevices=Cs(new be(s,16)),new Promise((a,u)=>{this.g.modPow(new be(Jg(this.saltToHashDevices+o),16),this.N,(c,f)=>{if(c){u(c);return}this.verifierDevices=Cs(f),a()})})}async getPasswordAuthenticationKey({username:t,password:n,serverBValue:r,salt:o}){if(r.mod(this.N).equals(be.ZERO))throw new Error("B cannot be zero.");const s=sQ({A:this.A,B:r}),a=`${this.userPoolName}${t}:${n}`,u=A_(a),c=new be(Jg(Cs(o)+u),16),f=await nQ({a:this.a,g:this.g,k:this.k,x:c,B:r,N:this.N,U:s}),h=this.encoder.convert("Caldera Derived Key"),g=this.encoder.convert(""),m=new Uint8Array(h.byteLength+g.byteLength);return m.set(h,0),m.set(g,h.byteLength),iQ(zu(Cs(f)),zu(Cs(s)),m)}}const uQ=async({a:e,g:t,N:n})=>new Promise((r,o)=>{t.modPow(e,n,(s,a)=>{if(s){o(s);return}if(a.mod(n).equals(be.ZERO)){o(new Error("Illegal parameter. A mod N cannot be 0."));return}r(a)})}),th=async e=>{const t=new be(rQ,16),n=new be("2",16),r=cQ(),o=await uQ({a:r,g:n,N:t});return new lQ({userPoolName:e,a:r,g:n,A:o,N:t})},cQ=()=>{const e=qA(VA(128));return new be(e,16)};async function rl({userPoolId:e,userPoolEndpoint:t,newDeviceMetadata:n,accessToken:r}){if(!n)return;const o=e.split("_")[1]||"",s=await th(o),a=n?.DeviceKey,u=n?.DeviceGroupKey;try{await s.generateHashDevice(u??"",a??"")}catch{return}const c={Salt:$u.convert(zu(s.getSaltToHashDevices())),PasswordVerifier:$u.convert(zu(s.getVerifierDevices()))},f=s.getRandomPassword();try{return await yY({endpointResolver:rt({endpointOverride:t})})({region:nt(e)},{AccessToken:r,DeviceName:await pZ(),DeviceKey:n?.DeviceKey,DeviceSecretVerifierConfig:c}),{deviceKey:a,deviceGroupKey:u,randomPassword:f}}catch{return}}async function dQ(e){const t=Tt.getConfig().Auth?.Cognito;We(t);const{username:n,signInSession:r,signInDetails:o,challengeName:s}=Bo.getState();if(s!=="WEB_AUTHN"||!n)throw new Oe({name:jo.SignInException,message:"Unable to proceed due to invalid sign in state."});const{CREDENTIAL_REQUEST_OPTIONS:a}=e;cc(!!a,It.InvalidPasskeyAuthenticationOptions);const u=await vY(JSON.parse(a)),c=Tr({endpointResolver:rt({endpointOverride:t.userPoolEndpoint})}),{ChallengeName:f,ChallengeParameters:h,AuthenticationResult:g,Session:m}=await c({region:nt(t.userPoolId),userAgentValue:vt($e.ConfirmSignIn)},{ChallengeName:"WEB_AUTHN",ChallengeResponses:{USERNAME:n,CREDENTIAL:JSON.stringify(u)},ClientId:t.userPoolClientId,Session:r});if(nl({signInSession:m,username:n,challengeName:f,signInDetails:o}),g)return await js({...g,username:n,NewDeviceMetadata:await rl({userPoolId:t.userPoolId,userPoolEndpoint:t.userPoolEndpoint,newDeviceMetadata:g.NewDeviceMetadata,accessToken:g.AccessToken}),signInDetails:o}),Bo.dispatch({type:"RESET_STATE"}),await Qi(),{isSignedIn:!0,nextStep:{signInStep:"DONE"}};if(f==="WEB_AUTHN")throw new Oe({name:jo.SignInException,message:"Sequential WEB_AUTHN challenges returned from underlying service cannot be handled."});return{challengeName:f,challengeParameters:h}}function In({username:e,userPoolId:t,userPoolClientId:n}){if(typeof window>"u")return;const r=window.AmazonCognitoAdvancedSecurityData;if(typeof r>"u")return;const o=r.getData(e,t,n);return o?{EncodedData:o}:{}}const fQ=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],hQ=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],B8=()=>{const e=new Date,t=hQ[e.getUTCDay()],n=fQ[e.getUTCMonth()],r=e.getUTCDate();let o=e.getUTCHours();o<10&&(o=`0${o}`);let s=e.getUTCMinutes();s<10&&(s=`0${s}`);let a=e.getUTCSeconds();a<10&&(a=`0${a}`);const u=e.getUTCFullYear();return`${t} ${n} ${r} ${o}:${s}:${a} UTC ${u}`},H8=({userPoolName:e,username:t,challengeParameters:n,dateNow:r,hkdf:o})=>{const s=Xg.convert(e),a=Xg.convert(t),u=pQ(n.SECRET_BLOCK),c=Xg.convert(r),f=new Uint8Array(s.byteLength+a.byteLength+u.byteLength+c.byteLength);f.set(s,0),f.set(a,s.byteLength),f.set(u,s.byteLength+a.byteLength),f.set(c,s.byteLength+a.byteLength+u.byteLength);const h=new qa(o);h.update(f);const g=h.digestSync();return $u.convert(g)},pQ=e=>{const t="=".repeat((4-e.length%4)%4),n=(e+t).replace(/-/g,"+").replace(/_/g,"/"),r=kA.convert(n),o=new Uint8Array(r.length);for(let s=0;s<r.length;++s)o[s]=r.charCodeAt(s);return o};async function nh({username:e,config:t,clientMetadata:n,session:r,tokenOrchestrator:o}){const{userPoolId:s,userPoolEndpoint:a}=t,u=t.userPoolClientId,c=await o?.getDeviceMetadata(e);P8(c);const f=await th(c.deviceGroupKey),h={USERNAME:e,SRP_A:f.A.toString(16),DEVICE_KEY:c.deviceKey},g={ChallengeName:"DEVICE_SRP_AUTH",ClientId:u,ChallengeResponses:h,ClientMetadata:n,Session:r},m=Tr({endpointResolver:rt({endpointOverride:a})}),{ChallengeParameters:v,Session:w}=await m({region:nt(s)},g);return gQ(e,v,n,w,f,t,o)}async function gQ(e,t,n,r,o,{userPoolId:s,userPoolClientId:a,userPoolEndpoint:u},c){const f=await c?.getDeviceMetadata(e);P8(f);const h=new be(t?.SRP_B,16),g=new be(t?.SALT,16),{deviceKey:m}=f,{deviceGroupKey:v}=f,w=await o.getPasswordAuthenticationKey({username:f.deviceKey,password:f.randomPassword,serverBValue:h,salt:g}),S=B8(),C={USERNAME:t?.USERNAME??e,PASSWORD_CLAIM_SECRET_BLOCK:t?.SECRET_BLOCK,TIMESTAMP:S,PASSWORD_CLAIM_SIGNATURE:H8({username:m,userPoolName:v,challengeParameters:t,dateNow:S,hkdf:w}),DEVICE_KEY:m},E=In({username:e,userPoolId:s,userPoolClientId:a}),A={ChallengeName:"DEVICE_PASSWORD_VERIFIER",ClientId:a,ChallengeResponses:C,Session:r,ClientMetadata:n,UserContextData:E};return Tr({endpointResolver:rt({endpointOverride:u})})({region:nt(s)},A)}async function WA(e,t,n,r,o,s,a){const{userPoolId:u,userPoolClientId:c,userPoolEndpoint:f}=s,h=u?.split("_")[1]||"",g=new be(t?.SRP_B,16),m=new be(t?.SALT,16),v=t?.USER_ID_FOR_SRP;if(!v)throw new Oe({name:"EmptyUserIdForSRPException",message:"USER_ID_FOR_SRP was not found in challengeParameters"});const w=await o.getPasswordAuthenticationKey({username:v,password:e,serverBValue:g,salt:m}),S=B8(),C={USERNAME:v,PASSWORD_CLAIM_SECRET_BLOCK:t?.SECRET_BLOCK,TIMESTAMP:S,PASSWORD_CLAIM_SIGNATURE:H8({username:v,userPoolName:h,challengeParameters:t,dateNow:S,hkdf:w})},E=await a.getDeviceMetadata(v);E&&E.deviceKey&&(C.DEVICE_KEY=E.deviceKey);const A=In({username:v,userPoolId:u,userPoolClientId:c}),I={ChallengeName:"PASSWORD_VERIFIER",ChallengeResponses:C,ClientMetadata:n,Session:r,ClientId:c,UserContextData:A},N=await Tr({endpointResolver:rt({endpointOverride:f})})({region:nt(u)},I);return N.ChallengeName==="DEVICE_SRP_AUTH"?nh({username:v,config:s,clientMetadata:n,session:N.Session,tokenOrchestrator:a}):N}async function hc(e,t,n,r){try{return await e(...t)}catch(o){if(o instanceof Oe&&o.name==="ResourceNotFoundException"&&o.message.includes("Device does not exist."))return await r.clearDeviceMetadata(n),e(...t);throw o}}function ol(e){const{dispatch:t}=Bo;t({type:"SET_USERNAME",value:e})}async function q8({username:e,password:t,clientMetadata:n,config:r,tokenOrchestrator:o,authFlow:s,preferredChallenge:a}){const{userPoolId:u,userPoolClientId:c,userPoolEndpoint:f}=r,h=u?.split("_")[1]||"",g=await th(h),m={USERNAME:e,SRP_A:g.A.toString(16)};s==="USER_AUTH"&&a&&(m.PREFERRED_CHALLENGE=a);const v=In({username:e,userPoolId:u,userPoolClientId:c}),w={AuthFlow:s,AuthParameters:m,ClientMetadata:n,ClientId:c,UserContextData:v},C=await eh({endpointResolver:rt({endpointOverride:f})})({region:nt(u),userAgentValue:vt($e.SignIn)},w),{ChallengeParameters:E,Session:A}=C,I=E?.USERNAME??e;return ol(I),C.ChallengeName==="PASSWORD_VERIFIER"?hc(WA,[t,E,n,A,g,r,o],I,o):C}async function mQ({username:e,session:t,selectedChallenge:n,config:r,clientMetadata:o}){return Tr({endpointResolver:rt({endpointOverride:r.userPoolEndpoint})})({region:nt(r.userPoolId),userAgentValue:vt($e.ConfirmSignIn)},{ChallengeName:"SELECT_CHALLENGE",ChallengeResponses:{USERNAME:e,ANSWER:n},ClientId:r.userPoolClientId,Session:t,ClientMetadata:o})}async function vQ(e,t,n,r,o){const{userPoolId:s,userPoolClientId:a,userPoolEndpoint:u}=r,c={ANSWER:"PASSWORD",USERNAME:e,PASSWORD:t},f=In({username:e,userPoolId:s,userPoolClientId:a}),g=await Tr({endpointResolver:rt({endpointOverride:u})})({region:nt(s),userAgentValue:vt($e.ConfirmSignIn)},{ChallengeName:"SELECT_CHALLENGE",ChallengeResponses:c,ClientId:a,ClientMetadata:n,Session:o,UserContextData:f}),m=g.ChallengeParameters?.USERNAME??e;return ol(m),g}async function yQ(e,t,n,r,o,s){const{userPoolId:a,userPoolClientId:u,userPoolEndpoint:c}=r,f=a.split("_")[1]||"",h=await th(f),g={ANSWER:"PASSWORD_SRP",USERNAME:e,SRP_A:h.A.toString(16)},m=In({username:e,userPoolId:a,userPoolClientId:u}),w=await Tr({endpointResolver:rt({endpointOverride:c})})({region:nt(a),userAgentValue:vt($e.ConfirmSignIn)},{ChallengeName:"SELECT_CHALLENGE",ChallengeResponses:g,ClientId:u,ClientMetadata:n,Session:o,UserContextData:m}),S=w.ChallengeParameters?.USERNAME??e;return ol(S),w.ChallengeName==="PASSWORD_VERIFIER"?hc(WA,[t,w.ChallengeParameters,n,w.Session,h,r,s],S,s):w}const I_="userAttributes.";function bQ(e){return"isSignedIn"in e&&"nextStep"in e}async function SQ({challengeResponse:e,clientMetadata:t,session:n,username:r,config:o,tokenOrchestrator:s}){const{userPoolId:a,userPoolClientId:u,userPoolEndpoint:c}=o,f={USERNAME:r,ANSWER:e},h=await s?.getDeviceMetadata(r);h&&h.deviceKey&&(f.DEVICE_KEY=h.deviceKey);const g=In({username:r,userPoolId:a,userPoolClientId:u}),m={ChallengeName:"CUSTOM_CHALLENGE",ChallengeResponses:f,Session:n,ClientMetadata:t,ClientId:u,UserContextData:g},w=await Tr({endpointResolver:rt({endpointOverride:c})})({region:nt(a),userAgentValue:vt($e.ConfirmSignIn)},m);return w.ChallengeName==="DEVICE_SRP_AUTH"?nh({username:r,config:o,clientMetadata:t,session:w.Session,tokenOrchestrator:s}):w}async function wQ({challengeResponse:e,username:t,clientMetadata:n,session:r,deviceName:o,config:s}){const{userPoolId:a,userPoolClientId:u,userPoolEndpoint:c}=s;if(e==="EMAIL")return{ChallengeName:"MFA_SETUP",Session:r,ChallengeParameters:{MFAS_CAN_SETUP:'["EMAIL_OTP"]'},$metadata:{}};if(e==="TOTP")return{ChallengeName:"MFA_SETUP",Session:r,ChallengeParameters:{MFAS_CAN_SETUP:'["SOFTWARE_TOKEN_MFA"]'},$metadata:{}};const f={USERNAME:t};if(/^\d+$/.test(e)){const m=jZ({endpointResolver:rt({endpointOverride:c})}),{Session:v}=await m({region:nt(a),userAgentValue:vt($e.ConfirmSignIn)},{UserCode:e,Session:r,FriendlyDeviceName:o});Bo.dispatch({type:"SET_SIGN_IN_SESSION",value:v});const w={ChallengeName:"MFA_SETUP",ChallengeResponses:f,Session:v,ClientMetadata:n,ClientId:u};return Tr({endpointResolver:rt({endpointOverride:c})})({region:nt(a),userAgentValue:vt($e.ConfirmSignIn)},w)}if(e.includes("@")){f.EMAIL=e;const m={ChallengeName:"MFA_SETUP",ChallengeResponses:f,Session:r,ClientMetadata:n,ClientId:u};return Tr({endpointResolver:rt({endpointOverride:c})})({region:nt(a),userAgentValue:vt($e.ConfirmSignIn)},m)}throw new Oe({name:jo.SignInException,message:`Cannot proceed with MFA setup using challengeResponse: ${e}`,recoverySuggestion:'Try passing "EMAIL", "TOTP", a valid email, or OTP code as the challengeResponse.'})}async function CQ({challengeResponse:e,username:t,clientMetadata:n,session:r,config:o}){const{userPoolId:s,userPoolClientId:a,userPoolEndpoint:u}=o;Kt(e==="TOTP"||e==="SMS"||e==="EMAIL",Ue.IncorrectMFAMethod);const c={USERNAME:t,ANSWER:PQ(e)},f=In({username:t,userPoolId:s,userPoolClientId:a}),h={ChallengeName:"SELECT_MFA_TYPE",ChallengeResponses:c,Session:r,ClientMetadata:n,ClientId:a,UserContextData:f};return Tr({endpointResolver:rt({endpointOverride:u})})({region:nt(s),userAgentValue:vt($e.ConfirmSignIn)},h)}async function EQ({challengeResponse:e,clientMetadata:t,session:n,username:r,requiredAttributes:o,config:s}){const{userPoolId:a,userPoolClientId:u,userPoolEndpoint:c}=s,f={...OQ(o),NEW_PASSWORD:e,USERNAME:r},h=In({username:r,userPoolId:a,userPoolClientId:u}),g={ChallengeName:"NEW_PASSWORD_REQUIRED",ChallengeResponses:f,ClientMetadata:t,Session:n,ClientId:u,UserContextData:h};return Tr({endpointResolver:rt({endpointOverride:c})})({region:nt(a),userAgentValue:vt($e.ConfirmSignIn)},g)}async function _Q(e,t,n,r,o){const{userPoolClientId:s,userPoolId:a,userPoolEndpoint:u}=r,c={USERNAME:e,PASSWORD:t},f=await o.getDeviceMetadata(e);f&&f.deviceKey&&(c.DEVICE_KEY=f.deviceKey);const h=In({username:e,userPoolId:a,userPoolClientId:s}),g={AuthFlow:"USER_PASSWORD_AUTH",AuthParameters:c,ClientMetadata:n,ClientId:s,UserContextData:h},v=await eh({endpointResolver:rt({endpointOverride:u})})({region:nt(a),userAgentValue:vt($e.SignIn)},g),w=v.ChallengeParameters?.USERNAME??v.ChallengeParameters?.USER_ID_FOR_SRP??e;return ol(w),v.ChallengeName==="DEVICE_SRP_AUTH"?nh({username:w,config:r,clientMetadata:n,session:v.Session,tokenOrchestrator:o}):v}async function xQ(e,t,n,r,o){return q8({username:e,password:t,clientMetadata:n,config:r,tokenOrchestrator:o,authFlow:"USER_SRP_AUTH"})}async function AQ(e,t,n,r){const{userPoolClientId:o,userPoolId:s,userPoolEndpoint:a}=n,u={USERNAME:e},c=await r.getDeviceMetadata(e);c&&c.deviceKey&&(u.DEVICE_KEY=c.deviceKey);const f=In({username:e,userPoolId:s,userPoolClientId:o}),h={AuthFlow:"CUSTOM_AUTH",AuthParameters:u,ClientMetadata:t,ClientId:o,UserContextData:f},m=await eh({endpointResolver:rt({endpointOverride:a})})({region:nt(s),userAgentValue:vt($e.SignIn)},h),v=m.ChallengeParameters?.USERNAME??e;return ol(v),m.ChallengeName==="DEVICE_SRP_AUTH"?nh({username:v,config:n,clientMetadata:t,session:m.Session,tokenOrchestrator:r}):m}async function IQ(e,t,n,r,o){We(r);const{userPoolId:s,userPoolClientId:a,userPoolEndpoint:u}=r,c=s?.split("_")[1]||"",f=await th(c),h={USERNAME:e,SRP_A:f.A.toString(16),CHALLENGE_NAME:"SRP_A"},g=In({username:e,userPoolId:s,userPoolClientId:a}),m={AuthFlow:"CUSTOM_AUTH",AuthParameters:h,ClientMetadata:n,ClientId:a,UserContextData:g},v=eh({endpointResolver:rt({endpointOverride:u})}),{ChallengeParameters:w,Session:S}=await v({region:nt(s),userAgentValue:vt($e.SignIn)},m),C=w?.USERNAME??e;return ol(C),hc(WA,[t,w,n,S,f,r,o],C,o)}async function sl(e){const{challengeName:t,challengeParameters:n,availableChallenges:r}=e,o=Tt.getConfig().Auth?.Cognito;switch(We(o),t){case"CUSTOM_CHALLENGE":return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_IN_WITH_CUSTOM_CHALLENGE",additionalInfo:n}};case"MFA_SETUP":{const{signInSession:s,username:a}=Bo.getState(),u=kN(DN(n.MFAS_CAN_SETUP))||[],c=kQ(u),f=c.includes("TOTP"),h=c.includes("EMAIL");if(f&&h)return{isSignedIn:!1,nextStep:{signInStep:"CONTINUE_SIGN_IN_WITH_MFA_SETUP_SELECTION",allowedMFATypes:c}};if(h)return{isSignedIn:!1,nextStep:{signInStep:"CONTINUE_SIGN_IN_WITH_EMAIL_SETUP"}};if(f){const g=BZ({endpointResolver:rt({endpointOverride:o.userPoolEndpoint})}),{Session:m,SecretCode:v}=await g({region:nt(o.userPoolId)},{Session:s});return Bo.dispatch({type:"SET_SIGN_IN_SESSION",value:m}),{isSignedIn:!1,nextStep:{signInStep:"CONTINUE_SIGN_IN_WITH_TOTP_SETUP",totpSetupDetails:RQ(v,a)}}}throw new Oe({name:jo.SignInException,message:`Cannot initiate MFA setup from available types: ${u}`})}case"NEW_PASSWORD_REQUIRED":return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_IN_WITH_NEW_PASSWORD_REQUIRED",missingAttributes:TQ(n.requiredAttributes)}};case"SELECT_MFA_TYPE":return{isSignedIn:!1,nextStep:{signInStep:"CONTINUE_SIGN_IN_WITH_MFA_SELECTION",allowedMFATypes:kN(DN(n.MFAS_CAN_CHOOSE))}};case"SMS_OTP":case"SMS_MFA":return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_IN_WITH_SMS_CODE",codeDeliveryDetails:{deliveryMedium:n.CODE_DELIVERY_DELIVERY_MEDIUM,destination:n.CODE_DELIVERY_DESTINATION}}};case"SOFTWARE_TOKEN_MFA":return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_IN_WITH_TOTP_CODE"}};case"EMAIL_OTP":return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_IN_WITH_EMAIL_CODE",codeDeliveryDetails:{deliveryMedium:n.CODE_DELIVERY_DELIVERY_MEDIUM,destination:n.CODE_DELIVERY_DESTINATION}}};case"WEB_AUTHN":{const s=await dQ(n);return bQ(s)?s:sl(s)}case"PASSWORD":case"PASSWORD_SRP":return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_IN_WITH_PASSWORD"}};case"SELECT_CHALLENGE":return{isSignedIn:!1,nextStep:{signInStep:"CONTINUE_SIGN_IN_WITH_FIRST_FACTOR_SELECTION",availableChallenges:r}}}throw new Oe({name:jo.SignInException,message:`An error occurred during the sign in process. ${t} challengeName returned by the underlying service was not addressed.`})}function RQ(e,t){return{sharedSecret:e,getSetupUri:(n,r)=>{const o=`otpauth://totp/${n}:${r??t}?secret=${e}&issuer=${n}`;return new Yi(o)}}}function pc(e){if(e===xm.PasswordResetRequiredException)return{isSignedIn:!1,nextStep:{signInStep:"RESET_PASSWORD"}};if(e===xm.UserNotConfirmedException)return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_UP"}}}function TQ(e){return e?JSON.parse(e).map(n=>n.includes(I_)?n.replace(I_,""):n):[]}function OQ(e){if(!e)return{};const t={};return Object.entries(e).forEach(([n,r])=>{r&&(t[`${I_}${n}`]=r)}),t}async function MQ(e,t,n,r,o,s,a,u){const c=u?.userAttributes,f=u?.friendlyDeviceName;switch(t){case"WEB_AUTHN":case"SELECT_CHALLENGE":return r==="PASSWORD_SRP"||r==="PASSWORD"?{ChallengeName:r,Session:n,$metadata:{}}:mQ({username:e,session:n,selectedChallenge:r,config:o,clientMetadata:a});case"SELECT_MFA_TYPE":return CQ({challengeResponse:r,clientMetadata:a,session:n,username:e,config:o});case"MFA_SETUP":return wQ({challengeResponse:r,clientMetadata:a,session:n,username:e,deviceName:f,config:o});case"NEW_PASSWORD_REQUIRED":return EQ({challengeResponse:r,clientMetadata:a,session:n,username:e,requiredAttributes:c,config:o});case"CUSTOM_CHALLENGE":return hc(SQ,[{challengeResponse:r,clientMetadata:a,session:n,username:e,config:o,tokenOrchestrator:s}],e,s);case"SMS_MFA":case"SOFTWARE_TOKEN_MFA":case"SMS_OTP":case"EMAIL_OTP":return DQ({challengeName:t,challengeResponse:r,clientMetadata:a,session:n,username:e,config:o,tokenOrchestrator:s});case"PASSWORD":return vQ(e,r,a,o,n);case"PASSWORD_SRP":return yQ(e,r,a,o,n,s)}throw new Oe({name:jo.SignInException,message:`An error occurred during the sign in process.
|
|
@@ -9,7 +9,7 @@ function r8(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&
|
|
|
9
9
|
1. signIn was not called before confirmSignIn.
|
|
10
10
|
2. signIn threw an exception.
|
|
11
11
|
3. page was refreshed during the sign in flow and session has expired.
|
|
12
|
-
`,recoverySuggestion:"Make sure a successful call to signIn is made before calling confirmSignInand that the session has not expired."});try{const{Session:f,ChallengeName:h,AuthenticationResult:g,ChallengeParameters:m}=await MQ(r,o,s,t,u,dr,c,n);return nl({signInSession:f,username:r,challengeName:h,signInDetails:a}),g?(await js({username:r,...g,NewDeviceMetadata:await rl({userPoolId:u.userPoolId,userPoolEndpoint:u.userPoolEndpoint,newDeviceMetadata:g.NewDeviceMetadata,accessToken:g.AccessToken}),signInDetails:a}),bo(),await Qi(),{isSignedIn:!0,nextStep:{signInStep:"DONE"}}):sl({challengeName:h,challengeParameters:m})}catch(f){eo(f);const h=pc(f.name);if(h)return h;throw f}}const rX=e=>fn(xn,_n("GetUser"),Un(),{...An,...e}),oX=e=>fn(xn,_n("VerifyUserAttribute"),Un(),{...An,...e});async function sX(e){const t=Tt.getConfig().Auth?.Cognito;We(t);const{userPoolEndpoint:n,userPoolId:r}=t,{confirmationCode:o,userAttributeKey:s}=e;Kt(!!o,Ue.EmptyConfirmUserAttributeCode);const{tokens:a}=await $v({forceRefresh:!1});uc(a),await oX({endpointResolver:rt({endpointOverride:n})})({region:nt(r),userAgentValue:vt($e.ConfirmUserAttribute)},{AccessToken:a.accessToken.toString(),AttributeName:s,Code:o})}new Ln("AuthError");const iX={oauthSignInError:{message:En.OAUTH_ERROR,log:"Make sure Cognito Hosted UI has been configured correctly"},noConfig:{message:En.DEFAULT_MSG},missingAuthConfig:{message:En.DEFAULT_MSG},emptyUsername:{message:En.EMPTY_USERNAME},invalidUsername:{message:En.INVALID_USERNAME},emptyPassword:{message:En.EMPTY_PASSWORD},emptyCode:{message:En.EMPTY_CODE},signUpError:{message:En.SIGN_UP_ERROR},noMFA:{message:En.NO_MFA},invalidMFA:{message:En.INVALID_MFA},emptyChallengeResponse:{message:En.EMPTY_CHALLENGE},noUserSession:{message:En.NO_USER_SESSION},deviceConfig:{message:En.DEVICE_CONFIG},networkError:{message:En.NETWORK_ERROR},autoSignInError:{message:En.AUTOSIGNIN_ERROR},default:{message:En.DEFAULT_MSG}},zi=(e,t)=>new Oe({message:e??"An error has occurred during the oauth process.",name:jo.OAuthSignInError,recoverySuggestion:iX.oauthSignInError.log});var T_;(function(e){e.NoConfig="noConfig",e.MissingAuthConfig="missingAuthConfig",e.EmptyUsername="emptyUsername",e.InvalidUsername="invalidUsername",e.EmptyPassword="emptyPassword",e.EmptyCode="emptyCode",e.SignUpError="signUpError",e.NoMFA="noMFA",e.InvalidMFA="invalidMFA",e.EmptyChallengeResponse="emptyChallengeResponse",e.NoUserSession="noUserSession",e.Default="default",e.DeviceConfig="deviceConfig",e.NetworkError="networkError",e.AutoSignInError="autoSignInError",e.OAuthSignInError="oauthSignInError"})(T_||(T_={}));const aX="`signInWithRedirect` has been canceled.",lX="An error occurred while validating the state.",uX="Try to initiate an OAuth flow from Amplify",J8=async e=>{const t=await ir.loadOAuthState(),n=e===t?t:void 0;if(!n)throw new Oe({name:T_.OAuthSignInError,message:e===null?aX:lX,recoverySuggestion:e===null?void 0:uX});return n},e$=async({currentUrl:e,userAgentValue:t,clientId:n,redirectUri:r,responseType:o,domain:s,preferPrivateSession:a})=>{const u=new Yi(e),c=u.searchParams.get("error"),f=u.searchParams.get("error_description");if(c)throw zi(f??c);return o==="code"?cX({currentUrl:e,userAgentValue:t,clientId:n,redirectUri:r,domain:s,preferPrivateSession:a}):dX({currentUrl:e,redirectUri:r,preferPrivateSession:a})},cX=async({currentUrl:e,userAgentValue:t,clientId:n,redirectUri:r,domain:o,preferPrivateSession:s})=>{const a=new Yi(e),u=a.searchParams.get("code"),c=a.searchParams.get("state");if(!u||!c)throw zi("User cancelled OAuth flow.");const f=await J8(c),h="https://"+o+"/oauth2/token",g=await ir.loadPKCE(),m={grant_type:"authorization_code",code:u,client_id:n,redirect_uri:r,...g?{code_verifier:g}:{}},v=Object.entries(m).map(([M,R])=>`${encodeURIComponent(M)}=${encodeURIComponent(R)}`).join("&"),{access_token:w,refresh_token:S,id_token:C,error:E,error_message:A,token_type:I,expires_in:T}=await(await fetch(h,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",[pG]:t},body:v})).json();if(E)throw zi(A??E);const N=(w&&Ms(w).payload.username)??"username";return await js({username:N,AccessToken:w,IdToken:C,RefreshToken:S}),t$({redirectUri:r,state:f,preferPrivateSession:s})},dX=async({currentUrl:e,redirectUri:t,preferPrivateSession:n})=>{const r=new Yi(e),{id_token:o,access_token:s,state:a,token_type:u,expires_in:c,error_description:f,error:h}=(r.hash??"#").substring(1).split("&").map(v=>v.split("=")).reduce((v,[w,S])=>({...v,[w]:S}),{id_token:void 0,access_token:void 0,state:void 0,token_type:void 0,expires_in:void 0,error_description:void 0,error:void 0});if(h)throw zi(f??h);if(!s)throw zi("No access token returned from OAuth flow.");const g=await J8(a),m=(s&&Ms(s).payload.username)??"username";return await js({username:m,AccessToken:s,IdToken:o}),t$({redirectUri:t,state:g,preferPrivateSession:n})},t$=async({redirectUri:e,state:t,preferPrivateSession:n})=>{await dr.setOAuthMetadata({oauthSignIn:!0}),await ir.clearOAuthData(),await ir.storeOAuthSignIn(!0,n),L8(),pX(e),fX(t)&&zo.dispatch("auth",{event:"customOAuthState",data:dZ(hX(t))},"Auth",Fo),zo.dispatch("auth",{event:"signInWithRedirect"},"Auth",Fo),await Qi()},fX=e=>/-/.test(e),hX=e=>e.split("-").splice(1).join("-"),pX=e=>{typeof window<"u"&&typeof window.history<"u"&&window.history.replaceState(window.history.state,"",e)};function ZA(e,t){{const n=e?.find(gX)??e?.find(mX),r=e?.find(yX)??e?.find(vX);if(n)return n;throw r?AZ:_Z}}const gX=e=>e.startsWith(String(window.location.origin+(window.location.pathname||"/"))),mX=e=>e.includes(String(window.location.hostname)),vX=e=>e.startsWith("http://"),yX=e=>e.startsWith("https://"),YA=async e=>{L8(),await ir.clearOAuthInflightData(),zo.dispatch("auth",{event:"signInWithRedirect_failure",data:{error:e}},"Auth",Fo)},bX=async e=>{try{We(e),kv(e),ir.setAuthConfig(e)}catch{return}if(await ir.loadOAuthInFlight())try{const t=window.location.href,{loginWith:n,userPoolClientId:r}=e,{domain:o,redirectSignIn:s,responseType:a}=n.oauth,u=ZA(s);await e$({currentUrl:t,clientId:r,domain:o,redirectUri:u,responseType:a,userAgentValue:vt($e.SignInWithRedirect)})}catch(t){await YA(t)}};Uv()&&Tt[i8](bX);const SX={Google:"Google",Facebook:"Facebook",Amazon:"LoginWithAmazon",Apple:"SignInWithApple"},n$=async e=>{window?.location&&(window.location.href=e.replace("http://","https://"))},UN="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",wX=e=>{const t=new Uint8Array(e);NA().getRandomValues(t);let n="",r;for(const o of t)n+=UN.charAt(o%UN.length);return{value:n,method:"S256",toCodeChallenge(){return r||(r=CX(n),r)}}};function CX(e){const t=new qa;return t.update(e),EX($u.convert(t.digestSync(),{urlSafe:!0}))}function EX(e){return e.replace(/=/g,"")}const _X=()=>cZ(32),xX=e=>{async function t(n){if(n.persisted&&await e.loadOAuthInFlight()){const o=zi("User cancelled OAuth flow.");await YA(o)}window.removeEventListener("pageshow",t)}window.addEventListener("pageshow",t)};async function r$(e){const t=Tt.getConfig().Auth?.Cognito;We(t),kv(t),ir.setAuthConfig(t),e?.options?.prompt||await V8();let n="COGNITO",r;return typeof e?.provider=="string"?n=SX[e.provider]:e?.provider?.custom?n=e.provider.custom:e?.provider?.idpIdentifier&&({idpIdentifier:r}=e.provider),AX({oauthConfig:t.loginWith.oauth,clientId:t.userPoolClientId,provider:n,idpIdentifier:r,customState:e?.customState,preferPrivateSession:e?.options?.preferPrivateSession,options:{loginHint:e?.options?.loginHint,lang:e?.options?.lang,nonce:e?.options?.nonce,prompt:e?.options?.prompt},authSessionOpener:e?.options?.authSessionOpener})}const AX=async({oauthConfig:e,provider:t,idpIdentifier:n,clientId:r,customState:o,preferPrivateSession:s,options:a,authSessionOpener:u})=>{const{domain:c,redirectSignIn:f,responseType:h,scopes:g}=e,{loginHint:m,lang:v,nonce:w,prompt:S}=a??{},C=_X(),E=u||n$,A=o?`${C}-${fZ(o)}`:C,{value:I,method:T,toCodeChallenge:N}=wX(128),M=ZA(e.redirectSignIn);Uv()&&ir.storeOAuthInFlight(!0),ir.storeOAuthState(A),ir.storePKCE(I);const R=new URLSearchParams;R.append("redirect_uri",M),R.append("response_type",h),R.append("client_id",r),n?R.append("idp_identifier",n):R.append("identity_provider",t),R.append("scope",g.join(" ")),m&&R.append("login_hint",m),v&&R.append("lang",v),w&&R.append("nonce",w),S&&R.append("prompt",S.toLowerCase()),R.append("state",A),h==="code"&&(R.append("code_challenge",N()),R.append("code_challenge_method",T));const k=`https://${c}/oauth2/authorize?${R.toString()}`;xX(ir);const{type:L,error:q,url:$}=await E(k,f,s)??{};try{if(L==="error")throw zi(String(q));if(L==="canceled")throw zi(String(L));L==="success"&&$&&await e$({currentUrl:$,clientId:r,domain:c,redirectUri:M,responseType:h,userAgentValue:vt($e.SignInWithRedirect),preferPrivateSession:s})}catch(D){throw await YA(D),D}},IX=async e=>{const t=e.getConfig().Auth?.Cognito;We(t);const{userPoolEndpoint:n,userPoolId:r}=t,{tokens:o}=await f8(e,{forceRefresh:!1});uc(o);const s=rX({endpointResolver:rt({endpointOverride:n})}),{UserAttributes:a}=await s({region:nt(r),userAgentValue:vt($e.FetchUserAttributes)},{AccessToken:o.accessToken.toString()});return yZ(a)},o$=()=>IX(Tt),RX=async e=>{await e.clearOAuthData(),dr.clearTokens(),await h8(),zo.dispatch("auth",{event:"signedOut"},"Auth",Fo)},TX=async(e,t=!1,n)=>{kv(e);const{loginWith:r,userPoolClientId:o}=e,{domain:s,redirectSignOut:a}=r.oauth,u=ZA(a),c=`https://${s}/logout?${Object.entries({client_id:o,logout_uri:encodeURIComponent(u)}).map(([f,h])=>`${f}=${h}`).join("&")}`;return n$(c)},OX=async(e,t,n,r)=>{const{isOAuthSignIn:o}=await t.loadOAuthSignIn(),s=await n.getOAuthMetadata();if(await RX(t),o||s?.oauthSignIn)return TX(e,!1)},MX=e=>fn(xn,_n("RevokeToken"),Un(),{...An,...e}),PX=new Ln("Auth");async function NX(e){const t=Tt.getConfig().Auth?.Cognito;We(t),await kX(t);let n;try{kv(t),n=!0}catch{n=!1}if(n){const r=new D8(Jf);r.setAuthConfig(t);const{type:o}=await OX(t,r,dr)??{};if(o==="error")throw new Oe({name:IZ,message:"An error occurred when attempting to log out from OAuth provider."})}else dr.clearTokens(),await h8(),zo.dispatch("auth",{event:"signedOut"},"Auth",Fo)}async function kX(e){try{const{userPoolEndpoint:t,userPoolId:n,userPoolClientId:r}=e,o=await dr.getTokenStore().loadTokens();M8(o),DX(o.accessToken)&&await MX({endpointResolver:rt({endpointOverride:t})})({region:nt(n),userAgentValue:vt($e.SignOut)},{ClientId:r,Token:o.refreshToken})}catch{PX.debug("Client signOut error caught but will proceed with token removal")}}const DX=e=>!!e?.payload?.origin_jti,LX=e=>fn(xn,_n("GetUserAttributeVerificationCode"),Un(),{...An,...e}),UX=async e=>{const{userAttributeKey:t,options:n}=e,r=Tt.getConfig().Auth?.Cognito,o=n?.clientMetadata;We(r);const{userPoolEndpoint:s,userPoolId:a}=r,{tokens:u}=await $v({forceRefresh:!1});uc(u);const c=LX({endpointResolver:rt({endpointOverride:s})}),{CodeDeliveryDetails:f}=await c({region:nt(a),userAgentValue:vt($e.SendUserAttributeVerificationCode)},{AccessToken:u.accessToken.toString(),ClientMetadata:o,AttributeName:t}),{DeliveryMedium:h,AttributeName:g,Destination:m}={...f};return{destination:m,deliveryMedium:h,attributeName:g}},$X={identityId:"identityId"},FX=new Ln("DefaultIdentityIdStore");class s${setAuthConfig(t){Zg(t.Cognito),this.authConfig=t,this._authKeys=zX("Cognito",t.Cognito.identityPoolId)}constructor(t){this._authKeys={},this._hasGuestIdentityId=!1,this.keyValueStorage=t}async loadIdentityId(){Zg(this.authConfig?.Cognito);try{if(this._primaryIdentityId)return{id:this._primaryIdentityId,type:"primary"};{const t=await this.keyValueStorage.getItem(this._authKeys.identityId);return t?(this._hasGuestIdentityId=!0,{id:t,type:"guest"}):null}}catch(t){return FX.log("Error getting stored IdentityId.",t),null}}async storeIdentityId(t){Zg(this.authConfig?.Cognito),t.type==="guest"?(this.keyValueStorage.setItem(this._authKeys.identityId,t.id),this._primaryIdentityId=void 0,this._hasGuestIdentityId=!0):(this._primaryIdentityId=t.id,this._hasGuestIdentityId&&(this.keyValueStorage.removeItem(this._authKeys.identityId),this._hasGuestIdentityId=!1))}async clearIdentityId(){this._primaryIdentityId=void 0,await this.keyValueStorage.removeItem(this._authKeys.identityId)}}const zX=(e,t)=>FA($X)(`com.amplify.${e}`,t),O_=({endpointOverride:e})=>t=>e?{url:new Yi(e)}:JK(t);function i$(e){const t=Ms(e).payload.iss,n={};if(!t)throw new Oe({name:"InvalidIdTokenException",message:"Invalid Idtoken."});const r=t.replace(/(^\w+:|^)\/\//,"");return n[r]=e,n}async function jX({tokens:e,authConfig:t,identityIdStore:n}){n.setAuthConfig({Cognito:t});const r=await n.loadIdentityId();if(r)return r.id;const o=e?.idToken?i$(e.idToken.toString()):{},s=await BX(o,t);return n.storeIdentityId({id:s,type:e?"primary":"guest"}),s}async function BX(e,t){const n=t?.identityPoolId,r=C_(n),o=YK({endpointResolver:O_({endpointOverride:t.identityPoolEndpoint})});let s;try{s=(await o({region:r},{IdentityPoolId:n,Logins:e})).IdentityId}catch(a){throw eo(a),new Oe(a)}if(!s)throw new Oe({name:"GetIdResponseException",message:"Received undefined response from getId operation",recoverySuggestion:"Make sure to pass a valid identityPoolId in the configuration."});return s}const Vp=new Ln("CognitoCredentialsProvider"),$N=3e3*1e3;class a${constructor(t){this._nextCredentialsRefresh=0,this._identityIdStore=t}async clearCredentialsAndIdentityId(){Vp.debug("Clearing out credentials and identityId"),this._credentialsAndIdentityId=void 0,await this._identityIdStore.clearIdentityId()}async clearCredentials(){Vp.debug("Clearing out in-memory credentials"),this._credentialsAndIdentityId=void 0}async getCredentialsAndIdentityId(t){const n=t.authenticated,{tokens:r}=t,{authConfig:o}=t;try{Zg(o?.Cognito)}catch{return}if(!n&&!o.Cognito.allowGuestAccess)return;const{forceRefresh:s}=t,a=this.hasTokenChanged(r),u=await jX({tokens:r,authConfig:o.Cognito,identityIdStore:this._identityIdStore});return(s||a)&&this.clearCredentials(),n?(OZ(r),this.credsForOIDCTokens(o.Cognito,r,u)):this.getGuestCredentials(u,o.Cognito)}async getGuestCredentials(t,n){if(this._credentialsAndIdentityId&&!this.isPastTTL()&&this._credentialsAndIdentityId.isAuthenticatedCreds===!1)return Vp.info("returning stored credentials as they neither past TTL nor expired."),this._credentialsAndIdentityId;this.clearCredentials();const r=C_(n.identityPoolId),o=tN({endpointResolver:O_({endpointOverride:n.identityPoolEndpoint})});let s;try{s=await o({region:r},{IdentityId:t})}catch(a){throw eo(a),new Oe(a)}if(s?.Credentials?.AccessKeyId&&s?.Credentials?.SecretKey){this._nextCredentialsRefresh=new Date().getTime()+$N;const a={credentials:{accessKeyId:s.Credentials.AccessKeyId,secretAccessKey:s.Credentials.SecretKey,sessionToken:s.Credentials.SessionToken,expiration:s.Credentials.Expiration},identityId:t};return s.IdentityId&&(a.identityId=s.IdentityId,this._identityIdStore.storeIdentityId({id:s.IdentityId,type:"guest"})),this._credentialsAndIdentityId={...a,isAuthenticatedCreds:!1},a}else throw new Oe({name:"CredentialsNotFoundException",message:"Cognito did not respond with either Credentials, AccessKeyId or SecretKey."})}async credsForOIDCTokens(t,n,r){if(this._credentialsAndIdentityId&&!this.isPastTTL()&&this._credentialsAndIdentityId.isAuthenticatedCreds===!0)return Vp.debug("returning stored credentials as they neither past TTL nor expired."),this._credentialsAndIdentityId;this.clearCredentials();const o=n.idToken?i$(n.idToken.toString()):{},s=C_(t.identityPoolId),a=tN({endpointResolver:O_({endpointOverride:t.identityPoolEndpoint})});let u;try{u=await a({region:s},{IdentityId:r,Logins:o})}catch(c){throw eo(c),new Oe(c)}if(u?.Credentials?.AccessKeyId&&u?.Credentials?.SecretKey){this._nextCredentialsRefresh=new Date().getTime()+$N;const c={credentials:{accessKeyId:u.Credentials.AccessKeyId,secretAccessKey:u.Credentials.SecretKey,sessionToken:u.Credentials.SessionToken,expiration:u.Credentials.Expiration},identityId:r};return u.IdentityId&&(c.identityId=u.IdentityId,this._identityIdStore.storeIdentityId({id:u.IdentityId,type:"primary"})),this._credentialsAndIdentityId={...c,isAuthenticatedCreds:!0,associatedIdToken:n.idToken?.toString()},c}else throw new Oe({name:"CredentialsException",message:"Cognito did not respond with either Credentials, AccessKeyId or SecretKey."})}isPastTTL(){return this._nextCredentialsRefresh===void 0?!0:this._nextCredentialsRefresh<=Date.now()}hasTokenChanged(t){return!!t&&!!this._credentialsAndIdentityId?.associatedIdToken&&t.idToken?.toString()!==this._credentialsAndIdentityId.associatedIdToken}}const HX=new a$(new s$(Jf)),l$={configure(e,t){const n=l8(e),r=new iZ({sameSite:"lax"}),o=t?.ssr?r:Jf,s=t?.ssr?new a$(new s$(r)):HX;if(!n.Auth||t?.Auth){Tt.configure(n,t);return}Qg.setAuthConfig(n.Auth),Qg.setKeyValueStorage(o),Tt.configure(n,{...t,Auth:{tokenProvider:Qg,credentialsProvider:s}})},getConfig(){return Tt.getConfig()}},qX="https://github.com/remit-mail/reader/issues/new",VX=["internal","acme","tailscale","off"],WX=["self","managed"],FN=(e,t,n)=>e.find(r=>r===t)??n,gc=()=>{const e=globalThis.__REMIT_CONFIG__??{};return{apiUrl:e.apiUrl??"/api",appOrigin:e.appOrigin??"",betterAuthEnabled:e.betterAuthEnabled??!1,cognito:{userPoolId:e.cognito?.userPoolId??"",clientId:e.cognito?.clientId??"",domain:e.cognito?.domain??"",region:e.cognito?.region??""},rum:{appMonitorId:e.rum?.appMonitorId??"",identityPoolId:e.rum?.identityPoolId??"",region:e.rum?.region??"eu-west-1"},mailboxPollIntervalSeconds:e.mailboxPollIntervalSeconds!=null?String(e.mailboxPollIntervalSeconds):void 0,disableDevtools:e.disableDevtools??!1,tlsMode:FN(VX,e.tlsMode,"off"),issuesUrl:e.issuesUrl??qX,updateMode:FN(WX,e.updateMode,"self")}},u$=()=>{const e=gc(),{userPoolId:t,clientId:n,domain:r,region:o}=e.cognito;return!t||!n?null:{userPoolId:t,userPoolClientId:n,domain:r,region:o,appOrigin:e.appOrigin}},Hv=()=>u$()!==null,c$=()=>{const e=u$();if(!e){console.warn("[auth] Cognito user pool is not configured. Running in local dev mode without Cognito auth.");return}const{userPoolId:t,userPoolClientId:n,domain:r,appOrigin:o}=e;l$.configure({Auth:{Cognito:{userPoolId:t,userPoolClientId:n,loginWith:r?{oauth:{domain:r,scopes:["openid","email","profile"],redirectSignIn:o?[o]:[],redirectSignOut:o?[o]:[],responseType:"code"}}:void 0}}})};var GX={};const em=Object.create(null),wd=e=>GX||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?em:globalThis),Ei=new Proxy(em,{get(e,t){return wd()[t]??em[t]},has(e,t){return t in wd()||t in em},set(e,t,n){const r=wd(!0);return r[t]=n,!0},deleteProperty(e,t){if(!t)return!1;const n=wd(!0);return delete n[t],!0},ownKeys(){const e=wd(!0);return Object.keys(e)}});Ei.NODE_ENV;var tm=class extends Error{constructor(e,t){super(e,t),this.name="BetterAuthError",this.message=e,this.stack=""}};const KX=47;function d$(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===KX;)t--;return t===e.length?e:e.slice(0,t)}function ZX(e){try{return(d$(new URL(e).pathname)||"/")!=="/"}catch{throw new tm(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}function YX(e){try{const t=new URL(e);if(t.protocol!=="http:"&&t.protocol!=="https:")throw new tm(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){throw t instanceof tm?t:new tm(`Invalid base URL: ${e}. Please provide a valid base URL.`,{cause:t})}}function zN(e,t="/api/auth"){if(YX(e),ZX(e))return e;const n=d$(e);return!t||t==="/"?n:(t=t.startsWith("/")?t:`/${t}`,`${n}${t}`)}function QX(e,t,n,r,o){{const s=Ei.BETTER_AUTH_URL||Ei.NEXT_PUBLIC_BETTER_AUTH_URL||Ei.PUBLIC_BETTER_AUTH_URL||Ei.NUXT_PUBLIC_BETTER_AUTH_URL||Ei.NUXT_PUBLIC_AUTH_URL||(Ei.BASE_URL!=="/"?Ei.BASE_URL:void 0);if(s)return zN(s,t)}if(typeof window<"u"&&window.location)return zN(window.location.origin,t)}const XX={proto:/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,constructor:/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,protoShort:/"__proto__"\s*:/,constructorShort:/"constructor"\s*:/},JX=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,jN={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:Number.POSITIVE_INFINITY,"-infinity":Number.NEGATIVE_INFINITY},eJ=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function tJ(e){return e instanceof Date&&!isNaN(e.getTime())}function nJ(e){const t=eJ.exec(e);if(!t)return null;const[,n,r,o,s,a,u,c,f,h,g]=t,m=new Date(Date.UTC(parseInt(n,10),parseInt(r,10)-1,parseInt(o,10),parseInt(s,10),parseInt(a,10),parseInt(u,10),c?parseInt(c.padEnd(3,"0"),10):0));if(f){const v=(parseInt(h,10)*60+parseInt(g,10))*(f==="+"?-1:1);m.setUTCMinutes(m.getUTCMinutes()+v)}return tJ(m)?m:null}function rJ(e,t={}){const{strict:n=!1,warnings:r=!1,reviver:o,parseDates:s=!0}=t;if(typeof e!="string")return e;const a=e.trim(),u=a.toLowerCase();if(u.length<=9&&u in jN)return jN[u];if(!JX.test(a)){if(n)throw new SyntaxError("[better-json] Invalid JSON");return e}if(Object.entries(XX).some(([c,f])=>{const h=f.test(a);return h&&r&&console.warn(`[better-json] Detected potential prototype pollution attempt using ${c} pattern`),h})&&n)throw new Error("[better-json] Potential prototype pollution attempt detected");try{return JSON.parse(a,(f,h)=>{if(f==="__proto__"||f==="constructor"&&h&&typeof h=="object"&&"prototype"in h){r&&console.warn(`[better-json] Dropping "${f}" key to prevent prototype pollution`);return}if(s&&typeof h=="string"){const g=nJ(h);if(g)return g}return o?o(f,h):h})}catch(c){if(n)throw c;return e}}function oJ(e,t={strict:!0}){return rJ(e,t)}const sJ=["javascript:","data:","vbscript:"];function iJ(e){let t;try{t=new URL(e)}catch{return!0}return!sJ.includes(t.protocol)}const aJ={id:"redirect",name:"Redirect",hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&iJ(e.data.url)&&typeof window<"u"&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}};let po=[],_i=0;const nm=4,lJ=globalThis.nanostoresGlobal||={epoch:0};let uJ=()=>{for(_i=0;_i<po.length;_i+=nm)po[_i](po[_i+1].value,po[_i+2],po[_i+3]);po.length=0};const f$=e=>{let t=[],n={get(){return n.lc||n.listen(()=>{})(),n.value},init:e,lc:0,listen(r){return n.lc=t.push(r),()=>{for(let s=_i+nm;s<po.length;)po[s]===r?po.splice(s,nm):s+=nm;let o=t.indexOf(r);~o&&(t.splice(o,1),--n.lc||n.off())}},notify(r,o){lJ.epoch++;let s=!po.length&&!0;for(let a of t)po.push(a,n,r,o);s&&uJ()},off(){},set(r){let o=n.value;o!==r&&(n.value=r,n.notify(o))},subscribe(r){let o=n.listen(r);return r(n.value),o},value:e};return n},cJ=2,dJ=5,Wp=6,Gp=10;let h$=(e,t,n,r)=>(e.events=e.events||{},e.events[n+Gp]||(e.events[n+Gp]=r(o=>{e.events[n].reduceRight((s,a)=>(a(s),s),{shared:{},...o})})),e.events[n]=e.events[n]||[],e.events[n].push(t),()=>{let o=e.events[n],s=o.indexOf(t);o.splice(s,1),o.length||(delete e.events[n],e.events[n+Gp](),delete e.events[n+Gp])}),fJ=(e,t)=>h$(e,t,cJ,n=>{let r=e.set,o=e.setKey;return e.setKey&&(e.setKey=(s,a)=>{let u;if(n({abort:()=>{u=!0},changed:s,newValue:{...e.value,[s]:a}}),!u)return o(s,a)}),e.set=s=>{let a;if(n({abort:()=>{a=!0},newValue:s}),!a)return r(s)},()=>{e.set=r,e.setKey=o}});const p$=1e3;let hJ=(e,t)=>h$(e,r=>{let o=t(r);o&&e.events[Wp].push(o)},dJ,r=>{let o=e.listen;e.listen=(...a)=>(!e.lc&&!e.active&&(e.active=!0,r()),o(...a));let s=e.off;return e.events[Wp]=[],e.off=()=>{s(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let a of e.events[Wp])a();e.events[Wp]=[]}},p$)},()=>{e.listen=o,e.off=s}});function pJ(e,t,n){let r=new Set(t);return e.listen((o,s,a)=>{(a===void 0?t.some(u=>o[u]!==s[u]):r.has(a)||r.has(a.split(/\.|\[/)[0]))&&n(o,s,a)})}function BN(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Im(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Im(e[n],t[n]))return!1;return!0}if(BN(e)&&BN(t)){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n)if(!(o in t)||!Im(e[o],t[o]))return!1;return!0}return!1}function gJ(e,t){return fJ(e,({newValue:n,abort:r})=>{t(e.value,n)&&r()})}const M_=Symbol.for("better-auth:auth-query");function mJ(e){return M_ in e&&e[M_]===!0}function vJ(e){const t=f$(e);return Object.defineProperty(t,M_,{value:!0}),t}const O1=Symbol.for("better-auth:broadcast-channel"),yJ=()=>Math.floor(Date.now()/1e3);var bJ=class{listeners=new Set;name;constructor(e="better-auth.message"){this.name=e}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}post(e){if(!(typeof window>"u"))try{localStorage.setItem(this.name,JSON.stringify({...e,timestamp:yJ()}))}catch{}}setup(){if(typeof window>"u"||typeof window.addEventListener>"u")return()=>{};const e=t=>{if(t.key!==this.name)return;const n=JSON.parse(t.newValue??"{}");n?.event!=="session"||!n?.data||this.listeners.forEach(r=>r(n))};return window.addEventListener("storage",e),()=>{window.removeEventListener("storage",e)}}};function M1(e="better-auth.message"){return globalThis[O1]||(globalThis[O1]=new bJ(e)),globalThis[O1]}const P1=Symbol.for("better-auth:focus-manager");var SJ=class{listeners=new Set;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setFocused(e){this.listeners.forEach(t=>t(e))}setup(){if(typeof window>"u"||typeof document>"u"||typeof window.addEventListener>"u")return()=>{};const e=()=>{document.visibilityState==="visible"&&this.setFocused(!0)};return document.addEventListener("visibilitychange",e,!1),()=>{document.removeEventListener("visibilitychange",e,!1)}}};function HN(){return globalThis[P1]||(globalThis[P1]=new SJ),globalThis[P1]}const N1=Symbol.for("better-auth:online-manager");var wJ=class{listeners=new Set;isOnline=typeof navigator<"u"?navigator.onLine:!0;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setOnline(e){this.isOnline=e,this.listeners.forEach(t=>t(e))}setup(){if(typeof window>"u"||typeof window.addEventListener>"u")return()=>{};const e=()=>this.setOnline(!0),t=()=>this.setOnline(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",t,!1),()=>{window.removeEventListener("online",e,!1),window.removeEventListener("offline",t,!1)}}};function k1(){return globalThis[N1]||(globalThis[N1]=new wJ),globalThis[N1]}const D1=()=>Math.floor(Date.now()/1e3),CJ=5;function EJ(e){const{fetchSession:t,shouldPollSession:n=()=>!0,sessionSignal:r,options:o={}}=e,s=o.sessionOptions?.refetchInterval??0,a=o.sessionOptions?.refetchOnWindowFocus??!0,u=o.sessionOptions?.refetchWhenOffline??!1,c={isInitialized:!1,lastSessionRequest:0},f=()=>u||k1().isOnline,h=I=>{if(f()){if(I?.event==="storage"){t();return}if(I?.event==="poll"){c.lastSessionRequest=D1(),t();return}if(I?.event==="visibilitychange"){if(D1()-c.lastSessionRequest<CJ)return;c.lastSessionRequest=D1(),t();return}t()}},g=I=>{M1().post({event:"session",data:{trigger:I},clientId:Math.random().toString(36).substring(7)})},m=()=>{s&&s>0&&(c.pollInterval=setInterval(()=>{n()&&h({event:"poll"})},s*1e3))},v=()=>{c.unsubscribeBroadcast=M1().subscribe(()=>{h({event:"storage"})})},w=()=>{a&&(c.unsubscribeFocus=HN().subscribe(()=>{h({event:"visibilitychange"})}))},S=()=>{c.unsubscribeOnline=k1().subscribe(I=>{I&&h({event:"visibilitychange"})})},C=()=>{c.unsubscribeSignal=r.listen(()=>{t()})};return{init:()=>{c.isInitialized||(c.isInitialized=!0,m(),v(),w(),S(),C(),c.cleanupBroadcastSetup=M1().setup(),c.cleanupFocusSetup=HN().setup(),c.cleanupOnlineSetup=k1().setup())},cleanup:()=>{c.isInitialized&&(c.pollInterval&&(clearInterval(c.pollInterval),c.pollInterval=void 0),c.unsubscribeBroadcast&&(c.unsubscribeBroadcast(),c.unsubscribeBroadcast=void 0),c.unsubscribeFocus&&(c.unsubscribeFocus(),c.unsubscribeFocus=void 0),c.unsubscribeOnline&&(c.unsubscribeOnline(),c.unsubscribeOnline=void 0),c.unsubscribeSignal&&(c.unsubscribeSignal(),c.unsubscribeSignal=void 0),c.cleanupBroadcastSetup&&(c.cleanupBroadcastSetup(),c.cleanupBroadcastSetup=void 0),c.cleanupFocusSetup&&(c.cleanupFocusSetup(),c.cleanupFocusSetup=void 0),c.cleanupOnlineSetup&&(c.cleanupOnlineSetup(),c.cleanupOnlineSetup=void 0),c.isInitialized=!1,c.lastSessionRequest=0)},triggerRefetch:h,broadcastSessionUpdate:g}}const _J=()=>typeof window>"u",xJ=p$;function AJ(e,t){if(typeof window>"u")return;const n=e.get();n.data!==null||t===null||e.set({...n,data:t,error:null,isPending:!1})}function qN(e){return typeof e=="object"&&e!==null&&"data"in e&&"error"in e?e:{data:e,error:null}}function IJ(e){return!e||e.session===null&&e.user===null?null:e}function RJ(e,t){return Im(e.data,t.data)&&e.error===t.error&&e.isPending===t.isPending&&e.isRefetching===t.isRefetching&&e.refetch===t.refetch}function TJ(e,t){const n=f$(!1);let r,o=0,s=0;n.listen(()=>{s++,o=0});const a=v=>h(v),u=vJ({data:null,error:null,isPending:!0,isRefetching:!1,refetch:a});gJ(u,RJ);const c=async(v,w)=>{const S=u.value;if(u.set({...S,isPending:S.data===null,isRefetching:!0,error:null,refetch:a}),v.aborted)return"aborted";try{const C=await e("/get-session",{method:"GET",query:w?.query,signal:v});if(v.aborted)return"aborted";let{data:E,error:A}=qN(C),I="fresh";if(E?.needsRefresh)try{const R=await e("/get-session",{method:"POST",signal:v});if(v.aborted)return"aborted";({data:E,error:A}=qN(R))}catch{if(v.aborted)return"aborted";I="stale"}if(A){const R=u.value,k=A?.status===401;return u.set({data:k?null:R.data,error:A,isPending:!1,isRefetching:!1,refetch:a}),"failed"}const T=IJ(E),N=u.value,M=N.data!=null&&T!=null&&Im(N.data,T)?N.data:T;return u.set({data:M,error:null,isPending:!1,isRefetching:!1,refetch:a}),I}catch(C){if(v.aborted)return"aborted";const E=u.value;return u.set({data:E.data,error:C,isPending:!1,isRefetching:!1,refetch:a}),"failed"}},f=()=>{const v=u.value.data?.session?.expiresAt,w=v instanceof Date?v.getTime():Number.POSITIVE_INFINITY;return Math.min(Date.now()+xJ,w)},h=v=>{o=0,r?.cancel();const w=new AbortController,S={cancel:()=>w.abort(),promise:Promise.resolve().then(()=>w.signal.aborted?"aborted":c(w.signal,v)),revision:s};r=S;const C=E=>{r===S&&(r=void 0,E==="fresh"&&S.revision===s&&(o=f()))};return S.promise.then(C,()=>C("failed")),S.promise.then(()=>{})},g=()=>r?.revision===s?r.promise.then(()=>{}):Date.now()<o?Promise.resolve():h();let m=()=>{};return hJ(u,()=>{let v;_J()||(v=setTimeout(()=>{g()},0));const w=EJ({fetchSession:h,shouldPollSession:()=>u.value.data!=null,sessionSignal:n,options:t});return w.init(),m=w.broadcastSessionUpdate,()=>{v&&clearTimeout(v),w.cleanup()}}),{session:u,$sessionSignal:n,broadcastSessionUpdate:v=>m(v)}}function L1(e){if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)==="[object Module]":!0}function P_(e,t,n=".",r){if(!L1(t))return P_(e,{},n,r);const o={...t};for(const s of Object.keys(e)){if(s==="__proto__"||s==="constructor")continue;const a=e[s];a!=null&&(r&&r(o,s,a,n)||(Array.isArray(a)&&Array.isArray(o[s])?o[s]=[...a,...o[s]]:L1(a)&&L1(o[s])?o[s]=P_(a,o[s],(n?`${n}.`:"")+s.toString(),r):o[s]=a))}return o}function OJ(e){return(...t)=>t.reduce((n,r)=>P_(n,r,"",e),{})}const MJ=OJ();var PJ=class extends Error{constructor(e,t,n){super(t||e.toString(),{cause:n}),this.status=e,this.statusText=t,this.error=n,Error.captureStackTrace(this,this.constructor)}};const NJ=async(e,t)=>{let n=t||{};const r={onRequest:[t?.onRequest],onResponse:[t?.onResponse],onSuccess:[t?.onSuccess],onError:[t?.onError],onRetry:[t?.onRetry]};if(!t||!t?.plugins)return{url:e,options:n,hooks:r};for(const h of t?.plugins||[]){var o,s,a,u,c;if(h.init){var f;const g=await((f=h.init)===null||f===void 0?void 0:f.call(h,e.toString(),n));n=g.options||n,e=g.url}r.onRequest.push((o=h.hooks)===null||o===void 0?void 0:o.onRequest),r.onResponse.push((s=h.hooks)===null||s===void 0?void 0:s.onResponse),r.onSuccess.push((a=h.hooks)===null||a===void 0?void 0:a.onSuccess),r.onError.push((u=h.hooks)===null||u===void 0?void 0:u.onError),r.onRetry.push((c=h.hooks)===null||c===void 0?void 0:c.onRetry)}return{url:e,options:n,hooks:r}};var VN=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(){return this.options.delay}},kJ=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(e){return Math.min(this.options.maxDelay,this.options.baseDelay*2**e)}};function DJ(e){if(typeof e=="number")return new VN({type:"linear",attempts:e,delay:1e3});switch(e.type){case"linear":return new VN(e);case"exponential":return new kJ(e);default:throw new Error("Invalid retry strategy")}}const LJ=["get","post","put","patch","delete"];function QA(e){if(!e.startsWith("@"))return{method:void 0,path:e};const t=e.indexOf("/"),n=e.slice(1,t===-1?void 0:t);return LJ.includes(n)?{method:n,path:t===-1?e:e.slice(t+1)}:{method:void 0,path:e}}const UJ=e=>e==="."||e==="..",$J=e=>e.split(":").map(t=>encodeURIComponent(t)).join(":");function FJ(e,t){const n=t.get(e);if(n===void 0)return $J(e);if(UJ(n))throw new TypeError("Path parameters cannot be reserved path segments");return encodeURIComponent(n)}function zJ(e,t){const{baseURL:n,params:r,query:o}=t||{query:{},params:{},baseURL:""};let s=e.startsWith("http")?e.split("/").slice(0,3).join("/"):n||"";const{path:a}=QA(e);a!==e&&(e=`/${a}`),s.endsWith("/")||(s+="/");let[u,c]=e.replace(s,"").split("?");const f=new URLSearchParams(c);for(const[m,v]of Object.entries(o||{})){if(v==null)continue;let w;if(typeof v=="string")w=v;else if(Array.isArray(v)){for(const S of v)f.append(m,S);continue}else w=JSON.stringify(v);f.set(m,w)}const h=new Map;if(r)if(Array.isArray(r)){const m=u.split("/").filter(v=>v.startsWith(":"));for(const[v,w]of m.entries()){const S=r[v];h.set(w,String(S))}}else for(const[m,v]of Object.entries(r))h.set(`:${m}`,String(v));u=u.split("/").map(m=>FJ(m,h)).join("/"),u=u.replace(/^\/+/,"");let g=f.toString();return g=g.length>0?`?${g}`.replace(/\+/g,"%20"):"",s.startsWith("http")?new URL(`${u}${g}`,s):`${s}${u}${g}`}const jJ=async e=>{const t={},n=async r=>typeof r=="function"?await r():r;if(e?.auth){if(e.auth.type==="Bearer"){const r=await n(e.auth.token);if(!r)return t;t.authorization=`Bearer ${r}`}else if(e.auth.type==="Basic"){const[r,o]=await Promise.all([n(e.auth.username),n(e.auth.password)]);if(!r||!o)return t;t.authorization=`Basic ${btoa(`${r}:${o}`)}`}else if(e.auth.type==="Custom"){const[r,o]=await Promise.all([n(e.auth.prefix),n(e.auth.value)]);if(!o)return t;t.authorization=`${r??""} ${o}`}}return t},BJ=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function HJ(e){const t=e.headers.get("content-type"),n=new Set(["image/svg","application/xml","application/xhtml","application/html"]);if(!t)return"json";const r=t.split(";").shift()||"";return BJ.test(r)?"json":n.has(r)||r.startsWith("text/")?"text":"blob"}function qJ(e){try{return JSON.parse(e),!0}catch{return!1}}function g$(e){if(e===void 0)return!1;const t=typeof e;return t==="string"||t==="number"||t==="boolean"||t===null?!0:t!=="object"?!1:Array.isArray(e)?!0:e.buffer?!1:e.constructor&&e.constructor.name==="Object"||typeof e.toJSON=="function"}function WN(e){try{return JSON.parse(e)}catch{return e}}function GN(e){return typeof e=="function"}function VJ(e){if(e?.customFetchImpl)return e.customFetchImpl;if(typeof globalThis<"u"&&GN(globalThis.fetch))return globalThis.fetch;if(typeof window<"u"&&GN(window.fetch))return window.fetch;throw new Error("No fetch implementation found")}function m$(...e){const t={};for(const n of e)if(n)if(n instanceof Headers)n.forEach((r,o)=>{t[o]=r});else{const r=Array.isArray(n)?n:Object.entries(n);for(const[o,s]of r)s!=null&&(t[o]=s)}return t}async function WJ(e){const t=new Headers(m$(e?.headers,await jJ(e)));if(!t.has("content-type")){const n=GJ(e?.body);n&&t.set("content-type",n)}return t}function GJ(e){return g$(e)?"application/json":null}function KJ(e){const t=e.get("content-type");return t?t.split(";")[0].trim().toLowerCase():null}function ZJ(e,t){const{body:n}=e;return n?!g$(n)||typeof n=="string"?n:KJ(t)==="application/x-www-form-urlencoded"?new URLSearchParams(n).toString():JSON.stringify(n):null}function YJ(e,t){if(t?.method)return t.method.toUpperCase();const{method:n}=QA(e);return n?n.toUpperCase():t?.body?"POST":"GET"}function QJ(e,t){let n;return!e?.signal&&e?.timeout&&(n=setTimeout(()=>t?.abort(),e?.timeout)),{abortTimeout:n,clearTimeout:()=>{n&&clearTimeout(n)}}}var XJ=class v$ extends Error{constructor(t,n){super(n||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,v$.prototype)}};async function qd(e,t){const n=await e["~standard"].validate(t);if(n.issues)throw new XJ(n.issues);return n.value}function bf(e){"@babel/helpers - typeof";return bf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},bf(e)}function JJ(e,t){if(bf(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(bf(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function eee(e){var t=JJ(e,"string");return bf(t)=="symbol"?t:t+""}function tee(e,t,n){return(t=eee(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function KN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function ct(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?KN(Object(n),!0).forEach(function(r){tee(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):KN(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}const N_=async(e,t)=>{var n,r,o;const{hooks:s,url:a,options:u}=await NJ(e,t),c=VJ(u),f=new AbortController,h=(n=u.signal)!==null&&n!==void 0?n:f.signal,g=zJ(a,u),m=await WJ(u),v=ZJ(u,m),w=YJ(a,u),S=ct(ct({},u),{},{url:g,headers:m,body:v,method:w,signal:h});for(const j of s.onRequest)if(j){const Z=await j(S);typeof Z=="object"&&Z!==null&&Object.assign(S,Z)}("pipeTo"in S&&typeof S.pipeTo=="function"||typeof(t==null||(r=t.body)===null||r===void 0?void 0:r.pipe)=="function")&&("duplex"in S||(S.duplex="half"));const{clearTimeout:C}=QJ(u,f);let E=await c(S.url,S);C();const A={response:E,request:S};for(const j of s.onResponse)if(j){var I;const Z=await j(ct(ct({},A),{},{response:!(t==null||(I=t.hookOptions)===null||I===void 0)&&I.cloneResponse?E.clone():E}));Z instanceof Response?E=Z:typeof Z=="object"&&Z!==null&&(E=Z.response)}if(E.ok){if(S.method==="HEAD")return{data:"",error:null};const j=HJ(E),Z={data:null,response:E,request:S};if(j==="json"||j==="text"){var T;const he=await E.text();Z.data=await((T=S.jsonParser)!==null&&T!==void 0?T:WN)(he)}else Z.data=await E[j]();S?.output&&S.output&&!S.disableValidation&&(Z.data=await qd(S.output,Z.data));for(const he of s.onSuccess)if(he){var N;await he(ct(ct({},Z),{},{response:!(t==null||(N=t.hookOptions)===null||N===void 0)&&N.cloneResponse?E.clone():E}))}return t?.throw?Z.data:{data:Z.data,error:null}}const M=(o=t?.jsonParser)!==null&&o!==void 0?o:WN,R=await E.text(),k=qJ(R),L=k?await M(R):null,q={response:E,responseText:R,request:S,error:ct(ct({},L),{},{status:E.status,statusText:E.statusText})};for(const j of s.onError)if(j){var $;await j(ct(ct({},q),{},{response:!(t==null||($=t.hookOptions)===null||$===void 0)&&$.cloneResponse?E.clone():E}))}if(t?.retry){var D;const j=DJ(t.retry),Z=(D=t.retryAttempt)!==null&&D!==void 0?D:0;if(await j.shouldAttemptRetry(Z,E)){for(const B of s.onRetry)B&&await B(A);const he=j.getDelay(Z);return await new Promise(B=>setTimeout(B,he)),await N_(e,ct(ct({},t),{},{retryAttempt:Z+1}))}}if(t?.throw)throw new PJ(E.status,E.statusText,k?L:R);return{data:null,error:ct(ct({},L),{},{status:E.status,statusText:E.statusText})}},nee=e=>({id:"apply-schema",name:"Apply Schema",version:"1.0.0",async init(t,n){var r;let o=ct(ct({},n),e.query!==void 0&&{query:ct(ct({},e.query),n?.query)});const s=((r=e.plugins)===null||r===void 0||(r=r.find(f=>{var h;return!((h=f.schema)===null||h===void 0)&&h.config?t.startsWith(f.schema.config.baseURL||"")||t.startsWith(f.schema.config.prefix||""):!1}))===null||r===void 0?void 0:r.schema)||e.schema;if(s){var a,u;let f=t;!((a=s.config)===null||a===void 0)&&a.prefix&&f.startsWith(s.config.prefix)&&(f=f.replace(s.config.prefix,""),s.config.baseURL&&(t=t.replace(s.config.prefix,s.config.baseURL))),!((u=s.config)===null||u===void 0)&&u.baseURL&&f.startsWith(s.config.baseURL)&&(f=f.replace(s.config.baseURL,"")),f.startsWith("/")&&f.charAt(1)==="@"&&(f=f.substring(1));const h=s.schema[f];if(h){var c;const{method:g,path:m}=QA(f);g&&(t=t.slice(0,t.length-f.length)+m);let v=n?.headers;if(h.headers&&!n?.disableValidation){const S={};if(n?.headers){if(n.headers instanceof Headers)n.headers.forEach((A,I)=>{S[I.toLowerCase()]=A});else if(typeof n.headers=="object")for(const[A,I]of Object.entries(n.headers))I!=null&&(S[A.toLowerCase()]=I)}const C=await qd(h.headers,S),E={};for(const[A,I]of Object.entries(C))E[A.toLowerCase()]=I;v=E}const w=(c=h.method)!==null&&c!==void 0?c:g;if(o=ct(ct(ct(ct({},o),w!==void 0&&{method:w}),h.output!==void 0&&{output:h.output}),v!==void 0&&{headers:v}),!n?.disableValidation){if(h.query&&(o.query=await qd(h.query,n?.query),o.query!==null&&typeof o.query=="object")){const S=ct({},e.query);for(const C of Object.keys(S))n?.query&&Object.prototype.hasOwnProperty.call(n.query,C)&&(S[C]=n.query[C]);o.query=ct(ct({},S),o.query)}o=ct(ct({},o),{},{body:h.input?await qd(h.input,n?.body):n?.body,params:h.params?await qd(h.params,n?.params):n?.params})}return{url:t,options:o}}}return ct({url:t},(n!==void 0||e.query!==void 0)&&{options:o})}}),ree=e=>{async function t(n,r){const o=ct(ct(ct({},e),r),{},{headers:m$(e?.headers,r?.headers),plugins:[...e?.plugins||[],nee(e||{}),...r?.plugins||[]]});if(e?.catchAllError)try{return await N_(n,o)}catch(s){return{data:null,error:{status:500,statusText:"Fetch Error",message:"Fetch related error. Captured by catchAllError option. See error property for more details.",error:s}}}return await N_(n,o)}return t};var Sa={};const oee=e=>{if(typeof process>"u")return;const t="/api/auth";if(Sa.NEXT_PUBLIC_AUTH_URL)return Sa.NEXT_PUBLIC_AUTH_URL;if(typeof window>"u"){if(Sa.NEXTAUTH_URL)try{return Sa.NEXTAUTH_URL}catch{}if(Sa.VERCEL_URL)try{const n=Sa.VERCEL_URL.startsWith("http")?"":"https://";return`${new URL(`${n}${Sa.VERCEL_URL}`).origin}${t}`}catch{}}},see=e=>e==="/sign-out"||e==="/update-user"||e==="/update-session"||e==="/sign-up/email"||e==="/sign-in/email"||e==="/delete-user"||e==="/verify-email"||e==="/revoke-sessions"||e==="/revoke-session"||e==="/revoke-other-sessions"||e==="/change-email"||e==="/change-password",iee=(e,t)=>{const n="credentials"in Request.prototype,r=QX(e?.baseURL,e?.basePath)??oee()??"/api/auth",o=[],s={id:"lifecycle-hooks",name:"lifecycle-hooks",hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:a,onError:u,onRequest:c,onResponse:f,...h}={},g=ree({baseURL:r,...n?{credentials:"include"}:{},method:"GET",jsonParser(R){return R?oJ(R,{strict:!1}):null},customFetchImpl:fetch,...h,plugins:[s,...h.plugins||[],aJ,...o]}),{$sessionSignal:m,session:v,broadcastSessionUpdate:w}=TJ(g,e);let S=!1;const C=R=>{S||R===null||(S=!0,AJ(v,R))},E=[];let A={};const I={$sessionSignal:m,session:v},T={"/sign-out":"POST","/revoke-sessions":"POST","/revoke-other-sessions":"POST","/delete-user":"POST"},N=[{signal:"$sessionSignal",matcher:see,callback(R){R==="/sign-out"?w("signout"):(R==="/update-user"||R==="/update-session")&&w("updateUser")}}];for(const R of E)R.getAtoms&&Object.assign(I,R.getAtoms?.(g)),R.pathMethods&&Object.assign(T,R.pathMethods),R.atomListeners&&N.push(...R.atomListeners);const M={notify:R=>{I[R].set(!I[R].get())},listen:(R,k)=>{I[R].subscribe(k)},atoms:I};for(const R of E)R.getActions&&(A=MJ(R.getActions?.(g,M,e)??{},A));return{get baseURL(){return r},pluginsActions:A,pluginsAtoms:I,pluginPathMethods:T,atomListeners:N,hydrateSession:C,$sessionSignal:m,$fetch:g,$store:M}};function aee(e){return typeof e=="object"&&e!==null&&"get"in e&&typeof e.get=="function"&&"lc"in e&&typeof e.lc=="number"}function lee(e){return e.charAt(0).toUpperCase()+e.slice(1)}const uee=new RegExp("[\\p{Ll}\\d]+|\\p{Lu}+(?!\\p{Ll})|\\p{Lu}[\\p{Ll}\\d]+|\\p{Lo}+","gu"),cee=/['\u2019]/g;function dee(e){return e.replace(cee,"").match(uee)??[]}function fee(e){return dee(e).map(t=>t.toLowerCase()).join("-")}function hee(e,t,n){const r=t[e],{fetchOptions:o,query:s,...a}=n||{};return r||(o?.method?o.method:a&&Object.keys(a).length>0?"POST":"GET")}function pee(e,t,n,r,o){function s(a=[]){return new Proxy(function(){},{get(u,c){if(typeof c!="string"||c==="then"||c==="catch"||c==="finally")return;const f=[...a,c];let h=e;for(const g of f)if(h&&typeof h=="object"&&g in h)h=h[g];else{h=void 0;break}return typeof h=="function"||aee(h)?h:s(f)},apply:async(u,c,f)=>{const h="/"+a.map(fee).join("/"),g=f[0]||{},m=f[1]||{},{query:v,fetchOptions:w,...S}=g,C={...m,...w},E=hee(h,n,g);return await t(h,{...C,body:E==="GET"?void 0:{...S,...C?.body||{}},query:v||C?.query,method:E,async onSuccess(A){if(await C?.onSuccess?.(A),!o||C.disableSignal)return;const I=o.filter(N=>N.matcher(h));if(!I.length)return;const T=new Set;for(const N of I){const M=r[N.signal];if(!M)return;if(T.has(N.signal))continue;T.add(N.signal);const R=M.get();setTimeout(()=>{M.set(!R)},10),N.callback?.(h)}}})}})}return s()}var U1={exports:{}},Le={};var ZN;function gee(){if(ZN)return Le;ZN=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),a=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),m=Symbol.iterator;function v(U){return U===null||typeof U!="object"?null:(U=m&&U[m]||U["@@iterator"],typeof U=="function"?U:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,C={};function E(U,X,ie){this.props=U,this.context=X,this.refs=C,this.updater=ie||w}E.prototype.isReactComponent={},E.prototype.setState=function(U,X){if(typeof U!="object"&&typeof U!="function"&&U!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,U,X,"setState")},E.prototype.forceUpdate=function(U){this.updater.enqueueForceUpdate(this,U,"forceUpdate")};function A(){}A.prototype=E.prototype;function I(U,X,ie){this.props=U,this.context=X,this.refs=C,this.updater=ie||w}var T=I.prototype=new A;T.constructor=I,S(T,E.prototype),T.isPureReactComponent=!0;var N=Array.isArray;function M(){}var R={H:null,A:null,T:null,S:null},k=Object.prototype.hasOwnProperty;function L(U,X,ie){var oe=ie.ref;return{$$typeof:e,type:U,key:X,ref:oe!==void 0?oe:null,props:ie}}function q(U,X){return L(U.type,X,U.props)}function $(U){return typeof U=="object"&&U!==null&&U.$$typeof===e}function D(U){var X={"=":"=0",":":"=2"};return"$"+U.replace(/[=:]/g,function(ie){return X[ie]})}var j=/\/+/g;function Z(U,X){return typeof U=="object"&&U!==null&&U.key!=null?D(""+U.key):X.toString(36)}function he(U){switch(U.status){case"fulfilled":return U.value;case"rejected":throw U.reason;default:switch(typeof U.status=="string"?U.then(M,M):(U.status="pending",U.then(function(X){U.status==="pending"&&(U.status="fulfilled",U.value=X)},function(X){U.status==="pending"&&(U.status="rejected",U.reason=X)})),U.status){case"fulfilled":return U.value;case"rejected":throw U.reason}}throw U}function B(U,X,ie,oe,fe){var Me=typeof U;(Me==="undefined"||Me==="boolean")&&(U=null);var xe=!1;if(U===null)xe=!0;else switch(Me){case"bigint":case"string":case"number":xe=!0;break;case"object":switch(U.$$typeof){case e:case t:xe=!0;break;case h:return xe=U._init,B(xe(U._payload),X,ie,oe,fe)}}if(xe)return fe=fe(U),xe=oe===""?"."+Z(U,0):oe,N(fe)?(ie="",xe!=null&&(ie=xe.replace(j,"$&/")+"/"),B(fe,X,ie,"",function(Ze){return Ze})):fe!=null&&($(fe)&&(fe=q(fe,ie+(fe.key==null||U&&U.key===fe.key?"":(""+fe.key).replace(j,"$&/")+"/")+xe)),X.push(fe)),1;xe=0;var se=oe===""?".":oe+":";if(N(U))for(var Se=0;Se<U.length;Se++)oe=U[Se],Me=se+Z(oe,Se),xe+=B(oe,X,ie,Me,fe);else if(Se=v(U),typeof Se=="function")for(U=Se.call(U),Se=0;!(oe=U.next()).done;)oe=oe.value,Me=se+Z(oe,Se++),xe+=B(oe,X,ie,Me,fe);else if(Me==="object"){if(typeof U.then=="function")return B(he(U),X,ie,oe,fe);throw X=String(U),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(U).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.")}return xe}function Q(U,X,ie){if(U==null)return U;var oe=[],fe=0;return B(U,oe,"","",function(Me){return X.call(ie,Me,fe++)}),oe}function ae(U){if(U._status===-1){var X=U._result;X=X(),X.then(function(ie){(U._status===0||U._status===-1)&&(U._status=1,U._result=ie)},function(ie){(U._status===0||U._status===-1)&&(U._status=2,U._result=ie)}),U._status===-1&&(U._status=0,U._result=X)}if(U._status===1)return U._result.default;throw U._result}var ue=typeof reportError=="function"?reportError:function(U){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var X=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof U=="object"&&U!==null&&typeof U.message=="string"?String(U.message):String(U),error:U});if(!window.dispatchEvent(X))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",U);return}console.error(U)},we={map:Q,forEach:function(U,X,ie){Q(U,function(){X.apply(this,arguments)},ie)},count:function(U){var X=0;return Q(U,function(){X++}),X},toArray:function(U){return Q(U,function(X){return X})||[]},only:function(U){if(!$(U))throw Error("React.Children.only expected to receive a single React element child.");return U}};return Le.Activity=g,Le.Children=we,Le.Component=E,Le.Fragment=n,Le.Profiler=o,Le.PureComponent=I,Le.StrictMode=r,Le.Suspense=c,Le.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=R,Le.__COMPILER_RUNTIME={__proto__:null,c:function(U){return R.H.useMemoCache(U)}},Le.cache=function(U){return function(){return U.apply(null,arguments)}},Le.cacheSignal=function(){return null},Le.cloneElement=function(U,X,ie){if(U==null)throw Error("The argument must be a React element, but you passed "+U+".");var oe=S({},U.props),fe=U.key;if(X!=null)for(Me in X.key!==void 0&&(fe=""+X.key),X)!k.call(X,Me)||Me==="key"||Me==="__self"||Me==="__source"||Me==="ref"&&X.ref===void 0||(oe[Me]=X[Me]);var Me=arguments.length-2;if(Me===1)oe.children=ie;else if(1<Me){for(var xe=Array(Me),se=0;se<Me;se++)xe[se]=arguments[se+2];oe.children=xe}return L(U.type,fe,oe)},Le.createContext=function(U){return U={$$typeof:a,_currentValue:U,_currentValue2:U,_threadCount:0,Provider:null,Consumer:null},U.Provider=U,U.Consumer={$$typeof:s,_context:U},U},Le.createElement=function(U,X,ie){var oe,fe={},Me=null;if(X!=null)for(oe in X.key!==void 0&&(Me=""+X.key),X)k.call(X,oe)&&oe!=="key"&&oe!=="__self"&&oe!=="__source"&&(fe[oe]=X[oe]);var xe=arguments.length-2;if(xe===1)fe.children=ie;else if(1<xe){for(var se=Array(xe),Se=0;Se<xe;Se++)se[Se]=arguments[Se+2];fe.children=se}if(U&&U.defaultProps)for(oe in xe=U.defaultProps,xe)fe[oe]===void 0&&(fe[oe]=xe[oe]);return L(U,Me,fe)},Le.createRef=function(){return{current:null}},Le.forwardRef=function(U){return{$$typeof:u,render:U}},Le.isValidElement=$,Le.lazy=function(U){return{$$typeof:h,_payload:{_status:-1,_result:U},_init:ae}},Le.memo=function(U,X){return{$$typeof:f,type:U,compare:X===void 0?null:X}},Le.startTransition=function(U){var X=R.T,ie={};R.T=ie;try{var oe=U(),fe=R.S;fe!==null&&fe(ie,oe),typeof oe=="object"&&oe!==null&&typeof oe.then=="function"&&oe.then(M,ue)}catch(Me){ue(Me)}finally{X!==null&&ie.types!==null&&(X.types=ie.types),R.T=X}},Le.unstable_useCacheRefresh=function(){return R.H.useCacheRefresh()},Le.use=function(U){return R.H.use(U)},Le.useActionState=function(U,X,ie){return R.H.useActionState(U,X,ie)},Le.useCallback=function(U,X){return R.H.useCallback(U,X)},Le.useContext=function(U){return R.H.useContext(U)},Le.useDebugValue=function(){},Le.useDeferredValue=function(U,X){return R.H.useDeferredValue(U,X)},Le.useEffect=function(U,X){return R.H.useEffect(U,X)},Le.useEffectEvent=function(U){return R.H.useEffectEvent(U)},Le.useId=function(){return R.H.useId()},Le.useImperativeHandle=function(U,X,ie){return R.H.useImperativeHandle(U,X,ie)},Le.useInsertionEffect=function(U,X){return R.H.useInsertionEffect(U,X)},Le.useLayoutEffect=function(U,X){return R.H.useLayoutEffect(U,X)},Le.useMemo=function(U,X){return R.H.useMemo(U,X)},Le.useOptimistic=function(U,X){return R.H.useOptimistic(U,X)},Le.useReducer=function(U,X,ie){return R.H.useReducer(U,X,ie)},Le.useRef=function(U){return R.H.useRef(U)},Le.useState=function(U){return R.H.useState(U)},Le.useSyncExternalStore=function(U,X,ie){return R.H.useSyncExternalStore(U,X,ie)},Le.useTransition=function(){return R.H.useTransition()},Le.version="19.2.7",Le}var YN;function oh(){return YN||(YN=1,U1.exports=gee()),U1.exports}var _=oh();const F=ic(_),mee=r8({__proto__:null,default:F},[_]);function vee(e,t={}){const n=_.useRef(e.get()),{keys:r,deps:o=[e,r]}=t,s=_.useCallback(u=>{const c=f=>{n.current!==f&&(n.current=f,u())};return c(e.value),r?.length?pJ(e,r,c):e.listen(c)},o),a=()=>n.current;return _.useSyncExternalStore(s,a,mJ(e)?()=>e.init:a)}function yee(e){return`use${lee(e)}`}function bee(e){const{pluginPathMethods:t,pluginsActions:n,pluginsAtoms:r,hydrateSession:o,$fetch:s,$store:a,atomListeners:u}=iee(e),c={};for(const[f,h]of Object.entries(r))c[yee(f)]=()=>vee(h);return pee({...n,...c,hydrateSession:o,$fetch:s,$store:a},s,t,r,u)}const See=10,Pu=[],wee=["x-correlation-id","x-request-id","x-amzn-requestid","x-amzn-trace-id","apigw-requestid","x-trace-id"];function Cee(e){const t=typeof e=="string"?e:e instanceof URL?e.href:e.url;try{return new URL(t,window.location.origin).pathname}catch{return t.split(/[?#]/)[0]}}function Eee(e,t){return t?.method?t.method.toUpperCase():typeof e!="string"&&!(e instanceof URL)&&e.method?e.method.toUpperCase():"GET"}function _ee(e){for(const t of wee){const n=e.headers.get(t);if(n)return n}}function xee(e){Pu.push(e),Pu.length>See&&Pu.shift()}function QN(e){const{input:t,init:n,response:r,durationMs:o}=e;xee({method:Eee(t,n),path:Cee(t),status:r?.status??0,durationMs:Math.round(o),correlationId:r?_ee(r):void 0,timestamp:new Date().toISOString()})}function Aee(){return Pu.slice()}function Iee(){for(let e=Pu.length-1;e>=0;e--){const t=Pu[e];if(t.status===0||t.status>=400)return t}}class XA extends Error{constructor(t){super(t instanceof Error&&t.message?t.message:"The request could not be completed.",{cause:t}),this.name="NetworkError"}}const Ree=e=>typeof e=="object"&&e!==null&&"name"in e&&e.name==="AbortError",y$=async(e,t)=>{const n=performance.now();try{const r=await fetch(e,{...t,redirect:"manual"}),o=r.type==="opaqueredirect"?new Response(null,{status:401}):r;return QN({input:e,init:t,response:o,durationMs:performance.now()-n}),o}catch(r){throw Ree(r)?r:(QN({input:e,init:t,durationMs:performance.now()-n}),new XA(r))}},JA=()=>{try{return globalThis.sessionStorage??null}catch{return null}},qv=()=>gc().betterAuthEnabled,Tee="EMAIL_PASSWORD_SIGN_UP_DISABLED",Oee=e=>typeof e=="object"&&e!==null&&e.code===Tee,Va=bee(),Mee=60,Pee=30,k_="remit.better-auth.token",Nee=()=>{const e=JA()?.getItem(k_);if(!e)return null;try{const t=JSON.parse(e);if(t&&typeof t=="object"&&typeof t.value=="string"&&typeof t.expiresAt=="number")return{value:t.value,expiresAt:t.expiresAt}}catch{}return null},b$=e=>{const t=JA();if(t)try{if(!e){t.removeItem(k_);return}t.setItem(k_,JSON.stringify(e))}catch{}};let Aa=null,Rm=0;const kee=()=>Aa||(Aa=Nee(),Aa),Pa=()=>Math.floor(Date.now()/1e3),Dee=e=>{const[,t]=e.split(".");if(!t)return Pa();try{const n=JSON.parse(atob(t.replace(/-/g,"+").replace(/_/g,"/")));return typeof n.exp=="number"?n.exp:Pa()}catch{return Pa()}};class Tm extends Error{status;constructor(t,n){super(t),this.name="AuthTokenError",this.status=n}}const Lee=async()=>{const e=await y$("/api/auth/token",{credentials:"include"});if(!e.ok)throw new Tm(`Could not mint a session token: ${e.status} ${e.statusText}`,e.status);const t=await e.json();if(t&&typeof t=="object"&&"token"in t&&typeof t.token=="string")return t.token;throw new Tm("The token endpoint returned no token")};let Cd=null;const Uee=()=>Cd||(Cd=Lee().then(e=>(Aa={value:e,expiresAt:Dee(e)},b$(Aa),Rm=0,e)).finally(()=>{Cd=null}),Cd),$ee=e=>e.expiresAt-Mee>Pa(),XN=e=>e.expiresAt>Pa(),Fee=e=>e instanceof XA?!0:e instanceof Tm?e.status===408||e.status===429||(e.status??0)>=500:!1,zee=e=>e instanceof Tm&&(e.status===401||e.status===403),jee=async()=>{const e=kee();if(e&&$ee(e)||e&&XN(e)&&Pa()<Rm)return e.value;try{return await Uee()}catch(t){if(zee(t))throw eI(),t.status===403&&Va.$store.notify("$sessionSignal"),t;if(e&&XN(e)&&Fee(t))return Rm=Pa()+Pee,e.value;throw t}},eI=()=>{Rm=0,b$(null),Aa=null};const Bee=e=>e?.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();function Hee(e,t,n=[]){if(t==null)throw new Error("[lucide]: iconNode is required when icon name is used");return{name:Bee(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}const qee=e=>{let t="",n=!1;for(const r of e){if(r==="-"||r==="_"||r<=" "){n=t.length>0;continue}t.length===0?t+=r.toLowerCase():t+=n?r.toUpperCase():r,n=!1}return t};const Vee=e=>{const t=qee(e);return t.charAt(0).toUpperCase()+t.slice(1)};const D_=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();const wa={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};function $1(e){return e!=null}function Wee(e,t={}){const n=t.attributeNames??{},r=m=>n[m]??m,o=e.size??e.width??wa.width,s=e.size??e.height??wa.height,a=e.aliases?.filter(m=>typeof m=="string"&&m.trim()!=="").map(m=>`lucide-${m}`)??[],u=[...e.name?[`lucide-${e.name}`]:[],...a],c=t.className?.split(" ").filter(Boolean)??[],f=t.includeDefaultClasses===!1?D_(...c):D_("lucide",...u,...c),h=t.absoluteStrokeWidth?Number(t.strokeWidth??wa["stroke-width"])*Number(e.size??e.width??wa.width)/Number(t.size??t.width??wa.width):t.strokeWidth??wa["stroke-width"];return["svg",{...Object.entries(wa).reduce((m,[v,w])=>(m[r(v)]=w,m),{}),..."color"in t&&t.color&&{[r("stroke")]:t.color},..."size"in t&&$1(t.size)&&{[r("width")]:t.size,[r("height")]:t.size},..."width"in t&&$1(t.width)&&{[r("width")]:t.width},..."height"in t&&$1(t.height)&&{[r("height")]:t.height},[r("stroke-width")]:h,...f&&{[r("class")]:f},[r("viewBox")]:`0 0 ${o} ${s}`,...t.hasA11yProp===!1?{[r("aria-hidden")]:"true"}:{},..."attributes"in t&&t.attributes},e.node.map(m=>{const[v,w,S]=m,C=t.nonScalingStroke?{[r("vector-effect")]:"non-scaling-stroke",...w}:w;return S?[v,C,S]:[v,C]})]}function Gee(e,t={}){return Wee(e,{...t,attributeNames:{...t.attributeNames,class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","vector-effect":"vectorEffect"}})}const Kee=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},Zee=_.createContext({}),Yee=()=>_.useContext(Zee),Qee=_.forwardRef(({color:e,size:t,width:n,height:r,strokeWidth:o,absoluteStrokeWidth:s,nonScalingStroke:a,className:u="",children:c,iconNode:f=[],icon:h={node:f,aliases:[],size:24},...g},m)=>{const{size:v=24,strokeWidth:w=2,absoluteStrokeWidth:S=!1,nonScalingStroke:C=!1,color:E="currentColor",className:A=""}=Yee()??{},I=!!c||Kee(g),[T,N,M=[]]=Gee(h,{color:e??E,width:n??t??v,height:r??t??v,strokeWidth:o??w,absoluteStrokeWidth:s??S,nonScalingStroke:a??C,className:D_(A,u),hasA11yProp:I,attributes:g});return _.createElement(T,{ref:m,...N},[...M.map(([R,k])=>_.createElement(R,k)),...Array.isArray(c)?c:[c]])});function yt(e,t=[],n=[]){const r=typeof e=="string"?Hee(e,t,n):e,o=_.forwardRef(({className:s,...a},u)=>_.createElement(Qee,{ref:u,icon:r,className:s,...a}));return r.name&&(o.displayName=Vee(r.name)),o}const S$={name:"archive",size:24,node:[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]};S$.node;const Xee=yt(S$);const w$={name:"calendar-days",size:24,node:[["path",{d:"M8 2v3",key:"1ioesn"}],["path",{d:"M16 2v3",key:"otl347"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M8 13h.01",key:"1sbv64"}],["path",{d:"M12 13h.01",key:"y0uutt"}],["path",{d:"M16 13h.01",key:"wip0gl"}],["path",{d:"M8 17h.01",key:"p3bg7i"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M16 17h.01",key:"ql8jdd"}]]};w$.node;const Jee=yt(w$);const C$={name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]};C$.node;const E$=yt(C$);const _$={name:"chevron-right",size:24,node:[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]};_$.node;const ete=yt(_$);const x$={name:"circle-alert",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],aliases:["alert-circle"]};x$.node;const A$=yt(x$);const I$={name:"eye",size:24,node:[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]};I$.node;const tte=yt(I$);const R$={name:"eye-off",size:24,node:[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]};R$.node;const nte=yt(R$);const T$={name:"file-text",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]};T$.node;const rte=yt(T$);const O$={name:"folder",size:24,node:[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]};O$.node;const ote=yt(O$);const M$={name:"folder-plus",size:24,node:[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]};M$.node;const ste=yt(M$);const P$={name:"folder-tree",size:24,node:[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]};P$.node;const ite=yt(P$);const N$={name:"funnel",size:24,node:[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],aliases:["filter"]};N$.node;const ate=yt(N$);const k$={name:"inbox",size:24,node:[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]};k$.node;const D$=yt(k$);const L$={name:"info",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]};L$.node;const lte=yt(L$);const U$={name:"loader-circle",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],aliases:["loader-2"]};U$.node;const $$=yt(U$);const F$={name:"log-in",size:24,node:[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]]};F$.node;const JN=yt(F$);const z$={name:"mails",size:24,node:[["path",{d:"M17 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 1-1.732",key:"1vyzll"}],["path",{d:"m22 5.5-6.419 4.179a2 2 0 0 1-2.162 0L7 5.5",key:"k7ramc"}],["rect",{x:"7",y:"3",width:"15",height:"12",rx:"2",key:"17196g"}]]};z$.node;const ute=yt(z$);const j$={name:"octagon-alert",size:24,node:[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]],aliases:["alert-octagon"]};j$.node;const tI=yt(j$);const B$={name:"palette",size:24,node:[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]]};B$.node;const cte=yt(B$);const H$={name:"search",size:24,node:[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]};H$.node;const dte=yt(H$);const q$={name:"send",size:24,node:[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]};q$.node;const fte=yt(q$);const V$={name:"sparkles",size:24,node:[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],aliases:["stars"]};V$.node;const hte=yt(V$);const W$={name:"star",size:24,node:[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]};W$.node;const pte=yt(W$);const G$={name:"tag",size:24,node:[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]};G$.node;const gte=yt(G$);const K$={name:"trash",size:24,node:[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],aliases:["trash-2"]};K$.node;const mte=yt(K$);const Z$={name:"triangle-alert",size:24,node:[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["alert-triangle"]};Z$.node;const nI=yt(Z$);const Y$={name:"user-cog",size:24,node:[["path",{d:"M10 15H6a4 4 0 0 0-4 4v2",key:"1nfge6"}],["path",{d:"m14.305 16.53.923-.382",key:"1itpsq"}],["path",{d:"m15.228 13.852-.923-.383",key:"eplpkm"}],["path",{d:"m16.852 12.228-.383-.923",key:"13v3q0"}],["path",{d:"m16.852 17.772-.383.924",key:"1i8mnm"}],["path",{d:"m19.148 12.228.383-.923",key:"1q8j1v"}],["path",{d:"m19.53 18.696-.382-.924",key:"vk1qj3"}],["path",{d:"m20.772 13.852.924-.383",key:"n880s0"}],["path",{d:"m20.772 16.148.924.383",key:"1g6xey"}],["circle",{cx:"18",cy:"15",r:"3",key:"gjjjvw"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]};Y$.node;const vte=yt(Y$);const Q$={name:"users",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]};Q$.node;const yte=yt(Q$);const X$={name:"wrench",size:24,node:[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]};X$.node;const bte=yt(X$);const J$={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]};J$.node;const L_=yt(J$);function eF(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=eF(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Ste(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=eF(e))&&(r&&(r+=" "),r+=t);return r}const rI="-",wte=e=>{const t=Ete(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:a=>{const u=a.split(rI);return u[0]===""&&u.length!==1&&u.shift(),tF(u,t)||Cte(a)},getConflictingClassGroupIds:(a,u)=>{const c=n[a]||[];return u&&r[a]?[...c,...r[a]]:c}}},tF=(e,t)=>{if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?tF(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const s=e.join(rI);return t.validators.find(({validator:a})=>a(s))?.classGroupId},ek=/^\[(.+)\]$/,Cte=e=>{if(ek.test(e)){const t=ek.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},Ete=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return xte(Object.entries(e.classGroups),n).forEach(([s,a])=>{U_(a,r,s,t)}),r},U_=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const s=o===""?t:tk(t,o);s.classGroupId=n;return}if(typeof o=="function"){if(_te(o)){U_(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([s,a])=>{U_(a,tk(t,s),n,r)})})},tk=(e,t)=>{let n=e;return t.split(rI).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},_te=e=>e.isThemeGetter,xte=(e,t)=>t?e.map(([n,r])=>{const o=r.map(s=>typeof s=="string"?t+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([a,u])=>[t+a,u])):s);return[n,o]}):e,Ate=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(s,a)=>{n.set(s,a),t++,t>e&&(t=0,r=n,n=new Map)};return{get(s){let a=n.get(s);if(a!==void 0)return a;if((a=r.get(s))!==void 0)return o(s,a),a},set(s,a){n.has(s)?n.set(s,a):o(s,a)}}},nF="!",Ite=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,o=t[0],s=t.length,a=u=>{const c=[];let f=0,h=0,g;for(let C=0;C<u.length;C++){let E=u[C];if(f===0){if(E===o&&(r||u.slice(C,C+s)===t)){c.push(u.slice(h,C)),h=C+s;continue}if(E==="/"){g=C;continue}}E==="["?f++:E==="]"&&f--}const m=c.length===0?u:u.substring(h),v=m.startsWith(nF),w=v?m.substring(1):m,S=g&&g>h?g-h:void 0;return{modifiers:c,hasImportantModifier:v,baseClassName:w,maybePostfixModifierPosition:S}};return n?u=>n({className:u,parseClassName:a}):a},Rte=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},Tte=e=>({cache:Ate(e.cacheSize),parseClassName:Ite(e),...wte(e)}),Ote=/\s+/,Mte=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,s=[],a=e.trim().split(Ote);let u="";for(let c=a.length-1;c>=0;c-=1){const f=a[c],{modifiers:h,hasImportantModifier:g,baseClassName:m,maybePostfixModifierPosition:v}=n(f);let w=!!v,S=r(w?m.substring(0,v):m);if(!S){if(!w){u=f+(u.length>0?" "+u:u);continue}if(S=r(m),!S){u=f+(u.length>0?" "+u:u);continue}w=!1}const C=Rte(h).join(":"),E=g?C+nF:C,A=E+S;if(s.includes(A))continue;s.push(A);const I=o(S,w);for(let T=0;T<I.length;++T){const N=I[T];s.push(E+N)}u=f+(u.length>0?" "+u:u)}return u};function Pte(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=rF(t))&&(r&&(r+=" "),r+=n);return r}const rF=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=rF(e[r]))&&(n&&(n+=" "),n+=t);return n};function Nte(e,...t){let n,r,o,s=a;function a(c){const f=t.reduce((h,g)=>g(h),e());return n=Tte(f),r=n.cache.get,o=n.cache.set,s=u,u(c)}function u(c){const f=r(c);if(f)return f;const h=Mte(c,n);return o(c,h),h}return function(){return s(Pte.apply(null,arguments))}}const Lt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},oF=/^\[(?:([a-z-]+):)?(.+)\]$/i,kte=/^\d+\/\d+$/,Dte=new Set(["px","full","screen"]),Lte=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ute=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,$te=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Fte=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,zte=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ms=e=>Nu(e)||Dte.has(e)||kte.test(e),bi=e=>mc(e,"length",Kte),Nu=e=>!!e&&!Number.isNaN(Number(e)),F1=e=>mc(e,"number",Nu),Ed=e=>!!e&&Number.isInteger(Number(e)),jte=e=>e.endsWith("%")&&Nu(e.slice(0,-1)),je=e=>oF.test(e),Si=e=>Lte.test(e),Bte=new Set(["length","size","percentage"]),Hte=e=>mc(e,Bte,sF),qte=e=>mc(e,"position",sF),Vte=new Set(["image","url"]),Wte=e=>mc(e,Vte,Yte),Gte=e=>mc(e,"",Zte),_d=()=>!0,mc=(e,t,n)=>{const r=oF.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},Kte=e=>Ute.test(e)&&!$te.test(e),sF=()=>!1,Zte=e=>Fte.test(e),Yte=e=>zte.test(e),Qte=()=>{const e=Lt("colors"),t=Lt("spacing"),n=Lt("blur"),r=Lt("brightness"),o=Lt("borderColor"),s=Lt("borderRadius"),a=Lt("borderSpacing"),u=Lt("borderWidth"),c=Lt("contrast"),f=Lt("grayscale"),h=Lt("hueRotate"),g=Lt("invert"),m=Lt("gap"),v=Lt("gradientColorStops"),w=Lt("gradientColorStopPositions"),S=Lt("inset"),C=Lt("margin"),E=Lt("opacity"),A=Lt("padding"),I=Lt("saturate"),T=Lt("scale"),N=Lt("sepia"),M=Lt("skew"),R=Lt("space"),k=Lt("translate"),L=()=>["auto","contain","none"],q=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto",je,t],D=()=>[je,t],j=()=>["",ms,bi],Z=()=>["auto",Nu,je],he=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],B=()=>["solid","dashed","dotted","double","none"],Q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ae=()=>["start","end","center","between","around","evenly","stretch"],ue=()=>["","0",je],we=()=>["auto","avoid","all","avoid-page","page","left","right","column"],U=()=>[Nu,je];return{cacheSize:500,separator:":",theme:{colors:[_d],spacing:[ms,bi],blur:["none","",Si,je],brightness:U(),borderColor:[e],borderRadius:["none","","full",Si,je],borderSpacing:D(),borderWidth:j(),contrast:U(),grayscale:ue(),hueRotate:U(),invert:ue(),gap:D(),gradientColorStops:[e],gradientColorStopPositions:[jte,bi],inset:$(),margin:$(),opacity:U(),padding:D(),saturate:U(),scale:U(),sepia:ue(),skew:U(),space:D(),translate:D()},classGroups:{aspect:[{aspect:["auto","square","video",je]}],container:["container"],columns:[{columns:[Si]}],"break-after":[{"break-after":we()}],"break-before":[{"break-before":we()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...he(),je]}],overflow:[{overflow:q()}],"overflow-x":[{"overflow-x":q()}],"overflow-y":[{"overflow-y":q()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[S]}],"inset-x":[{"inset-x":[S]}],"inset-y":[{"inset-y":[S]}],start:[{start:[S]}],end:[{end:[S]}],top:[{top:[S]}],right:[{right:[S]}],bottom:[{bottom:[S]}],left:[{left:[S]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ed,je]}],basis:[{basis:$()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",je]}],grow:[{grow:ue()}],shrink:[{shrink:ue()}],order:[{order:["first","last","none",Ed,je]}],"grid-cols":[{"grid-cols":[_d]}],"col-start-end":[{col:["auto",{span:["full",Ed,je]},je]}],"col-start":[{"col-start":Z()}],"col-end":[{"col-end":Z()}],"grid-rows":[{"grid-rows":[_d]}],"row-start-end":[{row:["auto",{span:[Ed,je]},je]}],"row-start":[{"row-start":Z()}],"row-end":[{"row-end":Z()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",je]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",je]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal",...ae()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ae(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ae(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[A]}],px:[{px:[A]}],py:[{py:[A]}],ps:[{ps:[A]}],pe:[{pe:[A]}],pt:[{pt:[A]}],pr:[{pr:[A]}],pb:[{pb:[A]}],pl:[{pl:[A]}],m:[{m:[C]}],mx:[{mx:[C]}],my:[{my:[C]}],ms:[{ms:[C]}],me:[{me:[C]}],mt:[{mt:[C]}],mr:[{mr:[C]}],mb:[{mb:[C]}],ml:[{ml:[C]}],"space-x":[{"space-x":[R]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[R]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",je,t]}],"min-w":[{"min-w":[je,t,"min","max","fit"]}],"max-w":[{"max-w":[je,t,"none","full","min","max","fit","prose",{screen:[Si]},Si]}],h:[{h:[je,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[je,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[je,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[je,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Si,bi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",F1]}],"font-family":[{font:[_d]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",je]}],"line-clamp":[{"line-clamp":["none",Nu,F1]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ms,je]}],"list-image":[{"list-image":["none",je]}],"list-style-type":[{list:["none","disc","decimal",je]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[E]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[E]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...B(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",ms,bi]}],"underline-offset":[{"underline-offset":["auto",ms,je]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:D()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",je]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",je]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[E]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...he(),qte]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Hte]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Wte]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[w]}],"gradient-via-pos":[{via:[w]}],"gradient-to-pos":[{to:[w]}],"gradient-from":[{from:[v]}],"gradient-via":[{via:[v]}],"gradient-to":[{to:[v]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[u]}],"border-w-x":[{"border-x":[u]}],"border-w-y":[{"border-y":[u]}],"border-w-s":[{"border-s":[u]}],"border-w-e":[{"border-e":[u]}],"border-w-t":[{"border-t":[u]}],"border-w-r":[{"border-r":[u]}],"border-w-b":[{"border-b":[u]}],"border-w-l":[{"border-l":[u]}],"border-opacity":[{"border-opacity":[E]}],"border-style":[{border:[...B(),"hidden"]}],"divide-x":[{"divide-x":[u]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[u]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[E]}],"divide-style":[{divide:B()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...B()]}],"outline-offset":[{"outline-offset":[ms,je]}],"outline-w":[{outline:[ms,bi]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:j()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[E]}],"ring-offset-w":[{"ring-offset":[ms,bi]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Si,Gte]}],"shadow-color":[{shadow:[_d]}],opacity:[{opacity:[E]}],"mix-blend":[{"mix-blend":[...Q(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Q()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",Si,je]}],grayscale:[{grayscale:[f]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[g]}],saturate:[{saturate:[I]}],sepia:[{sepia:[N]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[f]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h]}],"backdrop-invert":[{"backdrop-invert":[g]}],"backdrop-opacity":[{"backdrop-opacity":[E]}],"backdrop-saturate":[{"backdrop-saturate":[I]}],"backdrop-sepia":[{"backdrop-sepia":[N]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",je]}],duration:[{duration:U()}],ease:[{ease:["linear","in","out","in-out",je]}],delay:[{delay:U()}],animate:[{animate:["none","spin","ping","pulse","bounce",je]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[T]}],"scale-x":[{"scale-x":[T]}],"scale-y":[{"scale-y":[T]}],rotate:[{rotate:[Ed,je]}],"translate-x":[{"translate-x":[k]}],"translate-y":[{"translate-y":[k]}],"skew-x":[{"skew-x":[M]}],"skew-y":[{"skew-y":[M]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",je]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",je]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-mt":[{"scroll-mt":D()}],"scroll-mr":[{"scroll-mr":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-pe":[{"scroll-pe":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-pr":[{"scroll-pr":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",je]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[ms,bi,F1]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},Xte=Nte(Qte);function rn(...e){return Xte(Ste(e))}var z1={exports:{}},Fn={};var nk;function Jte(){if(nk)return Fn;nk=1;var e=oh();function t(c){var f="https://react.dev/errors/"+c;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)f+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+c+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},o=Symbol.for("react.portal");function s(c,f,h){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:g==null?null:""+g,children:c,containerInfo:f,implementation:h}}var a=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(c,f){if(c==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return Fn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Fn.createPortal=function(c,f){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(t(299));return s(c,f,null,h)},Fn.flushSync=function(c){var f=a.T,h=r.p;try{if(a.T=null,r.p=2,c)return c()}finally{a.T=f,r.p=h,r.d.f()}},Fn.preconnect=function(c,f){typeof c=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,r.d.C(c,f))},Fn.prefetchDNS=function(c){typeof c=="string"&&r.d.D(c)},Fn.preinit=function(c,f){if(typeof c=="string"&&f&&typeof f.as=="string"){var h=f.as,g=u(h,f.crossOrigin),m=typeof f.integrity=="string"?f.integrity:void 0,v=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;h==="style"?r.d.S(c,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:g,integrity:m,fetchPriority:v}):h==="script"&&r.d.X(c,{crossOrigin:g,integrity:m,fetchPriority:v,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},Fn.preinitModule=function(c,f){if(typeof c=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var h=u(f.as,f.crossOrigin);r.d.M(c,{crossOrigin:h,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&r.d.M(c)},Fn.preload=function(c,f){if(typeof c=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var h=f.as,g=u(h,f.crossOrigin);r.d.L(c,h,{crossOrigin:g,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},Fn.preloadModule=function(c,f){if(typeof c=="string")if(f){var h=u(f.as,f.crossOrigin);r.d.m(c,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:h,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else r.d.m(c)},Fn.requestFormReset=function(c){r.d.r(c)},Fn.unstable_batchedUpdates=function(c,f){return c(f)},Fn.useFormState=function(c,f,h){return a.H.useFormState(c,f,h)},Fn.useFormStatus=function(){return a.H.useHostTransitionStatus()},Fn.version="19.2.7",Fn}var rk;function iF(){if(rk)return z1.exports;rk=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),z1.exports=Jte(),z1.exports}var ene=iF();const xd={action:null,nextPrefix:null,preventDefault:!1},tne={b:"goBrief",i:"goInbox",s:"goSent",f:"goFlagged",",":"goSettings"},nne={j:{action:"focusNext"},k:{action:"focusPrevious"},arrowdown:{action:"focusNext"},arrowup:{action:"focusPrevious"},home:{action:"focusFirst"},end:{action:"focusLast"},enter:{action:"openFocused"}," ":{action:"toggleSelect"},delete:{action:"delete"},backspace:{action:"delete"},u:{action:"toggleRead"},x:{action:"toggleSelect"},r:{action:"reply"},a:{action:"replyAll"},f:{action:"forward"},"#":{action:"delete"},s:{action:"toggleStar"},m:{action:"muteSender"},b:{action:"blockSender"},v:{action:"vipSender"},"!":{action:"markJunk"},i:{action:"toggleIntelligence"},d:{action:"toggleDensity"},"/":{action:"focusSearch"},c:{action:"compose"},"?":{action:"help"}};function rne(e,t){const n=e.key.toLowerCase(),r=e.metaKey||e.ctrlKey;if(e.inEditable)return{...xd,nextPrefix:t==="g"?null:t};if(e.onControl&&(n==="enter"||n===" "))return{...xd,nextPrefix:t==="g"?null:t};if(r&&n==="n")return{action:"compose",nextPrefix:null,preventDefault:!0};if(r&&n==="a")return{action:"selectAll",nextPrefix:null,preventDefault:!0};if(r)return{...xd,nextPrefix:t==="g"?null:t};if(n==="escape")return{action:"back",nextPrefix:null,preventDefault:!1};if(t==="g"){const a=tne[n===","?",":n]??null;return{action:a,nextPrefix:null,preventDefault:a!==null}}if(n==="g"&&!e.shiftKey)return{action:null,nextPrefix:"g",preventDefault:!0};if(e.shiftKey){const s=n==="j"||n==="arrowdown";if(s||(n==="k"||n==="arrowup"))return{action:s?"extendSelectDown":"extendSelectUp",nextPrefix:null,preventDefault:!0}}const o=nne[n];if(o){const s=o.requireShift===!0,a=n.length===1&&!/[a-z0-9]/.test(n);return!s&&e.shiftKey&&!a?xd:{action:o.action,nextPrefix:null,preventDefault:!0}}return xd}function one(e){if(!(e instanceof HTMLElement))return!1;const t=e.tagName;return t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable}const sne="data-message-row",ine='button, a[href], summary, [role="button"], [role="menuitem"], [role="tab"], [role="switch"], [role="checkbox"]';function ane(e){if(!(e instanceof HTMLElement))return!1;const t=e.closest(ine);return t?!t.hasAttribute(sne):!1}const lne=["reply","replyAll","forward","delete","toggleStar","toggleRead","muteSender","blockSender","vipSender","markJunk"],une=["focusNext","focusPrevious","focusFirst","focusLast","openFocused","toggleSelect","extendSelectDown","extendSelectUp","selectAll","toggleDensity"],Cn=(e,...t)=>({action:e,requires:t});Cn("help"),Cn("goBrief",{listIsNot:"brief"}),Cn("goFlagged",{listIsNot:"flagged"}),Cn("goInbox",{listIsNot:"inbox"}),Cn("goSent",{listIsNot:"sent"}),Cn("goSettings"),Cn("compose"),Cn("focusSearch"),Cn("toggleIntelligence"),[...une.map(e=>Cn(e,"listVisible")),...lne.map(e=>Cn(e,"aimed")),Cn("back","selection")],Cn("focusNext","threadOpen",{not:"listVisible"}),Cn("focusPrevious","threadOpen",{not:"listVisible"}),Cn("reply","threadOpen"),Cn("replyAll","threadOpen"),Cn("forward","threadOpen"),Cn("back");function cne(e,t){const n=t.at(-1);return n?n.handles.includes(e)?{outcome:"act",target:{kind:"overlay",frame:n}}:{outcome:"contained",by:{kind:"overlay",frame:n}}:null}const dne="[data-escape-owner]";let ju=[],fne=0;const hne=()=>++fne;function aF(){const[e]=_.useState(hne);return e}const pne=(e,t)=>e.depth-t.depth;function gne(){return[...ju].sort(pne).map(e=>({id:e.id,handles:Object.entries(e.run()).filter(([,t])=>t).map(([t])=>t)}))}function mne(){let e;for(const t of ju)(!e||t.depth>e.depth)&&(e=t);return e}function e6e(e){return cne(e,gne())}function vne(e){if(e.key==="Escape"){const t=document.activeElement;return t instanceof Element&&t.closest(dne)?null:"back"}return rne({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,inEditable:one(e.target),onControl:ane(e.target)},null).action}function ok(e){const t=mne();if(!t)return;const n=vne(e);if(!n)return;const r=t.run()[n];r&&(e.preventDefault(),e.stopImmediatePropagation(),r())}function sk(e){const t=ju.length===0;if(ju=e,t!==(e.length===0)){if(e.length>0){window.addEventListener("keydown",ok,!0);return}window.removeEventListener("keydown",ok,!0)}}function Vv({id:e,open:t,answers:n={}}){const r=_.useRef(n);r.current=n;const o=aF();_.useEffect(()=>{if(!t)return;const s={id:e,depth:o,run:()=>r.current};return sk([...ju,s]),()=>{sk(ju.filter(a=>a!==s))}},[e,t,o])}const lF="inline-flex items-center justify-center gap-2 rounded-md font-medium whitespace-nowrap transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface disabled:opacity-50 disabled:pointer-events-none",uF={primary:"bg-accent text-accent-fg hover:bg-accent-hover",secondary:"bg-surface text-fg border border-line hover:bg-surface-sunken hover:border-line-strong",ghost:"text-fg-muted hover:bg-surface-sunken hover:text-fg",danger:"bg-danger text-accent-fg hover:opacity-90"},cF={sm:"h-7 px-2.5 text-xs",md:"h-9 px-3.5 text-sm",touch:"h-11 w-11 text-sm"};function Xr({variant:e="primary",size:t="md",icon:n,className:r,children:o,ref:s,...a}){return O.jsxs("button",{type:"button",ref:s,className:rn(lF,uF[e],cF[t],r),...a,children:[n,o]})}function t6e({variant:e="primary",size:t="md",icon:n,external:r,className:o,children:s,...a}){return O.jsxs("a",{className:rn(lF,uF[e],cF[t],o),...r?{target:"_blank",rel:"noopener noreferrer"}:{},...a,children:[n,s]})}const yne='a[href], button, input, select, textarea, iframe, [tabindex], [contenteditable]:not([contenteditable="false"])';function bne(e){if(Number(e.getAttribute("tabindex")??0)<0||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"||e.closest("[inert], [hidden], [aria-hidden='true']"))return!1;const t=getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}function ik(e){const t=e.querySelectorAll('[role="dialog"][aria-modal="true"]');return[...(t[t.length-1]??e).querySelectorAll(yne)].filter(bne)}const $_=new Set;function Sne(e){for(const t of $_)if(t>e)return!1;return!0}function wne(e,t){return!(t instanceof HTMLElement)||t===document.body||t===document.documentElement?!1:!e.contains(t)}function Wv(e,t){const n=aF();_.useEffect(()=>{if(t)return $_.add(n),()=>{$_.delete(n)}},[t,n]),_.useEffect(()=>{if(!t)return;const r=document.activeElement instanceof HTMLElement?document.activeElement:null,o=e.current;return o&&(ik(o)[0]??o).focus(),()=>{r?.isConnected&&r.focus()}},[t,e]),_.useEffect(()=>{if(!t)return;const r=o=>{if(o.key!=="Tab"||o.defaultPrevented||!Sne(n))return;const s=e.current;if(!s)return;const a=document.activeElement;if(wne(s,a))return;const u=ik(s),c=u[0],f=u.at(-1);if(!c||!f){o.preventDefault(),s.focus();return}const h=a instanceof HTMLElement&&u.includes(a);if(o.shiftKey){(!h||a===c)&&(o.preventDefault(),f.focus());return}(!h||a===f)&&(o.preventDefault(),c.focus())};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[t,e,n])}const Cne=({label:e,onDismiss:t,className:n})=>O.jsx("button",{type:"button","aria-label":e,tabIndex:-1,onClick:t,className:rn("absolute inset-0 bg-canvas/80",n)}),Ene={info:"bg-accent-2/15 text-accent-2 border-accent-2/40",success:"bg-positive/15 text-positive border-positive/40",warning:"bg-warning/15 text-warning border-warning/40",danger:"bg-danger/15 text-danger border-danger/40"},_ne={info:"bg-surface-sunken text-fg-muted",success:"bg-positive/10 text-positive",warning:"bg-warning/10 text-warning",danger:"bg-danger-soft text-danger"},xne={info:"status",success:"status",warning:"alert",danger:"alert"};function Zr({tone:e="info",variant:t="framed",onDismiss:n,role:r,className:o,children:s,...a}){const u=t==="soft";return O.jsxs("div",{role:r??xne[e],className:rn("flex gap-2 px-3 py-2 text-sm",u?rn("items-start rounded-md",_ne[e]):rn("items-center border",Ene[e]),o),...a,children:[O.jsx("div",{className:"flex-1 min-w-0",children:s}),n&&(u?O.jsx(Xr,{variant:"ghost",size:"sm",icon:O.jsx(L_,{className:"size-3.5"}),onClick:n,"aria-label":"Dismiss",className:"-mr-1 shrink-0"}):O.jsx("button",{type:"button",onClick:n,"aria-label":"Dismiss",className:"shrink-0 rounded-md p-1 hover:bg-fg/10 transition-colors",children:O.jsx(L_,{className:"size-4","aria-hidden":"true"})}))]})}function ak({open:e,onClose:t,title:n,children:r,className:o,anchor:s="center"}){const a=_.useRef(null);if(Vv({id:"dialog",open:e,answers:{back:t}}),Wv(a,e),!e)return null;const u=s==="left",c=s==="right";return O.jsxs("div",{className:rn("fixed inset-0 z-50 flex",u?"items-stretch justify-start":c?"items-stretch justify-end":"items-center justify-center px-4"),children:[O.jsx(Cne,{label:"Dismiss dialog",onDismiss:t}),O.jsxs("div",{ref:a,role:"dialog","aria-modal":"true","aria-labelledby":"dialog-title",tabIndex:-1,className:rn("relative z-10 overflow-hidden border-line bg-surface shadow-xl",u?"safe-area-frame h-full w-72 max-w-[85vw] border-r":c?"safe-area-frame h-full w-[80vw] max-w-[320px] border-l":"w-full max-w-lg rounded-md border",o),children:[O.jsx("h2",{id:"dialog-title",className:"sr-only",children:n}),r]})]})}function dF({children:e,label:t}){return O.jsxs("span",{className:"relative inline-flex",children:[e,t!==void 0&&O.jsxs(O.Fragment,{children:[O.jsx("span",{"data-testid":"attention-dot",className:"absolute -right-1 -top-1 size-2 rounded-full bg-accent-2"}),O.jsx("span",{className:"sr-only",children:t})]})]})}function Gv({children:e,className:t}){return O.jsx("div",{"data-auth-page":!0,className:rn("flex min-h-dvh w-full flex-col items-center justify-center overflow-y-auto bg-surface-sunken pb-[max(2rem,env(safe-area-inset-bottom,0px))] pl-[max(1rem,env(safe-area-inset-left,0px))] pr-[max(1rem,env(safe-area-inset-right,0px))] pt-[max(2rem,env(safe-area-inset-top,0px))] text-fg",t),style:{backgroundImage:"radial-gradient(at 20% 0%, color-mix(in oklch, var(--accent) 8%, transparent) 0px, transparent 50%), radial-gradient(at 80% 100%, color-mix(in oklch, var(--accent) 8%, transparent) 0px, transparent 50%)"},children:O.jsx("div",{className:"w-full max-w-[26rem]",children:e})})}const Ane="Secure sign-in powered by AWS Cognito";function oI(e){const t=e?.note??"Secure sign-in";return O.jsx("div",{className:"text-center pt-5",children:O.jsx("p",{className:"text-xs text-fg-muted",children:t})})}const Ine=()=>O.jsxs("svg",{width:"36",height:"36",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:"text-accent",children:[O.jsx("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),O.jsx("path",{d:"M3 7l9 6 9-6"})]});function Kv({wordmark:e="remit,",tagline:t="your email client in the cloud.",mark:n=O.jsx(Ine,{})}){return O.jsxs("div",{className:"text-center pb-6",children:[O.jsx("div",{className:"flex items-center justify-center pb-3",children:n}),O.jsx("h1",{className:"text-[1.75rem] font-semibold tracking-[-0.01em] text-fg",children:e}),O.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:t})]})}const Rne={default:rn("flex h-9 items-center gap-2 rounded-md border border-line bg-surface-sunken px-3 text-sm","focus-within:border-line-strong focus-within:ring-2 focus-within:ring-ring/30 transition-colors"),inline:"flex items-center gap-2 bg-transparent text-sm"};function Sf({icon:e,className:t,variant:n="default",trailing:r,ref:o,...s}){return O.jsxs("div",{className:rn(Rne[n],t),children:[e&&O.jsx("span",{className:"text-fg-subtle shrink-0",children:e}),O.jsx("input",{ref:o,className:"min-w-0 flex-1 bg-transparent text-fg placeholder:text-fg-subtle outline-none",...s}),r]})}const Tne={error:{container:"border-danger/50 bg-danger-soft",icon:"text-danger",title:"text-danger"},warning:{container:"border-warning/50 bg-warning-soft",icon:"text-warning",title:"text-warning"},info:{container:"border-accent-2/50 bg-accent-2-soft",icon:"text-accent-2",title:"text-accent-2"}},One={error:A$,warning:nI,info:lte},Mne={error:"Error",warning:"Warning",info:"Information"},Pne=({id:e,severity:t,title:n,detail:r,action:o,onDismiss:s})=>{const a=Tne[t],u=One[t];return O.jsxs("div",{role:t==="error"?"alert":"status","aria-live":t==="error"?"assertive":"polite",className:rn("pointer-events-auto flex items-start gap-3 rounded-md border bg-canvas px-3 py-2 shadow-lg",a.container),children:[O.jsx(u,{className:rn("size-5 shrink-0 mt-0.5",a.icon),"aria-hidden":"true"}),O.jsxs("div",{className:"flex-1 min-w-0",children:[O.jsx("p",{className:rn("text-sm font-medium",a.title),children:n}),r&&O.jsx("p",{className:"mt-0.5 text-xs text-fg-muted break-words",children:r}),o&&O.jsx("a",{href:o.href,target:"_blank",rel:"noopener noreferrer",className:"mt-1 inline-block text-xs font-medium text-accent-2 underline underline-offset-2",children:o.label})]}),O.jsx("button",{type:"button",onClick:()=>s(e),className:"shrink-0 rounded-md p-1 text-fg-muted hover:bg-surface-raised hover:text-fg transition-colors","aria-label":`Dismiss ${Mne[t].toLowerCase()}`,children:O.jsx(L_,{className:"size-4","aria-hidden":"true"})})]})},Nne=({errors:e,onDismiss:t})=>e.length===0?null:O.jsx("section",{"aria-label":"Notifications",className:"pointer-events-none fixed inset-x-0 top-0 z-[60] flex flex-col items-center gap-2 px-4 pt-[calc(1rem+env(safe-area-inset-top,0px))] sm:items-end sm:pr-6",children:O.jsx("div",{className:"flex w-full max-w-md flex-col gap-2",children:e.map(n=>O.jsx(Pne,{id:n.id,severity:n.severity,title:n.title,detail:n.detail,action:n.action,onDismiss:t},n.id))})});function kne({className:e,children:t,...n}){return O.jsx("label",{className:rn("mb-1 block text-xs font-medium text-fg-muted",e),...n,children:t})}const Dne="Matches on what the messages say about themselves — sender, subject, list. No reading involved.",Lne={From:"From",Subject:"Subject",HasWords:"Has the words",ListId:"List",FromDomain:"Domain"};function Une(e){return Lne[e]}const $ne={ListId:"The mailing list's List-Id header, matched exactly. New mail is matched as it arrives — mail delivered before this was set up may not carry it yet.",FromDomain:"The sender's registrable domain — matches anyone at it, subdomains included (a look-alike like example.com.evil.test never matches)."};function n6e(e){return $ne[e]}function Fne(e){return e==="HasWords"}function fF(e){return e.clauses.length>0}function hF(e){return e.clauses.filter(t=>Fne(t.field))}const r6e=["From","Subject","HasWords","ListId","FromDomain"],zne={all:"Match all",any:"Match any"};function o6e(e){return zne[e]}function jne(e){return e==="all"?"and":"or"}function s6e(e){if(e.status==="loading")return"Counting matches…";if(e.status==="error")return e.reason;if(e.count===0)return"No mail matches yet";const t=e.count===1?"message":"messages",n=`${e.count} ${t} match`;return e.stale?`${n} — recounting`:n}const Bne={once:"Just once",standing:"Keep doing this",until:"Until a date"};function i6e(e){return Bne[e]}function a6e(e){return e==="once"?"Apply now":e==="standing"?"Save rule":"Save until then"}const Gr={noMatch:"Add a clause so the rule has something to match.",bodyTextOnce:"Applying once can't read message bodies. Save this as a rule instead, or drop the “has the words” clause.",noAction:"Pick a folder to move into, or a label to apply.",unnamed:"Name this rule so you can find it later.",noUntilDate:"Pick the date this rule should stop on.",counting:"Counting matches — save once the count settles.",recounting:"Recounting matches — save once the count settles."},l6e="Can't count matches — “has the words” reads message bodies, which only a saved rule does.";function pF(e){if(e.status==="loading")return Gr.counting;if(e.status==="ready"&&e.stale)return Gr.recounting}function u6e(e,t){return fF(e)?e.scope==="once"&&hF(e).length>0?Gr.bodyTextOnce:!e.moveMailboxId&&!e.labelId?Gr.noAction:(e.scope==="standing"||e.scope==="until")&&(e.name??"").trim()===""?Gr.unnamed:e.scope==="until"&&!e.until?Gr.noUntilDate:pF(t):Gr.noMatch}const sI=(e,t)=>t.length===0?[e]:e.split(t),Hne=(e,t)=>{const n=sI(e,t);return n[n.length-1]||e},wf=(e,t)=>{if(t.length===0)return"";const n=e.lastIndexOf(t);return n===-1?"":e.slice(0,n)},gF=(e,t)=>sI(e,t).length-1,Cf=(e,t)=>{const n=[];let r=e,o=wf(r,t);for(;o&&o.length<r.length;)n.push(o),r=o,o=wf(r,t);return n},qne=(e,t)=>{const n=new Set(e.map(a=>a.path)),r=new Set,o=[],s=a=>{if(!r.has(a.path)){r.add(a.path),o.push(a);for(const u of e)wf(u.path,t)===a.path&&s(u)}};for(const a of e){const u=wf(a.path,t);u&&n.has(u)||s(a)}return o},mF=(e,t)=>e.label.toLowerCase().includes(t)||e.path.toLowerCase().includes(t),Vne=(e,t,n)=>{const r=new Set;if(!t)return r;for(const o of e)if(mF(o,t))for(const s of Cf(o.path,n))r.add(s);return r},Wne=(e,t,n,r=new Set)=>{const o=(u,c)=>({folder:u,depth:gF(u.path,n),context:c,expanded:r.has(u.path)});if(!t)return e.map(u=>o(u,!1));const s=new Set;for(const u of e)mF(u,t)&&s.add(u.path);const a=new Set(s);for(const u of s)for(const c of Cf(u,n))a.add(c);return e.filter(u=>a.has(u.path)).map(u=>o(u,!s.has(u.path)))},Gne=(e,t,n)=>{const r=new Set(e.map(o=>o.path));return e.filter(o=>Cf(o.path,n).every(s=>!r.has(s)||t.has(s))).map(o=>({folder:o,depth:gF(o.path,n),context:!1,expanded:t.has(o.path)}))},Kne=(e,t)=>{if(t.length===0)return e.map((s,a)=>({kind:"folder",row:s,index:a}));const n=[],r=[],o=s=>{for(;r.length>0;){const a=r[r.length-1];if(!a||s?.startsWith(`${a.folder.path}${t}`))break;r.pop(),n.push({kind:"create",parent:a.folder,depth:a.depth+1})}};return e.forEach((s,a)=>{o(s.folder.path),n.push({kind:"folder",row:s,index:a}),s.expanded&&r.push(s)}),o(null),n},Zne=e=>typeof e=="object"&&e!==null&&"name"in e&&e.name==="AbortError",Do=e=>e!==void 0&&!e.context,j1=e=>e!==void 0&&!e.folder.isCurrent&&!e.context,B1=e=>{for(let t=0;t<e.length;t+=1)if(Do(e[t]))return t;return-1},Yne=e=>{for(let t=e.length-1;t>=0;t-=1)if(Do(e[t]))return t;return-1},lk=(e,t,n)=>{const r=e.length;if(r<=0)return-1;const o=t<0?n===1?-1:r:t;for(let s=1;s<=r;s+=1){const a=((o+n*s)%r+r)%r;if(Do(e[a]))return a}return-1},Qne=(e,t,n)=>{const r=e[t];if(!r)return-1;const o=wf(r.folder.path,n);if(!o)return-1;for(let s=t-1;s>=0;s-=1)if(e[s]?.folder.path===o)return Do(e[s])?s:-1;return-1},F_="flex min-h-11 min-w-0 flex-1 items-center gap-2 px-3 py-2.5 text-left text-sm transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",vF=14,Xne=60,z_=({depth:e})=>e>0?O.jsx("span",{"aria-hidden":"true",className:"shrink-0",style:{width:e*vF}}):null,j_=({depth:e})=>O.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute right-0 bottom-0 h-px bg-line",style:{left:Xne+e*vF}}),Jne=({label:e,depth:t,expanded:n,ariaLabel:r,selected:o=!1,context:s=!1,current:a=!1,currentTag:u,messageCount:c,failure:f,separated:h=!1,actions:g,tabIndex:m,onActivate:v,onFocus:w,ref:S})=>{const C=O.jsx(ete,{className:rn("size-4 shrink-0 text-fg-subtle transition-transform",n&&"rotate-90"),"aria-hidden":"true"}),E=O.jsx(ote,{className:"size-4 shrink-0 text-fg-subtle","aria-hidden":"true"}),A=c===void 0?null:O.jsxs("span",{"aria-hidden":"true",className:"shrink-0 text-2xs text-fg-subtle",children:[c," ",c===1?"msg":"msgs"]}),I=O.jsxs("span",{className:"min-w-0 flex-1",children:[O.jsx("span",{className:"block truncate",children:e}),f&&O.jsxs("span",{className:"flex items-center gap-1 text-2xs text-danger",children:[O.jsx(A$,{className:"size-3 shrink-0","aria-hidden":"true"}),O.jsx("span",{className:"truncate",children:f})]})]}),T=f?`${r} — ${f}`:r;return s?O.jsxs("div",{className:"relative flex items-center",children:[O.jsxs("div",{role:"treeitem","aria-level":t+1,"aria-selected":!1,"aria-expanded":n,"aria-label":T,className:rn(F_,"opacity-60"),children:[O.jsx(z_,{depth:t}),C,E,I,A]}),g,h&&O.jsx(j_,{depth:t})]}):O.jsxs("div",{className:"relative flex items-center",children:[O.jsxs("button",{ref:S,type:"button",role:"treeitem","aria-level":t+1,"aria-selected":o,"aria-expanded":n,"aria-current":a?"true":void 0,"aria-label":T,tabIndex:m,onClick:v,onFocus:w,className:rn(F_,"hover:bg-surface-raised active:bg-surface-sunken",a&&"text-fg-muted"),children:[O.jsx(z_,{depth:t}),C,E,I,A,a&&u&&O.jsx("span",{className:"shrink-0 text-xs text-fg-muted",children:u}),o&&O.jsx(E$,{className:"size-4 shrink-0 text-accent","aria-hidden":"true"})]}),g,h&&O.jsx(j_,{depth:t})]})},uk=({label:e,ariaLabel:t,depth:n=0,prominence:r="prominent",separated:o=!1,onOpen:s})=>O.jsxs("div",{className:rn("relative",r==="prominent"&&"p-2"),children:[O.jsxs("button",{type:"button",onClick:s,"aria-label":t,"data-prominence":r,className:rn(F_,"w-full active:bg-surface-sunken",r==="prominent"?"rounded-lg border border-line-strong border-dashed font-medium text-fg-muted hover:border-accent-2 hover:text-accent-2":"text-fg-subtle hover:bg-surface-raised hover:text-fg-muted"),children:[O.jsx(z_,{depth:n}),O.jsx("span",{"aria-hidden":"true",className:"size-4 shrink-0"}),O.jsx(ste,{className:"size-4 shrink-0","aria-hidden":"true"}),O.jsx("span",{className:"min-w-0 flex-1 truncate",children:e})]}),o&&O.jsx(j_,{depth:n})]}),yF={nameLabel:"Folder name",namePlaceholder:"Hotels",insideLabel:"Inside",create:"Create folder",cancel:"Cancel",createPending:"Creating folder…"},ere=({parentLabel:e,name:t,onNameChange:n,onSubmit:r,onCancel:o,pending:s=!1,error:a,labels:u})=>{const c={...yF,...u},f=_.useId(),h=_.useRef(null),g=_.useRef(null);return _.useEffect(()=>{h.current?.focus({preventScroll:!0}),g.current?.scrollIntoView({block:"nearest"})},[]),O.jsxs("div",{ref:g,className:"space-y-3 border-y border-line bg-surface-sunken px-3 py-3",children:[O.jsxs("div",{children:[O.jsx(kne,{htmlFor:f,children:c.nameLabel}),O.jsx(Sf,{id:f,ref:h,value:t,placeholder:c.namePlaceholder,onChange:m=>n(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),r()),m.key==="Escape"&&(m.preventDefault(),o())}})]}),O.jsxs("p",{className:"text-xs text-fg-muted",children:[c.insideLabel," ",O.jsx("span",{className:"font-medium text-fg",children:e})]}),a&&O.jsx("p",{className:"text-xs text-danger",role:"alert",children:a}),O.jsxs("div",{className:"flex items-center gap-2",children:[O.jsx(Xr,{variant:"ghost",size:"md",onClick:o,className:"min-h-11 shrink-0",children:c.cancel}),O.jsx(Xr,{variant:"secondary",size:"md",onClick:r,disabled:s,className:"min-h-11 shrink-0",children:s?c.createPending:c.create})]})]})},tre={...yF,filterPlaceholder:"Filter folders…",filterAriaLabel:"Filter folders",treeAriaLabel:"Destination folders",currentSuffix:"(current folder)",currentTag:"current",contextSuffix:"(containing folder)",emptyMessage:e=>`No folders match "${e}"`,noFolders:"No folders to show",optionLabel:e=>`Move to ${e.label}`,newFolder:"New folder",newSubfolder:e=>`New folder inside ${e}`,topLevel:"Top level",nameRequired:"Give the folder a name.",createError:"Couldn't create that folder. Please try again."},nre=({folders:e,selectedId:t,onSelect:n,rowActions:r,rowFailure:o,onCreateFolder:s,onCancel:a,delimiter:u="/",labels:c,autoFocusFilter:f=!1})=>{const h={...tre,...c},[g,m]=_.useState(""),[v,w]=_.useState(()=>{const se=e.find(Se=>Se.id===t);return new Set(se?Cf(se.path,u):[])}),[S,C]=_.useState(null),[E,A]=_.useState(""),[I,T]=_.useState(),[N,M]=_.useState(!1),[R,k]=_.useState(-1),L=_.useRef([]),q=_.useRef(null),$=_.useRef(!1),D=_.useRef(null);_.useEffect(()=>()=>D.current?.abort(),[]),_.useEffect(()=>{f&&q.current?.focus()},[f]);const j=g.trim().toLowerCase(),Z=_.useMemo(()=>qne(e,u),[e,u]),he=_.useMemo(()=>{const se=Vne(Z,j,u);return se.size===0?v:new Set([...v,...se])},[Z,v,j,u]),B=_.useMemo(()=>j?Wne(Z,j,u,he):Gne(Z,he,u),[Z,j,u,he]),Q=_.useMemo(()=>s?Kne(B,u):void 0,[B,u,s]);_.useEffect(()=>{k(se=>Do(B[se])?se:B1(B))},[B]),_.useEffect(()=>{$.current&&($.current=!1,!(R<0)&&L.current[R]?.focus())},[R]);const ae=_.useCallback((se,Se)=>{w(Ze=>{if(Se)return new Set([...Cf(se,u),se]);const ve=new Set(Ze);return ve.delete(se),ve})},[u]),ue=_.useCallback(se=>{j1(se)&&n?.(se.folder.id),ae(se.folder.path,!se.expanded)},[n,ae]),we=_.useCallback(()=>{D.current?.abort(),C(null),A(""),T(void 0),M(!1)},[]),U=_.useCallback(se=>{D.current?.abort(),C({anchorId:se?.id??null,parentPath:se?.path??"",parentLabel:se?.label??h.topLevel}),A(""),T(void 0),M(!1)},[h.topLevel]),X=_.useCallback(()=>{if(!s||!S||N)return;const se=E.trim();if(se===""){T(h.nameRequired);return}M(!0),T(void 0),D.current?.abort();const Se=new AbortController;D.current=Se;const Ze=S.parentPath;s(se,Ze,Se.signal).then(ve=>{M(!1),C(null),A(""),Ze&&ae(Ze,!0),n?.(ve.id)}).catch(ve=>{Zne(ve)||(T(ve instanceof Error?ve.message:h.createError),M(!1))})},[s,S,N,E,n,ae,h.nameRequired,h.createError]),ie=_.useCallback(se=>{const Se=se.target;if(!(Se instanceof Element)||!Se.closest('[role="treeitem"]'))return;const Ze=pt=>{se.preventDefault(),$.current=!0,k(pt)},ve=B[R];switch(se.key){case"ArrowDown":return Ze(lk(B,R,1));case"ArrowUp":return Ze(lk(B,R,-1));case"Home":return Ze(B1(B));case"End":return Ze(Yne(B));case"ArrowRight":{if(!Do(ve)||!ve)return;if(se.preventDefault(),!ve.expanded){ae(ve.folder.path,!0);return}const pt=R+1;Do(B[pt])&&Ze(pt);return}case"ArrowLeft":{if(!Do(ve)||!ve)return;if(se.preventDefault(),ve.expanded){ae(ve.folder.path,!1);return}const pt=Qne(B,R,u);pt>=0&&Ze(pt);return}case"Enter":case" ":{if(!Do(ve)||!ve)return;se.preventDefault(),ue(ve);return}case"Escape":se.preventDefault(),a?.();return;default:return}},[B,R,u,ue,ae,a]),oe=S!==null&&S.anchorId!==null&&(Q?.some(se=>se.kind==="create"&&se.parent.id===S.anchorId)??!1),fe=S&&O.jsx(ere,{parentLabel:S.parentLabel,name:E,onNameChange:se=>{A(se),T(void 0)},onSubmit:X,onCancel:we,pending:N,error:I,labels:h}),Me=se=>se.context?`${se.folder.label} ${h.contextSuffix}`:j1(se)?h.optionLabel(se.folder):`${se.folder.label} ${h.currentSuffix}`,xe=(se,Se,Ze)=>{const{folder:ve,depth:pt}=se,gt=j1(se);return O.jsx(Jne,{ref:Ye=>{L.current[Se]=Ye},label:ve.label,depth:pt,expanded:se.expanded,context:se.context,current:ve.isCurrent,currentTag:h.currentTag,messageCount:ve.messageCount,selected:gt&&ve.id===t,separated:Ze,failure:o?.(ve),actions:r?.(ve),ariaLabel:Me(se),tabIndex:Se===R?0:-1,onActivate:()=>ue(se),onFocus:()=>k(Se)})};return O.jsxs("div",{className:"flex min-h-0 w-full min-w-0 flex-col",children:[O.jsx(Sf,{ref:q,variant:"inline",className:"border-b border-line px-3 py-2",icon:O.jsx(dte,{className:"size-4","aria-hidden":"true"}),type:"search",value:g,onChange:se=>m(se.target.value),onKeyDown:se=>{if(se.key==="Escape"){se.preventDefault(),a?.();return}if(se.key!=="ArrowDown")return;se.preventDefault();const Se=Do(B[R])?R:B1(B);Se<0||($.current=!0,k(Se),L.current[Se]?.focus())},placeholder:h.filterPlaceholder,"aria-label":h.filterAriaLabel}),s&&O.jsx("div",{className:"shrink-0 border-b border-line","data-create-anchor":"top",children:S&&!oe?fe:O.jsx(uk,{label:h.newFolder,ariaLabel:h.newFolder,prominence:"prominent",onOpen:()=>U(null)})}),B.length===0?O.jsx("p",{className:"px-3 py-3 text-sm text-fg-muted","aria-live":"polite",children:e.length===0?h.noFolders:h.emptyMessage(g)}):O.jsx("div",{role:"tree","aria-label":h.treeAriaLabel,className:"min-h-0 flex-1 overflow-y-auto overflow-x-hidden pb-24",onKeyDown:ie,children:(Q??B.map((se,Se)=>({kind:"folder",row:se,index:Se}))).map((se,Se,Ze)=>{const ve=Se<Ze.length-1;return se.kind==="create"?O.jsx("div",{role:"none","data-create-anchor":se.parent.id,children:S?.anchorId===se.parent.id?fe:O.jsx(uk,{label:h.newFolder,ariaLabel:h.newSubfolder(se.parent.label),depth:se.depth,prominence:"quiet",separated:ve,onOpen:()=>U(se.parent)})},`new:${se.parent.id}`):O.jsx("div",{role:"none",children:xe(se.row,se.index,ve)},se.row.folder.id)})})]})},rre={inbox:"Inbox",drafts:"Drafts",sent:"Sent",archive:"Archive",junk:"Spam",trash:"Trash",flagged:"Starred",all:"All Mail"};function ore(e){return rre[e]}const sre=new Set(["all","flagged"]);function ire(e){return sre.has(e)}const are=new Set(["[Gmail]","[Google Mail]"]);function lre(e){if(e.role)return ire(e.role)?void 0:ore(e.role);if(!e.providerPath)return;const t=sI(e.providerPath,e.hierarchyDelimiter);if(!are.has(t[0]))return Hne(e.providerPath,e.hierarchyDelimiter)}function c6e(e){return e==="inbox"?O.jsx(D$,{className:"size-4"}):e==="drafts"?O.jsx(rte,{className:"size-4"}):e==="sent"?O.jsx(fte,{className:"size-4"}):e==="archive"?O.jsx(Xee,{className:"size-4"}):e==="junk"?O.jsx(tI,{className:"size-4"}):e==="trash"?O.jsx(mte,{className:"size-4"}):e==="flagged"?O.jsx(pte,{className:"size-4"}):O.jsx(ute,{className:"size-4"})}const ure={Inbox:"Inbox",Drafts:"Drafts",Sent:"Sent",Archive:"Archive",Junk:"Junk",Trash:"Trash",All:"All",Flagged:"Flagged"},d6e={Body:"Body"},f6e={Mail:"Mail",Calendar:"Calendar"},ru={Appointed:"Appointed",Flagged:"Flagged",Reserved:"Reserved",Proposed:"Proposed",Stale:"Stale",None:"None"},Na={SignInDisabled:"sign_in_disabled",CallerDisabled:"caller_disabled",ForeignOrigin:"foreign_origin",StepUpRequired:"step_up_required",WrongPassword:"wrong_password",StepUpLocked:"step_up_locked",CannotDisableSelf:"cannot_disable_self"},ck={synced:"synced",failed:"failed"},h6e={Saved:"Saved",Deployment:"Deployment",Default:"Default"},p6e={NoBaseUrl:"NoBaseUrl",NoApiKey:"NoApiKey"},g6e={uncategorized:"uncategorized",personal:"personal",newsletter:"newsletter",marketing:"marketing",automated:"automated",transactional:"transactional",social:"social"},m6e={Wellknown:"wellknown",Vip:"vip"},v6e={Lookalike:"Lookalike",ForeignAddress:"ForeignAddress",Unrelated:"Unrelated"},y6e={abandoned:"abandoned"},b6e={none:"none",move:"move",delete:"delete"},S6e={MoveToInbox:"MoveToInbox",MoveToJunk:"MoveToJunk"},w6e={Confident:"Confident",Unsure:"Unsure"},C6e={Attachment:"attachment"},E6e={None:"None"},_6e={Retrying:"Retrying",GaveUp:"GaveUp"};function bF(e){const[t,n]=_.useState(!1),r=t?nte:tte,o=t?"Hide password":"Show password";return O.jsx(Sf,{...e,type:t?"text":"password",trailing:O.jsx("button",{type:"button","aria-label":o,"aria-pressed":t,title:o,onClick:()=>n(s=>!s),className:"-my-1 -mr-2 flex size-11 shrink-0 cursor-pointer items-center justify-center rounded-md text-fg-subtle transition-colors hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:O.jsx(r,{className:"size-4","aria-hidden":!0})})})}const cre=e=>e===1?"message":"messages",Om=e=>`${e.toLocaleString()} ${cre(e)}`,H1=(e,t)=>e.kind==="delete"?`delete ${Om(e.count)}`:t===void 0?"empty it":`empty ${Om(t)}`,SF=e=>e.kind==="delete"?"Nothing has been deleted.":"Nothing has been emptied.",dre=(e,t,n={})=>{const{trashFolderLabel:r,staleFolderLabel:o,selectedCount:s}=n,a=SF(t);if(e==="none")return{title:"No folder is set as Trash",description:`${a} reader files deleted mail in the folder you set as Trash, and this account has none.`,pickerPrompt:"Which folder does this account use for deleted mail?",confirmLabel:`Set as Trash and ${H1(t,void 0)}`,cancelLabel:"Cancel"};if(e==="stale")return{title:"The Trash folder you chose is gone",description:o?`${a} You set ${o} as this account's Trash and it is no longer on the mail server — another mail app may have renamed or removed it.`:`${a} The folder you set as this account's Trash is no longer on the mail server — another mail app may have renamed or removed it.`,pickerPrompt:"Which folder should reader use instead?",confirmLabel:`Set as Trash and ${H1(t,void 0)}`,cancelLabel:"Cancel"};const u=t.kind==="delete"?`Deleting ${Om(t.count)} there erases them from the mail server, and that cannot be restored.`:"Emptying a folder erases everything in it from the mail server, and that cannot be restored.";return{title:"Confirm this account's Trash folder",description:r?`${a} reader files this account's deleted mail in ${r} because of its name — you never chose it, and the mail server doesn't mark it as Trash. ${u}`:`${a} reader files this account's deleted mail in a folder it matched by name — you never chose it, and the mail server doesn't mark it as Trash. ${u}`,pickerPrompt:r?`Confirm ${r}, or pick the folder this account really uses.`:"Pick the folder this account really uses for deleted mail.",confirmLabel:`Set as Trash and ${H1(t,s)}`,cancelLabel:"Cancel"}},fre=(e,t,n,r)=>e.kind==="appointing"?{headline:"Setting the Trash folder…",status:n}:t.kind==="delete"?{headline:`Deleting ${Om(t.count)}…`,status:r?`Erasing them from ${n}. This can't be undone.`:`Moving them to ${n}`}:{headline:`Emptying ${n}…`,status:"This can't be undone."},hre=(e,t,n,r)=>e==="unconfirmed"&&t.kind==="delete"&&n!==void 0&&r===n,pre=(e,t,n)=>e==="mailbox-pending"?`${n} is still being created on the mail server. Wait for it to finish, then try again.`:`Couldn't set that folder as Trash. ${SF(t)} Please try again.`,gre=({open:e,reason:t,action:n,folders:r,delimiter:o,trashFolderLabel:s,guessedMailboxId:a,staleFolderLabel:u,accountEmail:c,phase:f,selectedId:h,onSelect:g,onCreateFolder:m,onConfirm:v,onCancel:w})=>{const S=_.useRef(null),C=f.kind==="appointing"||f.kind==="acting";_.useEffect(()=>{C&&S.current?.focus()},[C]);const E=r.find(N=>N.id===h),A=dre(t,n,{trashFolderLabel:s,staleFolderLabel:u,selectedCount:E?.messageCount}),I=hre(t,n,a,h),T=n.kind==="emptyTrash"||I;if(!e)return null;if(C){const N=fre(f,n,E?.label??"",I);return O.jsx(ak,{open:e,onClose:()=>{},title:A.title,children:O.jsxs("div",{ref:S,"data-escape-owner":!0,tabIndex:-1,className:"flex flex-col items-center gap-3 px-5 py-10 text-center outline-none",children:[O.jsx($$,{className:"size-8 animate-spin text-accent-2"}),O.jsx("p",{className:"text-sm font-medium text-fg",children:N.headline}),O.jsx("p",{className:"text-xs text-fg-muted",role:"status","aria-live":"polite",children:N.status})]})})}return O.jsxs(ak,{open:e,onClose:w,title:A.title,children:[O.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[O.jsx(nI,{className:`size-4 shrink-0 ${T?"text-danger":"text-warning"}`}),O.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:A.title})]}),O.jsxs("div",{className:"flex max-h-[70vh] flex-col",children:[O.jsxs("div",{className:"space-y-1 px-5 py-4",children:[O.jsx("p",{className:"text-sm text-fg-muted",children:A.description}),c&&O.jsx("p",{className:"text-xs text-fg-subtle",children:c})]}),f.kind==="appoint-failed"&&O.jsx("div",{className:"px-5 pb-3",children:O.jsx(Zr,{tone:"danger",variant:"soft",children:pre(f.cause,n,E?.label??"That folder")})}),O.jsx("p",{className:"px-5 pb-2 text-sm text-fg-muted",children:A.pickerPrompt}),O.jsx("div",{className:"flex h-[26rem] min-h-0 flex-1 overflow-hidden",children:O.jsx(nre,{folders:r,selectedId:h,delimiter:o,onSelect:g,onCreateFolder:t==="none"?m:void 0,onCancel:w,labels:{treeAriaLabel:"Folders on this account",optionLabel:N=>`Set ${N.label}${N.messageCount===void 0?"":`, ${N.messageCount} messages`}, as Trash`}})})]}),O.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[O.jsx(Xr,{variant:"secondary",size:"sm",onClick:w,children:A.cancelLabel}),E&&O.jsx(Xr,{variant:T?"danger":"primary",size:"sm",onClick:()=>v(E.id),children:O.jsx("span",{className:"truncate",children:A.confirmLabel})})]})]})},mre={delete:{label:"Delete",present:"Deleting",past:"Deleted",destructive:!0},move:{label:"Move",present:"Moving",past:"Moved",destructive:!1},junk:{label:"Junk",present:"Marking as junk",past:"Marked as junk",destructive:!0},markRead:{label:"Mark read",present:"Marking read",past:"Marked read",destructive:!1},organize:{label:"Organize",present:"Organizing",past:"Organized",destructive:!1}},vre=e=>mre[e],yre={match:"Apply to",properties:"Properties",folder:"Folder",rule:"Rule",name:"Name",review:"Review",run:"Run"},x6e=e=>yre[e],A6e=({verb:e,mode:t,scope:n,fromSearch:r})=>{const o=r?["properties"]:t==="properties"?["match","properties"]:["match"];return e==="move"?[...o,"folder","review","run"]:e==="organize"?n==="standing"||n==="until"?[...o,"folder","rule","name","review","run"]:[...o,"folder","rule","review","run"]:[...o,"review","run"]},wF=(e,t)=>Math.max(0,e.indexOf(t)),I6e=(e,t)=>wF(e,t)===0||t==="run",CF=(e,t)=>({clauses:[...e.clauses],matchOperator:e.matchOperator,moveMailboxId:e.moveMailboxId,scope:t,until:e.until,name:e.name}),bre=e=>hF(CF(e,e.scope??"once")),dk=e=>{if(!(e.scope!=="standing"&&e.scope!=="until")&&!fF(CF(e,e.scope)))return Gr.noMatch},Sre="A rule only works within one account — clear the selection, or pick messages from a single account.",wre="A destination only works within one account — clear the selection, or pick messages from a single account.",R6e="Matching beyond the messages you picked only works within one account — clear the selection, or pick messages from a single account.",Cre="A rule only works within one folder — clear the selection, or pick messages from a single folder.",Ere="A destination only works within one folder — clear the selection, or pick messages from a single folder.",_re={spansAccounts:{rule:Sre,destination:wre},spansFolders:{rule:Cre,destination:Ere}},xre="A match this wide applies once — use “Make this a filter” above the results to keep doing it.",T6e=(e,t)=>e==="escalated"?xre:t.rule,O6e=(e,t)=>{const n=e===void 0?"spansAccounts":t;if(!n)return{accountId:e};const r=_re[n];return{accountId:n==="spansAccounts"?void 0:e,rule:r.rule,destination:r.destination}},M6e=e=>e===void 0?["selected"]:["selected","properties"],Are="This matches no messages, so there is nothing to do. Go back and change what it applies to.",Ire="Fill in every property, or take the empty one off.",Rre="Pick a destination first.",Tre="Choose one of the three first.",P6e=(e,t,n)=>{if(e==="properties")return t.clauses.length===0?Gr.noMatch:t.clauses.some(r=>r.value.trim()==="")?Ire:void 0;if(e==="folder")return t.moveMailboxId?void 0:Rre;if(e==="rule"){if(!t.scope)return Tre;const r=dk(t);return r||(t.scope==="once"&&bre(t).length>0?Gr.bodyTextOnce:t.scope==="until"&&!t.until?.trim()?Gr.noUntilDate:void 0)}if(e==="name"&&!t.name?.trim())return Gr.unnamed;if(e==="review"){const r=dk(t);return r||(n.status==="uncounted"?void 0:n.status==="ready"&&n.count===0&&!n.stale?Are:pF(n))}},N6e="Nothing matches this yet. Widen a property, or match on a different one.",k6e=({state:e,verb:t,scope:n,matched:r,applied:o,failed:s,failureReason:a})=>{const{label:u,present:c,past:f}=vre(t),h=f.toLowerCase(),g=n==="standing"||n==="until",v={screenTitle:e==="saving"||e==="backApplyRunning"||e==="statusUnknown"||e==="commitFailed"?u:"Done",showProgress:e==="backApplyRunning"||e==="backApplyComplete"||e==="backApplyFailed"||e==="backApplyRestartFailed"||e==="statusUnknown"||e==="runStopped",failureListLabel:`Not ${h}`};return e==="saving"?{...v,title:g?"Saving rule…":"Applying…",detail:"Nothing has been changed yet.",tone:"progress",dismissLabel:"Close"}:e==="backApplyRunning"?{...v,title:g?"Rule saved. Moving the mail already in your mailbox…":`${c} ${r} messages…`,detail:"This keeps running if you close the wizard.",tone:"progress",dismissLabel:"Close",cancelLabel:"Stop the run"}:e==="statusUnknown"?{...v,title:g?"Rule saved. Its progress over your existing mail is unknown":`${c} — progress unknown`,detail:g?"The connection dropped, so the bar shows the last that was read. The pass runs on the mail server, and the rule keeps working on new mail either way. This keeps checking.":"The connection dropped, so the bar shows the last that was read. The run is on the mail server and carries on either way. This keeps checking.",tone:"warning",dismissLabel:"Close",retryLabel:"Check again"}:e==="backApplyComplete"?{...v,title:g?"Rule saved and applied":`${f} ${o}`,detail:g?`${o} of ${r} already in your mailbox ${h}. New mail follows the rule as it arrives.`:`Every message the match reached was ${h}. Your mail server is still catching up, so the list can lag behind.`,tone:"success",dismissLabel:"Done"}:e==="backApplyFailed"?{...v,title:g?"Rule saved — some mail stayed put":`Not everything was ${h}`,detail:`${o} of ${r} ${h} · the mail server rejected ${s}.${g?" The rule itself is saved and keeps working on new mail.":""}`,tone:"warning",dismissLabel:"Close",retryLabel:`Retry ${s}`}:e==="runStopped"?{...v,title:`Stopped after ${o}`,detail:`${o} of ${r} ${h}. The rest were not sent, apart from the ones already on their way when you stopped — those may still have gone through.`,tone:"warning",dismissLabel:"Close",retryLabel:`Retry ${s}`}:e==="backApplyRestartFailed"?{...v,title:g?"Rule saved — the retry didn't start":"The retry didn't start",detail:`${o} of ${r} ${h} · the mail server rejected ${s}, which are still where they were.${g?" The rule itself is saved and keeps working on new mail.":""} Check your connection and try again.`,tone:"warning",dismissLabel:"Close",retryLabel:`Retry ${s}`}:e==="backApplyStartFailed"?{...v,title:"Rule saved",detail:"New mail follows it automatically. The pass over the mail already in your mailbox never started.",tone:"warning",dismissLabel:"Not now",retryLabel:"Run it over existing mail"}:e==="filterSaved"?{...v,title:"Filter saved",detail:"There is no mail in your mailbox to apply it to yet. New mail follows it as it arrives. You can see it, and when it expires, under Settings › Filters.",tone:"success",dismissLabel:"Done"}:{...v,title:g?"Couldn't save the rule":`Couldn't start ${u.toLowerCase()}`,detail:a??"Nothing has changed.",tone:"danger",dismissLabel:a===void 0?"Not now":"Close",retryLabel:a===void 0?"Try again":void 0}},Ore=e=>`${Une(e.field)} "${e.value}"`,EF=(e,t)=>e.map(Ore).join(` ${jne(t)} `),Mre=(e,t)=>e==="selected"?`These ${t} messages`:"Its properties",D6e=e=>e==="selected"?"Only the messages ticked in the list.":Dne,Pre=e=>`Every message ${e}`,_F="the list is showing",L6e="This reaches every match on the mail server, including the ones the list has not loaded. The search is already the match, so there is nothing to widen.",U6e="This covers messages not shown in the list, and anything else matching by the time it runs.",$6e=({mode:e,selectedCount:t,clauses:n,matchOperator:r,escalatedScope:o})=>e==="escalated"?Pre(o??_F):e==="properties"?EF(n,r):Mre(e,t),F6e=({mode:e,selectedCount:t,clauses:n,matchOperator:r,escalatedScope:o,escalatedCount:s})=>{if(e==="selected")return`${t} messages`;if(e==="escalated"){const a=o??_F;return s===void 0?`every message ${a}`:`all ${s.toLocaleString()} messages ${a}`}return n.length===0?"every message":`every message where ${EF(n,r)}`},Nre={preparing:"Getting the new version ready",restarting:"Restarting Remit",reconnecting:"Waiting for Remit to answer again"};function fk(e){return Nre[e]}function kre(e){return e<90?"This usually takes about a minute.":e<240?"Longer than usual. Remit is still trying to reach the server.":"Still no answer. Remit keeps trying."}function z6e(e,t=Date.now()){const n=Math.floor((t-e)/6e4);if(n<1)return"just now";if(n<60)return`${n}m ago`;const r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function j6e(e){return new Date(e).toLocaleDateString(void 0,{dateStyle:"medium"})}const hk=["preparing","restarting","reconnecting"],xF="fixed inset-0 z-50 flex flex-col items-center justify-center gap-6 bg-canvas p-6 text-center outline-none";function Dre({target:e,phase:t,elapsedSeconds:n}){const r=_.useRef(null);Wv(r,!0),Vv({id:"self-update",open:!0});const o=hk.indexOf(t);return O.jsxs("div",{ref:r,role:"dialog","aria-modal":"true","aria-labelledby":"self-update-progress-title",tabIndex:-1,className:xF,children:[O.jsxs("div",{className:"max-w-md space-y-2",children:[O.jsxs("h1",{id:"self-update-progress-title",className:"text-lg font-semibold text-fg",children:["Installing Remit ",e]}),O.jsx("p",{className:"text-sm text-fg-muted",children:"Remit is restarting, so this page has no server to talk to for a moment. Leave this open — it reconnects on its own."})]}),O.jsx("ol",{className:"w-full max-w-sm space-y-2 text-left",children:hk.map((s,a)=>{const u=a<o,c=a===o;return O.jsxs("li",{className:rn("flex items-center gap-3 rounded-sm border px-row-inset py-2 text-sm",c?"border-line-strong bg-surface text-fg":"border-line bg-surface-sunken text-fg-subtle"),children:[u?O.jsx(E$,{className:"size-4 shrink-0 text-positive","aria-hidden":!0}):c?O.jsx($$,{className:"size-4 shrink-0 animate-spin text-accent-2","aria-hidden":!0}):O.jsx("span",{className:"size-4 shrink-0 rounded-full border border-line-strong"}),fk(s)]},s)})}),O.jsxs("p",{"aria-live":"polite",className:"max-w-md text-xs text-fg-subtle",children:[O.jsx("span",{className:"sr-only",children:`${fk(t)}. `}),kre(n)]})]})}function Lre({attemptedVersion:e,previousVersion:t,elapsedSeconds:n,logsCommand:r,onRetryConnection:o}){const s=_.useRef(null);Wv(s,!0);const a=Math.max(1,Math.round(n/60));return O.jsxs("div",{ref:s,role:"alertdialog","aria-modal":"true","aria-labelledby":"self-update-unreachable-title",tabIndex:-1,className:xF,children:[O.jsx(tI,{className:"size-12 shrink-0 text-danger","aria-hidden":!0}),O.jsxs("div",{className:"max-w-lg space-y-3",children:[O.jsx("h1",{id:"self-update-unreachable-title",className:"text-lg font-semibold text-fg",children:"Remit has not answered since the restart"}),O.jsxs("p",{className:"text-sm text-fg-muted",children:["Installing ",e," started ",a," minute",a===1?"":"s"," ago and the server has been silent since. Your mail is safe at your provider — it was never part of the update."]}),O.jsxs("p",{className:"text-sm text-fg-muted",children:["Remit rolls back to ",t," on its own when the new version fails to start, but this page cannot confirm that from here. Check the server directly:"]}),O.jsx("code",{className:"block rounded-xs bg-surface-sunken px-3 py-2 text-left text-xs text-fg-muted",children:r})]}),O.jsx("div",{className:"flex flex-wrap items-center justify-center gap-2",children:O.jsx(Xr,{size:"sm",onClick:o,children:"Try connecting again"})})]})}const Ure=()=>O.jsxs("div",{className:"hidden h-full w-[17%] min-w-40 max-w-64 shrink-0 flex-col gap-1 border-r border-line p-3 md:flex",children:[O.jsx("div",{className:"mb-3 h-6 w-24 rounded bg-surface-sunken"}),Array.from({length:6}).map((e,t)=>O.jsxs("div",{className:"flex items-center gap-2 py-1.5",children:[O.jsx("div",{className:"size-5 shrink-0 rounded bg-surface-sunken"}),O.jsx("div",{className:"h-3.5 flex-1 rounded bg-surface-sunken"})]},t))]}),$re=()=>O.jsx("div",{className:"min-w-0 flex-1",children:Array.from({length:8}).map((e,t)=>O.jsxs("div",{className:"flex items-start gap-3 border-b border-line py-2 pl-5 pr-4",children:[O.jsx("div",{className:"mt-0.5 size-7 shrink-0 rounded-full bg-surface-sunken"}),O.jsxs("div",{className:"flex-1 space-y-1.5",children:[O.jsxs("div",{className:"flex justify-between gap-2",children:[O.jsx("div",{className:"h-3.5 w-28 rounded bg-surface-sunken"}),O.jsx("div",{className:"h-3 w-12 rounded bg-surface-sunken"})]}),O.jsx("div",{className:"h-3.5 w-48 rounded bg-surface-sunken"}),O.jsx("div",{className:"h-3 w-full rounded bg-surface-sunken"})]})]},t))}),Zv=()=>O.jsxs("div",{className:"flex h-full animate-pulse bg-canvas","aria-hidden":"true",children:[O.jsx(Ure,{}),O.jsx($re,{})]}),Yv="094c26cd6473c4a57280bbe4ed3d35493740cb36",Fre="2026-11-11T08:47:51.202Z",zre=Yv.slice(0,7),jre=/^[0-9a-f]{40}$/.test(Yv),Bre=jre?`https://github.com/remit-mail/reader/commit/${Yv}`:void 0;class Qv extends Error{constructor(t,n,r){super(t),this.status=n,this.body=r,this.name="ApiError"}status;body}const B_=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),il=e=>{const t=e instanceof Qv?e.body:e;if(!B_(t))return;const{code:n,details:r}=t;if(typeof n=="string")return{code:n,details:B_(r)?r:void 0}},Hre=(e,t)=>{if(B_(e)&&e.message!==void 0&&e.message!==null){const n=String(e.message);if(n)return n}return`Request failed with status ${t}`},qre=(e,t)=>new Qv(Hre(e,t),t,e),hn=e=>{if(e instanceof Qv)return e.status;if(e&&typeof e=="object"){const t=e;if(typeof t.status=="number")return t.status;if(typeof t.statusCode=="number")return t.statusCode}},AF=e=>hn(e)!==void 0,Xv=e=>{const t=hn(e);return t!==void 0&&t>=500&&t<=599},Jv=e=>!!(typeof DOMException<"u"&&e instanceof DOMException&&e.name==="AbortError"||e&&typeof e=="object"&&"name"in e&&e.name==="AbortError"),Vre=()=>typeof navigator<"u"&&navigator.onLine===!1,ey=e=>Jv(e)||AF(e)?!1:e instanceof XA?!0:Vre(),Wre=e=>!AF(e)&&!Jv(e)&&!ey(e),IF=e=>Xv(e)||Wre(e),Gre=e=>e instanceof Error&&e.name==="AuthTokenError"&&hn(e)===403,ty=e=>hn(e)===401||Gre(e),Kre=(e,t)=>{if(t?.softError===!0)return!0;const n=t?.softErrorStatuses;if(!Array.isArray(n))return!1;const r=hn(e);return r!==void 0&&n.includes(r)},Zre=[502,503,504],Yre=(e,t)=>{if(t?.restartExpected!==!0)return!1;const n=hn(e);return n!==void 0&&Zre.includes(n)},Qre=(e,t)=>Xv(e)?!Yre(e,t)&&t?.ownsServerErrors!==!0:Jv(e)||ey(e)||ty(e)?!1:IF(e)?!0:!Kre(e,t),iI={softError:!0},ny=(...e)=>({softErrorStatuses:e}),Xre={restartExpected:!0},Jre={ownsServerErrors:!0},RF=e=>hn(e)===404,eoe=e=>Xv(e),H_=new Set;let TF=null,OF=null;const toe=e=>{OF=e},noe=e=>e instanceof Error?e:new Error(MF(e)),MF=e=>e instanceof Error?e.message||e.name:typeof e=="string"?e:e&&typeof e=="object"&&"message"in e&&typeof e.message=="string"?e.message:"An unexpected server error occurred.",roe=()=>typeof globalThis.crypto<"u"&&typeof globalThis.crypto.randomUUID=="function"?globalThis.crypto.randomUUID():`fatal-${Date.now()}-${Math.random().toString(36).slice(2,10)}`,Bu=(e,t)=>{const n={error:e,message:MF(e),correlationId:roe(),at:Date.now(),recoverable:t?.recoverable??eoe(e),stack:e instanceof Error?e.stack:void 0,componentStack:t?.componentStack};TF=n,uoe(`Fatal: ${n.message} [${n.correlationId}]`),OF?.recordError(noe(e),{fatal:"true",correlationId:n.correlationId});for(const r of H_)r(n);return n},ooe=e=>(H_.add(e),()=>{H_.delete(e)}),soe=()=>TF,ioe=20,rm=[],aoe=new Set(["ResizeObserver loop limit exceeded","ResizeObserver loop completed with undelivered notifications"]);function loe(e){return typeof e!="string"?!1:aoe.has(e.replace(/\.\s*$/,""))}function om(e){rm.push(e),rm.length>ioe&&rm.shift()}function uoe(e){om(e)}function coe(e){return e.map(t=>{if(typeof t=="string")return t;if(t instanceof Error)return`${t.name}: ${t.message}`;try{return JSON.stringify(t)}catch{return String(t)}}).join(" ")}function doe(){const e=console.error.bind(console);console.error=(...t)=>{om(coe(t)),e(...t)},window.addEventListener("error",t=>{loe(t.message)||(om(`Uncaught ${t.error instanceof Error?`${t.error.name}: ${t.error.message}`:String(t.message)} (${t.filename}:${t.lineno})`),Bu(t.error??t.message))}),window.addEventListener("unhandledrejection",t=>{const n=t.reason,r=n instanceof Error?`${n.name}: ${n.message}`:String(n);om(`Unhandled rejection: ${r}`),Bu(n)})}function foe(){return rm.slice()}const hoe=8,mu=[];function poe(e){const t=e.split(/[?#]/)[0],n=mu[mu.length-1];n&&n.path===t||(mu.push({path:t,timestamp:new Date().toISOString()}),mu.length>hoe&&mu.shift())}function goe(){return mu.slice()}const q1=7500,pk=`
|
|
12
|
+
`,recoverySuggestion:"Make sure a successful call to signIn is made before calling confirmSignInand that the session has not expired."});try{const{Session:f,ChallengeName:h,AuthenticationResult:g,ChallengeParameters:m}=await MQ(r,o,s,t,u,dr,c,n);return nl({signInSession:f,username:r,challengeName:h,signInDetails:a}),g?(await js({username:r,...g,NewDeviceMetadata:await rl({userPoolId:u.userPoolId,userPoolEndpoint:u.userPoolEndpoint,newDeviceMetadata:g.NewDeviceMetadata,accessToken:g.AccessToken}),signInDetails:a}),bo(),await Qi(),{isSignedIn:!0,nextStep:{signInStep:"DONE"}}):sl({challengeName:h,challengeParameters:m})}catch(f){eo(f);const h=pc(f.name);if(h)return h;throw f}}const rX=e=>fn(xn,_n("GetUser"),Un(),{...An,...e}),oX=e=>fn(xn,_n("VerifyUserAttribute"),Un(),{...An,...e});async function sX(e){const t=Tt.getConfig().Auth?.Cognito;We(t);const{userPoolEndpoint:n,userPoolId:r}=t,{confirmationCode:o,userAttributeKey:s}=e;Kt(!!o,Ue.EmptyConfirmUserAttributeCode);const{tokens:a}=await $v({forceRefresh:!1});uc(a),await oX({endpointResolver:rt({endpointOverride:n})})({region:nt(r),userAgentValue:vt($e.ConfirmUserAttribute)},{AccessToken:a.accessToken.toString(),AttributeName:s,Code:o})}new Ln("AuthError");const iX={oauthSignInError:{message:En.OAUTH_ERROR,log:"Make sure Cognito Hosted UI has been configured correctly"},noConfig:{message:En.DEFAULT_MSG},missingAuthConfig:{message:En.DEFAULT_MSG},emptyUsername:{message:En.EMPTY_USERNAME},invalidUsername:{message:En.INVALID_USERNAME},emptyPassword:{message:En.EMPTY_PASSWORD},emptyCode:{message:En.EMPTY_CODE},signUpError:{message:En.SIGN_UP_ERROR},noMFA:{message:En.NO_MFA},invalidMFA:{message:En.INVALID_MFA},emptyChallengeResponse:{message:En.EMPTY_CHALLENGE},noUserSession:{message:En.NO_USER_SESSION},deviceConfig:{message:En.DEVICE_CONFIG},networkError:{message:En.NETWORK_ERROR},autoSignInError:{message:En.AUTOSIGNIN_ERROR},default:{message:En.DEFAULT_MSG}},zi=(e,t)=>new Oe({message:e??"An error has occurred during the oauth process.",name:jo.OAuthSignInError,recoverySuggestion:iX.oauthSignInError.log});var T_;(function(e){e.NoConfig="noConfig",e.MissingAuthConfig="missingAuthConfig",e.EmptyUsername="emptyUsername",e.InvalidUsername="invalidUsername",e.EmptyPassword="emptyPassword",e.EmptyCode="emptyCode",e.SignUpError="signUpError",e.NoMFA="noMFA",e.InvalidMFA="invalidMFA",e.EmptyChallengeResponse="emptyChallengeResponse",e.NoUserSession="noUserSession",e.Default="default",e.DeviceConfig="deviceConfig",e.NetworkError="networkError",e.AutoSignInError="autoSignInError",e.OAuthSignInError="oauthSignInError"})(T_||(T_={}));const aX="`signInWithRedirect` has been canceled.",lX="An error occurred while validating the state.",uX="Try to initiate an OAuth flow from Amplify",J8=async e=>{const t=await ir.loadOAuthState(),n=e===t?t:void 0;if(!n)throw new Oe({name:T_.OAuthSignInError,message:e===null?aX:lX,recoverySuggestion:e===null?void 0:uX});return n},e$=async({currentUrl:e,userAgentValue:t,clientId:n,redirectUri:r,responseType:o,domain:s,preferPrivateSession:a})=>{const u=new Yi(e),c=u.searchParams.get("error"),f=u.searchParams.get("error_description");if(c)throw zi(f??c);return o==="code"?cX({currentUrl:e,userAgentValue:t,clientId:n,redirectUri:r,domain:s,preferPrivateSession:a}):dX({currentUrl:e,redirectUri:r,preferPrivateSession:a})},cX=async({currentUrl:e,userAgentValue:t,clientId:n,redirectUri:r,domain:o,preferPrivateSession:s})=>{const a=new Yi(e),u=a.searchParams.get("code"),c=a.searchParams.get("state");if(!u||!c)throw zi("User cancelled OAuth flow.");const f=await J8(c),h="https://"+o+"/oauth2/token",g=await ir.loadPKCE(),m={grant_type:"authorization_code",code:u,client_id:n,redirect_uri:r,...g?{code_verifier:g}:{}},v=Object.entries(m).map(([M,R])=>`${encodeURIComponent(M)}=${encodeURIComponent(R)}`).join("&"),{access_token:w,refresh_token:S,id_token:C,error:E,error_message:A,token_type:I,expires_in:T}=await(await fetch(h,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",[pG]:t},body:v})).json();if(E)throw zi(A??E);const N=(w&&Ms(w).payload.username)??"username";return await js({username:N,AccessToken:w,IdToken:C,RefreshToken:S}),t$({redirectUri:r,state:f,preferPrivateSession:s})},dX=async({currentUrl:e,redirectUri:t,preferPrivateSession:n})=>{const r=new Yi(e),{id_token:o,access_token:s,state:a,token_type:u,expires_in:c,error_description:f,error:h}=(r.hash??"#").substring(1).split("&").map(v=>v.split("=")).reduce((v,[w,S])=>({...v,[w]:S}),{id_token:void 0,access_token:void 0,state:void 0,token_type:void 0,expires_in:void 0,error_description:void 0,error:void 0});if(h)throw zi(f??h);if(!s)throw zi("No access token returned from OAuth flow.");const g=await J8(a),m=(s&&Ms(s).payload.username)??"username";return await js({username:m,AccessToken:s,IdToken:o}),t$({redirectUri:t,state:g,preferPrivateSession:n})},t$=async({redirectUri:e,state:t,preferPrivateSession:n})=>{await dr.setOAuthMetadata({oauthSignIn:!0}),await ir.clearOAuthData(),await ir.storeOAuthSignIn(!0,n),L8(),pX(e),fX(t)&&zo.dispatch("auth",{event:"customOAuthState",data:dZ(hX(t))},"Auth",Fo),zo.dispatch("auth",{event:"signInWithRedirect"},"Auth",Fo),await Qi()},fX=e=>/-/.test(e),hX=e=>e.split("-").splice(1).join("-"),pX=e=>{typeof window<"u"&&typeof window.history<"u"&&window.history.replaceState(window.history.state,"",e)};function ZA(e,t){{const n=e?.find(gX)??e?.find(mX),r=e?.find(yX)??e?.find(vX);if(n)return n;throw r?AZ:_Z}}const gX=e=>e.startsWith(String(window.location.origin+(window.location.pathname||"/"))),mX=e=>e.includes(String(window.location.hostname)),vX=e=>e.startsWith("http://"),yX=e=>e.startsWith("https://"),YA=async e=>{L8(),await ir.clearOAuthInflightData(),zo.dispatch("auth",{event:"signInWithRedirect_failure",data:{error:e}},"Auth",Fo)},bX=async e=>{try{We(e),kv(e),ir.setAuthConfig(e)}catch{return}if(await ir.loadOAuthInFlight())try{const t=window.location.href,{loginWith:n,userPoolClientId:r}=e,{domain:o,redirectSignIn:s,responseType:a}=n.oauth,u=ZA(s);await e$({currentUrl:t,clientId:r,domain:o,redirectUri:u,responseType:a,userAgentValue:vt($e.SignInWithRedirect)})}catch(t){await YA(t)}};Uv()&&Tt[i8](bX);const SX={Google:"Google",Facebook:"Facebook",Amazon:"LoginWithAmazon",Apple:"SignInWithApple"},n$=async e=>{window?.location&&(window.location.href=e.replace("http://","https://"))},UN="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",wX=e=>{const t=new Uint8Array(e);NA().getRandomValues(t);let n="",r;for(const o of t)n+=UN.charAt(o%UN.length);return{value:n,method:"S256",toCodeChallenge(){return r||(r=CX(n),r)}}};function CX(e){const t=new qa;return t.update(e),EX($u.convert(t.digestSync(),{urlSafe:!0}))}function EX(e){return e.replace(/=/g,"")}const _X=()=>cZ(32),xX=e=>{async function t(n){if(n.persisted&&await e.loadOAuthInFlight()){const o=zi("User cancelled OAuth flow.");await YA(o)}window.removeEventListener("pageshow",t)}window.addEventListener("pageshow",t)};async function r$(e){const t=Tt.getConfig().Auth?.Cognito;We(t),kv(t),ir.setAuthConfig(t),e?.options?.prompt||await V8();let n="COGNITO",r;return typeof e?.provider=="string"?n=SX[e.provider]:e?.provider?.custom?n=e.provider.custom:e?.provider?.idpIdentifier&&({idpIdentifier:r}=e.provider),AX({oauthConfig:t.loginWith.oauth,clientId:t.userPoolClientId,provider:n,idpIdentifier:r,customState:e?.customState,preferPrivateSession:e?.options?.preferPrivateSession,options:{loginHint:e?.options?.loginHint,lang:e?.options?.lang,nonce:e?.options?.nonce,prompt:e?.options?.prompt},authSessionOpener:e?.options?.authSessionOpener})}const AX=async({oauthConfig:e,provider:t,idpIdentifier:n,clientId:r,customState:o,preferPrivateSession:s,options:a,authSessionOpener:u})=>{const{domain:c,redirectSignIn:f,responseType:h,scopes:g}=e,{loginHint:m,lang:v,nonce:w,prompt:S}=a??{},C=_X(),E=u||n$,A=o?`${C}-${fZ(o)}`:C,{value:I,method:T,toCodeChallenge:N}=wX(128),M=ZA(e.redirectSignIn);Uv()&&ir.storeOAuthInFlight(!0),ir.storeOAuthState(A),ir.storePKCE(I);const R=new URLSearchParams;R.append("redirect_uri",M),R.append("response_type",h),R.append("client_id",r),n?R.append("idp_identifier",n):R.append("identity_provider",t),R.append("scope",g.join(" ")),m&&R.append("login_hint",m),v&&R.append("lang",v),w&&R.append("nonce",w),S&&R.append("prompt",S.toLowerCase()),R.append("state",A),h==="code"&&(R.append("code_challenge",N()),R.append("code_challenge_method",T));const k=`https://${c}/oauth2/authorize?${R.toString()}`;xX(ir);const{type:L,error:q,url:$}=await E(k,f,s)??{};try{if(L==="error")throw zi(String(q));if(L==="canceled")throw zi(String(L));L==="success"&&$&&await e$({currentUrl:$,clientId:r,domain:c,redirectUri:M,responseType:h,userAgentValue:vt($e.SignInWithRedirect),preferPrivateSession:s})}catch(D){throw await YA(D),D}},IX=async e=>{const t=e.getConfig().Auth?.Cognito;We(t);const{userPoolEndpoint:n,userPoolId:r}=t,{tokens:o}=await f8(e,{forceRefresh:!1});uc(o);const s=rX({endpointResolver:rt({endpointOverride:n})}),{UserAttributes:a}=await s({region:nt(r),userAgentValue:vt($e.FetchUserAttributes)},{AccessToken:o.accessToken.toString()});return yZ(a)},o$=()=>IX(Tt),RX=async e=>{await e.clearOAuthData(),dr.clearTokens(),await h8(),zo.dispatch("auth",{event:"signedOut"},"Auth",Fo)},TX=async(e,t=!1,n)=>{kv(e);const{loginWith:r,userPoolClientId:o}=e,{domain:s,redirectSignOut:a}=r.oauth,u=ZA(a),c=`https://${s}/logout?${Object.entries({client_id:o,logout_uri:encodeURIComponent(u)}).map(([f,h])=>`${f}=${h}`).join("&")}`;return n$(c)},OX=async(e,t,n,r)=>{const{isOAuthSignIn:o}=await t.loadOAuthSignIn(),s=await n.getOAuthMetadata();if(await RX(t),o||s?.oauthSignIn)return TX(e,!1)},MX=e=>fn(xn,_n("RevokeToken"),Un(),{...An,...e}),PX=new Ln("Auth");async function NX(e){const t=Tt.getConfig().Auth?.Cognito;We(t),await kX(t);let n;try{kv(t),n=!0}catch{n=!1}if(n){const r=new D8(Jf);r.setAuthConfig(t);const{type:o}=await OX(t,r,dr)??{};if(o==="error")throw new Oe({name:IZ,message:"An error occurred when attempting to log out from OAuth provider."})}else dr.clearTokens(),await h8(),zo.dispatch("auth",{event:"signedOut"},"Auth",Fo)}async function kX(e){try{const{userPoolEndpoint:t,userPoolId:n,userPoolClientId:r}=e,o=await dr.getTokenStore().loadTokens();M8(o),DX(o.accessToken)&&await MX({endpointResolver:rt({endpointOverride:t})})({region:nt(n),userAgentValue:vt($e.SignOut)},{ClientId:r,Token:o.refreshToken})}catch{PX.debug("Client signOut error caught but will proceed with token removal")}}const DX=e=>!!e?.payload?.origin_jti,LX=e=>fn(xn,_n("GetUserAttributeVerificationCode"),Un(),{...An,...e}),UX=async e=>{const{userAttributeKey:t,options:n}=e,r=Tt.getConfig().Auth?.Cognito,o=n?.clientMetadata;We(r);const{userPoolEndpoint:s,userPoolId:a}=r,{tokens:u}=await $v({forceRefresh:!1});uc(u);const c=LX({endpointResolver:rt({endpointOverride:s})}),{CodeDeliveryDetails:f}=await c({region:nt(a),userAgentValue:vt($e.SendUserAttributeVerificationCode)},{AccessToken:u.accessToken.toString(),ClientMetadata:o,AttributeName:t}),{DeliveryMedium:h,AttributeName:g,Destination:m}={...f};return{destination:m,deliveryMedium:h,attributeName:g}},$X={identityId:"identityId"},FX=new Ln("DefaultIdentityIdStore");class s${setAuthConfig(t){Zg(t.Cognito),this.authConfig=t,this._authKeys=zX("Cognito",t.Cognito.identityPoolId)}constructor(t){this._authKeys={},this._hasGuestIdentityId=!1,this.keyValueStorage=t}async loadIdentityId(){Zg(this.authConfig?.Cognito);try{if(this._primaryIdentityId)return{id:this._primaryIdentityId,type:"primary"};{const t=await this.keyValueStorage.getItem(this._authKeys.identityId);return t?(this._hasGuestIdentityId=!0,{id:t,type:"guest"}):null}}catch(t){return FX.log("Error getting stored IdentityId.",t),null}}async storeIdentityId(t){Zg(this.authConfig?.Cognito),t.type==="guest"?(this.keyValueStorage.setItem(this._authKeys.identityId,t.id),this._primaryIdentityId=void 0,this._hasGuestIdentityId=!0):(this._primaryIdentityId=t.id,this._hasGuestIdentityId&&(this.keyValueStorage.removeItem(this._authKeys.identityId),this._hasGuestIdentityId=!1))}async clearIdentityId(){this._primaryIdentityId=void 0,await this.keyValueStorage.removeItem(this._authKeys.identityId)}}const zX=(e,t)=>FA($X)(`com.amplify.${e}`,t),O_=({endpointOverride:e})=>t=>e?{url:new Yi(e)}:JK(t);function i$(e){const t=Ms(e).payload.iss,n={};if(!t)throw new Oe({name:"InvalidIdTokenException",message:"Invalid Idtoken."});const r=t.replace(/(^\w+:|^)\/\//,"");return n[r]=e,n}async function jX({tokens:e,authConfig:t,identityIdStore:n}){n.setAuthConfig({Cognito:t});const r=await n.loadIdentityId();if(r)return r.id;const o=e?.idToken?i$(e.idToken.toString()):{},s=await BX(o,t);return n.storeIdentityId({id:s,type:e?"primary":"guest"}),s}async function BX(e,t){const n=t?.identityPoolId,r=C_(n),o=YK({endpointResolver:O_({endpointOverride:t.identityPoolEndpoint})});let s;try{s=(await o({region:r},{IdentityPoolId:n,Logins:e})).IdentityId}catch(a){throw eo(a),new Oe(a)}if(!s)throw new Oe({name:"GetIdResponseException",message:"Received undefined response from getId operation",recoverySuggestion:"Make sure to pass a valid identityPoolId in the configuration."});return s}const Vp=new Ln("CognitoCredentialsProvider"),$N=3e3*1e3;class a${constructor(t){this._nextCredentialsRefresh=0,this._identityIdStore=t}async clearCredentialsAndIdentityId(){Vp.debug("Clearing out credentials and identityId"),this._credentialsAndIdentityId=void 0,await this._identityIdStore.clearIdentityId()}async clearCredentials(){Vp.debug("Clearing out in-memory credentials"),this._credentialsAndIdentityId=void 0}async getCredentialsAndIdentityId(t){const n=t.authenticated,{tokens:r}=t,{authConfig:o}=t;try{Zg(o?.Cognito)}catch{return}if(!n&&!o.Cognito.allowGuestAccess)return;const{forceRefresh:s}=t,a=this.hasTokenChanged(r),u=await jX({tokens:r,authConfig:o.Cognito,identityIdStore:this._identityIdStore});return(s||a)&&this.clearCredentials(),n?(OZ(r),this.credsForOIDCTokens(o.Cognito,r,u)):this.getGuestCredentials(u,o.Cognito)}async getGuestCredentials(t,n){if(this._credentialsAndIdentityId&&!this.isPastTTL()&&this._credentialsAndIdentityId.isAuthenticatedCreds===!1)return Vp.info("returning stored credentials as they neither past TTL nor expired."),this._credentialsAndIdentityId;this.clearCredentials();const r=C_(n.identityPoolId),o=tN({endpointResolver:O_({endpointOverride:n.identityPoolEndpoint})});let s;try{s=await o({region:r},{IdentityId:t})}catch(a){throw eo(a),new Oe(a)}if(s?.Credentials?.AccessKeyId&&s?.Credentials?.SecretKey){this._nextCredentialsRefresh=new Date().getTime()+$N;const a={credentials:{accessKeyId:s.Credentials.AccessKeyId,secretAccessKey:s.Credentials.SecretKey,sessionToken:s.Credentials.SessionToken,expiration:s.Credentials.Expiration},identityId:t};return s.IdentityId&&(a.identityId=s.IdentityId,this._identityIdStore.storeIdentityId({id:s.IdentityId,type:"guest"})),this._credentialsAndIdentityId={...a,isAuthenticatedCreds:!1},a}else throw new Oe({name:"CredentialsNotFoundException",message:"Cognito did not respond with either Credentials, AccessKeyId or SecretKey."})}async credsForOIDCTokens(t,n,r){if(this._credentialsAndIdentityId&&!this.isPastTTL()&&this._credentialsAndIdentityId.isAuthenticatedCreds===!0)return Vp.debug("returning stored credentials as they neither past TTL nor expired."),this._credentialsAndIdentityId;this.clearCredentials();const o=n.idToken?i$(n.idToken.toString()):{},s=C_(t.identityPoolId),a=tN({endpointResolver:O_({endpointOverride:t.identityPoolEndpoint})});let u;try{u=await a({region:s},{IdentityId:r,Logins:o})}catch(c){throw eo(c),new Oe(c)}if(u?.Credentials?.AccessKeyId&&u?.Credentials?.SecretKey){this._nextCredentialsRefresh=new Date().getTime()+$N;const c={credentials:{accessKeyId:u.Credentials.AccessKeyId,secretAccessKey:u.Credentials.SecretKey,sessionToken:u.Credentials.SessionToken,expiration:u.Credentials.Expiration},identityId:r};return u.IdentityId&&(c.identityId=u.IdentityId,this._identityIdStore.storeIdentityId({id:u.IdentityId,type:"primary"})),this._credentialsAndIdentityId={...c,isAuthenticatedCreds:!0,associatedIdToken:n.idToken?.toString()},c}else throw new Oe({name:"CredentialsException",message:"Cognito did not respond with either Credentials, AccessKeyId or SecretKey."})}isPastTTL(){return this._nextCredentialsRefresh===void 0?!0:this._nextCredentialsRefresh<=Date.now()}hasTokenChanged(t){return!!t&&!!this._credentialsAndIdentityId?.associatedIdToken&&t.idToken?.toString()!==this._credentialsAndIdentityId.associatedIdToken}}const HX=new a$(new s$(Jf)),l$={configure(e,t){const n=l8(e),r=new iZ({sameSite:"lax"}),o=t?.ssr?r:Jf,s=t?.ssr?new a$(new s$(r)):HX;if(!n.Auth||t?.Auth){Tt.configure(n,t);return}Qg.setAuthConfig(n.Auth),Qg.setKeyValueStorage(o),Tt.configure(n,{...t,Auth:{tokenProvider:Qg,credentialsProvider:s}})},getConfig(){return Tt.getConfig()}},qX="https://github.com/remit-mail/reader/issues/new",VX=["internal","acme","tailscale","off"],WX=["self","managed"],FN=(e,t,n)=>e.find(r=>r===t)??n,gc=()=>{const e=globalThis.__REMIT_CONFIG__??{};return{apiUrl:e.apiUrl??"/api",appOrigin:e.appOrigin??"",betterAuthEnabled:e.betterAuthEnabled??!1,cognito:{userPoolId:e.cognito?.userPoolId??"",clientId:e.cognito?.clientId??"",domain:e.cognito?.domain??"",region:e.cognito?.region??""},rum:{appMonitorId:e.rum?.appMonitorId??"",identityPoolId:e.rum?.identityPoolId??"",region:e.rum?.region??"eu-west-1"},mailboxPollIntervalSeconds:e.mailboxPollIntervalSeconds!=null?String(e.mailboxPollIntervalSeconds):void 0,disableDevtools:e.disableDevtools??!1,tlsMode:FN(VX,e.tlsMode,"off"),issuesUrl:e.issuesUrl??qX,updateMode:FN(WX,e.updateMode,"self")}},u$=()=>{const e=gc(),{userPoolId:t,clientId:n,domain:r,region:o}=e.cognito;return!t||!n?null:{userPoolId:t,userPoolClientId:n,domain:r,region:o,appOrigin:e.appOrigin}},Hv=()=>u$()!==null,c$=()=>{const e=u$();if(!e){console.warn("[auth] Cognito user pool is not configured. Running in local dev mode without Cognito auth.");return}const{userPoolId:t,userPoolClientId:n,domain:r,appOrigin:o}=e;l$.configure({Auth:{Cognito:{userPoolId:t,userPoolClientId:n,loginWith:r?{oauth:{domain:r,scopes:["openid","email","profile"],redirectSignIn:o?[o]:[],redirectSignOut:o?[o]:[],responseType:"code"}}:void 0}}})};var GX={};const em=Object.create(null),wd=e=>GX||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?em:globalThis),Ei=new Proxy(em,{get(e,t){return wd()[t]??em[t]},has(e,t){return t in wd()||t in em},set(e,t,n){const r=wd(!0);return r[t]=n,!0},deleteProperty(e,t){if(!t)return!1;const n=wd(!0);return delete n[t],!0},ownKeys(){const e=wd(!0);return Object.keys(e)}});Ei.NODE_ENV;var tm=class extends Error{constructor(e,t){super(e,t),this.name="BetterAuthError",this.message=e,this.stack=""}};const KX=47;function d$(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===KX;)t--;return t===e.length?e:e.slice(0,t)}function ZX(e){try{return(d$(new URL(e).pathname)||"/")!=="/"}catch{throw new tm(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}function YX(e){try{const t=new URL(e);if(t.protocol!=="http:"&&t.protocol!=="https:")throw new tm(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){throw t instanceof tm?t:new tm(`Invalid base URL: ${e}. Please provide a valid base URL.`,{cause:t})}}function zN(e,t="/api/auth"){if(YX(e),ZX(e))return e;const n=d$(e);return!t||t==="/"?n:(t=t.startsWith("/")?t:`/${t}`,`${n}${t}`)}function QX(e,t,n,r,o){{const s=Ei.BETTER_AUTH_URL||Ei.NEXT_PUBLIC_BETTER_AUTH_URL||Ei.PUBLIC_BETTER_AUTH_URL||Ei.NUXT_PUBLIC_BETTER_AUTH_URL||Ei.NUXT_PUBLIC_AUTH_URL||(Ei.BASE_URL!=="/"?Ei.BASE_URL:void 0);if(s)return zN(s,t)}if(typeof window<"u"&&window.location)return zN(window.location.origin,t)}const XX={proto:/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,constructor:/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,protoShort:/"__proto__"\s*:/,constructorShort:/"constructor"\s*:/},JX=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,jN={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:Number.POSITIVE_INFINITY,"-infinity":Number.NEGATIVE_INFINITY},eJ=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function tJ(e){return e instanceof Date&&!isNaN(e.getTime())}function nJ(e){const t=eJ.exec(e);if(!t)return null;const[,n,r,o,s,a,u,c,f,h,g]=t,m=new Date(Date.UTC(parseInt(n,10),parseInt(r,10)-1,parseInt(o,10),parseInt(s,10),parseInt(a,10),parseInt(u,10),c?parseInt(c.padEnd(3,"0"),10):0));if(f){const v=(parseInt(h,10)*60+parseInt(g,10))*(f==="+"?-1:1);m.setUTCMinutes(m.getUTCMinutes()+v)}return tJ(m)?m:null}function rJ(e,t={}){const{strict:n=!1,warnings:r=!1,reviver:o,parseDates:s=!0}=t;if(typeof e!="string")return e;const a=e.trim(),u=a.toLowerCase();if(u.length<=9&&u in jN)return jN[u];if(!JX.test(a)){if(n)throw new SyntaxError("[better-json] Invalid JSON");return e}if(Object.entries(XX).some(([c,f])=>{const h=f.test(a);return h&&r&&console.warn(`[better-json] Detected potential prototype pollution attempt using ${c} pattern`),h})&&n)throw new Error("[better-json] Potential prototype pollution attempt detected");try{return JSON.parse(a,(f,h)=>{if(f==="__proto__"||f==="constructor"&&h&&typeof h=="object"&&"prototype"in h){r&&console.warn(`[better-json] Dropping "${f}" key to prevent prototype pollution`);return}if(s&&typeof h=="string"){const g=nJ(h);if(g)return g}return o?o(f,h):h})}catch(c){if(n)throw c;return e}}function oJ(e,t={strict:!0}){return rJ(e,t)}const sJ=["javascript:","data:","vbscript:"];function iJ(e){let t;try{t=new URL(e)}catch{return!0}return!sJ.includes(t.protocol)}const aJ={id:"redirect",name:"Redirect",hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&iJ(e.data.url)&&typeof window<"u"&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}};let po=[],_i=0;const nm=4,lJ=globalThis.nanostoresGlobal||={epoch:0};let uJ=()=>{for(_i=0;_i<po.length;_i+=nm)po[_i](po[_i+1].value,po[_i+2],po[_i+3]);po.length=0};const f$=e=>{let t=[],n={get(){return n.lc||n.listen(()=>{})(),n.value},init:e,lc:0,listen(r){return n.lc=t.push(r),()=>{for(let s=_i+nm;s<po.length;)po[s]===r?po.splice(s,nm):s+=nm;let o=t.indexOf(r);~o&&(t.splice(o,1),--n.lc||n.off())}},notify(r,o){lJ.epoch++;let s=!po.length&&!0;for(let a of t)po.push(a,n,r,o);s&&uJ()},off(){},set(r){let o=n.value;o!==r&&(n.value=r,n.notify(o))},subscribe(r){let o=n.listen(r);return r(n.value),o},value:e};return n},cJ=2,dJ=5,Wp=6,Gp=10;let h$=(e,t,n,r)=>(e.events=e.events||{},e.events[n+Gp]||(e.events[n+Gp]=r(o=>{e.events[n].reduceRight((s,a)=>(a(s),s),{shared:{},...o})})),e.events[n]=e.events[n]||[],e.events[n].push(t),()=>{let o=e.events[n],s=o.indexOf(t);o.splice(s,1),o.length||(delete e.events[n],e.events[n+Gp](),delete e.events[n+Gp])}),fJ=(e,t)=>h$(e,t,cJ,n=>{let r=e.set,o=e.setKey;return e.setKey&&(e.setKey=(s,a)=>{let u;if(n({abort:()=>{u=!0},changed:s,newValue:{...e.value,[s]:a}}),!u)return o(s,a)}),e.set=s=>{let a;if(n({abort:()=>{a=!0},newValue:s}),!a)return r(s)},()=>{e.set=r,e.setKey=o}});const p$=1e3;let hJ=(e,t)=>h$(e,r=>{let o=t(r);o&&e.events[Wp].push(o)},dJ,r=>{let o=e.listen;e.listen=(...a)=>(!e.lc&&!e.active&&(e.active=!0,r()),o(...a));let s=e.off;return e.events[Wp]=[],e.off=()=>{s(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let a of e.events[Wp])a();e.events[Wp]=[]}},p$)},()=>{e.listen=o,e.off=s}});function pJ(e,t,n){let r=new Set(t);return e.listen((o,s,a)=>{(a===void 0?t.some(u=>o[u]!==s[u]):r.has(a)||r.has(a.split(/\.|\[/)[0]))&&n(o,s,a)})}function BN(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Im(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Im(e[n],t[n]))return!1;return!0}if(BN(e)&&BN(t)){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n)if(!(o in t)||!Im(e[o],t[o]))return!1;return!0}return!1}function gJ(e,t){return fJ(e,({newValue:n,abort:r})=>{t(e.value,n)&&r()})}const M_=Symbol.for("better-auth:auth-query");function mJ(e){return M_ in e&&e[M_]===!0}function vJ(e){const t=f$(e);return Object.defineProperty(t,M_,{value:!0}),t}const O1=Symbol.for("better-auth:broadcast-channel"),yJ=()=>Math.floor(Date.now()/1e3);var bJ=class{listeners=new Set;name;constructor(e="better-auth.message"){this.name=e}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}post(e){if(!(typeof window>"u"))try{localStorage.setItem(this.name,JSON.stringify({...e,timestamp:yJ()}))}catch{}}setup(){if(typeof window>"u"||typeof window.addEventListener>"u")return()=>{};const e=t=>{if(t.key!==this.name)return;const n=JSON.parse(t.newValue??"{}");n?.event!=="session"||!n?.data||this.listeners.forEach(r=>r(n))};return window.addEventListener("storage",e),()=>{window.removeEventListener("storage",e)}}};function M1(e="better-auth.message"){return globalThis[O1]||(globalThis[O1]=new bJ(e)),globalThis[O1]}const P1=Symbol.for("better-auth:focus-manager");var SJ=class{listeners=new Set;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setFocused(e){this.listeners.forEach(t=>t(e))}setup(){if(typeof window>"u"||typeof document>"u"||typeof window.addEventListener>"u")return()=>{};const e=()=>{document.visibilityState==="visible"&&this.setFocused(!0)};return document.addEventListener("visibilitychange",e,!1),()=>{document.removeEventListener("visibilitychange",e,!1)}}};function HN(){return globalThis[P1]||(globalThis[P1]=new SJ),globalThis[P1]}const N1=Symbol.for("better-auth:online-manager");var wJ=class{listeners=new Set;isOnline=typeof navigator<"u"?navigator.onLine:!0;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setOnline(e){this.isOnline=e,this.listeners.forEach(t=>t(e))}setup(){if(typeof window>"u"||typeof window.addEventListener>"u")return()=>{};const e=()=>this.setOnline(!0),t=()=>this.setOnline(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",t,!1),()=>{window.removeEventListener("online",e,!1),window.removeEventListener("offline",t,!1)}}};function k1(){return globalThis[N1]||(globalThis[N1]=new wJ),globalThis[N1]}const D1=()=>Math.floor(Date.now()/1e3),CJ=5;function EJ(e){const{fetchSession:t,shouldPollSession:n=()=>!0,sessionSignal:r,options:o={}}=e,s=o.sessionOptions?.refetchInterval??0,a=o.sessionOptions?.refetchOnWindowFocus??!0,u=o.sessionOptions?.refetchWhenOffline??!1,c={isInitialized:!1,lastSessionRequest:0},f=()=>u||k1().isOnline,h=I=>{if(f()){if(I?.event==="storage"){t();return}if(I?.event==="poll"){c.lastSessionRequest=D1(),t();return}if(I?.event==="visibilitychange"){if(D1()-c.lastSessionRequest<CJ)return;c.lastSessionRequest=D1(),t();return}t()}},g=I=>{M1().post({event:"session",data:{trigger:I},clientId:Math.random().toString(36).substring(7)})},m=()=>{s&&s>0&&(c.pollInterval=setInterval(()=>{n()&&h({event:"poll"})},s*1e3))},v=()=>{c.unsubscribeBroadcast=M1().subscribe(()=>{h({event:"storage"})})},w=()=>{a&&(c.unsubscribeFocus=HN().subscribe(()=>{h({event:"visibilitychange"})}))},S=()=>{c.unsubscribeOnline=k1().subscribe(I=>{I&&h({event:"visibilitychange"})})},C=()=>{c.unsubscribeSignal=r.listen(()=>{t()})};return{init:()=>{c.isInitialized||(c.isInitialized=!0,m(),v(),w(),S(),C(),c.cleanupBroadcastSetup=M1().setup(),c.cleanupFocusSetup=HN().setup(),c.cleanupOnlineSetup=k1().setup())},cleanup:()=>{c.isInitialized&&(c.pollInterval&&(clearInterval(c.pollInterval),c.pollInterval=void 0),c.unsubscribeBroadcast&&(c.unsubscribeBroadcast(),c.unsubscribeBroadcast=void 0),c.unsubscribeFocus&&(c.unsubscribeFocus(),c.unsubscribeFocus=void 0),c.unsubscribeOnline&&(c.unsubscribeOnline(),c.unsubscribeOnline=void 0),c.unsubscribeSignal&&(c.unsubscribeSignal(),c.unsubscribeSignal=void 0),c.cleanupBroadcastSetup&&(c.cleanupBroadcastSetup(),c.cleanupBroadcastSetup=void 0),c.cleanupFocusSetup&&(c.cleanupFocusSetup(),c.cleanupFocusSetup=void 0),c.cleanupOnlineSetup&&(c.cleanupOnlineSetup(),c.cleanupOnlineSetup=void 0),c.isInitialized=!1,c.lastSessionRequest=0)},triggerRefetch:h,broadcastSessionUpdate:g}}const _J=()=>typeof window>"u",xJ=p$;function AJ(e,t){if(typeof window>"u")return;const n=e.get();n.data!==null||t===null||e.set({...n,data:t,error:null,isPending:!1})}function qN(e){return typeof e=="object"&&e!==null&&"data"in e&&"error"in e?e:{data:e,error:null}}function IJ(e){return!e||e.session===null&&e.user===null?null:e}function RJ(e,t){return Im(e.data,t.data)&&e.error===t.error&&e.isPending===t.isPending&&e.isRefetching===t.isRefetching&&e.refetch===t.refetch}function TJ(e,t){const n=f$(!1);let r,o=0,s=0;n.listen(()=>{s++,o=0});const a=v=>h(v),u=vJ({data:null,error:null,isPending:!0,isRefetching:!1,refetch:a});gJ(u,RJ);const c=async(v,w)=>{const S=u.value;if(u.set({...S,isPending:S.data===null,isRefetching:!0,error:null,refetch:a}),v.aborted)return"aborted";try{const C=await e("/get-session",{method:"GET",query:w?.query,signal:v});if(v.aborted)return"aborted";let{data:E,error:A}=qN(C),I="fresh";if(E?.needsRefresh)try{const R=await e("/get-session",{method:"POST",signal:v});if(v.aborted)return"aborted";({data:E,error:A}=qN(R))}catch{if(v.aborted)return"aborted";I="stale"}if(A){const R=u.value,k=A?.status===401;return u.set({data:k?null:R.data,error:A,isPending:!1,isRefetching:!1,refetch:a}),"failed"}const T=IJ(E),N=u.value,M=N.data!=null&&T!=null&&Im(N.data,T)?N.data:T;return u.set({data:M,error:null,isPending:!1,isRefetching:!1,refetch:a}),I}catch(C){if(v.aborted)return"aborted";const E=u.value;return u.set({data:E.data,error:C,isPending:!1,isRefetching:!1,refetch:a}),"failed"}},f=()=>{const v=u.value.data?.session?.expiresAt,w=v instanceof Date?v.getTime():Number.POSITIVE_INFINITY;return Math.min(Date.now()+xJ,w)},h=v=>{o=0,r?.cancel();const w=new AbortController,S={cancel:()=>w.abort(),promise:Promise.resolve().then(()=>w.signal.aborted?"aborted":c(w.signal,v)),revision:s};r=S;const C=E=>{r===S&&(r=void 0,E==="fresh"&&S.revision===s&&(o=f()))};return S.promise.then(C,()=>C("failed")),S.promise.then(()=>{})},g=()=>r?.revision===s?r.promise.then(()=>{}):Date.now()<o?Promise.resolve():h();let m=()=>{};return hJ(u,()=>{let v;_J()||(v=setTimeout(()=>{g()},0));const w=EJ({fetchSession:h,shouldPollSession:()=>u.value.data!=null,sessionSignal:n,options:t});return w.init(),m=w.broadcastSessionUpdate,()=>{v&&clearTimeout(v),w.cleanup()}}),{session:u,$sessionSignal:n,broadcastSessionUpdate:v=>m(v)}}function L1(e){if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)==="[object Module]":!0}function P_(e,t,n=".",r){if(!L1(t))return P_(e,{},n,r);const o={...t};for(const s of Object.keys(e)){if(s==="__proto__"||s==="constructor")continue;const a=e[s];a!=null&&(r&&r(o,s,a,n)||(Array.isArray(a)&&Array.isArray(o[s])?o[s]=[...a,...o[s]]:L1(a)&&L1(o[s])?o[s]=P_(a,o[s],(n?`${n}.`:"")+s.toString(),r):o[s]=a))}return o}function OJ(e){return(...t)=>t.reduce((n,r)=>P_(n,r,"",e),{})}const MJ=OJ();var PJ=class extends Error{constructor(e,t,n){super(t||e.toString(),{cause:n}),this.status=e,this.statusText=t,this.error=n,Error.captureStackTrace(this,this.constructor)}};const NJ=async(e,t)=>{let n=t||{};const r={onRequest:[t?.onRequest],onResponse:[t?.onResponse],onSuccess:[t?.onSuccess],onError:[t?.onError],onRetry:[t?.onRetry]};if(!t||!t?.plugins)return{url:e,options:n,hooks:r};for(const h of t?.plugins||[]){var o,s,a,u,c;if(h.init){var f;const g=await((f=h.init)===null||f===void 0?void 0:f.call(h,e.toString(),n));n=g.options||n,e=g.url}r.onRequest.push((o=h.hooks)===null||o===void 0?void 0:o.onRequest),r.onResponse.push((s=h.hooks)===null||s===void 0?void 0:s.onResponse),r.onSuccess.push((a=h.hooks)===null||a===void 0?void 0:a.onSuccess),r.onError.push((u=h.hooks)===null||u===void 0?void 0:u.onError),r.onRetry.push((c=h.hooks)===null||c===void 0?void 0:c.onRetry)}return{url:e,options:n,hooks:r}};var VN=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(){return this.options.delay}},kJ=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(e){return Math.min(this.options.maxDelay,this.options.baseDelay*2**e)}};function DJ(e){if(typeof e=="number")return new VN({type:"linear",attempts:e,delay:1e3});switch(e.type){case"linear":return new VN(e);case"exponential":return new kJ(e);default:throw new Error("Invalid retry strategy")}}const LJ=["get","post","put","patch","delete"];function QA(e){if(!e.startsWith("@"))return{method:void 0,path:e};const t=e.indexOf("/"),n=e.slice(1,t===-1?void 0:t);return LJ.includes(n)?{method:n,path:t===-1?e:e.slice(t+1)}:{method:void 0,path:e}}const UJ=e=>e==="."||e==="..",$J=e=>e.split(":").map(t=>encodeURIComponent(t)).join(":");function FJ(e,t){const n=t.get(e);if(n===void 0)return $J(e);if(UJ(n))throw new TypeError("Path parameters cannot be reserved path segments");return encodeURIComponent(n)}function zJ(e,t){const{baseURL:n,params:r,query:o}=t||{query:{},params:{},baseURL:""};let s=e.startsWith("http")?e.split("/").slice(0,3).join("/"):n||"";const{path:a}=QA(e);a!==e&&(e=`/${a}`),s.endsWith("/")||(s+="/");let[u,c]=e.replace(s,"").split("?");const f=new URLSearchParams(c);for(const[m,v]of Object.entries(o||{})){if(v==null)continue;let w;if(typeof v=="string")w=v;else if(Array.isArray(v)){for(const S of v)f.append(m,S);continue}else w=JSON.stringify(v);f.set(m,w)}const h=new Map;if(r)if(Array.isArray(r)){const m=u.split("/").filter(v=>v.startsWith(":"));for(const[v,w]of m.entries()){const S=r[v];h.set(w,String(S))}}else for(const[m,v]of Object.entries(r))h.set(`:${m}`,String(v));u=u.split("/").map(m=>FJ(m,h)).join("/"),u=u.replace(/^\/+/,"");let g=f.toString();return g=g.length>0?`?${g}`.replace(/\+/g,"%20"):"",s.startsWith("http")?new URL(`${u}${g}`,s):`${s}${u}${g}`}const jJ=async e=>{const t={},n=async r=>typeof r=="function"?await r():r;if(e?.auth){if(e.auth.type==="Bearer"){const r=await n(e.auth.token);if(!r)return t;t.authorization=`Bearer ${r}`}else if(e.auth.type==="Basic"){const[r,o]=await Promise.all([n(e.auth.username),n(e.auth.password)]);if(!r||!o)return t;t.authorization=`Basic ${btoa(`${r}:${o}`)}`}else if(e.auth.type==="Custom"){const[r,o]=await Promise.all([n(e.auth.prefix),n(e.auth.value)]);if(!o)return t;t.authorization=`${r??""} ${o}`}}return t},BJ=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function HJ(e){const t=e.headers.get("content-type"),n=new Set(["image/svg","application/xml","application/xhtml","application/html"]);if(!t)return"json";const r=t.split(";").shift()||"";return BJ.test(r)?"json":n.has(r)||r.startsWith("text/")?"text":"blob"}function qJ(e){try{return JSON.parse(e),!0}catch{return!1}}function g$(e){if(e===void 0)return!1;const t=typeof e;return t==="string"||t==="number"||t==="boolean"||t===null?!0:t!=="object"?!1:Array.isArray(e)?!0:e.buffer?!1:e.constructor&&e.constructor.name==="Object"||typeof e.toJSON=="function"}function WN(e){try{return JSON.parse(e)}catch{return e}}function GN(e){return typeof e=="function"}function VJ(e){if(e?.customFetchImpl)return e.customFetchImpl;if(typeof globalThis<"u"&&GN(globalThis.fetch))return globalThis.fetch;if(typeof window<"u"&&GN(window.fetch))return window.fetch;throw new Error("No fetch implementation found")}function m$(...e){const t={};for(const n of e)if(n)if(n instanceof Headers)n.forEach((r,o)=>{t[o]=r});else{const r=Array.isArray(n)?n:Object.entries(n);for(const[o,s]of r)s!=null&&(t[o]=s)}return t}async function WJ(e){const t=new Headers(m$(e?.headers,await jJ(e)));if(!t.has("content-type")){const n=GJ(e?.body);n&&t.set("content-type",n)}return t}function GJ(e){return g$(e)?"application/json":null}function KJ(e){const t=e.get("content-type");return t?t.split(";")[0].trim().toLowerCase():null}function ZJ(e,t){const{body:n}=e;return n?!g$(n)||typeof n=="string"?n:KJ(t)==="application/x-www-form-urlencoded"?new URLSearchParams(n).toString():JSON.stringify(n):null}function YJ(e,t){if(t?.method)return t.method.toUpperCase();const{method:n}=QA(e);return n?n.toUpperCase():t?.body?"POST":"GET"}function QJ(e,t){let n;return!e?.signal&&e?.timeout&&(n=setTimeout(()=>t?.abort(),e?.timeout)),{abortTimeout:n,clearTimeout:()=>{n&&clearTimeout(n)}}}var XJ=class v$ extends Error{constructor(t,n){super(n||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,v$.prototype)}};async function qd(e,t){const n=await e["~standard"].validate(t);if(n.issues)throw new XJ(n.issues);return n.value}function bf(e){"@babel/helpers - typeof";return bf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},bf(e)}function JJ(e,t){if(bf(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(bf(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function eee(e){var t=JJ(e,"string");return bf(t)=="symbol"?t:t+""}function tee(e,t,n){return(t=eee(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function KN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function ct(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?KN(Object(n),!0).forEach(function(r){tee(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):KN(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}const N_=async(e,t)=>{var n,r,o;const{hooks:s,url:a,options:u}=await NJ(e,t),c=VJ(u),f=new AbortController,h=(n=u.signal)!==null&&n!==void 0?n:f.signal,g=zJ(a,u),m=await WJ(u),v=ZJ(u,m),w=YJ(a,u),S=ct(ct({},u),{},{url:g,headers:m,body:v,method:w,signal:h});for(const j of s.onRequest)if(j){const Z=await j(S);typeof Z=="object"&&Z!==null&&Object.assign(S,Z)}("pipeTo"in S&&typeof S.pipeTo=="function"||typeof(t==null||(r=t.body)===null||r===void 0?void 0:r.pipe)=="function")&&("duplex"in S||(S.duplex="half"));const{clearTimeout:C}=QJ(u,f);let E=await c(S.url,S);C();const A={response:E,request:S};for(const j of s.onResponse)if(j){var I;const Z=await j(ct(ct({},A),{},{response:!(t==null||(I=t.hookOptions)===null||I===void 0)&&I.cloneResponse?E.clone():E}));Z instanceof Response?E=Z:typeof Z=="object"&&Z!==null&&(E=Z.response)}if(E.ok){if(S.method==="HEAD")return{data:"",error:null};const j=HJ(E),Z={data:null,response:E,request:S};if(j==="json"||j==="text"){var T;const he=await E.text();Z.data=await((T=S.jsonParser)!==null&&T!==void 0?T:WN)(he)}else Z.data=await E[j]();S?.output&&S.output&&!S.disableValidation&&(Z.data=await qd(S.output,Z.data));for(const he of s.onSuccess)if(he){var N;await he(ct(ct({},Z),{},{response:!(t==null||(N=t.hookOptions)===null||N===void 0)&&N.cloneResponse?E.clone():E}))}return t?.throw?Z.data:{data:Z.data,error:null}}const M=(o=t?.jsonParser)!==null&&o!==void 0?o:WN,R=await E.text(),k=qJ(R),L=k?await M(R):null,q={response:E,responseText:R,request:S,error:ct(ct({},L),{},{status:E.status,statusText:E.statusText})};for(const j of s.onError)if(j){var $;await j(ct(ct({},q),{},{response:!(t==null||($=t.hookOptions)===null||$===void 0)&&$.cloneResponse?E.clone():E}))}if(t?.retry){var D;const j=DJ(t.retry),Z=(D=t.retryAttempt)!==null&&D!==void 0?D:0;if(await j.shouldAttemptRetry(Z,E)){for(const B of s.onRetry)B&&await B(A);const he=j.getDelay(Z);return await new Promise(B=>setTimeout(B,he)),await N_(e,ct(ct({},t),{},{retryAttempt:Z+1}))}}if(t?.throw)throw new PJ(E.status,E.statusText,k?L:R);return{data:null,error:ct(ct({},L),{},{status:E.status,statusText:E.statusText})}},nee=e=>({id:"apply-schema",name:"Apply Schema",version:"1.0.0",async init(t,n){var r;let o=ct(ct({},n),e.query!==void 0&&{query:ct(ct({},e.query),n?.query)});const s=((r=e.plugins)===null||r===void 0||(r=r.find(f=>{var h;return!((h=f.schema)===null||h===void 0)&&h.config?t.startsWith(f.schema.config.baseURL||"")||t.startsWith(f.schema.config.prefix||""):!1}))===null||r===void 0?void 0:r.schema)||e.schema;if(s){var a,u;let f=t;!((a=s.config)===null||a===void 0)&&a.prefix&&f.startsWith(s.config.prefix)&&(f=f.replace(s.config.prefix,""),s.config.baseURL&&(t=t.replace(s.config.prefix,s.config.baseURL))),!((u=s.config)===null||u===void 0)&&u.baseURL&&f.startsWith(s.config.baseURL)&&(f=f.replace(s.config.baseURL,"")),f.startsWith("/")&&f.charAt(1)==="@"&&(f=f.substring(1));const h=s.schema[f];if(h){var c;const{method:g,path:m}=QA(f);g&&(t=t.slice(0,t.length-f.length)+m);let v=n?.headers;if(h.headers&&!n?.disableValidation){const S={};if(n?.headers){if(n.headers instanceof Headers)n.headers.forEach((A,I)=>{S[I.toLowerCase()]=A});else if(typeof n.headers=="object")for(const[A,I]of Object.entries(n.headers))I!=null&&(S[A.toLowerCase()]=I)}const C=await qd(h.headers,S),E={};for(const[A,I]of Object.entries(C))E[A.toLowerCase()]=I;v=E}const w=(c=h.method)!==null&&c!==void 0?c:g;if(o=ct(ct(ct(ct({},o),w!==void 0&&{method:w}),h.output!==void 0&&{output:h.output}),v!==void 0&&{headers:v}),!n?.disableValidation){if(h.query&&(o.query=await qd(h.query,n?.query),o.query!==null&&typeof o.query=="object")){const S=ct({},e.query);for(const C of Object.keys(S))n?.query&&Object.prototype.hasOwnProperty.call(n.query,C)&&(S[C]=n.query[C]);o.query=ct(ct({},S),o.query)}o=ct(ct({},o),{},{body:h.input?await qd(h.input,n?.body):n?.body,params:h.params?await qd(h.params,n?.params):n?.params})}return{url:t,options:o}}}return ct({url:t},(n!==void 0||e.query!==void 0)&&{options:o})}}),ree=e=>{async function t(n,r){const o=ct(ct(ct({},e),r),{},{headers:m$(e?.headers,r?.headers),plugins:[...e?.plugins||[],nee(e||{}),...r?.plugins||[]]});if(e?.catchAllError)try{return await N_(n,o)}catch(s){return{data:null,error:{status:500,statusText:"Fetch Error",message:"Fetch related error. Captured by catchAllError option. See error property for more details.",error:s}}}return await N_(n,o)}return t};var Sa={};const oee=e=>{if(typeof process>"u")return;const t="/api/auth";if(Sa.NEXT_PUBLIC_AUTH_URL)return Sa.NEXT_PUBLIC_AUTH_URL;if(typeof window>"u"){if(Sa.NEXTAUTH_URL)try{return Sa.NEXTAUTH_URL}catch{}if(Sa.VERCEL_URL)try{const n=Sa.VERCEL_URL.startsWith("http")?"":"https://";return`${new URL(`${n}${Sa.VERCEL_URL}`).origin}${t}`}catch{}}},see=e=>e==="/sign-out"||e==="/update-user"||e==="/update-session"||e==="/sign-up/email"||e==="/sign-in/email"||e==="/delete-user"||e==="/verify-email"||e==="/revoke-sessions"||e==="/revoke-session"||e==="/revoke-other-sessions"||e==="/change-email"||e==="/change-password",iee=(e,t)=>{const n="credentials"in Request.prototype,r=QX(e?.baseURL,e?.basePath)??oee()??"/api/auth",o=[],s={id:"lifecycle-hooks",name:"lifecycle-hooks",hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:a,onError:u,onRequest:c,onResponse:f,...h}={},g=ree({baseURL:r,...n?{credentials:"include"}:{},method:"GET",jsonParser(R){return R?oJ(R,{strict:!1}):null},customFetchImpl:fetch,...h,plugins:[s,...h.plugins||[],aJ,...o]}),{$sessionSignal:m,session:v,broadcastSessionUpdate:w}=TJ(g,e);let S=!1;const C=R=>{S||R===null||(S=!0,AJ(v,R))},E=[];let A={};const I={$sessionSignal:m,session:v},T={"/sign-out":"POST","/revoke-sessions":"POST","/revoke-other-sessions":"POST","/delete-user":"POST"},N=[{signal:"$sessionSignal",matcher:see,callback(R){R==="/sign-out"?w("signout"):(R==="/update-user"||R==="/update-session")&&w("updateUser")}}];for(const R of E)R.getAtoms&&Object.assign(I,R.getAtoms?.(g)),R.pathMethods&&Object.assign(T,R.pathMethods),R.atomListeners&&N.push(...R.atomListeners);const M={notify:R=>{I[R].set(!I[R].get())},listen:(R,k)=>{I[R].subscribe(k)},atoms:I};for(const R of E)R.getActions&&(A=MJ(R.getActions?.(g,M,e)??{},A));return{get baseURL(){return r},pluginsActions:A,pluginsAtoms:I,pluginPathMethods:T,atomListeners:N,hydrateSession:C,$sessionSignal:m,$fetch:g,$store:M}};function aee(e){return typeof e=="object"&&e!==null&&"get"in e&&typeof e.get=="function"&&"lc"in e&&typeof e.lc=="number"}function lee(e){return e.charAt(0).toUpperCase()+e.slice(1)}const uee=new RegExp("[\\p{Ll}\\d]+|\\p{Lu}+(?!\\p{Ll})|\\p{Lu}[\\p{Ll}\\d]+|\\p{Lo}+","gu"),cee=/['\u2019]/g;function dee(e){return e.replace(cee,"").match(uee)??[]}function fee(e){return dee(e).map(t=>t.toLowerCase()).join("-")}function hee(e,t,n){const r=t[e],{fetchOptions:o,query:s,...a}=n||{};return r||(o?.method?o.method:a&&Object.keys(a).length>0?"POST":"GET")}function pee(e,t,n,r,o){function s(a=[]){return new Proxy(function(){},{get(u,c){if(typeof c!="string"||c==="then"||c==="catch"||c==="finally")return;const f=[...a,c];let h=e;for(const g of f)if(h&&typeof h=="object"&&g in h)h=h[g];else{h=void 0;break}return typeof h=="function"||aee(h)?h:s(f)},apply:async(u,c,f)=>{const h="/"+a.map(fee).join("/"),g=f[0]||{},m=f[1]||{},{query:v,fetchOptions:w,...S}=g,C={...m,...w},E=hee(h,n,g);return await t(h,{...C,body:E==="GET"?void 0:{...S,...C?.body||{}},query:v||C?.query,method:E,async onSuccess(A){if(await C?.onSuccess?.(A),!o||C.disableSignal)return;const I=o.filter(N=>N.matcher(h));if(!I.length)return;const T=new Set;for(const N of I){const M=r[N.signal];if(!M)return;if(T.has(N.signal))continue;T.add(N.signal);const R=M.get();setTimeout(()=>{M.set(!R)},10),N.callback?.(h)}}})}})}return s()}var U1={exports:{}},Le={};var ZN;function gee(){if(ZN)return Le;ZN=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),a=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),m=Symbol.iterator;function v(U){return U===null||typeof U!="object"?null:(U=m&&U[m]||U["@@iterator"],typeof U=="function"?U:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,C={};function E(U,X,ie){this.props=U,this.context=X,this.refs=C,this.updater=ie||w}E.prototype.isReactComponent={},E.prototype.setState=function(U,X){if(typeof U!="object"&&typeof U!="function"&&U!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,U,X,"setState")},E.prototype.forceUpdate=function(U){this.updater.enqueueForceUpdate(this,U,"forceUpdate")};function A(){}A.prototype=E.prototype;function I(U,X,ie){this.props=U,this.context=X,this.refs=C,this.updater=ie||w}var T=I.prototype=new A;T.constructor=I,S(T,E.prototype),T.isPureReactComponent=!0;var N=Array.isArray;function M(){}var R={H:null,A:null,T:null,S:null},k=Object.prototype.hasOwnProperty;function L(U,X,ie){var oe=ie.ref;return{$$typeof:e,type:U,key:X,ref:oe!==void 0?oe:null,props:ie}}function q(U,X){return L(U.type,X,U.props)}function $(U){return typeof U=="object"&&U!==null&&U.$$typeof===e}function D(U){var X={"=":"=0",":":"=2"};return"$"+U.replace(/[=:]/g,function(ie){return X[ie]})}var j=/\/+/g;function Z(U,X){return typeof U=="object"&&U!==null&&U.key!=null?D(""+U.key):X.toString(36)}function he(U){switch(U.status){case"fulfilled":return U.value;case"rejected":throw U.reason;default:switch(typeof U.status=="string"?U.then(M,M):(U.status="pending",U.then(function(X){U.status==="pending"&&(U.status="fulfilled",U.value=X)},function(X){U.status==="pending"&&(U.status="rejected",U.reason=X)})),U.status){case"fulfilled":return U.value;case"rejected":throw U.reason}}throw U}function B(U,X,ie,oe,fe){var Me=typeof U;(Me==="undefined"||Me==="boolean")&&(U=null);var xe=!1;if(U===null)xe=!0;else switch(Me){case"bigint":case"string":case"number":xe=!0;break;case"object":switch(U.$$typeof){case e:case t:xe=!0;break;case h:return xe=U._init,B(xe(U._payload),X,ie,oe,fe)}}if(xe)return fe=fe(U),xe=oe===""?"."+Z(U,0):oe,N(fe)?(ie="",xe!=null&&(ie=xe.replace(j,"$&/")+"/"),B(fe,X,ie,"",function(Ze){return Ze})):fe!=null&&($(fe)&&(fe=q(fe,ie+(fe.key==null||U&&U.key===fe.key?"":(""+fe.key).replace(j,"$&/")+"/")+xe)),X.push(fe)),1;xe=0;var se=oe===""?".":oe+":";if(N(U))for(var Se=0;Se<U.length;Se++)oe=U[Se],Me=se+Z(oe,Se),xe+=B(oe,X,ie,Me,fe);else if(Se=v(U),typeof Se=="function")for(U=Se.call(U),Se=0;!(oe=U.next()).done;)oe=oe.value,Me=se+Z(oe,Se++),xe+=B(oe,X,ie,Me,fe);else if(Me==="object"){if(typeof U.then=="function")return B(he(U),X,ie,oe,fe);throw X=String(U),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(U).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.")}return xe}function Q(U,X,ie){if(U==null)return U;var oe=[],fe=0;return B(U,oe,"","",function(Me){return X.call(ie,Me,fe++)}),oe}function ae(U){if(U._status===-1){var X=U._result;X=X(),X.then(function(ie){(U._status===0||U._status===-1)&&(U._status=1,U._result=ie)},function(ie){(U._status===0||U._status===-1)&&(U._status=2,U._result=ie)}),U._status===-1&&(U._status=0,U._result=X)}if(U._status===1)return U._result.default;throw U._result}var ue=typeof reportError=="function"?reportError:function(U){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var X=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof U=="object"&&U!==null&&typeof U.message=="string"?String(U.message):String(U),error:U});if(!window.dispatchEvent(X))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",U);return}console.error(U)},we={map:Q,forEach:function(U,X,ie){Q(U,function(){X.apply(this,arguments)},ie)},count:function(U){var X=0;return Q(U,function(){X++}),X},toArray:function(U){return Q(U,function(X){return X})||[]},only:function(U){if(!$(U))throw Error("React.Children.only expected to receive a single React element child.");return U}};return Le.Activity=g,Le.Children=we,Le.Component=E,Le.Fragment=n,Le.Profiler=o,Le.PureComponent=I,Le.StrictMode=r,Le.Suspense=c,Le.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=R,Le.__COMPILER_RUNTIME={__proto__:null,c:function(U){return R.H.useMemoCache(U)}},Le.cache=function(U){return function(){return U.apply(null,arguments)}},Le.cacheSignal=function(){return null},Le.cloneElement=function(U,X,ie){if(U==null)throw Error("The argument must be a React element, but you passed "+U+".");var oe=S({},U.props),fe=U.key;if(X!=null)for(Me in X.key!==void 0&&(fe=""+X.key),X)!k.call(X,Me)||Me==="key"||Me==="__self"||Me==="__source"||Me==="ref"&&X.ref===void 0||(oe[Me]=X[Me]);var Me=arguments.length-2;if(Me===1)oe.children=ie;else if(1<Me){for(var xe=Array(Me),se=0;se<Me;se++)xe[se]=arguments[se+2];oe.children=xe}return L(U.type,fe,oe)},Le.createContext=function(U){return U={$$typeof:a,_currentValue:U,_currentValue2:U,_threadCount:0,Provider:null,Consumer:null},U.Provider=U,U.Consumer={$$typeof:s,_context:U},U},Le.createElement=function(U,X,ie){var oe,fe={},Me=null;if(X!=null)for(oe in X.key!==void 0&&(Me=""+X.key),X)k.call(X,oe)&&oe!=="key"&&oe!=="__self"&&oe!=="__source"&&(fe[oe]=X[oe]);var xe=arguments.length-2;if(xe===1)fe.children=ie;else if(1<xe){for(var se=Array(xe),Se=0;Se<xe;Se++)se[Se]=arguments[Se+2];fe.children=se}if(U&&U.defaultProps)for(oe in xe=U.defaultProps,xe)fe[oe]===void 0&&(fe[oe]=xe[oe]);return L(U,Me,fe)},Le.createRef=function(){return{current:null}},Le.forwardRef=function(U){return{$$typeof:u,render:U}},Le.isValidElement=$,Le.lazy=function(U){return{$$typeof:h,_payload:{_status:-1,_result:U},_init:ae}},Le.memo=function(U,X){return{$$typeof:f,type:U,compare:X===void 0?null:X}},Le.startTransition=function(U){var X=R.T,ie={};R.T=ie;try{var oe=U(),fe=R.S;fe!==null&&fe(ie,oe),typeof oe=="object"&&oe!==null&&typeof oe.then=="function"&&oe.then(M,ue)}catch(Me){ue(Me)}finally{X!==null&&ie.types!==null&&(X.types=ie.types),R.T=X}},Le.unstable_useCacheRefresh=function(){return R.H.useCacheRefresh()},Le.use=function(U){return R.H.use(U)},Le.useActionState=function(U,X,ie){return R.H.useActionState(U,X,ie)},Le.useCallback=function(U,X){return R.H.useCallback(U,X)},Le.useContext=function(U){return R.H.useContext(U)},Le.useDebugValue=function(){},Le.useDeferredValue=function(U,X){return R.H.useDeferredValue(U,X)},Le.useEffect=function(U,X){return R.H.useEffect(U,X)},Le.useEffectEvent=function(U){return R.H.useEffectEvent(U)},Le.useId=function(){return R.H.useId()},Le.useImperativeHandle=function(U,X,ie){return R.H.useImperativeHandle(U,X,ie)},Le.useInsertionEffect=function(U,X){return R.H.useInsertionEffect(U,X)},Le.useLayoutEffect=function(U,X){return R.H.useLayoutEffect(U,X)},Le.useMemo=function(U,X){return R.H.useMemo(U,X)},Le.useOptimistic=function(U,X){return R.H.useOptimistic(U,X)},Le.useReducer=function(U,X,ie){return R.H.useReducer(U,X,ie)},Le.useRef=function(U){return R.H.useRef(U)},Le.useState=function(U){return R.H.useState(U)},Le.useSyncExternalStore=function(U,X,ie){return R.H.useSyncExternalStore(U,X,ie)},Le.useTransition=function(){return R.H.useTransition()},Le.version="19.2.7",Le}var YN;function oh(){return YN||(YN=1,U1.exports=gee()),U1.exports}var _=oh();const F=ic(_),mee=r8({__proto__:null,default:F},[_]);function vee(e,t={}){const n=_.useRef(e.get()),{keys:r,deps:o=[e,r]}=t,s=_.useCallback(u=>{const c=f=>{n.current!==f&&(n.current=f,u())};return c(e.value),r?.length?pJ(e,r,c):e.listen(c)},o),a=()=>n.current;return _.useSyncExternalStore(s,a,mJ(e)?()=>e.init:a)}function yee(e){return`use${lee(e)}`}function bee(e){const{pluginPathMethods:t,pluginsActions:n,pluginsAtoms:r,hydrateSession:o,$fetch:s,$store:a,atomListeners:u}=iee(e),c={};for(const[f,h]of Object.entries(r))c[yee(f)]=()=>vee(h);return pee({...n,...c,hydrateSession:o,$fetch:s,$store:a},s,t,r,u)}const See=10,Pu=[],wee=["x-correlation-id","x-request-id","x-amzn-requestid","x-amzn-trace-id","apigw-requestid","x-trace-id"];function Cee(e){const t=typeof e=="string"?e:e instanceof URL?e.href:e.url;try{return new URL(t,window.location.origin).pathname}catch{return t.split(/[?#]/)[0]}}function Eee(e,t){return t?.method?t.method.toUpperCase():typeof e!="string"&&!(e instanceof URL)&&e.method?e.method.toUpperCase():"GET"}function _ee(e){for(const t of wee){const n=e.headers.get(t);if(n)return n}}function xee(e){Pu.push(e),Pu.length>See&&Pu.shift()}function QN(e){const{input:t,init:n,response:r,durationMs:o}=e;xee({method:Eee(t,n),path:Cee(t),status:r?.status??0,durationMs:Math.round(o),correlationId:r?_ee(r):void 0,timestamp:new Date().toISOString()})}function Aee(){return Pu.slice()}function Iee(){for(let e=Pu.length-1;e>=0;e--){const t=Pu[e];if(t.status===0||t.status>=400)return t}}class XA extends Error{constructor(t){super(t instanceof Error&&t.message?t.message:"The request could not be completed.",{cause:t}),this.name="NetworkError"}}const Ree=e=>typeof e=="object"&&e!==null&&"name"in e&&e.name==="AbortError",y$=async(e,t)=>{const n=performance.now();try{const r=await fetch(e,{...t,redirect:"manual"}),o=r.type==="opaqueredirect"?new Response(null,{status:401}):r;return QN({input:e,init:t,response:o,durationMs:performance.now()-n}),o}catch(r){throw Ree(r)?r:(QN({input:e,init:t,durationMs:performance.now()-n}),new XA(r))}},JA=()=>{try{return globalThis.sessionStorage??null}catch{return null}},qv=()=>gc().betterAuthEnabled,Tee="EMAIL_PASSWORD_SIGN_UP_DISABLED",Oee=e=>typeof e=="object"&&e!==null&&e.code===Tee,Va=bee(),Mee=60,Pee=30,k_="remit.better-auth.token",Nee=()=>{const e=JA()?.getItem(k_);if(!e)return null;try{const t=JSON.parse(e);if(t&&typeof t=="object"&&typeof t.value=="string"&&typeof t.expiresAt=="number")return{value:t.value,expiresAt:t.expiresAt}}catch{}return null},b$=e=>{const t=JA();if(t)try{if(!e){t.removeItem(k_);return}t.setItem(k_,JSON.stringify(e))}catch{}};let Aa=null,Rm=0;const kee=()=>Aa||(Aa=Nee(),Aa),Pa=()=>Math.floor(Date.now()/1e3),Dee=e=>{const[,t]=e.split(".");if(!t)return Pa();try{const n=JSON.parse(atob(t.replace(/-/g,"+").replace(/_/g,"/")));return typeof n.exp=="number"?n.exp:Pa()}catch{return Pa()}};class Tm extends Error{status;constructor(t,n){super(t),this.name="AuthTokenError",this.status=n}}const Lee=async()=>{const e=await y$("/api/auth/token",{credentials:"include"});if(!e.ok)throw new Tm(`Could not mint a session token: ${e.status} ${e.statusText}`,e.status);const t=await e.json();if(t&&typeof t=="object"&&"token"in t&&typeof t.token=="string")return t.token;throw new Tm("The token endpoint returned no token")};let Cd=null;const Uee=()=>Cd||(Cd=Lee().then(e=>(Aa={value:e,expiresAt:Dee(e)},b$(Aa),Rm=0,e)).finally(()=>{Cd=null}),Cd),$ee=e=>e.expiresAt-Mee>Pa(),XN=e=>e.expiresAt>Pa(),Fee=e=>e instanceof XA?!0:e instanceof Tm?e.status===408||e.status===429||(e.status??0)>=500:!1,zee=e=>e instanceof Tm&&(e.status===401||e.status===403),jee=async()=>{const e=kee();if(e&&$ee(e)||e&&XN(e)&&Pa()<Rm)return e.value;try{return await Uee()}catch(t){if(zee(t))throw eI(),t.status===403&&Va.$store.notify("$sessionSignal"),t;if(e&&XN(e)&&Fee(t))return Rm=Pa()+Pee,e.value;throw t}},eI=()=>{Rm=0,b$(null),Aa=null};const Bee=e=>e?.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();function Hee(e,t,n=[]){if(t==null)throw new Error("[lucide]: iconNode is required when icon name is used");return{name:Bee(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}const qee=e=>{let t="",n=!1;for(const r of e){if(r==="-"||r==="_"||r<=" "){n=t.length>0;continue}t.length===0?t+=r.toLowerCase():t+=n?r.toUpperCase():r,n=!1}return t};const Vee=e=>{const t=qee(e);return t.charAt(0).toUpperCase()+t.slice(1)};const D_=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();const wa={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};function $1(e){return e!=null}function Wee(e,t={}){const n=t.attributeNames??{},r=m=>n[m]??m,o=e.size??e.width??wa.width,s=e.size??e.height??wa.height,a=e.aliases?.filter(m=>typeof m=="string"&&m.trim()!=="").map(m=>`lucide-${m}`)??[],u=[...e.name?[`lucide-${e.name}`]:[],...a],c=t.className?.split(" ").filter(Boolean)??[],f=t.includeDefaultClasses===!1?D_(...c):D_("lucide",...u,...c),h=t.absoluteStrokeWidth?Number(t.strokeWidth??wa["stroke-width"])*Number(e.size??e.width??wa.width)/Number(t.size??t.width??wa.width):t.strokeWidth??wa["stroke-width"];return["svg",{...Object.entries(wa).reduce((m,[v,w])=>(m[r(v)]=w,m),{}),..."color"in t&&t.color&&{[r("stroke")]:t.color},..."size"in t&&$1(t.size)&&{[r("width")]:t.size,[r("height")]:t.size},..."width"in t&&$1(t.width)&&{[r("width")]:t.width},..."height"in t&&$1(t.height)&&{[r("height")]:t.height},[r("stroke-width")]:h,...f&&{[r("class")]:f},[r("viewBox")]:`0 0 ${o} ${s}`,...t.hasA11yProp===!1?{[r("aria-hidden")]:"true"}:{},..."attributes"in t&&t.attributes},e.node.map(m=>{const[v,w,S]=m,C=t.nonScalingStroke?{[r("vector-effect")]:"non-scaling-stroke",...w}:w;return S?[v,C,S]:[v,C]})]}function Gee(e,t={}){return Wee(e,{...t,attributeNames:{...t.attributeNames,class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","vector-effect":"vectorEffect"}})}const Kee=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},Zee=_.createContext({}),Yee=()=>_.useContext(Zee),Qee=_.forwardRef(({color:e,size:t,width:n,height:r,strokeWidth:o,absoluteStrokeWidth:s,nonScalingStroke:a,className:u="",children:c,iconNode:f=[],icon:h={node:f,aliases:[],size:24},...g},m)=>{const{size:v=24,strokeWidth:w=2,absoluteStrokeWidth:S=!1,nonScalingStroke:C=!1,color:E="currentColor",className:A=""}=Yee()??{},I=!!c||Kee(g),[T,N,M=[]]=Gee(h,{color:e??E,width:n??t??v,height:r??t??v,strokeWidth:o??w,absoluteStrokeWidth:s??S,nonScalingStroke:a??C,className:D_(A,u),hasA11yProp:I,attributes:g});return _.createElement(T,{ref:m,...N},[...M.map(([R,k])=>_.createElement(R,k)),...Array.isArray(c)?c:[c]])});function yt(e,t=[],n=[]){const r=typeof e=="string"?Hee(e,t,n):e,o=_.forwardRef(({className:s,...a},u)=>_.createElement(Qee,{ref:u,icon:r,className:s,...a}));return r.name&&(o.displayName=Vee(r.name)),o}const S$={name:"archive",size:24,node:[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]};S$.node;const Xee=yt(S$);const w$={name:"calendar-days",size:24,node:[["path",{d:"M8 2v3",key:"1ioesn"}],["path",{d:"M16 2v3",key:"otl347"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M8 13h.01",key:"1sbv64"}],["path",{d:"M12 13h.01",key:"y0uutt"}],["path",{d:"M16 13h.01",key:"wip0gl"}],["path",{d:"M8 17h.01",key:"p3bg7i"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M16 17h.01",key:"ql8jdd"}]]};w$.node;const Jee=yt(w$);const C$={name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]};C$.node;const E$=yt(C$);const _$={name:"chevron-right",size:24,node:[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]};_$.node;const ete=yt(_$);const x$={name:"circle-alert",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],aliases:["alert-circle"]};x$.node;const A$=yt(x$);const I$={name:"eye",size:24,node:[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]};I$.node;const tte=yt(I$);const R$={name:"eye-off",size:24,node:[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]};R$.node;const nte=yt(R$);const T$={name:"file-text",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]};T$.node;const rte=yt(T$);const O$={name:"folder",size:24,node:[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]};O$.node;const ote=yt(O$);const M$={name:"folder-plus",size:24,node:[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]};M$.node;const ste=yt(M$);const P$={name:"folder-tree",size:24,node:[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]};P$.node;const ite=yt(P$);const N$={name:"funnel",size:24,node:[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],aliases:["filter"]};N$.node;const ate=yt(N$);const k$={name:"inbox",size:24,node:[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]};k$.node;const D$=yt(k$);const L$={name:"info",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]};L$.node;const lte=yt(L$);const U$={name:"loader-circle",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],aliases:["loader-2"]};U$.node;const $$=yt(U$);const F$={name:"log-in",size:24,node:[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]]};F$.node;const JN=yt(F$);const z$={name:"mails",size:24,node:[["path",{d:"M17 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 1-1.732",key:"1vyzll"}],["path",{d:"m22 5.5-6.419 4.179a2 2 0 0 1-2.162 0L7 5.5",key:"k7ramc"}],["rect",{x:"7",y:"3",width:"15",height:"12",rx:"2",key:"17196g"}]]};z$.node;const ute=yt(z$);const j$={name:"octagon-alert",size:24,node:[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]],aliases:["alert-octagon"]};j$.node;const tI=yt(j$);const B$={name:"palette",size:24,node:[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]]};B$.node;const cte=yt(B$);const H$={name:"search",size:24,node:[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]};H$.node;const dte=yt(H$);const q$={name:"send",size:24,node:[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]};q$.node;const fte=yt(q$);const V$={name:"sparkles",size:24,node:[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],aliases:["stars"]};V$.node;const hte=yt(V$);const W$={name:"star",size:24,node:[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]};W$.node;const pte=yt(W$);const G$={name:"tag",size:24,node:[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]};G$.node;const gte=yt(G$);const K$={name:"trash",size:24,node:[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],aliases:["trash-2"]};K$.node;const mte=yt(K$);const Z$={name:"triangle-alert",size:24,node:[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["alert-triangle"]};Z$.node;const nI=yt(Z$);const Y$={name:"user-cog",size:24,node:[["path",{d:"M10 15H6a4 4 0 0 0-4 4v2",key:"1nfge6"}],["path",{d:"m14.305 16.53.923-.382",key:"1itpsq"}],["path",{d:"m15.228 13.852-.923-.383",key:"eplpkm"}],["path",{d:"m16.852 12.228-.383-.923",key:"13v3q0"}],["path",{d:"m16.852 17.772-.383.924",key:"1i8mnm"}],["path",{d:"m19.148 12.228.383-.923",key:"1q8j1v"}],["path",{d:"m19.53 18.696-.382-.924",key:"vk1qj3"}],["path",{d:"m20.772 13.852.924-.383",key:"n880s0"}],["path",{d:"m20.772 16.148.924.383",key:"1g6xey"}],["circle",{cx:"18",cy:"15",r:"3",key:"gjjjvw"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]};Y$.node;const vte=yt(Y$);const Q$={name:"users",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]};Q$.node;const yte=yt(Q$);const X$={name:"wrench",size:24,node:[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]};X$.node;const bte=yt(X$);const J$={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]};J$.node;const L_=yt(J$);function eF(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=eF(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Ste(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=eF(e))&&(r&&(r+=" "),r+=t);return r}const rI="-",wte=e=>{const t=Ete(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:a=>{const u=a.split(rI);return u[0]===""&&u.length!==1&&u.shift(),tF(u,t)||Cte(a)},getConflictingClassGroupIds:(a,u)=>{const c=n[a]||[];return u&&r[a]?[...c,...r[a]]:c}}},tF=(e,t)=>{if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?tF(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const s=e.join(rI);return t.validators.find(({validator:a})=>a(s))?.classGroupId},ek=/^\[(.+)\]$/,Cte=e=>{if(ek.test(e)){const t=ek.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},Ete=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return xte(Object.entries(e.classGroups),n).forEach(([s,a])=>{U_(a,r,s,t)}),r},U_=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const s=o===""?t:tk(t,o);s.classGroupId=n;return}if(typeof o=="function"){if(_te(o)){U_(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([s,a])=>{U_(a,tk(t,s),n,r)})})},tk=(e,t)=>{let n=e;return t.split(rI).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},_te=e=>e.isThemeGetter,xte=(e,t)=>t?e.map(([n,r])=>{const o=r.map(s=>typeof s=="string"?t+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([a,u])=>[t+a,u])):s);return[n,o]}):e,Ate=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(s,a)=>{n.set(s,a),t++,t>e&&(t=0,r=n,n=new Map)};return{get(s){let a=n.get(s);if(a!==void 0)return a;if((a=r.get(s))!==void 0)return o(s,a),a},set(s,a){n.has(s)?n.set(s,a):o(s,a)}}},nF="!",Ite=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,o=t[0],s=t.length,a=u=>{const c=[];let f=0,h=0,g;for(let C=0;C<u.length;C++){let E=u[C];if(f===0){if(E===o&&(r||u.slice(C,C+s)===t)){c.push(u.slice(h,C)),h=C+s;continue}if(E==="/"){g=C;continue}}E==="["?f++:E==="]"&&f--}const m=c.length===0?u:u.substring(h),v=m.startsWith(nF),w=v?m.substring(1):m,S=g&&g>h?g-h:void 0;return{modifiers:c,hasImportantModifier:v,baseClassName:w,maybePostfixModifierPosition:S}};return n?u=>n({className:u,parseClassName:a}):a},Rte=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},Tte=e=>({cache:Ate(e.cacheSize),parseClassName:Ite(e),...wte(e)}),Ote=/\s+/,Mte=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,s=[],a=e.trim().split(Ote);let u="";for(let c=a.length-1;c>=0;c-=1){const f=a[c],{modifiers:h,hasImportantModifier:g,baseClassName:m,maybePostfixModifierPosition:v}=n(f);let w=!!v,S=r(w?m.substring(0,v):m);if(!S){if(!w){u=f+(u.length>0?" "+u:u);continue}if(S=r(m),!S){u=f+(u.length>0?" "+u:u);continue}w=!1}const C=Rte(h).join(":"),E=g?C+nF:C,A=E+S;if(s.includes(A))continue;s.push(A);const I=o(S,w);for(let T=0;T<I.length;++T){const N=I[T];s.push(E+N)}u=f+(u.length>0?" "+u:u)}return u};function Pte(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=rF(t))&&(r&&(r+=" "),r+=n);return r}const rF=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=rF(e[r]))&&(n&&(n+=" "),n+=t);return n};function Nte(e,...t){let n,r,o,s=a;function a(c){const f=t.reduce((h,g)=>g(h),e());return n=Tte(f),r=n.cache.get,o=n.cache.set,s=u,u(c)}function u(c){const f=r(c);if(f)return f;const h=Mte(c,n);return o(c,h),h}return function(){return s(Pte.apply(null,arguments))}}const Lt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},oF=/^\[(?:([a-z-]+):)?(.+)\]$/i,kte=/^\d+\/\d+$/,Dte=new Set(["px","full","screen"]),Lte=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ute=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,$te=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Fte=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,zte=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ms=e=>Nu(e)||Dte.has(e)||kte.test(e),bi=e=>mc(e,"length",Kte),Nu=e=>!!e&&!Number.isNaN(Number(e)),F1=e=>mc(e,"number",Nu),Ed=e=>!!e&&Number.isInteger(Number(e)),jte=e=>e.endsWith("%")&&Nu(e.slice(0,-1)),je=e=>oF.test(e),Si=e=>Lte.test(e),Bte=new Set(["length","size","percentage"]),Hte=e=>mc(e,Bte,sF),qte=e=>mc(e,"position",sF),Vte=new Set(["image","url"]),Wte=e=>mc(e,Vte,Yte),Gte=e=>mc(e,"",Zte),_d=()=>!0,mc=(e,t,n)=>{const r=oF.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},Kte=e=>Ute.test(e)&&!$te.test(e),sF=()=>!1,Zte=e=>Fte.test(e),Yte=e=>zte.test(e),Qte=()=>{const e=Lt("colors"),t=Lt("spacing"),n=Lt("blur"),r=Lt("brightness"),o=Lt("borderColor"),s=Lt("borderRadius"),a=Lt("borderSpacing"),u=Lt("borderWidth"),c=Lt("contrast"),f=Lt("grayscale"),h=Lt("hueRotate"),g=Lt("invert"),m=Lt("gap"),v=Lt("gradientColorStops"),w=Lt("gradientColorStopPositions"),S=Lt("inset"),C=Lt("margin"),E=Lt("opacity"),A=Lt("padding"),I=Lt("saturate"),T=Lt("scale"),N=Lt("sepia"),M=Lt("skew"),R=Lt("space"),k=Lt("translate"),L=()=>["auto","contain","none"],q=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto",je,t],D=()=>[je,t],j=()=>["",ms,bi],Z=()=>["auto",Nu,je],he=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],B=()=>["solid","dashed","dotted","double","none"],Q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ae=()=>["start","end","center","between","around","evenly","stretch"],ue=()=>["","0",je],we=()=>["auto","avoid","all","avoid-page","page","left","right","column"],U=()=>[Nu,je];return{cacheSize:500,separator:":",theme:{colors:[_d],spacing:[ms,bi],blur:["none","",Si,je],brightness:U(),borderColor:[e],borderRadius:["none","","full",Si,je],borderSpacing:D(),borderWidth:j(),contrast:U(),grayscale:ue(),hueRotate:U(),invert:ue(),gap:D(),gradientColorStops:[e],gradientColorStopPositions:[jte,bi],inset:$(),margin:$(),opacity:U(),padding:D(),saturate:U(),scale:U(),sepia:ue(),skew:U(),space:D(),translate:D()},classGroups:{aspect:[{aspect:["auto","square","video",je]}],container:["container"],columns:[{columns:[Si]}],"break-after":[{"break-after":we()}],"break-before":[{"break-before":we()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...he(),je]}],overflow:[{overflow:q()}],"overflow-x":[{"overflow-x":q()}],"overflow-y":[{"overflow-y":q()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[S]}],"inset-x":[{"inset-x":[S]}],"inset-y":[{"inset-y":[S]}],start:[{start:[S]}],end:[{end:[S]}],top:[{top:[S]}],right:[{right:[S]}],bottom:[{bottom:[S]}],left:[{left:[S]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ed,je]}],basis:[{basis:$()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",je]}],grow:[{grow:ue()}],shrink:[{shrink:ue()}],order:[{order:["first","last","none",Ed,je]}],"grid-cols":[{"grid-cols":[_d]}],"col-start-end":[{col:["auto",{span:["full",Ed,je]},je]}],"col-start":[{"col-start":Z()}],"col-end":[{"col-end":Z()}],"grid-rows":[{"grid-rows":[_d]}],"row-start-end":[{row:["auto",{span:[Ed,je]},je]}],"row-start":[{"row-start":Z()}],"row-end":[{"row-end":Z()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",je]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",je]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal",...ae()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ae(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ae(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[A]}],px:[{px:[A]}],py:[{py:[A]}],ps:[{ps:[A]}],pe:[{pe:[A]}],pt:[{pt:[A]}],pr:[{pr:[A]}],pb:[{pb:[A]}],pl:[{pl:[A]}],m:[{m:[C]}],mx:[{mx:[C]}],my:[{my:[C]}],ms:[{ms:[C]}],me:[{me:[C]}],mt:[{mt:[C]}],mr:[{mr:[C]}],mb:[{mb:[C]}],ml:[{ml:[C]}],"space-x":[{"space-x":[R]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[R]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",je,t]}],"min-w":[{"min-w":[je,t,"min","max","fit"]}],"max-w":[{"max-w":[je,t,"none","full","min","max","fit","prose",{screen:[Si]},Si]}],h:[{h:[je,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[je,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[je,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[je,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Si,bi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",F1]}],"font-family":[{font:[_d]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",je]}],"line-clamp":[{"line-clamp":["none",Nu,F1]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ms,je]}],"list-image":[{"list-image":["none",je]}],"list-style-type":[{list:["none","disc","decimal",je]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[E]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[E]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...B(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",ms,bi]}],"underline-offset":[{"underline-offset":["auto",ms,je]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:D()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",je]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",je]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[E]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...he(),qte]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Hte]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Wte]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[w]}],"gradient-via-pos":[{via:[w]}],"gradient-to-pos":[{to:[w]}],"gradient-from":[{from:[v]}],"gradient-via":[{via:[v]}],"gradient-to":[{to:[v]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[u]}],"border-w-x":[{"border-x":[u]}],"border-w-y":[{"border-y":[u]}],"border-w-s":[{"border-s":[u]}],"border-w-e":[{"border-e":[u]}],"border-w-t":[{"border-t":[u]}],"border-w-r":[{"border-r":[u]}],"border-w-b":[{"border-b":[u]}],"border-w-l":[{"border-l":[u]}],"border-opacity":[{"border-opacity":[E]}],"border-style":[{border:[...B(),"hidden"]}],"divide-x":[{"divide-x":[u]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[u]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[E]}],"divide-style":[{divide:B()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...B()]}],"outline-offset":[{"outline-offset":[ms,je]}],"outline-w":[{outline:[ms,bi]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:j()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[E]}],"ring-offset-w":[{"ring-offset":[ms,bi]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Si,Gte]}],"shadow-color":[{shadow:[_d]}],opacity:[{opacity:[E]}],"mix-blend":[{"mix-blend":[...Q(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Q()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",Si,je]}],grayscale:[{grayscale:[f]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[g]}],saturate:[{saturate:[I]}],sepia:[{sepia:[N]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[f]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h]}],"backdrop-invert":[{"backdrop-invert":[g]}],"backdrop-opacity":[{"backdrop-opacity":[E]}],"backdrop-saturate":[{"backdrop-saturate":[I]}],"backdrop-sepia":[{"backdrop-sepia":[N]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",je]}],duration:[{duration:U()}],ease:[{ease:["linear","in","out","in-out",je]}],delay:[{delay:U()}],animate:[{animate:["none","spin","ping","pulse","bounce",je]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[T]}],"scale-x":[{"scale-x":[T]}],"scale-y":[{"scale-y":[T]}],rotate:[{rotate:[Ed,je]}],"translate-x":[{"translate-x":[k]}],"translate-y":[{"translate-y":[k]}],"skew-x":[{"skew-x":[M]}],"skew-y":[{"skew-y":[M]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",je]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",je]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-mt":[{"scroll-mt":D()}],"scroll-mr":[{"scroll-mr":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-pe":[{"scroll-pe":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-pr":[{"scroll-pr":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",je]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[ms,bi,F1]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},Xte=Nte(Qte);function rn(...e){return Xte(Ste(e))}var z1={exports:{}},Fn={};var nk;function Jte(){if(nk)return Fn;nk=1;var e=oh();function t(c){var f="https://react.dev/errors/"+c;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)f+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+c+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},o=Symbol.for("react.portal");function s(c,f,h){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:g==null?null:""+g,children:c,containerInfo:f,implementation:h}}var a=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(c,f){if(c==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return Fn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Fn.createPortal=function(c,f){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(t(299));return s(c,f,null,h)},Fn.flushSync=function(c){var f=a.T,h=r.p;try{if(a.T=null,r.p=2,c)return c()}finally{a.T=f,r.p=h,r.d.f()}},Fn.preconnect=function(c,f){typeof c=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,r.d.C(c,f))},Fn.prefetchDNS=function(c){typeof c=="string"&&r.d.D(c)},Fn.preinit=function(c,f){if(typeof c=="string"&&f&&typeof f.as=="string"){var h=f.as,g=u(h,f.crossOrigin),m=typeof f.integrity=="string"?f.integrity:void 0,v=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;h==="style"?r.d.S(c,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:g,integrity:m,fetchPriority:v}):h==="script"&&r.d.X(c,{crossOrigin:g,integrity:m,fetchPriority:v,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},Fn.preinitModule=function(c,f){if(typeof c=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var h=u(f.as,f.crossOrigin);r.d.M(c,{crossOrigin:h,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&r.d.M(c)},Fn.preload=function(c,f){if(typeof c=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var h=f.as,g=u(h,f.crossOrigin);r.d.L(c,h,{crossOrigin:g,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},Fn.preloadModule=function(c,f){if(typeof c=="string")if(f){var h=u(f.as,f.crossOrigin);r.d.m(c,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:h,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else r.d.m(c)},Fn.requestFormReset=function(c){r.d.r(c)},Fn.unstable_batchedUpdates=function(c,f){return c(f)},Fn.useFormState=function(c,f,h){return a.H.useFormState(c,f,h)},Fn.useFormStatus=function(){return a.H.useHostTransitionStatus()},Fn.version="19.2.7",Fn}var rk;function iF(){if(rk)return z1.exports;rk=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),z1.exports=Jte(),z1.exports}var ene=iF();const xd={action:null,nextPrefix:null,preventDefault:!1},tne={b:"goBrief",i:"goInbox",s:"goSent",f:"goFlagged",",":"goSettings"},nne={j:{action:"focusNext"},k:{action:"focusPrevious"},arrowdown:{action:"focusNext"},arrowup:{action:"focusPrevious"},home:{action:"focusFirst"},end:{action:"focusLast"},enter:{action:"openFocused"}," ":{action:"toggleSelect"},delete:{action:"delete"},backspace:{action:"delete"},u:{action:"toggleRead"},x:{action:"toggleSelect"},r:{action:"reply"},a:{action:"replyAll"},f:{action:"forward"},"#":{action:"delete"},s:{action:"toggleStar"},m:{action:"muteSender"},b:{action:"blockSender"},v:{action:"vipSender"},"!":{action:"markJunk"},i:{action:"toggleIntelligence"},d:{action:"toggleDensity"},"/":{action:"focusSearch"},c:{action:"compose"},"?":{action:"help"}};function rne(e,t){const n=e.key.toLowerCase(),r=e.metaKey||e.ctrlKey;if(e.inEditable)return{...xd,nextPrefix:t==="g"?null:t};if(e.onControl&&(n==="enter"||n===" "))return{...xd,nextPrefix:t==="g"?null:t};if(r&&n==="n")return{action:"compose",nextPrefix:null,preventDefault:!0};if(r&&n==="a")return{action:"selectAll",nextPrefix:null,preventDefault:!0};if(r)return{...xd,nextPrefix:t==="g"?null:t};if(n==="escape")return{action:"back",nextPrefix:null,preventDefault:!1};if(t==="g"){const a=tne[n===","?",":n]??null;return{action:a,nextPrefix:null,preventDefault:a!==null}}if(n==="g"&&!e.shiftKey)return{action:null,nextPrefix:"g",preventDefault:!0};if(e.shiftKey){const s=n==="j"||n==="arrowdown";if(s||(n==="k"||n==="arrowup"))return{action:s?"extendSelectDown":"extendSelectUp",nextPrefix:null,preventDefault:!0}}const o=nne[n];if(o){const s=o.requireShift===!0,a=n.length===1&&!/[a-z0-9]/.test(n);return!s&&e.shiftKey&&!a?xd:{action:o.action,nextPrefix:null,preventDefault:!0}}return xd}function one(e){if(!(e instanceof HTMLElement))return!1;const t=e.tagName;return t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable}const sne="data-message-row",ine='button, a[href], summary, [role="button"], [role="menuitem"], [role="tab"], [role="switch"], [role="checkbox"]';function ane(e){if(!(e instanceof HTMLElement))return!1;const t=e.closest(ine);return t?!t.hasAttribute(sne):!1}const lne=["reply","replyAll","forward","delete","toggleStar","toggleRead","muteSender","blockSender","vipSender","markJunk"],une=["focusNext","focusPrevious","focusFirst","focusLast","openFocused","toggleSelect","extendSelectDown","extendSelectUp","selectAll","toggleDensity"],Cn=(e,...t)=>({action:e,requires:t});Cn("help"),Cn("goBrief",{listIsNot:"brief"}),Cn("goFlagged",{listIsNot:"flagged"}),Cn("goInbox",{listIsNot:"inbox"}),Cn("goSent",{listIsNot:"sent"}),Cn("goSettings"),Cn("compose"),Cn("focusSearch"),Cn("toggleIntelligence"),[...une.map(e=>Cn(e,"listVisible")),...lne.map(e=>Cn(e,"aimed")),Cn("back","selection")],Cn("focusNext","threadOpen",{not:"listVisible"}),Cn("focusPrevious","threadOpen",{not:"listVisible"}),Cn("reply","threadOpen"),Cn("replyAll","threadOpen"),Cn("forward","threadOpen"),Cn("back");function cne(e,t){const n=t.at(-1);return n?n.handles.includes(e)?{outcome:"act",target:{kind:"overlay",frame:n}}:{outcome:"contained",by:{kind:"overlay",frame:n}}:null}const dne="[data-escape-owner]";let ju=[],fne=0;const hne=()=>++fne;function aF(){const[e]=_.useState(hne);return e}const pne=(e,t)=>e.depth-t.depth;function gne(){return[...ju].sort(pne).map(e=>({id:e.id,handles:Object.entries(e.run()).filter(([,t])=>t).map(([t])=>t)}))}function mne(){let e;for(const t of ju)(!e||t.depth>e.depth)&&(e=t);return e}function e6e(e){return cne(e,gne())}function vne(e){if(e.key==="Escape"){const t=document.activeElement;return t instanceof Element&&t.closest(dne)?null:"back"}return rne({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,inEditable:one(e.target),onControl:ane(e.target)},null).action}function ok(e){const t=mne();if(!t)return;const n=vne(e);if(!n)return;const r=t.run()[n];r&&(e.preventDefault(),e.stopImmediatePropagation(),r())}function sk(e){const t=ju.length===0;if(ju=e,t!==(e.length===0)){if(e.length>0){window.addEventListener("keydown",ok,!0);return}window.removeEventListener("keydown",ok,!0)}}function Vv({id:e,open:t,answers:n={}}){const r=_.useRef(n);r.current=n;const o=aF();_.useEffect(()=>{if(!t)return;const s={id:e,depth:o,run:()=>r.current};return sk([...ju,s]),()=>{sk(ju.filter(a=>a!==s))}},[e,t,o])}const lF="inline-flex items-center justify-center gap-2 rounded-md font-medium whitespace-nowrap transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface disabled:opacity-50 disabled:pointer-events-none",uF={primary:"bg-accent text-accent-fg hover:bg-accent-hover",secondary:"bg-surface text-fg border border-line hover:bg-surface-sunken hover:border-line-strong",ghost:"text-fg-muted hover:bg-surface-sunken hover:text-fg",danger:"bg-danger text-accent-fg hover:opacity-90"},cF={sm:"h-7 px-2.5 text-xs",md:"h-9 px-3.5 text-sm",touch:"h-11 w-11 text-sm"};function Xr({variant:e="primary",size:t="md",icon:n,className:r,children:o,ref:s,...a}){return O.jsxs("button",{type:"button",ref:s,className:rn(lF,uF[e],cF[t],r),...a,children:[n,o]})}function t6e({variant:e="primary",size:t="md",icon:n,external:r,className:o,children:s,...a}){return O.jsxs("a",{className:rn(lF,uF[e],cF[t],o),...r?{target:"_blank",rel:"noopener noreferrer"}:{},...a,children:[n,s]})}const yne='a[href], button, input, select, textarea, iframe, [tabindex], [contenteditable]:not([contenteditable="false"])';function bne(e){if(Number(e.getAttribute("tabindex")??0)<0||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"||e.closest("[inert], [hidden], [aria-hidden='true']"))return!1;const t=getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}function ik(e){const t=e.querySelectorAll('[role="dialog"][aria-modal="true"]');return[...(t[t.length-1]??e).querySelectorAll(yne)].filter(bne)}const $_=new Set;function Sne(e){for(const t of $_)if(t>e)return!1;return!0}function wne(e,t){return!(t instanceof HTMLElement)||t===document.body||t===document.documentElement?!1:!e.contains(t)}function Wv(e,t){const n=aF();_.useEffect(()=>{if(t)return $_.add(n),()=>{$_.delete(n)}},[t,n]),_.useEffect(()=>{if(!t)return;const r=document.activeElement instanceof HTMLElement?document.activeElement:null,o=e.current;return o&&(ik(o)[0]??o).focus(),()=>{r?.isConnected&&r.focus()}},[t,e]),_.useEffect(()=>{if(!t)return;const r=o=>{if(o.key!=="Tab"||o.defaultPrevented||!Sne(n))return;const s=e.current;if(!s)return;const a=document.activeElement;if(wne(s,a))return;const u=ik(s),c=u[0],f=u.at(-1);if(!c||!f){o.preventDefault(),s.focus();return}const h=a instanceof HTMLElement&&u.includes(a);if(o.shiftKey){(!h||a===c)&&(o.preventDefault(),f.focus());return}(!h||a===f)&&(o.preventDefault(),c.focus())};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[t,e,n])}const Cne=({label:e,onDismiss:t,className:n})=>O.jsx("button",{type:"button","aria-label":e,tabIndex:-1,onClick:t,className:rn("absolute inset-0 bg-canvas/80",n)}),Ene={info:"bg-accent-2/15 text-accent-2 border-accent-2/40",success:"bg-positive/15 text-positive border-positive/40",warning:"bg-warning/15 text-warning border-warning/40",danger:"bg-danger/15 text-danger border-danger/40"},_ne={info:"bg-surface-sunken text-fg-muted",success:"bg-positive/10 text-positive",warning:"bg-warning/10 text-warning",danger:"bg-danger-soft text-danger"},xne={info:"status",success:"status",warning:"alert",danger:"alert"};function Zr({tone:e="info",variant:t="framed",onDismiss:n,role:r,className:o,children:s,...a}){const u=t==="soft";return O.jsxs("div",{role:r??xne[e],className:rn("flex gap-2 px-3 py-2 text-sm",u?rn("items-start rounded-md",_ne[e]):rn("items-center border",Ene[e]),o),...a,children:[O.jsx("div",{className:"flex-1 min-w-0",children:s}),n&&(u?O.jsx(Xr,{variant:"ghost",size:"sm",icon:O.jsx(L_,{className:"size-3.5"}),onClick:n,"aria-label":"Dismiss",className:"-mr-1 shrink-0"}):O.jsx("button",{type:"button",onClick:n,"aria-label":"Dismiss",className:"shrink-0 rounded-md p-1 hover:bg-fg/10 transition-colors",children:O.jsx(L_,{className:"size-4","aria-hidden":"true"})}))]})}function ak({open:e,onClose:t,title:n,children:r,className:o,anchor:s="center"}){const a=_.useRef(null);if(Vv({id:"dialog",open:e,answers:{back:t}}),Wv(a,e),!e)return null;const u=s==="left",c=s==="right";return O.jsxs("div",{className:rn("fixed inset-0 z-50 flex",u?"items-stretch justify-start":c?"items-stretch justify-end":"items-center justify-center px-4"),children:[O.jsx(Cne,{label:"Dismiss dialog",onDismiss:t}),O.jsxs("div",{ref:a,role:"dialog","aria-modal":"true","aria-labelledby":"dialog-title",tabIndex:-1,className:rn("relative z-10 overflow-hidden border-line bg-surface shadow-xl",u?"safe-area-frame h-full w-72 max-w-[85vw] border-r":c?"safe-area-frame h-full w-[80vw] max-w-[320px] border-l":"w-full max-w-lg rounded-md border",o),children:[O.jsx("h2",{id:"dialog-title",className:"sr-only",children:n}),r]})]})}function dF({children:e,label:t}){return O.jsxs("span",{className:"relative inline-flex",children:[e,t!==void 0&&O.jsxs(O.Fragment,{children:[O.jsx("span",{"data-testid":"attention-dot",className:"absolute -right-1 -top-1 size-2 rounded-full bg-accent-2"}),O.jsx("span",{className:"sr-only",children:t})]})]})}function Gv({children:e,className:t}){return O.jsx("div",{"data-auth-page":!0,className:rn("flex min-h-dvh w-full flex-col items-center justify-center overflow-y-auto bg-surface-sunken pb-[max(2rem,env(safe-area-inset-bottom,0px))] pl-[max(1rem,env(safe-area-inset-left,0px))] pr-[max(1rem,env(safe-area-inset-right,0px))] pt-[max(2rem,env(safe-area-inset-top,0px))] text-fg",t),style:{backgroundImage:"radial-gradient(at 20% 0%, color-mix(in oklch, var(--accent) 8%, transparent) 0px, transparent 50%), radial-gradient(at 80% 100%, color-mix(in oklch, var(--accent) 8%, transparent) 0px, transparent 50%)"},children:O.jsx("div",{className:"w-full max-w-[26rem]",children:e})})}const Ane="Secure sign-in powered by AWS Cognito";function oI(e){const t=e?.note??"Secure sign-in";return O.jsx("div",{className:"text-center pt-5",children:O.jsx("p",{className:"text-xs text-fg-muted",children:t})})}const Ine=()=>O.jsxs("svg",{width:"36",height:"36",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:"text-accent",children:[O.jsx("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),O.jsx("path",{d:"M3 7l9 6 9-6"})]});function Kv({wordmark:e="remit,",tagline:t="your email client in the cloud.",mark:n=O.jsx(Ine,{})}){return O.jsxs("div",{className:"text-center pb-6",children:[O.jsx("div",{className:"flex items-center justify-center pb-3",children:n}),O.jsx("h1",{className:"text-[1.75rem] font-semibold tracking-[-0.01em] text-fg",children:e}),O.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:t})]})}const Rne={default:rn("flex h-9 items-center gap-2 rounded-md border border-line bg-surface-sunken px-3 text-sm","focus-within:border-line-strong focus-within:ring-2 focus-within:ring-ring/30 transition-colors"),inline:"flex items-center gap-2 bg-transparent text-sm"};function Sf({icon:e,className:t,variant:n="default",trailing:r,ref:o,...s}){return O.jsxs("div",{className:rn(Rne[n],t),children:[e&&O.jsx("span",{className:"text-fg-subtle shrink-0",children:e}),O.jsx("input",{ref:o,className:"min-w-0 flex-1 bg-transparent text-fg placeholder:text-fg-subtle outline-none",...s}),r]})}const Tne={error:{container:"border-danger/50 bg-danger-soft",icon:"text-danger",title:"text-danger"},warning:{container:"border-warning/50 bg-warning-soft",icon:"text-warning",title:"text-warning"},info:{container:"border-accent-2/50 bg-accent-2-soft",icon:"text-accent-2",title:"text-accent-2"}},One={error:A$,warning:nI,info:lte},Mne={error:"Error",warning:"Warning",info:"Information"},Pne=({id:e,severity:t,title:n,detail:r,action:o,onDismiss:s})=>{const a=Tne[t],u=One[t];return O.jsxs("div",{role:t==="error"?"alert":"status","aria-live":t==="error"?"assertive":"polite",className:rn("pointer-events-auto flex items-start gap-3 rounded-md border bg-canvas px-3 py-2 shadow-lg",a.container),children:[O.jsx(u,{className:rn("size-5 shrink-0 mt-0.5",a.icon),"aria-hidden":"true"}),O.jsxs("div",{className:"flex-1 min-w-0",children:[O.jsx("p",{className:rn("text-sm font-medium",a.title),children:n}),r&&O.jsx("p",{className:"mt-0.5 text-xs text-fg-muted break-words",children:r}),o&&O.jsx("a",{href:o.href,target:"_blank",rel:"noopener noreferrer",className:"mt-1 inline-block text-xs font-medium text-accent-2 underline underline-offset-2",children:o.label})]}),O.jsx("button",{type:"button",onClick:()=>s(e),className:"shrink-0 rounded-md p-1 text-fg-muted hover:bg-surface-raised hover:text-fg transition-colors","aria-label":`Dismiss ${Mne[t].toLowerCase()}`,children:O.jsx(L_,{className:"size-4","aria-hidden":"true"})})]})},Nne=({errors:e,onDismiss:t})=>e.length===0?null:O.jsx("section",{"aria-label":"Notifications",className:"pointer-events-none fixed inset-x-0 top-0 z-[60] flex flex-col items-center gap-2 px-4 pt-[calc(1rem+env(safe-area-inset-top,0px))] sm:items-end sm:pr-6",children:O.jsx("div",{className:"flex w-full max-w-md flex-col gap-2",children:e.map(n=>O.jsx(Pne,{id:n.id,severity:n.severity,title:n.title,detail:n.detail,action:n.action,onDismiss:t},n.id))})});function kne({className:e,children:t,...n}){return O.jsx("label",{className:rn("mb-1 block text-xs font-medium text-fg-muted",e),...n,children:t})}const Dne="Matches on what the messages say about themselves — sender, subject, list. No reading involved.",Lne={From:"From",Subject:"Subject",HasWords:"Has the words",ListId:"List",FromDomain:"Domain"};function Une(e){return Lne[e]}const $ne={ListId:"The mailing list's List-Id header, matched exactly. New mail is matched as it arrives — mail delivered before this was set up may not carry it yet.",FromDomain:"The sender's registrable domain — matches anyone at it, subdomains included (a look-alike like example.com.evil.test never matches)."};function n6e(e){return $ne[e]}function Fne(e){return e==="HasWords"}function fF(e){return e.clauses.length>0}function hF(e){return e.clauses.filter(t=>Fne(t.field))}const r6e=["From","Subject","HasWords","ListId","FromDomain"],zne={all:"Match all",any:"Match any"};function o6e(e){return zne[e]}function jne(e){return e==="all"?"and":"or"}function s6e(e){if(e.status==="loading")return"Counting matches…";if(e.status==="error")return e.reason;if(e.count===0)return"No mail matches yet";const t=e.count===1?"message":"messages",n=`${e.count} ${t} match`;return e.stale?`${n} — recounting`:n}const Bne={once:"Just once",standing:"Keep doing this",until:"Until a date"};function i6e(e){return Bne[e]}function a6e(e){return e==="once"?"Apply now":e==="standing"?"Save rule":"Save until then"}const Gr={noMatch:"Add a clause so the rule has something to match.",bodyTextOnce:"Applying once can't read message bodies. Save this as a rule instead, or drop the “has the words” clause.",noAction:"Pick a folder to move into, or a label to apply.",unnamed:"Name this rule so you can find it later.",noUntilDate:"Pick the date this rule should stop on.",counting:"Counting matches — save once the count settles.",recounting:"Recounting matches — save once the count settles."},l6e="Can't count matches — “has the words” reads message bodies, which only a saved rule does.";function pF(e){if(e.status==="loading")return Gr.counting;if(e.status==="ready"&&e.stale)return Gr.recounting}function u6e(e,t){return fF(e)?e.scope==="once"&&hF(e).length>0?Gr.bodyTextOnce:!e.moveMailboxId&&!e.labelId?Gr.noAction:(e.scope==="standing"||e.scope==="until")&&(e.name??"").trim()===""?Gr.unnamed:e.scope==="until"&&!e.until?Gr.noUntilDate:pF(t):Gr.noMatch}const sI=(e,t)=>t.length===0?[e]:e.split(t),Hne=(e,t)=>{const n=sI(e,t);return n[n.length-1]||e},wf=(e,t)=>{if(t.length===0)return"";const n=e.lastIndexOf(t);return n===-1?"":e.slice(0,n)},gF=(e,t)=>sI(e,t).length-1,Cf=(e,t)=>{const n=[];let r=e,o=wf(r,t);for(;o&&o.length<r.length;)n.push(o),r=o,o=wf(r,t);return n},qne=(e,t)=>{const n=new Set(e.map(a=>a.path)),r=new Set,o=[],s=a=>{if(!r.has(a.path)){r.add(a.path),o.push(a);for(const u of e)wf(u.path,t)===a.path&&s(u)}};for(const a of e){const u=wf(a.path,t);u&&n.has(u)||s(a)}return o},mF=(e,t)=>e.label.toLowerCase().includes(t)||e.path.toLowerCase().includes(t),Vne=(e,t,n)=>{const r=new Set;if(!t)return r;for(const o of e)if(mF(o,t))for(const s of Cf(o.path,n))r.add(s);return r},Wne=(e,t,n,r=new Set)=>{const o=(u,c)=>({folder:u,depth:gF(u.path,n),context:c,expanded:r.has(u.path)});if(!t)return e.map(u=>o(u,!1));const s=new Set;for(const u of e)mF(u,t)&&s.add(u.path);const a=new Set(s);for(const u of s)for(const c of Cf(u,n))a.add(c);return e.filter(u=>a.has(u.path)).map(u=>o(u,!s.has(u.path)))},Gne=(e,t,n)=>{const r=new Set(e.map(o=>o.path));return e.filter(o=>Cf(o.path,n).every(s=>!r.has(s)||t.has(s))).map(o=>({folder:o,depth:gF(o.path,n),context:!1,expanded:t.has(o.path)}))},Kne=(e,t)=>{if(t.length===0)return e.map((s,a)=>({kind:"folder",row:s,index:a}));const n=[],r=[],o=s=>{for(;r.length>0;){const a=r[r.length-1];if(!a||s?.startsWith(`${a.folder.path}${t}`))break;r.pop(),n.push({kind:"create",parent:a.folder,depth:a.depth+1})}};return e.forEach((s,a)=>{o(s.folder.path),n.push({kind:"folder",row:s,index:a}),s.expanded&&r.push(s)}),o(null),n},Zne=e=>typeof e=="object"&&e!==null&&"name"in e&&e.name==="AbortError",Do=e=>e!==void 0&&!e.context,j1=e=>e!==void 0&&!e.folder.isCurrent&&!e.context,B1=e=>{for(let t=0;t<e.length;t+=1)if(Do(e[t]))return t;return-1},Yne=e=>{for(let t=e.length-1;t>=0;t-=1)if(Do(e[t]))return t;return-1},lk=(e,t,n)=>{const r=e.length;if(r<=0)return-1;const o=t<0?n===1?-1:r:t;for(let s=1;s<=r;s+=1){const a=((o+n*s)%r+r)%r;if(Do(e[a]))return a}return-1},Qne=(e,t,n)=>{const r=e[t];if(!r)return-1;const o=wf(r.folder.path,n);if(!o)return-1;for(let s=t-1;s>=0;s-=1)if(e[s]?.folder.path===o)return Do(e[s])?s:-1;return-1},F_="flex min-h-11 min-w-0 flex-1 items-center gap-2 px-3 py-2.5 text-left text-sm transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",vF=14,Xne=60,z_=({depth:e})=>e>0?O.jsx("span",{"aria-hidden":"true",className:"shrink-0",style:{width:e*vF}}):null,j_=({depth:e})=>O.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute right-0 bottom-0 h-px bg-line",style:{left:Xne+e*vF}}),Jne=({label:e,depth:t,expanded:n,ariaLabel:r,selected:o=!1,context:s=!1,current:a=!1,currentTag:u,messageCount:c,failure:f,separated:h=!1,actions:g,tabIndex:m,onActivate:v,onFocus:w,ref:S})=>{const C=O.jsx(ete,{className:rn("size-4 shrink-0 text-fg-subtle transition-transform",n&&"rotate-90"),"aria-hidden":"true"}),E=O.jsx(ote,{className:"size-4 shrink-0 text-fg-subtle","aria-hidden":"true"}),A=c===void 0?null:O.jsxs("span",{"aria-hidden":"true",className:"shrink-0 text-2xs text-fg-subtle",children:[c," ",c===1?"msg":"msgs"]}),I=O.jsxs("span",{className:"min-w-0 flex-1",children:[O.jsx("span",{className:"block truncate",children:e}),f&&O.jsxs("span",{className:"flex items-center gap-1 text-2xs text-danger",children:[O.jsx(A$,{className:"size-3 shrink-0","aria-hidden":"true"}),O.jsx("span",{className:"truncate",children:f})]})]}),T=f?`${r} — ${f}`:r;return s?O.jsxs("div",{className:"relative flex items-center",children:[O.jsxs("div",{role:"treeitem","aria-level":t+1,"aria-selected":!1,"aria-expanded":n,"aria-label":T,className:rn(F_,"opacity-60"),children:[O.jsx(z_,{depth:t}),C,E,I,A]}),g,h&&O.jsx(j_,{depth:t})]}):O.jsxs("div",{className:"relative flex items-center",children:[O.jsxs("button",{ref:S,type:"button",role:"treeitem","aria-level":t+1,"aria-selected":o,"aria-expanded":n,"aria-current":a?"true":void 0,"aria-label":T,tabIndex:m,onClick:v,onFocus:w,className:rn(F_,"hover:bg-surface-raised active:bg-surface-sunken",a&&"text-fg-muted"),children:[O.jsx(z_,{depth:t}),C,E,I,A,a&&u&&O.jsx("span",{className:"shrink-0 text-xs text-fg-muted",children:u}),o&&O.jsx(E$,{className:"size-4 shrink-0 text-accent","aria-hidden":"true"})]}),g,h&&O.jsx(j_,{depth:t})]})},uk=({label:e,ariaLabel:t,depth:n=0,prominence:r="prominent",separated:o=!1,onOpen:s})=>O.jsxs("div",{className:rn("relative",r==="prominent"&&"p-2"),children:[O.jsxs("button",{type:"button",onClick:s,"aria-label":t,"data-prominence":r,className:rn(F_,"w-full active:bg-surface-sunken",r==="prominent"?"rounded-lg border border-line-strong border-dashed font-medium text-fg-muted hover:border-accent-2 hover:text-accent-2":"text-fg-subtle hover:bg-surface-raised hover:text-fg-muted"),children:[O.jsx(z_,{depth:n}),O.jsx("span",{"aria-hidden":"true",className:"size-4 shrink-0"}),O.jsx(ste,{className:"size-4 shrink-0","aria-hidden":"true"}),O.jsx("span",{className:"min-w-0 flex-1 truncate",children:e})]}),o&&O.jsx(j_,{depth:n})]}),yF={nameLabel:"Folder name",namePlaceholder:"Hotels",insideLabel:"Inside",create:"Create folder",cancel:"Cancel",createPending:"Creating folder…"},ere=({parentLabel:e,name:t,onNameChange:n,onSubmit:r,onCancel:o,pending:s=!1,error:a,labels:u})=>{const c={...yF,...u},f=_.useId(),h=_.useRef(null),g=_.useRef(null);return _.useEffect(()=>{h.current?.focus({preventScroll:!0}),g.current?.scrollIntoView({block:"nearest"})},[]),O.jsxs("div",{ref:g,className:"space-y-3 border-y border-line bg-surface-sunken px-3 py-3",children:[O.jsxs("div",{children:[O.jsx(kne,{htmlFor:f,children:c.nameLabel}),O.jsx(Sf,{id:f,ref:h,value:t,placeholder:c.namePlaceholder,onChange:m=>n(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),r()),m.key==="Escape"&&(m.preventDefault(),o())}})]}),O.jsxs("p",{className:"text-xs text-fg-muted",children:[c.insideLabel," ",O.jsx("span",{className:"font-medium text-fg",children:e})]}),a&&O.jsx("p",{className:"text-xs text-danger",role:"alert",children:a}),O.jsxs("div",{className:"flex items-center gap-2",children:[O.jsx(Xr,{variant:"ghost",size:"md",onClick:o,className:"min-h-11 shrink-0",children:c.cancel}),O.jsx(Xr,{variant:"secondary",size:"md",onClick:r,disabled:s,className:"min-h-11 shrink-0",children:s?c.createPending:c.create})]})]})},tre={...yF,filterPlaceholder:"Filter folders…",filterAriaLabel:"Filter folders",treeAriaLabel:"Destination folders",currentSuffix:"(current folder)",currentTag:"current",contextSuffix:"(containing folder)",emptyMessage:e=>`No folders match "${e}"`,noFolders:"No folders to show",optionLabel:e=>`Move to ${e.label}`,newFolder:"New folder",newSubfolder:e=>`New folder inside ${e}`,topLevel:"Top level",nameRequired:"Give the folder a name.",createError:"Couldn't create that folder. Please try again."},nre=({folders:e,selectedId:t,onSelect:n,rowActions:r,rowFailure:o,onCreateFolder:s,onCancel:a,delimiter:u="/",labels:c,autoFocusFilter:f=!1})=>{const h={...tre,...c},[g,m]=_.useState(""),[v,w]=_.useState(()=>{const se=e.find(Se=>Se.id===t);return new Set(se?Cf(se.path,u):[])}),[S,C]=_.useState(null),[E,A]=_.useState(""),[I,T]=_.useState(),[N,M]=_.useState(!1),[R,k]=_.useState(-1),L=_.useRef([]),q=_.useRef(null),$=_.useRef(!1),D=_.useRef(null);_.useEffect(()=>()=>D.current?.abort(),[]),_.useEffect(()=>{f&&q.current?.focus()},[f]);const j=g.trim().toLowerCase(),Z=_.useMemo(()=>qne(e,u),[e,u]),he=_.useMemo(()=>{const se=Vne(Z,j,u);return se.size===0?v:new Set([...v,...se])},[Z,v,j,u]),B=_.useMemo(()=>j?Wne(Z,j,u,he):Gne(Z,he,u),[Z,j,u,he]),Q=_.useMemo(()=>s?Kne(B,u):void 0,[B,u,s]);_.useEffect(()=>{k(se=>Do(B[se])?se:B1(B))},[B]),_.useEffect(()=>{$.current&&($.current=!1,!(R<0)&&L.current[R]?.focus())},[R]);const ae=_.useCallback((se,Se)=>{w(Ze=>{if(Se)return new Set([...Cf(se,u),se]);const ve=new Set(Ze);return ve.delete(se),ve})},[u]),ue=_.useCallback(se=>{j1(se)&&n?.(se.folder.id),ae(se.folder.path,!se.expanded)},[n,ae]),we=_.useCallback(()=>{D.current?.abort(),C(null),A(""),T(void 0),M(!1)},[]),U=_.useCallback(se=>{D.current?.abort(),C({anchorId:se?.id??null,parentPath:se?.path??"",parentLabel:se?.label??h.topLevel}),A(""),T(void 0),M(!1)},[h.topLevel]),X=_.useCallback(()=>{if(!s||!S||N)return;const se=E.trim();if(se===""){T(h.nameRequired);return}M(!0),T(void 0),D.current?.abort();const Se=new AbortController;D.current=Se;const Ze=S.parentPath;s(se,Ze,Se.signal).then(ve=>{M(!1),C(null),A(""),Ze&&ae(Ze,!0),n?.(ve.id)}).catch(ve=>{Zne(ve)||(T(ve instanceof Error?ve.message:h.createError),M(!1))})},[s,S,N,E,n,ae,h.nameRequired,h.createError]),ie=_.useCallback(se=>{const Se=se.target;if(!(Se instanceof Element)||!Se.closest('[role="treeitem"]'))return;const Ze=pt=>{se.preventDefault(),$.current=!0,k(pt)},ve=B[R];switch(se.key){case"ArrowDown":return Ze(lk(B,R,1));case"ArrowUp":return Ze(lk(B,R,-1));case"Home":return Ze(B1(B));case"End":return Ze(Yne(B));case"ArrowRight":{if(!Do(ve)||!ve)return;if(se.preventDefault(),!ve.expanded){ae(ve.folder.path,!0);return}const pt=R+1;Do(B[pt])&&Ze(pt);return}case"ArrowLeft":{if(!Do(ve)||!ve)return;if(se.preventDefault(),ve.expanded){ae(ve.folder.path,!1);return}const pt=Qne(B,R,u);pt>=0&&Ze(pt);return}case"Enter":case" ":{if(!Do(ve)||!ve)return;se.preventDefault(),ue(ve);return}case"Escape":se.preventDefault(),a?.();return;default:return}},[B,R,u,ue,ae,a]),oe=S!==null&&S.anchorId!==null&&(Q?.some(se=>se.kind==="create"&&se.parent.id===S.anchorId)??!1),fe=S&&O.jsx(ere,{parentLabel:S.parentLabel,name:E,onNameChange:se=>{A(se),T(void 0)},onSubmit:X,onCancel:we,pending:N,error:I,labels:h}),Me=se=>se.context?`${se.folder.label} ${h.contextSuffix}`:j1(se)?h.optionLabel(se.folder):`${se.folder.label} ${h.currentSuffix}`,xe=(se,Se,Ze)=>{const{folder:ve,depth:pt}=se,gt=j1(se);return O.jsx(Jne,{ref:Ye=>{L.current[Se]=Ye},label:ve.label,depth:pt,expanded:se.expanded,context:se.context,current:ve.isCurrent,currentTag:h.currentTag,messageCount:ve.messageCount,selected:gt&&ve.id===t,separated:Ze,failure:o?.(ve),actions:r?.(ve),ariaLabel:Me(se),tabIndex:Se===R?0:-1,onActivate:()=>ue(se),onFocus:()=>k(Se)})};return O.jsxs("div",{className:"flex min-h-0 w-full min-w-0 flex-col",children:[O.jsx(Sf,{ref:q,variant:"inline",className:"border-b border-line px-3 py-2",icon:O.jsx(dte,{className:"size-4","aria-hidden":"true"}),type:"search",value:g,onChange:se=>m(se.target.value),onKeyDown:se=>{if(se.key==="Escape"){se.preventDefault(),a?.();return}if(se.key!=="ArrowDown")return;se.preventDefault();const Se=Do(B[R])?R:B1(B);Se<0||($.current=!0,k(Se),L.current[Se]?.focus())},placeholder:h.filterPlaceholder,"aria-label":h.filterAriaLabel}),s&&O.jsx("div",{className:"shrink-0 border-b border-line","data-create-anchor":"top",children:S&&!oe?fe:O.jsx(uk,{label:h.newFolder,ariaLabel:h.newFolder,prominence:"prominent",onOpen:()=>U(null)})}),B.length===0?O.jsx("p",{className:"px-3 py-3 text-sm text-fg-muted","aria-live":"polite",children:e.length===0?h.noFolders:h.emptyMessage(g)}):O.jsx("div",{role:"tree","aria-label":h.treeAriaLabel,className:"min-h-0 flex-1 overflow-y-auto overflow-x-hidden pb-24",onKeyDown:ie,children:(Q??B.map((se,Se)=>({kind:"folder",row:se,index:Se}))).map((se,Se,Ze)=>{const ve=Se<Ze.length-1;return se.kind==="create"?O.jsx("div",{role:"none","data-create-anchor":se.parent.id,children:S?.anchorId===se.parent.id?fe:O.jsx(uk,{label:h.newFolder,ariaLabel:h.newSubfolder(se.parent.label),depth:se.depth,prominence:"quiet",separated:ve,onOpen:()=>U(se.parent)})},`new:${se.parent.id}`):O.jsx("div",{role:"none",children:xe(se.row,se.index,ve)},se.row.folder.id)})})]})},rre={inbox:"Inbox",drafts:"Drafts",sent:"Sent",archive:"Archive",junk:"Spam",trash:"Trash",flagged:"Starred",all:"All Mail"};function ore(e){return rre[e]}const sre=new Set(["all","flagged"]);function ire(e){return sre.has(e)}const are=new Set(["[Gmail]","[Google Mail]"]);function lre(e){if(e.role)return ire(e.role)?void 0:ore(e.role);if(!e.providerPath)return;const t=sI(e.providerPath,e.hierarchyDelimiter);if(!are.has(t[0]))return Hne(e.providerPath,e.hierarchyDelimiter)}function c6e(e){return e==="inbox"?O.jsx(D$,{className:"size-4"}):e==="drafts"?O.jsx(rte,{className:"size-4"}):e==="sent"?O.jsx(fte,{className:"size-4"}):e==="archive"?O.jsx(Xee,{className:"size-4"}):e==="junk"?O.jsx(tI,{className:"size-4"}):e==="trash"?O.jsx(mte,{className:"size-4"}):e==="flagged"?O.jsx(pte,{className:"size-4"}):O.jsx(ute,{className:"size-4"})}const ure={Inbox:"Inbox",Drafts:"Drafts",Sent:"Sent",Archive:"Archive",Junk:"Junk",Trash:"Trash",All:"All",Flagged:"Flagged"},d6e={Body:"Body"},f6e={Mail:"Mail",Calendar:"Calendar"},ru={Appointed:"Appointed",Flagged:"Flagged",Reserved:"Reserved",Proposed:"Proposed",Stale:"Stale",None:"None"},Na={SignInDisabled:"sign_in_disabled",CallerDisabled:"caller_disabled",ForeignOrigin:"foreign_origin",StepUpRequired:"step_up_required",WrongPassword:"wrong_password",StepUpLocked:"step_up_locked",CannotDisableSelf:"cannot_disable_self"},ck={synced:"synced",failed:"failed"},h6e={Saved:"Saved",Deployment:"Deployment",Default:"Default"},p6e={NoBaseUrl:"NoBaseUrl",NoApiKey:"NoApiKey"},g6e={uncategorized:"uncategorized",personal:"personal",newsletter:"newsletter",marketing:"marketing",automated:"automated",transactional:"transactional",social:"social"},m6e={Wellknown:"wellknown",Vip:"vip"},v6e={Lookalike:"Lookalike",ForeignAddress:"ForeignAddress",Unrelated:"Unrelated"},y6e={abandoned:"abandoned"},b6e={none:"none",move:"move",delete:"delete"},S6e={MoveToInbox:"MoveToInbox",MoveToJunk:"MoveToJunk"},w6e={Confident:"Confident",Unsure:"Unsure"},C6e={Attachment:"attachment"},E6e={None:"None"},_6e={Retrying:"Retrying",GaveUp:"GaveUp"};function bF(e){const[t,n]=_.useState(!1),r=t?nte:tte,o=t?"Hide password":"Show password";return O.jsx(Sf,{...e,type:t?"text":"password",trailing:O.jsx("button",{type:"button","aria-label":o,"aria-pressed":t,title:o,onClick:()=>n(s=>!s),className:"-my-1 -mr-2 flex size-11 shrink-0 cursor-pointer items-center justify-center rounded-md text-fg-subtle transition-colors hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:O.jsx(r,{className:"size-4","aria-hidden":!0})})})}const cre=e=>e===1?"message":"messages",Om=e=>`${e.toLocaleString()} ${cre(e)}`,H1=(e,t)=>e.kind==="delete"?`delete ${Om(e.count)}`:t===void 0?"empty it":`empty ${Om(t)}`,SF=e=>e.kind==="delete"?"Nothing has been deleted.":"Nothing has been emptied.",dre=(e,t,n={})=>{const{trashFolderLabel:r,staleFolderLabel:o,selectedCount:s}=n,a=SF(t);if(e==="none")return{title:"No folder is set as Trash",description:`${a} reader files deleted mail in the folder you set as Trash, and this account has none.`,pickerPrompt:"Which folder does this account use for deleted mail?",confirmLabel:`Set as Trash and ${H1(t,void 0)}`,cancelLabel:"Cancel"};if(e==="stale")return{title:"The Trash folder you chose is gone",description:o?`${a} You set ${o} as this account's Trash and it is no longer on the mail server — another mail app may have renamed or removed it.`:`${a} The folder you set as this account's Trash is no longer on the mail server — another mail app may have renamed or removed it.`,pickerPrompt:"Which folder should reader use instead?",confirmLabel:`Set as Trash and ${H1(t,void 0)}`,cancelLabel:"Cancel"};const u=t.kind==="delete"?`Deleting ${Om(t.count)} there erases them from the mail server, and that cannot be restored.`:"Emptying a folder erases everything in it from the mail server, and that cannot be restored.";return{title:"Confirm this account's Trash folder",description:r?`${a} reader files this account's deleted mail in ${r} because of its name — you never chose it, and the mail server doesn't mark it as Trash. ${u}`:`${a} reader files this account's deleted mail in a folder it matched by name — you never chose it, and the mail server doesn't mark it as Trash. ${u}`,pickerPrompt:r?`Confirm ${r}, or pick the folder this account really uses.`:"Pick the folder this account really uses for deleted mail.",confirmLabel:`Set as Trash and ${H1(t,s)}`,cancelLabel:"Cancel"}},fre=(e,t,n,r)=>e.kind==="appointing"?{headline:"Setting the Trash folder…",status:n}:t.kind==="delete"?{headline:`Deleting ${Om(t.count)}…`,status:r?`Erasing them from ${n}. This can't be undone.`:`Moving them to ${n}`}:{headline:`Emptying ${n}…`,status:"This can't be undone."},hre=(e,t,n,r)=>e==="unconfirmed"&&t.kind==="delete"&&n!==void 0&&r===n,pre=(e,t,n)=>e==="mailbox-pending"?`${n} is still being created on the mail server. Wait for it to finish, then try again.`:`Couldn't set that folder as Trash. ${SF(t)} Please try again.`,gre=({open:e,reason:t,action:n,folders:r,delimiter:o,trashFolderLabel:s,guessedMailboxId:a,staleFolderLabel:u,accountEmail:c,phase:f,selectedId:h,onSelect:g,onCreateFolder:m,onConfirm:v,onCancel:w})=>{const S=_.useRef(null),C=f.kind==="appointing"||f.kind==="acting";_.useEffect(()=>{C&&S.current?.focus()},[C]);const E=r.find(N=>N.id===h),A=dre(t,n,{trashFolderLabel:s,staleFolderLabel:u,selectedCount:E?.messageCount}),I=hre(t,n,a,h),T=n.kind==="emptyTrash"||I;if(!e)return null;if(C){const N=fre(f,n,E?.label??"",I);return O.jsx(ak,{open:e,onClose:()=>{},title:A.title,children:O.jsxs("div",{ref:S,"data-escape-owner":!0,tabIndex:-1,className:"flex flex-col items-center gap-3 px-5 py-10 text-center outline-none",children:[O.jsx($$,{className:"size-8 animate-spin text-accent-2"}),O.jsx("p",{className:"text-sm font-medium text-fg",children:N.headline}),O.jsx("p",{className:"text-xs text-fg-muted",role:"status","aria-live":"polite",children:N.status})]})})}return O.jsxs(ak,{open:e,onClose:w,title:A.title,children:[O.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[O.jsx(nI,{className:`size-4 shrink-0 ${T?"text-danger":"text-warning"}`}),O.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:A.title})]}),O.jsxs("div",{className:"flex max-h-[70vh] flex-col",children:[O.jsxs("div",{className:"space-y-1 px-5 py-4",children:[O.jsx("p",{className:"text-sm text-fg-muted",children:A.description}),c&&O.jsx("p",{className:"text-xs text-fg-subtle",children:c})]}),f.kind==="appoint-failed"&&O.jsx("div",{className:"px-5 pb-3",children:O.jsx(Zr,{tone:"danger",variant:"soft",children:pre(f.cause,n,E?.label??"That folder")})}),O.jsx("p",{className:"px-5 pb-2 text-sm text-fg-muted",children:A.pickerPrompt}),O.jsx("div",{className:"flex h-[26rem] min-h-0 flex-1 overflow-hidden",children:O.jsx(nre,{folders:r,selectedId:h,delimiter:o,onSelect:g,onCreateFolder:t==="none"?m:void 0,onCancel:w,labels:{treeAriaLabel:"Folders on this account",optionLabel:N=>`Set ${N.label}${N.messageCount===void 0?"":`, ${N.messageCount} messages`}, as Trash`}})})]}),O.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[O.jsx(Xr,{variant:"secondary",size:"sm",onClick:w,children:A.cancelLabel}),E&&O.jsx(Xr,{variant:T?"danger":"primary",size:"sm",onClick:()=>v(E.id),children:O.jsx("span",{className:"truncate",children:A.confirmLabel})})]})]})},mre={delete:{label:"Delete",present:"Deleting",past:"Deleted",destructive:!0},move:{label:"Move",present:"Moving",past:"Moved",destructive:!1},junk:{label:"Junk",present:"Marking as junk",past:"Marked as junk",destructive:!0},markRead:{label:"Mark read",present:"Marking read",past:"Marked read",destructive:!1},organize:{label:"Organize",present:"Organizing",past:"Organized",destructive:!1}},vre=e=>mre[e],yre={match:"Apply to",properties:"Properties",folder:"Folder",rule:"Rule",name:"Name",review:"Review",run:"Run"},x6e=e=>yre[e],A6e=({verb:e,mode:t,scope:n,fromSearch:r})=>{const o=r?["properties"]:t==="properties"?["match","properties"]:["match"];return e==="move"?[...o,"folder","review","run"]:e==="organize"?n==="standing"||n==="until"?[...o,"folder","rule","name","review","run"]:[...o,"folder","rule","review","run"]:[...o,"review","run"]},wF=(e,t)=>Math.max(0,e.indexOf(t)),I6e=(e,t)=>wF(e,t)===0||t==="run",CF=(e,t)=>({clauses:[...e.clauses],matchOperator:e.matchOperator,moveMailboxId:e.moveMailboxId,scope:t,until:e.until,name:e.name}),bre=e=>hF(CF(e,e.scope??"once")),dk=e=>{if(!(e.scope!=="standing"&&e.scope!=="until")&&!fF(CF(e,e.scope)))return Gr.noMatch},Sre="A rule only works within one account — clear the selection, or pick messages from a single account.",wre="A destination only works within one account — clear the selection, or pick messages from a single account.",R6e="Matching beyond the messages you picked only works within one account — clear the selection, or pick messages from a single account.",Cre="A rule only works within one folder — clear the selection, or pick messages from a single folder.",Ere="A destination only works within one folder — clear the selection, or pick messages from a single folder.",_re={spansAccounts:{rule:Sre,destination:wre},spansFolders:{rule:Cre,destination:Ere}},xre="A match this wide applies once — use “Make this a filter” above the results to keep doing it.",T6e=(e,t)=>e==="escalated"?xre:t.rule,O6e=(e,t)=>{const n=e===void 0?"spansAccounts":t;if(!n)return{accountId:e};const r=_re[n];return{accountId:n==="spansAccounts"?void 0:e,rule:r.rule,destination:r.destination}},M6e=e=>e===void 0?["selected"]:["selected","properties"],Are="This matches no messages, so there is nothing to do. Go back and change what it applies to.",Ire="Fill in every property, or take the empty one off.",Rre="Pick a destination first.",Tre="Choose one of the three first.",P6e=(e,t,n)=>{if(e==="properties")return t.clauses.length===0?Gr.noMatch:t.clauses.some(r=>r.value.trim()==="")?Ire:void 0;if(e==="folder")return t.moveMailboxId?void 0:Rre;if(e==="rule"){if(!t.scope)return Tre;const r=dk(t);return r||(t.scope==="once"&&bre(t).length>0?Gr.bodyTextOnce:t.scope==="until"&&!t.until?.trim()?Gr.noUntilDate:void 0)}if(e==="name"&&!t.name?.trim())return Gr.unnamed;if(e==="review"){const r=dk(t);return r||(n.status==="uncounted"?void 0:n.status==="ready"&&n.count===0&&!n.stale?Are:pF(n))}},N6e="Nothing matches this yet. Widen a property, or match on a different one.",k6e=({state:e,verb:t,scope:n,matched:r,applied:o,failed:s,failureReason:a})=>{const{label:u,present:c,past:f}=vre(t),h=f.toLowerCase(),g=n==="standing"||n==="until",v={screenTitle:e==="saving"||e==="backApplyRunning"||e==="statusUnknown"||e==="commitFailed"?u:"Done",showProgress:e==="backApplyRunning"||e==="backApplyComplete"||e==="backApplyFailed"||e==="backApplyRestartFailed"||e==="statusUnknown"||e==="runStopped",failureListLabel:`Not ${h}`};return e==="saving"?{...v,title:g?"Saving rule…":"Applying…",detail:"Nothing has been changed yet.",tone:"progress",dismissLabel:"Close"}:e==="backApplyRunning"?{...v,title:g?"Rule saved. Moving the mail already in your mailbox…":`${c} ${r} messages…`,detail:"This keeps running if you close the wizard.",tone:"progress",dismissLabel:"Close",cancelLabel:"Stop the run"}:e==="statusUnknown"?{...v,title:g?"Rule saved. Its progress over your existing mail is unknown":`${c} — progress unknown`,detail:g?"The connection dropped, so the bar shows the last that was read. The pass runs on the mail server, and the rule keeps working on new mail either way. This keeps checking.":"The connection dropped, so the bar shows the last that was read. The run is on the mail server and carries on either way. This keeps checking.",tone:"warning",dismissLabel:"Close",retryLabel:"Check again"}:e==="backApplyComplete"?{...v,title:g?"Rule saved and applied":`${f} ${o}`,detail:g?`${o} of ${r} already in your mailbox ${h}. New mail follows the rule as it arrives.`:`Every message the match reached was ${h}. Your mail server is still catching up, so the list can lag behind.`,tone:"success",dismissLabel:"Done"}:e==="backApplyFailed"?{...v,title:g?"Rule saved — some mail stayed put":`Not everything was ${h}`,detail:`${o} of ${r} ${h} · the mail server rejected ${s}.${g?" The rule itself is saved and keeps working on new mail.":""}`,tone:"warning",dismissLabel:"Close",retryLabel:`Retry ${s}`}:e==="runStopped"?{...v,title:`Stopped after ${o}`,detail:`${o} of ${r} ${h}. The rest were not sent, apart from the ones already on their way when you stopped — those may still have gone through.`,tone:"warning",dismissLabel:"Close",retryLabel:`Retry ${s}`}:e==="backApplyRestartFailed"?{...v,title:g?"Rule saved — the retry didn't start":"The retry didn't start",detail:`${o} of ${r} ${h} · the mail server rejected ${s}, which are still where they were.${g?" The rule itself is saved and keeps working on new mail.":""} Check your connection and try again.`,tone:"warning",dismissLabel:"Close",retryLabel:`Retry ${s}`}:e==="backApplyStartFailed"?{...v,title:"Rule saved",detail:"New mail follows it automatically. The pass over the mail already in your mailbox never started.",tone:"warning",dismissLabel:"Not now",retryLabel:"Run it over existing mail"}:e==="filterSaved"?{...v,title:"Filter saved",detail:"There is no mail in your mailbox to apply it to yet. New mail follows it as it arrives. You can see it, and when it expires, under Settings › Filters.",tone:"success",dismissLabel:"Done"}:{...v,title:g?"Couldn't save the rule":`Couldn't start ${u.toLowerCase()}`,detail:a??"Nothing has changed.",tone:"danger",dismissLabel:a===void 0?"Not now":"Close",retryLabel:a===void 0?"Try again":void 0}},Ore=e=>`${Une(e.field)} "${e.value}"`,EF=(e,t)=>e.map(Ore).join(` ${jne(t)} `),Mre=(e,t)=>e==="selected"?`These ${t} messages`:"Its properties",D6e=e=>e==="selected"?"Only the messages ticked in the list.":Dne,Pre=e=>`Every message ${e}`,_F="the list is showing",L6e="This reaches every match on the mail server, including the ones the list has not loaded. The search is already the match, so there is nothing to widen.",U6e="This covers messages not shown in the list, and anything else matching by the time it runs.",$6e=({mode:e,selectedCount:t,clauses:n,matchOperator:r,escalatedScope:o})=>e==="escalated"?Pre(o??_F):e==="properties"?EF(n,r):Mre(e,t),F6e=({mode:e,selectedCount:t,clauses:n,matchOperator:r,escalatedScope:o,escalatedCount:s})=>{if(e==="selected")return`${t} messages`;if(e==="escalated"){const a=o??_F;return s===void 0?`every message ${a}`:`all ${s.toLocaleString()} messages ${a}`}return n.length===0?"every message":`every message where ${EF(n,r)}`},Nre={preparing:"Getting the new version ready",restarting:"Restarting Remit",reconnecting:"Waiting for Remit to answer again"};function fk(e){return Nre[e]}function kre(e){return e<90?"This usually takes about a minute.":e<240?"Longer than usual. Remit is still trying to reach the server.":"Still no answer. Remit keeps trying."}function z6e(e,t=Date.now()){const n=Math.floor((t-e)/6e4);if(n<1)return"just now";if(n<60)return`${n}m ago`;const r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function j6e(e){return new Date(e).toLocaleDateString(void 0,{dateStyle:"medium"})}const hk=["preparing","restarting","reconnecting"],xF="fixed inset-0 z-50 flex flex-col items-center justify-center gap-6 bg-canvas p-6 text-center outline-none";function Dre({target:e,phase:t,elapsedSeconds:n}){const r=_.useRef(null);Wv(r,!0),Vv({id:"self-update",open:!0});const o=hk.indexOf(t);return O.jsxs("div",{ref:r,role:"dialog","aria-modal":"true","aria-labelledby":"self-update-progress-title",tabIndex:-1,className:xF,children:[O.jsxs("div",{className:"max-w-md space-y-2",children:[O.jsxs("h1",{id:"self-update-progress-title",className:"text-lg font-semibold text-fg",children:["Installing Remit ",e]}),O.jsx("p",{className:"text-sm text-fg-muted",children:"Remit is restarting, so this page has no server to talk to for a moment. Leave this open — it reconnects on its own."})]}),O.jsx("ol",{className:"w-full max-w-sm space-y-2 text-left",children:hk.map((s,a)=>{const u=a<o,c=a===o;return O.jsxs("li",{className:rn("flex items-center gap-3 rounded-sm border px-row-inset py-2 text-sm",c?"border-line-strong bg-surface text-fg":"border-line bg-surface-sunken text-fg-subtle"),children:[u?O.jsx(E$,{className:"size-4 shrink-0 text-positive","aria-hidden":!0}):c?O.jsx($$,{className:"size-4 shrink-0 animate-spin text-accent-2","aria-hidden":!0}):O.jsx("span",{className:"size-4 shrink-0 rounded-full border border-line-strong"}),fk(s)]},s)})}),O.jsxs("p",{"aria-live":"polite",className:"max-w-md text-xs text-fg-subtle",children:[O.jsx("span",{className:"sr-only",children:`${fk(t)}. `}),kre(n)]})]})}function Lre({attemptedVersion:e,previousVersion:t,elapsedSeconds:n,logsCommand:r,onRetryConnection:o}){const s=_.useRef(null);Wv(s,!0);const a=Math.max(1,Math.round(n/60));return O.jsxs("div",{ref:s,role:"alertdialog","aria-modal":"true","aria-labelledby":"self-update-unreachable-title",tabIndex:-1,className:xF,children:[O.jsx(tI,{className:"size-12 shrink-0 text-danger","aria-hidden":!0}),O.jsxs("div",{className:"max-w-lg space-y-3",children:[O.jsx("h1",{id:"self-update-unreachable-title",className:"text-lg font-semibold text-fg",children:"Remit has not answered since the restart"}),O.jsxs("p",{className:"text-sm text-fg-muted",children:["Installing ",e," started ",a," minute",a===1?"":"s"," ago and the server has been silent since. Your mail is safe at your provider — it was never part of the update."]}),O.jsxs("p",{className:"text-sm text-fg-muted",children:["Remit rolls back to ",t," on its own when the new version fails to start, but this page cannot confirm that from here. Check the server directly:"]}),O.jsx("code",{className:"block rounded-xs bg-surface-sunken px-3 py-2 text-left text-xs text-fg-muted",children:r})]}),O.jsx("div",{className:"flex flex-wrap items-center justify-center gap-2",children:O.jsx(Xr,{size:"sm",onClick:o,children:"Try connecting again"})})]})}const Ure=()=>O.jsxs("div",{className:"hidden h-full w-[17%] min-w-40 max-w-64 shrink-0 flex-col gap-1 border-r border-line p-3 md:flex",children:[O.jsx("div",{className:"mb-3 h-6 w-24 rounded bg-surface-sunken"}),Array.from({length:6}).map((e,t)=>O.jsxs("div",{className:"flex items-center gap-2 py-1.5",children:[O.jsx("div",{className:"size-5 shrink-0 rounded bg-surface-sunken"}),O.jsx("div",{className:"h-3.5 flex-1 rounded bg-surface-sunken"})]},t))]}),$re=()=>O.jsx("div",{className:"min-w-0 flex-1",children:Array.from({length:8}).map((e,t)=>O.jsxs("div",{className:"flex items-start gap-3 border-b border-line py-2 pl-5 pr-4",children:[O.jsx("div",{className:"mt-0.5 size-7 shrink-0 rounded-full bg-surface-sunken"}),O.jsxs("div",{className:"flex-1 space-y-1.5",children:[O.jsxs("div",{className:"flex justify-between gap-2",children:[O.jsx("div",{className:"h-3.5 w-28 rounded bg-surface-sunken"}),O.jsx("div",{className:"h-3 w-12 rounded bg-surface-sunken"})]}),O.jsx("div",{className:"h-3.5 w-48 rounded bg-surface-sunken"}),O.jsx("div",{className:"h-3 w-full rounded bg-surface-sunken"})]})]},t))}),Zv=()=>O.jsxs("div",{className:"flex h-full animate-pulse bg-canvas","aria-hidden":"true",children:[O.jsx(Ure,{}),O.jsx($re,{})]}),Yv="edb86b3531cfff4973256c06a1f11134b8d8ae2c",Fre="2026-11-11T08:57:56.040Z",zre=Yv.slice(0,7),jre=/^[0-9a-f]{40}$/.test(Yv),Bre=jre?`https://github.com/remit-mail/reader/commit/${Yv}`:void 0;class Qv extends Error{constructor(t,n,r){super(t),this.status=n,this.body=r,this.name="ApiError"}status;body}const B_=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),il=e=>{const t=e instanceof Qv?e.body:e;if(!B_(t))return;const{code:n,details:r}=t;if(typeof n=="string")return{code:n,details:B_(r)?r:void 0}},Hre=(e,t)=>{if(B_(e)&&e.message!==void 0&&e.message!==null){const n=String(e.message);if(n)return n}return`Request failed with status ${t}`},qre=(e,t)=>new Qv(Hre(e,t),t,e),hn=e=>{if(e instanceof Qv)return e.status;if(e&&typeof e=="object"){const t=e;if(typeof t.status=="number")return t.status;if(typeof t.statusCode=="number")return t.statusCode}},AF=e=>hn(e)!==void 0,Xv=e=>{const t=hn(e);return t!==void 0&&t>=500&&t<=599},Jv=e=>!!(typeof DOMException<"u"&&e instanceof DOMException&&e.name==="AbortError"||e&&typeof e=="object"&&"name"in e&&e.name==="AbortError"),Vre=()=>typeof navigator<"u"&&navigator.onLine===!1,ey=e=>Jv(e)||AF(e)?!1:e instanceof XA?!0:Vre(),Wre=e=>!AF(e)&&!Jv(e)&&!ey(e),IF=e=>Xv(e)||Wre(e),Gre=e=>e instanceof Error&&e.name==="AuthTokenError"&&hn(e)===403,ty=e=>hn(e)===401||Gre(e),Kre=(e,t)=>{if(t?.softError===!0)return!0;const n=t?.softErrorStatuses;if(!Array.isArray(n))return!1;const r=hn(e);return r!==void 0&&n.includes(r)},Zre=[502,503,504],Yre=(e,t)=>{if(t?.restartExpected!==!0)return!1;const n=hn(e);return n!==void 0&&Zre.includes(n)},Qre=(e,t)=>Xv(e)?!Yre(e,t)&&t?.ownsServerErrors!==!0:Jv(e)||ey(e)||ty(e)?!1:IF(e)?!0:!Kre(e,t),iI={softError:!0},ny=(...e)=>({softErrorStatuses:e}),Xre={restartExpected:!0},Jre={ownsServerErrors:!0},RF=e=>hn(e)===404,eoe=e=>Xv(e),H_=new Set;let TF=null,OF=null;const toe=e=>{OF=e},noe=e=>e instanceof Error?e:new Error(MF(e)),MF=e=>e instanceof Error?e.message||e.name:typeof e=="string"?e:e&&typeof e=="object"&&"message"in e&&typeof e.message=="string"?e.message:"An unexpected server error occurred.",roe=()=>typeof globalThis.crypto<"u"&&typeof globalThis.crypto.randomUUID=="function"?globalThis.crypto.randomUUID():`fatal-${Date.now()}-${Math.random().toString(36).slice(2,10)}`,Bu=(e,t)=>{const n={error:e,message:MF(e),correlationId:roe(),at:Date.now(),recoverable:t?.recoverable??eoe(e),stack:e instanceof Error?e.stack:void 0,componentStack:t?.componentStack};TF=n,uoe(`Fatal: ${n.message} [${n.correlationId}]`),OF?.recordError(noe(e),{fatal:"true",correlationId:n.correlationId});for(const r of H_)r(n);return n},ooe=e=>(H_.add(e),()=>{H_.delete(e)}),soe=()=>TF,ioe=20,rm=[],aoe=new Set(["ResizeObserver loop limit exceeded","ResizeObserver loop completed with undelivered notifications"]);function loe(e){return typeof e!="string"?!1:aoe.has(e.replace(/\.\s*$/,""))}function om(e){rm.push(e),rm.length>ioe&&rm.shift()}function uoe(e){om(e)}function coe(e){return e.map(t=>{if(typeof t=="string")return t;if(t instanceof Error)return`${t.name}: ${t.message}`;try{return JSON.stringify(t)}catch{return String(t)}}).join(" ")}function doe(){const e=console.error.bind(console);console.error=(...t)=>{om(coe(t)),e(...t)},window.addEventListener("error",t=>{loe(t.message)||(om(`Uncaught ${t.error instanceof Error?`${t.error.name}: ${t.error.message}`:String(t.message)} (${t.filename}:${t.lineno})`),Bu(t.error??t.message))}),window.addEventListener("unhandledrejection",t=>{const n=t.reason,r=n instanceof Error?`${n.name}: ${n.message}`:String(n);om(`Unhandled rejection: ${r}`),Bu(n)})}function foe(){return rm.slice()}const hoe=8,mu=[];function poe(e){const t=e.split(/[?#]/)[0],n=mu[mu.length-1];n&&n.path===t||(mu.push({path:t,timestamp:new Date().toISOString()}),mu.length>hoe&&mu.shift())}function goe(){return mu.slice()}const q1=7500,pk=`
|
|
13
13
|
… (truncated — the copy action on this screen has the full report)`;function Hu(e){return{appShortSha:zre,appCommitUrl:Bre,appBuildTime:Fre,userAgent:navigator.userAgent,viewport:`${window.innerWidth}×${window.innerHeight}`,timestamp:new Date().toISOString(),timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,href:window.location.href,recentErrors:foe(),requests:Aee(),routes:goe(),failingRequest:Iee(),errorMessage:e?.errorMessage,stack:e?.stack,componentStack:e?.componentStack,quarantine:e?.quarantine,syncWarning:e?.syncWarning,title:e?.title}}function V1(e){return["```",e,"```"].join(`
|
|
14
14
|
`)}function PF(e){const t=/T(\d{2}:\d{2}:\d{2})/.exec(e);return t?t[1]:e}function moe(e){return`- **Version**: ${e.appCommitUrl?`[\`${e.appShortSha}\`](${e.appCommitUrl})`:`\`${e.appShortSha}\``} built ${e.appBuildTime}`}function voe(e){const t=e.status===0?"no response (transport failure)":`${e.status}`;return["## Failing request",`- **Endpoint**: \`${e.path}\``,`- **Method**: ${e.method}`,`- **Status**: ${t}`,`- **Correlation id**: ${e.correlationId??"(none)"}`,""]}function yoe(e){return e.length===0?["## Recent API requests","(none)",""]:["## Recent API requests","| Time | Method | Path | Status | Duration | Correlation |","| --- | --- | --- | --- | --- | --- |",...e.map(n=>{const r=n.status===0?"ERR":`${n.status}`;return`| ${PF(n.timestamp)} | ${n.method} | \`${n.path}\` | ${r} | ${n.durationMs}ms | ${n.correlationId??""} |`}),""]}function boe(e){return e.length===0?["## Navigation trail","(none)",""]:["## Navigation trail",...e.map(n=>`- ${PF(n.timestamp)} \`${n.path}\``),""]}function NF(e,t){const n=e.recentErrors.length>0?e.recentErrors.map(s=>` - ${s}`).join(`
|
|
15
15
|
`):" (none)",r=["## Environment",moe(e),`- **Browser**: ${e.userAgent}`,`- **Viewport**: ${e.viewport}`,`- **Time**: ${e.timestamp} (${e.timezone})`,"","## URL",e.href,""];if(e.errorMessage&&r.push("## Error",e.errorMessage,""),e.failingRequest&&r.push(...voe(e.failingRequest)),e.quarantine){const s=t?.quarantineStructure??e.quarantine.structure;r.push(e.quarantine.head,"",V1(s),"",e.quarantine.disclaimer,"")}e.syncWarning&&r.push(e.syncWarning,"");const o=t?.stack??e.stack;return o&&r.push("## Stacktrace",V1(o),""),e.componentStack&&r.push("## Component stack",V1(e.componentStack),""),r.push(...yoe(e.requests)),r.push(...boe(e.routes)),r.push("## Recent console errors",n,"","## Steps to reproduce","1. ","","## Expected behaviour","","## Actual behaviour",""),r.join(`
|
|
@@ -210,4 +210,4 @@ ${n.join(`
|
|
|
210
210
|
|
|
211
211
|
`)}return C.write("payload.value = newResult;"),C.write("return payload;"),C.compile()};let a;const u=yv,c=!So.jitless,h=c&&FRe.value,g=t.catchall;let m;e._zod.parse=(v,w)=>{m??(m=r.value);const S=v.value;return u(S)?c&&h&&w?.async===!1&&w.jitless!==!0?(a||(a=s(t.shape)),v=a(v,w),g?IH([],S,v,w,m,e,w?.abortEarly===!0):v):n(v,w):(v.issues.push({expected:"object",code:"invalid_type",input:S,inst:e}),v)}});function X6(e,t,n,r){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const o=e.filter(s=>!Rs(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(a=>Gi(a,r,Vo())))}),t)}const o2e=te("$ZodUnion",(e,t)=>{Zt.init(e,t),mt(e,"optin",r=>r.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":r.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0),mt(e,"optout",r=>r.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),mt(e,"values",r=>{if(r.def.options.every(o=>o._zod.values))return new Set(r.def.options.flatMap(o=>Array.from(o._zod.values)))}),mt(e,"pattern",r=>{if(r.def.options.every(o=>o._zod.pattern)){const o=r.def.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>lT(s.source)).join("|")})$`)}});const n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let s=!1;const a=[];for(const u of t.options){const c=u._zod.run({value:r.value,issues:[]},o);if(c instanceof Promise)a.push(c),s=!0;else{if(c.issues.length===0)return c;a.push(c)}}return s?Promise.all(a).then(u=>X6(u,r,e,o)):X6(a,r,e,o)}}),s2e=te("$ZodIntersection",(e,t)=>{Zt.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,s=t.left._zod.run({value:o,issues:[]},r),a=t.right._zod.run({value:o,issues:[]},r);return s instanceof Promise||a instanceof Promise?Promise.all([s,a]).then(([c,f])=>J6(n,c,f)):J6(n,s,a)}});function bA(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(tc(e)&&tc(t)){const n=Object.keys(t),r=Object.keys(e).filter(s=>n.indexOf(s)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(const s of r){if(s==="__proto__")continue;const a=bA(e[s],t[s]);if(!a.valid)return{valid:!1,mergeErrorPath:[s,...a.mergeErrorPath]};o[s]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],s=t[r],a=bA(o,s);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function J6(e,t,n){const r=new Map;let o;const s=new Map,a=(f,h)=>{let g;if(f.code==="unrecognized_keys"&&!f.path?.length)o??(o=f),g=f.keys;else if(f.code==="invalid_key"&&f.origin==="record"&&f.path?.length===1){const m=String(f.path[0]);s.has(m)||s.set(m,f),g=[m]}else return!1;for(const m of g)r.has(m)||r.set(m,{}),r.get(m)[h]=!0;return!0};for(const f of t.issues)a(f,"l")||e.issues.push(f);for(const f of n.issues)a(f,"r")||e.issues.push(f);const u=[...r].filter(([,f])=>f.l&&f.r).map(([f])=>f);if(u.length){const f=o?u.filter(h=>o.keys.includes(h)):[];f.length&&e.issues.push({...o,keys:f});for(const h of u)!f.includes(h)&&s.has(h)&&e.issues.push(s.get(h))}const c=bA(t.value,n.value);if(!c.valid){if(Rs(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}const i2e=te("$ZodRecord",(e,t)=>{Zt.init(e,t);const n=So.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{const s=r.value;if(!tc(s))return r.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),r;const a=[],u=t.keyType._zod.values;if(u&&!t.partial){r.value=n?n.alloc(e,r,{},o):{};const c=new Set;for(const h of u)if(typeof h=="string"||typeof h=="number"||typeof h=="symbol"){if(c.add(typeof h=="number"?h.toString():h),h==="__proto__")continue;const g=t.keyType._zod.run({value:h,issues:[]},o);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(g.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:g.issues.map(w=>Gi(w,o,Vo())),input:h,path:[h],inst:e});continue}const m=g.value;if(m==="__proto__")continue;const v=t.valueType._zod.run({value:s[h],issues:[]},o);v instanceof Promise?a.push(v.then(w=>{w.issues.length&&r.issues.push(...Ou(h,w.issues)),r.value[m]=w.value})):(v.issues.length&&r.issues.push(...Ou(h,v.issues)),r.value[m]=v.value)}let f;for(const h in s)if(!c.has(h))if(t.mode==="loose"){if(h==="__proto__")continue;r.value[h]=s[h]}else f=f??[],f.push(h);f&&f.length>0&&r.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:f,continue:!0})}else{r.value=n?n.alloc(e,r,{},o):{};let c;for(const f of Reflect.ownKeys(s)){if(f==="__proto__"||!Object.prototype.propertyIsEnumerable.call(s,f))continue;let h=t.keyType._zod.run({value:f,issues:[]},o);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof f=="string"&&hT.test(f)&&h.issues.length){const w=t.keyType._zod.run({value:Number(f),issues:[]},o);if(w instanceof Promise)throw new Error("Async schemas not supported in object keys currently");w.issues.length===0&&(h=w)}if(h.issues.length){t.mode==="loose"?r.value[f]=s[f]:u?(c=c??[],c.push(f)):r.issues.push({code:"invalid_key",origin:"record",issues:h.issues.map(w=>Gi(w,o,Vo())),input:f,path:[f],inst:e});continue}const m=h.value;if(m==="__proto__")continue;const v=t.valueType._zod.run({value:s[f],issues:[]},o);v instanceof Promise?a.push(v.then(w=>{w.issues.length&&r.issues.push(...Ou(f,w.issues)),r.value[m]=w.value})):(v.issues.length&&r.issues.push(...Ou(f,v.issues)),r.value[m]=v.value)}c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:c,continue:!0})}return a.length?Promise.all(a).then(()=>r):r}}),a2e=te("$ZodEnum",(e,t)=>{Zt.init(e,t);const n=gA(t.entries),r=new Set(n);e._zod.values=r,mt(e,"pattern",o=>{const s=gA(o.def.entries).filter(a=>zRe.has(typeof a));return new RegExp(s.length?`^(${s.map(a=>nc(a.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,s)=>{const a=o.value;return r.has(a)||o.issues.push({code:"invalid_value",values:n,input:a,inst:e}),o}}),l2e=te("$ZodLiteral",(e,t)=>{Zt.init(e,t);const n=new Set(t.values);e._zod.values=n,mt(e,"pattern",r=>{const o=r.def.values;return new RegExp(o.length?`^(${o.map(s=>typeof s=="string"?nc(s):s?nc(s.toString()):String(s)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(r,o)=>{const s=r.value;return n.has(s)||r.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),r}}),u2e=te("$ZodTransform",(e,t)=>{Zt.init(e,t),e._zod.optin="optional",So.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new dH(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(n.value=a,n));if(o instanceof Promise)throw new Ba;return n.value=o,n}});function e5(e,t){return e.value=t.issues.length?void 0:t.value,e}const RH=te("$ZodOptional",(e,t)=>{Zt.init(e,t),mt(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",mt(e,"values",n=>{const r=n.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),mt(e,"pattern",n=>{const r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${lT(r.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(n.value===void 0){if(t.innerType._zod.optin!=="defaulted")return n;const o=t.innerType._zod.run({value:n.value,issues:[]},r);return o instanceof Promise?o.then(s=>e5(n,s)):e5(n,o)}return t.innerType._zod.run(n,r)}}),c2e=te("$ZodExactOptional",(e,t)=>{RH.init(e,t),mt(e,"values",n=>n.def.innerType._zod.values),mt(e,"pattern",n=>n.def.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),d2e=te("$ZodNullable",(e,t)=>{Zt.init(e,t),mt(e,"optin",n=>n.def.innerType._zod.optin),mt(e,"optout",n=>n.def.innerType._zod.optout),mt(e,"pattern",n=>{const r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${lT(r.source)}|null)$`):void 0}),mt(e,"values",n=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),f2e=te("$ZodDefault",(e,t)=>{Zt.init(e,t),e._zod.optin="defaulted",mt(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>t5(s,t)):t5(o,t)}});function t5(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const h2e=te("$ZodPrefault",(e,t)=>{Zt.init(e,t),e._zod.optin="defaulted",mt(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),p2e=te("$ZodNonOptional",(e,t)=>{Zt.init(e,t),mt(e,"values",n=>{const r=n.def.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>n5(s,e)):n5(o,e)}});function n5(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function r5(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>Gi(o,r,Vo()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}const g2e=te("$ZodCatch",(e,t)=>{Zt.init(e,t),mt(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),mt(e,"optout",n=>n.def.innerType._zod.optout),mt(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run({value:n.value,issues:[]},r);return o instanceof Promise?o.then(s=>r5(n,s,t,r)):r5(n,o,t,r)}}),m2e=te("$ZodPipe",(e,t)=>{Zt.init(e,t),mt(e,"values",n=>n.def.in._zod.values),mt(e,"optin",n=>n.def.in._zod.optin),mt(e,"optout",n=>n.def.out._zod.optout),mt(e,"propValues",n=>n.def.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const s=t.out._zod.run(n,r);return s instanceof Promise?s.then(a=>zg(a,t.in,r)):zg(s,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(s=>zg(s,t.out,r)):zg(o,t.out,r)}});function zg(e,t,n){return e.issues.some(r=>r.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const v2e=te("$ZodReadonly",(e,t)=>{Zt.init(e,t),mt(e,"propValues",n=>n.def.innerType._zod.propValues),mt(e,"values",n=>n.def.innerType._zod.values),mt(e,"optin",n=>n.def.innerType?._zod?.optin),mt(e,"optout",n=>n.def.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(o5):o5(o)}});function o5(e){return e.memo||(e.value=Object.freeze(e.value)),e}const y2e=te("$ZodCustom",(e,t)=>{mr.init(e,t),Zt.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(s=>s5(s,n,r,e));s5(o,n,r,e)}});function s5(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(Gf(o))}}class b2e extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}const SA="~memo",i5=[];function TH(e){return e!==null&&typeof e=="object"}function u_(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}const OH=new WeakMap,Jd=0,Cm=1,gf=2;function Em(e,t,n){const r=OH.get(e);if(r!==void 0)return r?gf:Jd;if(t.has(e))return gf;t.add(e);let o=Jd;const s=h=>{if(o!==gf&&h?._zod){const g=Em(h,t);g>o&&(o=g)}},a=(h,g)=>{let m=Jd;for(const v of Reflect.ownKeys(h)){const w=Object.getOwnPropertyDescriptor(h,v);if(!w.enumerable)continue;const S=w.get?Cm:w.value?._zod?Em(w.value,t):Jd;S>m&&(m=S)}return m},u=h=>{h>o&&(o=h)},c=e._zod.def;switch(c.type){case"object":{const h=tH(c);u(h?a(h):Cm),s(c.catchall);break}case"array":s(c.element);break;case"tuple":for(const h of c.items)s(h);s(c.rest);break;case"record":case"map":s(c.keyType),s(c.valueType);break;case"set":s(c.valueType);break;case"union":for(const h of c.options)s(h);break;case"intersection":s(c.left),s(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":s(c.innerType);break;case"pipe":s(c.in),s(c.out);break;case"function":s(c.input),s(c.output);break;case"lazy":{const h=c._cachedInner??void 0;u(h?Em(h,t):Cm);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(const h in c){const g=Object.getOwnPropertyDescriptor(c,h);if(!g||g.get)continue;const m=g.value;if(!(!m||typeof m!="object")){if(m._zod)s(m);else if(Array.isArray(m))for(const v of m)s(v)}}}return t.delete(e),S2e(e,o)}function S2e(e,t){return t!==Cm&&OH.set(e,t===gf),t}function w2e(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}let jg;const Bg=[],C2e={alloc(e,t,n){const r=jg;if(!r)return n;jg=void 0;const o={value:n,issues:null};return r.set(t.value,o),Bg.push(o),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{const n=e._zod.parse,r=(o,s)=>{if(s.direction!=="backward"&&_2e(s,o.value))throw new b2e;return n(o,s)};e._zod.parse=r,e._zod.run===n&&(e._zod.run=r)})},attach(e){var t;let n,r=!1,o,s;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{const a=e._zod.parse,u=(c,f)=>{if(n===void 0){const E=Em(e,new Set);if(E===Jd)return e._zod.parse=a,e._zod.run===u&&(e._zod.run=a),a(c,f);E===gf||r?n=!0:r=!0}const h=c.value;if(!TH(h))return a(c,f);let g=f[SA];g||(g={buckets:new WeakMap,backEdges:void 0},f[SA]=g);let m;o===f?m=s:(m=w2e(g,e),o=f,s=m);const v=m.get(h);if(v)return c.value=v.value,v.issues?v.issues.length&&c.issues.push(...u_(v.issues)):(c.memo=!0,g.backEdges??(g.backEdges=new WeakSet),g.backEdges.add(v.value)),c;jg=m;const w=Bg.length,S=a(c,f);jg=void 0;const C=Bg.length>w?Bg.pop():void 0;return S instanceof Promise?S.then(E=>(C&&(C.issues=E.issues.length?u_(E.issues):i5),E)):(C&&(C.issues=S.issues.length?u_(S.issues):i5),S)};e._zod.parse=u,e._zod.run===a&&(e._zod.run=u)})}};function E2e(){return C2e}function _2e(e,t){const n=e[SA]?.backEdges;return n!==void 0&&TH(t)&&n.has(t)}const x2e=()=>{const e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(s){return e[s]??null}const n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};function o(s,a){return s==="number"&&typeof a=="number"&&!Number.isFinite(a)?String(a):r[s]??s}return s=>{switch(s.code){case"invalid_type":{const a=o(s.expected),u=QRe(s.input),c=o(u,s.input);return`Invalid input: expected ${a}, received ${c}`}case"invalid_value":return s.values.length===1?`Invalid input: expected ${iH(s.values[0])}`:`Invalid option: expected one of ${H6(s.values,"|")}`;case"too_big":{const a=s.exact?"exactly ":s.inclusive?"<=":"<",u=t(s.origin);return u?`Too big: expected ${s.origin??"value"} to have ${a}${s.maximum.toString()} ${u.unit??"elements"}`:`Too big: expected ${s.origin??"value"} to be ${a}${s.maximum.toString()}`}case"too_small":{const a=s.exact?"exactly ":s.inclusive?">=":">",u=t(s.origin);return u?`Too small: expected ${s.origin} to have ${a}${s.minimum.toString()} ${u.unit}`:`Too small: expected ${s.origin} to be ${a}${s.minimum.toString()}`}case"invalid_format":{const a=s;return a.format==="starts_with"?`Invalid string: must start with "${a.prefix}"`:a.format==="ends_with"?`Invalid string: must end with "${a.suffix}"`:a.format==="includes"?`Invalid string: must include "${a.includes}"`:a.format==="regex"?`Invalid string: must match pattern ${a.pattern}`:`Invalid ${n[a.format]??s.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${s.divisor}`;case"unrecognized_keys":return`Unrecognized key${s.keys.length>1?"s":""}: ${H6(s.keys,", ")}`;case"invalid_key":return`Invalid key in ${s.origin}`;case"invalid_union":return s.options&&Array.isArray(s.options)&&s.options.length>0?`Invalid discriminator value. Expected ${s.options.map(u=>`'${u}'`).join(" | ")}`:s.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${s.origin}`;default:return"Invalid input"}}};function A2e(){return{localeError:x2e()}}var a5;class I2e{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function R2e(){return new I2e}(a5=globalThis).__zod_globalRegistry??(a5.__zod_globalRegistry=R2e());const ef=globalThis.__zod_globalRegistry;function vT(e){return e.checks&&(e.checks=[...e.checks]),e}function T2e(e,t){return new e(vT({type:"string",..._e(t)}))}function MH(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,..._e(t)})}function O2e(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,..._e(t)})}function M2e(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,..._e(t)})}function P2e(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",..._e(t)})}function N2e(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",..._e(t)})}function k2e(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",..._e(t)})}function D2e(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,..._e(t)})}function L2e(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,..._e(t)})}function U2e(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,..._e(t)})}function $2e(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,..._e(t)})}function F2e(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,..._e(t)})}function z2e(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,..._e(t)})}function j2e(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,..._e(t)})}function B2e(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,..._e(t)})}function H2e(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,..._e(t)})}function q2e(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,..._e(t)})}function V2e(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,..._e(t)})}function W2e(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,..._e(t)})}function G2e(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,..._e(t)})}function K2e(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,..._e(t)})}function Z2e(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,..._e(t)})}function Y2e(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,..._e(t)})}function PH(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,..._e(t)})}function NH(e,t){return new e({type:"string",format:"date",check:"string_format",..._e(t)})}function Q2e(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,..._e(t)})}function X2e(e,t){return new e({type:"string",format:"duration",check:"string_format",..._e(t)})}function J2e(e,t){return new e(vT({type:"number",checks:[],..._e(t)}))}function s$e(e,t){return new e(vT({type:"number",coerce:!0,checks:[],..._e(t)}))}function eMe(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",..._e(t)})}function tMe(e,t){return new e({type:"boolean",..._e(t)})}function nMe(e){return new e({type:"unknown"})}function rMe(e,t){return new e({type:"never",..._e(t)})}function l5(e,t){return new mH({check:"less_than",..._e(t),value:e,inclusive:!1})}function c_(e,t){return new mH({check:"less_than",..._e(t),value:e,inclusive:!0})}function u5(e,t){return new vH({check:"greater_than",..._e(t),value:e,inclusive:!1})}function d_(e,t){return new vH({check:"greater_than",..._e(t),value:e,inclusive:!0})}function c5(e,t){return new tOe({check:"multiple_of",..._e(t),value:e})}function kH(e,t){return new rOe({check:"max_length",..._e(t),maximum:e})}function Cv(e,t){return new oOe({check:"min_length",..._e(t),minimum:e})}function DH(e,t){return new sOe({check:"length_equals",..._e(t),length:e})}function oMe(e,t){return new iOe({check:"string_format",format:"regex",..._e(t),pattern:e})}function sMe(e){return new aOe({check:"string_format",format:"lowercase",..._e(e)})}function iMe(e){return new lOe({check:"string_format",format:"uppercase",..._e(e)})}function aMe(e,t){return new uOe({check:"string_format",format:"includes",..._e(t),includes:e})}function lMe(e,t){return new cOe({check:"string_format",format:"starts_with",..._e(t),prefix:e})}function uMe(e,t){return new dOe({check:"string_format",format:"ends_with",..._e(t),suffix:e})}function Ec(e){return new fOe({check:"overwrite",tx:e})}function cMe(e){return Ec(t=>t.normalize(e))}function dMe(){return Ec(e=>e.trim())}function fMe(){return Ec(e=>e.toLowerCase())}function hMe(){return Ec(e=>e.toUpperCase())}function pMe(){return Ec(e=>$Re(e))}function gMe(e,t,n){return new e({type:"array",element:t,..._e(n)})}function mMe(e,t,n){return new e({type:"custom",check:"custom",fn:t,..._e(n)})}function vMe(e,t){const n=yMe(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(Gf(o,r.value,n._zod.def));else{const s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=r.value),s.inst??(s.inst=n),s.continue??(s.continue=!n._zod.def.abort),r.issues.push(Gf(s))}},e(r.value,r)),t);return n}function yMe(e,t){const n=new mr({check:"custom",..._e(t)});return n._zod.check=e,n}function mf(e,...t){for(const n of t)for(const r of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,r)&&Xi(e,r,n[r]);return e}function LH(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??ef,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function Zi(e,t,n,r,o){const s=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:r.path,message:o}):t.unrepresentable;if(s==="any")return!1;if(s===void 0||s==="throw")throw new Error(o);return Object.assign(n,s),!0}function dn(e,t,n={path:[],schemaPath:[]}){var r;const o=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;const a={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,a),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;const u=e._zod.toJSONSchema?.();if(u)a.schema=u;else{const h={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,h);else{const m=a.schema,v=t.processors[o.type];if(!v)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);v(e,t,m,h)}const g=e._zod.parent;g&&(a.ref||(a.ref=g),dn(g,t,h),t.seen.get(g).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&mf(a.schema,c),t.io==="input"&&qn(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&"_prefault"in a.schema&&((r=a.schema).default??(r.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function d5(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function UH(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;const r=new Map;for(const a of e.seen.entries()){const u=e.metadataRegistry.get(a[0])?.id;if(u){const c=r.get(u);if(c&&c!==a[0])throw new Error(`Duplicate schema id "${u}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(u,a[0])}}const o=a=>{const u=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const g=e.external.registry.get(a[0])?.id,m=e.external.uri??(w=>w);if(g)return{ref:m(g)};const v=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=v,{defId:v,ref:`${m("__shared")}#/${u}/${d5(v)}`}}const c="#",f=`${c}/${u}/`;if(a[1]===n&&!a[1].schema.id)return{ref:c};const h=a[1].schema.id??`__schema${e.counter++}`;return{defId:h,ref:f+d5(h)}},s=a=>{if(a[1].schema.$ref)return;const u=a[1],{ref:c,defId:f}=o(a);u.def={...u.schema},f&&(u.defId=f);const h=u.schema;for(const g in h)delete h[g];h.$ref=c};if(e.cycles==="throw")for(const a of e.seen.entries()){const u=a[1];if(u.cycle)throw new Error(`Cycle detected: #/${u.cycle?.join("/")}/<root>
|
|
212
212
|
|
|
213
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const a of e.seen.entries()){const u=a[1];if(t===a[0]){s(a);continue}if(e.external){const f=e.external.registry.get(a[0])?.id;if(t!==a[0]&&f){s(a);continue}}if(e.metadataRegistry.get(a[0])?.id){s(a);continue}if(u.cycle){s(a);continue}u.count>1&&e.reused==="ref"&&s(a)}e.external&&(e.sharedDefsExtractedFor=e.external)}function $H(e){const t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;const n=[];for(const r of t){if(!r||typeof r!="object")return;$H(r);const o=Object.keys(r);if(o.length!==1||o[0]!=="type")return;const s=r.type;for(const a of Array.isArray(s)?s:[s]){if(typeof a!="string")return;n.includes(a)||n.push(a)}}delete e.anyOf,e.type=n.length===1?n[0]:n}const FH=new Set(["type","properties","required","additionalProperties"]),f5=["oneOf","anyOf"];function h5(e){const t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function wA(e){const t=[];for(const s of e){if(typeof s!="object"||s.type!=="object")return null;for(const a in s)if(!FH.has(a))return null;t.push(s)}const n={},r=new Set;for(const s of t){for(const a in s.properties){if(Object.prototype.hasOwnProperty.call(n,a))continue;const u=[];for(const f of t){const h=f.properties?.[a]??h5(f);h!=null&&(u.some(g=>JSON.stringify(g)===JSON.stringify(h))||u.push(h))}const c=u.length===1?u[0]:wA(u)??{allOf:u};Xi(n,a,c)}for(const a of s.required??[])r.add(a)}const o={type:"object",properties:n};if(r.size&&(o.required=[...r]),t.every(s=>s.additionalProperties===!1))o.additionalProperties=!1;else{const s=[];for(const a of t){const u=h5(a);u&&!s.some(c=>JSON.stringify(c)===JSON.stringify(u))&&s.push(u)}s.length===1?o.additionalProperties=s[0]:s.length>1&&(o.additionalProperties={allOf:s})}return o}function bMe(e){const t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(const o of FH)if(o in e)return;const n=t.filter(o=>f5.some(s=>Array.isArray(o[s])));let r=null;if(!n.length)r=wA(t);else{const o=n[0],s=f5.find(c=>Array.isArray(o[c]));if(Object.keys(o).length!==1)return;const a=t.filter(c=>c!==o),u=o[s].map(c=>wA([...a,c]));if(u.some(c=>!c))return;r={[s]:u}}r&&(delete e.allOf,mf(e,r))}function zH(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=u=>{const c=e.seen.get(u);if(c.ref===null)return;const f=c.def??c.schema,h={...f},g=c.ref;if(c.ref=null,g){r(g);const v=e.seen.get(g),w=v.schema;if(w.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(f.allOf=f.allOf??[],f.allOf.push(w)):mf(f,w),mf(f,h),u._zod.parent===g)for(const C in f)C==="$ref"||C==="allOf"||C in h||delete f[C];if(w.$ref&&v.def)for(const C in f)C==="$ref"||C==="allOf"||C in v.def&&JSON.stringify(f[C])===JSON.stringify(v.def[C])&&delete f[C]}const m=u._zod.parent;if(m&&m!==g){r(m);const v=e.seen.get(m);if(v?.schema.$ref&&(f.$ref=v.schema.$ref,v.def))for(const w in f)w==="$ref"||w==="allOf"||w in v.def&&JSON.stringify(f[w])===JSON.stringify(v.def[w])&&delete f[w]}e.override({zodSchema:u,jsonSchema:f,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(const u of[...e.seen.entries()].reverse())r(u[0]);if(e.target!=="openapi-3.0")for(const u of e.seen.entries())$H(u[1].def??u[1].schema);for(const u of e.deferred)u();if(e.intersections.length){const u=new Map;for(const c of e.seen.values())for(const f of[c.schema,c.def]){const h=f?.allOf;if(!Array.isArray(h))continue;const g=u.get(h);g?g.push(f):u.set(h,[f])}for(const c of e.intersections)for(const f of u.get(c)??[])bMe(f)}}const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const u=e.external.registry.get(t)?.id;if(!u)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(u)}mf(o,n.defId?n.schema:n.def??n.schema);const s=e.metadataRegistry.get(t)?.id;s!==void 0&&o.id===s&&delete o.id;const a=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(const u of e.seen.entries()){const c=u[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,Xi(a,c.defId,c.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(a).length>0&&(e.target==="draft-2020-12"?o.$defs=a:o.definitions=a);try{const u=JSON.parse(JSON.stringify(o));return Object.defineProperty(u,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ev(t,"input",e.processors),output:Ev(t,"output",e.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function qn(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return qn(r.element,n);if(r.type==="set")return qn(r.valueType,n);if(r.type==="lazy")return qn(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault"||r.type==="catch")return qn(r.innerType,n);if(r.type==="intersection")return qn(r.left,n)||qn(r.right,n);if(r.type==="record"||r.type==="map")return qn(r.keyType,n)||qn(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:qn(r.in,n)||qn(r.out,n);if(r.type==="object"){for(const o in r.shape)if(qn(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(qn(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(qn(o,n))return!0;return!!(r.rest&&qn(r.rest,n))}return!1}const SMe=(e,t={})=>n=>{const r=LH({...n,processors:t});return dn(e,r),UH(r,e),zH(r,e)},Ev=(e,t,n={})=>r=>{const{libraryOptions:o,target:s}=r??{},a=LH({...o??{},target:s,io:t,processors:n});return dn(e,a),UH(a,e),zH(a,e)},rc=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},oc=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},p5=(e,t)=>{rc(e,"minimum",t),oc(e,"maximum",t)},jH=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},BH=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},HH=(e,t)=>{e.mime=e.mime?e.mime.filter(n=>t.includes(n)):[...t]},qH=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},g5=(e,t)=>rc(e,"minimum",t.minimum),m5=(e,t)=>oc(e,"maximum",t.maximum),v5=e=>(t,n)=>{qH(t,n.format);const[r,o]=e[n.format];rc(t,"minimum",r),oc(t,"maximum",o)},wMe={greater_than:(e,t)=>rc(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>oc(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>jH(e,t.value),number_format:v5(aH),bigint_format:v5(BRe),min_length:g5,max_length:m5,length_equals:(e,t)=>p5(e,t.length),min_size:g5,max_size:m5,size_equals:(e,t)=>p5(e,t.size),string_format:(e,t)=>{qH(e,t.format),t.pattern&&BH(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>HH(e,t.mime)};function mo(e){const t={},n=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(const s of r)wMe[s._zod.def.check]?.(t,s._zod.def);const o=e._zod.bag;o.minimum!==void 0&&rc(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&rc(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&oc(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&oc(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&jH(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&HH(t,o.mime);for(const s of o.patterns??[])BH(t,s);return t}const CMe={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},EMe=new Map([[_H,BTe],[mT,HTe]]),VH=e=>EMe.get(e)??e,_Me=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:s,maximum:a,format:u,patterns:c,contentEncoding:f,laxFormat:h}=mo(e);if(typeof s=="number"&&(o.minLength=s),typeof a=="number"&&(o.maxLength=a),u&&(o.format=CMe[u]??u,o.format===""&&delete o.format,(u==="time"||h)&&delete o.format),f&&(o.contentEncoding=f),c&&c.size>0){const g=[...c].map(VH);g.length===1?o.pattern=g[0].source:g.length>1&&(o.allOf=[...g.map(m=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},xMe=(e,t,n,r)=>{const o=n,{minimum:s,maximum:a,multipleOf:u,exclusiveMaximum:c,exclusiveMinimum:f,isInt:h}=mo(e);o.type=h?"integer":"number";const g=typeof f=="number"&&f>=(s??Number.NEGATIVE_INFINITY),m=typeof c=="number"&&c<=(a??Number.POSITIVE_INFINITY),v=t.target==="draft-04"||t.target==="openapi-3.0";if(g?v?(o.minimum=f,o.exclusiveMinimum=!0):o.exclusiveMinimum=f:typeof s=="number"&&(o.minimum=s),m?v?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c:typeof a=="number"&&(o.maximum=a),u){const w=new Set;for(const E of u)Number.isFinite(E)&&E!==0?w.add(Math.abs(E)):Zi(e,t,o,r,`A multipleOf divisor of ${E} cannot be represented in JSON Schema`);const[S,...C]=w;S!==void 0&&(o.multipleOf=S),C.length&&(o.allOf=[...o.allOf??[],...C.map(E=>({multipleOf:E}))])}},AMe=(e,t,n,r)=>{n.type="boolean"},IMe=(e,t,n,r)=>{n.not={}},RMe=(e,t,n,r)=>{},TMe=(e,t,n,r)=>{const o=e._zod.def,s=gA(o.entries);if(s.length===0){n.not={};return}s.every(a=>typeof a=="number")&&(n.type="number"),s.every(a=>typeof a=="string")&&(n.type="string"),n.enum=s},OMe=(e,t,n,r)=>{const o=e._zod.def;if(o.values.length===0){n.not={};return}const s=[];for(const a of o.values)if(a===void 0){if(Zi(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof a=="bigint"){if(Zi(e,t,n,r,"BigInt literals cannot be represented in JSON Schema"))return;s.push(Number(a))}else s.push(a);if(s.length!==0)if(s.length===1){const a=s[0];n.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[a]:n.const=a}else s.every(a=>typeof a=="number")&&(n.type="number"),s.every(a=>typeof a=="string")&&(n.type="string"),s.every(a=>typeof a=="boolean")&&(n.type="boolean"),s.every(a=>a===null)&&(n.type="null"),n.enum=s},MMe=(e,t,n,r)=>{Zi(e,t,n,r,"Custom types cannot be represented in JSON Schema")},PMe=(e,t,n,r)=>{Zi(e,t,n,r,"Transforms cannot be represented in JSON Schema")},NMe=(e,t,n,r)=>{const o=n,s=e._zod.def,{minimum:a,maximum:u}=mo(e);typeof a=="number"&&(o.minItems=a),typeof u=="number"&&(o.maxItems=u),o.type="array",o.items=dn(s.element,t,{...r,path:[...r.path,"items"]})};function _v(e){const t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?_v(t.out):t.type==="catch"?_v(t.innerType):e._zod.optin}const kMe=(e,t,n,r)=>{const o=n,s=e._zod.def,a=s.shape;if(Object.getOwnPropertySymbols(a).length&&Zi(e,t,o,r,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(const f in a)Xi(o.properties,f,dn(a[f],t,{...r,path:[...r.path,"properties",f]}));const c=[];for(const f of Object.keys(a)){const h=s.shape[f];(t.io==="input"?_v(h)===void 0:h._zod.optout===void 0)&&c.push(f)}c.length>0&&(o.required=c),s.catchall?._zod.def.type==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=dn(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},DMe=(e,t,n,r)=>{const o=e._zod.def,s=o.inclusive===!1,a=o.options.map((u,c)=>dn(u,t,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?n.oneOf=a:n.anyOf=a},LMe=(e,t,n,r)=>{const o=e._zod.def,s=dn(o.left,t,{...r,path:[...r.path,"allOf",0]}),a=dn(o.right,t,{...r,path:[...r.path,"allOf",1]}),u=f=>"allOf"in f&&Object.keys(f).length===1,c=[...u(s)?s.allOf:[s],...u(a)?a.allOf:[a]];n.allOf=c,t.intersections.push(c)};function CA(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);const w=e.get(t)?.def;if(!w)return t;const S=CA(e,w,n);return S===w?t:S}for(const w of["anyOf","oneOf"]){const S=t[w];if(!Array.isArray(S))continue;const C=S.map(E=>CA(e,E,n));C.some((E,A)=>E!==S[A])&&(t={...t,[w]:C})}const r=Array.isArray(t.type)?t.type:[t.type],o=!r.includes("string")&&r.some(w=>w==="number"||w==="integer"),s=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!s?.some(w=>typeof w=="number"))return t;const{minimum:a,maximum:u,exclusiveMinimum:c,exclusiveMaximum:f,multipleOf:h,format:g,id:m,...v}=t;return v.enum?v.enum=v.enum.map(w=>typeof w=="number"?String(w):w):typeof v.const=="number"&&(v.const=String(v.const)),o&&(v.type="string",s||(v.pattern=(r.includes("number")?hT:QTe).source)),v}const EA=new WeakMap;function UMe(e){const t=new Map;for(const r of e.seen.values())r.def&&!t.has(r.schema)&&t.set(r.schema,r);const n=new Map;for(const r of EA.get(e)??[]){const o=e.seen.get(r),s=(o?.def??o?.schema)?.propertyNames;if(!s||s===!0||n.has(s))continue;const a=CA(t,s,new Set);a!==s&&n.set(s,a)}if(n.size)for(const r of e.seen.values())for(const o of[r.schema,r.def]){const s=o&&n.get(o.propertyNames);s&&(o.propertyNames=s)}}const $Me=(e,t,n,r)=>{const o=n,s=e._zod.def;o.type="object";const a=s.keyType,u=mo(a).patterns;if(s.mode==="loose"&&u&&u.size>0){const h=dn(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const g of u)Xi(o.patternProperties,VH(g).source,h)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=dn(s.keyType,t,{...r,path:[...r.path,"propertyNames"]});let h=EA.get(t);h||(h=[],EA.set(t,h),t.deferred.push(()=>UMe(t))),h.push(e)}o.additionalProperties=dn(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}const c=a._zod.values,f=t.io==="input"&&_v(s.valueType)!==void 0;if(c&&!s.partial&&!f){const h=[...c].filter(g=>typeof g=="string"||typeof g=="number");h.length>0&&(o.required=h.map(String))}},FMe=(e,t,n,r)=>{const o=e._zod.def,s=dn(o.innerType,t,r),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},zMe=(e,t,n,r)=>{const o=e._zod.def;dn(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},yT=Symbol();function WH(e,t,n,r,o){let s=!1;const a=JSON.stringify(e,(u,c)=>typeof c!="bigint"?c:(s=!0,null));return s?(Zi(t,n,r,o,"BigInt defaults cannot be represented in JSON Schema"),yT):JSON.parse(a)}const jMe=(e,t,n,r)=>{const o=e._zod.def;dn(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType;const a=WH(o.defaultValue,e,t,n,r);a!==yT&&(n.default=a)},BMe=(e,t,n,r)=>{const o=e._zod.def;dn(o.innerType,t,r);const s=t.seen.get(e);if(s.ref=o.innerType,t.io!=="input")return;const a=WH(o.defaultValue,e,t,n,r);a!==yT&&(n._prefault=a)},HMe=(e,t,n,r)=>{const o=e._zod.def;dn(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{Zi(e,t,n,r,"Dynamic catch values are not supported in JSON Schema");return}n.default=a},qMe=(e,t,n,r)=>{const o=e._zod.def,s=o.in._zod.traits.has("$ZodTransform"),a=t.io==="input"?s?o.out:o.in:o.out;dn(a,t,r);const u=t.seen.get(e);u.ref=a},VMe=(e,t,n,r)=>{const o=e._zod.def;dn(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.readOnly=!0},GH=(e,t,n,r)=>{const o=e._zod.def;dn(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},y5=new WeakSet([Object.prototype,Error.prototype]);function Hg(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){const r=n(this);return Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0})}})}const WMe=(e,t)=>{uTe.init(e,t),e.name="ZodError";const n=Object.getPrototypeOf(e);y5.has(n)||(y5.add(n),Hg(n,"format",r=>o=>fTe(r,o)),Hg(n,"flatten",r=>o=>dTe(r,o)),Hg(n,"addIssue",r=>o=>{r.issues.push(o),r.message=JSON.stringify(r.issues,mA,2)}),Hg(n,"addIssues",r=>o=>{r.issues.push(...o),r.message=JSON.stringify(r.issues,mA,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},no=te("ZodError",WMe,void 0,{Parent:Error}),GMe=tb(no),KMe=nb(no),ZMe=dT(no),YMe=fT(no),QMe=yTe(no),XMe=bTe(no),JMe=STe(no),ePe=wTe(no),tPe=CTe(no),nPe=ETe(no),rPe=_Te(no),oPe=xTe(no);function sPe(){So.localeError||Vo(A2e())}function ob(){So.memoizer||Vo({memoizer:E2e()})}const Yt=te("ZodType",(e,t)=>(sPe(),Zt.init(e,t),e.def=t,e.type=t.type,e),{check(...e){const t=this.def;return this.clone(Rr(t,{checks:[...t.checks??[],...e.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Ji(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(JPe(e,t))},superRefine(e,t){return this.check(eNe(e,t))},overwrite(e){return this.check(Ec(e))},optional(){return w5(this)},exactOptional(){return zPe(this)},nullable(){return C5(this)},nullish(){return w5(C5(this))},nonoptional(e){return WPe(this,e)},array(){return JH(this)},or(e){return eq([this,e])},and(e){return DPe(this,e)},transform(e){return E5(this,FPe(e))},default(e){return HPe(this,e)},prefault(e){return VPe(this,e)},catch(e){return KPe(this,e)},pipe(e){return E5(this,e)},readonly(){return QPe(this)},describe(e){const t=this.clone();return ef.add(t,{description:e}),t},meta(...e){if(e.length===0)return ef.get(this);const t=this.clone();return ef.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return uH(this,"~standard",{...bH(this),jsonSchema:{input:Ev(this,"input"),output:Ev(this,"output")}})},set"~standard"(e){Ki(this,"~standard",e)},parse:function e(t,n){return GMe(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await KMe(this,t,n,{callee:e})},safeParse(e,t){return ZMe(this,e,t)},async safeParseAsync(e,t){return YMe(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Ki(this,"spa",e)},validate(e,t){return gTe(this,e,t)},validateAsync(e,t){return vTe(this,e,t)},encode:function e(t,n){return QMe(this,t,n,{callee:e})},decode:function e(t,n){return XMe(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await JMe(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await ePe(this,t,n,{callee:e})},safeEncode(e,t){return tPe(this,e,t)},safeDecode(e,t){return nPe(this,e,t)},async safeEncodeAsync(e,t){return rPe(this,e,t)},async safeDecodeAsync(e,t){return oPe(this,e,t)},toJSONSchema(e){return SMe(this,{})(e)},get description(){return ef.get(this)?.description},get _def(){return this._zod.def}}),KH=te("_ZodString",(e,t)=>{gT.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_Me(e,n,r)},cH({format:e=>mo(e).format??null,minLength:e=>mo(e).minimum??null,maxLength:e=>mo(e).maximum??null},{regex(...e){return this.check(oMe(...e))},includes(...e){return this.check(aMe(...e))},startsWith(...e){return this.check(lMe(...e))},endsWith(...e){return this.check(uMe(...e))},min(...e){return this.check(Cv(...e))},max(...e){return this.check(kH(...e))},length(...e){return this.check(DH(...e))},nonempty(...e){return this.check(Cv(1,...e))},lowercase(e){return this.check(sMe(e))},uppercase(e){return this.check(iMe(e))},trim(){return this.check(dMe())},normalize(...e){return this.check(cMe(...e))},toLowerCase(){return this.check(fMe())},toUpperCase(){return this.check(hMe())},slugify(){return this.check(pMe())}})),iPe=te("ZodString",(e,t)=>{gT.init(e,t),KH.init(e,t)},{email(e){return this.check(MH(QH,e))},url(e){return this.check(D2e(cPe,e))},jwt(e){return this.check(Y2e(xPe,e))},emoji(e){return this.check(L2e(dPe,e))},guid(e){return this.check(O2e(uPe,e))},uuid(e){return this.check(M2e(qg,e))},uuidv4(e){return this.check(P2e(qg,e))},uuidv6(e){return this.check(N2e(qg,e))},uuidv7(e){return this.check(k2e(qg,e))},nanoid(e){return this.check(U2e(fPe,e))},cuid(e){return this.check($2e(hPe,e))},cuid2(e){return this.check(F2e(pPe,e))},ulid(e){return this.check(z2e(gPe,e))},base64(e){return this.check(G2e(CPe,e))},base64url(e){return this.check(K2e(EPe,e))},xid(e){return this.check(j2e(mPe,e))},ksuid(e){return this.check(B2e(vPe,e))},ipv4(e){return this.check(H2e(yPe,e))},ipv6(e){return this.check(q2e(bPe,e))},cidrv4(e){return this.check(V2e(SPe,e))},cidrv6(e){return this.check(W2e(wPe,e))},e164(e){return this.check(Z2e(_Pe,e))},datetime(e){return this.check(PH(ZH,e))},date(e){return this.check(NH(YH,e))},time(e){return this.check(Q2e(aPe,e))},duration(e){return this.check(X2e(lPe,e))}});function Kn(e){return T2e(iPe,e)}const Qt=te("ZodStringFormat",(e,t)=>{Vt.init(e,t),KH.init(e,t)}),ZH=te("ZodISODateTime",(e,t)=>{POe.init(e,t),Qt.init(e,t)}),YH=te("ZodISODate",(e,t)=>{NOe.init(e,t),Qt.init(e,t)}),aPe=te("ZodISOTime",(e,t)=>{kOe.init(e,t),Qt.init(e,t)}),lPe=te("ZodISODuration",(e,t)=>{DOe.init(e,t),Qt.init(e,t)}),QH=te("ZodEmail",(e,t)=>{yOe.init(e,t),Qt.init(e,t)});function i$e(e){return MH(QH,e)}const uPe=te("ZodGUID",(e,t)=>{mOe.init(e,t),Qt.init(e,t)}),qg=te("ZodUUID",(e,t)=>{vOe.init(e,t),Qt.init(e,t)}),cPe=te("ZodURL",(e,t)=>{_Oe.init(e,t),Qt.init(e,t)}),dPe=te("ZodEmoji",(e,t)=>{xOe.init(e,t),Qt.init(e,t)}),fPe=te("ZodNanoID",(e,t)=>{AOe.init(e,t),Qt.init(e,t)}),hPe=te("ZodCUID",(e,t)=>{IOe.init(e,t),Qt.init(e,t)}),pPe=te("ZodCUID2",(e,t)=>{ROe.init(e,t),Qt.init(e,t)}),gPe=te("ZodULID",(e,t)=>{TOe.init(e,t),Qt.init(e,t)}),mPe=te("ZodXID",(e,t)=>{OOe.init(e,t),Qt.init(e,t)}),vPe=te("ZodKSUID",(e,t)=>{MOe.init(e,t),Qt.init(e,t)}),yPe=te("ZodIPv4",(e,t)=>{LOe.init(e,t),Qt.init(e,t)}),bPe=te("ZodIPv6",(e,t)=>{$Oe.init(e,t),Qt.init(e,t)}),SPe=te("ZodCIDRv4",(e,t)=>{FOe.init(e,t),Qt.init(e,t)}),wPe=te("ZodCIDRv6",(e,t)=>{jOe.init(e,t),Qt.init(e,t)}),CPe=te("ZodBase64",(e,t)=>{BOe.init(e,t),Qt.init(e,t)}),EPe=te("ZodBase64URL",(e,t)=>{qOe.init(e,t),Qt.init(e,t)}),_Pe=te("ZodE164",(e,t)=>{VOe.init(e,t),Qt.init(e,t)}),xPe=te("ZodJWT",(e,t)=>{GOe.init(e,t),Qt.init(e,t)}),XH=te("ZodNumber",(e,t)=>{xH.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>xMe(e,n,r,o),e.isFinite=!0},cH({minValue:e=>{const{minimum:t,exclusiveMinimum:n}=mo(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:e=>{const{maximum:t,exclusiveMaximum:n}=mo(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:e=>{const{isInt:t,multipleOf:n}=mo(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>mo(e).format??null},{gt(e,t){return this.check(u5(e,t))},gte(e,t){return this.check(d_(e,t))},min(e,t){return this.check(d_(e,t))},lt(e,t){return this.check(l5(e,t))},lte(e,t){return this.check(c_(e,t))},max(e,t){return this.check(c_(e,t))},int(e){return this.check(b5(e))},safe(e){return this.check(b5(e))},positive(e){return this.check(u5(0,e))},nonnegative(e){return this.check(d_(0,e))},negative(e){return this.check(l5(0,e))},nonpositive(e){return this.check(c_(0,e))},multipleOf(e,t){return this.check(c5(e,t))},step(e,t){return this.check(c5(e,t))},finite(){return this}}));function _A(e){return J2e(XH,e)}const APe=te("ZodNumberFormat",(e,t)=>{KOe.init(e,t),XH.init(e,t)});function b5(e){return eMe(APe,e)}const IPe=te("ZodBoolean",(e,t)=>{ZOe.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>AMe(e,n,r)});function bT(e){return tMe(IPe,e)}const RPe=te("ZodUnknown",(e,t)=>{YOe.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>RMe()});function xv(){return nMe(RPe)}const TPe=te("ZodNever",(e,t)=>{QOe.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>IMe(e,n,r)});function OPe(e){return rMe(TPe,e)}const MPe=te("ZodArray",(e,t)=>{ob(),e2e.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>NMe(e,n,r,o),e.element=t.element},{min(e,t){return this.check(Cv(e,t))},nonempty(e){return this.check(Cv(1,e))},max(e,t){return this.check(kH(e,t))},length(e,t){return this.check(DH(e,t))},unwrap(){return this.element}});function JH(e,t){return gMe(MPe,e,t)}const PPe=te("ZodObject",(e,t)=>{ob(),r2e.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>kMe(e,n,r,o),nTe(e,"shape",n=>n._zod.def.shape,!1)},{keyof(){return ST(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(Rr(this._zod.def,{catchall:e}))},passthrough(){return this.clone(Rr(this._zod.def,{catchall:xv()}))},loose(){return this.clone(Rr(this._zod.def,{catchall:xv()}))},strict(){return this.clone(Rr(this._zod.def,{catchall:OPe()}))},strip(){return this.clone(Rr(this._zod.def,{catchall:void 0}))},extend(e){return VRe(this,e)},safeExtend(e){return WRe(this,e)},merge(e){return GRe(this,e)},pick(e){return HRe(this,e)},omit(e){return qRe(this,e)},partial(...e){return q6(tq,this,e[0])},exactPartial(...e){return q6(nq,this,e[0],"exactPartial")},required(...e){return KRe(rq,this,e[0])}});function wo(e,t){const n={type:"object",shape:e??{},..._e(t)};return new PPe(n)}const NPe=te("ZodUnion",(e,t)=>{o2e.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>DMe(e,n,r,o),e.options=t.options});function eq(e,t){return new NPe({type:"union",options:e,..._e(t)})}const kPe=te("ZodIntersection",(e,t)=>{s2e.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>LMe(e,n,r,o)});function DPe(e,t){return new kPe({type:"intersection",left:e,right:t})}const S5=te("ZodRecord",(e,t)=>{ob(),i2e.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$Me(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function LPe(e,t,n){return!t||!t._zod?new S5({type:"record",keyType:Kn(),valueType:e,..._e(t)}):new S5({type:"record",keyType:e,valueType:t,..._e(n)})}const xA=te("ZodEnum",(e,t)=>{a2e.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(r,o,s)=>TMe(e,r,o),e.enum=t.entries,e.options=[...e._zod.values];const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const s={};for(const a of r)if(n.has(a))s[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new xA({...t,checks:[],..._e(o),entries:s})},e.exclude=(r,o)=>{const s={...t.entries};for(const a of r)if(n.has(a))delete s[a];else throw new Error(`Key ${a} not found in enum`);return new xA({...t,checks:[],..._e(o),entries:s})}});function ST(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new xA({type:"enum",entries:n,..._e(t)})}const UPe=te("ZodLiteral",(e,t)=>{l2e.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>OMe(e,n,r,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function vl(e,t){return new UPe({type:"literal",values:Array.isArray(e)?e:[e],..._e(t)})}const $Pe=te("ZodTransform",(e,t)=>{ob(),u2e.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>PMe(e,n,r,o),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new dH(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(Gf(s,n.value,t));else{const a=s;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),"input"in a||(a.input=n.value),a.inst??(a.inst=e),n.issues.push(Gf(a))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n)):(n.value=o,n)}});function FPe(e){return new $Pe({type:"transform",transform:e})}const tq=te("ZodOptional",(e,t)=>{RH.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>GH(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function w5(e){return new tq({type:"optional",innerType:e})}const nq=te("ZodExactOptional",(e,t)=>{c2e.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>GH(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function zPe(e){return new nq({type:"optional",innerType:e})}const jPe=te("ZodNullable",(e,t)=>{d2e.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>FMe(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function C5(e){return new jPe({type:"nullable",innerType:e})}const BPe=te("ZodDefault",(e,t)=>{f2e.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>jMe(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function HPe(e,t){return new BPe({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():sH(t)}})}const qPe=te("ZodPrefault",(e,t)=>{h2e.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>BMe(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function VPe(e,t){return new qPe({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():sH(t)}})}const rq=te("ZodNonOptional",(e,t)=>{p2e.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>zMe(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function WPe(e,t){return new rq({type:"nonoptional",innerType:e,..._e(t)})}const GPe=te("ZodCatch",(e,t)=>{g2e.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>HMe(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function KPe(e,t){return new GPe({type:"catch",innerType:e,catchValue:typeof t=="function"?t:oTe(t)})}const ZPe=te("ZodPipe",(e,t)=>{m2e.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qMe(e,n,r,o),e.in=t.in,e.out=t.out});function E5(e,t){return new ZPe({type:"pipe",in:e,out:t})}const YPe=te("ZodReadonly",(e,t)=>{v2e.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>VMe(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function QPe(e){return new YPe({type:"readonly",innerType:e})}const XPe=te("ZodCustom",(e,t)=>{y2e.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>MMe(e,n,r,o)});function JPe(e,t={}){return mMe(XPe,e,t)}function eNe(e,t){return vMe(e,t)}function tNe(e){return PH(ZH,e)}function nNe(e){return NH(YH,e)}wo({kind:vl("Boolean"),value:bT()});wo({kind:vl("String"),value:Kn()});wo({kind:vl("Number"),value:_A()});wo({kind:vl("StringList"),value:JH(Kn())});wo({kind:vl("Map"),value:LPe(Kn(),Kn())});wo({kind:vl("MutedFlag"),value:wo({value:bT(),setAt:_A(),setBy:Kn().optional(),expiresAt:_A().optional(),reason:Kn().optional()})});const rNe=e=>e.hierarchyDelimiter.length===0?[e.fullPath]:e.fullPath.split(e.hierarchyDelimiter),Kf=e=>{const t=rNe(e);return t[t.length-1]||e.fullPath},oNe=(e,t)=>{switch(e.kind){case"appointed":case"flagged":return{allowed:!0,mailbox:e.mailbox};case"proposed":return t==="resolved"?{allowed:!0,mailbox:e.mailbox}:{allowed:!1,reason:"unconfirmed"};case"appointment_stale":return{allowed:!1,reason:"stale"};default:return{allowed:!1,reason:"none"}}},sNe=(e,t)=>oNe(e,t).allowed,iNe={[ru.Appointed]:{kind:"appointed",mailbox:null},[ru.Flagged]:{kind:"flagged",mailbox:null},[ru.Reserved]:{kind:"reserved",mailbox:null},[ru.Proposed]:{kind:"proposed",mailbox:null},[ru.Stale]:{kind:"appointment_stale",appointedMailboxId:"",fallback:{kind:"none"}},[ru.None]:{kind:"none"}},aNe=(e,t)=>sNe(iNe[e],t),wT=()=>typeof navigator<"u"&&(navigator.language||navigator.languages?.[0])||"en-US",Wo=(e,t)=>new Intl.NumberFormat(wT(),t).format(e),lNe=/^-?\d+$/,CT=e=>{if(e instanceof Date)return e;if(typeof e=="number")return new Date(e);if(typeof e=="string"){const t=e.trim();return lNe.test(t)?new Date(Number(t)):new Date(t)}return new Date(Number.NaN)},ET=e=>Number.isFinite(e.getTime()),tf=(e,t)=>{const n=CT(e);return ET(n)?new Intl.DateTimeFormat(wT(),t).format(n):""},oq=(e,t)=>tf(e,{short:{month:"short",day:"numeric"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"},time:{hour:"numeric",minute:"numeric"},datetime:{month:"short",day:"numeric",hour:"numeric",minute:"numeric"}}[t]),a$e=e=>{const t=CT(e);if(!ET(t))return"";const n=new Intl.RelativeTimeFormat(wT(),{numeric:"auto"}),r=Date.now(),o=t.getTime()-r,s=Math.round(o/1e3),a=Math.round(o/(1e3*60)),u=Math.round(o/(1e3*60*60)),c=Math.round(o/(1e3*60*60*24)),f=Math.round(o/(1e3*60*60*24*7));return Math.abs(s)<60?n.format(s,"second"):Math.abs(a)<60?n.format(a,"minute"):Math.abs(u)<24?n.format(u,"hour"):Math.abs(c)<7?n.format(c,"day"):Math.abs(f)<4?n.format(f,"week"):oq(t,"medium")},l$e=e=>{const t=CT(e);if(!ET(t))return"";const n=new Date,r=t.toDateString()===n.toDateString(),o=new Date(n);o.setDate(o.getDate()-1);const s=t.toDateString()===o.toDateString(),a=new Date(n);a.setDate(a.getDate()-6);const u=t>=a&&t<n,c=t.getFullYear()===n.getFullYear();return r?tf(t,{hour:"numeric",minute:"numeric"}):s?"Yesterday":u?tf(t,{weekday:"long"}):c?tf(t,{month:"short",day:"numeric"}):tf(t,{month:"short",day:"numeric",year:"numeric"})},uNe=e=>`Move ${e===1?"1":Wo(e)} ${e===1?"message":"messages"} to Trash?`,u$e=({targets:e,trashByAccount:t,hasAppointments:n,isError:r})=>{if(r)return"unavailable";if(!n||e.length===0)return"unknown";let o=!1,s=!1;for(const a of e){if(a.accountId===void 0)return"unknown";const u=t.get(a.accountId);if(u===void 0)return"unknown";if(u.source==="Stale")return"staleTrash";if(u.mailboxId===void 0)return"noTrash";u.mailboxId===a.mailboxId&&(o=!0,aNe(u.source,"confirmed")||(s=!0))}return s?"unconfirmed":o?"permanent":"trash"},cNe=e=>e==="permanent"||e==="unconfirmed",c$e=(e,t,n={})=>{const r=e===1?"1":Wo(e),o=e===1?"message":"messages",{trashFolderLabel:s,staleFolderLabel:a}=n;if(t==="noTrash")return{title:`Can't delete ${r} ${o} yet`,description:"No folder on this account is set as Trash, so there is nowhere to move the mail. Nothing has been deleted.",confirmLabel:"Pick a Trash folder"};if(t==="staleTrash")return{title:`Can't delete ${r} ${o} yet`,description:a?`The folder you set as this account's Trash — ${a} — is gone from the mail server. Nothing has been deleted.`:"The folder you set as this account's Trash is gone from the mail server. Nothing has been deleted.",confirmLabel:"Pick another folder"};if(t==="unconfirmed"){const u=s?`reader files this account's deleted mail in ${s} because of its name — nobody confirmed it.`:"reader files this account's deleted mail in a folder it matched by name — nobody confirmed it.";return{title:"Confirm this account's Trash folder",description:e>0?`${u} Deleting ${r} ${o} there erases them from the mail server, and that cannot be restored. Nothing has been deleted.`:`${u} Emptying a folder erases everything in it from the mail server, and that cannot be restored. Nothing has been emptied.`,confirmLabel:"Confirm the folder"}}return t==="unavailable"?{title:`Can't delete ${r} ${o}`,description:"reader couldn't read this account's folder settings, so it can't say whether this would move the mail to Trash or erase it. Nothing has been deleted.",confirmLabel:"Sign in again"}:t==="unknown"?{title:`Delete ${r} ${o}?`,description:"Checking where this account files deleted mail…",confirmLabel:"Delete"}:t==="permanent"?{title:`Permanently delete ${r} ${o}?`,description:"They are erased from the mail server and cannot be restored.",confirmLabel:"Delete permanently"}:{title:uNe(e),description:"You can restore them from Trash later.",confirmLabel:"Move to Trash"}},dNe={delete:(e,t)=>`Deleting ${e} of ${t}…`,move:(e,t)=>`Moving ${e} of ${t}…`,markRead:(e,t)=>`Marking ${e} of ${t} as read…`},fNe={delete:"moved to Trash",move:"moved",markRead:"marked as read"},sq=(e,t)=>e==="delete"&&cNe(t)?"permanently deleted":fNe[e],hNe={delete:"couldn't be deleted",move:"couldn't be moved",markRead:"couldn't be marked as read"},pNe={delete:"Couldn't delete these messages",move:"Couldn't move these messages",markRead:"Couldn't mark these messages as read"},gNe={delete:"The delete didn't finish.",move:"The move didn't finish.",markRead:"The update didn't finish."},d$e=(e,t,n)=>dNe[e](Wo(t),Wo(n)),mNe=(e,t,n="trash")=>`${Wo(t)} ${sq(e,n)}. Your mail server is still catching up.`,vNe=e=>`Stopped after ${Wo(e)}`,yNe=(e,t,n,r="trash")=>`${Wo(t)} of ${Wo(n)} ${sq(e,r)}. The rest were not sent, apart from the ones already on their way when you stopped — those may still have gone through.`,_5=(e,t)=>t>0?`Stopped after ${Wo(t)} — some messages ${hNe[e]}`:pNe[e],bNe=e=>gNe[e],SNe={delete:e=>`A delete of ${e} messages`,move:e=>`A move of ${e} messages`,markRead:e=>`Marking ${e} messages as read`},wNe=(e,t,n)=>`${SNe[e](Wo(t))}${n?` in ${n}`:""} is still running — stop it first.`,f$e=e=>e==="delete"?"danger":"info",h$e=(e,t,n,r)=>n.error!==void 0?null:n.cancelled?{severity:"warning",title:vNe(n.done),detail:yNe(e,n.done,t,r)}:{severity:"info",title:mNe(e,n.done,r)},iq=100,CNe=(e,t)=>e.kind==="move"?[t,e.destinationMailboxId]:[t],ENe=new AbortController().signal,AA=async e=>e.then(t=>({ok:!0,value:t}),t=>({ok:!1,error:t})),_Ne=(e,t=iq)=>{if(e.length===0)return[];const n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n},xNe=(e,t=iq)=>{const n=new Map;for(const r of e){const o=n.get(r.accountId);if(o){o.push(r.id);continue}n.set(r.accountId,[r.id])}return[...n.values()].flatMap(r=>_Ne(r,t))},aq=async(e,t,n,r)=>{const o=xNe(e),s=e.length;let a=0,u=0;const c=[];for(let f=0;f<o.length;f++){if(r.aborted)return c.push(...o.slice(f).flat()),{done:a,failedIds:c,refused:u,cancelled:!0};const h=o[f],g=await AA(t(h,r));if(!g.ok)return c.push(...o.slice(f).flat()),r.aborted?{done:a,failedIds:c,refused:u,cancelled:!0}:(n({done:a,total:s}),{done:a,failedIds:c,refused:u,cancelled:!1,error:g.error});u+=g.value?.failureCount??0,a+=h.length,n({done:a,total:s})}return{done:a,failedIds:c,refused:u,cancelled:!1}},p$e=async(e,t)=>{await aq(e.map(n=>({id:n,accountId:void 0})),async n=>(await t(n),{successCount:n.length,failureCount:0}),()=>{},ENe)},ANe=async(e,t,n,r,o)=>{let s=0,a=0;const u=[];let c;do{if(o.aborted)return{done:s,failedIds:u,refused:a,cancelled:!0};const f=await AA(e(c,o));if(!f.ok)return o.aborted?{done:s,failedIds:u,refused:a,cancelled:!0}:{done:s,failedIds:u,refused:a,cancelled:!1,error:f.error};const h=f.value;if(h.ids.length>0){const g=await AA(n(h.ids,o));if(!g.ok)return o.aborted?{done:s,failedIds:u,refused:a,cancelled:!0}:{done:s,failedIds:u,refused:a,cancelled:!1,error:g.error};a+=g.value?.failureCount??0,s+=h.ids.length,r({done:s,total:t})}c=h.continuationToken}while(c);return{done:s,failedIds:u,refused:a,cancelled:!1}},INe=e=>({done:e.done,total:Math.max(e.total,e.done)}),RNe=e=>typeof e=="object"&&e!==null&&Array.isArray(e.pages),TNe=e=>typeof e=="object"&&e!==null&&Array.isArray(e.items),ONe=(e,t)=>e===void 0?e:RNe(e)?{...e,pages:e.pages.map(n=>({...n,items:t(n.items)}))}:TNe(e)?{...e,items:t(e.items)}:e,MNe=e=>{const t=[];for(const n of new Set(e))t.push(fRe({path:{mailboxId:n}})),t.push(QB({path:{mailboxId:n}}));return t.push(JB()),t},g$e=(e,t)=>Promise.all(t.map(n=>e.cancelQueries({queryKey:n}))),m$e=(e,t)=>t.flatMap(n=>e.getQueriesData({queryKey:n})).filter(n=>n[1]!==void 0).map(([n,r])=>({queryKey:n,data:r})),v$e=(e,t,n)=>{const r=o=>ONe(o,n);for(const o of t)e.setQueriesData({queryKey:o},r)},y$e=(e,t)=>{for(const n of t)e.setQueryData(n.queryKey,n.data)},PNe=(e,t)=>{for(const n of t)e.invalidateQueries({queryKey:n})},lq=_.createContext(void 0),NNe=e=>{if(e.action)return e.action;if((e.severity??"error")==="error")return{label:"Report an issue",href:sh(Hu({title:`Bug: ${e.title}`,errorMessage:e.detail?`${e.title} — ${e.detail}`:e.title,stack:e.error instanceof Error?e.error.stack:void 0}))}},kNe=()=>{const e=_.useContext(lq);if(!e)throw new Error("useErrorBanners must be used within an ErrorBannerProvider");return e},x5=5,DNe=(e,t,n)=>({title:e,detail:uq(n)??t,error:n}),uq=e=>{if(e!=null){if(e instanceof Error)return e.message||void 0;if(typeof e=="string")return e||void 0;if(typeof e=="object"&&"message"in e&&typeof e.message=="string")return e.message||void 0}},b$e=e=>il(e)?.code==="message_gone_from_server",S$e=e=>{const t=uq(e);return t?t.startsWith("Message not found"):!1},LNe=(e,t,n)=>e.severity===n&&e.title===t.title&&e.detail===t.detail,UNe=(e,t)=>{const r=[...e.filter(o=>!LNe(o,{title:t.title,detail:t.detail,severity:t.severity},t.severity)),t];return r.length<=x5?r:r.slice(r.length-x5)},$Ne=(e,t)=>e.filter(n=>n.id!==t),FNe=(e,t,n)=>({id:t,severity:e.severity??"error",title:e.title,detail:e.detail,action:e.action,createdAt:n}),zNe=new Set(["none","stale","unconfirmed"]),jNe=new Set(Object.values(ure)),f_=(e,t)=>{const n=e?.[t];return typeof n=="string"?n:void 0},BNe=e=>{const t=il(e);if(t?.code!=="folder_role_unresolved")return;const{details:n}=t;if(!n)return;const r=f_(n,"reason"),o=f_(n,"role"),s=f_(n,"accountId");if(!(!r||!zNe.has(r))&&!(!o||!jNe.has(o)||!s))return{reason:r,role:o,accountId:s}},HNe=e=>il(e)?.code==="mailbox_not_settled",qNe=3e4,VNe=1e3,WNe="The folder couldn't be created on the mail server. Please try again.",GNe="The folder was created but the mail server hasn't confirmed it yet, so nothing was attached to it. It's in your folder list — try again in a moment.",KNe=(e,t)=>new Promise((n,r)=>{if(t?.aborted){r(t.reason);return}const o=setTimeout(()=>{t?.removeEventListener("abort",s),n()},e),s=()=>{clearTimeout(o),r(t?.reason)};t?.addEventListener("abort",s,{once:!0})});async function ZNe({fetchMailboxes:e,mailboxId:t,signal:n,timeoutMs:r=qNe,pollIntervalMs:o=VNe,delay:s=KNe,now:a=Date.now}){const u=a()+r;for(;;){n?.throwIfAborted();const f=(await e()).find(h=>h.mailboxId===t);if(f?.syncStatus===ck.synced)return f;if(f?.syncStatus===ck.failed)throw new Error(WNe);if(a()>=u)throw new Error(GNe);await s(o,n)}}function cq(e,t){const n=e.trim();return t?`${t.fullPath}${t.hierarchyDelimiter}${n}`:n}const A5=(e,t)=>{const n=t.length===0?[e]:e.split(t);return n[0]?.toLowerCase()==="inbox"&&(n[0]="INBOX"),n.join(t)};function YNe({name:e,delimiter:t,parent:n,existingPaths:r}){const o=e.trim();if(o==="")return"Enter a folder name.";if(t.length>0&&o.includes(t))return`A folder name can't contain "${t}".`;const s=A5(cq(o,n),t);if(r.some(u=>A5(u,t)===s))return"A folder with that name already exists."}function QNe(e){const t=dl(),{data:n}=Ja({...hA({path:{accountId:e??""}}),enabled:!!e}),r=lR({...JIe(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:sT({path:{accountId:e}})})}}),o=_.useRef(new Map),s=_.useCallback(async(u,c,f)=>{if(!e)throw new Error("No account to create the folder in. Pick messages from a single account first.");const h=n?.items??[],g=c?h.find(C=>C.fullPath===c):void 0;if(c&&!g)throw new Error(`Couldn't find the folder "${c}" to create this one inside.`);const m=g?{fullPath:g.fullPath,hierarchyDelimiter:g.hierarchyDelimiter}:void 0,v=cq(u,m);let w=o.current.get(v);if(!w){const C=m?.hierarchyDelimiter??h[0]?.hierarchyDelimiter??"/",E=YNe({name:u,delimiter:C,parent:m,existingPaths:h.map(I=>I.fullPath)});if(E)throw new Error(E);w=(await r.mutateAsync({path:{accountId:e},body:{fullPath:v,namespaceType:"personal"}})).mailboxId,o.current.set(v,w)}const S=await ZNe({mailboxId:w,signal:f,fetchMailboxes:async()=>(await t.fetchQuery({...hA({path:{accountId:e}}),staleTime:0})).items??[]});return o.current.delete(v),{id:S.mailboxId,label:Kf(S),path:S.fullPath}},[r,e,n,t]);return{createFolder:_.useCallback((u,c)=>s(u,"",c),[s]),createFolderIn:s,mutation:r}}const XNe=()=>{const{t:e}=KB("mail",{useSuspense:!1});return _.useCallback((t,n)=>e(t,{defaultValue:n}),[e])},h_={Inbox:"inbox",Drafts:"drafts",Sent:"sent",Archive:"archive",Junk:"junk",Trash:"trash",All:"all",Flagged:"flagged"},w$e={inbox:"Inbox",drafts:"Drafts",sent:"Sent",archive:"Archive",junk:"Junk",trash:"Trash",all:"All",flagged:"Flagged"},Zf=["inbox","flagged","drafts","sent","archive","all","junk","trash"];function sb(e){const t=new Map,n=[...e].sort((r,o)=>Zf.indexOf(h_[r.role])-Zf.indexOf(h_[o.role]));for(const r of n){if(!r.mailboxId||t.has(r.mailboxId))continue;const o=h_[r.role];o&&t.set(r.mailboxId,o)}return t}function dq(e,t,n){const r=e.displayNameOverride?.trim();if(r)return r;const o=Kf(e);return!t||!n?o:n(`sidebar.${t}`,o)}const JNe=new Set(["sent","drafts","trash"]),C$e=e=>e===void 0||!JNe.has(e),E$e=100,eke=e=>e.trim().toLowerCase()==="inbox",tke=(e,t)=>{if(e.hierarchyDelimiter.length===0)return!1;const n=`${e.fullPath}${e.hierarchyDelimiter}`;return t.some(r=>r.mailboxId!==e.mailboxId&&r.fullPath.startsWith(n))},nke=["Appointed","Flagged","Reserved"],rke=(e,t)=>e.mailboxId!==t.mailboxId?!1:e.source==="Stale"?t.specialUse?.includes(e.role)??!1:nke.includes(e.source),oke=(e,t)=>t.find(n=>rke(n,e))?.role;function _$e(e,t,n){if(eke(e.fullPath))return{deletable:!1,reason:"inbox",message:"The inbox can't be deleted."};const r=oke(e,n);return r?{deletable:!1,reason:"role",message:`This folder is your ${r} folder. Reassign that role before deleting it.`}:tke(e,t)?{deletable:!1,reason:"children",message:"This folder has subfolders. Delete them first."}:{deletable:!0}}function ske(e,t){return e.filter(n=>n.mailboxId!==t)}function x$e(e){return{total:e,moved:0,phase:e===0?"moved":"moving"}}function A$e(e,t){if(e.phase!=="moving")return e;const n=Math.min(e.total,e.moved+Math.max(0,t));return{...e,moved:n,phase:n>=e.total?"moved":"moving"}}function I$e(e,t){return{...e,phase:"failed",error:t}}function R$e(e){return`Moved ${e.moved} of ${e.total}`}function T$e(e){const t=Math.max(0,Math.floor(e/1e3));return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function O$e(e){return e>0?"choose-fate":"confirm-empty"}const ike=new Set(["outbox","postvak uit","boîte d'envoi","postausgang","buzón de salida","posta in uscita","送信トレイ","送件匣","发件箱","skrzynka nadawcza"]),ake=e=>{const t=Kf(e).trim().toLowerCase();return ike.has(t)},I5=Zf.length,lke=(e,t)=>{const n=sb(t);return[...e.filter(o=>{const s=n.get(o.mailboxId);return s==="drafts"||s==="sent"?!1:!ake(o)})].sort((o,s)=>{const a=n.has(o.mailboxId)?Zf.indexOf(n.get(o.mailboxId)??"inbox"):I5,u=n.has(s.mailboxId)?Zf.indexOf(n.get(s.mailboxId)??"inbox"):I5;return a!==u?a-u:Kf(o).localeCompare(Kf(s),void 0,{sensitivity:"base",numeric:!0})})},uke=e=>e[0]?.hierarchyDelimiter??"/",cke=({mailboxes:e,folderAppointments:t,currentMailboxId:n,excludeMailboxId:r,translator:o})=>{const s=lke(e,t),a=sb(t);return(r?ske(s,r):s).map(c=>({id:c.mailboxId,label:dq(c,a.get(c.mailboxId),o),path:c.fullPath,isCurrent:c.mailboxId===n,messageCount:c.messageCount}))},fq=_.createContext(void 0),R5=Symbol("appoint-failed"),dke=({children:e})=>{const t=dl(),n=XNe(),[r,o]=_.useState(null),[s,a]=_.useState(),[u,c]=_.useState({kind:"choosing"}),f=r?.accountId,{data:h}=Ja({...iT(),staleTime:1/0,enabled:!!f}),{data:g}=Ja({...hA({path:{accountId:f??""}}),enabled:!!f}),{createFolderIn:m}=QNe(f),v=lR({...QIe(),meta:ny(409)}),w=h?.accounts.find(D=>D.accountId===f),S=_.useMemo(()=>g?.items??[],[g]),C=_.useMemo(()=>w?.folderAppointments??[],[w]),E=_.useMemo(()=>cke({mailboxes:S,folderAppointments:C,translator:n}),[S,C,n]),A=C.find(D=>D.role===r?.role),I=r?.guessedMailboxId??A?.mailboxId,T=S.find(D=>D.mailboxId===I),N=r?.trashFolderLabel??(T?dq(T,sb(C).get(T.mailboxId),n):void 0),M=_.useRef(null),R=_.useCallback(()=>{M.current=null,o(null),a(void 0),c({kind:"choosing"})},[]),k=_.useCallback(D=>{M.current=D,o(D),c({kind:"choosing"}),a(D.reason==="unconfirmed"?D.guessedMailboxId:void 0)},[]),L=_.useCallback(D=>{M.current===D&&R()},[R]),q=_.useCallback(D=>{r&&(c({kind:"appointing"}),v.mutateAsync({path:{accountId:r.accountId,role:r.role},body:{mailboxId:D}}).catch(j=>(c({kind:"appoint-failed",cause:HNe(j)?"mailbox-pending":"generic"}),R5)).then(async j=>{j!==R5&&(await t.invalidateQueries({queryKey:YB()}),c({kind:"acting"}),await r.onAppointed(),L(r))}).catch(()=>L(r)))},[r,v,t,L]),$=_.useMemo(()=>({requestAppointment:k}),[k]);return O.jsxs(fq.Provider,{value:$,children:[e,r&&O.jsx(gre,{open:!0,reason:r.reason,action:r.action,folders:E,delimiter:uke(S),trashFolderLabel:N,guessedMailboxId:I,staleFolderLabel:r.staleFolderLabel??A?.staleAppointmentPath,accountEmail:(h?.accounts.length??0)>1?w?.email:void 0,phase:u,selectedId:s,onSelect:a,onCreateFolder:m,onConfirm:q,onCancel:R})]})},fke=()=>{const e=_.useContext(fq);if(!e)throw new Error("useRoleAppointmentPrompt must be used within a RoleAppointmentPromptProvider");return e},hq=_.createContext(void 0),hke=({children:e})=>{const[t,n]=_.useState(void 0),r=_.useRef(void 0),o=_.useRef(void 0),s=_.useRef(void 0),a=_.useRef(new Set),u=dl(),{pushError:c}=kNe(),{requestAppointment:f}=fke(),h=_.useRef(async()=>({kind:"ran",outcome:{done:0,failedIds:[],refused:0,cancelled:!1}})),g=_.useCallback(S=>{PNe(u,MNe(CNe(S.action,S.mailboxId)));const C=new Set;if(S.accountId&&C.add(S.accountId),S.source.kind==="targets")for(const E of S.source.targets)E.accountId&&C.add(E.accountId);for(const E of C)u.invalidateQueries({queryKey:sT({path:{accountId:E}})})},[u]),m=_.useCallback(async S=>{const C=s.current;if(C)return{kind:"refused",reason:wNe(C.action.kind,C.matched,C.mailboxLabel)};const E=Symbol("bulk-run"),A=new AbortController;r.current=A,o.current=E,s.current=S,S.claimEnding&&(a.current.add(E),S.claimEnding(()=>a.current.delete(E))),n({action:S.action,mailboxId:S.mailboxId,progress:{done:0,total:S.matched}});const I=R=>{o.current===E&&n(k=>k&&{...k,progress:INe(R)})},T=S.source.kind==="targets"?await aq(S.source.targets,S.applyBatch,I,A.signal):await ANe(S.source.fetchPage,S.matched,S.applyBatch,I,A.signal),N=a.current.delete(E);o.current===E&&(o.current=void 0,s.current=void 0,n(void 0));const M=T.error?BNe(T.error):void 0;return M?f({accountId:M.accountId,role:M.role,reason:M.reason,action:{kind:"delete",count:S.matched},onAppointed:async()=>{const R=await h.current({...S,claimEnding:void 0});R.kind==="refused"&&c({title:_5(S.action.kind,0),detail:R.reason})}}):T.error?c(DNe(_5(S.action.kind,T.done),bNe(S.action.kind),T.error)):T.refused>0&&c({severity:"warning",title:T.refused>1?`Couldn't delete ${T.refused} of ${S.matched} messages yet`:"Couldn't delete this message yet",detail:"Something else moved them while the delete was being prepared. They are back where they now sit — try again."}),N||S.reportEnding?.(S.action.kind,S.matched,T),T.done>0&&g(S),{kind:"ran",outcome:T}},[g,c,f]);h.current=m;const v=_.useCallback(S=>{s.current?.mailboxId===S&&r.current?.abort()},[]);_.useEffect(()=>{const S=a.current;return()=>{r.current?.abort(),r.current=void 0,o.current=void 0,s.current=void 0,S.clear()}},[]);const w=_.useMemo(()=>({run:t,start:m,stop:v}),[t,m,v]);return O.jsx(hq.Provider,{value:w,children:e})},M$e=()=>{const e=_.useContext(hq);if(!e)throw new Error("useBulkRun must be used within a BulkRunProvider");return e},pke=600,gke=300,pq="remit logs",mke="https://github.com/remit-mail/reader/releases/tag/";function gq(e,t){const n=t?.check.lastCheckedAt;return n!==void 0&&n!==e.since}function vke(e){const t=hn(e);return`The check could not be requested — ${t===void 0?"the server did not answer":`the server answered ${t}`}. Run \`remit logs backend\` to see why.`}const yke={checking:"preparing",pulling:"preparing",snapshotting:"preparing",stopping:"restarting",starting:"restarting",verifying:"reconnecting",committing:"reconnecting",rollingBack:"reconnecting",recovering:"reconnecting"};function _T(e){return yke[e]??"reconnecting"}function mq(e){const t=hn(e);return t===404||t===403||t===401}function IA(e,t){const n=e?.run??null;return n===null||n.outcome!==null||n.runId===t?null:n}function vq(e,t){const n=e?.check;if(n?.status==="ok"&&!(!n.updateAvailable||!n.latestVersion))return{version:n.latestVersion,releasedAt:Av(n.publishedAt)??t,releaseNotesUrl:n.releaseNotesUrl??yq(n.latestVersion),summary:n.summary??""}}function bke(e){const t=e?.check.schemaVersion,n=e?.currentSchemaVersion;return t===void 0||n===void 0?!1:t>n}function RA(){return pke+gke}function TA(e,t){return Math.max(0,Math.floor((t-e)/1e3))}function Av(e){if(!e)return;const t=Date.parse(e);return Number.isNaN(t)?void 0:t}function yq(e){return`${mke}${e}`}function Yf(e,t,n,r,o){return{status:"applying",runId:e,version:t,target:n,phase:r,elapsedSeconds:o}}function Ske(e,t,n){switch(n){case"succeeded":return{status:"succeeded",runId:t.runId,version:t.targetVersion,previousVersion:t.fromVersion,releaseNotesUrl:e.check.releaseNotesUrl??yq(t.targetVersion)};case"rolledBack":return{status:"rolledBack",runId:t.runId,version:t.fromVersion,attemptedVersion:t.targetVersion,reason:t.message,logsCommand:t.logCommand};case"rollbackFailed":return{status:"rollbackFailed",runId:t.runId,attemptedVersion:t.targetVersion,previousVersion:t.fromVersion,reason:t.message,logsCommand:t.logCommand};case"abandoned":return{status:"abandoned",runId:t.runId,version:t.fromVersion,attemptedVersion:t.targetVersion,reason:t.message,logsCommand:t.logCommand};default:return n}}function wke(e,t,n,r){const o=e.check,s=Av(o.lastCheckedAt);if(n!==null)return{status:"checkFailed",version:e.currentVersion,reason:n,lastCheckedAt:s};if(t!==null&&!gq(t,e))return{status:"checking",version:e.currentVersion};if(o.status==="failed")return{status:"checkFailed",version:e.currentVersion,reason:o.error??"Remit could not reach the update service.",lastCheckedAt:s};if(o.status==="disabled")return{status:"neverChecked",version:e.currentVersion,lastCheckedAt:s};const a=vq(e,r);return a?{status:"available",version:e.currentVersion,release:a}:{status:"upToDate",version:e.currentVersion,checkedAt:Av(o.lastCheckedAt)??r}}function T5(e,t,n){return{surface:{status:"ready",section:e,overlay:t},releaseHeld:n}}function bq(e,t,n,r){return{status:"ready",section:Yf(e,t,n,"reconnecting",r),overlay:{kind:"applying",target:n,phase:"reconnecting",elapsedSeconds:r}}}function Sq(e,t,n,r,o){return{status:"ready",section:Yf(e,t,n,"reconnecting",r),overlay:{kind:"neverCameBack",attemptedVersion:n,previousVersion:t,elapsedSeconds:r,logsCommand:o}}}function Cke(e,t){return{surface:Sq(e.runId,e.previousVersion,e.attemptedVersion,t,pq),releaseHeld:!1}}function Eke(e,t,n,r,o){const s=TA(e.startedAt,o),a=t?.currentVersion??e.previousVersion,u=!r&&n!==null&&n.runId===e.runId;if(u&&n!==null&&n.outcome!==null)return null;if(u&&n!==null){const c=_T(n.phase);return T5(Yf(n.runId,a,n.targetVersion,c,s),{kind:"applying",target:n.targetVersion,phase:c,elapsedSeconds:s},!1)}return r?s>RA()?Cke(e,s):{surface:bq(e.runId,e.previousVersion,e.attemptedVersion,s),releaseHeld:!1}:t===void 0?{surface:{status:"loading"},releaseHeld:!1}:s>RA()?{surface:{status:"ready",section:{status:"unreachable",runId:e.runId,previousVersion:e.previousVersion,attemptedVersion:e.attemptedVersion,elapsedSeconds:s,logsCommand:n?.logCommand??pq},overlay:{kind:"none"}},releaseHeld:!0}:T5(Yf(e.runId,a,e.attemptedVersion,e.phase,s),{kind:"applying",target:e.attemptedVersion,phase:e.phase,elapsedSeconds:s},!1)}function O5(e){const{data:t,isError:n,dismissedRunId:r,checkPress:o,checkFailure:s,sighting:a,now:u}=e;if(n){const h=IA(t,r);if(h!==null){const g=a!==null&&a.runId===h.runId?a.observedAt:u,m=TA(g,u);return m>RA()?Sq(h.runId,h.fromVersion,h.targetVersion,m,h.logCommand):bq(h.runId,h.fromVersion,h.targetVersion,m)}return{status:"ready",section:{status:"checkFailed",version:t?.currentVersion??"the current version",reason:"Remit could not reach the update service."},overlay:{kind:"none"}}}if(!t)return{status:"loading"};const c=t.run,f=c!==null&&r!==null&&c.runId===r;if(c!==null&&!f&&c.outcome!==null)return{status:"ready",section:Ske(t,c,c.outcome),overlay:{kind:"none"}};if(c!==null&&!f&&c.outcome===null){const h=TA(Av(c.startedAt)??u,u),g=_T(c.phase);return{status:"ready",section:Yf(c.runId,c.fromVersion,c.targetVersion,g,h),overlay:{kind:"applying",target:c.targetVersion,phase:g,elapsedSeconds:h}}}return{status:"ready",section:wke(t,o,s,u),overlay:{kind:"none"}}}function _ke(e){const{data:t,isError:n,error:r,held:o,now:s}=e,a=t?.run??null;if(mq(r)&&!o)return{surface:{status:"absent"},releaseHeld:!0};if(o){const u=Eke(o,t,a,n,s);return u||{surface:O5(e),releaseHeld:!0}}return{surface:O5(e),releaseHeld:!1}}const xke=3e4,Ake=5e3,Ike=iI,Rke={...iI,...Xre},Tke=3e4,Oke="The updater did not answer. Run `remit logs updater` to see why.";function Mke(e,t,n,r){if(mq(e)&&!n)return!1;const o=t!==null&&t.outcome===null;return n||o||r?Ake:xke}function Pke(){const e=dl(),[t,n]=_.useState(null),[r,o]=_.useState(null),[s,a]=_.useState(null),[u,c]=_.useState(null),[f,h]=_.useState(null),g=_.useRef(t);g.current=t;const m=_.useRef(s);m.current=s;const v=e.getQueryData(pA()),w=t!==null||IA(v,r)!==null,S=Ja({..._Re(),retry:!1,meta:w?Rke:Ike,refetchInterval:D=>Mke(D.state.error,D.state.data?.run??null,g.current!==null,m.current!==null)}),C=_.useRef(S.data);C.current=S.data;const E=_ke({data:S.data,isError:S.isError,error:S.error,held:t,dismissedRunId:r,checkPress:s,checkFailure:u,sighting:f,now:Date.now()}),A=IA(S.data,r);_.useEffect(()=>{if(A===null){h(D=>D===null?D:null);return}h(D=>D!==null&&D.runId===A.runId?D:{runId:A.runId,observedAt:Date.now()})},[A]);const I=_.useRef(null);I.current=E.surface.status==="ready"&&"runId"in E.surface.section?E.surface.section.runId:null;const{releaseHeld:T}=E;_.useEffect(()=>{T&&n(D=>D===null?D:null)},[T]),_.useEffect(()=>{s!==null&&gq(s,S.data)&&a(null)},[s,S.data]),_.useEffect(()=>{if(s===null)return;const D=s.pressedAt+Tke-Date.now(),j=setTimeout(()=>{a(null),c(Oke)},Math.max(0,D));return()=>clearTimeout(j)},[s]);const{refetch:N}=S,M=_.useCallback(()=>{c(null),a({pressedAt:Date.now(),since:C.current?.check.lastCheckedAt}),ZB({query:{refresh:!0},throwOnError:!0}).then(()=>{N()}).catch(D=>{mR(D,iI),a(null),c(vke(D))})},[N]),R=_.useCallback(()=>{N()},[N]),k=lR({...xRe(),meta:{softError:!0},onSuccess:D=>{const j=D.run;j!==null&&(n({runId:j.runId,attemptedVersion:j.targetVersion,previousVersion:j.fromVersion,phase:_T(j.phase),startedAt:Date.now()}),o(null)),e.setQueryData(pA(),D)},onError:()=>{N()}}),{mutate:L}=k,q=_.useCallback(D=>{L({body:{targetVersion:D}})},[L]),$=_.useCallback(()=>{I.current!==null&&o(I.current),n(null),a(null),c(null)},[]);return{surface:E.surface,appliesSchemaMigration:bke(S.data),currentVersion:S.data?.currentVersion,release:vq(S.data,Date.now()),onCheck:M,install:q,onDismissResult:$,onRetryConnection:R}}const xT=_.createContext(null);function Nke({children:e}){const t=Pke();return _.createElement(xT.Provider,{value:t},e)}function kke(){const e=_.useContext(xT);if(e===null)throw new Error("useSelfUpdate must be used within a SelfUpdateProvider");return e}function Dke(){return _.useContext(xT)}function Lke(){const{surface:e,onRetryConnection:t}=kke();if(e.status!=="ready")return null;const{overlay:n}=e;return n.kind==="applying"?O.jsx(Dre,{target:n.target,phase:n.phase,elapsedSeconds:n.elapsedSeconds}):n.kind==="neverCameBack"?O.jsx(Lre,{attemptedVersion:n.attemptedVersion,previousVersion:n.previousVersion,elapsedSeconds:n.elapsedSeconds,logsCommand:n.logsCommand,onRetryConnection:t}):null}const Uke=()=>typeof globalThis.crypto<"u"&&typeof globalThis.crypto.randomUUID=="function"?globalThis.crypto.randomUUID():`banner-${Date.now()}-${Math.random().toString(36).slice(2,10)}`,$ke=({children:e})=>{const[t,n]=_.useState([]),r=_.useCallback(u=>{if(u.error!=null&&IF(u.error))return Bu(u.error).correlationId;const c=FNe({...u,action:NNe(u)},Uke(),Date.now());return n(f=>UNe(f,c)),c.id},[]),o=_.useCallback(u=>{n(c=>$Ne(c,u))},[]),s=_.useCallback(()=>{n([])},[]),a=_.useMemo(()=>({errors:t,pushError:r,dismissError:o,clearAll:s}),[t,r,o,s]);return O.jsxs(lq.Provider,{value:a,children:[e,O.jsx(Nne,{errors:t,onDismiss:o})]})},M5="mt-6 inline-flex min-h-11 w-full items-center justify-center gap-2 rounded-md bg-accent px-4 text-sm font-medium text-accent-fg hover:bg-accent-hover focus-visible:ring-2 focus-visible:ring-ring";function wq(){const[e,t]=_.useState(Pbe),{Account:n}=Mbe(),r=_.useRef(null);return _.useEffect(()=>Nbe(t),[]),Vv({id:"signed-out",open:e}),Wv(r,e),e?O.jsx("div",{className:"fixed inset-0 z-[70] flex items-center justify-center bg-canvas/80 p-4 backdrop-blur-sm",children:O.jsxs("div",{ref:r,role:"alertdialog","aria-modal":"true","aria-labelledby":"signed-out-title","aria-describedby":"signed-out-text",tabIndex:-1,className:"w-full max-w-sm rounded-lg border border-line bg-surface p-6 shadow-xl outline-none",children:[O.jsx("h2",{id:"signed-out-title",className:"text-lg font-semibold text-fg",children:"You're signed out"}),O.jsx("p",{id:"signed-out-text",className:"mt-2 text-sm text-fg-muted",children:"The server no longer accepts this session. Sign in again to carry on here; you will come back to this screen."}),O.jsx(n,{fallback:O.jsxs("button",{type:"button",onClick:()=>{lU(),window.location.reload()},className:M5,children:[O.jsx(JN,{className:"size-4","aria-hidden":"true"}),"Sign in"]}),children:({signOut:o})=>O.jsxs("button",{type:"button",onClick:()=>{lU(),o()},className:M5,children:[O.jsx(JN,{className:"size-4","aria-hidden":"true"}),"Sign in"]})})]})}):null}const Fke=({error:e,reset:t,info:n})=>{if(ty(e))return gR(),O.jsx(wq,{});const r=Xv(e),o=Bu(e,{recoverable:r,componentStack:n?.componentStack});return O.jsx(DF,{fatal:o,onRetry:r?t:void 0})},ea=Fye()({component:Bke,errorComponent:Fke}),zke=()=>{const{t:e}=KB("common",{useSuspense:!1});return O.jsx("a",{href:"#main-content",className:"sr-only focus:not-sr-only focus:absolute focus:z-50 focus:p-4 focus:bg-canvas focus:text-fg focus:rounded-md",children:e("accessibility.skipToContent","Skip to main content")})},jke=({children:e})=>gc().updateMode==="managed"?e:O.jsxs(Nke,{children:[e,O.jsx(Lke,{})]});function Bke(){return O.jsxs($ke,{children:[O.jsx(dke,{children:O.jsx(hke,{children:O.jsx(jke,{children:O.jsxs(PRe,{children:[O.jsx(zke,{}),O.jsx("main",{id:"main-content",className:"h-dvh overflow-hidden",children:O.jsx(_.Suspense,{fallback:O.jsx(Zv,{}),children:O.jsx(o7,{})})})]})})})}),O.jsx(kF,{}),O.jsx(wq,{})]})}const Hke=Ee("/")({beforeLoad:()=>{throw wc({to:"/mail/brief"})}}),qke=gc().apiUrl;le.setConfig({baseUrl:qke,fetch:y$});le.interceptors.error.use((e,t)=>e instanceof Qv||!t?e:qre(e,t.status));const Vke=()=>Re(()=>import("./calendar-iY8BLzO2.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])),Wke=Ee("/calendar")({loader:({context:{queryClient:e}})=>{e.prefetchQuery(iT())},component:Ie(Vke,"component")}),Gke=()=>Re(()=>import("./import-BfiMMK8M.js"),__vite__mapDeps([14,15,16,17,18,19,20,21,22])),Kke=Ee("/import")({component:Ie(Gke,"component")}),Zke=ST(["match","properties","folder","rule","name","review","run"]),Yke=vl("search"),Qke=Yke.optional().catch(void 0),Xke=()=>Ny({from:"/mail",select:e=>e.wizardFrom}),Jke=Zke.optional().catch(void 0),e3e=(e,t)=>wF(e,t)+1,Cq=()=>Ny({from:"/mail",select:e=>e.wizard}),t3e=()=>{const e=fh();return _.useCallback((t,n)=>{e({to:".",search:r=>({...r,wizard:t,wizardFrom:n})})},[e])},P$e=()=>{const e=Cq(),t=t3e(),[n,r]=_.useState("organize"),o=_.useCallback(a=>{r(a),t("match")},[t]),s=_.useCallback(()=>{t("properties","search")},[t]);return{verb:n,start:o,startFromSearch:s,isOpen:e!==void 0}},N$e=e=>{const t=gr(),n=fh(),r=Cq(),o=Xke(),s=_.useRef(r!==void 0),a=_.useRef(o),u=_.useRef(void 0);_.useEffect(()=>{u.current=void 0},[r]),_.useEffect(()=>{if(!s.current)return;s.current=!1;const g=a.current;(async()=>(await n({to:".",search:m=>({...m,wizard:void 0,wizardFrom:void 0}),replace:!0}),await n({to:".",search:m=>({...m,wizard:e,wizardFrom:g})})))()},[e,n]);const c=_.useCallback(g=>{g===r||u.current===g||(u.current=g,n({to:".",search:m=>({...m,wizard:g})}))},[n,r]),f=_.useCallback(()=>{t.history.back()},[t]),h=_.useCallback((g,m)=>{t.history.go(-e3e(g,m))},[t]);return{step:r,goToStep:c,goBack:f,closeWizard:h}},Sh=wo({q:Kn().optional()}),AT=Sh.extend({}),Eq=Sh.extend({}),n3e=Sh.extend({}),_q=Sh.extend({}),r3e=AT,o3e=Sh.extend({wizard:Jke,wizardFrom:Qke}),p_=wo({body:Kn().optional()}),k$e=e=>{const{body:t,...n}=e;return n},IT={brief:AT.extend(p_.shape),flagged:Eq.extend(p_.shape),mailbox:_q.extend(p_.shape)},s3e=new Map;function D$e(e){const t=new Map;for(const n of e){const r=sb(n.folderAppointments);for(const[o,s]of r)t.set(o,{role:s});for(const o of n.mailboxes){const s=r.get(o.mailboxId),a={providerPath:o.fullPath,hierarchyDelimiter:o.hierarchyDelimiter};t.set(o.mailboxId,s?{role:s,...a}:a)}}return t}function L$e(e){const t=[];for(const[n,r]of e)r.role==="junk"&&t.push(n);return t}function U$e(e,t){const n=t[0];if(!e)return n?{mailboxId:n}:{};for(const o of t){const s=e.get(o);if(s&&lre(s)!==void 0)return{mailboxId:o,folder:s}}if(!n)return{};const r=e.get(n);return{mailboxId:n,...r?{folder:r}:{}}}const i3e=_.createContext(null),$$e=()=>_.useContext(i3e)??{accounts:[],mailboxNameIndex:new Map,accountNameIndex:new Map,resultFolderIndex:s3e,searchQuery:"",searchInput:"",searchViewKey:"",onSearchChange:()=>{},onSearchClear:()=>{},onSearchClearQuery:()=>{},intelligenceOpen:!1,onToggleIntelligence:()=>{},onRaiseIntelligence:()=>{}},a3e=()=>Re(()=>import("./mail-DtD-4wOO.js"),__vite__mapDeps([23,5,4,3,1,2,6,7,8,9,10,11,24,25,26,27,28,29,30,31,32,17,13,33,34,35,36,37,38,39,40,41,42,43,44,45])),l3e=Ee("/mail")({loader:({context:{queryClient:e}})=>{e.prefetchQuery(iT()),e.prefetchQuery({...ARe(),staleTime:6e4})},component:Ie(a3e,"component"),validateSearch:o3e}),u3e=()=>Re(()=>import("./onboarding-BSC6mmKf.js"),__vite__mapDeps([46,47,15,16,17,18,19,30,10,21,45,48,22])),c3e=Ee("/onboarding")({component:Ie(u3e,"component")});function d3e(){const e=Dke(),t=e?.surface.status==="ready"&&e.surface.section.status==="available";return O.jsx(dF,{label:t?"Update available":void 0,children:O.jsx(bte,{className:"size-4"})})}function f3e(){return Ja({...pRe()})}const g_={listed:"Sync warnings",unread:"Warnings could not be read",signedOut:"Session ended"};function h3e(e,t){if(ty(t))return g_.signedOut;if(t)return g_.unread;if(e&&((e.entries?.length??0)>0||(e.warnings?.length??0)>0))return g_.listed}function p3e(){const e=f3e();return h3e(e.data,e.error)}function g3e(){const e=p3e();return O.jsx(dF,{label:e,children:O.jsx(nI,{className:"size-4"})})}const m3e=ny(403,404),F$e={...ny(403,404,409,429),...Jre},v3e=new Set([Na.SignInDisabled,Na.CallerDisabled]),xq=e=>{if(hn(e)!==403)return!1;const t=il(e)?.code;return t!==void 0&&v3e.has(t)},y3e=e=>{if(ey(e))return"The server could not be reached. Nothing changed. Try again.";const t=il(e)?.code;return t===Na.CannotDisableSelf?"You cannot disable your own account, so one account always stays on.":t===Na.StepUpRequired?"The password check did not carry over to the action. Nothing changed. Try again.":t===Na.ForeignOrigin?"The server refused a request from this address. Nothing changed. Open this page from the server's own address.":hn(e)===404?"That account is gone, or this server no longer has a People page. Reload the page.":"Something went wrong on the server. Nothing changed. Try again."},z$e=e=>ey(e)?"The server could not be reached. Check your connection and try again.":"The server did not answer as expected. Try again.",j$e=e=>{if(hn(e)===401||xq(e))return{kind:"signedOut"};const t=il(e)?.code;return t===Na.WrongPassword?{kind:"wrongPassword"}:t===Na.StepUpLocked?{kind:"locked"}:{kind:"failed",reason:y3e(e)}},B$e=(e,t)=>e==="Disable"?{title:`Disable ${t}?`,body:"They are signed out everywhere within 15 minutes and cannot sign in until you enable them again. Their calendar feed links stop working. Their mail stays.",confirmLabel:"Disable",failedTitle:`${t} was not disabled`,destructive:!0}:e==="Enable"?{title:`Enable ${t}?`,body:"They can sign in again with their password. Calendar feed links they shared before stay off; they make new ones in Settings.",confirmLabel:"Enable",failedTitle:`${t} was not enabled`,destructive:!1}:e==="SignOut"?{title:`Sign ${t} out everywhere?`,body:"Every session and connected app of theirs ends within 15 minutes. They can sign in again with their password.",confirmLabel:"Sign out everywhere",failedTitle:`${t} was not signed out`,destructive:!0}:{title:`Reset the password of ${t}?`,body:"Their password stops working at once and they are signed out everywhere. You get a link to give them, which works once, for 24 hours.",confirmLabel:"Make a reset link",failedTitle:`No reset link was made for ${t}`,destructive:!0},H$e=(e,t)=>{const n=hn(t),r=il(t)?.code,o=t instanceof Error?t.message:String(t),s=[n??"no response",r,o].filter(a=>a!==void 0&&a!=="").join(" ");return sh(Hu({title:`People: ${e}`,errorMessage:`${e}. The server answered: ${s}`}))},b3e=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),q$e=(e,t)=>b3e(new Date(e),t)?"Today":oq(e,"medium"),V$e=(e,t)=>e.map(n=>n.userId===t.userId?t:n),S3e=()=>({...CRe(),meta:m3e,retry:!1}),w3e=()=>{const e=Ja(S3e()),t=e.isError&&xq(e.error);return _.useEffect(()=>{t&&gR()},[t]),{...e,unavailable:e.isError&&RF(e.error)}},Aq=_.createContext([]),C3e=Aq.Provider,E3e=()=>_.useContext(Aq),_3e=()=>Re(()=>import("./settings-D2KYecr5.js"),[]),x3e=[{id:"accounts",label:"Accounts",icon:O.jsx(D$,{className:"size-4"})},{id:"senders",label:"Senders & Rules",icon:O.jsx(yte,{className:"size-4"})},{id:"folders",label:"Folder roles",icon:O.jsx(ite,{className:"size-4"})},{id:"filters",label:"Filters",icon:O.jsx(ate,{className:"size-4"})},{id:"labels",label:"Labels",icon:O.jsx(gte,{className:"size-4"})},{id:"classification",label:"Mail classification",icon:O.jsx(hte,{className:"size-4"})},{id:"calendars",label:"Calendars",icon:O.jsx(Jee,{className:"size-4"})},{id:"appearance",label:"Appearance",icon:O.jsx(cte,{className:"size-4"})},{id:"warnings",label:"Warnings",icon:O.jsx(g3e,{})},{id:"advanced",label:"Advanced",icon:O.jsx(d3e,{})}],A3e={id:"people",label:"People",icon:O.jsx(vte,{className:"size-4"})},W$e=()=>{const e=w3e(),t=E3e(),n=[...x3e];if(n.splice(1,0,...t.map(({id:o,label:s,icon:a})=>({id:o,label:s,icon:a}))),!e.isSuccess)return n;const r=n.findIndex(o=>o.id==="advanced");return[...n.slice(0,r),A3e,...n.slice(r)]},I3e=Ee("/settings")({component:Ie(_3e,"component")}),R3e=["year","month","week","day","agenda"],T3e=ST(R3e),Iq="week",G$e=e=>e==="agenda";function O3e(e){const t=T3e.safeParse(e);return t.success?t.data:void 0}const M3e=/^\d{4}-\d{2}-\d{2}$/;function P3e(e){if(!M3e.test(e))return;const[t,n,r]=e.split("-").map(Number),o=Date.UTC(t,n-1,r),s=new Date(o);if(s.getUTCFullYear()===t&&s.getUTCMonth()===n-1&&s.getUTCDate()===r)return e}const sc=e=>String(e).padStart(2,"0");function Rq(e){return`${e.getFullYear()}-${sc(e.getMonth()+1)}-${sc(e.getDate())}`}function N3e(e,t){return{view:O3e(e.view)??Iq,date:P3e(e.date)??t}}function K$e(e,t,n){const[r,o,s]=e.split("-").map(Number);if(t==="year")return P5(r+n,o,s);if(t==="month")return P5(r,o+n,s);const a=t==="day"?1:7,u=new Date(Date.UTC(r,o-1,s+a*n));return k3e(u)}const k3e=e=>`${e.getUTCFullYear()}-${sc(e.getUTCMonth()+1)}-${sc(e.getUTCDate())}`;function P5(e,t,n){const r=e+Math.floor((t-1)/12),o=((t-1)%12+12)%12+1,s=new Date(Date.UTC(r,o,0)).getUTCDate();return`${r}-${sc(o)}-${sc(Math.min(n,s))}`}const D3e=Kn().min(1);function L3e(e){const t=e==null?[]:[e].flat(),n=new Set;for(const r of t){if(typeof r!="string"&&typeof r!="number")continue;const o=D3e.safeParse(String(r));o.success&&n.add(o.data)}return[...n].sort()}const RT=wo({calendarId:xv().transform(L3e).transform(e=>e.length===0?void 0:e).optional()});function Z$e(e,t){return t?e==="week"?"day":e==="year"?"month":e:e}const U3e=Ee("/calendar/")({validateSearch:RT,beforeLoad:({search:e,location:t})=>{throw wc({to:"/calendar/$view/$date",params:{view:Iq,date:Rq(new Date)},search:e,hash:t.hash,replace:!0})}}),$3e=Ee("/mail/")({validateSearch:r3e,beforeLoad:({search:e,location:t})=>{throw wc({to:"/mail/brief",search:e,hash:t.hash,replace:!0})}}),F3e=()=>Re(()=>import("./_mailboxId-DA2rNZ6D.js"),__vite__mapDeps([49,26,5,4,3,24,27,28,29,30,31,32,6,17,13,33,34,11,50,51,39,38,9,52,53,45,18,54,55,8,10,56,7,57,58,59,60,61,62,12,63,48,64,65,66,2,40,67,16,68,69,37,35,36,70,71,72,73,74,75,76])),z3e=Ee("/mail/$mailboxId")({component:Ie(F3e,"component"),validateSearch:_q}),j3e=()=>Re(()=>import("./brief-CMzu4LMD.js"),__vite__mapDeps([77,13])),B3e=()=>Re(()=>import("./brief-DYSQ_oRb.js"),__vite__mapDeps([78,26,5,4,3,24,27,28,29,30,31,32,6,17,13,33,34,11,79,52,53,45,9,39,38,18,54,55,8,10,56,7,57,58,59,60,61,62,12,63,48,64,65,66,2,40,67,16,68,69,70,71,35,36,37,80,76])),H3e=Ee("/mail/brief")({component:Ie(B3e,"component"),validateSearch:AT,errorComponent:Ie(j3e,"errorComponent")}),q3e=()=>Re(()=>import("./flagged-CwOw5Xxs.js"),__vite__mapDeps([81,13])),V3e=()=>Re(()=>import("./flagged-aucGpj-Z.js"),__vite__mapDeps([82,26,5,4,3,24,27,28,29,30,31,32,6,17,13,33,34,11,83,52,53,45,9,39,38,18,54,55,8,10,56,7,57,58,59,60,61,62,12,63,48,64,65,66,2,40,67,16,68,69,51,37,80,76])),W3e=Ee("/mail/flagged")({component:Ie(V3e,"component"),validateSearch:Eq,errorComponent:Ie(q3e,"errorComponent")}),G3e=()=>Re(()=>import("./outbox-DQD-mHZK.js"),__vite__mapDeps([84,26,5,4,3,24,27,28,29,30,31,32,6,17,13,33,34,11,85,53,45,43,72,40,9,36,64,86,87,76])),K3e=Ee("/mail/outbox")({component:Ie(G3e,"component"),validateSearch:n3e}),Z3e=Ee("/reset-password/$token")({beforeLoad:()=>{throw wc({to:"/"})}}),Y3e=()=>Re(()=>import("./index-DlNRygfs.js"),[]),Q3e=Ee("/settings/")({component:Ie(Y3e,"component")}),X3e=()=>Re(()=>import("./_slotId-BLO1Rmfd.js"),__vite__mapDeps([88,4,3,6,89,7,18,90,40,74])),J3e=Ee("/settings/$slotId")({component:Ie(X3e,"component")}),eDe=()=>Re(()=>import("./accounts-Dl4YCzpm.js"),__vite__mapDeps([91,47,15,16,17,18,19,30,10,21,45,48,29,92,33,13,56,6,93,89,7,90,40,74,61,86])),tDe=wo({editAccountId:Kn().optional(),focusSmtp:bT().optional(),connected:Kn().optional(),oauthError:Kn().optional(),oauthEmail:Kn().optional(),missingServices:Kn().optional()}),nDe=Ee("/settings/accounts")({component:Ie(eDe,"component"),validateSearch:tDe}),rDe=()=>Re(()=>import("./advanced-CgXbUOtb.js"),__vite__mapDeps([94,20,4,3,5,6,19,56,18,21,87,75,95,66,64,93,45,89,7,90,40,74])),oDe=Ee("/settings/advanced")({component:Ie(rDe,"component")}),sDe=()=>Re(()=>import("./appearance-C6nkCe1H.js"),__vite__mapDeps([96,6,93,45,89,7,18,90,40,74,65])),iDe=Ee("/settings/appearance")({component:Ie(sDe,"component")}),aDe=()=>Re(()=>import("./calendars-ZADJ8TZ1.js"),__vite__mapDeps([97,59,13,38,16,17,19,61,98,31,99,100,25,74,33,18,37,101,6,89,7,90,40])),lDe=Ee("/settings/calendars")({component:Ie(aDe,"component")}),uDe=()=>Re(()=>import("./classification-BoqrRObl.js"),__vite__mapDeps([102,103,13,16,17,33,92,18,6,89,7,90,40,74])),cDe=Ee("/settings/classification")({component:Ie(uDe,"component")}),dDe=()=>Re(()=>import("./filters-D9G5dAF4.js"),__vite__mapDeps([104,13,3,71,67,32,16,17,61,69,65,75,73,18,6,89,7,90,40,74])),fDe=Ee("/settings/filters")({component:Ie(dDe,"component")}),hDe=()=>Re(()=>import("./folders-Bn_4Y9H0.js"),__vite__mapDeps([105,68,42,6,89,7,18,90,40,74,13,16,17,25])),pDe=Ee("/settings/folders")({component:Ie(hDe,"component")}),gDe=()=>Re(()=>import("./labels-DWadctIQ.js"),__vite__mapDeps([106,69,16,17,71,6,89,7,18,90,40,74,13,33])),mDe=Ee("/settings/labels")({component:Ie(gDe,"component")}),vDe=()=>Re(()=>import("./people-DWWALdDd.js"),__vite__mapDeps([107,103,101,55,6,89,7,18,90,40,74])),yDe=Ee("/settings/people")({component:Ie(vDe,"component")}),bDe=()=>Re(()=>import("./senders-ap9QQK-k.js"),__vite__mapDeps([108,31,6,93,45,13,89,7,18,90,40,74])),SDe=Ee("/settings/senders")({component:Ie(bDe,"component")}),wDe=()=>Re(()=>import("./suggested-vips-Gtwi6sFb.js"),[]),CDe=Ee("/settings/suggested-vips")({component:Ie(wDe,"component")}),EDe=()=>Re(()=>import("./warnings-BEW4lkgR.js"),__vite__mapDeps([109,41,38,18,75,101,95,13,6,93,45,89,7,90,40,74])),_De=Ee("/settings/warnings")({component:Ie(EDe,"component")}),xDe=()=>Re(()=>import("./_view._date-CZiRXVFR.js"),__vite__mapDeps([110,59,13,38,98,31,111,112,4,3,5,12,58,60,10,61,62,64,113,44,17,90,114,115,99,100,25,74,116,63,16,40,2,117])),ADe=Ee("/calendar/$view/$date")({validateSearch:RT,beforeLoad:({params:e,search:t,location:n})=>{const r=N3e(e,Rq(new Date));if(!(r.view===e.view&&r.date===e.date))throw wc({to:"/calendar/$view/$date",params:r,search:t,hash:n.hash,replace:!0})},component:Ie(xDe,"component")}),IDe=()=>Re(()=>import("./index-DL3ZaCDr.js"),__vite__mapDeps([118,50,51,39,5,4,3,34,11,38,9,52,53,45,24,17,28,29,30,31,32,6,18,54,55,8,13,10,56,7,57,58,59,60,61,62,12,63,48,64,65,66,2,40,67,16,68,33,69,37,35,36,70,71,72,73,74,75])),RDe=Ee("/mail/$mailboxId/")({component:Ie(IDe,"component")}),TDe=()=>Re(()=>import("./_threadId-CrzKmCrt.js"),[]),ODe=Ee("/mail/$mailboxId/$threadId")({component:Ie(TDe,"component")}),MDe=()=>Re(()=>import("./index-CqG3g67K.js"),__vite__mapDeps([119,79,52,53,45,34,11,4,3,5,24,9,17,39,38,28,29,30,31,32,6,18,54,55,8,13,10,56,7,57,58,59,60,61,62,12,63,48,64,65,66,2,40,67,16,68,33,69,70,71,35,36,37,80])),PDe=Ee("/mail/brief/")({component:Ie(MDe,"component")}),NDe=()=>Re(()=>import("./_threadId-CGEJtUok.js"),[]),kDe=Ee("/mail/brief/$threadId")({component:Ie(NDe,"component")}),DDe=()=>Re(()=>import("./index-BWpSJ9nc.js"),__vite__mapDeps([120,83,52,53,45,34,11,4,3,5,24,9,17,39,38,28,29,30,31,32,6,18,54,55,8,13,10,56,7,57,58,59,60,61,62,12,63,48,64,65,66,2,40,67,16,68,33,69,51,37,80])),LDe=Ee("/mail/flagged/")({component:Ie(DDe,"component")}),UDe=()=>Re(()=>import("./_threadId-D5at7_2j.js"),[]),$De=Ee("/mail/flagged/$threadId")({component:Ie(UDe,"component")}),FDe=()=>Re(()=>import("./index-BkkdzHr6.js"),__vite__mapDeps([121,85,53,45,34,11,4,3,5,24,43,72,40,9,36,64,86,87])),zDe=Ee("/mail/outbox/")({component:Ie(FDe,"component")}),jDe=()=>Re(()=>import("./index-DtqBFgK5.js"),[]),BDe=Ee("/calendar/$view/$date/")({component:Ie(jDe,"component")}),HDe=()=>Re(()=>import("./_calendarObjectId-Dus6Z_aO.js"),[]),qDe=Ee("/calendar/$view/$date/$calendarObjectId")({component:Ie(HDe,"component")}),Os=e=>String(e).padStart(2,"0"),Tq=e=>`${e.getUTCFullYear()}-${Os(e.getUTCMonth()+1)}-${Os(e.getUTCDate())}`,TT=e=>{const t=e<0?"-":"+",n=Math.abs(e);return`${t}${Os(Math.floor(n/60))}:${Os(n%60)}`};function Oq(e,t){const n=new Date(`${e}T${t}:00`);return`${e}T${t}:00${TT(-n.getTimezoneOffset())}`}const m_=new Map;function VDe(e){if(m_.has(e))return m_.get(e);let t;try{t=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{t=void 0}return m_.set(e,t),t}function OA(e,t){const n=VDe(e);if(!n)return Number.NaN;const r=n.formatToParts(new Date(t)),o=u=>Number(r.find(c=>c.type===u)?.value),s=o("hour")%24;return(Date.UTC(o("year"),o("month")-1,o("day"),s,o("minute"),o("second"))-t)/6e4}function N5(e,t,n){if(n==="")return`${e}T${t}:00+00:00`;const r=Date.parse(`${e}T${t}:00Z`),o=OA(n,r);if(Number.isNaN(o))return Oq(e,t);const s=OA(n,r-o*6e4);return`${e}T${t}:00${TT(Number.isNaN(s)?o:s)}`}function k5(e,t){const n=Date.parse(e),r=OA(t,n),o=Number.isNaN(r)?-new Date(n).getTimezoneOffset():r,s=new Date(n+o*6e4);return`${Tq(s)}T${Os(s.getUTCHours())}:${Os(s.getUTCMinutes())}:${Os(s.getUTCSeconds())}${TT(o)}`}const Iv=e=>Oq(e,"00:00");function Di(e,t){const[n,r,o]=e.split("-").map(Number);return Tq(new Date(Date.UTC(n,r-1,o+t)))}function v_(e){const[t,n,r]=e.split("-").map(Number),o=new Date(Date.UTC(t,n-1,r));return Di(e,-((o.getUTCDay()+6)%7))}function WDe(e,t){const[n,r]=t.split("-").map(Number);if(e==="year")return[`${n}-01-01`,`${n+1}-01-01`];if(e==="month"){const s=`${n}-${Os(r)}-01`,a=r===12?`${n+1}-01-01`:`${n}-${Os(r+1)}-01`;return[v_(s),Di(v_(Di(a,-1)),7)]}if(e==="day")return[t,Di(t,1)];const o=v_(t);return[o,Di(o,7)]}function Y$e(e,t){const[n,r]=WDe(e,t);return{from:Iv(n),to:Iv(r)}}function Q$e(e,t){return{from:Iv(e),to:Iv(Di(e,t))}}const GDe=tNe({offset:!0,local:!1}),Mq=nNe(),D5=xv().transform(e=>{const t=eq([GDe,Mq]).safeParse(e);return t.success?t.data:void 0}).optional(),KDe=RT.extend({start:D5,end:D5}),Vg=e=>Mq.safeParse(e).success;function Wg(e){return{date:e,endDate:e,startTime:"09:00",endTime:"10:00",allDay:!1}}function X$e(e,t,n,r){if(e===void 0||t===void 0)return Wg(n);if(Vg(e)&&Vg(t)){const a=Di(t,-1);return a<e?Wg(n):{date:e,endDate:a,startTime:"",endTime:"",allDay:!0}}if(Vg(e)||Vg(t)||Date.parse(t)<=Date.parse(e))return Wg(n);const o=k5(e,r),s=k5(t,r);return{date:o.slice(0,10),endDate:s.slice(0,10),startTime:o.slice(11,16),endTime:s.slice(11,16),allDay:!1}}function J$e(e,t){return e.allDay?{start:e.date,end:Di(e.endDate,1)}:{start:N5(e.date,e.startTime,t),end:N5(e.endDate,e.endTime,t)}}const ZDe=()=>Re(()=>import("./new-C7PkD0CK.js"),__vite__mapDeps([122,123,115,60,99,100,59,13,38,25,74,112,111,98,31,62,4,3,12,5,114,116,124,16,17,33])),YDe=Ee("/calendar/$view/$date/new")({validateSearch:KDe,component:Ie(ZDe,"component")}),QDe=()=>Re(()=>import("./index-UN1wPrb5.js"),__vite__mapDeps([125,50,51,39,5,4,3,34,11,38,9,52,53,45,24,17,28,29,30,31,32,6,18,54,55,8,13,10,56,7,57,58,59,60,61,62,12,63,48,64,65,66,2,40,67,16,68,33,69,37,35,36,70,71,72,73,74,75])),XDe=Ee("/mail/$mailboxId/$threadId/")({component:Ie(QDe,"component")}),JDe=()=>Re(()=>import("./_messageId-UN1wPrb5.js"),__vite__mapDeps([126,50,51,39,5,4,3,34,11,38,9,52,53,45,24,17,28,29,30,31,32,6,18,54,55,8,13,10,56,7,57,58,59,60,61,62,12,63,48,64,65,66,2,40,67,16,68,33,69,37,35,36,70,71,72,73,74,75])),eLe=Ee("/mail/$mailboxId/$threadId/$messageId")({component:Ie(JDe,"component")}),tLe=()=>Re(()=>import("./compose._-_outboxMessageId_-Dj0vXnYT.js"),__vite__mapDeps([127,27,28,24,5,4,3,29,30,31,32,6,17,13,33])),nLe=Ee("/mail/$mailboxId/compose/{-$outboxMessageId}")({component:Ie(tLe,"component")}),rLe=()=>Re(()=>import("./index-CoU9lExJ.js"),__vite__mapDeps([128,79,52,53,45,34,11,4,3,5,24,9,17,39,38,28,29,30,31,32,6,18,54,55,8,13,10,56,7,57,58,59,60,61,62,12,63,48,64,65,66,2,40,67,16,68,33,69,70,71,35,36,37,80])),oLe=Ee("/mail/brief/$threadId/")({component:Ie(rLe,"component")}),sLe=()=>Re(()=>import("./_messageId-CoU9lExJ.js"),__vite__mapDeps([129,79,52,53,45,34,11,4,3,5,24,9,17,39,38,28,29,30,31,32,6,18,54,55,8,13,10,56,7,57,58,59,60,61,62,12,63,48,64,65,66,2,40,67,16,68,33,69,70,71,35,36,37,80])),iLe=Ee("/mail/brief/$threadId/$messageId")({component:Ie(sLe,"component")}),aLe=()=>Re(()=>import("./compose._-_outboxMessageId_-Dsv-7Ma0.js"),__vite__mapDeps([130,27,28,24,5,4,3,29,30,31,32,6,17,13,33])),lLe=Ee("/mail/brief/compose/{-$outboxMessageId}")({component:Ie(aLe,"component")}),uLe=()=>Re(()=>import("./index-CBEFnj_-.js"),__vite__mapDeps([131,83,52,53,45,34,11,4,3,5,24,9,17,39,38,28,29,30,31,32,6,18,54,55,8,13,10,56,7,57,58,59,60,61,62,12,63,48,64,65,66,2,40,67,16,68,33,69,51,37,80])),cLe=Ee("/mail/flagged/$threadId/")({component:Ie(uLe,"component")}),dLe=()=>Re(()=>import("./_messageId-CBEFnj_-.js"),__vite__mapDeps([132,83,52,53,45,34,11,4,3,5,24,9,17,39,38,28,29,30,31,32,6,18,54,55,8,13,10,56,7,57,58,59,60,61,62,12,63,48,64,65,66,2,40,67,16,68,33,69,51,37,80])),fLe=Ee("/mail/flagged/$threadId/$messageId")({component:Ie(dLe,"component")}),hLe=()=>Re(()=>import("./compose._-_outboxMessageId_-Cv8p7Ifc.js"),__vite__mapDeps([133,27,28,24,5,4,3,29,30,31,32,6,17,13,33])),pLe=Ee("/mail/flagged/compose/{-$outboxMessageId}")({component:Ie(hLe,"component")}),gLe=()=>Re(()=>import("./compose._-_outboxMessageId_-_t-bMwDD.js"),__vite__mapDeps([134,27,28,24,5,4,3,29,30,31,32,6,17,13,33])),mLe=Ee("/mail/outbox/compose/{-$outboxMessageId}")({component:Ie(gLe,"component")}),vLe=()=>Re(()=>import("./_outboxMessageId-Crw8NNd4.js"),__vite__mapDeps([135,85,53,45,34,11,4,3,5,24,43,72,40,9,36,64,86,87])),yLe=Ee("/mail/outbox/draft/$outboxMessageId")({component:Ie(vLe,"component")}),bLe=()=>Re(()=>import("./index--IxFGldl.js"),__vite__mapDeps([136,137,59,13,38,112,111,62,4,3,12,5,116,100,25,99,74,33])),SLe=Ee("/calendar/$view/$date/$calendarObjectId/")({component:Ie(bLe,"component")}),wLe=()=>Re(()=>import("./_recurrenceId-DN3W2Byk.js"),[]),CLe=Ee("/calendar/$view/$date/$calendarObjectId/$recurrenceId")({component:Ie(wLe,"component")}),ELe=()=>Re(()=>import("./edit-Dhgn_BMZ.js"),__vite__mapDeps([138,123,115,60,99,100,59,13,38,25,74,112,111,98,31,62,4,3,12,5,114,116,124,16,17,33])),_Le=Ee("/calendar/$view/$date/$calendarObjectId/edit")({component:Ie(ELe,"component")}),xLe=()=>Re(()=>import("./suggestion._suggestionId-BHxPFUy0.js"),__vite__mapDeps([139,59,13,38,115,60,99,100,25,74,62,116,63,57,124,16,17,4,3,12,5])),ALe=Ee("/calendar/$view/$date/suggestion/$suggestionId")({component:Ie(xLe,"component")}),ILe=()=>Re(()=>import("./task._calendarTaskId-r7Jl9ABh.js"),__vite__mapDeps([140,59,13,38,111,4,3,12,5,113,100,25])),RLe=Ee("/calendar/$view/$date/task/$calendarTaskId")({component:Ie(ILe,"component")}),TLe=()=>Re(()=>import("./index-Dw2xSkAT.js"),__vite__mapDeps([141,137,59,13,38,112,111,62,4,3,12,5,116,100,25,99,74,33])),OLe=Ee("/calendar/$view/$date/$calendarObjectId/$recurrenceId/")({component:Ie(TLe,"component")}),MLe=()=>Re(()=>import("./edit-D9CdMYNH.js"),__vite__mapDeps([142,123,115,60,99,100,59,13,38,25,74,112,111,98,31,62,4,3,12,5,114,116,124,16,17,33])),PLe=Ee("/calendar/$view/$date/$calendarObjectId/$recurrenceId/edit")({component:Ie(MLe,"component")}),NLe=Ee("/mail/$mailboxId/$threadId/$messageId/$mode/{-$outboxMessageId}")({validateSearch:IT.mailbox}),kLe=Ee("/mail/brief/$threadId/$messageId/$mode/{-$outboxMessageId}")({validateSearch:IT.brief}),DLe=Ee("/mail/flagged/$threadId/$messageId/$mode/{-$outboxMessageId}")({validateSearch:IT.flagged}),LLe=Hke.update({id:"/",path:"/",getParentRoute:()=>ea}),OT=Wke.update({id:"/calendar",path:"/calendar",getParentRoute:()=>ea}),ULe=Kke.update({id:"/import",path:"/import",getParentRoute:()=>ea}),_c=l3e.update({id:"/mail",path:"/mail",getParentRoute:()=>ea}),$Le=c3e.update({id:"/onboarding",path:"/onboarding",getParentRoute:()=>ea}),Qn=I3e.update({id:"/settings",path:"/settings",getParentRoute:()=>ea}),FLe=U3e.update({id:"/",path:"/",getParentRoute:()=>OT}),zLe=$3e.update({id:"/",path:"/",getParentRoute:()=>_c}),ib=z3e.update({id:"/$mailboxId",path:"/$mailboxId",getParentRoute:()=>_c}),ab=H3e.update({id:"/brief",path:"/brief",getParentRoute:()=>_c}),lb=W3e.update({id:"/flagged",path:"/flagged",getParentRoute:()=>_c}),ub=K3e.update({id:"/outbox",path:"/outbox",getParentRoute:()=>_c}),jLe=Z3e.update({id:"/reset-password/$token",path:"/reset-password/$token",getParentRoute:()=>ea}),BLe=Q3e.update({id:"/",path:"/",getParentRoute:()=>Qn}),HLe=J3e.update({id:"/$slotId",path:"/$slotId",getParentRoute:()=>Qn}),qLe=nDe.update({id:"/accounts",path:"/accounts",getParentRoute:()=>Qn}),VLe=oDe.update({id:"/advanced",path:"/advanced",getParentRoute:()=>Qn}),WLe=iDe.update({id:"/appearance",path:"/appearance",getParentRoute:()=>Qn}),GLe=lDe.update({id:"/calendars",path:"/calendars",getParentRoute:()=>Qn}),KLe=cDe.update({id:"/classification",path:"/classification",getParentRoute:()=>Qn}),ZLe=fDe.update({id:"/filters",path:"/filters",getParentRoute:()=>Qn}),YLe=pDe.update({id:"/folders",path:"/folders",getParentRoute:()=>Qn}),QLe=mDe.update({id:"/labels",path:"/labels",getParentRoute:()=>Qn}),XLe=yDe.update({id:"/people",path:"/people",getParentRoute:()=>Qn}),JLe=SDe.update({id:"/senders",path:"/senders",getParentRoute:()=>Qn}),e4e=CDe.update({id:"/suggested-vips",path:"/suggested-vips",getParentRoute:()=>Qn}),t4e=_De.update({id:"/warnings",path:"/warnings",getParentRoute:()=>Qn}),xc=ADe.update({id:"/$view/$date",path:"/$view/$date",getParentRoute:()=>OT}),n4e=RDe.update({id:"/",path:"/",getParentRoute:()=>ib}),MT=ODe.update({id:"/$threadId",path:"/$threadId",getParentRoute:()=>ib}),r4e=PDe.update({id:"/",path:"/",getParentRoute:()=>ab}),PT=kDe.update({id:"/$threadId",path:"/$threadId",getParentRoute:()=>ab}),o4e=LDe.update({id:"/",path:"/",getParentRoute:()=>lb}),NT=$De.update({id:"/$threadId",path:"/$threadId",getParentRoute:()=>lb}),s4e=zDe.update({id:"/",path:"/",getParentRoute:()=>ub}),i4e=BDe.update({id:"/",path:"/",getParentRoute:()=>xc}),cb=qDe.update({id:"/$calendarObjectId",path:"/$calendarObjectId",getParentRoute:()=>xc}),a4e=YDe.update({id:"/new",path:"/new",getParentRoute:()=>xc}),l4e=XDe.update({id:"/",path:"/",getParentRoute:()=>MT}),Pq=eLe.update({id:"/$messageId",path:"/$messageId",getParentRoute:()=>MT}),u4e=nLe.update({id:"/compose/{-$outboxMessageId}",path:"/compose/{-$outboxMessageId}",getParentRoute:()=>ib}),c4e=oLe.update({id:"/",path:"/",getParentRoute:()=>PT}),Nq=iLe.update({id:"/$messageId",path:"/$messageId",getParentRoute:()=>PT}),d4e=lLe.update({id:"/compose/{-$outboxMessageId}",path:"/compose/{-$outboxMessageId}",getParentRoute:()=>ab}),f4e=cLe.update({id:"/",path:"/",getParentRoute:()=>NT}),kq=fLe.update({id:"/$messageId",path:"/$messageId",getParentRoute:()=>NT}),h4e=pLe.update({id:"/compose/{-$outboxMessageId}",path:"/compose/{-$outboxMessageId}",getParentRoute:()=>lb}),p4e=mLe.update({id:"/compose/{-$outboxMessageId}",path:"/compose/{-$outboxMessageId}",getParentRoute:()=>ub}),g4e=yLe.update({id:"/draft/$outboxMessageId",path:"/draft/$outboxMessageId",getParentRoute:()=>ub}),m4e=SLe.update({id:"/",path:"/",getParentRoute:()=>cb}),kT=CLe.update({id:"/$recurrenceId",path:"/$recurrenceId",getParentRoute:()=>cb}),v4e=_Le.update({id:"/edit",path:"/edit",getParentRoute:()=>cb}),y4e=ALe.update({id:"/suggestion/$suggestionId",path:"/suggestion/$suggestionId",getParentRoute:()=>xc}),b4e=RLe.update({id:"/task/$calendarTaskId",path:"/task/$calendarTaskId",getParentRoute:()=>xc}),S4e=OLe.update({id:"/",path:"/",getParentRoute:()=>kT}),w4e=PLe.update({id:"/edit",path:"/edit",getParentRoute:()=>kT}),C4e=NLe.update({id:"/$mode/{-$outboxMessageId}",path:"/$mode/{-$outboxMessageId}",getParentRoute:()=>Pq}),E4e=kLe.update({id:"/$mode/{-$outboxMessageId}",path:"/$mode/{-$outboxMessageId}",getParentRoute:()=>Nq}),_4e=DLe.update({id:"/$mode/{-$outboxMessageId}",path:"/$mode/{-$outboxMessageId}",getParentRoute:()=>kq}),x4e={CalendarViewDateCalendarObjectIdRecurrenceIdEditRoute:w4e,CalendarViewDateCalendarObjectIdRecurrenceIdIndexRoute:S4e},A4e=kT._addFileChildren(x4e),I4e={CalendarViewDateCalendarObjectIdRecurrenceIdRoute:A4e,CalendarViewDateCalendarObjectIdEditRoute:v4e,CalendarViewDateCalendarObjectIdIndexRoute:m4e},R4e=cb._addFileChildren(I4e),T4e={CalendarViewDateCalendarObjectIdRoute:R4e,CalendarViewDateNewRoute:a4e,CalendarViewDateIndexRoute:i4e,CalendarViewDateSuggestionSuggestionIdRoute:y4e,CalendarViewDateTaskCalendarTaskIdRoute:b4e},O4e=xc._addFileChildren(T4e),M4e={CalendarIndexRoute:FLe,CalendarViewDateRoute:O4e},P4e=OT._addFileChildren(M4e),N4e={MailMailboxIdThreadIdMessageIdModeChar123OutboxMessageIdChar125Route:C4e},k4e=Pq._addFileChildren(N4e),D4e={MailMailboxIdThreadIdMessageIdRoute:k4e,MailMailboxIdThreadIdIndexRoute:l4e},L4e=MT._addFileChildren(D4e),U4e={MailMailboxIdThreadIdRoute:L4e,MailMailboxIdIndexRoute:n4e,MailMailboxIdComposeChar123OutboxMessageIdChar125Route:u4e},$4e=ib._addFileChildren(U4e),F4e={MailBriefThreadIdMessageIdModeChar123OutboxMessageIdChar125Route:E4e},z4e=Nq._addFileChildren(F4e),j4e={MailBriefThreadIdMessageIdRoute:z4e,MailBriefThreadIdIndexRoute:c4e},B4e=PT._addFileChildren(j4e),H4e={MailBriefThreadIdRoute:B4e,MailBriefIndexRoute:r4e,MailBriefComposeChar123OutboxMessageIdChar125Route:d4e},q4e=ab._addFileChildren(H4e),V4e={MailFlaggedThreadIdMessageIdModeChar123OutboxMessageIdChar125Route:_4e},W4e=kq._addFileChildren(V4e),G4e={MailFlaggedThreadIdMessageIdRoute:W4e,MailFlaggedThreadIdIndexRoute:f4e},K4e=NT._addFileChildren(G4e),Z4e={MailFlaggedThreadIdRoute:K4e,MailFlaggedIndexRoute:o4e,MailFlaggedComposeChar123OutboxMessageIdChar125Route:h4e},Y4e=lb._addFileChildren(Z4e),Q4e={MailOutboxIndexRoute:s4e,MailOutboxComposeChar123OutboxMessageIdChar125Route:p4e,MailOutboxDraftOutboxMessageIdRoute:g4e},X4e=ub._addFileChildren(Q4e),J4e={MailMailboxIdRoute:$4e,MailBriefRoute:q4e,MailFlaggedRoute:Y4e,MailOutboxRoute:X4e,MailIndexRoute:zLe},eUe=_c._addFileChildren(J4e),tUe={SettingsSlotIdRoute:HLe,SettingsAccountsRoute:qLe,SettingsAdvancedRoute:VLe,SettingsAppearanceRoute:WLe,SettingsCalendarsRoute:GLe,SettingsClassificationRoute:KLe,SettingsFiltersRoute:ZLe,SettingsFoldersRoute:YLe,SettingsLabelsRoute:QLe,SettingsPeopleRoute:XLe,SettingsSendersRoute:JLe,SettingsSuggestedVipsRoute:e4e,SettingsWarningsRoute:t4e,SettingsIndexRoute:BLe},nUe=Qn._addFileChildren(tUe),rUe={IndexRoute:LLe,CalendarRoute:P4e,ImportRoute:ULe,MailRoute:eUe,OnboardingRoute:$Le,SettingsRoute:nUe,ResetPasswordTokenRoute:jLe},oUe=ea._addFileChildren(rUe)._addFileTypes(),sUe=(e,t,n)=>{const r=tbe({routeTree:oUe,context:{queryClient:e},history:n,stringifySearch:aAe,defaultPreload:"intent",defaultPendingComponent:Zv,defaultPendingMs:200,defaultPendingMinMs:300});return r.subscribe("onResolved",o=>{t.recordPageView(o.toLocation.pathname),poe(o.toLocation.pathname)}),r},De=e=>typeof e=="string",Bd=()=>{let e,t;const n=new Promise((r,o)=>{e=r,t=o});return n.resolve=e,n.reject=t,n},L5=e=>e==null?"":""+e,iUe=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},aUe=/###/g,U5=e=>e&&e.indexOf("###")>-1?e.replace(aUe,"."):e,$5=e=>!e||De(e),vf=(e,t,n)=>{const r=De(t)?t.split("."):t;let o=0;for(;o<r.length-1;){if($5(e))return{};const s=U5(r[o]);!e[s]&&n&&(e[s]=new n),Object.prototype.hasOwnProperty.call(e,s)?e=e[s]:e={},++o}return $5(e)?{}:{obj:e,k:U5(r[o])}},F5=(e,t,n)=>{const{obj:r,k:o}=vf(e,t,Object);if(r!==void 0||t.length===1){r[o]=n;return}let s=t[t.length-1],a=t.slice(0,t.length-1),u=vf(e,a,Object);for(;u.obj===void 0&&a.length;)s=`${a[a.length-1]}.${s}`,a=a.slice(0,a.length-1),u=vf(e,a,Object),u?.obj&&typeof u.obj[`${u.k}.${s}`]<"u"&&(u.obj=void 0);u.obj[`${u.k}.${s}`]=n},lUe=(e,t,n,r)=>{const{obj:o,k:s}=vf(e,t,Object);o[s]=o[s]||[],o[s].push(n)},Rv=(e,t)=>{const{obj:n,k:r}=vf(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},uUe=(e,t,n)=>{const r=Rv(e,n);return r!==void 0?r:Rv(t,n)},Dq=(e,t,n)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?De(e[r])||e[r]instanceof String||De(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):Dq(e[r],t[r],n):e[r]=t[r]);return e},fu=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var cUe={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const dUe=e=>De(e)?e.replace(/[&<>"'\/]/g,t=>cUe[t]):e;class fUe{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const n=this.regExpMap.get(t);if(n!==void 0)return n;const r=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,r),this.regExpQueue.push(t),r}}const hUe=[" ",",","?","!",";"],pUe=new fUe(20),gUe=(e,t,n)=>{t=t||"",n=n||"";const r=hUe.filter(a=>t.indexOf(a)<0&&n.indexOf(a)<0);if(r.length===0)return!0;const o=pUe.getRegExp(`(${r.map(a=>a==="?"?"\\?":a).join("|")})`);let s=!o.test(e);if(!s){const a=e.indexOf(n);a>0&&!o.test(e.substring(0,a))&&(s=!0)}return s},MA=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;const r=t.split(n);let o=e;for(let s=0;s<r.length;){if(!o||typeof o!="object")return;let a,u="";for(let c=s;c<r.length;++c)if(c!==s&&(u+=n),u+=r[c],a=o[u],a!==void 0){if(["string","number","boolean"].indexOf(typeof a)>-1&&c<r.length-1)continue;s+=c-s+1;break}o=a}return o},Tv=e=>e?.replace("_","-"),mUe={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}};class Ov{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(t,n)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=t||mUe,this.options=n,this.debug=n.debug}log(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"log","",!0)}warn(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"warn","",!0)}error(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"error","")}deprecate(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"warn","WARNING DEPRECATED: ",!0)}forward(t,n,r,o){return o&&!this.debug?null:(De(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new Ov(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new Ov(this.logger,t)}}var $o=new Ov;class db{constructor(){this.observers={}}on(t,n){return t.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const o=this.observers[r].get(n)||0;this.observers[r].set(n,o+1)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t].delete(n)}}emit(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];this.observers[t]&&Array.from(this.observers[t].entries()).forEach(a=>{let[u,c]=a;for(let f=0;f<c;f++)u(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(a=>{let[u,c]=a;for(let f=0;f<c;f++)u.apply(u,[t,...r])})}}class z5 extends db{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,a=o.ignoreJSONStructure!==void 0?o.ignoreJSONStructure:this.options.ignoreJSONStructure;let u;t.indexOf(".")>-1?u=t.split("."):(u=[t,n],r&&(Array.isArray(r)?u.push(...r):De(r)&&s?u.push(...r.split(s)):u.push(r)));const c=Rv(this.data,u);return!c&&!n&&!r&&t.indexOf(".")>-1&&(t=u[0],n=u[1],r=u.slice(2).join(".")),c||!a||!De(r)?c:MA(this.data?.[t]?.[n],r,s)}addResource(t,n,r,o){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const a=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let u=[t,n];r&&(u=u.concat(a?r.split(a):r)),t.indexOf(".")>-1&&(u=t.split("."),o=n,n=u[1]),this.addNamespaces(n),F5(this.data,u,o),s.silent||this.emit("added",t,n,r,o)}addResources(t,n,r){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const s in r)(De(r[s])||Array.isArray(r[s]))&&this.addResource(t,n,s,r[s],{silent:!0});o.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,o,s){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},u=[t,n];t.indexOf(".")>-1&&(u=t.split("."),o=r,r=n,n=u[1]),this.addNamespaces(n);let c=Rv(this.data,u)||{};a.skipCopy||(r=JSON.parse(JSON.stringify(r))),o?Dq(c,r,s):c={...c,...r},F5(this.data,u,c),a.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(o=>n[o]&&Object.keys(n[o]).length>0)}toJSON(){return this.data}}var Lq={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,o){return e.forEach(s=>{t=this.processors[s]?.process(t,n,r,o)??t}),t}};const j5={},B5=e=>!De(e)&&typeof e!="boolean"&&typeof e!="number";class Mv extends db{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),iUe(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=$o.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};return t==null?!1:this.resolve(t,n)?.res!==void 0}extractFromKey(t,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const o=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let s=n.ns||this.options.defaultNS||[];const a=r&&t.indexOf(r)>-1,u=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!gUe(t,r,o);if(a&&!u){const c=t.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:t,namespaces:De(s)?[s]:s};const f=t.split(r);(r!==o||r===o&&this.options.ns.indexOf(f[0])>-1)&&(s=f.shift()),t=f.join(o)}return{key:t,namespaces:De(s)?[s]:s}}translate(t,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const o=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,s=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:a,namespaces:u}=this.extractFromKey(t[t.length-1],n),c=u[u.length-1],f=n.lng||this.language,h=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(f?.toLowerCase()==="cimode"){if(h){const $=n.nsSeparator||this.options.nsSeparator;return o?{res:`${c}${$}${a}`,usedKey:a,exactUsedKey:a,usedLng:f,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:`${c}${$}${a}`}return o?{res:a,usedKey:a,exactUsedKey:a,usedLng:f,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:a}const g=this.resolve(t,n);let m=g?.res;const v=g?.usedKey||a,w=g?.exactUsedKey||a,S=["[object Number]","[object Function]","[object RegExp]"],C=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,E=!this.i18nFormat||this.i18nFormat.handleAsObject,A=n.count!==void 0&&!De(n.count),I=Mv.hasDefaultValue(n),T=A?this.pluralResolver.getSuffix(f,n.count,n):"",N=n.ordinal&&A?this.pluralResolver.getSuffix(f,n.count,{ordinal:!1}):"",M=A&&!n.ordinal&&n.count===0,R=M&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${T}`]||n[`defaultValue${N}`]||n.defaultValue;let k=m;E&&!m&&I&&(k=R);const L=B5(k),q=Object.prototype.toString.apply(k);if(E&&k&&L&&S.indexOf(q)<0&&!(De(C)&&Array.isArray(k))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const $=this.options.returnedObjectHandler?this.options.returnedObjectHandler(v,k,{...n,ns:u}):`key '${a} (${this.language})' returned an object instead of string.`;return o?(g.res=$,g.usedParams=this.getUsedParamsDetails(n),g):$}if(s){const $=Array.isArray(k),D=$?[]:{},j=$?w:v;for(const Z in k)if(Object.prototype.hasOwnProperty.call(k,Z)){const he=`${j}${s}${Z}`;I&&!m?D[Z]=this.translate(he,{...n,defaultValue:B5(R)?R[Z]:void 0,joinArrays:!1,ns:u}):D[Z]=this.translate(he,{...n,joinArrays:!1,ns:u}),D[Z]===he&&(D[Z]=k[Z])}m=D}}else if(E&&De(C)&&Array.isArray(m))m=m.join(C),m&&(m=this.extendTranslation(m,t,n,r));else{let $=!1,D=!1;!this.isValidLookup(m)&&I&&($=!0,m=R),this.isValidLookup(m)||(D=!0,m=a);const Z=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&D?void 0:m,he=I&&R!==m&&this.options.updateMissing;if(D||$||he){if(this.logger.log(he?"updateKey":"missingKey",f,c,a,he?R:m),s){const ue=this.resolve(a,{...n,keySeparator:!1});ue&&ue.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let B=[];const Q=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&Q&&Q[0])for(let ue=0;ue<Q.length;ue++)B.push(Q[ue]);else this.options.saveMissingTo==="all"?B=this.languageUtils.toResolveHierarchy(n.lng||this.language):B.push(n.lng||this.language);const ae=(ue,we,U)=>{const X=I&&U!==m?U:Z;this.options.missingKeyHandler?this.options.missingKeyHandler(ue,c,we,X,he,n):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(ue,c,we,X,he,n),this.emit("missingKey",ue,c,we,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&A?B.forEach(ue=>{const we=this.pluralResolver.getSuffixes(ue,n);M&&n[`defaultValue${this.options.pluralSeparator}zero`]&&we.indexOf(`${this.options.pluralSeparator}zero`)<0&&we.push(`${this.options.pluralSeparator}zero`),we.forEach(U=>{ae([ue],a+U,n[`defaultValue${U}`]||R)})}):ae(B,a,R))}m=this.extendTranslation(m,t,n,g,r),D&&m===a&&this.options.appendNamespaceToMissingKey&&(m=`${c}:${a}`),(D||$)&&this.options.parseMissingKeyHandler&&(m=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}:${a}`:a,$?m:void 0))}return o?(g.res=m,g.usedParams=this.getUsedParamsDetails(n),g):m}extendTranslation(t,n,r,o,s){var a=this;if(this.i18nFormat?.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||o.usedLng,o.usedNS,o.usedKey,{resolved:o});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const f=De(t)&&(r?.interpolation?.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let h;if(f){const m=t.match(this.interpolator.nestingRegexp);h=m&&m.length}let g=r.replace&&!De(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(g={...this.options.interpolation.defaultVariables,...g}),t=this.interpolator.interpolate(t,g,r.lng||this.language||o.usedLng,r),f){const m=t.match(this.interpolator.nestingRegexp),v=m&&m.length;h<v&&(r.nest=!1)}!r.lng&&o&&o.res&&(r.lng=this.language||o.usedLng),r.nest!==!1&&(t=this.interpolator.nest(t,function(){for(var m=arguments.length,v=new Array(m),w=0;w<m;w++)v[w]=arguments[w];return s?.[0]===v[0]&&!r.context?(a.logger.warn(`It seems you are nesting recursively key: ${v[0]} in key: ${n[0]}`),null):a.translate(...v,n)},r)),r.interpolation&&this.interpolator.reset()}const u=r.postProcess||this.options.postProcess,c=De(u)?[u]:u;return t!=null&&c?.length&&r.applyPostProcessor!==!1&&(t=Lq.handle(c,t,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...o,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),t}resolve(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r,o,s,a,u;return De(t)&&(t=[t]),t.forEach(c=>{if(this.isValidLookup(r))return;const f=this.extractFromKey(c,n),h=f.key;o=h;let g=f.namespaces;this.options.fallbackNS&&(g=g.concat(this.options.fallbackNS));const m=n.count!==void 0&&!De(n.count),v=m&&!n.ordinal&&n.count===0,w=n.context!==void 0&&(De(n.context)||typeof n.context=="number")&&n.context!=="",S=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);g.forEach(C=>{this.isValidLookup(r)||(u=C,!j5[`${S[0]}-${C}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(u)&&(j5[`${S[0]}-${C}`]=!0,this.logger.warn(`key "${o}" for languages "${S.join(", ")}" won't get resolved as namespace "${u}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),S.forEach(E=>{if(this.isValidLookup(r))return;a=E;const A=[h];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(A,h,E,C,n);else{let T;m&&(T=this.pluralResolver.getSuffix(E,n.count,n));const N=`${this.options.pluralSeparator}zero`,M=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(m&&(A.push(h+T),n.ordinal&&T.indexOf(M)===0&&A.push(h+T.replace(M,this.options.pluralSeparator)),v&&A.push(h+N)),w){const R=`${h}${this.options.contextSeparator}${n.context}`;A.push(R),m&&(A.push(R+T),n.ordinal&&T.indexOf(M)===0&&A.push(R+T.replace(M,this.options.pluralSeparator)),v&&A.push(R+N))}}let I;for(;I=A.pop();)this.isValidLookup(r)||(s=I,r=this.getResource(E,C,I,n))}))})}),{res:r,usedKey:o,exactUsedKey:s,usedLng:a,usedNS:u}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat?.getResource?this.i18nFormat.getResource(t,n,r,o):this.resourceStore.getResource(t,n,r,o)}getUsedParamsDetails(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=t.replace&&!De(t.replace);let o=r?t.replace:t;if(r&&typeof t.count<"u"&&(o.count=t.count),this.options.interpolation.defaultVariables&&(o={...this.options.interpolation.defaultVariables,...o}),!r){o={...o};for(const s of n)delete o[s]}return o}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n===r.substring(0,n.length)&&t[r]!==void 0)return!0;return!1}}class H5{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=$o.create("languageUtils")}getScriptPartFromCode(t){if(t=Tv(t),!t||t.indexOf("-")<0)return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=Tv(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(De(t)&&t.indexOf("-")>-1){let n;try{n=Intl.getCanonicalLocales(t)[0]}catch{}return n&&this.options.lowerCaseLng&&(n=n.toLowerCase()),n||(this.options.lowerCaseLng?t.toLowerCase():t)}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const o=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(o))&&(n=o)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const o=this.getLanguagePartFromCode(r);if(this.isSupportedCode(o))return n=o;n=this.options.supportedLngs.find(s=>{if(s===o)return s;if(!(s.indexOf("-")<0&&o.indexOf("-")<0)&&(s.indexOf("-")>0&&o.indexOf("-")<0&&s.substring(0,s.indexOf("-"))===o||s.indexOf(o)===0&&o.length>1))return s})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),De(t)&&(t=[t]),Array.isArray(t))return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],t),o=[],s=a=>{a&&(this.isSupportedCode(a)?o.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return De(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&s(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&s(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&s(this.getLanguagePartFromCode(t))):De(t)&&s(this.formatLanguageCode(t)),r.forEach(a=>{o.indexOf(a)<0&&s(this.formatLanguageCode(a))}),o}}const q5={zero:0,one:1,two:2,few:3,many:4,other:5},V5={select:e=>e===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class vUe{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=$o.create("pluralResolver"),this.pluralRulesCache={}}addRule(t,n){this.rules[t]=n}clearCache(){this.pluralRulesCache={}}getRule(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=Tv(t==="dev"?"en":t),o=n.ordinal?"ordinal":"cardinal",s=JSON.stringify({cleanedCode:r,type:o});if(s in this.pluralRulesCache)return this.pluralRulesCache[s];let a;try{a=new Intl.PluralRules(r,{type:o})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),V5;if(!t.match(/-|_/))return V5;const c=this.languageUtils.getLanguagePartFromCode(t);a=this.getRule(c,n)}return this.pluralRulesCache[s]=a,a}needsPlural(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=this.getRule(t,n);return r||(r=this.getRule("dev",n)),r?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,r).map(o=>`${n}${o}`)}getSuffixes(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=this.getRule(t,n);return r||(r=this.getRule("dev",n)),r?r.resolvedOptions().pluralCategories.sort((o,s)=>q5[o]-q5[s]).map(o=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${o}`):[]}getSuffix(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const o=this.getRule(t,r);return o?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${o.select(n)}`:(this.logger.warn(`no plural rule found for: ${t}`),this.getSuffix("dev",n,r))}}const W5=function(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=uUe(e,t,n);return!s&&o&&De(n)&&(s=MA(e,n,r),s===void 0&&(s=MA(t,n,r))),s},y_=e=>e.replace(/\$/g,"$$$$");class yUe{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=$o.create("interpolator"),this.options=t,this.format=t?.interpolation?.format||(n=>n),this.init(t)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});const{escape:n,escapeValue:r,useRawValueToEscape:o,prefix:s,prefixEscaped:a,suffix:u,suffixEscaped:c,formatSeparator:f,unescapeSuffix:h,unescapePrefix:g,nestingPrefix:m,nestingPrefixEscaped:v,nestingSuffix:w,nestingSuffixEscaped:S,nestingOptionsSeparator:C,maxReplaces:E,alwaysFormat:A}=t.interpolation;this.escape=n!==void 0?n:dUe,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=o!==void 0?o:!1,this.prefix=s?fu(s):a||"{{",this.suffix=u?fu(u):c||"}}",this.formatSeparator=f||",",this.unescapePrefix=h?"":g||"-",this.unescapeSuffix=this.unescapePrefix?"":h||"",this.nestingPrefix=m?fu(m):v||fu("$t("),this.nestingSuffix=w?fu(w):S||fu(")"),this.nestingOptionsSeparator=C||",",this.maxReplaces=E||1e3,this.alwaysFormat=A!==void 0?A:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(n,r)=>n?.source===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(t,n,r,o){let s,a,u;const c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},f=v=>{if(v.indexOf(this.formatSeparator)<0){const E=W5(n,c,v,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(E,void 0,r,{...o,...n,interpolationkey:v}):E}const w=v.split(this.formatSeparator),S=w.shift().trim(),C=w.join(this.formatSeparator).trim();return this.format(W5(n,c,S,this.options.keySeparator,this.options.ignoreJSONStructure),C,r,{...o,...n,interpolationkey:S})};this.resetRegExp();const h=o?.missingInterpolationHandler||this.options.missingInterpolationHandler,g=o?.interpolation?.skipOnVariables!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:v=>y_(v)},{regex:this.regexp,safeValue:v=>this.escapeValue?y_(this.escape(v)):y_(v)}].forEach(v=>{for(u=0;s=v.regex.exec(t);){const w=s[1].trim();if(a=f(w),a===void 0)if(typeof h=="function"){const C=h(t,s,o);a=De(C)?C:""}else if(o&&Object.prototype.hasOwnProperty.call(o,w))a="";else if(g){a=s[0];continue}else this.logger.warn(`missed to pass in variable ${w} for interpolating ${t}`),a="";else!De(a)&&!this.useRawValueToEscape&&(a=L5(a));const S=v.safeValue(a);if(t=t.replace(s[0],S),g?(v.regex.lastIndex+=a.length,v.regex.lastIndex-=s[0].length):v.regex.lastIndex=0,u++,u>=this.maxReplaces)break}}),t}nest(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o,s,a;const u=(c,f)=>{const h=this.nestingOptionsSeparator;if(c.indexOf(h)<0)return c;const g=c.split(new RegExp(`${h}[ ]*{`));let m=`{${g[1]}`;c=g[0],m=this.interpolate(m,a);const v=m.match(/'/g),w=m.match(/"/g);((v?.length??0)%2===0&&!w||w.length%2!==0)&&(m=m.replace(/'/g,'"'));try{a=JSON.parse(m),f&&(a={...f,...a})}catch(S){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,S),`${c}${h}${m}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,c};for(;o=this.nestingRegexp.exec(t);){let c=[];a={...r},a=a.replace&&!De(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let f=!1;if(o[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(o[1])){const h=o[1].split(this.formatSeparator).map(g=>g.trim());o[1]=h.shift(),c=h,f=!0}if(s=n(u.call(this,o[1].trim(),a),a),s&&o[0]===t&&!De(s))return s;De(s)||(s=L5(s)),s||(this.logger.warn(`missed to resolve ${o[1]} for nesting ${t}`),s=""),f&&(s=c.reduce((h,g)=>this.format(h,g,r.lng,{...r,interpolationkey:o[1].trim()}),s.trim())),t=t.replace(o[0],s),this.regexp.lastIndex=0}return t}}const bUe=e=>{let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const o=r[1].substring(0,r[1].length-1);t==="currency"&&o.indexOf(":")<0?n.currency||(n.currency=o.trim()):t==="relativetime"&&o.indexOf(":")<0?n.range||(n.range=o.trim()):o.split(";").forEach(a=>{if(a){const[u,...c]=a.split(":"),f=c.join(":").trim().replace(/^'+|'+$/g,""),h=u.trim();n[h]||(n[h]=f),f==="false"&&(n[h]=!1),f==="true"&&(n[h]=!0),isNaN(f)||(n[h]=parseInt(f,10))}})}return{formatName:t,formatOptions:n}},hu=e=>{const t={};return(n,r,o)=>{let s=o;o&&o.interpolationkey&&o.formatParams&&o.formatParams[o.interpolationkey]&&o[o.interpolationkey]&&(s={...s,[o.interpolationkey]:void 0});const a=r+JSON.stringify(s);let u=t[a];return u||(u=e(Tv(r),o),t[a]=u),u(n)}};class SUe{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=$o.create("formatter"),this.options=t,this.formats={number:hu((n,r)=>{const o=new Intl.NumberFormat(n,{...r});return s=>o.format(s)}),currency:hu((n,r)=>{const o=new Intl.NumberFormat(n,{...r,style:"currency"});return s=>o.format(s)}),datetime:hu((n,r)=>{const o=new Intl.DateTimeFormat(n,{...r});return s=>o.format(s)}),relativetime:hu((n,r)=>{const o=new Intl.RelativeTimeFormat(n,{...r});return s=>o.format(s,r.range||"day")}),list:hu((n,r)=>{const o=new Intl.ListFormat(n,{...r});return s=>o.format(s)})},this.init(t)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};this.formatSeparator=n.interpolation.formatSeparator||","}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=hu(n)}format(t,n,r){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=n.split(this.formatSeparator);if(s.length>1&&s[0].indexOf("(")>1&&s[0].indexOf(")")<0&&s.find(u=>u.indexOf(")")>-1)){const u=s.findIndex(c=>c.indexOf(")")>-1);s[0]=[s[0],...s.splice(1,u)].join(this.formatSeparator)}return s.reduce((u,c)=>{const{formatName:f,formatOptions:h}=bUe(c);if(this.formats[f]){let g=u;try{const m=o?.formatParams?.[o.interpolationkey]||{},v=m.locale||m.lng||o.locale||o.lng||r;g=this.formats[f](u,v,{...h,...o,...m})}catch(m){this.logger.warn(m)}return g}else this.logger.warn(`there was no format function for ${f}`);return u},t)}}const wUe=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class CUe extends db{constructor(t,n,r){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=t,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=o,this.logger=$o.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=o.maxParallelReads||10,this.readingCalls=0,this.maxRetries=o.maxRetries>=0?o.maxRetries:5,this.retryTimeout=o.retryTimeout>=1?o.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(r,o.backend,o)}queueLoad(t,n,r,o){const s={},a={},u={},c={};return t.forEach(f=>{let h=!0;n.forEach(g=>{const m=`${f}|${g}`;!r.reload&&this.store.hasResourceBundle(f,g)?this.state[m]=2:this.state[m]<0||(this.state[m]===1?a[m]===void 0&&(a[m]=!0):(this.state[m]=1,h=!1,a[m]===void 0&&(a[m]=!0),s[m]===void 0&&(s[m]=!0),c[g]===void 0&&(c[g]=!0)))}),h||(u[f]=!0)}),(Object.keys(s).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:o}),{toLoad:Object.keys(s),pending:Object.keys(a),toLoadLanguages:Object.keys(u),toLoadNamespaces:Object.keys(c)}}loaded(t,n,r){const o=t.split("|"),s=o[0],a=o[1];n&&this.emit("failedLoading",s,a,n),!n&&r&&this.store.addResourceBundle(s,a,r,void 0,void 0,{skipCopy:!0}),this.state[t]=n?-1:2,n&&r&&(this.state[t]=0);const u={};this.queue.forEach(c=>{lUe(c.loaded,[s],a),wUe(c,t),n&&c.errors.push(n),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(f=>{u[f]||(u[f]={});const h=c.loaded[f];h.length&&h.forEach(g=>{u[f][g]===void 0&&(u[f][g]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",u),this.queue=this.queue.filter(c=>!c.done)}read(t,n,r){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;if(!t.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:o,wait:s,callback:a});return}this.readingCalls++;const u=(f,h)=>{if(this.readingCalls--,this.waitingReads.length>0){const g=this.waitingReads.shift();this.read(g.lng,g.ns,g.fcName,g.tried,g.wait,g.callback)}if(f&&h&&o<this.maxRetries){setTimeout(()=>{this.read.call(this,t,n,r,o+1,s*2,a)},s);return}a(f,h)},c=this.backend[r].bind(this.backend);if(c.length===2){try{const f=c(t,n);f&&typeof f.then=="function"?f.then(h=>u(null,h)).catch(u):u(null,f)}catch(f){u(f)}return}return c(t,n,u)}prepareLoading(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();De(t)&&(t=this.languageUtils.toResolveHierarchy(t)),De(n)&&(n=[n]);const s=this.queueLoad(t,n,r,o);if(!s.toLoad.length)return s.pending.length||o(),null;s.toLoad.forEach(a=>{this.loadOne(a)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=t.split("|"),o=r[0],s=r[1];this.read(o,s,"read",void 0,void 0,(a,u)=>{a&&this.logger.warn(`${n}loading namespace ${s} for language ${o} failed`,a),!a&&u&&this.logger.log(`${n}loaded namespace ${s} for language ${o}`,u),this.loaded(t,a,u)})}saveMissing(t,n,r,o,s){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},u=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend?.create){const c={...a,isUpdate:s},f=this.backend.create.bind(this.backend);if(f.length<6)try{let h;f.length===5?h=f(t,n,r,o,c):h=f(t,n,r,o),h&&typeof h.then=="function"?h.then(g=>u(null,g)).catch(u):u(null,h)}catch(h){u(h)}else f(t,n,r,o,u,c)}!t||!t[0]||this.store.addResource(t[0],n,r,o)}}}const G5=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),De(e[1])&&(t.defaultValue=e[1]),De(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const n=e[3]||e[2];Object.keys(n).forEach(r=>{t[r]=n[r]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),K5=e=>(De(e.ns)&&(e.ns=[e.ns]),De(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),De(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),typeof e.initImmediate=="boolean"&&(e.initAsync=e.initImmediate),e),Gg=()=>{},EUe=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class Qf extends db{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=K5(t),this.services={},this.logger=$o,this.modules={external:[]},EUe(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(){var t=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof n=="function"&&(r=n,n={}),n.defaultNS==null&&n.ns&&(De(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const o=G5();this.options={...o,...this.options,...K5(n)},this.options.interpolation={...o.interpolation,...this.options.interpolation},n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);const s=h=>h?typeof h=="function"?new h:h:null;if(!this.options.isClone){this.modules.logger?$o.init(s(this.modules.logger),this.options):$o.init(null,this.options);let h;this.modules.formatter?h=this.modules.formatter:h=SUe;const g=new H5(this.options);this.store=new z5(this.options.resources,this.options);const m=this.services;m.logger=$o,m.resourceStore=this.store,m.languageUtils=g,m.pluralResolver=new vUe(g,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),h&&(!this.options.interpolation.format||this.options.interpolation.format===o.interpolation.format)&&(m.formatter=s(h),m.formatter.init(m,this.options),this.options.interpolation.format=m.formatter.format.bind(m.formatter)),m.interpolator=new yUe(this.options),m.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},m.backendConnector=new CUe(s(this.modules.backend),m.resourceStore,m,this.options),m.backendConnector.on("*",function(v){for(var w=arguments.length,S=new Array(w>1?w-1:0),C=1;C<w;C++)S[C-1]=arguments[C];t.emit(v,...S)}),this.modules.languageDetector&&(m.languageDetector=s(this.modules.languageDetector),m.languageDetector.init&&m.languageDetector.init(m,this.options.detection,this.options)),this.modules.i18nFormat&&(m.i18nFormat=s(this.modules.i18nFormat),m.i18nFormat.init&&m.i18nFormat.init(this)),this.translator=new Mv(this.services,this.options),this.translator.on("*",function(v){for(var w=arguments.length,S=new Array(w>1?w-1:0),C=1;C<w;C++)S[C-1]=arguments[C];t.emit(v,...S)}),this.modules.external.forEach(v=>{v.init&&v.init(this)})}if(this.format=this.options.interpolation.format,r||(r=Gg),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const h=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);h.length>0&&h[0]!=="dev"&&(this.options.lng=h[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(h=>{this[h]=function(){return t.store[h](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(h=>{this[h]=function(){return t.store[h](...arguments),t}});const c=Bd(),f=()=>{const h=(g,m)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),c.resolve(m),r(g,m)};if(this.languages&&!this.isInitialized)return h(null,this.t.bind(this));this.changeLanguage(this.options.lng,h)};return this.options.resources||!this.options.initAsync?f():setTimeout(f,0),c}loadResources(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Gg;const o=De(t)?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(o?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const s=[],a=u=>{if(!u||u==="cimode")return;this.services.languageUtils.toResolveHierarchy(u).forEach(f=>{f!=="cimode"&&s.indexOf(f)<0&&s.push(f)})};o?a(o):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(c=>a(c)),this.options.preload?.forEach?.(u=>a(u)),this.services.backendConnector.load(s,this.options.ns,u=>{!u&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(u)})}else r(null)}reloadResources(t,n,r){const o=Bd();return typeof t=="function"&&(r=t,t=void 0),typeof n=="function"&&(r=n,n=void 0),t||(t=this.languages),n||(n=this.options.ns),r||(r=Gg),this.services.backendConnector.reload(t,n,s=>{o.resolve(),r(s)}),o}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&Lq.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1))for(let n=0;n<this.languages.length;n++){const r=this.languages[n];if(!(["cimode","dev"].indexOf(r)>-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}changeLanguage(t,n){var r=this;this.isLanguageChangingTo=t;const o=Bd();this.emit("languageChanging",t);const s=c=>{this.language=c,this.languages=this.services.languageUtils.toResolveHierarchy(c),this.resolvedLanguage=void 0,this.setResolvedLanguage(c)},a=(c,f)=>{f?(s(f),this.translator.changeLanguage(f),this.isLanguageChangingTo=void 0,this.emit("languageChanged",f),this.logger.log("languageChanged",f)):this.isLanguageChangingTo=void 0,o.resolve(function(){return r.t(...arguments)}),n&&n(c,function(){return r.t(...arguments)})},u=c=>{!t&&!c&&this.services.languageDetector&&(c=[]);const f=De(c)?c:this.services.languageUtils.getBestMatchFromCodes(c);f&&(this.language||s(f),this.translator.language||this.translator.changeLanguage(f),this.services.languageDetector?.cacheUserLanguage?.(f)),this.loadResources(f,h=>{a(h,f)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?u(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(u):this.services.languageDetector.detect(u):u(t),o}getFixedT(t,n,r){var o=this;const s=function(a,u){let c;if(typeof u!="object"){for(var f=arguments.length,h=new Array(f>2?f-2:0),g=2;g<f;g++)h[g-2]=arguments[g];c=o.options.overloadTranslationOptionHandler([a,u].concat(h))}else c={...u};c.lng=c.lng||s.lng,c.lngs=c.lngs||s.lngs,c.ns=c.ns||s.ns,c.keyPrefix!==""&&(c.keyPrefix=c.keyPrefix||r||s.keyPrefix);const m=o.options.keySeparator||".";let v;return c.keyPrefix&&Array.isArray(a)?v=a.map(w=>`${c.keyPrefix}${m}${w}`):v=c.keyPrefix?`${c.keyPrefix}${m}${a}`:a,o.t(v,c)};return De(t)?s.lng=t:s.lngs=t,s.ns=n,s.keyPrefix=r,s}t(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.translator?.translate(...n)}exists(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.translator?.exists(...n)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],o=this.options?this.options.fallbackLng:!1,s=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(u,c)=>{const f=this.services.backendConnector.state[`${u}|${c}`];return f===-1||f===0||f===2};if(n.precheck){const u=n.precheck(this,a);if(u!==void 0)return u}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(r,t)&&(!o||a(s,t)))}loadNamespaces(t,n){const r=Bd();return this.options.ns?(De(t)&&(t=[t]),t.forEach(o=>{this.options.ns.indexOf(o)<0&&this.options.ns.push(o)}),this.loadResources(o=>{r.resolve(),n&&n(o)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=Bd();De(t)&&(t=[t]);const o=this.options.preload||[],s=t.filter(a=>o.indexOf(a)<0&&this.services.languageUtils.isSupportedCode(a));return s.length?(this.options.preload=o.concat(s),this.loadResources(a=>{r.resolve(),n&&n(a)}),r):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!t)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services?.languageUtils||new H5(G5());return n.indexOf(r.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new Qf(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Gg;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const o={...this.options,...t,isClone:!0},s=new Qf(o);if((t.debug!==void 0||t.prefix!==void 0)&&(s.logger=s.logger.clone(t)),["store","services","language"].forEach(u=>{s[u]=this[u]}),s.services={...this.services},s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},r){const u=Object.keys(this.store.data).reduce((c,f)=>(c[f]={...this.store.data[f]},Object.keys(c[f]).reduce((h,g)=>(h[g]={...c[f][g]},h),{})),{});s.store=new z5(u,o),s.services.resourceStore=s.store}return s.translator=new Mv(s.services,o),s.translator.on("*",function(u){for(var c=arguments.length,f=new Array(c>1?c-1:0),h=1;h<c;h++)f[h-1]=arguments[h];s.emit(u,...f)}),s.init(o,n),s.translator.options=o,s.translator.backendConnector.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},s}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Bn=Qf.createInstance();Bn.createInstance=Qf.createInstance;Bn.createInstance;Bn.dir;Bn.init;Bn.loadResources;Bn.reloadResources;Bn.use;Bn.changeLanguage;Bn.getFixedT;Bn.t;Bn.exists;Bn.setDefaultNamespace;Bn.hasLoadedNamespace;Bn.loadNamespaces;Bn.loadLanguages;const{slice:_Ue,forEach:xUe}=[];function AUe(e){return xUe.call(_Ue.call(arguments,1),t=>{if(t)for(const n in t)e[n]===void 0&&(e[n]=t[n])}),e}function IUe(e){return typeof e!="string"?!1:[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(n=>n.test(e))}const Z5=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,RUe=function(e,t){const r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},o=encodeURIComponent(t);let s=`${e}=${o}`;if(r.maxAge>0){const a=r.maxAge-0;if(Number.isNaN(a))throw new Error("maxAge should be a Number");s+=`; Max-Age=${Math.floor(a)}`}if(r.domain){if(!Z5.test(r.domain))throw new TypeError("option domain is invalid");s+=`; Domain=${r.domain}`}if(r.path){if(!Z5.test(r.path))throw new TypeError("option path is invalid");s+=`; Path=${r.path}`}if(r.expires){if(typeof r.expires.toUTCString!="function")throw new TypeError("option expires is invalid");s+=`; Expires=${r.expires.toUTCString()}`}if(r.httpOnly&&(s+="; HttpOnly"),r.secure&&(s+="; Secure"),r.sameSite)switch(typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite){case!0:s+="; SameSite=Strict";break;case"lax":s+="; SameSite=Lax";break;case"strict":s+="; SameSite=Strict";break;case"none":s+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return r.partitioned&&(s+="; Partitioned"),s},Y5={create(e,t,n,r){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};n&&(o.expires=new Date,o.expires.setTime(o.expires.getTime()+n*60*1e3)),r&&(o.domain=r),document.cookie=RUe(e,t,o)},read(e){const t=`${e}=`,n=document.cookie.split(";");for(let r=0;r<n.length;r++){let o=n[r];for(;o.charAt(0)===" ";)o=o.substring(1,o.length);if(o.indexOf(t)===0)return o.substring(t.length,o.length)}return null},remove(e,t){this.create(e,"",-1,t)}};var TUe={name:"cookie",lookup(e){let{lookupCookie:t}=e;if(t&&typeof document<"u")return Y5.read(t)||void 0},cacheUserLanguage(e,t){let{lookupCookie:n,cookieMinutes:r,cookieDomain:o,cookieOptions:s}=t;n&&typeof document<"u"&&Y5.create(n,e,r,o,s)}},OUe={name:"querystring",lookup(e){let{lookupQuerystring:t}=e,n;if(typeof window<"u"){let{search:r}=window.location;!window.location.search&&window.location.hash?.indexOf("?")>-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));const s=r.substring(1).split("&");for(let a=0;a<s.length;a++){const u=s[a].indexOf("=");u>0&&s[a].substring(0,u)===t&&(n=s[a].substring(u+1))}}return n}},MUe={name:"hash",lookup(e){let{lookupHash:t,lookupFromHashIndex:n}=e,r;if(typeof window<"u"){const{hash:o}=window.location;if(o&&o.length>2){const s=o.substring(1);if(t){const a=s.split("&");for(let u=0;u<a.length;u++){const c=a[u].indexOf("=");c>0&&a[u].substring(0,c)===t&&(r=a[u].substring(c+1))}}if(r)return r;if(!r&&n>-1){const a=o.match(/\/([a-zA-Z-]*)/g);return Array.isArray(a)?a[typeof n=="number"?n:0]?.replace("/",""):void 0}}}return r}};let pu=null;const Q5=()=>{if(pu!==null)return pu;try{if(pu=typeof window<"u"&&window.localStorage!==null,!pu)return!1;const e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{pu=!1}return pu};var PUe={name:"localStorage",lookup(e){let{lookupLocalStorage:t}=e;if(t&&Q5())return window.localStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupLocalStorage:n}=t;n&&Q5()&&window.localStorage.setItem(n,e)}};let gu=null;const X5=()=>{if(gu!==null)return gu;try{if(gu=typeof window<"u"&&window.sessionStorage!==null,!gu)return!1;const e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{gu=!1}return gu};var NUe={name:"sessionStorage",lookup(e){let{lookupSessionStorage:t}=e;if(t&&X5())return window.sessionStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupSessionStorage:n}=t;n&&X5()&&window.sessionStorage.setItem(n,e)}},kUe={name:"navigator",lookup(e){const t=[];if(typeof navigator<"u"){const{languages:n,userLanguage:r,language:o}=navigator;if(n)for(let s=0;s<n.length;s++)t.push(n[s]);r&&t.push(r),o&&t.push(o)}return t.length>0?t:void 0}},DUe={name:"htmlTag",lookup(e){let{htmlTag:t}=e,n;const r=t||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(n=r.getAttribute("lang")),n}},LUe={name:"path",lookup(e){let{lookupFromPathIndex:t}=e;if(typeof window>"u")return;const n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(n)?n[typeof t=="number"?t:0]?.replace("/",""):void 0}},UUe={name:"subdomain",lookup(e){let{lookupFromSubdomainIndex:t}=e;const n=typeof t=="number"?t+1:1,r=typeof window<"u"&&window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(r)return r[n]}};let Uq=!1;try{document.cookie,Uq=!0}catch{}const $q=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];Uq||$q.splice(1,1);const $Ue=()=>({order:$q,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:e=>e});class Fq{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(t,n)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t,this.options=AUe(n,this.options||{},$Ue()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=o=>o.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=r,this.addDetector(TUe),this.addDetector(OUe),this.addDetector(PUe),this.addDetector(NUe),this.addDetector(kUe),this.addDetector(DUe),this.addDetector(LUe),this.addDetector(UUe),this.addDetector(MUe)}addDetector(t){return this.detectors[t.name]=t,this}detect(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,n=[];return t.forEach(r=>{if(this.detectors[r]){let o=this.detectors[r].lookup(this.options);o&&typeof o=="string"&&(o=[o]),o&&(n=n.concat(o))}}),n=n.filter(r=>r!=null&&!IUe(r)).map(r=>this.options.convertDetectedLanguage(r)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?n:n.length>0?n[0]:null}cacheUserLanguage(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;n&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||n.forEach(r=>{this.detectors[r]&&this.detectors[r].cacheUserLanguage(t,this.options)}))}}Fq.type="languageDetector";const zq=["__proto__","constructor","prototype"];function jq(e){return!(typeof e!="string"||e.length===0||e.length>128||zq.indexOf(e)>-1||e.indexOf("..")>-1||e.indexOf("\\")>-1||/[?#%:&=;\s]/.test(e)||/[\x00-\x1F\x7F]/.test(e))}function Bq(e){return!(!jq(e)||e.indexOf("/")>-1||e.indexOf("@")>-1)}function FUe(e){return!(!jq(e)||e.indexOf("//")>-1)}const zUe={lng:Bq,ns:FUe};function Kg(e){return typeof e!="string"?e:e.replace(/[\r\n\x00-\x1F\x7F]/g," ")}function jUe(e){if(typeof e!="string"||e.length===0)return e;try{const t=new URL(e);return t.username||t.password?(t.username="",t.password="",t.toString()):e}catch{return e.replace(/(\/\/)[^/@\s]+@/g,"$1")}}function Hq(){return typeof XMLHttpRequest=="function"||typeof XMLHttpRequest=="object"}function BUe(e){return!!e&&typeof e.then=="function"}function HUe(e){return BUe(e)?e:Promise.resolve(e)}const qUe=/\{\{(.+?)\}\}/g,J5=/^[/\\]{2}/;function e8(e,t){let n=!1;const r=e.replace(qUe,(o,s)=>{const a=s.trim();if(zq.indexOf(a)>-1)return o;const u=t[a];if(u==null)return o;const c=zUe[a]||Bq,f=String(u).split("+");for(const h of f)if(!c(h))return n=!0,o;return f.join("+")});return n||J5.test(r)&&!J5.test(e)?null:r}const Ha=typeof globalThis<"u"?globalThis:typeof global<"u"?global:typeof window<"u"?window:void 0;let Pv;typeof fetch=="function"?Pv=fetch:Ha&&typeof Ha.fetch=="function"&&(Pv=Ha.fetch);const t8=Hq()&&Ha?Ha.XMLHttpRequest:void 0,VUe=typeof ActiveXObject=="function"&&Ha?Ha.ActiveXObject:void 0,qq=["__proto__","constructor","prototype"],PA=(e,t)=>{if(t&&typeof t=="object"){let n="";for(const r of Object.keys(t))qq.indexOf(r)>-1||(n+="&"+encodeURIComponent(r)+"="+encodeURIComponent(t[r]));if(!n)return e;e=e+(e.indexOf("?")!==-1?"&":"?")+n.slice(1)}return e},n8=(e,t,n,r)=>{const o=s=>{if(!s.ok)return n(s.statusText||"Error",{status:s.status});s.text().then(a=>{n(null,{status:s.status,data:a})}).catch(n)};if(r){const s=r(e,t);if(s instanceof Promise){s.then(o).catch(n);return}}typeof fetch=="function"?fetch(e,t).then(o).catch(n):Pv(e,t).then(o).catch(n)},WUe=(e,t,n,r)=>{e.queryStringParams&&(t=PA(t,e.queryStringParams));const o={...typeof e.customHeaders=="function"?e.customHeaders():e.customHeaders};typeof window>"u"&&typeof global<"u"&&typeof global.process<"u"&&global.process.versions&&global.process.versions.node&&(o["User-Agent"]=`i18next-http-backend (node/${global.process.version}; ${global.process.platform} ${global.process.arch})`),n&&(o["Content-Type"]="application/json");const s=typeof e.requestOptions=="function"?e.requestOptions(n):e.requestOptions,a={method:n?"POST":"GET",body:n?e.stringify(n):void 0,headers:o,...e._omitFetchOptions?{}:s},u=typeof e.alternateFetch=="function"&&e.alternateFetch.length>=1?e.alternateFetch:void 0;try{n8(t,a,r,u)}catch(c){if(!s||Object.keys(s).length===0||!c.message||c.message.indexOf("not implemented")<0)return r(c);try{Object.keys(s).forEach(f=>{delete a[f]}),n8(t,a,r,u),e._omitFetchOptions=!0}catch(f){r(f)}}},GUe=(e,t,n,r)=>{n&&typeof n=="object"&&(n=PA("",n).slice(1)),e.queryStringParams&&(t=PA(t,e.queryStringParams));try{const o=t8?new t8:new VUe("MSXML2.XMLHTTP.3.0");o.open(n?"POST":"GET",t,1),e.crossDomain||o.setRequestHeader("X-Requested-With","XMLHttpRequest"),o.withCredentials=!!e.withCredentials,n&&o.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),o.overrideMimeType&&o.overrideMimeType("application/json");let s=e.customHeaders;if(s=typeof s=="function"?s():s,s)for(const a of Object.keys(s))qq.indexOf(a)>-1||o.setRequestHeader(a,s[a]);o.onreadystatechange=()=>{o.readyState>3&&r(o.status>=400?o.statusText:null,{status:o.status,data:o.responseText})},o.send(n)}catch(o){console&&console.log(o)}},KUe=(e,t,n,r)=>{if(typeof n=="function"&&(r=n,n=void 0),r=r||(()=>{}),Pv&&t.indexOf("file:")!==0)return WUe(e,t,n,r);if(Hq()||typeof ActiveXObject=="function")return GUe(e,t,n,r);r(new Error("No fetch and no xhr implementation found!"))},ZUe=()=>({loadPath:"/locales/{{lng}}/{{ns}}.json",addPath:"/locales/add/{{lng}}/{{ns}}",parse:e=>JSON.parse(e),stringify:JSON.stringify,parsePayload:(e,t,n)=>({[t]:n||""}),parseLoadPayload:(e,t)=>{},request:KUe,reloadInterval:typeof window<"u"?!1:3600*1e3,customHeaders:{},queryStringParams:{},crossDomain:!1,withCredentials:!1,overrideMimeType:!1,requestOptions:{mode:"cors",credentials:"same-origin",cache:"default"}});var Vq=class{constructor(e,t={},n={}){this.services=e,this.options=t,this.allOptions=n,this.type="backend",this.init(e,t,n)}init(e,t={},n={}){if(this.services=e,this.options={...ZUe(),...this.options||{},...t},this.allOptions=n,this.services&&this.options.reloadInterval){const r=setInterval(()=>this.reload(),this.options.reloadInterval);typeof r=="object"&&typeof r.unref=="function"&&r.unref()}}readMulti(e,t,n){this._readAny(e,e,t,t,n)}read(e,t,n){this._readAny([e],e,[t],t,n)}_readAny(e,t,n,r,o){let s=this.options.loadPath;typeof this.options.loadPath=="function"&&(s=this.options.loadPath(e,n)),s=HUe(s),s.then(a=>{if(!a)return o(null,{});const u=e8(a,{lng:e.join("+"),ns:n.join("+")});if(u==null){const c=e.map(Kg).join(", "),f=n.map(Kg).join(", ");return o(new Error("i18next-http-backend: unsafe lng/ns value — refusing to build request URL for languages=["+c+"] namespaces=["+f+"]"),!1)}this.loadUrl(u,o,t,r)})}loadUrl(e,t,n,r){const o=typeof n=="string"?[n]:n,s=typeof r=="string"?[r]:r,a=this.options.parseLoadPayload(o,s),u=Kg(jUe(e));this.options.request(this.options,e,a,(c,f)=>{if(f&&(f.status>=500&&f.status<600||!f.status))return t("failed loading "+u+"; status code: "+f.status,!0);if(f&&f.status>=400&&f.status<500)return t("failed loading "+u+"; status code: "+f.status,!1);if(!f&&c&&c.message){const m=c.message.toLowerCase();if(["failed","fetch","network","load"].find(v=>m.indexOf(v)>-1))return t("failed loading "+u+": "+Kg(c.message),!0)}if(c)return t(c,!1);let h,g;try{typeof f.data=="string"?h=this.options.parse(f.data,n,r):h=f.data}catch{g="failed parsing "+u+" to json"}if(g)return t(g,!1);t(null,h)})}create(e,t,n,r,o){if(!this.options.addPath)return;typeof e=="string"&&(e=[e]);const s=this.options.parsePayload(t,n,r);let a=0;const u=[],c=[];e.forEach(f=>{let h=this.options.addPath;typeof this.options.addPath=="function"&&(h=this.options.addPath(f,t));const g=e8(h,{lng:f,ns:t});if(g==null){a+=1,o&&a===e.length&&o(u,c);return}this.options.request(this.options,g,s,(m,v)=>{a+=1,u.push(m),c.push(v),a===e.length&&typeof o=="function"&&o(u,c)})})}reload(){const{backendConnector:e,languageUtils:t,logger:n}=this.services,r=e.language;if(r&&r.toLowerCase()==="cimode")return;const o=[],s=a=>{t.toResolveHierarchy(a).forEach(u=>{o.indexOf(u)<0&&o.push(u)})};s(r),this.allOptions.preload&&this.allOptions.preload.forEach(a=>s(a)),o.forEach(a=>{this.allOptions.ns.forEach(u=>{e.read(a,u,"read",null,null,(c,f)=>{c&&n.warn(`loading namespace ${u} for language ${a} failed`,c),!c&&f&&n.log(`loaded namespace ${u} for language ${a}`,f),e.loaded(`${a}|${u}`,c,f)})})})}};Vq.type="backend";Bn.use(Vq).use(Fq).use(bAe).init({fallbackLng:"en",supportedLngs:["en","nl","de","fr"],ns:["common","mail"],defaultNS:"common",backend:{loadPath:"/locales/{{lng}}/{{ns}}.json"},detection:{order:["navigator","htmlTag"],caches:[]},interpolation:{escapeValue:!1},react:{useSuspense:!0,bindI18n:"languageChanged loaded"}});const YUe=({authProvider:e,settingsSlots:t=[],rootElementId:n="root"})=>{doe(),sAe(),e.configure(),Ibe(e);const r=eAe();toe(r);const o=new Jme({queryCache:new R9({onError:kbe}),mutationCache:new I9({onError:Dbe}),defaultOptions:{queries:{staleTime:3e4,gcTime:5*6e4,retry:1}}});rAe();const s=sUe(o,r);for(const c of t)if(Object.hasOwn(s.routesByPath,`/settings/${c.id}`))throw new Error(`Settings slot "${c.id}" collides with a built-in settings section`);r.recordPageView(window.location.pathname);const a=document.getElementById(n);if(!a)throw new Error(`Root element not found: #${n}`);const{Shell:u}=e;ube.createRoot(a).render(O.jsx(_.StrictMode,{children:O.jsx(qB.Provider,{value:r,children:O.jsxs(eve,{client:o,children:[O.jsx(Obe,{value:e,children:O.jsx(C3e,{value:t,children:O.jsx(u,{children:O.jsx(obe,{router:s})})})}),!1]})})}))};YUe({authProvider:Ome});export{ic as $,Zv as A,Xr as B,Jee as C,Cne as D,dF as E,ote as F,e7 as G,gr as H,D$ as I,$$e as J,p3e as K,$$ as L,ute as M,Coe as N,o7 as O,PNe as P,MNe as Q,KB as R,hte as S,mte as T,hA as U,q8e as V,sb as W,L_ as X,dq as Y,C$e as Z,fRe as _,Ja as a,uRe as a$,qAe as a0,sT as a1,ty as a2,Qre as a3,mR as a4,gc as a5,i3e as a6,Mbe as a7,E3e as a8,z3e as a9,k8e as aA,ak as aB,nDe as aC,j5e as aD,a$e as aE,r8e as aF,kne as aG,j6e as aH,t6e as aI,z6e as aJ,O8e as aK,kke as aL,Bre as aM,zre as aN,Fre as aO,hn as aP,Qv as aQ,$6 as aR,T5e as aS,cRe as aT,R8e as aU,I8e as aV,T8e as aW,RF as aX,oq as aY,_8e as aZ,A8e as a_,V6e as aa,J3e as ab,W$e as ac,nI as ad,s$e as ae,XH as af,F as ag,r$e as ah,o$e as ai,uTe as aj,kNe as ak,DNe as al,z5e as am,$5e as an,Sf as ao,bF as ap,E$ as aq,wo as ar,bT as as,Kn as at,i$e as au,f6e as av,sh as aw,Hu as ax,iI as ay,N8e as az,yt as b,d6e as b$,Jre as b0,h6e as b1,tf as b2,il as b3,Q8e as b4,gR as b5,X8e as b6,J8e as b7,e$e as b8,p6e as b9,R$e as bA,T$e as bB,QIe as bC,X5e as bD,_$e as bE,h_ as bF,HNe as bG,w$e as bH,F$e as bI,wRe as bJ,V$e as bK,k5e as bL,U5e as bM,L5e as bN,D5e as bO,B$e as bP,j$e as bQ,w3e as bR,z$e as bS,H$e as bT,q$e as bU,s8e as bV,i8e as bW,dte as bX,D8e as bY,gRe as bZ,_6e as b_,s6e as ba,jne as bb,u6e as bc,a6e as bd,o6e as be,nre as bf,sI as bg,W5e as bh,G5e as bi,QNe as bj,XNe as bk,cke as bl,uke as bm,Hne as bn,c6e as bo,ore as bp,KNe as bq,O5e as br,$Ae as bs,x$e as bt,I$e as bu,TIe as bv,A$e as bw,M5e as bx,E$e as by,O$e as bz,iT as c,Wo as c$,f3e as c0,D$e as c1,yte as c2,ene as c3,c8e as c4,Rq as c5,N5 as c6,J$e as c7,G$e as c8,K$e as c9,ane as cA,one as cB,gne as cC,Kf as cD,mRe as cE,Sc as cF,yn as cG,Fm as cH,b9 as cI,Kme as cJ,tve as cK,ove as cL,lve as cM,sve as cN,ive as cO,Vn as cP,cve as cQ,R4 as cR,ave as cS,fke as cT,BNe as cU,o8e as cV,QB as cW,wIe as cX,l$e as cY,XB as cZ,c$e as c_,Z$e as ca,hr as cb,Iye as cc,ST as cd,W6e as ce,Ny as cf,N3e as cg,k$e as ch,mee as ci,$P as cj,QUe as ck,XUe as cl,e6e as cm,uq as cn,K8e as co,Z8e as cp,G8e as cq,y$ as cr,V8e as cs,Re as ct,n$e as cu,SRe as cv,Y8e as cw,W8e as cx,MRe as cy,rne as cz,Zr as d,Q$e as d$,P$e as d0,Cq as d1,h$e as d2,mNe as d3,d$e as d4,f$e as d5,H6e as d6,B6e as d7,dve as d8,w6e as d9,p$e as dA,y$e as dB,IRe as dC,g$e as dD,m$e as dE,v$e as dF,L8e as dG,Xv as dH,v6e as dI,m6e as dJ,F8e as dK,t$e as dL,ONe as dM,B8e as dN,nRe as dO,Bu as dP,g6e as dQ,U$e as dR,b6e as dS,y6e as dT,z8e as dU,N5e as dV,P5e as dW,C6e as dX,H8e as dY,b$e as dZ,S$e as d_,S6e as da,lte as db,sne as dc,lre as dd,ate as de,vre as df,wF as dg,I6e as dh,x6e as di,k6e as dj,Pre as dk,L6e as dl,R6e as dm,D6e as dn,Mre as dp,bre as dq,Gr as dr,i6e as ds,F6e as dt,U6e as du,$6e as dv,N6e as dw,M6e as dx,_F as dy,U8e as dz,dl as e,RLe as e$,E6e as e0,t3e as e1,u$e as e2,M$e as e3,IIe as e4,AIe as e5,P8e as e6,JB as e7,RNe as e8,TNe as e9,m8e as eA,v8e as eB,h8e as eC,tIe as eD,Une as eE,n6e as eF,r6e as eG,J5e as eH,t8e as eI,e8e as eJ,l6e as eK,q5e as eL,YIe as eM,H5e as eN,V5e as eO,KIe as eP,L$e as eQ,ARe as eR,CT as eS,b8e as eT,C8e as eU,S8e as eV,y8e as eW,w8e as eX,X$e as eY,SLe as eZ,_Le as e_,Xke as ea,N$e as eb,A6e as ec,O6e as ed,T6e as ee,P6e as ef,$8e as eg,gte as eh,K5e as ei,Z5e as ej,XIe as ek,Q5e as el,Y5e as em,Di as en,Y$e as eo,k5 as ep,E8e as eq,l8e as er,d8e as es,u8e as et,x8e as eu,a8e as ev,f8e as ew,j8e as ex,p8e as ey,g8e as ez,lR as f,OLe as f0,PLe as f1,nte as f2,M8e as g,B5e as h,n8e as i,O as j,YB as k,R5e as l,F5e as m,Vv as n,Wv as o,rn as p,pte as q,_ as r,ny as s,ete as t,fh as u,A$ as v,fte as w,tI as x,Xee as y,rte as z};
|
|
213
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const a of e.seen.entries()){const u=a[1];if(t===a[0]){s(a);continue}if(e.external){const f=e.external.registry.get(a[0])?.id;if(t!==a[0]&&f){s(a);continue}}if(e.metadataRegistry.get(a[0])?.id){s(a);continue}if(u.cycle){s(a);continue}u.count>1&&e.reused==="ref"&&s(a)}e.external&&(e.sharedDefsExtractedFor=e.external)}function $H(e){const t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;const n=[];for(const r of t){if(!r||typeof r!="object")return;$H(r);const o=Object.keys(r);if(o.length!==1||o[0]!=="type")return;const s=r.type;for(const a of Array.isArray(s)?s:[s]){if(typeof a!="string")return;n.includes(a)||n.push(a)}}delete e.anyOf,e.type=n.length===1?n[0]:n}const FH=new Set(["type","properties","required","additionalProperties"]),f5=["oneOf","anyOf"];function h5(e){const t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function wA(e){const t=[];for(const s of e){if(typeof s!="object"||s.type!=="object")return null;for(const a in s)if(!FH.has(a))return null;t.push(s)}const n={},r=new Set;for(const s of t){for(const a in s.properties){if(Object.prototype.hasOwnProperty.call(n,a))continue;const u=[];for(const f of t){const h=f.properties?.[a]??h5(f);h!=null&&(u.some(g=>JSON.stringify(g)===JSON.stringify(h))||u.push(h))}const c=u.length===1?u[0]:wA(u)??{allOf:u};Xi(n,a,c)}for(const a of s.required??[])r.add(a)}const o={type:"object",properties:n};if(r.size&&(o.required=[...r]),t.every(s=>s.additionalProperties===!1))o.additionalProperties=!1;else{const s=[];for(const a of t){const u=h5(a);u&&!s.some(c=>JSON.stringify(c)===JSON.stringify(u))&&s.push(u)}s.length===1?o.additionalProperties=s[0]:s.length>1&&(o.additionalProperties={allOf:s})}return o}function bMe(e){const t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(const o of FH)if(o in e)return;const n=t.filter(o=>f5.some(s=>Array.isArray(o[s])));let r=null;if(!n.length)r=wA(t);else{const o=n[0],s=f5.find(c=>Array.isArray(o[c]));if(Object.keys(o).length!==1)return;const a=t.filter(c=>c!==o),u=o[s].map(c=>wA([...a,c]));if(u.some(c=>!c))return;r={[s]:u}}r&&(delete e.allOf,mf(e,r))}function zH(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=u=>{const c=e.seen.get(u);if(c.ref===null)return;const f=c.def??c.schema,h={...f},g=c.ref;if(c.ref=null,g){r(g);const v=e.seen.get(g),w=v.schema;if(w.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(f.allOf=f.allOf??[],f.allOf.push(w)):mf(f,w),mf(f,h),u._zod.parent===g)for(const C in f)C==="$ref"||C==="allOf"||C in h||delete f[C];if(w.$ref&&v.def)for(const C in f)C==="$ref"||C==="allOf"||C in v.def&&JSON.stringify(f[C])===JSON.stringify(v.def[C])&&delete f[C]}const m=u._zod.parent;if(m&&m!==g){r(m);const v=e.seen.get(m);if(v?.schema.$ref&&(f.$ref=v.schema.$ref,v.def))for(const w in f)w==="$ref"||w==="allOf"||w in v.def&&JSON.stringify(f[w])===JSON.stringify(v.def[w])&&delete f[w]}e.override({zodSchema:u,jsonSchema:f,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(const u of[...e.seen.entries()].reverse())r(u[0]);if(e.target!=="openapi-3.0")for(const u of e.seen.entries())$H(u[1].def??u[1].schema);for(const u of e.deferred)u();if(e.intersections.length){const u=new Map;for(const c of e.seen.values())for(const f of[c.schema,c.def]){const h=f?.allOf;if(!Array.isArray(h))continue;const g=u.get(h);g?g.push(f):u.set(h,[f])}for(const c of e.intersections)for(const f of u.get(c)??[])bMe(f)}}const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const u=e.external.registry.get(t)?.id;if(!u)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(u)}mf(o,n.defId?n.schema:n.def??n.schema);const s=e.metadataRegistry.get(t)?.id;s!==void 0&&o.id===s&&delete o.id;const a=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(const u of e.seen.entries()){const c=u[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,Xi(a,c.defId,c.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(a).length>0&&(e.target==="draft-2020-12"?o.$defs=a:o.definitions=a);try{const u=JSON.parse(JSON.stringify(o));return Object.defineProperty(u,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ev(t,"input",e.processors),output:Ev(t,"output",e.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function qn(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return qn(r.element,n);if(r.type==="set")return qn(r.valueType,n);if(r.type==="lazy")return qn(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault"||r.type==="catch")return qn(r.innerType,n);if(r.type==="intersection")return qn(r.left,n)||qn(r.right,n);if(r.type==="record"||r.type==="map")return qn(r.keyType,n)||qn(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:qn(r.in,n)||qn(r.out,n);if(r.type==="object"){for(const o in r.shape)if(qn(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(qn(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(qn(o,n))return!0;return!!(r.rest&&qn(r.rest,n))}return!1}const SMe=(e,t={})=>n=>{const r=LH({...n,processors:t});return dn(e,r),UH(r,e),zH(r,e)},Ev=(e,t,n={})=>r=>{const{libraryOptions:o,target:s}=r??{},a=LH({...o??{},target:s,io:t,processors:n});return dn(e,a),UH(a,e),zH(a,e)},rc=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},oc=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},p5=(e,t)=>{rc(e,"minimum",t),oc(e,"maximum",t)},jH=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},BH=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},HH=(e,t)=>{e.mime=e.mime?e.mime.filter(n=>t.includes(n)):[...t]},qH=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},g5=(e,t)=>rc(e,"minimum",t.minimum),m5=(e,t)=>oc(e,"maximum",t.maximum),v5=e=>(t,n)=>{qH(t,n.format);const[r,o]=e[n.format];rc(t,"minimum",r),oc(t,"maximum",o)},wMe={greater_than:(e,t)=>rc(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>oc(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>jH(e,t.value),number_format:v5(aH),bigint_format:v5(BRe),min_length:g5,max_length:m5,length_equals:(e,t)=>p5(e,t.length),min_size:g5,max_size:m5,size_equals:(e,t)=>p5(e,t.size),string_format:(e,t)=>{qH(e,t.format),t.pattern&&BH(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>HH(e,t.mime)};function mo(e){const t={},n=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(const s of r)wMe[s._zod.def.check]?.(t,s._zod.def);const o=e._zod.bag;o.minimum!==void 0&&rc(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&rc(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&oc(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&oc(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&jH(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&HH(t,o.mime);for(const s of o.patterns??[])BH(t,s);return t}const CMe={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},EMe=new Map([[_H,BTe],[mT,HTe]]),VH=e=>EMe.get(e)??e,_Me=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:s,maximum:a,format:u,patterns:c,contentEncoding:f,laxFormat:h}=mo(e);if(typeof s=="number"&&(o.minLength=s),typeof a=="number"&&(o.maxLength=a),u&&(o.format=CMe[u]??u,o.format===""&&delete o.format,(u==="time"||h)&&delete o.format),f&&(o.contentEncoding=f),c&&c.size>0){const g=[...c].map(VH);g.length===1?o.pattern=g[0].source:g.length>1&&(o.allOf=[...g.map(m=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},xMe=(e,t,n,r)=>{const o=n,{minimum:s,maximum:a,multipleOf:u,exclusiveMaximum:c,exclusiveMinimum:f,isInt:h}=mo(e);o.type=h?"integer":"number";const g=typeof f=="number"&&f>=(s??Number.NEGATIVE_INFINITY),m=typeof c=="number"&&c<=(a??Number.POSITIVE_INFINITY),v=t.target==="draft-04"||t.target==="openapi-3.0";if(g?v?(o.minimum=f,o.exclusiveMinimum=!0):o.exclusiveMinimum=f:typeof s=="number"&&(o.minimum=s),m?v?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c:typeof a=="number"&&(o.maximum=a),u){const w=new Set;for(const E of u)Number.isFinite(E)&&E!==0?w.add(Math.abs(E)):Zi(e,t,o,r,`A multipleOf divisor of ${E} cannot be represented in JSON Schema`);const[S,...C]=w;S!==void 0&&(o.multipleOf=S),C.length&&(o.allOf=[...o.allOf??[],...C.map(E=>({multipleOf:E}))])}},AMe=(e,t,n,r)=>{n.type="boolean"},IMe=(e,t,n,r)=>{n.not={}},RMe=(e,t,n,r)=>{},TMe=(e,t,n,r)=>{const o=e._zod.def,s=gA(o.entries);if(s.length===0){n.not={};return}s.every(a=>typeof a=="number")&&(n.type="number"),s.every(a=>typeof a=="string")&&(n.type="string"),n.enum=s},OMe=(e,t,n,r)=>{const o=e._zod.def;if(o.values.length===0){n.not={};return}const s=[];for(const a of o.values)if(a===void 0){if(Zi(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof a=="bigint"){if(Zi(e,t,n,r,"BigInt literals cannot be represented in JSON Schema"))return;s.push(Number(a))}else s.push(a);if(s.length!==0)if(s.length===1){const a=s[0];n.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[a]:n.const=a}else s.every(a=>typeof a=="number")&&(n.type="number"),s.every(a=>typeof a=="string")&&(n.type="string"),s.every(a=>typeof a=="boolean")&&(n.type="boolean"),s.every(a=>a===null)&&(n.type="null"),n.enum=s},MMe=(e,t,n,r)=>{Zi(e,t,n,r,"Custom types cannot be represented in JSON Schema")},PMe=(e,t,n,r)=>{Zi(e,t,n,r,"Transforms cannot be represented in JSON Schema")},NMe=(e,t,n,r)=>{const o=n,s=e._zod.def,{minimum:a,maximum:u}=mo(e);typeof a=="number"&&(o.minItems=a),typeof u=="number"&&(o.maxItems=u),o.type="array",o.items=dn(s.element,t,{...r,path:[...r.path,"items"]})};function _v(e){const t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?_v(t.out):t.type==="catch"?_v(t.innerType):e._zod.optin}const kMe=(e,t,n,r)=>{const o=n,s=e._zod.def,a=s.shape;if(Object.getOwnPropertySymbols(a).length&&Zi(e,t,o,r,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(const f in a)Xi(o.properties,f,dn(a[f],t,{...r,path:[...r.path,"properties",f]}));const c=[];for(const f of Object.keys(a)){const h=s.shape[f];(t.io==="input"?_v(h)===void 0:h._zod.optout===void 0)&&c.push(f)}c.length>0&&(o.required=c),s.catchall?._zod.def.type==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=dn(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},DMe=(e,t,n,r)=>{const o=e._zod.def,s=o.inclusive===!1,a=o.options.map((u,c)=>dn(u,t,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?n.oneOf=a:n.anyOf=a},LMe=(e,t,n,r)=>{const o=e._zod.def,s=dn(o.left,t,{...r,path:[...r.path,"allOf",0]}),a=dn(o.right,t,{...r,path:[...r.path,"allOf",1]}),u=f=>"allOf"in f&&Object.keys(f).length===1,c=[...u(s)?s.allOf:[s],...u(a)?a.allOf:[a]];n.allOf=c,t.intersections.push(c)};function CA(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);const w=e.get(t)?.def;if(!w)return t;const S=CA(e,w,n);return S===w?t:S}for(const w of["anyOf","oneOf"]){const S=t[w];if(!Array.isArray(S))continue;const C=S.map(E=>CA(e,E,n));C.some((E,A)=>E!==S[A])&&(t={...t,[w]:C})}const r=Array.isArray(t.type)?t.type:[t.type],o=!r.includes("string")&&r.some(w=>w==="number"||w==="integer"),s=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!s?.some(w=>typeof w=="number"))return t;const{minimum:a,maximum:u,exclusiveMinimum:c,exclusiveMaximum:f,multipleOf:h,format:g,id:m,...v}=t;return v.enum?v.enum=v.enum.map(w=>typeof w=="number"?String(w):w):typeof v.const=="number"&&(v.const=String(v.const)),o&&(v.type="string",s||(v.pattern=(r.includes("number")?hT:QTe).source)),v}const EA=new WeakMap;function UMe(e){const t=new Map;for(const r of e.seen.values())r.def&&!t.has(r.schema)&&t.set(r.schema,r);const n=new Map;for(const r of EA.get(e)??[]){const o=e.seen.get(r),s=(o?.def??o?.schema)?.propertyNames;if(!s||s===!0||n.has(s))continue;const a=CA(t,s,new Set);a!==s&&n.set(s,a)}if(n.size)for(const r of e.seen.values())for(const o of[r.schema,r.def]){const s=o&&n.get(o.propertyNames);s&&(o.propertyNames=s)}}const $Me=(e,t,n,r)=>{const o=n,s=e._zod.def;o.type="object";const a=s.keyType,u=mo(a).patterns;if(s.mode==="loose"&&u&&u.size>0){const h=dn(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const g of u)Xi(o.patternProperties,VH(g).source,h)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=dn(s.keyType,t,{...r,path:[...r.path,"propertyNames"]});let h=EA.get(t);h||(h=[],EA.set(t,h),t.deferred.push(()=>UMe(t))),h.push(e)}o.additionalProperties=dn(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}const c=a._zod.values,f=t.io==="input"&&_v(s.valueType)!==void 0;if(c&&!s.partial&&!f){const h=[...c].filter(g=>typeof g=="string"||typeof g=="number");h.length>0&&(o.required=h.map(String))}},FMe=(e,t,n,r)=>{const o=e._zod.def,s=dn(o.innerType,t,r),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},zMe=(e,t,n,r)=>{const o=e._zod.def;dn(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},yT=Symbol();function WH(e,t,n,r,o){let s=!1;const a=JSON.stringify(e,(u,c)=>typeof c!="bigint"?c:(s=!0,null));return s?(Zi(t,n,r,o,"BigInt defaults cannot be represented in JSON Schema"),yT):JSON.parse(a)}const jMe=(e,t,n,r)=>{const o=e._zod.def;dn(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType;const a=WH(o.defaultValue,e,t,n,r);a!==yT&&(n.default=a)},BMe=(e,t,n,r)=>{const o=e._zod.def;dn(o.innerType,t,r);const s=t.seen.get(e);if(s.ref=o.innerType,t.io!=="input")return;const a=WH(o.defaultValue,e,t,n,r);a!==yT&&(n._prefault=a)},HMe=(e,t,n,r)=>{const o=e._zod.def;dn(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{Zi(e,t,n,r,"Dynamic catch values are not supported in JSON Schema");return}n.default=a},qMe=(e,t,n,r)=>{const o=e._zod.def,s=o.in._zod.traits.has("$ZodTransform"),a=t.io==="input"?s?o.out:o.in:o.out;dn(a,t,r);const u=t.seen.get(e);u.ref=a},VMe=(e,t,n,r)=>{const o=e._zod.def;dn(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.readOnly=!0},GH=(e,t,n,r)=>{const o=e._zod.def;dn(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},y5=new WeakSet([Object.prototype,Error.prototype]);function Hg(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){const r=n(this);return Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0})}})}const WMe=(e,t)=>{uTe.init(e,t),e.name="ZodError";const n=Object.getPrototypeOf(e);y5.has(n)||(y5.add(n),Hg(n,"format",r=>o=>fTe(r,o)),Hg(n,"flatten",r=>o=>dTe(r,o)),Hg(n,"addIssue",r=>o=>{r.issues.push(o),r.message=JSON.stringify(r.issues,mA,2)}),Hg(n,"addIssues",r=>o=>{r.issues.push(...o),r.message=JSON.stringify(r.issues,mA,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},no=te("ZodError",WMe,void 0,{Parent:Error}),GMe=tb(no),KMe=nb(no),ZMe=dT(no),YMe=fT(no),QMe=yTe(no),XMe=bTe(no),JMe=STe(no),ePe=wTe(no),tPe=CTe(no),nPe=ETe(no),rPe=_Te(no),oPe=xTe(no);function sPe(){So.localeError||Vo(A2e())}function ob(){So.memoizer||Vo({memoizer:E2e()})}const Yt=te("ZodType",(e,t)=>(sPe(),Zt.init(e,t),e.def=t,e.type=t.type,e),{check(...e){const t=this.def;return this.clone(Rr(t,{checks:[...t.checks??[],...e.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Ji(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(JPe(e,t))},superRefine(e,t){return this.check(eNe(e,t))},overwrite(e){return this.check(Ec(e))},optional(){return w5(this)},exactOptional(){return zPe(this)},nullable(){return C5(this)},nullish(){return w5(C5(this))},nonoptional(e){return WPe(this,e)},array(){return JH(this)},or(e){return eq([this,e])},and(e){return DPe(this,e)},transform(e){return E5(this,FPe(e))},default(e){return HPe(this,e)},prefault(e){return VPe(this,e)},catch(e){return KPe(this,e)},pipe(e){return E5(this,e)},readonly(){return QPe(this)},describe(e){const t=this.clone();return ef.add(t,{description:e}),t},meta(...e){if(e.length===0)return ef.get(this);const t=this.clone();return ef.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return uH(this,"~standard",{...bH(this),jsonSchema:{input:Ev(this,"input"),output:Ev(this,"output")}})},set"~standard"(e){Ki(this,"~standard",e)},parse:function e(t,n){return GMe(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await KMe(this,t,n,{callee:e})},safeParse(e,t){return ZMe(this,e,t)},async safeParseAsync(e,t){return YMe(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Ki(this,"spa",e)},validate(e,t){return gTe(this,e,t)},validateAsync(e,t){return vTe(this,e,t)},encode:function e(t,n){return QMe(this,t,n,{callee:e})},decode:function e(t,n){return XMe(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await JMe(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await ePe(this,t,n,{callee:e})},safeEncode(e,t){return tPe(this,e,t)},safeDecode(e,t){return nPe(this,e,t)},async safeEncodeAsync(e,t){return rPe(this,e,t)},async safeDecodeAsync(e,t){return oPe(this,e,t)},toJSONSchema(e){return SMe(this,{})(e)},get description(){return ef.get(this)?.description},get _def(){return this._zod.def}}),KH=te("_ZodString",(e,t)=>{gT.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_Me(e,n,r)},cH({format:e=>mo(e).format??null,minLength:e=>mo(e).minimum??null,maxLength:e=>mo(e).maximum??null},{regex(...e){return this.check(oMe(...e))},includes(...e){return this.check(aMe(...e))},startsWith(...e){return this.check(lMe(...e))},endsWith(...e){return this.check(uMe(...e))},min(...e){return this.check(Cv(...e))},max(...e){return this.check(kH(...e))},length(...e){return this.check(DH(...e))},nonempty(...e){return this.check(Cv(1,...e))},lowercase(e){return this.check(sMe(e))},uppercase(e){return this.check(iMe(e))},trim(){return this.check(dMe())},normalize(...e){return this.check(cMe(...e))},toLowerCase(){return this.check(fMe())},toUpperCase(){return this.check(hMe())},slugify(){return this.check(pMe())}})),iPe=te("ZodString",(e,t)=>{gT.init(e,t),KH.init(e,t)},{email(e){return this.check(MH(QH,e))},url(e){return this.check(D2e(cPe,e))},jwt(e){return this.check(Y2e(xPe,e))},emoji(e){return this.check(L2e(dPe,e))},guid(e){return this.check(O2e(uPe,e))},uuid(e){return this.check(M2e(qg,e))},uuidv4(e){return this.check(P2e(qg,e))},uuidv6(e){return this.check(N2e(qg,e))},uuidv7(e){return this.check(k2e(qg,e))},nanoid(e){return this.check(U2e(fPe,e))},cuid(e){return this.check($2e(hPe,e))},cuid2(e){return this.check(F2e(pPe,e))},ulid(e){return this.check(z2e(gPe,e))},base64(e){return this.check(G2e(CPe,e))},base64url(e){return this.check(K2e(EPe,e))},xid(e){return this.check(j2e(mPe,e))},ksuid(e){return this.check(B2e(vPe,e))},ipv4(e){return this.check(H2e(yPe,e))},ipv6(e){return this.check(q2e(bPe,e))},cidrv4(e){return this.check(V2e(SPe,e))},cidrv6(e){return this.check(W2e(wPe,e))},e164(e){return this.check(Z2e(_Pe,e))},datetime(e){return this.check(PH(ZH,e))},date(e){return this.check(NH(YH,e))},time(e){return this.check(Q2e(aPe,e))},duration(e){return this.check(X2e(lPe,e))}});function Kn(e){return T2e(iPe,e)}const Qt=te("ZodStringFormat",(e,t)=>{Vt.init(e,t),KH.init(e,t)}),ZH=te("ZodISODateTime",(e,t)=>{POe.init(e,t),Qt.init(e,t)}),YH=te("ZodISODate",(e,t)=>{NOe.init(e,t),Qt.init(e,t)}),aPe=te("ZodISOTime",(e,t)=>{kOe.init(e,t),Qt.init(e,t)}),lPe=te("ZodISODuration",(e,t)=>{DOe.init(e,t),Qt.init(e,t)}),QH=te("ZodEmail",(e,t)=>{yOe.init(e,t),Qt.init(e,t)});function i$e(e){return MH(QH,e)}const uPe=te("ZodGUID",(e,t)=>{mOe.init(e,t),Qt.init(e,t)}),qg=te("ZodUUID",(e,t)=>{vOe.init(e,t),Qt.init(e,t)}),cPe=te("ZodURL",(e,t)=>{_Oe.init(e,t),Qt.init(e,t)}),dPe=te("ZodEmoji",(e,t)=>{xOe.init(e,t),Qt.init(e,t)}),fPe=te("ZodNanoID",(e,t)=>{AOe.init(e,t),Qt.init(e,t)}),hPe=te("ZodCUID",(e,t)=>{IOe.init(e,t),Qt.init(e,t)}),pPe=te("ZodCUID2",(e,t)=>{ROe.init(e,t),Qt.init(e,t)}),gPe=te("ZodULID",(e,t)=>{TOe.init(e,t),Qt.init(e,t)}),mPe=te("ZodXID",(e,t)=>{OOe.init(e,t),Qt.init(e,t)}),vPe=te("ZodKSUID",(e,t)=>{MOe.init(e,t),Qt.init(e,t)}),yPe=te("ZodIPv4",(e,t)=>{LOe.init(e,t),Qt.init(e,t)}),bPe=te("ZodIPv6",(e,t)=>{$Oe.init(e,t),Qt.init(e,t)}),SPe=te("ZodCIDRv4",(e,t)=>{FOe.init(e,t),Qt.init(e,t)}),wPe=te("ZodCIDRv6",(e,t)=>{jOe.init(e,t),Qt.init(e,t)}),CPe=te("ZodBase64",(e,t)=>{BOe.init(e,t),Qt.init(e,t)}),EPe=te("ZodBase64URL",(e,t)=>{qOe.init(e,t),Qt.init(e,t)}),_Pe=te("ZodE164",(e,t)=>{VOe.init(e,t),Qt.init(e,t)}),xPe=te("ZodJWT",(e,t)=>{GOe.init(e,t),Qt.init(e,t)}),XH=te("ZodNumber",(e,t)=>{xH.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>xMe(e,n,r,o),e.isFinite=!0},cH({minValue:e=>{const{minimum:t,exclusiveMinimum:n}=mo(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:e=>{const{maximum:t,exclusiveMaximum:n}=mo(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:e=>{const{isInt:t,multipleOf:n}=mo(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>mo(e).format??null},{gt(e,t){return this.check(u5(e,t))},gte(e,t){return this.check(d_(e,t))},min(e,t){return this.check(d_(e,t))},lt(e,t){return this.check(l5(e,t))},lte(e,t){return this.check(c_(e,t))},max(e,t){return this.check(c_(e,t))},int(e){return this.check(b5(e))},safe(e){return this.check(b5(e))},positive(e){return this.check(u5(0,e))},nonnegative(e){return this.check(d_(0,e))},negative(e){return this.check(l5(0,e))},nonpositive(e){return this.check(c_(0,e))},multipleOf(e,t){return this.check(c5(e,t))},step(e,t){return this.check(c5(e,t))},finite(){return this}}));function _A(e){return J2e(XH,e)}const APe=te("ZodNumberFormat",(e,t)=>{KOe.init(e,t),XH.init(e,t)});function b5(e){return eMe(APe,e)}const IPe=te("ZodBoolean",(e,t)=>{ZOe.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>AMe(e,n,r)});function bT(e){return tMe(IPe,e)}const RPe=te("ZodUnknown",(e,t)=>{YOe.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>RMe()});function xv(){return nMe(RPe)}const TPe=te("ZodNever",(e,t)=>{QOe.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>IMe(e,n,r)});function OPe(e){return rMe(TPe,e)}const MPe=te("ZodArray",(e,t)=>{ob(),e2e.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>NMe(e,n,r,o),e.element=t.element},{min(e,t){return this.check(Cv(e,t))},nonempty(e){return this.check(Cv(1,e))},max(e,t){return this.check(kH(e,t))},length(e,t){return this.check(DH(e,t))},unwrap(){return this.element}});function JH(e,t){return gMe(MPe,e,t)}const PPe=te("ZodObject",(e,t)=>{ob(),r2e.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>kMe(e,n,r,o),nTe(e,"shape",n=>n._zod.def.shape,!1)},{keyof(){return ST(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(Rr(this._zod.def,{catchall:e}))},passthrough(){return this.clone(Rr(this._zod.def,{catchall:xv()}))},loose(){return this.clone(Rr(this._zod.def,{catchall:xv()}))},strict(){return this.clone(Rr(this._zod.def,{catchall:OPe()}))},strip(){return this.clone(Rr(this._zod.def,{catchall:void 0}))},extend(e){return VRe(this,e)},safeExtend(e){return WRe(this,e)},merge(e){return GRe(this,e)},pick(e){return HRe(this,e)},omit(e){return qRe(this,e)},partial(...e){return q6(tq,this,e[0])},exactPartial(...e){return q6(nq,this,e[0],"exactPartial")},required(...e){return KRe(rq,this,e[0])}});function wo(e,t){const n={type:"object",shape:e??{},..._e(t)};return new PPe(n)}const NPe=te("ZodUnion",(e,t)=>{o2e.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>DMe(e,n,r,o),e.options=t.options});function eq(e,t){return new NPe({type:"union",options:e,..._e(t)})}const kPe=te("ZodIntersection",(e,t)=>{s2e.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>LMe(e,n,r,o)});function DPe(e,t){return new kPe({type:"intersection",left:e,right:t})}const S5=te("ZodRecord",(e,t)=>{ob(),i2e.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$Me(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function LPe(e,t,n){return!t||!t._zod?new S5({type:"record",keyType:Kn(),valueType:e,..._e(t)}):new S5({type:"record",keyType:e,valueType:t,..._e(n)})}const xA=te("ZodEnum",(e,t)=>{a2e.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(r,o,s)=>TMe(e,r,o),e.enum=t.entries,e.options=[...e._zod.values];const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const s={};for(const a of r)if(n.has(a))s[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new xA({...t,checks:[],..._e(o),entries:s})},e.exclude=(r,o)=>{const s={...t.entries};for(const a of r)if(n.has(a))delete s[a];else throw new Error(`Key ${a} not found in enum`);return new xA({...t,checks:[],..._e(o),entries:s})}});function ST(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new xA({type:"enum",entries:n,..._e(t)})}const UPe=te("ZodLiteral",(e,t)=>{l2e.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>OMe(e,n,r,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function vl(e,t){return new UPe({type:"literal",values:Array.isArray(e)?e:[e],..._e(t)})}const $Pe=te("ZodTransform",(e,t)=>{ob(),u2e.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>PMe(e,n,r,o),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new dH(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(Gf(s,n.value,t));else{const a=s;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),"input"in a||(a.input=n.value),a.inst??(a.inst=e),n.issues.push(Gf(a))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n)):(n.value=o,n)}});function FPe(e){return new $Pe({type:"transform",transform:e})}const tq=te("ZodOptional",(e,t)=>{RH.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>GH(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function w5(e){return new tq({type:"optional",innerType:e})}const nq=te("ZodExactOptional",(e,t)=>{c2e.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>GH(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function zPe(e){return new nq({type:"optional",innerType:e})}const jPe=te("ZodNullable",(e,t)=>{d2e.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>FMe(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function C5(e){return new jPe({type:"nullable",innerType:e})}const BPe=te("ZodDefault",(e,t)=>{f2e.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>jMe(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function HPe(e,t){return new BPe({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():sH(t)}})}const qPe=te("ZodPrefault",(e,t)=>{h2e.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>BMe(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function VPe(e,t){return new qPe({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():sH(t)}})}const rq=te("ZodNonOptional",(e,t)=>{p2e.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>zMe(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function WPe(e,t){return new rq({type:"nonoptional",innerType:e,..._e(t)})}const GPe=te("ZodCatch",(e,t)=>{g2e.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>HMe(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function KPe(e,t){return new GPe({type:"catch",innerType:e,catchValue:typeof t=="function"?t:oTe(t)})}const ZPe=te("ZodPipe",(e,t)=>{m2e.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qMe(e,n,r,o),e.in=t.in,e.out=t.out});function E5(e,t){return new ZPe({type:"pipe",in:e,out:t})}const YPe=te("ZodReadonly",(e,t)=>{v2e.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>VMe(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function QPe(e){return new YPe({type:"readonly",innerType:e})}const XPe=te("ZodCustom",(e,t)=>{y2e.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>MMe(e,n,r,o)});function JPe(e,t={}){return mMe(XPe,e,t)}function eNe(e,t){return vMe(e,t)}function tNe(e){return PH(ZH,e)}function nNe(e){return NH(YH,e)}wo({kind:vl("Boolean"),value:bT()});wo({kind:vl("String"),value:Kn()});wo({kind:vl("Number"),value:_A()});wo({kind:vl("StringList"),value:JH(Kn())});wo({kind:vl("Map"),value:LPe(Kn(),Kn())});wo({kind:vl("MutedFlag"),value:wo({value:bT(),setAt:_A(),setBy:Kn().optional(),expiresAt:_A().optional(),reason:Kn().optional()})});const rNe=e=>e.hierarchyDelimiter.length===0?[e.fullPath]:e.fullPath.split(e.hierarchyDelimiter),Kf=e=>{const t=rNe(e);return t[t.length-1]||e.fullPath},oNe=(e,t)=>{switch(e.kind){case"appointed":case"flagged":return{allowed:!0,mailbox:e.mailbox};case"proposed":return t==="resolved"?{allowed:!0,mailbox:e.mailbox}:{allowed:!1,reason:"unconfirmed"};case"appointment_stale":return{allowed:!1,reason:"stale"};default:return{allowed:!1,reason:"none"}}},sNe=(e,t)=>oNe(e,t).allowed,iNe={[ru.Appointed]:{kind:"appointed",mailbox:null},[ru.Flagged]:{kind:"flagged",mailbox:null},[ru.Reserved]:{kind:"reserved",mailbox:null},[ru.Proposed]:{kind:"proposed",mailbox:null},[ru.Stale]:{kind:"appointment_stale",appointedMailboxId:"",fallback:{kind:"none"}},[ru.None]:{kind:"none"}},aNe=(e,t)=>sNe(iNe[e],t),wT=()=>typeof navigator<"u"&&(navigator.language||navigator.languages?.[0])||"en-US",Wo=(e,t)=>new Intl.NumberFormat(wT(),t).format(e),lNe=/^-?\d+$/,CT=e=>{if(e instanceof Date)return e;if(typeof e=="number")return new Date(e);if(typeof e=="string"){const t=e.trim();return lNe.test(t)?new Date(Number(t)):new Date(t)}return new Date(Number.NaN)},ET=e=>Number.isFinite(e.getTime()),tf=(e,t)=>{const n=CT(e);return ET(n)?new Intl.DateTimeFormat(wT(),t).format(n):""},oq=(e,t)=>tf(e,{short:{month:"short",day:"numeric"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"},time:{hour:"numeric",minute:"numeric"},datetime:{month:"short",day:"numeric",hour:"numeric",minute:"numeric"}}[t]),a$e=e=>{const t=CT(e);if(!ET(t))return"";const n=new Intl.RelativeTimeFormat(wT(),{numeric:"auto"}),r=Date.now(),o=t.getTime()-r,s=Math.round(o/1e3),a=Math.round(o/(1e3*60)),u=Math.round(o/(1e3*60*60)),c=Math.round(o/(1e3*60*60*24)),f=Math.round(o/(1e3*60*60*24*7));return Math.abs(s)<60?n.format(s,"second"):Math.abs(a)<60?n.format(a,"minute"):Math.abs(u)<24?n.format(u,"hour"):Math.abs(c)<7?n.format(c,"day"):Math.abs(f)<4?n.format(f,"week"):oq(t,"medium")},l$e=e=>{const t=CT(e);if(!ET(t))return"";const n=new Date,r=t.toDateString()===n.toDateString(),o=new Date(n);o.setDate(o.getDate()-1);const s=t.toDateString()===o.toDateString(),a=new Date(n);a.setDate(a.getDate()-6);const u=t>=a&&t<n,c=t.getFullYear()===n.getFullYear();return r?tf(t,{hour:"numeric",minute:"numeric"}):s?"Yesterday":u?tf(t,{weekday:"long"}):c?tf(t,{month:"short",day:"numeric"}):tf(t,{month:"short",day:"numeric",year:"numeric"})},uNe=e=>`Move ${e===1?"1":Wo(e)} ${e===1?"message":"messages"} to Trash?`,u$e=({targets:e,trashByAccount:t,hasAppointments:n,isError:r})=>{if(r)return"unavailable";if(!n||e.length===0)return"unknown";let o=!1,s=!1;for(const a of e){if(a.accountId===void 0)return"unknown";const u=t.get(a.accountId);if(u===void 0)return"unknown";if(u.source==="Stale")return"staleTrash";if(u.mailboxId===void 0)return"noTrash";u.mailboxId===a.mailboxId&&(o=!0,aNe(u.source,"confirmed")||(s=!0))}return s?"unconfirmed":o?"permanent":"trash"},cNe=e=>e==="permanent"||e==="unconfirmed",c$e=(e,t,n={})=>{const r=e===1?"1":Wo(e),o=e===1?"message":"messages",{trashFolderLabel:s,staleFolderLabel:a}=n;if(t==="noTrash")return{title:`Can't delete ${r} ${o} yet`,description:"No folder on this account is set as Trash, so there is nowhere to move the mail. Nothing has been deleted.",confirmLabel:"Pick a Trash folder"};if(t==="staleTrash")return{title:`Can't delete ${r} ${o} yet`,description:a?`The folder you set as this account's Trash — ${a} — is gone from the mail server. Nothing has been deleted.`:"The folder you set as this account's Trash is gone from the mail server. Nothing has been deleted.",confirmLabel:"Pick another folder"};if(t==="unconfirmed"){const u=s?`reader files this account's deleted mail in ${s} because of its name — nobody confirmed it.`:"reader files this account's deleted mail in a folder it matched by name — nobody confirmed it.";return{title:"Confirm this account's Trash folder",description:e>0?`${u} Deleting ${r} ${o} there erases them from the mail server, and that cannot be restored. Nothing has been deleted.`:`${u} Emptying a folder erases everything in it from the mail server, and that cannot be restored. Nothing has been emptied.`,confirmLabel:"Confirm the folder"}}return t==="unavailable"?{title:`Can't delete ${r} ${o}`,description:"reader couldn't read this account's folder settings, so it can't say whether this would move the mail to Trash or erase it. Nothing has been deleted.",confirmLabel:"Sign in again"}:t==="unknown"?{title:`Delete ${r} ${o}?`,description:"Checking where this account files deleted mail…",confirmLabel:"Delete"}:t==="permanent"?{title:`Permanently delete ${r} ${o}?`,description:"They are erased from the mail server and cannot be restored.",confirmLabel:"Delete permanently"}:{title:uNe(e),description:"You can restore them from Trash later.",confirmLabel:"Move to Trash"}},dNe={delete:(e,t)=>`Deleting ${e} of ${t}…`,move:(e,t)=>`Moving ${e} of ${t}…`,markRead:(e,t)=>`Marking ${e} of ${t} as read…`},fNe={delete:"moved to Trash",move:"moved",markRead:"marked as read"},sq=(e,t)=>e==="delete"&&cNe(t)?"permanently deleted":fNe[e],hNe={delete:"couldn't be deleted",move:"couldn't be moved",markRead:"couldn't be marked as read"},pNe={delete:"Couldn't delete these messages",move:"Couldn't move these messages",markRead:"Couldn't mark these messages as read"},gNe={delete:"The delete didn't finish.",move:"The move didn't finish.",markRead:"The update didn't finish."},d$e=(e,t,n)=>dNe[e](Wo(t),Wo(n)),mNe=(e,t,n="trash")=>`${Wo(t)} ${sq(e,n)}. Your mail server is still catching up.`,vNe=e=>`Stopped after ${Wo(e)}`,yNe=(e,t,n,r="trash")=>`${Wo(t)} of ${Wo(n)} ${sq(e,r)}. The rest were not sent, apart from the ones already on their way when you stopped — those may still have gone through.`,_5=(e,t)=>t>0?`Stopped after ${Wo(t)} — some messages ${hNe[e]}`:pNe[e],bNe=e=>gNe[e],SNe={delete:e=>`A delete of ${e} messages`,move:e=>`A move of ${e} messages`,markRead:e=>`Marking ${e} messages as read`},wNe=(e,t,n)=>`${SNe[e](Wo(t))}${n?` in ${n}`:""} is still running — stop it first.`,f$e=e=>e==="delete"?"danger":"info",h$e=(e,t,n,r)=>n.error!==void 0?null:n.cancelled?{severity:"warning",title:vNe(n.done),detail:yNe(e,n.done,t,r)}:{severity:"info",title:mNe(e,n.done,r)},iq=100,CNe=(e,t)=>e.kind==="move"?[t,e.destinationMailboxId]:[t],ENe=new AbortController().signal,AA=async e=>e.then(t=>({ok:!0,value:t}),t=>({ok:!1,error:t})),_Ne=(e,t=iq)=>{if(e.length===0)return[];const n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n},xNe=(e,t=iq)=>{const n=new Map;for(const r of e){const o=n.get(r.accountId);if(o){o.push(r.id);continue}n.set(r.accountId,[r.id])}return[...n.values()].flatMap(r=>_Ne(r,t))},aq=async(e,t,n,r)=>{const o=xNe(e),s=e.length;let a=0,u=0;const c=[];for(let f=0;f<o.length;f++){if(r.aborted)return c.push(...o.slice(f).flat()),{done:a,failedIds:c,refused:u,cancelled:!0};const h=o[f],g=await AA(t(h,r));if(!g.ok)return c.push(...o.slice(f).flat()),r.aborted?{done:a,failedIds:c,refused:u,cancelled:!0}:(n({done:a,total:s}),{done:a,failedIds:c,refused:u,cancelled:!1,error:g.error});u+=g.value?.failureCount??0,a+=h.length,n({done:a,total:s})}return{done:a,failedIds:c,refused:u,cancelled:!1}},p$e=async(e,t)=>{await aq(e.map(n=>({id:n,accountId:void 0})),async n=>(await t(n),{successCount:n.length,failureCount:0}),()=>{},ENe)},ANe=async(e,t,n,r,o)=>{let s=0,a=0;const u=[];let c;do{if(o.aborted)return{done:s,failedIds:u,refused:a,cancelled:!0};const f=await AA(e(c,o));if(!f.ok)return o.aborted?{done:s,failedIds:u,refused:a,cancelled:!0}:{done:s,failedIds:u,refused:a,cancelled:!1,error:f.error};const h=f.value;if(h.ids.length>0){const g=await AA(n(h.ids,o));if(!g.ok)return o.aborted?{done:s,failedIds:u,refused:a,cancelled:!0}:{done:s,failedIds:u,refused:a,cancelled:!1,error:g.error};a+=g.value?.failureCount??0,s+=h.ids.length,r({done:s,total:t})}c=h.continuationToken}while(c);return{done:s,failedIds:u,refused:a,cancelled:!1}},INe=e=>({done:e.done,total:Math.max(e.total,e.done)}),RNe=e=>typeof e=="object"&&e!==null&&Array.isArray(e.pages),TNe=e=>typeof e=="object"&&e!==null&&Array.isArray(e.items),ONe=(e,t)=>e===void 0?e:RNe(e)?{...e,pages:e.pages.map(n=>({...n,items:t(n.items)}))}:TNe(e)?{...e,items:t(e.items)}:e,MNe=e=>{const t=[];for(const n of new Set(e))t.push(fRe({path:{mailboxId:n}})),t.push(QB({path:{mailboxId:n}}));return t.push(JB()),t},g$e=(e,t)=>Promise.all(t.map(n=>e.cancelQueries({queryKey:n}))),m$e=(e,t)=>t.flatMap(n=>e.getQueriesData({queryKey:n})).filter(n=>n[1]!==void 0).map(([n,r])=>({queryKey:n,data:r})),v$e=(e,t,n)=>{const r=o=>ONe(o,n);for(const o of t)e.setQueriesData({queryKey:o},r)},y$e=(e,t)=>{for(const n of t)e.setQueryData(n.queryKey,n.data)},PNe=(e,t)=>{for(const n of t)e.invalidateQueries({queryKey:n})},lq=_.createContext(void 0),NNe=e=>{if(e.action)return e.action;if((e.severity??"error")==="error")return{label:"Report an issue",href:sh(Hu({title:`Bug: ${e.title}`,errorMessage:e.detail?`${e.title} — ${e.detail}`:e.title,stack:e.error instanceof Error?e.error.stack:void 0}))}},kNe=()=>{const e=_.useContext(lq);if(!e)throw new Error("useErrorBanners must be used within an ErrorBannerProvider");return e},x5=5,DNe=(e,t,n)=>({title:e,detail:uq(n)??t,error:n}),uq=e=>{if(e!=null){if(e instanceof Error)return e.message||void 0;if(typeof e=="string")return e||void 0;if(typeof e=="object"&&"message"in e&&typeof e.message=="string")return e.message||void 0}},b$e=e=>il(e)?.code==="message_gone_from_server",S$e=e=>{const t=uq(e);return t?t.startsWith("Message not found"):!1},LNe=(e,t,n)=>e.severity===n&&e.title===t.title&&e.detail===t.detail,UNe=(e,t)=>{const r=[...e.filter(o=>!LNe(o,{title:t.title,detail:t.detail,severity:t.severity},t.severity)),t];return r.length<=x5?r:r.slice(r.length-x5)},$Ne=(e,t)=>e.filter(n=>n.id!==t),FNe=(e,t,n)=>({id:t,severity:e.severity??"error",title:e.title,detail:e.detail,action:e.action,createdAt:n}),zNe=new Set(["none","stale","unconfirmed"]),jNe=new Set(Object.values(ure)),f_=(e,t)=>{const n=e?.[t];return typeof n=="string"?n:void 0},BNe=e=>{const t=il(e);if(t?.code!=="folder_role_unresolved")return;const{details:n}=t;if(!n)return;const r=f_(n,"reason"),o=f_(n,"role"),s=f_(n,"accountId");if(!(!r||!zNe.has(r))&&!(!o||!jNe.has(o)||!s))return{reason:r,role:o,accountId:s}},HNe=e=>il(e)?.code==="mailbox_not_settled",qNe=3e4,VNe=1e3,WNe="The folder couldn't be created on the mail server. Please try again.",GNe="The folder was created but the mail server hasn't confirmed it yet, so nothing was attached to it. It's in your folder list — try again in a moment.",KNe=(e,t)=>new Promise((n,r)=>{if(t?.aborted){r(t.reason);return}const o=setTimeout(()=>{t?.removeEventListener("abort",s),n()},e),s=()=>{clearTimeout(o),r(t?.reason)};t?.addEventListener("abort",s,{once:!0})});async function ZNe({fetchMailboxes:e,mailboxId:t,signal:n,timeoutMs:r=qNe,pollIntervalMs:o=VNe,delay:s=KNe,now:a=Date.now}){const u=a()+r;for(;;){n?.throwIfAborted();const f=(await e()).find(h=>h.mailboxId===t);if(f?.syncStatus===ck.synced)return f;if(f?.syncStatus===ck.failed)throw new Error(WNe);if(a()>=u)throw new Error(GNe);await s(o,n)}}function cq(e,t){const n=e.trim();return t?`${t.fullPath}${t.hierarchyDelimiter}${n}`:n}const A5=(e,t)=>{const n=t.length===0?[e]:e.split(t);return n[0]?.toLowerCase()==="inbox"&&(n[0]="INBOX"),n.join(t)};function YNe({name:e,delimiter:t,parent:n,existingPaths:r}){const o=e.trim();if(o==="")return"Enter a folder name.";if(t.length>0&&o.includes(t))return`A folder name can't contain "${t}".`;const s=A5(cq(o,n),t);if(r.some(u=>A5(u,t)===s))return"A folder with that name already exists."}function QNe(e){const t=dl(),{data:n}=Ja({...hA({path:{accountId:e??""}}),enabled:!!e}),r=lR({...JIe(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:sT({path:{accountId:e}})})}}),o=_.useRef(new Map),s=_.useCallback(async(u,c,f)=>{if(!e)throw new Error("No account to create the folder in. Pick messages from a single account first.");const h=n?.items??[],g=c?h.find(C=>C.fullPath===c):void 0;if(c&&!g)throw new Error(`Couldn't find the folder "${c}" to create this one inside.`);const m=g?{fullPath:g.fullPath,hierarchyDelimiter:g.hierarchyDelimiter}:void 0,v=cq(u,m);let w=o.current.get(v);if(!w){const C=m?.hierarchyDelimiter??h[0]?.hierarchyDelimiter??"/",E=YNe({name:u,delimiter:C,parent:m,existingPaths:h.map(I=>I.fullPath)});if(E)throw new Error(E);w=(await r.mutateAsync({path:{accountId:e},body:{fullPath:v,namespaceType:"personal"}})).mailboxId,o.current.set(v,w)}const S=await ZNe({mailboxId:w,signal:f,fetchMailboxes:async()=>(await t.fetchQuery({...hA({path:{accountId:e}}),staleTime:0})).items??[]});return o.current.delete(v),{id:S.mailboxId,label:Kf(S),path:S.fullPath}},[r,e,n,t]);return{createFolder:_.useCallback((u,c)=>s(u,"",c),[s]),createFolderIn:s,mutation:r}}const XNe=()=>{const{t:e}=KB("mail",{useSuspense:!1});return _.useCallback((t,n)=>e(t,{defaultValue:n}),[e])},h_={Inbox:"inbox",Drafts:"drafts",Sent:"sent",Archive:"archive",Junk:"junk",Trash:"trash",All:"all",Flagged:"flagged"},w$e={inbox:"Inbox",drafts:"Drafts",sent:"Sent",archive:"Archive",junk:"Junk",trash:"Trash",all:"All",flagged:"Flagged"},Zf=["inbox","flagged","drafts","sent","archive","all","junk","trash"];function sb(e){const t=new Map,n=[...e].sort((r,o)=>Zf.indexOf(h_[r.role])-Zf.indexOf(h_[o.role]));for(const r of n){if(!r.mailboxId||t.has(r.mailboxId))continue;const o=h_[r.role];o&&t.set(r.mailboxId,o)}return t}function dq(e,t,n){const r=e.displayNameOverride?.trim();if(r)return r;const o=Kf(e);return!t||!n?o:n(`sidebar.${t}`,o)}const JNe=new Set(["sent","drafts","trash"]),C$e=e=>e===void 0||!JNe.has(e),E$e=100,eke=e=>e.trim().toLowerCase()==="inbox",tke=(e,t)=>{if(e.hierarchyDelimiter.length===0)return!1;const n=`${e.fullPath}${e.hierarchyDelimiter}`;return t.some(r=>r.mailboxId!==e.mailboxId&&r.fullPath.startsWith(n))},nke=["Appointed","Flagged","Reserved"],rke=(e,t)=>e.mailboxId!==t.mailboxId?!1:e.source==="Stale"?t.specialUse?.includes(e.role)??!1:nke.includes(e.source),oke=(e,t)=>t.find(n=>rke(n,e))?.role;function _$e(e,t,n){if(eke(e.fullPath))return{deletable:!1,reason:"inbox",message:"The inbox can't be deleted."};const r=oke(e,n);return r?{deletable:!1,reason:"role",message:`This folder is your ${r} folder. Reassign that role before deleting it.`}:tke(e,t)?{deletable:!1,reason:"children",message:"This folder has subfolders. Delete them first."}:{deletable:!0}}function ske(e,t){return e.filter(n=>n.mailboxId!==t)}function x$e(e){return{total:e,moved:0,phase:e===0?"moved":"moving"}}function A$e(e,t){if(e.phase!=="moving")return e;const n=Math.min(e.total,e.moved+Math.max(0,t));return{...e,moved:n,phase:n>=e.total?"moved":"moving"}}function I$e(e,t){return{...e,phase:"failed",error:t}}function R$e(e){return`Moved ${e.moved} of ${e.total}`}function T$e(e){const t=Math.max(0,Math.floor(e/1e3));return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function O$e(e){return e>0?"choose-fate":"confirm-empty"}const ike=new Set(["outbox","postvak uit","boîte d'envoi","postausgang","buzón de salida","posta in uscita","送信トレイ","送件匣","发件箱","skrzynka nadawcza"]),ake=e=>{const t=Kf(e).trim().toLowerCase();return ike.has(t)},I5=Zf.length,lke=(e,t)=>{const n=sb(t);return[...e.filter(o=>{const s=n.get(o.mailboxId);return s==="drafts"||s==="sent"?!1:!ake(o)})].sort((o,s)=>{const a=n.has(o.mailboxId)?Zf.indexOf(n.get(o.mailboxId)??"inbox"):I5,u=n.has(s.mailboxId)?Zf.indexOf(n.get(s.mailboxId)??"inbox"):I5;return a!==u?a-u:Kf(o).localeCompare(Kf(s),void 0,{sensitivity:"base",numeric:!0})})},uke=e=>e[0]?.hierarchyDelimiter??"/",cke=({mailboxes:e,folderAppointments:t,currentMailboxId:n,excludeMailboxId:r,translator:o})=>{const s=lke(e,t),a=sb(t);return(r?ske(s,r):s).map(c=>({id:c.mailboxId,label:dq(c,a.get(c.mailboxId),o),path:c.fullPath,isCurrent:c.mailboxId===n,messageCount:c.messageCount}))},fq=_.createContext(void 0),R5=Symbol("appoint-failed"),dke=({children:e})=>{const t=dl(),n=XNe(),[r,o]=_.useState(null),[s,a]=_.useState(),[u,c]=_.useState({kind:"choosing"}),f=r?.accountId,{data:h}=Ja({...iT(),staleTime:1/0,enabled:!!f}),{data:g}=Ja({...hA({path:{accountId:f??""}}),enabled:!!f}),{createFolderIn:m}=QNe(f),v=lR({...QIe(),meta:ny(409)}),w=h?.accounts.find(D=>D.accountId===f),S=_.useMemo(()=>g?.items??[],[g]),C=_.useMemo(()=>w?.folderAppointments??[],[w]),E=_.useMemo(()=>cke({mailboxes:S,folderAppointments:C,translator:n}),[S,C,n]),A=C.find(D=>D.role===r?.role),I=r?.guessedMailboxId??A?.mailboxId,T=S.find(D=>D.mailboxId===I),N=r?.trashFolderLabel??(T?dq(T,sb(C).get(T.mailboxId),n):void 0),M=_.useRef(null),R=_.useCallback(()=>{M.current=null,o(null),a(void 0),c({kind:"choosing"})},[]),k=_.useCallback(D=>{M.current=D,o(D),c({kind:"choosing"}),a(D.reason==="unconfirmed"?D.guessedMailboxId:void 0)},[]),L=_.useCallback(D=>{M.current===D&&R()},[R]),q=_.useCallback(D=>{r&&(c({kind:"appointing"}),v.mutateAsync({path:{accountId:r.accountId,role:r.role},body:{mailboxId:D}}).catch(j=>(c({kind:"appoint-failed",cause:HNe(j)?"mailbox-pending":"generic"}),R5)).then(async j=>{j!==R5&&(await t.invalidateQueries({queryKey:YB()}),c({kind:"acting"}),await r.onAppointed(),L(r))}).catch(()=>L(r)))},[r,v,t,L]),$=_.useMemo(()=>({requestAppointment:k}),[k]);return O.jsxs(fq.Provider,{value:$,children:[e,r&&O.jsx(gre,{open:!0,reason:r.reason,action:r.action,folders:E,delimiter:uke(S),trashFolderLabel:N,guessedMailboxId:I,staleFolderLabel:r.staleFolderLabel??A?.staleAppointmentPath,accountEmail:(h?.accounts.length??0)>1?w?.email:void 0,phase:u,selectedId:s,onSelect:a,onCreateFolder:m,onConfirm:q,onCancel:R})]})},fke=()=>{const e=_.useContext(fq);if(!e)throw new Error("useRoleAppointmentPrompt must be used within a RoleAppointmentPromptProvider");return e},hq=_.createContext(void 0),hke=({children:e})=>{const[t,n]=_.useState(void 0),r=_.useRef(void 0),o=_.useRef(void 0),s=_.useRef(void 0),a=_.useRef(new Set),u=dl(),{pushError:c}=kNe(),{requestAppointment:f}=fke(),h=_.useRef(async()=>({kind:"ran",outcome:{done:0,failedIds:[],refused:0,cancelled:!1}})),g=_.useCallback(S=>{PNe(u,MNe(CNe(S.action,S.mailboxId)));const C=new Set;if(S.accountId&&C.add(S.accountId),S.source.kind==="targets")for(const E of S.source.targets)E.accountId&&C.add(E.accountId);for(const E of C)u.invalidateQueries({queryKey:sT({path:{accountId:E}})})},[u]),m=_.useCallback(async S=>{const C=s.current;if(C)return{kind:"refused",reason:wNe(C.action.kind,C.matched,C.mailboxLabel)};const E=Symbol("bulk-run"),A=new AbortController;r.current=A,o.current=E,s.current=S,S.claimEnding&&(a.current.add(E),S.claimEnding(()=>a.current.delete(E))),n({action:S.action,mailboxId:S.mailboxId,progress:{done:0,total:S.matched}});const I=R=>{o.current===E&&n(k=>k&&{...k,progress:INe(R)})},T=S.source.kind==="targets"?await aq(S.source.targets,S.applyBatch,I,A.signal):await ANe(S.source.fetchPage,S.matched,S.applyBatch,I,A.signal),N=a.current.delete(E);o.current===E&&(o.current=void 0,s.current=void 0,n(void 0));const M=T.error?BNe(T.error):void 0;return M?f({accountId:M.accountId,role:M.role,reason:M.reason,action:{kind:"delete",count:S.matched},onAppointed:async()=>{const R=await h.current({...S,claimEnding:void 0});R.kind==="refused"&&c({title:_5(S.action.kind,0),detail:R.reason})}}):T.error?c(DNe(_5(S.action.kind,T.done),bNe(S.action.kind),T.error)):T.refused>0&&c({severity:"warning",title:T.refused>1?`Couldn't delete ${T.refused} of ${S.matched} messages yet`:"Couldn't delete this message yet",detail:"Something else moved them while the delete was being prepared. They are back where they now sit — try again."}),N||S.reportEnding?.(S.action.kind,S.matched,T),T.done>0&&g(S),{kind:"ran",outcome:T}},[g,c,f]);h.current=m;const v=_.useCallback(S=>{s.current?.mailboxId===S&&r.current?.abort()},[]);_.useEffect(()=>{const S=a.current;return()=>{r.current?.abort(),r.current=void 0,o.current=void 0,s.current=void 0,S.clear()}},[]);const w=_.useMemo(()=>({run:t,start:m,stop:v}),[t,m,v]);return O.jsx(hq.Provider,{value:w,children:e})},M$e=()=>{const e=_.useContext(hq);if(!e)throw new Error("useBulkRun must be used within a BulkRunProvider");return e},pke=600,gke=300,pq="remit logs",mke="https://github.com/remit-mail/reader/releases/tag/";function gq(e,t){const n=t?.check.lastCheckedAt;return n!==void 0&&n!==e.since}function vke(e){const t=hn(e);return`The check could not be requested — ${t===void 0?"the server did not answer":`the server answered ${t}`}. Run \`remit logs backend\` to see why.`}const yke={checking:"preparing",pulling:"preparing",snapshotting:"preparing",stopping:"restarting",starting:"restarting",verifying:"reconnecting",committing:"reconnecting",rollingBack:"reconnecting",recovering:"reconnecting"};function _T(e){return yke[e]??"reconnecting"}function mq(e){const t=hn(e);return t===404||t===403||t===401}function IA(e,t){const n=e?.run??null;return n===null||n.outcome!==null||n.runId===t?null:n}function vq(e,t){const n=e?.check;if(n?.status==="ok"&&!(!n.updateAvailable||!n.latestVersion))return{version:n.latestVersion,releasedAt:Av(n.publishedAt)??t,releaseNotesUrl:n.releaseNotesUrl??yq(n.latestVersion),summary:n.summary??""}}function bke(e){const t=e?.check.schemaVersion,n=e?.currentSchemaVersion;return t===void 0||n===void 0?!1:t>n}function RA(){return pke+gke}function TA(e,t){return Math.max(0,Math.floor((t-e)/1e3))}function Av(e){if(!e)return;const t=Date.parse(e);return Number.isNaN(t)?void 0:t}function yq(e){return`${mke}${e}`}function Yf(e,t,n,r,o){return{status:"applying",runId:e,version:t,target:n,phase:r,elapsedSeconds:o}}function Ske(e,t,n){switch(n){case"succeeded":return{status:"succeeded",runId:t.runId,version:t.targetVersion,previousVersion:t.fromVersion,releaseNotesUrl:e.check.releaseNotesUrl??yq(t.targetVersion)};case"rolledBack":return{status:"rolledBack",runId:t.runId,version:t.fromVersion,attemptedVersion:t.targetVersion,reason:t.message,logsCommand:t.logCommand};case"rollbackFailed":return{status:"rollbackFailed",runId:t.runId,attemptedVersion:t.targetVersion,previousVersion:t.fromVersion,reason:t.message,logsCommand:t.logCommand};case"abandoned":return{status:"abandoned",runId:t.runId,version:t.fromVersion,attemptedVersion:t.targetVersion,reason:t.message,logsCommand:t.logCommand};default:return n}}function wke(e,t,n,r){const o=e.check,s=Av(o.lastCheckedAt);if(n!==null)return{status:"checkFailed",version:e.currentVersion,reason:n,lastCheckedAt:s};if(t!==null&&!gq(t,e))return{status:"checking",version:e.currentVersion};if(o.status==="failed")return{status:"checkFailed",version:e.currentVersion,reason:o.error??"Remit could not reach the update service.",lastCheckedAt:s};if(o.status==="disabled")return{status:"neverChecked",version:e.currentVersion,lastCheckedAt:s};const a=vq(e,r);return a?{status:"available",version:e.currentVersion,release:a}:{status:"upToDate",version:e.currentVersion,checkedAt:Av(o.lastCheckedAt)??r}}function T5(e,t,n){return{surface:{status:"ready",section:e,overlay:t},releaseHeld:n}}function bq(e,t,n,r){return{status:"ready",section:Yf(e,t,n,"reconnecting",r),overlay:{kind:"applying",target:n,phase:"reconnecting",elapsedSeconds:r}}}function Sq(e,t,n,r,o){return{status:"ready",section:Yf(e,t,n,"reconnecting",r),overlay:{kind:"neverCameBack",attemptedVersion:n,previousVersion:t,elapsedSeconds:r,logsCommand:o}}}function Cke(e,t){return{surface:Sq(e.runId,e.previousVersion,e.attemptedVersion,t,pq),releaseHeld:!1}}function Eke(e,t,n,r,o){const s=TA(e.startedAt,o),a=t?.currentVersion??e.previousVersion,u=!r&&n!==null&&n.runId===e.runId;if(u&&n!==null&&n.outcome!==null)return null;if(u&&n!==null){const c=_T(n.phase);return T5(Yf(n.runId,a,n.targetVersion,c,s),{kind:"applying",target:n.targetVersion,phase:c,elapsedSeconds:s},!1)}return r?s>RA()?Cke(e,s):{surface:bq(e.runId,e.previousVersion,e.attemptedVersion,s),releaseHeld:!1}:t===void 0?{surface:{status:"loading"},releaseHeld:!1}:s>RA()?{surface:{status:"ready",section:{status:"unreachable",runId:e.runId,previousVersion:e.previousVersion,attemptedVersion:e.attemptedVersion,elapsedSeconds:s,logsCommand:n?.logCommand??pq},overlay:{kind:"none"}},releaseHeld:!0}:T5(Yf(e.runId,a,e.attemptedVersion,e.phase,s),{kind:"applying",target:e.attemptedVersion,phase:e.phase,elapsedSeconds:s},!1)}function O5(e){const{data:t,isError:n,dismissedRunId:r,checkPress:o,checkFailure:s,sighting:a,now:u}=e;if(n){const h=IA(t,r);if(h!==null){const g=a!==null&&a.runId===h.runId?a.observedAt:u,m=TA(g,u);return m>RA()?Sq(h.runId,h.fromVersion,h.targetVersion,m,h.logCommand):bq(h.runId,h.fromVersion,h.targetVersion,m)}return{status:"ready",section:{status:"checkFailed",version:t?.currentVersion??"the current version",reason:"Remit could not reach the update service."},overlay:{kind:"none"}}}if(!t)return{status:"loading"};const c=t.run,f=c!==null&&r!==null&&c.runId===r;if(c!==null&&!f&&c.outcome!==null)return{status:"ready",section:Ske(t,c,c.outcome),overlay:{kind:"none"}};if(c!==null&&!f&&c.outcome===null){const h=TA(Av(c.startedAt)??u,u),g=_T(c.phase);return{status:"ready",section:Yf(c.runId,c.fromVersion,c.targetVersion,g,h),overlay:{kind:"applying",target:c.targetVersion,phase:g,elapsedSeconds:h}}}return{status:"ready",section:wke(t,o,s,u),overlay:{kind:"none"}}}function _ke(e){const{data:t,isError:n,error:r,held:o,now:s}=e,a=t?.run??null;if(mq(r)&&!o)return{surface:{status:"absent"},releaseHeld:!0};if(o){const u=Eke(o,t,a,n,s);return u||{surface:O5(e),releaseHeld:!0}}return{surface:O5(e),releaseHeld:!1}}const xke=3e4,Ake=5e3,Ike=iI,Rke={...iI,...Xre},Tke=3e4,Oke="The updater did not answer. Run `remit logs updater` to see why.";function Mke(e,t,n,r){if(mq(e)&&!n)return!1;const o=t!==null&&t.outcome===null;return n||o||r?Ake:xke}function Pke(){const e=dl(),[t,n]=_.useState(null),[r,o]=_.useState(null),[s,a]=_.useState(null),[u,c]=_.useState(null),[f,h]=_.useState(null),g=_.useRef(t);g.current=t;const m=_.useRef(s);m.current=s;const v=e.getQueryData(pA()),w=t!==null||IA(v,r)!==null,S=Ja({..._Re(),retry:!1,meta:w?Rke:Ike,refetchInterval:D=>Mke(D.state.error,D.state.data?.run??null,g.current!==null,m.current!==null)}),C=_.useRef(S.data);C.current=S.data;const E=_ke({data:S.data,isError:S.isError,error:S.error,held:t,dismissedRunId:r,checkPress:s,checkFailure:u,sighting:f,now:Date.now()}),A=IA(S.data,r);_.useEffect(()=>{if(A===null){h(D=>D===null?D:null);return}h(D=>D!==null&&D.runId===A.runId?D:{runId:A.runId,observedAt:Date.now()})},[A]);const I=_.useRef(null);I.current=E.surface.status==="ready"&&"runId"in E.surface.section?E.surface.section.runId:null;const{releaseHeld:T}=E;_.useEffect(()=>{T&&n(D=>D===null?D:null)},[T]),_.useEffect(()=>{s!==null&&gq(s,S.data)&&a(null)},[s,S.data]),_.useEffect(()=>{if(s===null)return;const D=s.pressedAt+Tke-Date.now(),j=setTimeout(()=>{a(null),c(Oke)},Math.max(0,D));return()=>clearTimeout(j)},[s]);const{refetch:N}=S,M=_.useCallback(()=>{c(null),a({pressedAt:Date.now(),since:C.current?.check.lastCheckedAt}),ZB({query:{refresh:!0},throwOnError:!0}).then(()=>{N()}).catch(D=>{mR(D,iI),a(null),c(vke(D))})},[N]),R=_.useCallback(()=>{N()},[N]),k=lR({...xRe(),meta:{softError:!0},onSuccess:D=>{const j=D.run;j!==null&&(n({runId:j.runId,attemptedVersion:j.targetVersion,previousVersion:j.fromVersion,phase:_T(j.phase),startedAt:Date.now()}),o(null)),e.setQueryData(pA(),D)},onError:()=>{N()}}),{mutate:L}=k,q=_.useCallback(D=>{L({body:{targetVersion:D}})},[L]),$=_.useCallback(()=>{I.current!==null&&o(I.current),n(null),a(null),c(null)},[]);return{surface:E.surface,appliesSchemaMigration:bke(S.data),currentVersion:S.data?.currentVersion,release:vq(S.data,Date.now()),onCheck:M,install:q,onDismissResult:$,onRetryConnection:R}}const xT=_.createContext(null);function Nke({children:e}){const t=Pke();return _.createElement(xT.Provider,{value:t},e)}function kke(){const e=_.useContext(xT);if(e===null)throw new Error("useSelfUpdate must be used within a SelfUpdateProvider");return e}function Dke(){return _.useContext(xT)}function Lke(){const{surface:e,onRetryConnection:t}=kke();if(e.status!=="ready")return null;const{overlay:n}=e;return n.kind==="applying"?O.jsx(Dre,{target:n.target,phase:n.phase,elapsedSeconds:n.elapsedSeconds}):n.kind==="neverCameBack"?O.jsx(Lre,{attemptedVersion:n.attemptedVersion,previousVersion:n.previousVersion,elapsedSeconds:n.elapsedSeconds,logsCommand:n.logsCommand,onRetryConnection:t}):null}const Uke=()=>typeof globalThis.crypto<"u"&&typeof globalThis.crypto.randomUUID=="function"?globalThis.crypto.randomUUID():`banner-${Date.now()}-${Math.random().toString(36).slice(2,10)}`,$ke=({children:e})=>{const[t,n]=_.useState([]),r=_.useCallback(u=>{if(u.error!=null&&IF(u.error))return Bu(u.error).correlationId;const c=FNe({...u,action:NNe(u)},Uke(),Date.now());return n(f=>UNe(f,c)),c.id},[]),o=_.useCallback(u=>{n(c=>$Ne(c,u))},[]),s=_.useCallback(()=>{n([])},[]),a=_.useMemo(()=>({errors:t,pushError:r,dismissError:o,clearAll:s}),[t,r,o,s]);return O.jsxs(lq.Provider,{value:a,children:[e,O.jsx(Nne,{errors:t,onDismiss:o})]})},M5="mt-6 inline-flex min-h-11 w-full items-center justify-center gap-2 rounded-md bg-accent px-4 text-sm font-medium text-accent-fg hover:bg-accent-hover focus-visible:ring-2 focus-visible:ring-ring";function wq(){const[e,t]=_.useState(Pbe),{Account:n}=Mbe(),r=_.useRef(null);return _.useEffect(()=>Nbe(t),[]),Vv({id:"signed-out",open:e}),Wv(r,e),e?O.jsx("div",{className:"fixed inset-0 z-[70] flex items-center justify-center bg-canvas/80 p-4 backdrop-blur-sm",children:O.jsxs("div",{ref:r,role:"alertdialog","aria-modal":"true","aria-labelledby":"signed-out-title","aria-describedby":"signed-out-text",tabIndex:-1,className:"w-full max-w-sm rounded-lg border border-line bg-surface p-6 shadow-xl outline-none",children:[O.jsx("h2",{id:"signed-out-title",className:"text-lg font-semibold text-fg",children:"You're signed out"}),O.jsx("p",{id:"signed-out-text",className:"mt-2 text-sm text-fg-muted",children:"The server no longer accepts this session. Sign in again to carry on here; you will come back to this screen."}),O.jsx(n,{fallback:O.jsxs("button",{type:"button",onClick:()=>{lU(),window.location.reload()},className:M5,children:[O.jsx(JN,{className:"size-4","aria-hidden":"true"}),"Sign in"]}),children:({signOut:o})=>O.jsxs("button",{type:"button",onClick:()=>{lU(),o()},className:M5,children:[O.jsx(JN,{className:"size-4","aria-hidden":"true"}),"Sign in"]})})]})}):null}const Fke=({error:e,reset:t,info:n})=>{if(ty(e))return gR(),O.jsx(wq,{});const r=Xv(e),o=Bu(e,{recoverable:r,componentStack:n?.componentStack});return O.jsx(DF,{fatal:o,onRetry:r?t:void 0})},ea=Fye()({component:Bke,errorComponent:Fke}),zke=()=>{const{t:e}=KB("common",{useSuspense:!1});return O.jsx("a",{href:"#main-content",className:"sr-only focus:not-sr-only focus:absolute focus:z-50 focus:p-4 focus:bg-canvas focus:text-fg focus:rounded-md",children:e("accessibility.skipToContent","Skip to main content")})},jke=({children:e})=>gc().updateMode==="managed"?e:O.jsxs(Nke,{children:[e,O.jsx(Lke,{})]});function Bke(){return O.jsxs($ke,{children:[O.jsx(dke,{children:O.jsx(hke,{children:O.jsx(jke,{children:O.jsxs(PRe,{children:[O.jsx(zke,{}),O.jsx("main",{id:"main-content",className:"h-dvh overflow-hidden",children:O.jsx(_.Suspense,{fallback:O.jsx(Zv,{}),children:O.jsx(o7,{})})})]})})})}),O.jsx(kF,{}),O.jsx(wq,{})]})}const Hke=Ee("/")({beforeLoad:()=>{throw wc({to:"/mail/brief"})}}),qke=gc().apiUrl;le.setConfig({baseUrl:qke,fetch:y$});le.interceptors.error.use((e,t)=>e instanceof Qv||!t?e:qre(e,t.status));const Vke=()=>Re(()=>import("./calendar-BIfjhUb1.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])),Wke=Ee("/calendar")({loader:({context:{queryClient:e}})=>{e.prefetchQuery(iT())},component:Ie(Vke,"component")}),Gke=()=>Re(()=>import("./import-BIxL3HZr.js"),__vite__mapDeps([14,15,16,17,18,19,20,21,22])),Kke=Ee("/import")({component:Ie(Gke,"component")}),Zke=ST(["match","properties","folder","rule","name","review","run"]),Yke=vl("search"),Qke=Yke.optional().catch(void 0),Xke=()=>Ny({from:"/mail",select:e=>e.wizardFrom}),Jke=Zke.optional().catch(void 0),e3e=(e,t)=>wF(e,t)+1,Cq=()=>Ny({from:"/mail",select:e=>e.wizard}),t3e=()=>{const e=fh();return _.useCallback((t,n)=>{e({to:".",search:r=>({...r,wizard:t,wizardFrom:n})})},[e])},P$e=()=>{const e=Cq(),t=t3e(),[n,r]=_.useState("organize"),o=_.useCallback(a=>{r(a),t("match")},[t]),s=_.useCallback(()=>{t("properties","search")},[t]);return{verb:n,start:o,startFromSearch:s,isOpen:e!==void 0}},N$e=e=>{const t=gr(),n=fh(),r=Cq(),o=Xke(),s=_.useRef(r!==void 0),a=_.useRef(o),u=_.useRef(void 0);_.useEffect(()=>{u.current=void 0},[r]),_.useEffect(()=>{if(!s.current)return;s.current=!1;const g=a.current;(async()=>(await n({to:".",search:m=>({...m,wizard:void 0,wizardFrom:void 0}),replace:!0}),await n({to:".",search:m=>({...m,wizard:e,wizardFrom:g})})))()},[e,n]);const c=_.useCallback(g=>{g===r||u.current===g||(u.current=g,n({to:".",search:m=>({...m,wizard:g})}))},[n,r]),f=_.useCallback(()=>{t.history.back()},[t]),h=_.useCallback((g,m)=>{t.history.go(-e3e(g,m))},[t]);return{step:r,goToStep:c,goBack:f,closeWizard:h}},Sh=wo({q:Kn().optional()}),AT=Sh.extend({}),Eq=Sh.extend({}),n3e=Sh.extend({}),_q=Sh.extend({}),r3e=AT,o3e=Sh.extend({wizard:Jke,wizardFrom:Qke}),p_=wo({body:Kn().optional()}),k$e=e=>{const{body:t,...n}=e;return n},IT={brief:AT.extend(p_.shape),flagged:Eq.extend(p_.shape),mailbox:_q.extend(p_.shape)},s3e=new Map;function D$e(e){const t=new Map;for(const n of e){const r=sb(n.folderAppointments);for(const[o,s]of r)t.set(o,{role:s});for(const o of n.mailboxes){const s=r.get(o.mailboxId),a={providerPath:o.fullPath,hierarchyDelimiter:o.hierarchyDelimiter};t.set(o.mailboxId,s?{role:s,...a}:a)}}return t}function L$e(e){const t=[];for(const[n,r]of e)r.role==="junk"&&t.push(n);return t}function U$e(e,t){const n=t[0];if(!e)return n?{mailboxId:n}:{};for(const o of t){const s=e.get(o);if(s&&lre(s)!==void 0)return{mailboxId:o,folder:s}}if(!n)return{};const r=e.get(n);return{mailboxId:n,...r?{folder:r}:{}}}const i3e=_.createContext(null),$$e=()=>_.useContext(i3e)??{accounts:[],mailboxNameIndex:new Map,accountNameIndex:new Map,resultFolderIndex:s3e,searchQuery:"",searchInput:"",searchViewKey:"",onSearchChange:()=>{},onSearchClear:()=>{},onSearchClearQuery:()=>{},intelligenceOpen:!1,onToggleIntelligence:()=>{},onRaiseIntelligence:()=>{}},a3e=()=>Re(()=>import("./mail-Bf1kTy2y.js"),__vite__mapDeps([23,5,4,3,1,2,6,7,8,9,10,11,24,25,26,27,28,29,30,31,32,17,13,33,34,35,36,37,38,39,40,41,42,43,44,45])),l3e=Ee("/mail")({loader:({context:{queryClient:e}})=>{e.prefetchQuery(iT()),e.prefetchQuery({...ARe(),staleTime:6e4})},component:Ie(a3e,"component"),validateSearch:o3e}),u3e=()=>Re(()=>import("./onboarding-cRvBetgB.js"),__vite__mapDeps([46,47,15,16,17,18,19,30,10,21,45,48,22])),c3e=Ee("/onboarding")({component:Ie(u3e,"component")});function d3e(){const e=Dke(),t=e?.surface.status==="ready"&&e.surface.section.status==="available";return O.jsx(dF,{label:t?"Update available":void 0,children:O.jsx(bte,{className:"size-4"})})}function f3e(){return Ja({...pRe()})}const g_={listed:"Sync warnings",unread:"Warnings could not be read",signedOut:"Session ended"};function h3e(e,t){if(ty(t))return g_.signedOut;if(t)return g_.unread;if(e&&((e.entries?.length??0)>0||(e.warnings?.length??0)>0))return g_.listed}function p3e(){const e=f3e();return h3e(e.data,e.error)}function g3e(){const e=p3e();return O.jsx(dF,{label:e,children:O.jsx(nI,{className:"size-4"})})}const m3e=ny(403,404),F$e={...ny(403,404,409,429),...Jre},v3e=new Set([Na.SignInDisabled,Na.CallerDisabled]),xq=e=>{if(hn(e)!==403)return!1;const t=il(e)?.code;return t!==void 0&&v3e.has(t)},y3e=e=>{if(ey(e))return"The server could not be reached. Nothing changed. Try again.";const t=il(e)?.code;return t===Na.CannotDisableSelf?"You cannot disable your own account, so one account always stays on.":t===Na.StepUpRequired?"The password check did not carry over to the action. Nothing changed. Try again.":t===Na.ForeignOrigin?"The server refused a request from this address. Nothing changed. Open this page from the server's own address.":hn(e)===404?"That account is gone, or this server no longer has a People page. Reload the page.":"Something went wrong on the server. Nothing changed. Try again."},z$e=e=>ey(e)?"The server could not be reached. Check your connection and try again.":"The server did not answer as expected. Try again.",j$e=e=>{if(hn(e)===401||xq(e))return{kind:"signedOut"};const t=il(e)?.code;return t===Na.WrongPassword?{kind:"wrongPassword"}:t===Na.StepUpLocked?{kind:"locked"}:{kind:"failed",reason:y3e(e)}},B$e=(e,t)=>e==="Disable"?{title:`Disable ${t}?`,body:"They are signed out everywhere within 15 minutes and cannot sign in until you enable them again. Their calendar feed links stop working. Their mail stays.",confirmLabel:"Disable",failedTitle:`${t} was not disabled`,destructive:!0}:e==="Enable"?{title:`Enable ${t}?`,body:"They can sign in again with their password. Calendar feed links they shared before stay off; they make new ones in Settings.",confirmLabel:"Enable",failedTitle:`${t} was not enabled`,destructive:!1}:e==="SignOut"?{title:`Sign ${t} out everywhere?`,body:"Every session and connected app of theirs ends within 15 minutes. They can sign in again with their password.",confirmLabel:"Sign out everywhere",failedTitle:`${t} was not signed out`,destructive:!0}:{title:`Reset the password of ${t}?`,body:"Their password stops working at once and they are signed out everywhere. You get a link to give them, which works once, for 24 hours.",confirmLabel:"Make a reset link",failedTitle:`No reset link was made for ${t}`,destructive:!0},H$e=(e,t)=>{const n=hn(t),r=il(t)?.code,o=t instanceof Error?t.message:String(t),s=[n??"no response",r,o].filter(a=>a!==void 0&&a!=="").join(" ");return sh(Hu({title:`People: ${e}`,errorMessage:`${e}. The server answered: ${s}`}))},b3e=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),q$e=(e,t)=>b3e(new Date(e),t)?"Today":oq(e,"medium"),V$e=(e,t)=>e.map(n=>n.userId===t.userId?t:n),S3e=()=>({...CRe(),meta:m3e,retry:!1}),w3e=()=>{const e=Ja(S3e()),t=e.isError&&xq(e.error);return _.useEffect(()=>{t&&gR()},[t]),{...e,unavailable:e.isError&&RF(e.error)}},Aq=_.createContext([]),C3e=Aq.Provider,E3e=()=>_.useContext(Aq),_3e=()=>Re(()=>import("./settings-CWQQ_e-3.js"),[]),x3e=[{id:"accounts",label:"Accounts",icon:O.jsx(D$,{className:"size-4"})},{id:"senders",label:"Senders & Rules",icon:O.jsx(yte,{className:"size-4"})},{id:"folders",label:"Folder roles",icon:O.jsx(ite,{className:"size-4"})},{id:"filters",label:"Filters",icon:O.jsx(ate,{className:"size-4"})},{id:"labels",label:"Labels",icon:O.jsx(gte,{className:"size-4"})},{id:"classification",label:"Mail classification",icon:O.jsx(hte,{className:"size-4"})},{id:"calendars",label:"Calendars",icon:O.jsx(Jee,{className:"size-4"})},{id:"appearance",label:"Appearance",icon:O.jsx(cte,{className:"size-4"})},{id:"warnings",label:"Warnings",icon:O.jsx(g3e,{})},{id:"advanced",label:"Advanced",icon:O.jsx(d3e,{})}],A3e={id:"people",label:"People",icon:O.jsx(vte,{className:"size-4"})},W$e=()=>{const e=w3e(),t=E3e(),n=[...x3e];if(n.splice(1,0,...t.map(({id:o,label:s,icon:a})=>({id:o,label:s,icon:a}))),!e.isSuccess)return n;const r=n.findIndex(o=>o.id==="advanced");return[...n.slice(0,r),A3e,...n.slice(r)]},I3e=Ee("/settings")({component:Ie(_3e,"component")}),R3e=["year","month","week","day","agenda"],T3e=ST(R3e),Iq="week",G$e=e=>e==="agenda";function O3e(e){const t=T3e.safeParse(e);return t.success?t.data:void 0}const M3e=/^\d{4}-\d{2}-\d{2}$/;function P3e(e){if(!M3e.test(e))return;const[t,n,r]=e.split("-").map(Number),o=Date.UTC(t,n-1,r),s=new Date(o);if(s.getUTCFullYear()===t&&s.getUTCMonth()===n-1&&s.getUTCDate()===r)return e}const sc=e=>String(e).padStart(2,"0");function Rq(e){return`${e.getFullYear()}-${sc(e.getMonth()+1)}-${sc(e.getDate())}`}function N3e(e,t){return{view:O3e(e.view)??Iq,date:P3e(e.date)??t}}function K$e(e,t,n){const[r,o,s]=e.split("-").map(Number);if(t==="year")return P5(r+n,o,s);if(t==="month")return P5(r,o+n,s);const a=t==="day"?1:7,u=new Date(Date.UTC(r,o-1,s+a*n));return k3e(u)}const k3e=e=>`${e.getUTCFullYear()}-${sc(e.getUTCMonth()+1)}-${sc(e.getUTCDate())}`;function P5(e,t,n){const r=e+Math.floor((t-1)/12),o=((t-1)%12+12)%12+1,s=new Date(Date.UTC(r,o,0)).getUTCDate();return`${r}-${sc(o)}-${sc(Math.min(n,s))}`}const D3e=Kn().min(1);function L3e(e){const t=e==null?[]:[e].flat(),n=new Set;for(const r of t){if(typeof r!="string"&&typeof r!="number")continue;const o=D3e.safeParse(String(r));o.success&&n.add(o.data)}return[...n].sort()}const RT=wo({calendarId:xv().transform(L3e).transform(e=>e.length===0?void 0:e).optional()});function Z$e(e,t){return t?e==="week"?"day":e==="year"?"month":e:e}const U3e=Ee("/calendar/")({validateSearch:RT,beforeLoad:({search:e,location:t})=>{throw wc({to:"/calendar/$view/$date",params:{view:Iq,date:Rq(new Date)},search:e,hash:t.hash,replace:!0})}}),$3e=Ee("/mail/")({validateSearch:r3e,beforeLoad:({search:e,location:t})=>{throw wc({to:"/mail/brief",search:e,hash:t.hash,replace:!0})}}),F3e=()=>Re(()=>import("./_mailboxId-ThNYujv3.js"),__vite__mapDeps([49,26,5,4,3,24,27,28,29,30,31,32,6,17,13,33,34,11,50,51,39,38,9,52,53,45,18,54,55,8,10,56,7,57,58,59,60,61,62,12,63,48,64,65,66,2,40,67,16,68,69,37,35,36,70,71,72,73,74,75,76])),z3e=Ee("/mail/$mailboxId")({component:Ie(F3e,"component"),validateSearch:_q}),j3e=()=>Re(()=>import("./brief-fIZB7Fkj.js"),__vite__mapDeps([77,13])),B3e=()=>Re(()=>import("./brief-MY0I_pcw.js"),__vite__mapDeps([78,26,5,4,3,24,27,28,29,30,31,32,6,17,13,33,34,11,79,52,53,45,9,39,38,18,54,55,8,10,56,7,57,58,59,60,61,62,12,63,48,64,65,66,2,40,67,16,68,69,70,71,35,36,37,80,76])),H3e=Ee("/mail/brief")({component:Ie(B3e,"component"),validateSearch:AT,errorComponent:Ie(j3e,"errorComponent")}),q3e=()=>Re(()=>import("./flagged-A9fk8Fz2.js"),__vite__mapDeps([81,13])),V3e=()=>Re(()=>import("./flagged-D6O3EhIo.js"),__vite__mapDeps([82,26,5,4,3,24,27,28,29,30,31,32,6,17,13,33,34,11,83,52,53,45,9,39,38,18,54,55,8,10,56,7,57,58,59,60,61,62,12,63,48,64,65,66,2,40,67,16,68,69,51,37,80,76])),W3e=Ee("/mail/flagged")({component:Ie(V3e,"component"),validateSearch:Eq,errorComponent:Ie(q3e,"errorComponent")}),G3e=()=>Re(()=>import("./outbox-CTC-6RuN.js"),__vite__mapDeps([84,26,5,4,3,24,27,28,29,30,31,32,6,17,13,33,34,11,85,53,45,43,72,40,9,36,64,86,87,76])),K3e=Ee("/mail/outbox")({component:Ie(G3e,"component"),validateSearch:n3e}),Z3e=Ee("/reset-password/$token")({beforeLoad:()=>{throw wc({to:"/"})}}),Y3e=()=>Re(()=>import("./index-BA_isERD.js"),[]),Q3e=Ee("/settings/")({component:Ie(Y3e,"component")}),X3e=()=>Re(()=>import("./_slotId-BwEkuNG8.js"),__vite__mapDeps([88,4,3,6,89,7,18,90,40,74])),J3e=Ee("/settings/$slotId")({component:Ie(X3e,"component")}),eDe=()=>Re(()=>import("./accounts-Dei0QQHb.js"),__vite__mapDeps([91,47,15,16,17,18,19,30,10,21,45,48,29,92,33,13,56,6,93,89,7,90,40,74,61,86])),tDe=wo({editAccountId:Kn().optional(),focusSmtp:bT().optional(),connected:Kn().optional(),oauthError:Kn().optional(),oauthEmail:Kn().optional(),missingServices:Kn().optional()}),nDe=Ee("/settings/accounts")({component:Ie(eDe,"component"),validateSearch:tDe}),rDe=()=>Re(()=>import("./advanced-CmaLt1-e.js"),__vite__mapDeps([94,20,4,3,5,6,19,56,18,21,87,75,95,66,64,93,45,89,7,90,40,74])),oDe=Ee("/settings/advanced")({component:Ie(rDe,"component")}),sDe=()=>Re(()=>import("./appearance-UFpWVtEM.js"),__vite__mapDeps([96,6,93,45,89,7,18,90,40,74,65])),iDe=Ee("/settings/appearance")({component:Ie(sDe,"component")}),aDe=()=>Re(()=>import("./calendars-Dpds3q2Z.js"),__vite__mapDeps([97,59,13,38,16,17,19,61,98,31,99,100,25,74,33,18,37,101,6,89,7,90,40])),lDe=Ee("/settings/calendars")({component:Ie(aDe,"component")}),uDe=()=>Re(()=>import("./classification-0ZO1lOyG.js"),__vite__mapDeps([102,103,13,16,17,33,92,18,6,89,7,90,40,74])),cDe=Ee("/settings/classification")({component:Ie(uDe,"component")}),dDe=()=>Re(()=>import("./filters-DEBkAOGr.js"),__vite__mapDeps([104,13,3,71,67,32,16,17,61,69,65,75,73,18,6,89,7,90,40,74])),fDe=Ee("/settings/filters")({component:Ie(dDe,"component")}),hDe=()=>Re(()=>import("./folders-Dfg9m7Cm.js"),__vite__mapDeps([105,68,42,6,89,7,18,90,40,74,13,16,17,25])),pDe=Ee("/settings/folders")({component:Ie(hDe,"component")}),gDe=()=>Re(()=>import("./labels-jKncGvQ3.js"),__vite__mapDeps([106,69,16,17,71,6,89,7,18,90,40,74,13,33])),mDe=Ee("/settings/labels")({component:Ie(gDe,"component")}),vDe=()=>Re(()=>import("./people-ClLsRDo6.js"),__vite__mapDeps([107,103,101,55,6,89,7,18,90,40,74])),yDe=Ee("/settings/people")({component:Ie(vDe,"component")}),bDe=()=>Re(()=>import("./senders-DjPDuDhf.js"),__vite__mapDeps([108,31,6,93,45,13,89,7,18,90,40,74])),SDe=Ee("/settings/senders")({component:Ie(bDe,"component")}),wDe=()=>Re(()=>import("./suggested-vips-D9pkriav.js"),[]),CDe=Ee("/settings/suggested-vips")({component:Ie(wDe,"component")}),EDe=()=>Re(()=>import("./warnings-B1lLZh5p.js"),__vite__mapDeps([109,41,38,18,75,101,95,13,6,93,45,89,7,90,40,74])),_De=Ee("/settings/warnings")({component:Ie(EDe,"component")}),xDe=()=>Re(()=>import("./_view._date-XDQ3AudE.js"),__vite__mapDeps([110,59,13,38,98,31,111,112,4,3,5,12,58,60,10,61,62,64,113,44,17,90,114,115,99,100,25,74,116,63,16,40,2,117])),ADe=Ee("/calendar/$view/$date")({validateSearch:RT,beforeLoad:({params:e,search:t,location:n})=>{const r=N3e(e,Rq(new Date));if(!(r.view===e.view&&r.date===e.date))throw wc({to:"/calendar/$view/$date",params:r,search:t,hash:n.hash,replace:!0})},component:Ie(xDe,"component")}),IDe=()=>Re(()=>import("./index-BI3VHL-i.js"),__vite__mapDeps([118,50,51,39,5,4,3,34,11,38,9,52,53,45,24,17,28,29,30,31,32,6,18,54,55,8,13,10,56,7,57,58,59,60,61,62,12,63,48,64,65,66,2,40,67,16,68,33,69,37,35,36,70,71,72,73,74,75])),RDe=Ee("/mail/$mailboxId/")({component:Ie(IDe,"component")}),TDe=()=>Re(()=>import("./_threadId-DI4EN6E1.js"),[]),ODe=Ee("/mail/$mailboxId/$threadId")({component:Ie(TDe,"component")}),MDe=()=>Re(()=>import("./index-CfV5o-lD.js"),__vite__mapDeps([119,79,52,53,45,34,11,4,3,5,24,9,17,39,38,28,29,30,31,32,6,18,54,55,8,13,10,56,7,57,58,59,60,61,62,12,63,48,64,65,66,2,40,67,16,68,33,69,70,71,35,36,37,80])),PDe=Ee("/mail/brief/")({component:Ie(MDe,"component")}),NDe=()=>Re(()=>import("./_threadId-CmA2aUrS.js"),[]),kDe=Ee("/mail/brief/$threadId")({component:Ie(NDe,"component")}),DDe=()=>Re(()=>import("./index-C-PJeYPQ.js"),__vite__mapDeps([120,83,52,53,45,34,11,4,3,5,24,9,17,39,38,28,29,30,31,32,6,18,54,55,8,13,10,56,7,57,58,59,60,61,62,12,63,48,64,65,66,2,40,67,16,68,33,69,51,37,80])),LDe=Ee("/mail/flagged/")({component:Ie(DDe,"component")}),UDe=()=>Re(()=>import("./_threadId-Cqj7hjyS.js"),[]),$De=Ee("/mail/flagged/$threadId")({component:Ie(UDe,"component")}),FDe=()=>Re(()=>import("./index-CrZmkeYk.js"),__vite__mapDeps([121,85,53,45,34,11,4,3,5,24,43,72,40,9,36,64,86,87])),zDe=Ee("/mail/outbox/")({component:Ie(FDe,"component")}),jDe=()=>Re(()=>import("./index-DtqBFgK5.js"),[]),BDe=Ee("/calendar/$view/$date/")({component:Ie(jDe,"component")}),HDe=()=>Re(()=>import("./_calendarObjectId-DNhcPvtT.js"),[]),qDe=Ee("/calendar/$view/$date/$calendarObjectId")({component:Ie(HDe,"component")}),Os=e=>String(e).padStart(2,"0"),Tq=e=>`${e.getUTCFullYear()}-${Os(e.getUTCMonth()+1)}-${Os(e.getUTCDate())}`,TT=e=>{const t=e<0?"-":"+",n=Math.abs(e);return`${t}${Os(Math.floor(n/60))}:${Os(n%60)}`};function Oq(e,t){const n=new Date(`${e}T${t}:00`);return`${e}T${t}:00${TT(-n.getTimezoneOffset())}`}const m_=new Map;function VDe(e){if(m_.has(e))return m_.get(e);let t;try{t=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{t=void 0}return m_.set(e,t),t}function OA(e,t){const n=VDe(e);if(!n)return Number.NaN;const r=n.formatToParts(new Date(t)),o=u=>Number(r.find(c=>c.type===u)?.value),s=o("hour")%24;return(Date.UTC(o("year"),o("month")-1,o("day"),s,o("minute"),o("second"))-t)/6e4}function N5(e,t,n){if(n==="")return`${e}T${t}:00+00:00`;const r=Date.parse(`${e}T${t}:00Z`),o=OA(n,r);if(Number.isNaN(o))return Oq(e,t);const s=OA(n,r-o*6e4);return`${e}T${t}:00${TT(Number.isNaN(s)?o:s)}`}function k5(e,t){const n=Date.parse(e),r=OA(t,n),o=Number.isNaN(r)?-new Date(n).getTimezoneOffset():r,s=new Date(n+o*6e4);return`${Tq(s)}T${Os(s.getUTCHours())}:${Os(s.getUTCMinutes())}:${Os(s.getUTCSeconds())}${TT(o)}`}const Iv=e=>Oq(e,"00:00");function Di(e,t){const[n,r,o]=e.split("-").map(Number);return Tq(new Date(Date.UTC(n,r-1,o+t)))}function v_(e){const[t,n,r]=e.split("-").map(Number),o=new Date(Date.UTC(t,n-1,r));return Di(e,-((o.getUTCDay()+6)%7))}function WDe(e,t){const[n,r]=t.split("-").map(Number);if(e==="year")return[`${n}-01-01`,`${n+1}-01-01`];if(e==="month"){const s=`${n}-${Os(r)}-01`,a=r===12?`${n+1}-01-01`:`${n}-${Os(r+1)}-01`;return[v_(s),Di(v_(Di(a,-1)),7)]}if(e==="day")return[t,Di(t,1)];const o=v_(t);return[o,Di(o,7)]}function Y$e(e,t){const[n,r]=WDe(e,t);return{from:Iv(n),to:Iv(r)}}function Q$e(e,t){return{from:Iv(e),to:Iv(Di(e,t))}}const GDe=tNe({offset:!0,local:!1}),Mq=nNe(),D5=xv().transform(e=>{const t=eq([GDe,Mq]).safeParse(e);return t.success?t.data:void 0}).optional(),KDe=RT.extend({start:D5,end:D5}),Vg=e=>Mq.safeParse(e).success;function Wg(e){return{date:e,endDate:e,startTime:"09:00",endTime:"10:00",allDay:!1}}function X$e(e,t,n,r){if(e===void 0||t===void 0)return Wg(n);if(Vg(e)&&Vg(t)){const a=Di(t,-1);return a<e?Wg(n):{date:e,endDate:a,startTime:"",endTime:"",allDay:!0}}if(Vg(e)||Vg(t)||Date.parse(t)<=Date.parse(e))return Wg(n);const o=k5(e,r),s=k5(t,r);return{date:o.slice(0,10),endDate:s.slice(0,10),startTime:o.slice(11,16),endTime:s.slice(11,16),allDay:!1}}function J$e(e,t){return e.allDay?{start:e.date,end:Di(e.endDate,1)}:{start:N5(e.date,e.startTime,t),end:N5(e.endDate,e.endTime,t)}}const ZDe=()=>Re(()=>import("./new-Dcxxskrf.js"),__vite__mapDeps([122,123,115,60,99,100,59,13,38,25,74,112,111,98,31,62,4,3,12,5,114,116,124,16,17,33])),YDe=Ee("/calendar/$view/$date/new")({validateSearch:KDe,component:Ie(ZDe,"component")}),QDe=()=>Re(()=>import("./index-CKJI1yyc.js"),__vite__mapDeps([125,50,51,39,5,4,3,34,11,38,9,52,53,45,24,17,28,29,30,31,32,6,18,54,55,8,13,10,56,7,57,58,59,60,61,62,12,63,48,64,65,66,2,40,67,16,68,33,69,37,35,36,70,71,72,73,74,75])),XDe=Ee("/mail/$mailboxId/$threadId/")({component:Ie(QDe,"component")}),JDe=()=>Re(()=>import("./_messageId-CKJI1yyc.js"),__vite__mapDeps([126,50,51,39,5,4,3,34,11,38,9,52,53,45,24,17,28,29,30,31,32,6,18,54,55,8,13,10,56,7,57,58,59,60,61,62,12,63,48,64,65,66,2,40,67,16,68,33,69,37,35,36,70,71,72,73,74,75])),eLe=Ee("/mail/$mailboxId/$threadId/$messageId")({component:Ie(JDe,"component")}),tLe=()=>Re(()=>import("./compose._-_outboxMessageId_-CNjOOJSh.js"),__vite__mapDeps([127,27,28,24,5,4,3,29,30,31,32,6,17,13,33])),nLe=Ee("/mail/$mailboxId/compose/{-$outboxMessageId}")({component:Ie(tLe,"component")}),rLe=()=>Re(()=>import("./index-zm_VBLaY.js"),__vite__mapDeps([128,79,52,53,45,34,11,4,3,5,24,9,17,39,38,28,29,30,31,32,6,18,54,55,8,13,10,56,7,57,58,59,60,61,62,12,63,48,64,65,66,2,40,67,16,68,33,69,70,71,35,36,37,80])),oLe=Ee("/mail/brief/$threadId/")({component:Ie(rLe,"component")}),sLe=()=>Re(()=>import("./_messageId-zm_VBLaY.js"),__vite__mapDeps([129,79,52,53,45,34,11,4,3,5,24,9,17,39,38,28,29,30,31,32,6,18,54,55,8,13,10,56,7,57,58,59,60,61,62,12,63,48,64,65,66,2,40,67,16,68,33,69,70,71,35,36,37,80])),iLe=Ee("/mail/brief/$threadId/$messageId")({component:Ie(sLe,"component")}),aLe=()=>Re(()=>import("./compose._-_outboxMessageId_-B1VRxkLN.js"),__vite__mapDeps([130,27,28,24,5,4,3,29,30,31,32,6,17,13,33])),lLe=Ee("/mail/brief/compose/{-$outboxMessageId}")({component:Ie(aLe,"component")}),uLe=()=>Re(()=>import("./index-ChPDqFRo.js"),__vite__mapDeps([131,83,52,53,45,34,11,4,3,5,24,9,17,39,38,28,29,30,31,32,6,18,54,55,8,13,10,56,7,57,58,59,60,61,62,12,63,48,64,65,66,2,40,67,16,68,33,69,51,37,80])),cLe=Ee("/mail/flagged/$threadId/")({component:Ie(uLe,"component")}),dLe=()=>Re(()=>import("./_messageId-ChPDqFRo.js"),__vite__mapDeps([132,83,52,53,45,34,11,4,3,5,24,9,17,39,38,28,29,30,31,32,6,18,54,55,8,13,10,56,7,57,58,59,60,61,62,12,63,48,64,65,66,2,40,67,16,68,33,69,51,37,80])),fLe=Ee("/mail/flagged/$threadId/$messageId")({component:Ie(dLe,"component")}),hLe=()=>Re(()=>import("./compose._-_outboxMessageId_-C46VmFN6.js"),__vite__mapDeps([133,27,28,24,5,4,3,29,30,31,32,6,17,13,33])),pLe=Ee("/mail/flagged/compose/{-$outboxMessageId}")({component:Ie(hLe,"component")}),gLe=()=>Re(()=>import("./compose._-_outboxMessageId_-P_jyR3kH.js"),__vite__mapDeps([134,27,28,24,5,4,3,29,30,31,32,6,17,13,33])),mLe=Ee("/mail/outbox/compose/{-$outboxMessageId}")({component:Ie(gLe,"component")}),vLe=()=>Re(()=>import("./_outboxMessageId-DcDyjoYW.js"),__vite__mapDeps([135,85,53,45,34,11,4,3,5,24,43,72,40,9,36,64,86,87])),yLe=Ee("/mail/outbox/draft/$outboxMessageId")({component:Ie(vLe,"component")}),bLe=()=>Re(()=>import("./index-CkmUVU7Z.js"),__vite__mapDeps([136,137,59,13,38,112,111,62,4,3,12,5,116,100,25,99,74,33])),SLe=Ee("/calendar/$view/$date/$calendarObjectId/")({component:Ie(bLe,"component")}),wLe=()=>Re(()=>import("./_recurrenceId-C0Y19B2U.js"),[]),CLe=Ee("/calendar/$view/$date/$calendarObjectId/$recurrenceId")({component:Ie(wLe,"component")}),ELe=()=>Re(()=>import("./edit-AzkegsLe.js"),__vite__mapDeps([138,123,115,60,99,100,59,13,38,25,74,112,111,98,31,62,4,3,12,5,114,116,124,16,17,33])),_Le=Ee("/calendar/$view/$date/$calendarObjectId/edit")({component:Ie(ELe,"component")}),xLe=()=>Re(()=>import("./suggestion._suggestionId-BsoCLJDm.js"),__vite__mapDeps([139,59,13,38,115,60,99,100,25,74,62,116,63,57,124,16,17,4,3,12,5])),ALe=Ee("/calendar/$view/$date/suggestion/$suggestionId")({component:Ie(xLe,"component")}),ILe=()=>Re(()=>import("./task._calendarTaskId-c5dsQ5Rn.js"),__vite__mapDeps([140,59,13,38,111,4,3,12,5,113,100,25])),RLe=Ee("/calendar/$view/$date/task/$calendarTaskId")({component:Ie(ILe,"component")}),TLe=()=>Re(()=>import("./index-COXNp0IG.js"),__vite__mapDeps([141,137,59,13,38,112,111,62,4,3,12,5,116,100,25,99,74,33])),OLe=Ee("/calendar/$view/$date/$calendarObjectId/$recurrenceId/")({component:Ie(TLe,"component")}),MLe=()=>Re(()=>import("./edit-qD-xofN1.js"),__vite__mapDeps([142,123,115,60,99,100,59,13,38,25,74,112,111,98,31,62,4,3,12,5,114,116,124,16,17,33])),PLe=Ee("/calendar/$view/$date/$calendarObjectId/$recurrenceId/edit")({component:Ie(MLe,"component")}),NLe=Ee("/mail/$mailboxId/$threadId/$messageId/$mode/{-$outboxMessageId}")({validateSearch:IT.mailbox}),kLe=Ee("/mail/brief/$threadId/$messageId/$mode/{-$outboxMessageId}")({validateSearch:IT.brief}),DLe=Ee("/mail/flagged/$threadId/$messageId/$mode/{-$outboxMessageId}")({validateSearch:IT.flagged}),LLe=Hke.update({id:"/",path:"/",getParentRoute:()=>ea}),OT=Wke.update({id:"/calendar",path:"/calendar",getParentRoute:()=>ea}),ULe=Kke.update({id:"/import",path:"/import",getParentRoute:()=>ea}),_c=l3e.update({id:"/mail",path:"/mail",getParentRoute:()=>ea}),$Le=c3e.update({id:"/onboarding",path:"/onboarding",getParentRoute:()=>ea}),Qn=I3e.update({id:"/settings",path:"/settings",getParentRoute:()=>ea}),FLe=U3e.update({id:"/",path:"/",getParentRoute:()=>OT}),zLe=$3e.update({id:"/",path:"/",getParentRoute:()=>_c}),ib=z3e.update({id:"/$mailboxId",path:"/$mailboxId",getParentRoute:()=>_c}),ab=H3e.update({id:"/brief",path:"/brief",getParentRoute:()=>_c}),lb=W3e.update({id:"/flagged",path:"/flagged",getParentRoute:()=>_c}),ub=K3e.update({id:"/outbox",path:"/outbox",getParentRoute:()=>_c}),jLe=Z3e.update({id:"/reset-password/$token",path:"/reset-password/$token",getParentRoute:()=>ea}),BLe=Q3e.update({id:"/",path:"/",getParentRoute:()=>Qn}),HLe=J3e.update({id:"/$slotId",path:"/$slotId",getParentRoute:()=>Qn}),qLe=nDe.update({id:"/accounts",path:"/accounts",getParentRoute:()=>Qn}),VLe=oDe.update({id:"/advanced",path:"/advanced",getParentRoute:()=>Qn}),WLe=iDe.update({id:"/appearance",path:"/appearance",getParentRoute:()=>Qn}),GLe=lDe.update({id:"/calendars",path:"/calendars",getParentRoute:()=>Qn}),KLe=cDe.update({id:"/classification",path:"/classification",getParentRoute:()=>Qn}),ZLe=fDe.update({id:"/filters",path:"/filters",getParentRoute:()=>Qn}),YLe=pDe.update({id:"/folders",path:"/folders",getParentRoute:()=>Qn}),QLe=mDe.update({id:"/labels",path:"/labels",getParentRoute:()=>Qn}),XLe=yDe.update({id:"/people",path:"/people",getParentRoute:()=>Qn}),JLe=SDe.update({id:"/senders",path:"/senders",getParentRoute:()=>Qn}),e4e=CDe.update({id:"/suggested-vips",path:"/suggested-vips",getParentRoute:()=>Qn}),t4e=_De.update({id:"/warnings",path:"/warnings",getParentRoute:()=>Qn}),xc=ADe.update({id:"/$view/$date",path:"/$view/$date",getParentRoute:()=>OT}),n4e=RDe.update({id:"/",path:"/",getParentRoute:()=>ib}),MT=ODe.update({id:"/$threadId",path:"/$threadId",getParentRoute:()=>ib}),r4e=PDe.update({id:"/",path:"/",getParentRoute:()=>ab}),PT=kDe.update({id:"/$threadId",path:"/$threadId",getParentRoute:()=>ab}),o4e=LDe.update({id:"/",path:"/",getParentRoute:()=>lb}),NT=$De.update({id:"/$threadId",path:"/$threadId",getParentRoute:()=>lb}),s4e=zDe.update({id:"/",path:"/",getParentRoute:()=>ub}),i4e=BDe.update({id:"/",path:"/",getParentRoute:()=>xc}),cb=qDe.update({id:"/$calendarObjectId",path:"/$calendarObjectId",getParentRoute:()=>xc}),a4e=YDe.update({id:"/new",path:"/new",getParentRoute:()=>xc}),l4e=XDe.update({id:"/",path:"/",getParentRoute:()=>MT}),Pq=eLe.update({id:"/$messageId",path:"/$messageId",getParentRoute:()=>MT}),u4e=nLe.update({id:"/compose/{-$outboxMessageId}",path:"/compose/{-$outboxMessageId}",getParentRoute:()=>ib}),c4e=oLe.update({id:"/",path:"/",getParentRoute:()=>PT}),Nq=iLe.update({id:"/$messageId",path:"/$messageId",getParentRoute:()=>PT}),d4e=lLe.update({id:"/compose/{-$outboxMessageId}",path:"/compose/{-$outboxMessageId}",getParentRoute:()=>ab}),f4e=cLe.update({id:"/",path:"/",getParentRoute:()=>NT}),kq=fLe.update({id:"/$messageId",path:"/$messageId",getParentRoute:()=>NT}),h4e=pLe.update({id:"/compose/{-$outboxMessageId}",path:"/compose/{-$outboxMessageId}",getParentRoute:()=>lb}),p4e=mLe.update({id:"/compose/{-$outboxMessageId}",path:"/compose/{-$outboxMessageId}",getParentRoute:()=>ub}),g4e=yLe.update({id:"/draft/$outboxMessageId",path:"/draft/$outboxMessageId",getParentRoute:()=>ub}),m4e=SLe.update({id:"/",path:"/",getParentRoute:()=>cb}),kT=CLe.update({id:"/$recurrenceId",path:"/$recurrenceId",getParentRoute:()=>cb}),v4e=_Le.update({id:"/edit",path:"/edit",getParentRoute:()=>cb}),y4e=ALe.update({id:"/suggestion/$suggestionId",path:"/suggestion/$suggestionId",getParentRoute:()=>xc}),b4e=RLe.update({id:"/task/$calendarTaskId",path:"/task/$calendarTaskId",getParentRoute:()=>xc}),S4e=OLe.update({id:"/",path:"/",getParentRoute:()=>kT}),w4e=PLe.update({id:"/edit",path:"/edit",getParentRoute:()=>kT}),C4e=NLe.update({id:"/$mode/{-$outboxMessageId}",path:"/$mode/{-$outboxMessageId}",getParentRoute:()=>Pq}),E4e=kLe.update({id:"/$mode/{-$outboxMessageId}",path:"/$mode/{-$outboxMessageId}",getParentRoute:()=>Nq}),_4e=DLe.update({id:"/$mode/{-$outboxMessageId}",path:"/$mode/{-$outboxMessageId}",getParentRoute:()=>kq}),x4e={CalendarViewDateCalendarObjectIdRecurrenceIdEditRoute:w4e,CalendarViewDateCalendarObjectIdRecurrenceIdIndexRoute:S4e},A4e=kT._addFileChildren(x4e),I4e={CalendarViewDateCalendarObjectIdRecurrenceIdRoute:A4e,CalendarViewDateCalendarObjectIdEditRoute:v4e,CalendarViewDateCalendarObjectIdIndexRoute:m4e},R4e=cb._addFileChildren(I4e),T4e={CalendarViewDateCalendarObjectIdRoute:R4e,CalendarViewDateNewRoute:a4e,CalendarViewDateIndexRoute:i4e,CalendarViewDateSuggestionSuggestionIdRoute:y4e,CalendarViewDateTaskCalendarTaskIdRoute:b4e},O4e=xc._addFileChildren(T4e),M4e={CalendarIndexRoute:FLe,CalendarViewDateRoute:O4e},P4e=OT._addFileChildren(M4e),N4e={MailMailboxIdThreadIdMessageIdModeChar123OutboxMessageIdChar125Route:C4e},k4e=Pq._addFileChildren(N4e),D4e={MailMailboxIdThreadIdMessageIdRoute:k4e,MailMailboxIdThreadIdIndexRoute:l4e},L4e=MT._addFileChildren(D4e),U4e={MailMailboxIdThreadIdRoute:L4e,MailMailboxIdIndexRoute:n4e,MailMailboxIdComposeChar123OutboxMessageIdChar125Route:u4e},$4e=ib._addFileChildren(U4e),F4e={MailBriefThreadIdMessageIdModeChar123OutboxMessageIdChar125Route:E4e},z4e=Nq._addFileChildren(F4e),j4e={MailBriefThreadIdMessageIdRoute:z4e,MailBriefThreadIdIndexRoute:c4e},B4e=PT._addFileChildren(j4e),H4e={MailBriefThreadIdRoute:B4e,MailBriefIndexRoute:r4e,MailBriefComposeChar123OutboxMessageIdChar125Route:d4e},q4e=ab._addFileChildren(H4e),V4e={MailFlaggedThreadIdMessageIdModeChar123OutboxMessageIdChar125Route:_4e},W4e=kq._addFileChildren(V4e),G4e={MailFlaggedThreadIdMessageIdRoute:W4e,MailFlaggedThreadIdIndexRoute:f4e},K4e=NT._addFileChildren(G4e),Z4e={MailFlaggedThreadIdRoute:K4e,MailFlaggedIndexRoute:o4e,MailFlaggedComposeChar123OutboxMessageIdChar125Route:h4e},Y4e=lb._addFileChildren(Z4e),Q4e={MailOutboxIndexRoute:s4e,MailOutboxComposeChar123OutboxMessageIdChar125Route:p4e,MailOutboxDraftOutboxMessageIdRoute:g4e},X4e=ub._addFileChildren(Q4e),J4e={MailMailboxIdRoute:$4e,MailBriefRoute:q4e,MailFlaggedRoute:Y4e,MailOutboxRoute:X4e,MailIndexRoute:zLe},eUe=_c._addFileChildren(J4e),tUe={SettingsSlotIdRoute:HLe,SettingsAccountsRoute:qLe,SettingsAdvancedRoute:VLe,SettingsAppearanceRoute:WLe,SettingsCalendarsRoute:GLe,SettingsClassificationRoute:KLe,SettingsFiltersRoute:ZLe,SettingsFoldersRoute:YLe,SettingsLabelsRoute:QLe,SettingsPeopleRoute:XLe,SettingsSendersRoute:JLe,SettingsSuggestedVipsRoute:e4e,SettingsWarningsRoute:t4e,SettingsIndexRoute:BLe},nUe=Qn._addFileChildren(tUe),rUe={IndexRoute:LLe,CalendarRoute:P4e,ImportRoute:ULe,MailRoute:eUe,OnboardingRoute:$Le,SettingsRoute:nUe,ResetPasswordTokenRoute:jLe},oUe=ea._addFileChildren(rUe)._addFileTypes(),sUe=(e,t,n)=>{const r=tbe({routeTree:oUe,context:{queryClient:e},history:n,stringifySearch:aAe,defaultPreload:"intent",defaultPendingComponent:Zv,defaultPendingMs:200,defaultPendingMinMs:300});return r.subscribe("onResolved",o=>{t.recordPageView(o.toLocation.pathname),poe(o.toLocation.pathname)}),r},De=e=>typeof e=="string",Bd=()=>{let e,t;const n=new Promise((r,o)=>{e=r,t=o});return n.resolve=e,n.reject=t,n},L5=e=>e==null?"":""+e,iUe=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},aUe=/###/g,U5=e=>e&&e.indexOf("###")>-1?e.replace(aUe,"."):e,$5=e=>!e||De(e),vf=(e,t,n)=>{const r=De(t)?t.split("."):t;let o=0;for(;o<r.length-1;){if($5(e))return{};const s=U5(r[o]);!e[s]&&n&&(e[s]=new n),Object.prototype.hasOwnProperty.call(e,s)?e=e[s]:e={},++o}return $5(e)?{}:{obj:e,k:U5(r[o])}},F5=(e,t,n)=>{const{obj:r,k:o}=vf(e,t,Object);if(r!==void 0||t.length===1){r[o]=n;return}let s=t[t.length-1],a=t.slice(0,t.length-1),u=vf(e,a,Object);for(;u.obj===void 0&&a.length;)s=`${a[a.length-1]}.${s}`,a=a.slice(0,a.length-1),u=vf(e,a,Object),u?.obj&&typeof u.obj[`${u.k}.${s}`]<"u"&&(u.obj=void 0);u.obj[`${u.k}.${s}`]=n},lUe=(e,t,n,r)=>{const{obj:o,k:s}=vf(e,t,Object);o[s]=o[s]||[],o[s].push(n)},Rv=(e,t)=>{const{obj:n,k:r}=vf(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},uUe=(e,t,n)=>{const r=Rv(e,n);return r!==void 0?r:Rv(t,n)},Dq=(e,t,n)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?De(e[r])||e[r]instanceof String||De(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):Dq(e[r],t[r],n):e[r]=t[r]);return e},fu=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var cUe={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const dUe=e=>De(e)?e.replace(/[&<>"'\/]/g,t=>cUe[t]):e;class fUe{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const n=this.regExpMap.get(t);if(n!==void 0)return n;const r=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,r),this.regExpQueue.push(t),r}}const hUe=[" ",",","?","!",";"],pUe=new fUe(20),gUe=(e,t,n)=>{t=t||"",n=n||"";const r=hUe.filter(a=>t.indexOf(a)<0&&n.indexOf(a)<0);if(r.length===0)return!0;const o=pUe.getRegExp(`(${r.map(a=>a==="?"?"\\?":a).join("|")})`);let s=!o.test(e);if(!s){const a=e.indexOf(n);a>0&&!o.test(e.substring(0,a))&&(s=!0)}return s},MA=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;const r=t.split(n);let o=e;for(let s=0;s<r.length;){if(!o||typeof o!="object")return;let a,u="";for(let c=s;c<r.length;++c)if(c!==s&&(u+=n),u+=r[c],a=o[u],a!==void 0){if(["string","number","boolean"].indexOf(typeof a)>-1&&c<r.length-1)continue;s+=c-s+1;break}o=a}return o},Tv=e=>e?.replace("_","-"),mUe={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}};class Ov{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(t,n)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=t||mUe,this.options=n,this.debug=n.debug}log(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"log","",!0)}warn(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"warn","",!0)}error(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"error","")}deprecate(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"warn","WARNING DEPRECATED: ",!0)}forward(t,n,r,o){return o&&!this.debug?null:(De(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new Ov(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new Ov(this.logger,t)}}var $o=new Ov;class db{constructor(){this.observers={}}on(t,n){return t.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const o=this.observers[r].get(n)||0;this.observers[r].set(n,o+1)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t].delete(n)}}emit(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];this.observers[t]&&Array.from(this.observers[t].entries()).forEach(a=>{let[u,c]=a;for(let f=0;f<c;f++)u(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(a=>{let[u,c]=a;for(let f=0;f<c;f++)u.apply(u,[t,...r])})}}class z5 extends db{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,a=o.ignoreJSONStructure!==void 0?o.ignoreJSONStructure:this.options.ignoreJSONStructure;let u;t.indexOf(".")>-1?u=t.split("."):(u=[t,n],r&&(Array.isArray(r)?u.push(...r):De(r)&&s?u.push(...r.split(s)):u.push(r)));const c=Rv(this.data,u);return!c&&!n&&!r&&t.indexOf(".")>-1&&(t=u[0],n=u[1],r=u.slice(2).join(".")),c||!a||!De(r)?c:MA(this.data?.[t]?.[n],r,s)}addResource(t,n,r,o){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const a=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let u=[t,n];r&&(u=u.concat(a?r.split(a):r)),t.indexOf(".")>-1&&(u=t.split("."),o=n,n=u[1]),this.addNamespaces(n),F5(this.data,u,o),s.silent||this.emit("added",t,n,r,o)}addResources(t,n,r){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const s in r)(De(r[s])||Array.isArray(r[s]))&&this.addResource(t,n,s,r[s],{silent:!0});o.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,o,s){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},u=[t,n];t.indexOf(".")>-1&&(u=t.split("."),o=r,r=n,n=u[1]),this.addNamespaces(n);let c=Rv(this.data,u)||{};a.skipCopy||(r=JSON.parse(JSON.stringify(r))),o?Dq(c,r,s):c={...c,...r},F5(this.data,u,c),a.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(o=>n[o]&&Object.keys(n[o]).length>0)}toJSON(){return this.data}}var Lq={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,o){return e.forEach(s=>{t=this.processors[s]?.process(t,n,r,o)??t}),t}};const j5={},B5=e=>!De(e)&&typeof e!="boolean"&&typeof e!="number";class Mv extends db{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),iUe(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=$o.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};return t==null?!1:this.resolve(t,n)?.res!==void 0}extractFromKey(t,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const o=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let s=n.ns||this.options.defaultNS||[];const a=r&&t.indexOf(r)>-1,u=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!gUe(t,r,o);if(a&&!u){const c=t.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:t,namespaces:De(s)?[s]:s};const f=t.split(r);(r!==o||r===o&&this.options.ns.indexOf(f[0])>-1)&&(s=f.shift()),t=f.join(o)}return{key:t,namespaces:De(s)?[s]:s}}translate(t,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const o=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,s=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:a,namespaces:u}=this.extractFromKey(t[t.length-1],n),c=u[u.length-1],f=n.lng||this.language,h=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(f?.toLowerCase()==="cimode"){if(h){const $=n.nsSeparator||this.options.nsSeparator;return o?{res:`${c}${$}${a}`,usedKey:a,exactUsedKey:a,usedLng:f,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:`${c}${$}${a}`}return o?{res:a,usedKey:a,exactUsedKey:a,usedLng:f,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:a}const g=this.resolve(t,n);let m=g?.res;const v=g?.usedKey||a,w=g?.exactUsedKey||a,S=["[object Number]","[object Function]","[object RegExp]"],C=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,E=!this.i18nFormat||this.i18nFormat.handleAsObject,A=n.count!==void 0&&!De(n.count),I=Mv.hasDefaultValue(n),T=A?this.pluralResolver.getSuffix(f,n.count,n):"",N=n.ordinal&&A?this.pluralResolver.getSuffix(f,n.count,{ordinal:!1}):"",M=A&&!n.ordinal&&n.count===0,R=M&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${T}`]||n[`defaultValue${N}`]||n.defaultValue;let k=m;E&&!m&&I&&(k=R);const L=B5(k),q=Object.prototype.toString.apply(k);if(E&&k&&L&&S.indexOf(q)<0&&!(De(C)&&Array.isArray(k))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const $=this.options.returnedObjectHandler?this.options.returnedObjectHandler(v,k,{...n,ns:u}):`key '${a} (${this.language})' returned an object instead of string.`;return o?(g.res=$,g.usedParams=this.getUsedParamsDetails(n),g):$}if(s){const $=Array.isArray(k),D=$?[]:{},j=$?w:v;for(const Z in k)if(Object.prototype.hasOwnProperty.call(k,Z)){const he=`${j}${s}${Z}`;I&&!m?D[Z]=this.translate(he,{...n,defaultValue:B5(R)?R[Z]:void 0,joinArrays:!1,ns:u}):D[Z]=this.translate(he,{...n,joinArrays:!1,ns:u}),D[Z]===he&&(D[Z]=k[Z])}m=D}}else if(E&&De(C)&&Array.isArray(m))m=m.join(C),m&&(m=this.extendTranslation(m,t,n,r));else{let $=!1,D=!1;!this.isValidLookup(m)&&I&&($=!0,m=R),this.isValidLookup(m)||(D=!0,m=a);const Z=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&D?void 0:m,he=I&&R!==m&&this.options.updateMissing;if(D||$||he){if(this.logger.log(he?"updateKey":"missingKey",f,c,a,he?R:m),s){const ue=this.resolve(a,{...n,keySeparator:!1});ue&&ue.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let B=[];const Q=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&Q&&Q[0])for(let ue=0;ue<Q.length;ue++)B.push(Q[ue]);else this.options.saveMissingTo==="all"?B=this.languageUtils.toResolveHierarchy(n.lng||this.language):B.push(n.lng||this.language);const ae=(ue,we,U)=>{const X=I&&U!==m?U:Z;this.options.missingKeyHandler?this.options.missingKeyHandler(ue,c,we,X,he,n):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(ue,c,we,X,he,n),this.emit("missingKey",ue,c,we,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&A?B.forEach(ue=>{const we=this.pluralResolver.getSuffixes(ue,n);M&&n[`defaultValue${this.options.pluralSeparator}zero`]&&we.indexOf(`${this.options.pluralSeparator}zero`)<0&&we.push(`${this.options.pluralSeparator}zero`),we.forEach(U=>{ae([ue],a+U,n[`defaultValue${U}`]||R)})}):ae(B,a,R))}m=this.extendTranslation(m,t,n,g,r),D&&m===a&&this.options.appendNamespaceToMissingKey&&(m=`${c}:${a}`),(D||$)&&this.options.parseMissingKeyHandler&&(m=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}:${a}`:a,$?m:void 0))}return o?(g.res=m,g.usedParams=this.getUsedParamsDetails(n),g):m}extendTranslation(t,n,r,o,s){var a=this;if(this.i18nFormat?.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||o.usedLng,o.usedNS,o.usedKey,{resolved:o});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const f=De(t)&&(r?.interpolation?.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let h;if(f){const m=t.match(this.interpolator.nestingRegexp);h=m&&m.length}let g=r.replace&&!De(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(g={...this.options.interpolation.defaultVariables,...g}),t=this.interpolator.interpolate(t,g,r.lng||this.language||o.usedLng,r),f){const m=t.match(this.interpolator.nestingRegexp),v=m&&m.length;h<v&&(r.nest=!1)}!r.lng&&o&&o.res&&(r.lng=this.language||o.usedLng),r.nest!==!1&&(t=this.interpolator.nest(t,function(){for(var m=arguments.length,v=new Array(m),w=0;w<m;w++)v[w]=arguments[w];return s?.[0]===v[0]&&!r.context?(a.logger.warn(`It seems you are nesting recursively key: ${v[0]} in key: ${n[0]}`),null):a.translate(...v,n)},r)),r.interpolation&&this.interpolator.reset()}const u=r.postProcess||this.options.postProcess,c=De(u)?[u]:u;return t!=null&&c?.length&&r.applyPostProcessor!==!1&&(t=Lq.handle(c,t,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...o,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),t}resolve(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r,o,s,a,u;return De(t)&&(t=[t]),t.forEach(c=>{if(this.isValidLookup(r))return;const f=this.extractFromKey(c,n),h=f.key;o=h;let g=f.namespaces;this.options.fallbackNS&&(g=g.concat(this.options.fallbackNS));const m=n.count!==void 0&&!De(n.count),v=m&&!n.ordinal&&n.count===0,w=n.context!==void 0&&(De(n.context)||typeof n.context=="number")&&n.context!=="",S=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);g.forEach(C=>{this.isValidLookup(r)||(u=C,!j5[`${S[0]}-${C}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(u)&&(j5[`${S[0]}-${C}`]=!0,this.logger.warn(`key "${o}" for languages "${S.join(", ")}" won't get resolved as namespace "${u}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),S.forEach(E=>{if(this.isValidLookup(r))return;a=E;const A=[h];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(A,h,E,C,n);else{let T;m&&(T=this.pluralResolver.getSuffix(E,n.count,n));const N=`${this.options.pluralSeparator}zero`,M=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(m&&(A.push(h+T),n.ordinal&&T.indexOf(M)===0&&A.push(h+T.replace(M,this.options.pluralSeparator)),v&&A.push(h+N)),w){const R=`${h}${this.options.contextSeparator}${n.context}`;A.push(R),m&&(A.push(R+T),n.ordinal&&T.indexOf(M)===0&&A.push(R+T.replace(M,this.options.pluralSeparator)),v&&A.push(R+N))}}let I;for(;I=A.pop();)this.isValidLookup(r)||(s=I,r=this.getResource(E,C,I,n))}))})}),{res:r,usedKey:o,exactUsedKey:s,usedLng:a,usedNS:u}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat?.getResource?this.i18nFormat.getResource(t,n,r,o):this.resourceStore.getResource(t,n,r,o)}getUsedParamsDetails(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=t.replace&&!De(t.replace);let o=r?t.replace:t;if(r&&typeof t.count<"u"&&(o.count=t.count),this.options.interpolation.defaultVariables&&(o={...this.options.interpolation.defaultVariables,...o}),!r){o={...o};for(const s of n)delete o[s]}return o}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n===r.substring(0,n.length)&&t[r]!==void 0)return!0;return!1}}class H5{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=$o.create("languageUtils")}getScriptPartFromCode(t){if(t=Tv(t),!t||t.indexOf("-")<0)return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=Tv(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(De(t)&&t.indexOf("-")>-1){let n;try{n=Intl.getCanonicalLocales(t)[0]}catch{}return n&&this.options.lowerCaseLng&&(n=n.toLowerCase()),n||(this.options.lowerCaseLng?t.toLowerCase():t)}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const o=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(o))&&(n=o)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const o=this.getLanguagePartFromCode(r);if(this.isSupportedCode(o))return n=o;n=this.options.supportedLngs.find(s=>{if(s===o)return s;if(!(s.indexOf("-")<0&&o.indexOf("-")<0)&&(s.indexOf("-")>0&&o.indexOf("-")<0&&s.substring(0,s.indexOf("-"))===o||s.indexOf(o)===0&&o.length>1))return s})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),De(t)&&(t=[t]),Array.isArray(t))return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],t),o=[],s=a=>{a&&(this.isSupportedCode(a)?o.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return De(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&s(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&s(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&s(this.getLanguagePartFromCode(t))):De(t)&&s(this.formatLanguageCode(t)),r.forEach(a=>{o.indexOf(a)<0&&s(this.formatLanguageCode(a))}),o}}const q5={zero:0,one:1,two:2,few:3,many:4,other:5},V5={select:e=>e===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class vUe{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=$o.create("pluralResolver"),this.pluralRulesCache={}}addRule(t,n){this.rules[t]=n}clearCache(){this.pluralRulesCache={}}getRule(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=Tv(t==="dev"?"en":t),o=n.ordinal?"ordinal":"cardinal",s=JSON.stringify({cleanedCode:r,type:o});if(s in this.pluralRulesCache)return this.pluralRulesCache[s];let a;try{a=new Intl.PluralRules(r,{type:o})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),V5;if(!t.match(/-|_/))return V5;const c=this.languageUtils.getLanguagePartFromCode(t);a=this.getRule(c,n)}return this.pluralRulesCache[s]=a,a}needsPlural(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=this.getRule(t,n);return r||(r=this.getRule("dev",n)),r?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,r).map(o=>`${n}${o}`)}getSuffixes(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=this.getRule(t,n);return r||(r=this.getRule("dev",n)),r?r.resolvedOptions().pluralCategories.sort((o,s)=>q5[o]-q5[s]).map(o=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${o}`):[]}getSuffix(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const o=this.getRule(t,r);return o?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${o.select(n)}`:(this.logger.warn(`no plural rule found for: ${t}`),this.getSuffix("dev",n,r))}}const W5=function(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=uUe(e,t,n);return!s&&o&&De(n)&&(s=MA(e,n,r),s===void 0&&(s=MA(t,n,r))),s},y_=e=>e.replace(/\$/g,"$$$$");class yUe{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=$o.create("interpolator"),this.options=t,this.format=t?.interpolation?.format||(n=>n),this.init(t)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});const{escape:n,escapeValue:r,useRawValueToEscape:o,prefix:s,prefixEscaped:a,suffix:u,suffixEscaped:c,formatSeparator:f,unescapeSuffix:h,unescapePrefix:g,nestingPrefix:m,nestingPrefixEscaped:v,nestingSuffix:w,nestingSuffixEscaped:S,nestingOptionsSeparator:C,maxReplaces:E,alwaysFormat:A}=t.interpolation;this.escape=n!==void 0?n:dUe,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=o!==void 0?o:!1,this.prefix=s?fu(s):a||"{{",this.suffix=u?fu(u):c||"}}",this.formatSeparator=f||",",this.unescapePrefix=h?"":g||"-",this.unescapeSuffix=this.unescapePrefix?"":h||"",this.nestingPrefix=m?fu(m):v||fu("$t("),this.nestingSuffix=w?fu(w):S||fu(")"),this.nestingOptionsSeparator=C||",",this.maxReplaces=E||1e3,this.alwaysFormat=A!==void 0?A:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(n,r)=>n?.source===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(t,n,r,o){let s,a,u;const c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},f=v=>{if(v.indexOf(this.formatSeparator)<0){const E=W5(n,c,v,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(E,void 0,r,{...o,...n,interpolationkey:v}):E}const w=v.split(this.formatSeparator),S=w.shift().trim(),C=w.join(this.formatSeparator).trim();return this.format(W5(n,c,S,this.options.keySeparator,this.options.ignoreJSONStructure),C,r,{...o,...n,interpolationkey:S})};this.resetRegExp();const h=o?.missingInterpolationHandler||this.options.missingInterpolationHandler,g=o?.interpolation?.skipOnVariables!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:v=>y_(v)},{regex:this.regexp,safeValue:v=>this.escapeValue?y_(this.escape(v)):y_(v)}].forEach(v=>{for(u=0;s=v.regex.exec(t);){const w=s[1].trim();if(a=f(w),a===void 0)if(typeof h=="function"){const C=h(t,s,o);a=De(C)?C:""}else if(o&&Object.prototype.hasOwnProperty.call(o,w))a="";else if(g){a=s[0];continue}else this.logger.warn(`missed to pass in variable ${w} for interpolating ${t}`),a="";else!De(a)&&!this.useRawValueToEscape&&(a=L5(a));const S=v.safeValue(a);if(t=t.replace(s[0],S),g?(v.regex.lastIndex+=a.length,v.regex.lastIndex-=s[0].length):v.regex.lastIndex=0,u++,u>=this.maxReplaces)break}}),t}nest(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o,s,a;const u=(c,f)=>{const h=this.nestingOptionsSeparator;if(c.indexOf(h)<0)return c;const g=c.split(new RegExp(`${h}[ ]*{`));let m=`{${g[1]}`;c=g[0],m=this.interpolate(m,a);const v=m.match(/'/g),w=m.match(/"/g);((v?.length??0)%2===0&&!w||w.length%2!==0)&&(m=m.replace(/'/g,'"'));try{a=JSON.parse(m),f&&(a={...f,...a})}catch(S){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,S),`${c}${h}${m}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,c};for(;o=this.nestingRegexp.exec(t);){let c=[];a={...r},a=a.replace&&!De(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let f=!1;if(o[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(o[1])){const h=o[1].split(this.formatSeparator).map(g=>g.trim());o[1]=h.shift(),c=h,f=!0}if(s=n(u.call(this,o[1].trim(),a),a),s&&o[0]===t&&!De(s))return s;De(s)||(s=L5(s)),s||(this.logger.warn(`missed to resolve ${o[1]} for nesting ${t}`),s=""),f&&(s=c.reduce((h,g)=>this.format(h,g,r.lng,{...r,interpolationkey:o[1].trim()}),s.trim())),t=t.replace(o[0],s),this.regexp.lastIndex=0}return t}}const bUe=e=>{let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const o=r[1].substring(0,r[1].length-1);t==="currency"&&o.indexOf(":")<0?n.currency||(n.currency=o.trim()):t==="relativetime"&&o.indexOf(":")<0?n.range||(n.range=o.trim()):o.split(";").forEach(a=>{if(a){const[u,...c]=a.split(":"),f=c.join(":").trim().replace(/^'+|'+$/g,""),h=u.trim();n[h]||(n[h]=f),f==="false"&&(n[h]=!1),f==="true"&&(n[h]=!0),isNaN(f)||(n[h]=parseInt(f,10))}})}return{formatName:t,formatOptions:n}},hu=e=>{const t={};return(n,r,o)=>{let s=o;o&&o.interpolationkey&&o.formatParams&&o.formatParams[o.interpolationkey]&&o[o.interpolationkey]&&(s={...s,[o.interpolationkey]:void 0});const a=r+JSON.stringify(s);let u=t[a];return u||(u=e(Tv(r),o),t[a]=u),u(n)}};class SUe{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=$o.create("formatter"),this.options=t,this.formats={number:hu((n,r)=>{const o=new Intl.NumberFormat(n,{...r});return s=>o.format(s)}),currency:hu((n,r)=>{const o=new Intl.NumberFormat(n,{...r,style:"currency"});return s=>o.format(s)}),datetime:hu((n,r)=>{const o=new Intl.DateTimeFormat(n,{...r});return s=>o.format(s)}),relativetime:hu((n,r)=>{const o=new Intl.RelativeTimeFormat(n,{...r});return s=>o.format(s,r.range||"day")}),list:hu((n,r)=>{const o=new Intl.ListFormat(n,{...r});return s=>o.format(s)})},this.init(t)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};this.formatSeparator=n.interpolation.formatSeparator||","}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=hu(n)}format(t,n,r){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=n.split(this.formatSeparator);if(s.length>1&&s[0].indexOf("(")>1&&s[0].indexOf(")")<0&&s.find(u=>u.indexOf(")")>-1)){const u=s.findIndex(c=>c.indexOf(")")>-1);s[0]=[s[0],...s.splice(1,u)].join(this.formatSeparator)}return s.reduce((u,c)=>{const{formatName:f,formatOptions:h}=bUe(c);if(this.formats[f]){let g=u;try{const m=o?.formatParams?.[o.interpolationkey]||{},v=m.locale||m.lng||o.locale||o.lng||r;g=this.formats[f](u,v,{...h,...o,...m})}catch(m){this.logger.warn(m)}return g}else this.logger.warn(`there was no format function for ${f}`);return u},t)}}const wUe=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class CUe extends db{constructor(t,n,r){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=t,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=o,this.logger=$o.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=o.maxParallelReads||10,this.readingCalls=0,this.maxRetries=o.maxRetries>=0?o.maxRetries:5,this.retryTimeout=o.retryTimeout>=1?o.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(r,o.backend,o)}queueLoad(t,n,r,o){const s={},a={},u={},c={};return t.forEach(f=>{let h=!0;n.forEach(g=>{const m=`${f}|${g}`;!r.reload&&this.store.hasResourceBundle(f,g)?this.state[m]=2:this.state[m]<0||(this.state[m]===1?a[m]===void 0&&(a[m]=!0):(this.state[m]=1,h=!1,a[m]===void 0&&(a[m]=!0),s[m]===void 0&&(s[m]=!0),c[g]===void 0&&(c[g]=!0)))}),h||(u[f]=!0)}),(Object.keys(s).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:o}),{toLoad:Object.keys(s),pending:Object.keys(a),toLoadLanguages:Object.keys(u),toLoadNamespaces:Object.keys(c)}}loaded(t,n,r){const o=t.split("|"),s=o[0],a=o[1];n&&this.emit("failedLoading",s,a,n),!n&&r&&this.store.addResourceBundle(s,a,r,void 0,void 0,{skipCopy:!0}),this.state[t]=n?-1:2,n&&r&&(this.state[t]=0);const u={};this.queue.forEach(c=>{lUe(c.loaded,[s],a),wUe(c,t),n&&c.errors.push(n),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(f=>{u[f]||(u[f]={});const h=c.loaded[f];h.length&&h.forEach(g=>{u[f][g]===void 0&&(u[f][g]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",u),this.queue=this.queue.filter(c=>!c.done)}read(t,n,r){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;if(!t.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:o,wait:s,callback:a});return}this.readingCalls++;const u=(f,h)=>{if(this.readingCalls--,this.waitingReads.length>0){const g=this.waitingReads.shift();this.read(g.lng,g.ns,g.fcName,g.tried,g.wait,g.callback)}if(f&&h&&o<this.maxRetries){setTimeout(()=>{this.read.call(this,t,n,r,o+1,s*2,a)},s);return}a(f,h)},c=this.backend[r].bind(this.backend);if(c.length===2){try{const f=c(t,n);f&&typeof f.then=="function"?f.then(h=>u(null,h)).catch(u):u(null,f)}catch(f){u(f)}return}return c(t,n,u)}prepareLoading(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();De(t)&&(t=this.languageUtils.toResolveHierarchy(t)),De(n)&&(n=[n]);const s=this.queueLoad(t,n,r,o);if(!s.toLoad.length)return s.pending.length||o(),null;s.toLoad.forEach(a=>{this.loadOne(a)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=t.split("|"),o=r[0],s=r[1];this.read(o,s,"read",void 0,void 0,(a,u)=>{a&&this.logger.warn(`${n}loading namespace ${s} for language ${o} failed`,a),!a&&u&&this.logger.log(`${n}loaded namespace ${s} for language ${o}`,u),this.loaded(t,a,u)})}saveMissing(t,n,r,o,s){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},u=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend?.create){const c={...a,isUpdate:s},f=this.backend.create.bind(this.backend);if(f.length<6)try{let h;f.length===5?h=f(t,n,r,o,c):h=f(t,n,r,o),h&&typeof h.then=="function"?h.then(g=>u(null,g)).catch(u):u(null,h)}catch(h){u(h)}else f(t,n,r,o,u,c)}!t||!t[0]||this.store.addResource(t[0],n,r,o)}}}const G5=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),De(e[1])&&(t.defaultValue=e[1]),De(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const n=e[3]||e[2];Object.keys(n).forEach(r=>{t[r]=n[r]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),K5=e=>(De(e.ns)&&(e.ns=[e.ns]),De(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),De(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),typeof e.initImmediate=="boolean"&&(e.initAsync=e.initImmediate),e),Gg=()=>{},EUe=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class Qf extends db{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=K5(t),this.services={},this.logger=$o,this.modules={external:[]},EUe(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(){var t=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof n=="function"&&(r=n,n={}),n.defaultNS==null&&n.ns&&(De(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const o=G5();this.options={...o,...this.options,...K5(n)},this.options.interpolation={...o.interpolation,...this.options.interpolation},n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);const s=h=>h?typeof h=="function"?new h:h:null;if(!this.options.isClone){this.modules.logger?$o.init(s(this.modules.logger),this.options):$o.init(null,this.options);let h;this.modules.formatter?h=this.modules.formatter:h=SUe;const g=new H5(this.options);this.store=new z5(this.options.resources,this.options);const m=this.services;m.logger=$o,m.resourceStore=this.store,m.languageUtils=g,m.pluralResolver=new vUe(g,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),h&&(!this.options.interpolation.format||this.options.interpolation.format===o.interpolation.format)&&(m.formatter=s(h),m.formatter.init(m,this.options),this.options.interpolation.format=m.formatter.format.bind(m.formatter)),m.interpolator=new yUe(this.options),m.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},m.backendConnector=new CUe(s(this.modules.backend),m.resourceStore,m,this.options),m.backendConnector.on("*",function(v){for(var w=arguments.length,S=new Array(w>1?w-1:0),C=1;C<w;C++)S[C-1]=arguments[C];t.emit(v,...S)}),this.modules.languageDetector&&(m.languageDetector=s(this.modules.languageDetector),m.languageDetector.init&&m.languageDetector.init(m,this.options.detection,this.options)),this.modules.i18nFormat&&(m.i18nFormat=s(this.modules.i18nFormat),m.i18nFormat.init&&m.i18nFormat.init(this)),this.translator=new Mv(this.services,this.options),this.translator.on("*",function(v){for(var w=arguments.length,S=new Array(w>1?w-1:0),C=1;C<w;C++)S[C-1]=arguments[C];t.emit(v,...S)}),this.modules.external.forEach(v=>{v.init&&v.init(this)})}if(this.format=this.options.interpolation.format,r||(r=Gg),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const h=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);h.length>0&&h[0]!=="dev"&&(this.options.lng=h[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(h=>{this[h]=function(){return t.store[h](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(h=>{this[h]=function(){return t.store[h](...arguments),t}});const c=Bd(),f=()=>{const h=(g,m)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),c.resolve(m),r(g,m)};if(this.languages&&!this.isInitialized)return h(null,this.t.bind(this));this.changeLanguage(this.options.lng,h)};return this.options.resources||!this.options.initAsync?f():setTimeout(f,0),c}loadResources(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Gg;const o=De(t)?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(o?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const s=[],a=u=>{if(!u||u==="cimode")return;this.services.languageUtils.toResolveHierarchy(u).forEach(f=>{f!=="cimode"&&s.indexOf(f)<0&&s.push(f)})};o?a(o):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(c=>a(c)),this.options.preload?.forEach?.(u=>a(u)),this.services.backendConnector.load(s,this.options.ns,u=>{!u&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(u)})}else r(null)}reloadResources(t,n,r){const o=Bd();return typeof t=="function"&&(r=t,t=void 0),typeof n=="function"&&(r=n,n=void 0),t||(t=this.languages),n||(n=this.options.ns),r||(r=Gg),this.services.backendConnector.reload(t,n,s=>{o.resolve(),r(s)}),o}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&Lq.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1))for(let n=0;n<this.languages.length;n++){const r=this.languages[n];if(!(["cimode","dev"].indexOf(r)>-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}changeLanguage(t,n){var r=this;this.isLanguageChangingTo=t;const o=Bd();this.emit("languageChanging",t);const s=c=>{this.language=c,this.languages=this.services.languageUtils.toResolveHierarchy(c),this.resolvedLanguage=void 0,this.setResolvedLanguage(c)},a=(c,f)=>{f?(s(f),this.translator.changeLanguage(f),this.isLanguageChangingTo=void 0,this.emit("languageChanged",f),this.logger.log("languageChanged",f)):this.isLanguageChangingTo=void 0,o.resolve(function(){return r.t(...arguments)}),n&&n(c,function(){return r.t(...arguments)})},u=c=>{!t&&!c&&this.services.languageDetector&&(c=[]);const f=De(c)?c:this.services.languageUtils.getBestMatchFromCodes(c);f&&(this.language||s(f),this.translator.language||this.translator.changeLanguage(f),this.services.languageDetector?.cacheUserLanguage?.(f)),this.loadResources(f,h=>{a(h,f)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?u(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(u):this.services.languageDetector.detect(u):u(t),o}getFixedT(t,n,r){var o=this;const s=function(a,u){let c;if(typeof u!="object"){for(var f=arguments.length,h=new Array(f>2?f-2:0),g=2;g<f;g++)h[g-2]=arguments[g];c=o.options.overloadTranslationOptionHandler([a,u].concat(h))}else c={...u};c.lng=c.lng||s.lng,c.lngs=c.lngs||s.lngs,c.ns=c.ns||s.ns,c.keyPrefix!==""&&(c.keyPrefix=c.keyPrefix||r||s.keyPrefix);const m=o.options.keySeparator||".";let v;return c.keyPrefix&&Array.isArray(a)?v=a.map(w=>`${c.keyPrefix}${m}${w}`):v=c.keyPrefix?`${c.keyPrefix}${m}${a}`:a,o.t(v,c)};return De(t)?s.lng=t:s.lngs=t,s.ns=n,s.keyPrefix=r,s}t(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.translator?.translate(...n)}exists(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.translator?.exists(...n)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],o=this.options?this.options.fallbackLng:!1,s=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(u,c)=>{const f=this.services.backendConnector.state[`${u}|${c}`];return f===-1||f===0||f===2};if(n.precheck){const u=n.precheck(this,a);if(u!==void 0)return u}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(r,t)&&(!o||a(s,t)))}loadNamespaces(t,n){const r=Bd();return this.options.ns?(De(t)&&(t=[t]),t.forEach(o=>{this.options.ns.indexOf(o)<0&&this.options.ns.push(o)}),this.loadResources(o=>{r.resolve(),n&&n(o)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=Bd();De(t)&&(t=[t]);const o=this.options.preload||[],s=t.filter(a=>o.indexOf(a)<0&&this.services.languageUtils.isSupportedCode(a));return s.length?(this.options.preload=o.concat(s),this.loadResources(a=>{r.resolve(),n&&n(a)}),r):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!t)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services?.languageUtils||new H5(G5());return n.indexOf(r.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new Qf(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Gg;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const o={...this.options,...t,isClone:!0},s=new Qf(o);if((t.debug!==void 0||t.prefix!==void 0)&&(s.logger=s.logger.clone(t)),["store","services","language"].forEach(u=>{s[u]=this[u]}),s.services={...this.services},s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},r){const u=Object.keys(this.store.data).reduce((c,f)=>(c[f]={...this.store.data[f]},Object.keys(c[f]).reduce((h,g)=>(h[g]={...c[f][g]},h),{})),{});s.store=new z5(u,o),s.services.resourceStore=s.store}return s.translator=new Mv(s.services,o),s.translator.on("*",function(u){for(var c=arguments.length,f=new Array(c>1?c-1:0),h=1;h<c;h++)f[h-1]=arguments[h];s.emit(u,...f)}),s.init(o,n),s.translator.options=o,s.translator.backendConnector.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},s}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Bn=Qf.createInstance();Bn.createInstance=Qf.createInstance;Bn.createInstance;Bn.dir;Bn.init;Bn.loadResources;Bn.reloadResources;Bn.use;Bn.changeLanguage;Bn.getFixedT;Bn.t;Bn.exists;Bn.setDefaultNamespace;Bn.hasLoadedNamespace;Bn.loadNamespaces;Bn.loadLanguages;const{slice:_Ue,forEach:xUe}=[];function AUe(e){return xUe.call(_Ue.call(arguments,1),t=>{if(t)for(const n in t)e[n]===void 0&&(e[n]=t[n])}),e}function IUe(e){return typeof e!="string"?!1:[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(n=>n.test(e))}const Z5=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,RUe=function(e,t){const r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},o=encodeURIComponent(t);let s=`${e}=${o}`;if(r.maxAge>0){const a=r.maxAge-0;if(Number.isNaN(a))throw new Error("maxAge should be a Number");s+=`; Max-Age=${Math.floor(a)}`}if(r.domain){if(!Z5.test(r.domain))throw new TypeError("option domain is invalid");s+=`; Domain=${r.domain}`}if(r.path){if(!Z5.test(r.path))throw new TypeError("option path is invalid");s+=`; Path=${r.path}`}if(r.expires){if(typeof r.expires.toUTCString!="function")throw new TypeError("option expires is invalid");s+=`; Expires=${r.expires.toUTCString()}`}if(r.httpOnly&&(s+="; HttpOnly"),r.secure&&(s+="; Secure"),r.sameSite)switch(typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite){case!0:s+="; SameSite=Strict";break;case"lax":s+="; SameSite=Lax";break;case"strict":s+="; SameSite=Strict";break;case"none":s+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return r.partitioned&&(s+="; Partitioned"),s},Y5={create(e,t,n,r){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};n&&(o.expires=new Date,o.expires.setTime(o.expires.getTime()+n*60*1e3)),r&&(o.domain=r),document.cookie=RUe(e,t,o)},read(e){const t=`${e}=`,n=document.cookie.split(";");for(let r=0;r<n.length;r++){let o=n[r];for(;o.charAt(0)===" ";)o=o.substring(1,o.length);if(o.indexOf(t)===0)return o.substring(t.length,o.length)}return null},remove(e,t){this.create(e,"",-1,t)}};var TUe={name:"cookie",lookup(e){let{lookupCookie:t}=e;if(t&&typeof document<"u")return Y5.read(t)||void 0},cacheUserLanguage(e,t){let{lookupCookie:n,cookieMinutes:r,cookieDomain:o,cookieOptions:s}=t;n&&typeof document<"u"&&Y5.create(n,e,r,o,s)}},OUe={name:"querystring",lookup(e){let{lookupQuerystring:t}=e,n;if(typeof window<"u"){let{search:r}=window.location;!window.location.search&&window.location.hash?.indexOf("?")>-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));const s=r.substring(1).split("&");for(let a=0;a<s.length;a++){const u=s[a].indexOf("=");u>0&&s[a].substring(0,u)===t&&(n=s[a].substring(u+1))}}return n}},MUe={name:"hash",lookup(e){let{lookupHash:t,lookupFromHashIndex:n}=e,r;if(typeof window<"u"){const{hash:o}=window.location;if(o&&o.length>2){const s=o.substring(1);if(t){const a=s.split("&");for(let u=0;u<a.length;u++){const c=a[u].indexOf("=");c>0&&a[u].substring(0,c)===t&&(r=a[u].substring(c+1))}}if(r)return r;if(!r&&n>-1){const a=o.match(/\/([a-zA-Z-]*)/g);return Array.isArray(a)?a[typeof n=="number"?n:0]?.replace("/",""):void 0}}}return r}};let pu=null;const Q5=()=>{if(pu!==null)return pu;try{if(pu=typeof window<"u"&&window.localStorage!==null,!pu)return!1;const e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{pu=!1}return pu};var PUe={name:"localStorage",lookup(e){let{lookupLocalStorage:t}=e;if(t&&Q5())return window.localStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupLocalStorage:n}=t;n&&Q5()&&window.localStorage.setItem(n,e)}};let gu=null;const X5=()=>{if(gu!==null)return gu;try{if(gu=typeof window<"u"&&window.sessionStorage!==null,!gu)return!1;const e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{gu=!1}return gu};var NUe={name:"sessionStorage",lookup(e){let{lookupSessionStorage:t}=e;if(t&&X5())return window.sessionStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupSessionStorage:n}=t;n&&X5()&&window.sessionStorage.setItem(n,e)}},kUe={name:"navigator",lookup(e){const t=[];if(typeof navigator<"u"){const{languages:n,userLanguage:r,language:o}=navigator;if(n)for(let s=0;s<n.length;s++)t.push(n[s]);r&&t.push(r),o&&t.push(o)}return t.length>0?t:void 0}},DUe={name:"htmlTag",lookup(e){let{htmlTag:t}=e,n;const r=t||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(n=r.getAttribute("lang")),n}},LUe={name:"path",lookup(e){let{lookupFromPathIndex:t}=e;if(typeof window>"u")return;const n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(n)?n[typeof t=="number"?t:0]?.replace("/",""):void 0}},UUe={name:"subdomain",lookup(e){let{lookupFromSubdomainIndex:t}=e;const n=typeof t=="number"?t+1:1,r=typeof window<"u"&&window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(r)return r[n]}};let Uq=!1;try{document.cookie,Uq=!0}catch{}const $q=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];Uq||$q.splice(1,1);const $Ue=()=>({order:$q,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:e=>e});class Fq{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(t,n)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t,this.options=AUe(n,this.options||{},$Ue()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=o=>o.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=r,this.addDetector(TUe),this.addDetector(OUe),this.addDetector(PUe),this.addDetector(NUe),this.addDetector(kUe),this.addDetector(DUe),this.addDetector(LUe),this.addDetector(UUe),this.addDetector(MUe)}addDetector(t){return this.detectors[t.name]=t,this}detect(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,n=[];return t.forEach(r=>{if(this.detectors[r]){let o=this.detectors[r].lookup(this.options);o&&typeof o=="string"&&(o=[o]),o&&(n=n.concat(o))}}),n=n.filter(r=>r!=null&&!IUe(r)).map(r=>this.options.convertDetectedLanguage(r)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?n:n.length>0?n[0]:null}cacheUserLanguage(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;n&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||n.forEach(r=>{this.detectors[r]&&this.detectors[r].cacheUserLanguage(t,this.options)}))}}Fq.type="languageDetector";const zq=["__proto__","constructor","prototype"];function jq(e){return!(typeof e!="string"||e.length===0||e.length>128||zq.indexOf(e)>-1||e.indexOf("..")>-1||e.indexOf("\\")>-1||/[?#%:&=;\s]/.test(e)||/[\x00-\x1F\x7F]/.test(e))}function Bq(e){return!(!jq(e)||e.indexOf("/")>-1||e.indexOf("@")>-1)}function FUe(e){return!(!jq(e)||e.indexOf("//")>-1)}const zUe={lng:Bq,ns:FUe};function Kg(e){return typeof e!="string"?e:e.replace(/[\r\n\x00-\x1F\x7F]/g," ")}function jUe(e){if(typeof e!="string"||e.length===0)return e;try{const t=new URL(e);return t.username||t.password?(t.username="",t.password="",t.toString()):e}catch{return e.replace(/(\/\/)[^/@\s]+@/g,"$1")}}function Hq(){return typeof XMLHttpRequest=="function"||typeof XMLHttpRequest=="object"}function BUe(e){return!!e&&typeof e.then=="function"}function HUe(e){return BUe(e)?e:Promise.resolve(e)}const qUe=/\{\{(.+?)\}\}/g,J5=/^[/\\]{2}/;function e8(e,t){let n=!1;const r=e.replace(qUe,(o,s)=>{const a=s.trim();if(zq.indexOf(a)>-1)return o;const u=t[a];if(u==null)return o;const c=zUe[a]||Bq,f=String(u).split("+");for(const h of f)if(!c(h))return n=!0,o;return f.join("+")});return n||J5.test(r)&&!J5.test(e)?null:r}const Ha=typeof globalThis<"u"?globalThis:typeof global<"u"?global:typeof window<"u"?window:void 0;let Pv;typeof fetch=="function"?Pv=fetch:Ha&&typeof Ha.fetch=="function"&&(Pv=Ha.fetch);const t8=Hq()&&Ha?Ha.XMLHttpRequest:void 0,VUe=typeof ActiveXObject=="function"&&Ha?Ha.ActiveXObject:void 0,qq=["__proto__","constructor","prototype"],PA=(e,t)=>{if(t&&typeof t=="object"){let n="";for(const r of Object.keys(t))qq.indexOf(r)>-1||(n+="&"+encodeURIComponent(r)+"="+encodeURIComponent(t[r]));if(!n)return e;e=e+(e.indexOf("?")!==-1?"&":"?")+n.slice(1)}return e},n8=(e,t,n,r)=>{const o=s=>{if(!s.ok)return n(s.statusText||"Error",{status:s.status});s.text().then(a=>{n(null,{status:s.status,data:a})}).catch(n)};if(r){const s=r(e,t);if(s instanceof Promise){s.then(o).catch(n);return}}typeof fetch=="function"?fetch(e,t).then(o).catch(n):Pv(e,t).then(o).catch(n)},WUe=(e,t,n,r)=>{e.queryStringParams&&(t=PA(t,e.queryStringParams));const o={...typeof e.customHeaders=="function"?e.customHeaders():e.customHeaders};typeof window>"u"&&typeof global<"u"&&typeof global.process<"u"&&global.process.versions&&global.process.versions.node&&(o["User-Agent"]=`i18next-http-backend (node/${global.process.version}; ${global.process.platform} ${global.process.arch})`),n&&(o["Content-Type"]="application/json");const s=typeof e.requestOptions=="function"?e.requestOptions(n):e.requestOptions,a={method:n?"POST":"GET",body:n?e.stringify(n):void 0,headers:o,...e._omitFetchOptions?{}:s},u=typeof e.alternateFetch=="function"&&e.alternateFetch.length>=1?e.alternateFetch:void 0;try{n8(t,a,r,u)}catch(c){if(!s||Object.keys(s).length===0||!c.message||c.message.indexOf("not implemented")<0)return r(c);try{Object.keys(s).forEach(f=>{delete a[f]}),n8(t,a,r,u),e._omitFetchOptions=!0}catch(f){r(f)}}},GUe=(e,t,n,r)=>{n&&typeof n=="object"&&(n=PA("",n).slice(1)),e.queryStringParams&&(t=PA(t,e.queryStringParams));try{const o=t8?new t8:new VUe("MSXML2.XMLHTTP.3.0");o.open(n?"POST":"GET",t,1),e.crossDomain||o.setRequestHeader("X-Requested-With","XMLHttpRequest"),o.withCredentials=!!e.withCredentials,n&&o.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),o.overrideMimeType&&o.overrideMimeType("application/json");let s=e.customHeaders;if(s=typeof s=="function"?s():s,s)for(const a of Object.keys(s))qq.indexOf(a)>-1||o.setRequestHeader(a,s[a]);o.onreadystatechange=()=>{o.readyState>3&&r(o.status>=400?o.statusText:null,{status:o.status,data:o.responseText})},o.send(n)}catch(o){console&&console.log(o)}},KUe=(e,t,n,r)=>{if(typeof n=="function"&&(r=n,n=void 0),r=r||(()=>{}),Pv&&t.indexOf("file:")!==0)return WUe(e,t,n,r);if(Hq()||typeof ActiveXObject=="function")return GUe(e,t,n,r);r(new Error("No fetch and no xhr implementation found!"))},ZUe=()=>({loadPath:"/locales/{{lng}}/{{ns}}.json",addPath:"/locales/add/{{lng}}/{{ns}}",parse:e=>JSON.parse(e),stringify:JSON.stringify,parsePayload:(e,t,n)=>({[t]:n||""}),parseLoadPayload:(e,t)=>{},request:KUe,reloadInterval:typeof window<"u"?!1:3600*1e3,customHeaders:{},queryStringParams:{},crossDomain:!1,withCredentials:!1,overrideMimeType:!1,requestOptions:{mode:"cors",credentials:"same-origin",cache:"default"}});var Vq=class{constructor(e,t={},n={}){this.services=e,this.options=t,this.allOptions=n,this.type="backend",this.init(e,t,n)}init(e,t={},n={}){if(this.services=e,this.options={...ZUe(),...this.options||{},...t},this.allOptions=n,this.services&&this.options.reloadInterval){const r=setInterval(()=>this.reload(),this.options.reloadInterval);typeof r=="object"&&typeof r.unref=="function"&&r.unref()}}readMulti(e,t,n){this._readAny(e,e,t,t,n)}read(e,t,n){this._readAny([e],e,[t],t,n)}_readAny(e,t,n,r,o){let s=this.options.loadPath;typeof this.options.loadPath=="function"&&(s=this.options.loadPath(e,n)),s=HUe(s),s.then(a=>{if(!a)return o(null,{});const u=e8(a,{lng:e.join("+"),ns:n.join("+")});if(u==null){const c=e.map(Kg).join(", "),f=n.map(Kg).join(", ");return o(new Error("i18next-http-backend: unsafe lng/ns value — refusing to build request URL for languages=["+c+"] namespaces=["+f+"]"),!1)}this.loadUrl(u,o,t,r)})}loadUrl(e,t,n,r){const o=typeof n=="string"?[n]:n,s=typeof r=="string"?[r]:r,a=this.options.parseLoadPayload(o,s),u=Kg(jUe(e));this.options.request(this.options,e,a,(c,f)=>{if(f&&(f.status>=500&&f.status<600||!f.status))return t("failed loading "+u+"; status code: "+f.status,!0);if(f&&f.status>=400&&f.status<500)return t("failed loading "+u+"; status code: "+f.status,!1);if(!f&&c&&c.message){const m=c.message.toLowerCase();if(["failed","fetch","network","load"].find(v=>m.indexOf(v)>-1))return t("failed loading "+u+": "+Kg(c.message),!0)}if(c)return t(c,!1);let h,g;try{typeof f.data=="string"?h=this.options.parse(f.data,n,r):h=f.data}catch{g="failed parsing "+u+" to json"}if(g)return t(g,!1);t(null,h)})}create(e,t,n,r,o){if(!this.options.addPath)return;typeof e=="string"&&(e=[e]);const s=this.options.parsePayload(t,n,r);let a=0;const u=[],c=[];e.forEach(f=>{let h=this.options.addPath;typeof this.options.addPath=="function"&&(h=this.options.addPath(f,t));const g=e8(h,{lng:f,ns:t});if(g==null){a+=1,o&&a===e.length&&o(u,c);return}this.options.request(this.options,g,s,(m,v)=>{a+=1,u.push(m),c.push(v),a===e.length&&typeof o=="function"&&o(u,c)})})}reload(){const{backendConnector:e,languageUtils:t,logger:n}=this.services,r=e.language;if(r&&r.toLowerCase()==="cimode")return;const o=[],s=a=>{t.toResolveHierarchy(a).forEach(u=>{o.indexOf(u)<0&&o.push(u)})};s(r),this.allOptions.preload&&this.allOptions.preload.forEach(a=>s(a)),o.forEach(a=>{this.allOptions.ns.forEach(u=>{e.read(a,u,"read",null,null,(c,f)=>{c&&n.warn(`loading namespace ${u} for language ${a} failed`,c),!c&&f&&n.log(`loaded namespace ${u} for language ${a}`,f),e.loaded(`${a}|${u}`,c,f)})})})}};Vq.type="backend";Bn.use(Vq).use(Fq).use(bAe).init({fallbackLng:"en",supportedLngs:["en","nl","de","fr"],ns:["common","mail"],defaultNS:"common",backend:{loadPath:"/locales/{{lng}}/{{ns}}.json"},detection:{order:["navigator","htmlTag"],caches:[]},interpolation:{escapeValue:!1},react:{useSuspense:!0,bindI18n:"languageChanged loaded"}});const YUe=({authProvider:e,settingsSlots:t=[],rootElementId:n="root"})=>{doe(),sAe(),e.configure(),Ibe(e);const r=eAe();toe(r);const o=new Jme({queryCache:new R9({onError:kbe}),mutationCache:new I9({onError:Dbe}),defaultOptions:{queries:{staleTime:3e4,gcTime:5*6e4,retry:1}}});rAe();const s=sUe(o,r);for(const c of t)if(Object.hasOwn(s.routesByPath,`/settings/${c.id}`))throw new Error(`Settings slot "${c.id}" collides with a built-in settings section`);r.recordPageView(window.location.pathname);const a=document.getElementById(n);if(!a)throw new Error(`Root element not found: #${n}`);const{Shell:u}=e;ube.createRoot(a).render(O.jsx(_.StrictMode,{children:O.jsx(qB.Provider,{value:r,children:O.jsxs(eve,{client:o,children:[O.jsx(Obe,{value:e,children:O.jsx(C3e,{value:t,children:O.jsx(u,{children:O.jsx(obe,{router:s})})})}),!1]})})}))};YUe({authProvider:Ome});export{ic as $,Zv as A,Xr as B,Jee as C,Cne as D,dF as E,ote as F,e7 as G,gr as H,D$ as I,$$e as J,p3e as K,$$ as L,ute as M,Coe as N,o7 as O,PNe as P,MNe as Q,KB as R,hte as S,mte as T,hA as U,q8e as V,sb as W,L_ as X,dq as Y,C$e as Z,fRe as _,Ja as a,uRe as a$,qAe as a0,sT as a1,ty as a2,Qre as a3,mR as a4,gc as a5,i3e as a6,Mbe as a7,E3e as a8,z3e as a9,k8e as aA,ak as aB,nDe as aC,j5e as aD,a$e as aE,r8e as aF,kne as aG,j6e as aH,t6e as aI,z6e as aJ,O8e as aK,kke as aL,Bre as aM,zre as aN,Fre as aO,hn as aP,Qv as aQ,$6 as aR,T5e as aS,cRe as aT,R8e as aU,I8e as aV,T8e as aW,RF as aX,oq as aY,_8e as aZ,A8e as a_,V6e as aa,J3e as ab,W$e as ac,nI as ad,s$e as ae,XH as af,F as ag,r$e as ah,o$e as ai,uTe as aj,kNe as ak,DNe as al,z5e as am,$5e as an,Sf as ao,bF as ap,E$ as aq,wo as ar,bT as as,Kn as at,i$e as au,f6e as av,sh as aw,Hu as ax,iI as ay,N8e as az,yt as b,d6e as b$,Jre as b0,h6e as b1,tf as b2,il as b3,Q8e as b4,gR as b5,X8e as b6,J8e as b7,e$e as b8,p6e as b9,R$e as bA,T$e as bB,QIe as bC,X5e as bD,_$e as bE,h_ as bF,HNe as bG,w$e as bH,F$e as bI,wRe as bJ,V$e as bK,k5e as bL,U5e as bM,L5e as bN,D5e as bO,B$e as bP,j$e as bQ,w3e as bR,z$e as bS,H$e as bT,q$e as bU,s8e as bV,i8e as bW,dte as bX,D8e as bY,gRe as bZ,_6e as b_,s6e as ba,jne as bb,u6e as bc,a6e as bd,o6e as be,nre as bf,sI as bg,W5e as bh,G5e as bi,QNe as bj,XNe as bk,cke as bl,uke as bm,Hne as bn,c6e as bo,ore as bp,KNe as bq,O5e as br,$Ae as bs,x$e as bt,I$e as bu,TIe as bv,A$e as bw,M5e as bx,E$e as by,O$e as bz,iT as c,Wo as c$,f3e as c0,D$e as c1,yte as c2,ene as c3,c8e as c4,Rq as c5,N5 as c6,J$e as c7,G$e as c8,K$e as c9,ane as cA,one as cB,gne as cC,Kf as cD,mRe as cE,Sc as cF,yn as cG,Fm as cH,b9 as cI,Kme as cJ,tve as cK,ove as cL,lve as cM,sve as cN,ive as cO,Vn as cP,cve as cQ,R4 as cR,ave as cS,fke as cT,BNe as cU,o8e as cV,QB as cW,wIe as cX,l$e as cY,XB as cZ,c$e as c_,Z$e as ca,hr as cb,Iye as cc,ST as cd,W6e as ce,Ny as cf,N3e as cg,k$e as ch,mee as ci,$P as cj,QUe as ck,XUe as cl,e6e as cm,uq as cn,K8e as co,Z8e as cp,G8e as cq,y$ as cr,V8e as cs,Re as ct,n$e as cu,SRe as cv,Y8e as cw,W8e as cx,MRe as cy,rne as cz,Zr as d,Q$e as d$,P$e as d0,Cq as d1,h$e as d2,mNe as d3,d$e as d4,f$e as d5,H6e as d6,B6e as d7,dve as d8,w6e as d9,p$e as dA,y$e as dB,IRe as dC,g$e as dD,m$e as dE,v$e as dF,L8e as dG,Xv as dH,v6e as dI,m6e as dJ,F8e as dK,t$e as dL,ONe as dM,B8e as dN,nRe as dO,Bu as dP,g6e as dQ,U$e as dR,b6e as dS,y6e as dT,z8e as dU,N5e as dV,P5e as dW,C6e as dX,H8e as dY,b$e as dZ,S$e as d_,S6e as da,lte as db,sne as dc,lre as dd,ate as de,vre as df,wF as dg,I6e as dh,x6e as di,k6e as dj,Pre as dk,L6e as dl,R6e as dm,D6e as dn,Mre as dp,bre as dq,Gr as dr,i6e as ds,F6e as dt,U6e as du,$6e as dv,N6e as dw,M6e as dx,_F as dy,U8e as dz,dl as e,RLe as e$,E6e as e0,t3e as e1,u$e as e2,M$e as e3,IIe as e4,AIe as e5,P8e as e6,JB as e7,RNe as e8,TNe as e9,m8e as eA,v8e as eB,h8e as eC,tIe as eD,Une as eE,n6e as eF,r6e as eG,J5e as eH,t8e as eI,e8e as eJ,l6e as eK,q5e as eL,YIe as eM,H5e as eN,V5e as eO,KIe as eP,L$e as eQ,ARe as eR,CT as eS,b8e as eT,C8e as eU,S8e as eV,y8e as eW,w8e as eX,X$e as eY,SLe as eZ,_Le as e_,Xke as ea,N$e as eb,A6e as ec,O6e as ed,T6e as ee,P6e as ef,$8e as eg,gte as eh,K5e as ei,Z5e as ej,XIe as ek,Q5e as el,Y5e as em,Di as en,Y$e as eo,k5 as ep,E8e as eq,l8e as er,d8e as es,u8e as et,x8e as eu,a8e as ev,f8e as ew,j8e as ex,p8e as ey,g8e as ez,lR as f,OLe as f0,PLe as f1,nte as f2,M8e as g,B5e as h,n8e as i,O as j,YB as k,R5e as l,F5e as m,Vv as n,Wv as o,rn as p,pte as q,_ as r,ny as s,ete as t,fh as u,A$ as v,fte as w,tI as x,Xee as y,rte as z};
|