@lunora/studio 1.0.0-alpha.31 → 1.0.0-alpha.311
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/LICENSE.md +6 -0
- package/README.md +1 -1
- package/dist/index.d.mts +1581 -0
- package/dist/index.d.ts +974 -806
- package/dist/index.mjs +1 -0
- package/dist/mount.d.mts +22 -0
- package/dist/mount.d.ts +11 -10
- package/dist/mount.mjs +1 -0
- package/dist/packem_chunks/AdvisorHealthPanel.mjs +1 -0
- package/dist/packem_chunks/ApiTab.mjs +1 -0
- package/dist/packem_chunks/AuditPanel.mjs +1 -0
- package/dist/packem_chunks/DeploymentHealthPanel.mjs +1 -0
- package/dist/packem_chunks/ExportImportPanel.mjs +3 -0
- package/dist/packem_chunks/FileBrowser.mjs +4 -0
- package/dist/packem_chunks/FunctionRunner.mjs +1 -0
- package/dist/packem_chunks/FunctionStatsPanel.mjs +1 -0
- package/dist/packem_chunks/HealthPanel.mjs +1 -0
- package/dist/packem_chunks/InsightsPanel.mjs +1 -0
- package/dist/packem_chunks/LogsPanel.mjs +1 -0
- package/dist/packem_chunks/MailPanel.mjs +2 -0
- package/dist/packem_chunks/MetricsPanel.mjs +1 -0
- package/dist/packem_chunks/NotificationsPanel.mjs +1 -0
- package/dist/packem_chunks/PitrPanel.mjs +1 -0
- package/dist/packem_chunks/SchemaViewer.mjs +1 -0
- package/dist/packem_chunks/SecurityAdvisorPanel.mjs +1 -0
- package/dist/packem_chunks/SettingsPanel.mjs +1 -0
- package/dist/packem_chunks/SqlEditorPanel.mjs +10 -0
- package/dist/packem_chunks/TableEditor.mjs +1 -0
- package/dist/packem_chunks/agents-panel.mjs +1 -0
- package/dist/packem_chunks/ai-usage-panel.mjs +1 -0
- package/dist/packem_chunks/analytics-panel.mjs +1 -0
- package/dist/packem_chunks/architecture-panel.mjs +1 -0
- package/dist/packem_chunks/auth-audit-panel.mjs +1 -0
- package/dist/packem_chunks/auth-config-panel.mjs +1 -0
- package/dist/packem_chunks/auth-sessions-panel.mjs +1 -0
- package/dist/packem_chunks/containers-panel.mjs +1 -0
- package/dist/packem_chunks/dashboards-panel.mjs +1 -0
- package/dist/packem_chunks/evals-panel.mjs +1 -0
- package/dist/packem_chunks/fanout-panel.mjs +1 -0
- package/dist/packem_chunks/flags-panel.mjs +1 -0
- package/dist/packem_chunks/issues-panel.mjs +1 -0
- package/dist/packem_chunks/kv-browser.mjs +1 -0
- package/dist/packem_chunks/log-drains-panel.mjs +4 -0
- package/dist/packem_chunks/migrations-route.mjs +1 -0
- package/dist/packem_chunks/organizations-panel.mjs +1 -0
- package/dist/packem_chunks/payments-panel.mjs +1 -0
- package/dist/packem_chunks/permissions-panel.mjs +1 -0
- package/dist/packem_chunks/privacy-requests-panel.mjs +1 -0
- package/dist/packem_chunks/queues-panel.mjs +1 -0
- package/dist/packem_chunks/reactors-panel.mjs +1 -0
- package/dist/packem_chunks/rls-panel.mjs +1 -0
- package/dist/packem_chunks/schedule-panel.mjs +1 -0
- package/dist/packem_chunks/sparkline.mjs +1 -0
- package/dist/packem_chunks/storage-rules-panel.mjs +1 -0
- package/dist/packem_chunks/subscriptions-panel.mjs +1 -0
- package/dist/packem_chunks/sync-client-panel.mjs +1 -0
- package/dist/packem_chunks/traces-panel.mjs +1 -0
- package/dist/packem_chunks/users-panel.mjs +1 -0
- package/dist/packem_chunks/vector-browser.mjs +1 -0
- package/dist/packem_chunks/workflows-panel.mjs +1 -0
- package/dist/packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs +1 -0
- package/dist/packem_shared/ApiDocsPanel-fhDlZGE4.mjs +2 -0
- package/dist/packem_shared/ApiReferencePanel-nAf8tNRr.mjs +1 -0
- package/dist/packem_shared/CommandPalette-D9ZY-qQd.mjs +1 -0
- package/dist/packem_shared/ConfirmButton-DU4p72Er.mjs +1 -0
- package/dist/packem_shared/ConnectionBadge-B8Hj5DaE.mjs +1 -0
- package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-DuULO4XM.mjs +1 -0
- package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-D5YMT0gM.mjs +1 -0
- package/dist/packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs +1 -0
- package/dist/packem_shared/DataBrowser-E68QfaST.mjs +4 -0
- package/dist/packem_shared/DataFilters-CYZFt2EK.mjs +1 -0
- package/dist/packem_shared/ErrorBoundary-BWNF98VF.mjs +1 -0
- package/dist/packem_shared/GlobalDataBrowser-DhObcZDY.mjs +1 -0
- package/dist/packem_shared/HomePanel-CUuYsApa.mjs +1 -0
- package/dist/packem_shared/MigrationsPanel-CkVIwAbK.mjs +1 -0
- package/dist/packem_shared/OpenRpcReferencePanel-BxEr49D9.mjs +1 -0
- package/dist/packem_shared/STUDIO_ROOT_CLASS-C6MccdVk.mjs +1 -0
- package/dist/packem_shared/ScheduledJobs-BZNcYWBP.mjs +1 -0
- package/dist/packem_shared/ShardInput-C6mjgAh4.mjs +1 -0
- package/dist/packem_shared/Studio-CZjQXFHC.mjs +1 -0
- package/dist/packem_shared/StudioApp-C9ENwcOH.mjs +1 -0
- package/dist/packem_shared/StudioI18nProvider-fVsCSs5L.mjs +1 -0
- package/dist/packem_shared/advisor-view-DzI2RQhY.mjs +1 -0
- package/dist/packem_shared/aggregateMetrics-DKFJc-o5.mjs +1 -0
- package/dist/packem_shared/alert-PB5W11MM.mjs +1 -0
- package/dist/packem_shared/app.d-D7vL0y8y.d.mts +349 -0
- package/dist/packem_shared/app.d-D7vL0y8y.d.ts +349 -0
- package/dist/packem_shared/auth-pager-DiDnXsfe.mjs +1 -0
- package/dist/packem_shared/badge-r_5B4LHP.mjs +1 -0
- package/dist/packem_shared/bar-chart-BCsEIQoQ.mjs +6 -0
- package/dist/packem_shared/browser-storage-BH1MxLZs.mjs +1 -0
- package/dist/packem_shared/button-q0UYSmrn.mjs +1 -0
- package/dist/packem_shared/card-By2O8ULa.mjs +1 -0
- package/dist/packem_shared/cf-links-CBJ5SywP.mjs +1 -0
- package/dist/packem_shared/checkbox-CnS9cyCz.mjs +1 -0
- package/dist/packem_shared/control-button-BOZ5K-FC.mjs +1 -0
- package/dist/packem_shared/data-grid-DIiNmDR9.mjs +1 -0
- package/dist/packem_shared/data-view-params-DhYmAkcj.mjs +1 -0
- package/dist/packem_shared/diagram-export-panel-D5CVNJkp.mjs +2 -0
- package/dist/packem_shared/dropdown-menu-jLZenfWH.mjs +2 -0
- package/dist/packem_shared/empty-state-D7jEML_T.mjs +1 -0
- package/dist/packem_shared/error-alert-DueSEkt-.mjs +1 -0
- package/dist/packem_shared/grid-features-OVIMIQan.mjs +6 -0
- package/dist/packem_shared/grid-pagination-DgzyzfBh.mjs +1 -0
- package/dist/packem_shared/home-panel-BcE8S2Nn.mjs +3 -0
- package/dist/packem_shared/input-CXhxesPC.mjs +1 -0
- package/dist/packem_shared/internal-Df43vQI0.mjs +2 -0
- package/dist/packem_shared/label-DKFzyHq6.mjs +1 -0
- package/dist/packem_shared/live-status-BuJdUZFU.mjs +1 -0
- package/dist/packem_shared/log-fields-BolUoZ9g.mjs +1 -0
- package/dist/packem_shared/log-line-CICyJ_kc.mjs +1 -0
- package/dist/packem_shared/metrics-format-1sNGG47R.mjs +1 -0
- package/dist/packem_shared/modal-shell-CDztwLnv.mjs +1 -0
- package/dist/packem_shared/operation-console-provider-DoloEvon.mjs +1 -0
- package/dist/packem_shared/recording-client-CyFiAE2l.mjs +1 -0
- package/dist/packem_shared/reference-view-CIHyURU6.mjs +13 -0
- package/dist/packem_shared/schema-diagram-C5oilX7l.mjs +2 -0
- package/dist/packem_shared/scroll-area-CXCQH7VT.mjs +2 -0
- package/dist/packem_shared/select-DPyS18Vy.mjs +2 -0
- package/dist/packem_shared/shard-history-CaO3C4KQ.mjs +1 -0
- package/dist/packem_shared/shortcuts-B9gDaXmw.mjs +1 -0
- package/dist/packem_shared/skeleton-DX1gfixl.mjs +1 -0
- package/dist/packem_shared/sparkline-B_sPPO_8.mjs +1 -0
- package/dist/packem_shared/sql-result-table-DyK762_A.mjs +1 -0
- package/dist/packem_shared/stat-card-BAv73QtB.mjs +1 -0
- package/dist/packem_shared/storage-tier-C2mKwYRj.mjs +1 -0
- package/dist/packem_shared/studio-fK2DTLde.mjs +2 -0
- package/dist/packem_shared/table-D0SBiDu-.mjs +2 -0
- package/dist/packem_shared/table-list-sidebar-DkPO_Qtz.mjs +1 -0
- package/dist/packem_shared/textarea--40GKAyz.mjs +1 -0
- package/dist/packem_shared/trace-handoff-BV3EWqy_.mjs +1 -0
- package/dist/packem_shared/use-admin-query-tlBof8Yg.mjs +1 -0
- package/dist/packem_shared/use-admin-spec-Bir7V68L.mjs +1 -0
- package/dist/packem_shared/use-async-submit-CZqCMTJ_.mjs +1 -0
- package/dist/packem_shared/use-auth-config-Z_n4ABCI.mjs +1 -0
- package/dist/packem_shared/use-mirrored-ref-CVDf2z1M.mjs +1 -0
- package/dist/packem_shared/use-open-trace-DMVhpnyG.mjs +1 -0
- package/dist/packem_shared/use-shard-key-BsP3o5wT.mjs +1 -0
- package/dist/packem_shared/use-sql-assistant-CZydTzd5.mjs +1 -0
- package/dist/packem_shared/useDebounced-DVeQ5-oW.mjs +1 -0
- package/dist/packem_shared/utils-bhneXptQ.mjs +1 -0
- package/dist/packem_shared/virtual-rect-D_j7aLxX.mjs +1 -0
- package/dist/standalone/chunk-253UHWDX.js +1 -0
- package/dist/standalone/chunk-2BXYYWFF.js +1 -0
- package/dist/standalone/chunk-2I4NHEKA.js +1 -0
- package/dist/standalone/chunk-2IKDEUCX.js +1 -0
- package/dist/standalone/chunk-2KCU3R63.js +1 -0
- package/dist/standalone/chunk-2MLBXX35.js +1 -0
- package/dist/standalone/chunk-2VA5S3IA.js +1 -0
- package/dist/standalone/chunk-37WYCOQ2.js +1 -0
- package/dist/standalone/chunk-3MUG4ZHJ.js +1 -0
- package/dist/standalone/chunk-3YXASVTP.js +1 -0
- package/dist/standalone/chunk-43KOF4CQ.js +1 -0
- package/dist/standalone/chunk-465XOUP7.js +1 -0
- package/dist/standalone/chunk-4OSK5JED.js +1 -0
- package/dist/standalone/chunk-4SONVRCI.js +1 -0
- package/dist/standalone/chunk-4VXO6PEW.js +1 -0
- package/dist/standalone/chunk-4WD4XGC3.js +1 -0
- package/dist/standalone/chunk-4ZEL6BYL.js +1 -0
- package/dist/standalone/chunk-53NRDRMS.js +1 -0
- package/dist/standalone/chunk-55UGUCQ6.js +1 -0
- package/dist/standalone/chunk-5B2RTXBS.js +1 -0
- package/dist/standalone/chunk-5QLHJ63L.js +14 -0
- package/dist/standalone/chunk-5QR2SQIS.js +1 -0
- package/dist/standalone/chunk-6HLARDYO.js +1 -0
- package/dist/standalone/chunk-6L2GY26N.js +9 -0
- package/dist/standalone/chunk-6QTAHSDD.js +1 -0
- package/dist/standalone/chunk-72K3I5WQ.js +1 -0
- package/dist/standalone/chunk-7G4Z6Q7X.js +1 -0
- package/dist/standalone/chunk-7QW4APH4.js +1 -0
- package/dist/standalone/chunk-7RKB5KS7.js +1 -0
- package/dist/standalone/chunk-7Y3SY37W.js +1 -0
- package/dist/standalone/chunk-APSLOGDM.js +1 -0
- package/dist/standalone/chunk-AUAECCXB.js +1 -0
- package/dist/standalone/{chunk-BJGBHGK3.js → chunk-AUGKHAMQ.js} +1 -1
- package/dist/standalone/chunk-B56FJPX3.js +1 -0
- package/dist/standalone/chunk-BOMPSVRC.js +1 -0
- package/dist/standalone/chunk-BTU2DO4W.js +1 -0
- package/dist/standalone/chunk-CCDX5RYT.js +1 -0
- package/dist/standalone/chunk-CGQMJYCW.js +1 -0
- package/dist/standalone/chunk-CSPLK3YB.js +1 -0
- package/dist/standalone/chunk-CSX53SBE.js +1 -0
- package/dist/standalone/chunk-CVXNHIQW.js +1 -0
- package/dist/standalone/chunk-D5V2I2AG.js +1 -0
- package/dist/standalone/chunk-DPTYTQR4.js +1 -0
- package/dist/standalone/chunk-E4PXACVL.js +3 -0
- package/dist/standalone/chunk-ECY2JC5F.js +1 -0
- package/dist/standalone/chunk-EHIBZBUU.js +1 -0
- package/dist/standalone/chunk-EOLEL3WN.js +15 -0
- package/dist/standalone/chunk-FECB2R4V.js +1 -0
- package/dist/standalone/chunk-FPI7AMQJ.js +1 -0
- package/dist/standalone/chunk-FUYEZFBP.js +1 -0
- package/dist/standalone/chunk-FWNCU5GC.js +8 -0
- package/dist/standalone/chunk-G74GIEU4.js +1 -0
- package/dist/standalone/chunk-G7SKQQMQ.js +1 -0
- package/dist/standalone/chunk-GHQ2VDI2.js +1 -0
- package/dist/standalone/chunk-GI2ASB4F.js +1 -0
- package/dist/standalone/chunk-GP4Y7JTA.js +1 -0
- package/dist/standalone/chunk-GUICDCZY.js +1 -0
- package/dist/standalone/chunk-GVHNP2GX.js +1 -0
- package/dist/standalone/chunk-HCTJKP5J.js +1 -0
- package/dist/standalone/chunk-HJHSQPHW.js +19 -0
- package/dist/standalone/chunk-I26MS5PJ.js +1 -0
- package/dist/standalone/chunk-IKA6U6M6.js +3 -0
- package/dist/standalone/chunk-IKF6SZS6.js +1 -0
- package/dist/standalone/chunk-IKMM2GHN.js +1 -0
- package/dist/standalone/chunk-IOKJXFIU.js +1 -0
- package/dist/standalone/chunk-IQHFRVZM.js +2 -0
- package/dist/standalone/chunk-IWZ7GVQO.js +1 -0
- package/dist/standalone/chunk-JPDDVVP6.js +5 -0
- package/dist/standalone/chunk-JQXA2OYK.js +1 -0
- package/dist/standalone/chunk-JX6TE3LZ.js +1 -0
- package/dist/standalone/chunk-JZGTSH2C.js +4 -0
- package/dist/standalone/chunk-LILVP4NU.js +1 -0
- package/dist/standalone/chunk-MAGV5WWM.js +1 -0
- package/dist/standalone/chunk-MHJKGEKR.js +1 -0
- package/dist/standalone/chunk-MVWZMWPD.js +1 -0
- package/dist/standalone/chunk-MZU5M2TO.js +1 -0
- package/dist/standalone/chunk-NCPW7WHO.js +1 -0
- package/dist/standalone/chunk-NDTQTKDX.js +6 -0
- package/dist/standalone/chunk-NGVP66OH.js +1 -0
- package/dist/standalone/chunk-NNSCCLU4.js +1 -0
- package/dist/standalone/chunk-NQZALRU3.js +1 -0
- package/dist/standalone/chunk-NRP22GKC.js +1 -0
- package/dist/standalone/chunk-NXQW5E6W.js +1 -0
- package/dist/standalone/chunk-OHMGKCDA.js +1 -0
- package/dist/standalone/chunk-OPM7ESDV.js +1 -0
- package/dist/standalone/chunk-OQ6I6OXT.js +2 -0
- package/dist/standalone/chunk-OSGXNEFA.js +1 -0
- package/dist/standalone/chunk-OYCUPD3Q.js +1 -0
- package/dist/standalone/chunk-PIMTWCRD.js +1 -0
- package/dist/standalone/chunk-PXBXNIM2.js +1 -0
- package/dist/standalone/chunk-Q6ED4KUL.js +1 -0
- package/dist/standalone/chunk-Q6IT6ZD7.js +1 -0
- package/dist/standalone/chunk-QAQDMS6R.js +1 -0
- package/dist/standalone/chunk-QJLHH3ET.js +1 -0
- package/dist/standalone/chunk-QSF3YY7X.js +59 -0
- package/dist/standalone/chunk-QXRMBK26.js +1 -0
- package/dist/standalone/chunk-R2TAO7Q4.js +1 -0
- package/dist/standalone/chunk-R6U22RSY.js +1 -0
- package/dist/standalone/chunk-RGMVGZV4.js +1 -0
- package/dist/standalone/chunk-RWVIV3U7.js +1 -0
- package/dist/standalone/chunk-S4Z7K55A.js +1 -0
- package/dist/standalone/chunk-SA2OGF3F.js +1 -0
- package/dist/standalone/chunk-SJQERRSZ.js +1 -0
- package/dist/standalone/chunk-SMIU5HX6.js +1 -0
- package/dist/standalone/chunk-SV764LKQ.js +1 -0
- package/dist/standalone/chunk-TGZBBSZG.js +1 -0
- package/dist/standalone/chunk-U6QBSDND.js +1 -0
- package/dist/standalone/chunk-UC7MNI2F.js +1 -0
- package/dist/standalone/chunk-UYEZR3BI.js +1 -0
- package/dist/standalone/chunk-VABBWB42.js +4 -0
- package/dist/standalone/chunk-VCFEO3RI.js +1 -0
- package/dist/standalone/chunk-VESGIGMQ.js +1 -0
- package/dist/standalone/chunk-VGL7ERWQ.js +15 -0
- package/dist/standalone/chunk-VXEC3UCO.js +1 -0
- package/dist/standalone/chunk-W36YKEUZ.js +1 -0
- package/dist/standalone/chunk-WCAUFFIX.js +1 -0
- package/dist/standalone/chunk-WJRYEML4.js +1 -0
- package/dist/standalone/chunk-WK5TYZAF.js +1 -0
- package/dist/standalone/chunk-WQMS7276.js +1 -0
- package/dist/standalone/chunk-WV4V42RT.js +1 -0
- package/dist/standalone/chunk-XDC2SWYS.js +1 -0
- package/dist/standalone/chunk-XGCIDUJF.js +1 -0
- package/dist/standalone/chunk-XHRKNCCI.js +1 -0
- package/dist/standalone/chunk-XYBZYLQL.js +1 -0
- package/dist/standalone/chunk-Y3AYVFTK.js +1 -0
- package/dist/standalone/chunk-Y4CGNYC5.js +1 -0
- package/dist/standalone/chunk-YC5NRN4O.js +1 -0
- package/dist/standalone/chunk-YVR4SEPU.js +1 -0
- package/dist/standalone/chunk-Z22BDS6N.js +1 -0
- package/dist/standalone/chunk-Z4XHXX73.js +1 -0
- package/dist/standalone/chunk-ZHLX75F6.js +3 -0
- package/dist/standalone/chunk-ZKJS6EBE.js +1 -0
- package/dist/standalone/chunk-ZLVANF7H.js +1 -0
- package/dist/standalone/studio.js +9 -214
- package/dist/styles.css +2 -2
- package/package.json +26 -21
- package/dist/index.js +0 -41
- package/dist/mount.js +0 -26
- package/dist/packem_chunks/ApiTab.js +0 -251
- package/dist/packem_chunks/AuditPanel.js +0 -200
- package/dist/packem_chunks/ExportImportPanel.js +0 -197
- package/dist/packem_chunks/FileBrowser.js +0 -2932
- package/dist/packem_chunks/FunctionRunner.js +0 -343
- package/dist/packem_chunks/FunctionStatsPanel.js +0 -375
- package/dist/packem_chunks/HealthPanel.js +0 -648
- package/dist/packem_chunks/InsightsPanel.js +0 -461
- package/dist/packem_chunks/LogsPanel.js +0 -827
- package/dist/packem_chunks/MailPanel.js +0 -440
- package/dist/packem_chunks/MetricsPanel.js +0 -1344
- package/dist/packem_chunks/MigrationsPanel.js +0 -239
- package/dist/packem_chunks/PitrPanel.js +0 -252
- package/dist/packem_chunks/SchemaViewer.js +0 -2512
- package/dist/packem_chunks/SecurityAdvisorPanel.js +0 -92
- package/dist/packem_chunks/SettingsPanel.js +0 -390
- package/dist/packem_chunks/SqlEditorPanel.js +0 -2322
- package/dist/packem_chunks/TableEditor.js +0 -313
- package/dist/packem_chunks/analytics-panel.js +0 -261
- package/dist/packem_chunks/auth-config-panel.js +0 -179
- package/dist/packem_chunks/auth-sessions-panel.js +0 -175
- package/dist/packem_chunks/containers-panel.js +0 -247
- package/dist/packem_chunks/dashboards-panel.js +0 -779
- package/dist/packem_chunks/fanout-panel.js +0 -481
- package/dist/packem_chunks/flags-panel.js +0 -176
- package/dist/packem_chunks/kv-browser.js +0 -1896
- package/dist/packem_chunks/log-drains-panel.js +0 -273
- package/dist/packem_chunks/organizations-panel.js +0 -670
- package/dist/packem_chunks/payments-panel.js +0 -185
- package/dist/packem_chunks/permissions-panel.js +0 -804
- package/dist/packem_chunks/queues-panel.js +0 -147
- package/dist/packem_chunks/rls-panel.js +0 -313
- package/dist/packem_chunks/schedule-panel.js +0 -831
- package/dist/packem_chunks/sparkline.js +0 -79
- package/dist/packem_chunks/storage-rules-panel.js +0 -138
- package/dist/packem_chunks/subscriptions-panel.js +0 -236
- package/dist/packem_chunks/users-panel.js +0 -1265
- package/dist/packem_chunks/vector-browser.js +0 -281
- package/dist/packem_chunks/workflows-panel.js +0 -562
- package/dist/packem_shared/ADMIN_FUNCTIONS-CdaxLGkE.js +0 -48
- package/dist/packem_shared/ApiDocsPanel-B6u_wnz-.js +0 -842
- package/dist/packem_shared/ApiReferencePanel-Drz4UO0a.js +0 -230
- package/dist/packem_shared/CommandPalette-B5BertvU.js +0 -373
- package/dist/packem_shared/ConfirmButton-C2eVi2Qv.js +0 -59
- package/dist/packem_shared/ConnectionBadge-B2DDM2Tn.js +0 -111
- package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-Vxwaxx51.js +0 -50
- package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-DjF0h-gA.js +0 -89
- package/dist/packem_shared/DEFAULT_LOCALE-CiX4W7Kr.js +0 -27
- package/dist/packem_shared/DataBrowser-ANTHLWWh.js +0 -4493
- package/dist/packem_shared/DataFilters-FNquMaiu.js +0 -249
- package/dist/packem_shared/ErrorBoundary-BzAApI7J.js +0 -66
- package/dist/packem_shared/GlobalDataBrowser-CjgTG_wa.js +0 -289
- package/dist/packem_shared/HomePanel-BRcQVDby.js +0 -14
- package/dist/packem_shared/OpenRpcReferencePanel-CspFdbUT.js +0 -192
- package/dist/packem_shared/STUDIO_ROOT_CLASS-D12gX2dV.js +0 -3
- package/dist/packem_shared/ScheduledJobs-BEJXtsBn.js +0 -262
- package/dist/packem_shared/ShardInput-gx_DZXXn.js +0 -107
- package/dist/packem_shared/Studio-B1V0GxTz.js +0 -16
- package/dist/packem_shared/StudioApp-CR0Tvy81.js +0 -657
- package/dist/packem_shared/StudioI18nProvider-B-tDCZIi.js +0 -48
- package/dist/packem_shared/advisor-view-DzqyvUU3.js +0 -159
- package/dist/packem_shared/aggregateMetrics-D4nUHEKU.js +0 -108
- package/dist/packem_shared/app.d-CNLRTrWw.d.ts +0 -300
- package/dist/packem_shared/badge-B2PKA1-5.js +0 -49
- package/dist/packem_shared/bar-chart-Bb__F5-u.js +0 -3245
- package/dist/packem_shared/browser-storage-d03UsV7v.js +0 -249
- package/dist/packem_shared/button-BhsN2uZH.js +0 -49
- package/dist/packem_shared/card-DURq3ElK.js +0 -175
- package/dist/packem_shared/cf-links-BZfRdxSE.js +0 -8
- package/dist/packem_shared/checkbox-UNkzAxl-.js +0 -63
- package/dist/packem_shared/data-grid-Dsg6nRjo.js +0 -183
- package/dist/packem_shared/data-view-params-Cd6yRVbv.js +0 -96
- package/dist/packem_shared/dropdown-menu-WY4B_eJO.js +0 -280
- package/dist/packem_shared/empty-state-DY_oe0k6.js +0 -98
- package/dist/packem_shared/grid-features-D7nNzBYm.js +0 -745
- package/dist/packem_shared/home-panel-CRIs6x2j.js +0 -1639
- package/dist/packem_shared/input-XH4r1Pt1.js +0 -53
- package/dist/packem_shared/internal-FcNZ3beb.js +0 -68
- package/dist/packem_shared/label-D8ykjn5J.js +0 -46
- package/dist/packem_shared/live-status-FZ0psC1z.js +0 -44
- package/dist/packem_shared/modal-shell-hyaJvIJ6.js +0 -100
- package/dist/packem_shared/reference-view-Doy1XlQq.js +0 -2140
- package/dist/packem_shared/select-UkNYCT3s.js +0 -273
- package/dist/packem_shared/shard-history-DyebH1R5.js +0 -38
- package/dist/packem_shared/skeleton-CGhL0p20.js +0 -45
- package/dist/packem_shared/sparkline-KgMPHS4u.js +0 -93
- package/dist/packem_shared/storage-tier-CL98eOvn.js +0 -85
- package/dist/packem_shared/studio-CQ-rtNhn.js +0 -4013
- package/dist/packem_shared/table-DsCa9Qp9.js +0 -246
- package/dist/packem_shared/table-list-sidebar-VMo0ftxD.js +0 -832
- package/dist/packem_shared/textarea-D3gaCU_-.js +0 -46
- package/dist/packem_shared/use-admin-query-BViPA3US.js +0 -105
- package/dist/packem_shared/use-auth-capabilities-BHkoBnbZ.js +0 -32
- package/dist/packem_shared/useDebounced-Dxncpg6z.js +0 -32
- package/dist/packem_shared/utils-B05Dmz_H.js +0 -8
- package/dist/packem_shared/virtual-rect-CVMUskSm.js +0 -10
- package/dist/standalone/chunk-2DS7JLWL.js +0 -13
- package/dist/standalone/chunk-2K47A3P6.js +0 -1
- package/dist/standalone/chunk-2NGUNNGW.js +0 -1
- package/dist/standalone/chunk-2PDQ4KZ6.js +0 -1
- package/dist/standalone/chunk-3BP4BTLR.js +0 -4
- package/dist/standalone/chunk-3OA7PECS.js +0 -6
- package/dist/standalone/chunk-45QK5ZPN.js +0 -1
- package/dist/standalone/chunk-4QHKBC77.js +0 -1
- package/dist/standalone/chunk-57LYXHXH.js +0 -1
- package/dist/standalone/chunk-5NSZVXCS.js +0 -1
- package/dist/standalone/chunk-5OIBXYZM.js +0 -1
- package/dist/standalone/chunk-63XKJQTQ.js +0 -1
- package/dist/standalone/chunk-6RC6L33K.js +0 -4
- package/dist/standalone/chunk-6VTGE3WJ.js +0 -1
- package/dist/standalone/chunk-7PBZKXYA.js +0 -1
- package/dist/standalone/chunk-7POIIWC5.js +0 -3
- package/dist/standalone/chunk-7RYIQKZA.js +0 -1
- package/dist/standalone/chunk-7TJJXVSE.js +0 -1
- package/dist/standalone/chunk-AB6QGMBF.js +0 -1
- package/dist/standalone/chunk-AHILM3ZP.js +0 -1
- package/dist/standalone/chunk-AQGOX5DK.js +0 -1
- package/dist/standalone/chunk-ASLGNHAX.js +0 -1
- package/dist/standalone/chunk-BHTPZS7L.js +0 -4
- package/dist/standalone/chunk-D6ORSB24.js +0 -1
- package/dist/standalone/chunk-DGWTR4G7.js +0 -1
- package/dist/standalone/chunk-DSX53PBM.js +0 -1
- package/dist/standalone/chunk-DV2MNASX.js +0 -1
- package/dist/standalone/chunk-DWDILV2E.js +0 -1
- package/dist/standalone/chunk-EGJX34WM.js +0 -1
- package/dist/standalone/chunk-FCR3HKFV.js +0 -1
- package/dist/standalone/chunk-FKO3HO6I.js +0 -4
- package/dist/standalone/chunk-FQKNJSRA.js +0 -76
- package/dist/standalone/chunk-G2TFEWEQ.js +0 -4
- package/dist/standalone/chunk-GTM65MVX.js +0 -1
- package/dist/standalone/chunk-GZXPPJVK.js +0 -1
- package/dist/standalone/chunk-HFBRE65A.js +0 -1
- package/dist/standalone/chunk-HG7Q5B3H.js +0 -1
- package/dist/standalone/chunk-HTQL7AXU.js +0 -1
- package/dist/standalone/chunk-HV7G6DFP.js +0 -5
- package/dist/standalone/chunk-ITLLHEVG.js +0 -1
- package/dist/standalone/chunk-J6J54MBP.js +0 -1
- package/dist/standalone/chunk-JSEXCW5Q.js +0 -1
- package/dist/standalone/chunk-KEGAWN6Y.js +0 -1
- package/dist/standalone/chunk-KG3QTFWE.js +0 -1
- package/dist/standalone/chunk-KGS7KM4A.js +0 -2
- package/dist/standalone/chunk-KNRVPCFX.js +0 -1
- package/dist/standalone/chunk-KODWGUAB.js +0 -1
- package/dist/standalone/chunk-KZ6INM5M.js +0 -1
- package/dist/standalone/chunk-LZWPCZLE.js +0 -1
- package/dist/standalone/chunk-N2QDG3MW.js +0 -1
- package/dist/standalone/chunk-N4JI6VQD.js +0 -1
- package/dist/standalone/chunk-NNISYDNI.js +0 -1
- package/dist/standalone/chunk-O4PXDNR3.js +0 -1
- package/dist/standalone/chunk-O77VNUFD.js +0 -1
- package/dist/standalone/chunk-OD2POGPJ.js +0 -1
- package/dist/standalone/chunk-OXCK3ZUG.js +0 -1
- package/dist/standalone/chunk-P7DSVO4U.js +0 -1
- package/dist/standalone/chunk-PKAM3N5C.js +0 -1
- package/dist/standalone/chunk-QGXGBHQO.js +0 -1
- package/dist/standalone/chunk-QHA3TAEJ.js +0 -1
- package/dist/standalone/chunk-QQWC62X7.js +0 -1
- package/dist/standalone/chunk-RMYA7NAH.js +0 -1
- package/dist/standalone/chunk-RRCPZMC2.js +0 -22
- package/dist/standalone/chunk-S53RUBW5.js +0 -1
- package/dist/standalone/chunk-SB4GT6PK.js +0 -1
- package/dist/standalone/chunk-SEU5V7I6.js +0 -1
- package/dist/standalone/chunk-SHIOUDOT.js +0 -1
- package/dist/standalone/chunk-SIDRSX7Y.js +0 -1
- package/dist/standalone/chunk-SVR644RF.js +0 -1
- package/dist/standalone/chunk-TAD43CG5.js +0 -1
- package/dist/standalone/chunk-TBMYIZIO.js +0 -1
- package/dist/standalone/chunk-TICVNLPM.js +0 -1
- package/dist/standalone/chunk-TQ36RWOP.js +0 -1
- package/dist/standalone/chunk-UGMRUEBU.js +0 -1
- package/dist/standalone/chunk-UII66UVF.js +0 -1
- package/dist/standalone/chunk-VJPQUBN6.js +0 -8
- package/dist/standalone/chunk-VLXV72QE.js +0 -1
- package/dist/standalone/chunk-VMJKJWG6.js +0 -1
- package/dist/standalone/chunk-VPDPN5RR.js +0 -2
- package/dist/standalone/chunk-VSEGZA3J.js +0 -1
- package/dist/standalone/chunk-VXBZQIGY.js +0 -4
- package/dist/standalone/chunk-W5LWN6IP.js +0 -1
- package/dist/standalone/chunk-W7PCVQTE.js +0 -1
- package/dist/standalone/chunk-W7SQVLBH.js +0 -1
- package/dist/standalone/chunk-XLILSHPE.js +0 -1
- package/dist/standalone/chunk-XURNGQSS.js +0 -1
- package/dist/standalone/chunk-YJGANMU7.js +0 -18
- package/dist/standalone/chunk-YQQJ4N6U.js +0 -1
- package/dist/standalone/chunk-ZH7UES4T.js +0 -2
- package/dist/standalone/chunk-ZPUO7FNI.js +0 -1
- package/dist/standalone/chunk-ZQCVDXDL.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as ut,b as he,c as Xe,d as Ke,e as pt,f as cr}from"./chunk-NRP22GKC.js";import{a as sr,b as ir,c as lr,d as ar}from"./chunk-OPM7ESDV.js";import{B as Do,C as _o,E as Uo,F as ko,G as Fo,J as Ho,X as Bo,a as Eo,aa as jo,ba as zo,e as wo,ea as Wo,fa as Go,la as Yo,ma as $o,na as Xo,o as Tt,oa as Ko,qa as Jo,r as Oo,ra as Zo,sa as Qo,ta as er,u as Lo}from"./chunk-NXQW5E6W.js";import{a as Po,b as qo}from"./chunk-UC7MNI2F.js";import{a as Mo,b as Vo}from"./chunk-NGVP66OH.js";import{a as tr,b as or,i as rr,j as nr,k as ct}from"./chunk-GHQ2VDI2.js";import{a as Et,b as qe,c as So,d as ho,e as wt,f as Co,h as No}from"./chunk-E4PXACVL.js";import{A as Io,D as Ye,F as Ao,I as Ve,J as $e,K as $t,L as To,M as oe,N as ce,b as xo,c as Ro,e as At,l as Me,n as Yt,o as bo,p as yo,q as Nt,r as vo}from"./chunk-MVWZMWPD.js";import{c as Pt}from"./chunk-3YXASVTP.js";import{a as te,c as Ie,e as Ct,w as at}from"./chunk-AUAECCXB.js";import{a as it,c as ve,d as mo,e as go,g as lt,h as qt,i as It,j as w}from"./chunk-BOMPSVRC.js";import{a as o,c as hn,d as b,e as O,f as Rn,g as xe,i as He}from"./chunk-I26MS5PJ.js";var St=b(Rn(),1);var re={};hn(re,{Arrow:()=>Jr,Backdrop:()=>Ur,Group:()=>an,GroupLabel:()=>un,Icon:()=>Vr,Item:()=>qr,ItemIndicator:()=>$r,ItemText:()=>Xr,Label:()=>Cr,List:()=>Wr,Popup:()=>jr,Portal:()=>Dr,Positioner:()=>kr,Root:()=>vr,ScrollDownArrow:()=>tn,ScrollUpArrow:()=>nn,Separator:()=>dn,Trigger:()=>Nr,Value:()=>Pr});var U=b(O(),1);var ur=b(O(),1);function pr(e){let t=ur.useRef(!0);t.current&&(t.current=!1,e())}o(pr,"useOnFirstRender");var Oe=b(O(),1);var Xt=Oe.createContext(void 0),Kt=Oe.createContext(void 0),Jt=Oe.createContext(void 0);function L(){let e=Oe.useContext(Xt);if(e===void 0)throw new Error(ve(60));return e}o(L,"useSelectRootContext");function Le(){let e=Oe.useContext(Kt);if(e===void 0)throw new Error(ve(101));return e}o(Le,"useSelectRootPropsContext");function Mt(){let e=Oe.useContext(Jt);if(e===void 0)throw new Error(ve(61));return e}o(Mt,"useSelectFloatingContext");function fr(e,t,r=Object.is){let{length:n}=e;if(n!==t.length)return!1;for(let s=0;s<n;s+=1)if(!r(e[s],t[s]))return!1;return!0}o(fr,"areArraysEqual");var Qt=o((e,t)=>Object.is(e,t),"defaultItemEquality");function Ce(e,t,r){return e==null||t==null?Object.is(e,t):r(e,t)}o(Ce,"compareItemEquality");function dr(e,t,r){return Array.isArray(e)&&Array.isArray(t)?!fr(e,t,(n,s)=>Ce(n,s,r)):e!==t}o(dr,"isSelectedValueDirty");function Zt(e,t,r){return e?e.some(n=>n===void 0?!1:Ce(t,n,r)):!1}o(Zt,"selectedValueIncludes");function ft(e,t,r){return e?e.findIndex(n=>n===void 0?!1:Ce(n,t,r)):-1}o(ft,"findItemIndex");function bn(e,t){if(t!==Qt)return n=>Zt(e,n,t);let r=new Set(e);return r.delete(void 0),n=>r.has(n)&&(n!==0||e.some(s=>Object.is(n,s)))}o(bn,"createSelectionMatcher");function eo(e,t,r,n){let s=n&&Array.isArray(t)?e.findIndex(bn(t,r)):ft(e,t,r);return s===-1?null:s}o(eo,"findSelectionIndex");function mr(e,t,r,n,s,a){return Zt(n,t,s)?a!=null&&e>a&&Zt(n,r[a],s)?a:e:e===a?eo(r,n,s,!0):a}o(mr,"resolveSelectedIndex");function gr(e,t,r){return e.filter(n=>!Ce(t,n,r))}o(gr,"removeItem");var Sr=b(O(),1);function Vt(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}o(Vt,"serializeValue");var xr=b(xe(),1);function yn(e){return typeof e=="object"&&e!=null&&Array.isArray(e.items)}o(yn,"isGroup");function hr(e){return yn(e?.[0])}o(hr,"isGroupedItems");function vn(e){return hr(e)?e.flatMap(t=>t.items):e}o(vn,"flattenLeafItems");function Rr(e){if(!Array.isArray(e))return e!=null&&"null"in e;let t=e;if(hr(t)){for(let r of t)for(let n of r.items)if(n&&n.value==null&&n.label!=null)return!0;return!1}for(let r of t)if(r&&r.value==null&&r.label!=null)return!0;return!1}o(Rr,"hasNullItemLabel");function to(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return Vt(e)}o(to,"stringifyAsLabel");function De(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Vt(e.value):Vt(e)}o(De,"stringifyAsValue");function oo(e,t,r){function n(){return to(e,r)}if(o(n,"fallback"),r&&e!=null)return r(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??n();if(Array.isArray(t)){let a=vn(t);if(e==null||typeof e!="object"){let i=a.find(u=>u.value===e);return i&&i.label!=null?i.label:n()}if("value"in e){let i=a.find(u=>u&&u.value===e.value);if(i&&i.label!=null)return i.label}}return n()}o(oo,"resolveSelectedLabel");function br(e,t,r){return e.reduce((n,s,a)=>(a>0&&n.push(", "),n.push((0,xr.jsx)(Sr.Fragment,{children:oo(s,t,r)},a)),n),[])}o(br,"resolveMultipleLabels");var yr={id:o(e=>e.id,"id"),labelId:o(e=>e.labelId,"labelId"),modal:o(e=>e.modal,"modal"),items:o(e=>e.items,"items"),itemToStringLabel:o(e=>e.itemToStringLabel,"itemToStringLabel"),isItemEqualToValue:o(e=>e.isItemEqualToValue,"isItemEqualToValue"),value:o(e=>e.value,"value"),hasSelectedValue:o(e=>{let{value:t,multiple:r,itemToStringValue:n}=e;return t==null?!1:r&&Array.isArray(t)?t.length>0:De(t,n)!==""},"hasSelectedValue"),hasNullItemLabel:o((e,t)=>t?Rr(e.items):!1,"hasNullItemLabel"),open:o(e=>e.open,"open"),mounted:o(e=>e.mounted,"mounted"),forceMount:o(e=>e.forceMount,"forceMount"),transitionStatus:o(e=>e.transitionStatus,"transitionStatus"),openMethod:o(e=>e.openMethod,"openMethod"),activeIndex:o(e=>e.activeIndex,"activeIndex"),selectedIndex:o(e=>e.selectedIndex,"selectedIndex"),isActive:o((e,t)=>e.activeIndex===t,"isActive"),isSelected:o((e,t)=>{let r=e.isItemEqualToValue,n=e.value;return e.multiple?Array.isArray(n)&&n.some(s=>Ce(t,s,r)):Ce(t,n,r)},"isSelected"),isSelectedByFocus:o((e,t)=>e.selectedIndex===t,"isSelectedByFocus"),popupProps:o(e=>e.popupProps,"popupProps"),triggerProps:o(e=>e.triggerProps,"triggerProps"),triggerElement:o(e=>e.triggerElement,"triggerElement"),positionerElement:o(e=>e.positionerElement,"positionerElement"),listElement:o(e=>e.listElement,"listElement"),popupSide:o(e=>e.popupSide,"popupSide"),scrollUpArrowVisible:o(e=>e.scrollUpArrowVisible,"scrollUpArrowVisible"),scrollDownArrowVisible:o(e=>e.scrollDownArrowVisible,"scrollDownArrowVisible"),hasScrollArrows:o(e=>e.hasScrollArrows,"hasScrollArrows")};var Be=b(xe(),1);function vr(e){let{id:t,value:r,defaultValue:n=null,onValueChange:s,open:a,defaultOpen:i=!1,onOpenChange:u,name:l,form:m,autoComplete:p,disabled:h=!1,readOnly:y=!1,required:d=!1,modal:N=!0,actionsRef:v,inputRef:H,onOpenChangeComplete:S,items:j,multiple:I=!1,itemToStringLabel:g,itemToStringValue:C,isItemEqualToValue:M=Qt,highlightItemOnHover:T=!0,children:k}=e,{clearErrors:Q}=So(),{setDirty:$,setTouched:W,setFocused:X,validityData:c,setFilled:z,name:q,disabled:ie,validation:G,validationMode:le}=qe(),F=wt({id:t}),f=ie||h,E=q??l,[R,x]=$t({controlled:r,default:I?n??qt:n,name:"Select",state:"value"}),[P,K]=$t({controlled:a,default:i,name:"Select",state:"open"}),ne=U.useRef([]),J=U.useRef([]),ue=U.useRef(null),Se=U.useRef(null),ee=U.useRef(0),pe=U.useRef(null),V=U.useRef([]),D=U.useRef(!1),ae=U.useRef(null),Z=U.useRef(null),Ue=U.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),Ae=U.useRef(!1),Ne=U.useRef(R),{mounted:fe,setMounted:ke,transitionStatus:Te}=$e(P),{openMethod:se,triggerProps:xt}=Wo(P),_=mo(()=>new Fo({id:F,labelId:void 0,modal:N,multiple:I,itemToStringLabel:g,itemToStringValue:C,isItemEqualToValue:M,value:R,open:P,mounted:fe,transitionStatus:Te,items:j,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:It,triggerProps:It,triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:lt,setOpen:lt,handleScrollArrowVisibility:lt,onOpenChangeComplete:lt,listRef:ne,popupRef:ue,scrollHandlerRef:Se,scrollArrowsMountedCountRef:ee,valueRef:pe,valuesRef:V,labelsRef:J,typingRef:D,selectionRef:Ue,firstItemTextRef:ae,selectedItemTextRef:Z,alignItemWithTriggerActiveRef:Ae,initialValueRef:Ne},yr)).current,be=_.useState("activeIndex"),ht=_.useState("selectedIndex"),Rt=_.useState("triggerElement"),ye=_.useState("positionerElement"),bt=er(se),yt=se??bt,ze=U.useMemo(()=>I?"":De(R,C),[I,R,C]),Ee=U.useMemo(()=>I&&Array.isArray(R)?R.map(A=>De(A,C)):De(R,C),[I,R,C]),Bt=Tt(Rt),tt=Ie(()=>Ee);No(Bt,F,R,tt,!f,l);let ot=I?Array.isArray(R)&&R.length>0:R!=null&&ze!=="";te(()=>{z(ot)},[ot,z]),te(o(function(){let Y=eo(V.current,R,M,I);Y===null&&(Z.current=null),!P&&_.set("selectedIndex",Y)},"syncSelectedIndex"),[I,P,R,M,_]),To(R,()=>{Q(E),$(dr(R,c.initialValue,M)),G.change(R)});let rt=Ie((A,Y)=>{u?.(A,Y),!Y.isCanceled&&(K(A),!A&&(Y.reason===oe.focusOut||Y.reason===oe.outsidePress)&&(W(!0),X(!1),le==="onBlur"&&G.commit(R)))}),We=Ie(()=>{ke(!1),_.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),S?.(!1)});Ve({enabled:!v,open:P,ref:ue,onComplete(){P||We()}}),U.useImperativeHandle(v,()=>({unmount:We}),[We]);let nt=Ie((A,Y)=>{s?.(A,Y),!Y.isCanceled&&x(A)}),jt=Ie(A=>{let Y=Xe(A.scrollHeight,A.clientHeight),vt=Ke(A.scrollTop,Y),zt=vt>0,st=vt<Y;_.set("scrollUpArrowVisible",zt),_.set("scrollDownArrowVisible",st)}),Fe=Bo({open:P,onOpenChange:rt,elements:{reference:Rt,floating:ye}}),de=_o(Fe,{enabled:!f,event:"mousedown"}),we=Uo(Fe),Pe=jo(Fe,{enabled:!f,listRef:ne,activeIndex:be,selectedIndex:ht,disabledIndices:qt,onNavigate(A){A===null&&!P||_.set("activeIndex",A)},focusItemOnHover:T}),Ge=zo(Fe,{enabled:!f&&(P||!y&&!I),listRef:J,activeIndex:be,selectedIndex:ht,disabledIndices:o(A=>ar(ne.current[A]),"disabledIndices"),onMatch(A){P?_.set("activeIndex",A):nt(V.current[A],ce(oe.none))},onTyping(A){D.current=A}}),lo=U.useMemo(()=>it(Ge.reference,Pe.reference,we.reference,de.reference,xt),[de.reference,Ge.reference,Pe.reference,we.reference,xt]),ao=U.useMemo(()=>it(Ho,Ge.floating,Pe.floating,we.floating),[Ge.floating,Pe.floating,we.floating]),co=Pe.item??It;_.useContextCallback("setValue",nt),_.useContextCallback("setOpen",rt),_.useContextCallback("handleScrollArrowVisibility",jt),_.useContextCallback("onOpenChangeComplete",S),pr(()=>{_.update({popupProps:ao,triggerProps:lo})}),_.useSyncedValues({id:F,modal:N,multiple:I,value:R,open:P,mounted:fe,transitionStatus:Te,popupProps:ao,triggerProps:lo,items:j,itemToStringLabel:g,itemToStringValue:C,isItemEqualToValue:M,openMethod:yt});let mn=U.useMemo(()=>({disabled:f,readOnly:y,required:d,multiple:I,highlightItemOnHover:T,itemProps:co}),[f,y,d,I,T,co]),gn=go(H,G.inputRef),uo=I?void 0:E,Sn=U.useMemo(()=>!I||!Array.isArray(R)||!E?null:R.map(A=>{let Y=De(A,C);return(0,Be.jsx)("input",{type:"hidden",form:m,name:E,value:Y,disabled:f},Y)}),[I,R,m,E,C,f]);return(0,Be.jsxs)(Xt.Provider,{value:_,children:[(0,Be.jsx)(Kt.Provider,{value:mn,children:(0,Be.jsx)(Jt.Provider,{value:Fe,children:k})}),(0,Be.jsx)("input",{...G.getValidationProps(f,{onFocus(){_.state.triggerElement?.focus({focusVisible:!0})},onChange(A){if(A.nativeEvent.defaultPrevented||f||y)return;let Y=A.currentTarget.value,vt=ce(oe.none,A.nativeEvent);function zt(){if(I)return;let st=Y.toLowerCase(),Wt=V.current.findIndex(Gt=>De(Gt,C).toLowerCase()===st||to(Gt,g).toLowerCase()===st);Wt===-1&&(Wt=V.current.findIndex((Gt,xn)=>{let fo=J.current[xn];return fo!=null&&fo.toLowerCase()===st}));let po=V.current[Wt];po!=null&&nt(po,vt)}o(zt,"handleChange"),_.set("forceMount",!0),queueMicrotask(zt)}}),id:F&&uo==null?`${F}-hidden-input`:void 0,form:m,name:uo,autoComplete:p,value:ze,disabled:f,required:d&&!(I&&ot),readOnly:y,ref:gn,style:E?Vo:Mo,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Sn]})}o(vr,"SelectRoot");var wr=b(O(),1);function Ir(e){return e==null?void 0:`${e}-label`}o(Ir,"getDefaultLabelId");function Er(e,t){return e??t}o(Er,"resolveAriaLabelledBy");var Cr=wr.forwardRef(o(function(t,r){let{render:n,className:s,style:a,...i}=t,u=i;delete u.id;let l=qe(),m=L(),p=m.useState("triggerElement"),h=m.useState("id"),y=Ir(h),d=Co({id:y,fallbackControlId:p?.id??h,setLabelId(N){let v=typeof N=="function"?N(m.state.labelId):N;m.set("labelId",v)}});return w("div",t,{ref:r,state:l.state,props:[d,i],stateAttributesMapping:Et})},"SelectLabel"));var Je=b(O(),1);var Gs=Yt.popupOpen,qs=Yt.pressed;var Ar="data-popup-side";var En=400,wn={...yo,...Et,popupSide:o(e=>e?{[Ar]:e}:null,"popupSide"),value:o(()=>null,"value")},Nr=Je.forwardRef(o(function(t,r){let{render:n,className:s,id:a,disabled:i=!1,nativeButton:u=!0,style:l,...m}=t,{setTouched:p,setFocused:h,validationMode:y,validation:d,state:N,disabled:v}=qe(),{labelId:H}=ho(),S=L(),{readOnly:j,required:I,disabled:g}=Le(),C=v||g||i,M=S.useState("open"),T=S.useState("mounted"),k=S.useState("value"),Q=S.useState("triggerProps"),$=S.useState("positionerElement"),W=S.useState("listElement"),X=S.useState("popupSide"),c=S.useState("id"),z=S.useState("labelId"),q=S.useState("hasSelectedValue"),ie=T&&$?X:null,G=a??c,le=Er(H,z);wt({id:a});let F=Tt($),f=Je.useRef(null),{getButtonProps:E,buttonRef:R}=Pt({disabled:C,native:u}),x=S.useStateSetter("triggerElement"),P=Ye(),K=Ye(),ne=Ye();Je.useEffect(()=>{if(M)return ne.start(En,()=>{S.context.selectionRef.current.allowUnselectedMouseUp=!0,S.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{ne.clear()};S.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},K.clear()},[M,S,K,ne]);let J=it(Q,{id:G,role:"combobox","aria-expanded":M,"aria-haspopup":"listbox","aria-controls":M?W?.id??Io($)?.id:void 0,"aria-labelledby":le,"aria-readonly":j||void 0,"aria-required":I||void 0,tabIndex:C?-1:0,onFocus(ee){h(!0),M&&S.context.alignItemWithTriggerActiveRef.current&&S.context.setOpen(!1,ce(oe.none,ee.nativeEvent)),P.start(0,()=>{S.set("forceMount",!0)})},onBlur(ee){At($,ee.relatedTarget)||(p(!0),h(!1),y==="onBlur"&&d.commit(k))},onMouseDown(ee){if(M)return;let pe=at(ee.currentTarget);function V(D){if(!f.current)return;let ae=D.target;At(f.current,ae)||At(F.current,ae)||lr(D,f.current)||S.context.setOpen(!1,ce(oe.cancelOpen,D))}o(V,"handleMouseUp"),K.start(0,()=>{pe.addEventListener("mouseup",V,{once:!0})})}},m,E),ue=d.getValidationProps(C,J);ue.role="combobox";let Se={...N,open:M,disabled:C,value:k,readOnly:j,popupSide:ie,placeholder:!q};return w("button",t,{ref:[r,f,R,x],state:Se,stateAttributesMapping:wn,props:ue})},"SelectTrigger"));var Tr=b(O(),1);var Cn={value:o(()=>null,"value")},Pr=Tr.forwardRef(o(function(t,r){let{className:n,render:s,children:a,placeholder:i,style:u,...l}=t,m=L(),p=m.useState("value"),h=m.useState("items"),y=m.useState("itemToStringLabel"),d=m.useState("hasSelectedValue"),N=!d&&i!=null&&a==null,v=m.useState("hasNullItemLabel",N),H={value:p,placeholder:!d},S=null;return typeof a=="function"?S=a(p):a!=null?S=a:N&&!v?S=i:Array.isArray(p)?S=br(p,h,y):S=oo(p,h,y),w("span",t,{state:H,ref:[r,m.context.valueRef],props:[{children:S},l],stateAttributesMapping:Cn})},"SelectValue"));var Mr=b(O(),1);var Vr=Mr.forwardRef(o(function(t,r){let{render:n,className:s,style:a,...i}=t,m={open:L().useState("open")};return w("span",t,{state:m,ref:r,props:[{"aria-hidden":!0,children:"\u25BC"},i],stateAttributesMapping:bo})},"SelectIcon"));var Or=b(O(),1);var Lr=b(xe(),1);var Dr=Or.forwardRef(o(function(t,r){let n=L(),s=n.useState("mounted"),a=n.useState("forceMount");return s||a?(0,Lr.jsx)(Lo,{ref:r,...t}):null},"SelectPortal"));var _r=b(O(),1);var An={...Nt,...Me},Ur=_r.forwardRef(o(function(t,r){let{render:n,className:s,style:a,...i}=t,u=L(),l=u.useState("open"),m=u.useState("mounted"),p=u.useState("transitionStatus");return w("div",t,{state:{open:l,transitionStatus:p},ref:r,props:[{role:"presentation",hidden:!m,style:{userSelect:"none",WebkitUserSelect:"none"}},i],stateAttributesMapping:An})},"SelectBackdrop"));var me=b(O(),1);var Ot=b(O(),1);var ro=Ot.createContext(void 0);function _e(){let e=Ot.useContext(ro);if(!e)throw new Error(ve(59));return e}o(_e,"useSelectPositionerContext");function Ze(e,t){e&&Object.assign(e.style,t)}o(Ze,"clearStyles");var Lt={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"};var dt=b(xe(),1);var Nn={position:"fixed"},kr=me.forwardRef(o(function(t,r){let{anchor:n,className:s,render:a,positionMethod:i,side:u,align:l,sideOffset:m,alignOffset:p,collisionBoundary:h="clipping-ancestors",collisionPadding:y,arrowPadding:d,sticky:N,disableAnchorTracking:v,alignItemWithTrigger:H=!0,collisionAvoidance:S=Oo,style:j,...I}=t,g=L(),C=Mt(),M=g.useState("open"),T=g.useState("mounted"),k=g.useState("modal"),Q=g.useState("value"),$=g.useState("openMethod"),W=g.useState("positionerElement"),X=g.useState("triggerElement"),c=g.useState("isItemEqualToValue"),z=g.useState("transitionStatus"),q=me.useRef(null),ie=me.useRef(null),[G,le]=me.useState(H),F=T&&G&&$!=="touch";!T&&G!==H&&le(H),me.useImperativeHandle(g.context.alignItemWithTriggerActiveRef,()=>F),Jo((F||k)&&M,$==="touch",W,X);let f=Yo({anchor:n,floatingRootContext:C,positionMethod:i,mounted:T,side:u,sideOffset:m,align:l,alignOffset:p,arrowPadding:d,collisionBoundary:h,collisionPadding:y,sticky:N,disableAnchorTracking:v??F,collisionAvoidance:S,keepMounted:!0}),E=F?"none":f.side,R=F?Nn:f.positionerStyles,x={open:M,side:E,align:f.align,anchorHidden:f.anchorHidden};te(()=>{g.set("popupSide",f.side)},[g,f.side]);let P=g.useStateSetter("positionerElement"),K=Ko(t,x,{styles:R,transitionStatus:z,props:I,refs:[r,P],hidden:!T,inert:!M}),ne=me.useRef(0),J=Ie(Se=>{if(g.context.valuesRef.current.length===0)return;let ee=ne.current;ne.current=Se.size;let pe=ce(oe.none);if(ee!==0&&!g.state.multiple&&Q!==null&&ft(g.context.valuesRef.current,Q,c)===-1){let D=g.context.initialValueRef.current,Z=D!=null&&ft(g.context.valuesRef.current,D,c)!==-1?D:null;g.context.setValue(Z,pe),Z===null&&(g.set("selectedIndex",null),g.context.selectedItemTextRef.current=null)}if(ee!==0&&g.state.multiple&&Array.isArray(Q)){let V=Q.filter(D=>ft(g.context.valuesRef.current,D,c)!==-1);V.length!==Q.length&&(g.context.setValue(V,pe),V.length===0&&(g.set("selectedIndex",null),g.context.selectedItemTextRef.current=null))}if(M&&F){g.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let V={height:""};Ze(W,V),Ze(g.context.popupRef.current,V)}}),ue=me.useMemo(()=>({...f,side:E,alignItemWithTriggerActive:F,setControlledAlignItemWithTrigger:le,scrollUpArrowRef:q,scrollDownArrowRef:ie}),[f,E,F,le]);return(0,dt.jsx)(ir,{elementsRef:g.context.listRef,labelsRef:g.context.labelsRef,onMapChange:J,children:(0,dt.jsxs)(ro.Provider,{value:ue,children:[T&&k&&(0,dt.jsx)($o,{inert:Go(!M),cutout:X}),K]})})},"SelectPositioner"));var ge=b(O(),1);var no="--transform-origin";var Ut=b(xe(),1);var Pn={...Nt,...Me},jr=ge.forwardRef(o(function(t,r){let{render:n,className:s,style:a,finalFocus:i,...u}=t,l=L(),{multiple:m,readOnly:p,highlightItemOnHover:h}=Le(),y=Mt(),{side:d,align:N,alignItemWithTriggerActive:v,isPositioned:H,setControlledAlignItemWithTrigger:S}=_e(),j=Qo(!0)!=null,I=qo(),{nonce:g,disableStyleElements:C}=cr(),M=l.useState("id"),T=l.useState("open"),k=l.useState("openMethod"),Q=l.useState("mounted"),$=l.useState("popupProps"),W=l.useState("transitionStatus"),X=l.useState("triggerElement"),c=l.useState("positionerElement"),z=l.useState("listElement"),q=ge.useRef(!1),ie=ge.useRef(!1),G=ge.useRef({}),le=Ao(),F=Ie(x=>{if(!c||!l.context.popupRef.current||!ie.current)return;let P=c.style.top==="0px",K=c.style.bottom==="0px";if(q.current||!v||!P&&!K){l.context.handleScrollArrowVisibility(x);return}let ne=Hr(c),J=mt(c.getBoundingClientRect().height,"y",ne),ue=at(c),Se=Ct(c),ee=Se.getComputedStyle(c),pe=parseFloat(ee.marginTop),V=parseFloat(ee.marginBottom),D=Fr(Se.getComputedStyle(l.context.popupRef.current)),ae=Math.min(ue.documentElement.clientHeight-pe-V,D),Z=x.scrollTop,Ue=Dt(x),Ae=null,Ne=o(se=>{c.style.height=`${se}px`},"setHeight"),fe=P?Ue-Z:Z,ke=Math.min(J+fe,ae);if(fe<=he){let se=ut(fe,0,ae-J);se>0&&Ne(J+se),x.scrollTop=P?Ue:0,ae-(J+se)<=he&&(q.current=!0),l.context.handleScrollArrowVisibility(x);return}if(ae-ke>he)Ae=P?1/0:0;else if(K&&Z<Ue){let se=J+fe-ae;Ae=Z-(fe-se)}let Te=Math.ceil(ke);if(Te!==0&&Ne(Te),Ae!=null){let se=ut(Ae,0,Dt(x));Math.abs(x.scrollTop-se)>he&&(x.scrollTop=se)}Te>=ae-he&&(q.current=!0),l.context.handleScrollArrowVisibility(x)});ge.useImperativeHandle(l.context.scrollHandlerRef,()=>F,[F]),Ve({open:T,ref:l.context.popupRef,onComplete(){T&&l.context.onOpenChangeComplete(!0)}});let f={open:T,transitionStatus:W,side:d,align:N};te(()=>{!c||!l.context.popupRef.current||Object.keys(G.current).length||(G.current={top:c.style.top||"0",left:c.style.left||"0",right:c.style.right,height:c.style.height,bottom:c.style.bottom,minHeight:c.style.minHeight,maxHeight:c.style.maxHeight,marginTop:c.style.marginTop,marginBottom:c.style.marginBottom})},[l,c]),te(()=>{T||v||(ie.current=!1,q.current=!1,Ze(c,G.current))},[T,v,c]),te(()=>{let x=l.context.popupRef.current;if(!T||!X||!c||!x||v&&!H||l.state.transitionStatus==="ending")return;if(ie.current=!0,x.style.removeProperty(no),!v){le.request(()=>l.context.handleScrollArrowVisibility(z||x));return}let P=Mn(x);try{let K=l.context.selectedItemTextRef.current;K?.isConnected||(K=!l.select("hasSelectedValue")&&l.context.firstItemTextRef.current?.isConnected?l.context.firstItemTextRef.current:null);let ne=l.context.valueRef.current,J=Ct(c),ue=J.getComputedStyle(c),Se=J.getComputedStyle(x),ee=at(X),pe=Hr(X),V=_t(X.getBoundingClientRect(),pe),D=_t(c.getBoundingClientRect(),pe),ae=V.height,Z=z||x,Ue=Z.scrollHeight,Ae=parseFloat(Se.borderBottomWidth),Ne=parseFloat(ue.marginTop)||10,fe=parseFloat(ue.marginBottom)||10,ke=parseFloat(ue.minHeight)||100,Te=Fr(Se),se=5,xt=5,_=20,be=ee.documentElement.clientHeight-Ne-fe,ht=ee.documentElement.clientWidth,Rt=be-V.bottom+ae,ye,bt=I==="rtl"?V.right-D.width:V.left,yt=0;if(K&&ne){let de=_t(ne.getBoundingClientRect(),pe);ye=_t(K.getBoundingClientRect(),pe),bt=D.left+(I==="rtl"?de.right-ye.right:de.left-ye.left);let we=de.top-V.top+de.height/2;yt=ye.top-D.top+ye.height/2-we}let ze=Rt+yt+fe+Ae,Ee=Math.min(be,ze),Bt=be-Ne-fe,tt=ze-Ee,ot=ht-xt;c.style.left=`${ut(bt,se,ot-D.width)}px`,c.style.height=`${Ee}px`,c.style.maxHeight="none",c.style.marginTop=`${Ne}px`,c.style.marginBottom=`${fe}px`,x.style.height="100%";let rt=Dt(Z),We=tt>=rt-he;We&&(Ee=Math.min(be,D.height)-(tt-rt));let nt=V.top<_||V.bottom>be-_||Math.ceil(Ee)+he<Math.min(Ue,ke),jt=(J.visualViewport?.scale??1)!==1&&Ro.engine.webkit;if(nt||jt){Ze(c,G.current),S(!1);return}let Fe=Math.max(ke,Ee);if(We){let de=Math.max(0,be-ze);c.style.top=D.height>=Bt?"0":`${de}px`,c.style.height=`${Ee}px`,Z.scrollTop=Dt(Z)}else c.style.bottom="0",Z.scrollTop=tt;if(ye){let de=D.top,we=D.height,Pe=ye.top+ye.height/2,Ge=ut(we>0?(Pe-de)/we*100:50,0,100);x.style.setProperty(no,`50% ${Ge}%`)}(Fe===be||Ee>=Te)&&(q.current=!0),l.context.handleScrollArrowVisibility(Z),h&&l.state.selectedIndex===null&&l.state.activeIndex===null&&l.context.listRef.current[0]!=null&&l.set("activeIndex",0)}finally{P()}},[l,T,c,X,v,S,le,z,h,I,H]),ge.useEffect(()=>{if(!v||!c||!T)return;let x=Ct(c);function P(K){l.context.setOpen(!1,ce(oe.windowResize,K))}return o(P,"handleResize"),Po(x,"resize",P)},[l,v,c,T]);let E={...z?{role:"presentation"}:{role:"listbox","aria-multiselectable":m||void 0,"aria-readonly":p||void 0,id:`${M}-list`},onKeyDown(x){j&&Zo.has(x.key)&&x.stopPropagation()},onScroll(x){z||F(x.currentTarget)},...v&&{style:z?{height:"100%"}:Lt},className:!z&&v?pt.className:void 0},R=w("div",t,{ref:[r,l.context.popupRef],state:f,stateAttributesMapping:Pn,props:[$,E,Xo(W),u]});return(0,Ut.jsxs)(ge.Fragment,{children:[!C&&pt.getElement(g),(0,Ut.jsx)(Do,{context:y,modal:!1,disabled:!Q,openInteractionType:k,returnFocus:i,restoreFocus:!0,children:R})]})},"SelectPopup"));function Fr(e){let t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}o(Fr,"getMaxPopupHeight");function Dt(e){return Xe(e.scrollHeight,e.clientHeight)}o(Dt,"getMaxScrollTop");function Hr(e){return ko.getScale(e)}o(Hr,"getScale");function mt(e,t,r){return e/r[t]}o(mt,"normalizeSize");function _t(e,t){return wo({x:mt(e.x,"x",t),y:mt(e.y,"y",t),width:mt(e.width,"x",t),height:mt(e.height,"y",t)})}o(_t,"normalizeRect");var Br=[["transform","none"],["scale","1"],["translate","0 0"]];function Mn(e){let{style:t}=e,r={};for(let[n,s]of Br)r[n]=t.getPropertyValue(n),t.setProperty(n,s,"important");return()=>{for(let[n]of Br){let s=r[n];s?t.setProperty(n,s):t.removeProperty(n)}}}o(Mn,"unsetTransformStyles");var zr=b(O(),1);var Wr=zr.forwardRef(o(function(t,r){let{render:n,className:s,style:a,...i}=t,u=L(),{multiple:l,readOnly:m}=Le(),{alignItemWithTriggerActive:p}=_e(),h=u.useState("hasScrollArrows"),y=u.useState("openMethod"),N={id:`${u.useState("id")}-list`,role:"listbox","aria-multiselectable":l||void 0,"aria-readonly":m||void 0,onScroll(H){u.context.scrollHandlerRef.current?.(H.currentTarget)},...p&&{style:Lt},className:h&&y!=="touch"?pt.className:void 0},v=u.useStateSetter("listElement");return w("div",t,{ref:[r,v],props:[N,i]})},"SelectList"));var Re=b(O(),1);var kt=b(O(),1);var so=kt.createContext(void 0);function gt(){let e=kt.useContext(so);if(!e)throw new Error(ve(57));return e}o(gt,"useSelectItemContext");var Gr=b(xe(),1);var qr=Re.memo(Re.forwardRef(o(function(t,r){let{render:n,className:s,style:a,value:i=null,label:u,disabled:l=!1,nativeButton:m=!1,...p}=t,h=Re.useRef(null),y=sr({guess:!0,label:u,textRef:h}),d=L(),{itemProps:N,multiple:v,disabled:H,readOnly:S}=Le(),j=H||l,I=d.useState("isActive",y.index),g=d.useState("open"),C=d.useState("isSelected",i),M=d.useState("isSelectedByFocus",y.index),T=d.useState("isItemEqualToValue"),k=y.index,Q=Re.useRef(null);te(()=>{let f=d.context.valuesRef.current;return f[k]=i,()=>{delete f[k]}},[k,i,d]),te(()=>{let f=d.state.value,E=d.state.selectedIndex,R=E,x;v&&Array.isArray(f)?(R=mr(k,i,d.context.valuesRef.current,f,T,E),x=R===k,k===E&&!x&&(d.context.selectedItemTextRef.current=null)):(x=f!==void 0&&Ce(i,f,T),x&&(R=k)),d.set("selectedIndex",R),x&&h.current&&(d.context.selectedItemTextRef.current=h.current)},[k,v,T,d,i]);let $=Re.useRef("mouse"),W=Re.useRef(!1),{getButtonProps:X,buttonRef:c}=Pt({disabled:j,focusableWhenDisabled:!0,native:m,composite:!0}),z={disabled:j,selected:C,highlighted:I};function q(f){if(H||S)return;let E=d.state.value;if(v){let R=Array.isArray(E)?E:[],x=C?gr(R,i,T):[...R,i];d.context.setValue(x,ce(oe.itemPress,f))}else d.context.setValue(i,ce(oe.itemPress,f)),d.context.setOpen(!1,ce(oe.itemPress,f))}o(q,"commitSelection");function ie(){d.context.selectionRef.current.dragY=0}o(ie,"resetDragMovement");let G={role:"option","aria-selected":C,tabIndex:g&&I?0:-1,onKeyDown(f){d.set("activeIndex",k),f.key===" "&&d.context.typingRef.current&&f.preventDefault()},onClick(f){let E=$.current!=="touch",R=f.nativeEvent.pointerType,x=E&&Eo(f.nativeEvent)&&(R!==void 0||I),P=E&&!x&&!W.current;W.current=!1,!(j||P)&&q(f.nativeEvent)},onPointerEnter(f){$.current=f.pointerType},onPointerMove(f){if(f.pointerType==="mouse"&&f.buttons===1){let E=d.context.selectionRef.current;E.dragY+=f.movementY,E.dragY**2>=64&&(E.allowUnselectedMouseUp=!0)}},onPointerDown(f){$.current=f.pointerType,W.current=!0,ie()},onMouseUp(){if(ie(),j||$.current==="touch"||W.current)return;let f=!d.context.selectionRef.current.allowSelectedMouseUp&&C,E=!d.context.selectionRef.current.allowUnselectedMouseUp&&!C;f||E||(W.current=!0,Q.current?.click(),W.current=!1)}},le=w("div",t,{ref:[c,r,y.ref,Q],state:z,props:[N,G,p,X]}),F=Re.useMemo(()=>({selected:C,index:k,textRef:h,selectedByFocus:M}),[C,k,h,M]);return(0,Gr.jsx)(so.Provider,{value:F,children:le})},"SelectItem")));var je=b(O(),1);var Yr=b(xe(),1);var $r=je.forwardRef(o(function(t,r){let{selected:n}=gt();return t.keepMounted||n?(0,Yr.jsx)(Vn,{...t,ref:r}):null},"SelectItemIndicator")),Vn=je.memo(je.forwardRef((e,t)=>{let{render:r,className:n,style:s,keepMounted:a,...i}=e,{selected:u}=gt(),l=je.useRef(null),{transitionStatus:m,setMounted:p}=$e(u),y=w("span",e,{ref:[t,l],state:{selected:u,transitionStatus:m},props:[{"aria-hidden":!0,children:"\u2714\uFE0F"},i],stateAttributesMapping:Me});return Ve({batch:!0,enabled:!u,open:u,ref:l,onComplete(){u||p(!1)}}),y}));var Qe=b(O(),1);var Xr=Qe.memo(Qe.forwardRef(o(function(t,r){let{index:n,textRef:s,selectedByFocus:a}=gt(),i=L(),{render:u,className:l,style:m,...p}=t,h=Qe.useCallback(d=>{d&&(n===0&&(i.context.firstItemTextRef.current=d),a&&(i.context.selectedItemTextRef.current=d))},[i,n,a]);return w("div",t,{ref:[h,r,s],props:p})},"SelectItemText")));var Kr=b(O(),1);var Jr=Kr.forwardRef(o(function(t,r){let{render:n,className:s,style:a,...i}=t,u=L(),{side:l,align:m,arrowRef:p,arrowStyles:h,arrowUncentered:y,alignItemWithTriggerActive:d}=_e(),v={open:u.useState("open"),side:l,align:m,uncentered:y},H=w("div",t,{state:v,ref:[p,r],props:[{style:h,"aria-hidden":!0},i],stateAttributesMapping:vo});return d?null:H},"SelectArrow"));var Qr=b(O(),1);var Zr=b(O(),1);var Ft=Zr.forwardRef(o(function(t,r){let{render:n,className:s,style:a,direction:i,keepMounted:u,...l}=t,m=i==="up",p=L(),{side:h,scrollDownArrowRef:y,scrollUpArrowRef:d}=_e(),N=m?"scrollUpArrowVisible":"scrollDownArrowVisible",v=p.useState(N),H=p.useState("openMethod"),S=v&&H!=="touch",j=Ye(),I=m?d:y,{mounted:g,transitionStatus:C,setMounted:M}=$e(S);te(()=>(p.context.scrollArrowsMountedCountRef.current+=1,p.set("hasScrollArrows",!0),()=>{p.context.scrollArrowsMountedCountRef.current=Math.max(0,p.context.scrollArrowsMountedCountRef.current-1),p.context.scrollArrowsMountedCountRef.current===0&&p.set("hasScrollArrows",!1)}),[p]),Ve({open:S,ref:I,onComplete(){S||M(!1)}});let Q=w("div",t,{ref:[r,I],state:{direction:i,visible:S,side:h,transitionStatus:C},props:[{"aria-hidden":!0,children:m?"\u25B2":"\u25BC",style:{position:"absolute"},onMouseMove(W){if(W.movementX===0&&W.movementY===0||j.isStarted())return;p.set("activeIndex",null);function X(){let c=p.state.listElement??p.context.popupRef.current;if(!c)return;p.set("activeIndex",null),p.context.handleScrollArrowVisibility(c);let z=Xe(c.scrollHeight,c.clientHeight),q=Ke(c.scrollTop,z),ie=q===(m?0:z),G=p.context.listRef.current;if(q!==c.scrollTop&&(c.scrollTop=q),ie){j.clear();return}if(G.length>0){let le=I.current?.offsetHeight||0;c.scrollTop=On(G,m,q,c.clientHeight,le,z)}j.start(40,X)}o(X,"scrollNextItem"),j.start(40,X)},onMouseLeave(){j.clear()}},l],stateAttributesMapping:Me});return g||u?Q:null},"SelectScrollArrow"));function On(e,t,r,n,s,a){if(t){let p=0,h=r+s-he;for(let N=0;N<e.length;N+=1){let v=e[N];if(v&&v.offsetTop>=h){p=N;break}}let y=Math.max(0,p-1),d=e[y];return y<p&&d?Ke(d.offsetTop-s,a):0}let i=e.length-1,u=r+n-s+he;for(let p=0;p<e.length;p+=1){let h=e[p];if(h&&h.offsetTop+h.offsetHeight>u){i=Math.max(0,p-1);break}}let l=Math.min(e.length-1,i+1),m=e[l];return l>i&&m?Ke(m.offsetTop+m.offsetHeight-n+s,a):a}o(On,"getTargetScrollTop");var en=b(xe(),1);var tn=Qr.forwardRef(o(function(t,r){return(0,en.jsx)(Ft,{...t,ref:r,direction:"down"})},"SelectScrollDownArrow"));var on=b(O(),1);var rn=b(xe(),1);var nn=on.forwardRef(o(function(t,r){return(0,rn.jsx)(Ft,{...t,ref:r,direction:"up"})},"SelectScrollUpArrow"));var et=b(O(),1);var Ht=b(O(),1);var io=Ht.createContext(void 0);function sn(){let e=Ht.useContext(io);if(e===void 0)throw new Error(ve(56));return e}o(sn,"useSelectGroupContext");var ln=b(xe(),1);var an=et.forwardRef(o(function(t,r){let{render:n,className:s,style:a,...i}=t,[u,l]=et.useState(),m=et.useMemo(()=>({labelId:u,setLabelId:l}),[u,l]),p=w("div",t,{ref:r,props:[{role:"group","aria-labelledby":u},i]});return(0,ln.jsx)(io.Provider,{value:m,children:p})},"SelectGroup"));var cn=b(O(),1);var un=cn.forwardRef(o(function(t,r){let{render:n,className:s,style:a,id:i,...u}=t,{setLabelId:l}=sn(),m=xo(i);return te(()=>(l(m),()=>{l(h=>h===m?void 0:h)}),[m,l]),w("div",t,{ref:r,props:[{id:m,"aria-hidden":!0},u]})},"SelectGroupLabel"));var pn=b(O(),1);var fn=pn.forwardRef(o(function(t,r){let{className:n,render:s,orientation:a="horizontal",style:i,...u}=t;return w("div",t,{state:{orientation:a},ref:r,props:[{role:"presentation"},u]})},"ListboxSeparator"));var dn=fn;var B=b(xe(),1);var hc=re.Root;function Rc(e){let t=(0,St.c)(8),r,n;t[0]!==e?({className:r,...n}=e,t[0]=e,t[1]=r,t[2]=n):(r=t[1],n=t[2]);let s;t[3]!==r?(s=He("flex flex-1 text-start",r),t[3]=r,t[4]=s):s=t[4];let a;return t[5]!==n||t[6]!==s?(a=(0,B.jsx)(re.Value,{"data-slot":"select-value",className:s,...n}),t[5]=n,t[6]=s,t[7]=a):a=t[7],a}o(Rc,"$");function bc({className:e,size:t="default",children:r,...n}){return(0,B.jsxs)(re.Trigger,{"data-slot":"select-trigger","data-size":t,className:He("flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-transparent py-2 pe-2 ps-2.5 text-xs whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-md *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...n,children:[r,(0,B.jsx)(re.Icon,{render:(0,B.jsx)(ct,{icon:nr,strokeWidth:2,className:"pointer-events-none size-4 text-muted-foreground"})})]})}o(bc,"j");function yc({className:e,children:t,side:r="bottom",sideOffset:n=4,align:s="center",alignOffset:a=0,alignItemWithTrigger:i=!0,...u}){return(0,B.jsx)(re.Portal,{children:(0,B.jsx)(re.Positioner,{side:r,sideOffset:n,align:s,alignOffset:a,alignItemWithTrigger:i,className:"isolate z-50",children:(0,B.jsxs)(re.Popup,{"data-slot":"select-content","data-align-trigger":i,className:He("isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 animate-none! relative bg-popover before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!",e),...u,children:[(0,B.jsx)(Ln,{}),(0,B.jsx)(re.List,{children:t}),(0,B.jsx)(Dn,{})]})})})}o(yc,"A");function vc(e){let t=(0,St.c)(13),r,n,s;t[0]!==e?({className:n,children:r,...s}=e,t[0]=e,t[1]=r,t[2]=n,t[3]=s):(r=t[1],n=t[2],s=t[3]);let a;t[4]!==n?(a=He("relative flex w-full cursor-default items-center gap-2 rounded-md py-2 pe-8 ps-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",n),t[4]=n,t[5]=a):a=t[5];let i;t[6]!==r?(i=(0,B.jsx)(re.ItemText,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:r}),t[6]=r,t[7]=i):i=t[7];let u;t[8]===Symbol.for("react.memo_cache_sentinel")?(u=(0,B.jsx)(re.ItemIndicator,{render:(0,B.jsx)("span",{className:"pointer-events-none absolute end-2 flex size-4 items-center justify-center"}),children:(0,B.jsx)(ct,{icon:rr,strokeWidth:2,className:"pointer-events-none"})}),t[8]=u):u=t[8];let l;return t[9]!==s||t[10]!==a||t[11]!==i?(l=(0,B.jsxs)(re.Item,{"data-slot":"select-item",className:a,...s,children:[i,u]}),t[9]=s,t[10]=a,t[11]=i,t[12]=l):l=t[12],l}o(vc,"U");function Ln(e){let t=(0,St.c)(9),r,n;t[0]!==e?({className:r,...n}=e,t[0]=e,t[1]=r,t[2]=n):(r=t[1],n=t[2]);let s;t[3]!==r?(s=He("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",r),t[3]=r,t[4]=s):s=t[4];let a;t[5]===Symbol.for("react.memo_cache_sentinel")?(a=(0,B.jsx)(ct,{icon:or,strokeWidth:2}),t[5]=a):a=t[5];let i;return t[6]!==n||t[7]!==s?(i=(0,B.jsx)(re.ScrollUpArrow,{"data-slot":"select-scroll-up-button",className:s,...n,children:a}),t[6]=n,t[7]=s,t[8]=i):i=t[8],i}o(Ln,"x");function Dn(e){let t=(0,St.c)(9),r,n;t[0]!==e?({className:r,...n}=e,t[0]=e,t[1]=r,t[2]=n):(r=t[1],n=t[2]);let s;t[3]!==r?(s=He("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",r),t[3]=r,t[4]=s):s=t[4];let a;t[5]===Symbol.for("react.memo_cache_sentinel")?(a=(0,B.jsx)(ct,{icon:tr,strokeWidth:2}),t[5]=a):a=t[5];let i;return t[6]!==n||t[7]!==s?(i=(0,B.jsx)(re.ScrollDownArrow,{"data-slot":"select-scroll-down-button",className:s,...n,children:a}),t[6]=n,t[7]=s,t[8]=i):i=t[8],i}o(Dn,"w");export{hc as a,Rc as b,bc as c,yc as d,vc as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as g}from"./chunk-HJHSQPHW.js";import{a,d as b,e as x,f as y}from"./chunk-I26MS5PJ.js";var k=b(y(),1),n=b(x(),1);var _=a(function(o,d,s){let t=(0,k.c)(15),c;t[0]===Symbol.for("react.memo_cache_sentinel")?(c={kind:"loading"},t[0]=c):c=t[0];let[h,E]=(0,n.useState)(c),r;t[1]!==d?(r=a(async()=>d(),"f"),t[1]=d,t[2]=r):r=t[2];let p=(0,n.useEffectEvent)(r),f;t[3]!==s?(f=a(e=>s(e),"m"),t[3]=s,t[4]=f):f=t[4];let v=(0,n.useEffectEvent)(f),i;t[5]!==v||t[6]!==p||t[7]!==o?(i=a(()=>{if(o!==void 0)return;let e=!1;return p().then(l=>(e||E(v(l)),l)).catch(l=>{e||E({kind:"error",message:g(l)})}),()=>{e=!0}},"u"),t[5]=v,t[6]=p,t[7]=o,t[8]=i):i=t[8];let m;t[9]!==o?(m=[o],t[9]=o,t[10]=m):m=t[10],(0,n.useEffect)(i,m);let u;return t[11]!==s||t[12]!==h||t[13]!==o?(u=o===void 0?h:s(o),t[11]=s,t[12]=h,t[13]=o,t[14]=u):u=t[14],u},"$");export{_ as a};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{a as Jt,d as b}from"./chunk-VGL7ERWQ.js";import{a as n,d as D,e as Z,f as Yt,g as nt}from"./chunk-I26MS5PJ.js";var br=/["\\\u0000-\u001F\uD800-\uDFFF]/,Xt=n(t=>br.test(t)?JSON.stringify(t):`"${t}"`,"y"),gr=n(t=>Number.isNaN(t)?"nan":t===1/0?"inf":t===-1/0?"-inf":Object.is(t,-0)?"-0":void 0,"p"),vr=n((t,e)=>{let s=Object.getPrototypeOf(t);if(s!==null&&s!==Object.prototype){let c=t.constructor?.name??"value";throw new TypeError(`stableStringify: cannot use a ${c} in a stable JSON cache key \u2014 only plain objects, arrays, and JSON primitives are supported (wire-typed values key via stableWireKey)`)}let r=t,i=Object.keys(r).sort(),a="{",o=!0;for(let c of i){let u=r[c];u!==void 0&&(o?o=!1:a+=",",a+=Xt(c),a+=":",a+=e(u))}return`${a}}`},"u"),me=n(t=>{if(t===void 0)return"null";if(typeof t=="bigint")throw new TypeError("stableStringify: cannot use a bigint in a stable JSON cache key \u2014 pass it as a string, or use stableWireKey");if(typeof t=="number"){let e=gr(t);if(e!==void 0)return e}return typeof t=="string"?Xt(t):t===null||typeof t!="object"?JSON.stringify(t):Array.isArray(t)?`[${Array.from({length:t.length},(e,s)=>me(t[s])).join(",")}]`:vr(t,me)},"c");var Re=n(t=>{if(t===null||typeof t!="object")return!1;let e=Object.getPrototypeOf(t);return e===null||e===Object.prototype},"e");var Ae=n(t=>{let e="";for(let s=0;s<t.length;s+=32768)e+=String.fromCharCode(...t.subarray(s,s+32768));return btoa(e)},"f"),Sr=n(t=>{let e=atob(t),s=new Uint8Array(e.length);for(let r=0;r<e.length;r+=1)s[r]=e.codePointAt(r)??0;return s},"l"),O="$lunora.wire$",Fe=64,Pe=1024,wr="__proto__",Cr=/^-?\d+$/,Zt={BigInt64Array,BigUint64Array,Float32Array,Float64Array,Int8Array,Int16Array,Int32Array,Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array},es={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError},at=n((t,e,s)=>{e===wr?Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:s,writable:!0}):t[e]=s},"y");var kr=n(t=>{let e=t.toString();if(e.length>Pe)throw new RangeError(`wire-codec: over-long bigint (max ${String(Pe)} digits)`);return[O,"bigint",e]},"T"),Tr=n(t=>Number.isNaN(t)?[O,"nan"]:t===1/0?[O,"inf"]:t===-1/0?[O,"-inf"]:t,"j"),Er=n((t,e)=>{let s=e(Object.fromEntries(Object.keys(t).map(a=>[a,t[a]]))),r=t,i=[O,"error",String(r.name),String(r.message),s];return t.cause!==void 0&&i.push(e(t.cause)),i},"R"),Ir=n(t=>{let e=t.constructor.name,s=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);return e==="Uint8Array"?[O,"bytes",Ae(s)]:[O,"bytes",Ae(s),e]},"S"),Or=n((t,e)=>t instanceof Date?[O,"date",e(t.getTime())]:t instanceof Error?Er(t,e):t instanceof URL?[O,"url",t.href]:t instanceof Map?[O,"map",[...t.entries()].map(([s,r])=>[e(s),e(r)])]:t instanceof Set?[O,"set",[...t].map(s=>e(s))]:t instanceof ArrayBuffer?[O,"bytes",Ae(new Uint8Array(t)),"ArrayBuffer"]:ArrayBuffer.isView(t)?Ir(t):void 0,"U"),Rr=n((t,e)=>{let s=t.map(r=>e(r));return s.length>0&&s[0]===O?[O,"arr",s]:s},"I"),Ar=n((t,e)=>{let s={};for(let r of Object.keys(t)){let i=t[r];i!==void 0&&at(s,r,e(i))}return s},"B"),B=n((t,e=0)=>{if(e>Fe)throw new RangeError(`wire-codec: value nesting exceeds the ${String(Fe)}-level limit`);if(t===void 0)return[O,"undefined"];if(t===null)return t;if(typeof t=="bigint")return kr(t);if(typeof t=="number")return Tr(t);if(typeof t!="object")return t;let s=n(i=>B(i,e+1),"t"),r=Or(t,s);if(r!==void 0)return r;if(Array.isArray(t))return Rr(t,s);if(!Re(t)){let i=t.constructor?.name??"value";throw new TypeError(`wire-codec: cannot encode a ${i} over the Lunora wire \u2014 only plain objects, arrays, and the supported built-ins (Date, Error, URL, Map, Set, ArrayBuffer/typed arrays, bigint) round-trip`)}return Ar(t,s)},"m"),Fr=n(t=>{let e=t[2];if(typeof e!="string"||e.length>Pe||!Cr.test(e))throw new RangeError(`wire-codec: invalid or over-long bigint (max ${String(Pe)} digits)`);return BigInt(e)},"N"),Pr=n((t,e)=>{let s=e(t[2]);if(typeof s!="number")throw new TypeError("wire-codec: malformed date \u2014 epoch must be a number");return new Date(s)},"_"),Mr=n((t,e)=>{let s=t[2];return new Map(s.map(r=>{if(!Array.isArray(r)||r.length!==2)throw new TypeError("wire-codec: malformed map entry \u2014 expected a [key, value] pair");return[e(r[0]),e(r[1])]}))},"$"),xr=n(t=>{let e=t[2];if(typeof e!="string")throw new TypeError("wire-codec: malformed url \u2014 href must be a string");return new URL(e)},"k"),Qr=n((t,e)=>{let s=t[2],r=t[3];if(typeof s!="string"||typeof r!="string")throw new TypeError("wire-codec: malformed error \u2014 name and message must be strings");let i=(Object.hasOwn(es,s)?es[s]:void 0)??Error,a=new i(r);a.name!==s&&Object.defineProperty(a,"name",{configurable:!0,value:s,writable:!0});let o=e(t[4]);if(o===null||typeof o!="object"||Array.isArray(o))throw new TypeError("wire-codec: malformed error \u2014 props must be an object");for(let[c,u]of Object.entries(o))at(a,c,u);return t.length>5&&Object.defineProperty(a,"cause",{configurable:!0,value:e(t[5]),writable:!0}),a},"P"),_r=n(t=>{let e=t[2];if(typeof e!="string")throw new TypeError("wire-codec: malformed bytes \u2014 payload must be a base64 string");let s=Sr(e);if(Ae(s)!==e)throw new TypeError("wire-codec: malformed bytes \u2014 payload must be canonical padded base64");let r=t[3]??"Uint8Array";if(r==="ArrayBuffer")return s.buffer.byteLength===s.byteLength?s.buffer:new Uint8Array(s).buffer;let i=Object.hasOwn(Zt,r)?Zt[r]:void 0;return i?new i(new Uint8Array(s).buffer):s},"D"),Lr=n((t,e)=>{switch(t[1]){case"-inf":return-1/0;case"arr":return t[2].map(s=>e(s));case"bigint":return Fr(t);case"bytes":return _r(t);case"date":return Pr(t,e);case"error":return Qr(t,e);case"inf":return 1/0;case"map":return Mr(t,e);case"nan":return Number.NaN;case"set":return new Set(t[2].map(s=>e(s)));case"undefined":return;case"url":return xr(t);default:return t.map(s=>e(s))}},"C"),Dr=n((t,e)=>{let s={};for(let r of Object.keys(t))at(s,r,e(t[r]));return s},"L"),I=n((t,e=0)=>{if(e>Fe)throw new RangeError(`wire-codec: value nesting exceeds the ${String(Fe)}-level limit`);if(t===null||typeof t!="object")return t;let s=n(r=>I(r,e+1),"t");if(Array.isArray(t)){let r=t;return r[0]===O?Lr(r,s):r.map(i=>s(i))}return Dr(t,s)},"A"),Ur=n(t=>{try{let e=I(JSON.parse(t));return Re(e)?e:void 0}catch{return}},"F");var q=n(t=>me(B(t)),"a");var oe=D(Z(),1),ts=D(nt(),1);var ye=oe.createContext(void 0),be=n(t=>{let e=oe.useContext(ye);if(t)return t;if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},"useQueryClient"),ot=n(({client:t,children:e})=>(oe.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),(0,ts.jsx)(ye.Provider,{value:t,children:e})),"QueryClientProvider");var U=class{static{n(this,"Subscribable")}constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};var Kr=class extends U{static{n(this,"FocusManager")}#e;#t;#s;constructor(){super(),this.#s=t=>{if(typeof window<"u"&&window.addEventListener){let e=n(()=>t(),"listener");return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}}}onSubscribe(){this.#t||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(t){this.#s=t,this.#t?.(),this.#t=t(e=>{typeof e=="boolean"?this.setFocused(e):this.onFocus()})}setFocused(t){this.#e!==t&&(this.#e=t,this.onFocus())}onFocus(){let t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},ce=new Kr;var Nr={setTimeout:n((t,e)=>setTimeout(t,e),"setTimeout"),clearTimeout:n(t=>clearTimeout(t),"clearTimeout"),setInterval:n((t,e)=>setInterval(t,e),"setInterval"),clearInterval:n(t=>clearInterval(t),"clearInterval")},qr=class{static{n(this,"TimeoutManager")}#e=Nr;#t=!1;setTimeoutProvider(t){this.#e=t}setTimeout(t,e){return this.#e.setTimeout(t,e)}clearTimeout(t){this.#e.clearTimeout(t)}setInterval(t,e){return this.#e.setInterval(t,e)}clearInterval(t){this.#e.clearInterval(t)}},$=new qr;function ss(t){setTimeout(t,0)}n(ss,"systemSetTimeoutZero");var ut=typeof window>"u"||"Deno"in globalThis;function T(){}n(T,"noop");function ns(t,e){return typeof t=="function"?t(e):t}n(ns,"functionalUpdate");function ge(t){return typeof t=="number"&&t>=0&&t!==1/0}n(ge,"isValidTimeout");function Me(t,e){return Math.max(t+(e||0)-Date.now(),0)}n(Me,"timeUntilStale");function j(t,e){return typeof t=="function"?t(e):t}n(j,"resolveStaleTime");function A(t,e){return typeof t=="function"?t(e):t}n(A,"resolveQueryBoolean");function xe(t,e){let{type:s="all",exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:c}=t;if(o){if(r){if(e.queryHash!==ve(o,e.options))return!1}else if(!ee(e.queryKey,o))return!1}if(s!=="all"){let u=e.isActive();if(s==="active"&&!u||s==="inactive"&&u)return!1}return!(typeof c=="boolean"&&e.isStale()!==c||i&&i!==e.state.fetchStatus||a&&!a(e))}n(xe,"matchQuery");function Qe(t,e){let{exact:s,status:r,predicate:i,mutationKey:a}=t;if(a){if(!e.options.mutationKey)return!1;if(s){if(H(e.options.mutationKey)!==H(a))return!1}else if(!ee(e.options.mutationKey,a))return!1}return!(r&&e.state.status!==r||i&&!i(e))}n(Qe,"matchMutation");function ve(t,e){return(e?.queryKeyHashFn||H)(t)}n(ve,"hashQueryKeyByOptions");function H(t){return JSON.stringify(t,(e,s)=>ct(s)?Object.keys(s).sort().reduce((r,i)=>(r[i]=s[i],r),{}):s)}n(H,"hashKey");function ee(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(Array.isArray(t)&&Array.isArray(e)){for(let r=0;r<e.length;r++)if(!ee(t[r],e[r]))return!1;return!0}let s=Object.keys(e);for(let r of s)if(!ee(t[r],e[r]))return!1;return!0}return!1}n(ee,"partialMatchKey");var jr=Object.prototype.hasOwnProperty;function ht(t,e,s=0){if(t===e)return t;if(s>500)return e;let r=rs(t)&&rs(e);if(!r&&!(ct(t)&&ct(e)))return e;let a=(r?t:Object.keys(t)).length,o=r?e:Object.keys(e),c=o.length,u=r?new Array(c):{},d=0;for(let h=0;h<c;h++){let l=r?h:o[h],f=t[l],p=e[l];if(f===p){u[l]=f,(r?h<a:jr.call(t,l))&&d++;continue}if(f===null||p===null||typeof f!="object"||typeof p!="object"){u[l]=p;continue}let m=ht(f,p,s+1);u[l]=m,m===f&&d++}return a===c&&d===a?t:u}n(ht,"replaceEqualDeep");function ue(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(let s in t)if(t[s]!==e[s])return!1;return!0}n(ue,"shallowEqualObjects");function rs(t){return Array.isArray(t)&&t.length===Object.keys(t).length}n(rs,"isPlainArray");function ct(t){if(!is(t))return!1;let e=t.constructor;if(e===void 0)return!0;let s=e.prototype;return!(!is(s)||!s.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}n(ct,"isPlainObject");function is(t){return Object.prototype.toString.call(t)==="[object Object]"}n(is,"hasObjectPrototype");function as(t){return new Promise(e=>{$.setTimeout(e,t)})}n(as,"sleep");function Se(t,e,s){return typeof s.structuralSharing=="function"?s.structuralSharing(t,e):s.structuralSharing!==!1?ht(t,e):e}n(Se,"replaceData");function Br(t){return t}n(Br,"keepPreviousData");function os(t,e,s=0){let r=[...t,e];return s&&r.length>s?r.slice(1):r}n(os,"addToEnd");function cs(t,e,s=0){let r=[e,...t];return s&&r.length>s?r.slice(0,-1):r}n(cs,"addToStart");var he=Symbol();function _e(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:!t.queryFn||t.queryFn===he?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}n(_e,"ensureQueryFn");function de(t,e){return typeof t=="function"?t(...e):!!t}n(de,"shouldThrowError");function us(t,e,s){let r=!1,i;return Object.defineProperty(t,"signal",{enumerable:!0,get:n(()=>(i??=e(),r||(r=!0,i.aborted?s():i.addEventListener("abort",s,{once:!0})),i),"get")}),t}n(us,"addConsumeAwareSignal");var W=(()=>{let t=n(()=>ut,"isServerFn");return{isServer(){return t()},setIsServer(e){t=e}}})();function we(){let t,e,s=new Promise((i,a)=>{t=i,e=a});s.status="pending",s.catch(()=>{});function r(i){Object.assign(s,i),delete s.resolve,delete s.reject}return n(r,"finalize"),s.resolve=i=>{r({status:"fulfilled",value:i}),t(i)},s.reject=i=>{r({status:"rejected",reason:i}),e(i)},s}n(we,"pendingThenable");var hs=ss;function $r(){let t=[],e=0,s=n(c=>{c()},"notifyFn"),r=n(c=>{c()},"batchNotifyFn"),i=hs,a=n(c=>{e?t.push(c):i(()=>{s(c)})},"schedule"),o=n(()=>{let c=t;t=[],c.length&&i(()=>{r(()=>{c.forEach(u=>{s(u)})})})},"flush");return{batch:n(c=>{let u;e++;try{u=c()}finally{e--,e||o()}return u},"batch"),batchCalls:n(c=>(...u)=>{a(()=>{c(...u)})},"batchCalls"),schedule:a,setNotifyFunction:n(c=>{s=c},"setNotifyFunction"),setBatchNotifyFunction:n(c=>{r=c},"setBatchNotifyFunction"),setScheduler:n(c=>{i=c},"setScheduler")}}n($r,"createNotifyManager");var S=$r();var Hr=class extends U{static{n(this,"OnlineManager")}#e=!0;#t;#s;constructor(){super(),this.#s=t=>{if(typeof window<"u"&&window.addEventListener){let e=n(()=>t(!0),"onlineListener"),s=n(()=>t(!1),"offlineListener");return window.addEventListener("online",e,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",s)}}}}onSubscribe(){this.#t||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(t){this.#s=t,this.#t?.(),this.#t=t(this.setOnline.bind(this))}setOnline(t){this.#e!==t&&(this.#e=t,this.listeners.forEach(s=>{s(t)}))}isOnline(){return this.#e}},le=new Hr;function Wr(t){return Math.min(1e3*2**t,3e4)}n(Wr,"defaultRetryDelay");function dt(t){return(t??"online")==="online"?le.isOnline():!0}n(dt,"canFetch");var Le=class extends Error{static{n(this,"CancelledError")}constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function De(t){let e=!1,s=0,r,i=we(),a=n(()=>i.status!=="pending","isResolved"),o=n(y=>{if(!a()){let v=new Le(y);f(v),t.onCancel?.(v)}},"cancel"),c=n(()=>{e=!0},"cancelRetry"),u=n(()=>{e=!1},"continueRetry"),d=n(()=>ce.isFocused()&&(t.networkMode==="always"||le.isOnline())&&t.canRun(),"canContinue"),h=n(()=>dt(t.networkMode)&&t.canRun(),"canStart"),l=n(y=>{a()||(r?.(),i.resolve(y))},"resolve"),f=n(y=>{a()||(r?.(),i.reject(y))},"reject"),p=n(()=>new Promise(y=>{r=n(v=>{(a()||d())&&y(v)},"continueFn"),t.onPause?.()}).then(()=>{r=void 0,a()||t.onContinue?.()}),"pause"),m=n(()=>{if(a())return;let y,v=s===0?t.initialPromise:void 0;try{y=v??t.fn()}catch(C){y=Promise.reject(C)}Promise.resolve(y).then(l).catch(C=>{if(a())return;let k=t.retry??(W.isServer()?0:3),E=t.retryDelay??Wr,w=typeof E=="function"?E(s,C):E,P=k===!0||typeof k=="number"&&s<k||typeof k=="function"&&k(s,C);if(e||!P){f(C);return}s++,t.onFail?.(s,C),as(w).then(()=>d()?void 0:p()).then(()=>{e?f(C):m()})})},"run");return{promise:i,status:n(()=>i.status,"status"),cancel:o,continue:n(()=>(r?.(),i),"continue"),cancelRetry:c,continueRetry:u,canStart:h,start:n(()=>(h()?m():p().then(m),i),"start")}}n(De,"createRetryer");var Ue=class{static{n(this,"Removable")}#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ge(this.gcTime)&&(this.#e=$.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(W.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&($.clearTimeout(this.#e),this.#e=void 0)}};function ls(t){return{onFetch:n((e,s)=>{let r=e.options,i=e.fetchOptions?.meta?.fetchMore?.direction,a=e.state.data?.pages||[],o=e.state.data?.pageParams||[],c={pages:[],pageParams:[]},u=0,d=n(async()=>{let h=!1,l=n(m=>{us(m,()=>e.signal,()=>h=!0)},"addSignalProperty"),f=_e(e.options,e.fetchOptions),p=n(async(m,y,v)=>{if(h)return Promise.reject(e.signal.reason);if(y==null&&m.pages.length)return Promise.resolve(m);let k=n(()=>{let M={client:e.client,queryKey:e.queryKey,pageParam:y,direction:v?"backward":"forward",meta:e.options.meta};return l(M),M},"createQueryFnContext")(),E=await f(k),{maxPages:w}=e.options,P=v?cs:os;return{pages:P(m.pages,E,w),pageParams:P(m.pageParams,y,w)}},"fetchPage");if(i&&a.length){let m=i==="backward",y=m?zr:ds,v={pages:a,pageParams:o},C=y(r,v);c=await p(v,C,m)}else{let m=t??a.length;do{let y=u===0?o[0]??r.initialPageParam:ds(r,c);if(u>0&&y==null)break;c=await p(c,y),u++}while(u<m)}return c},"fetchFn");e.options.persister?e.fetchFn=()=>e.options.persister?.(d,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},s):e.fetchFn=d},"onFetch")}}n(ls,"infiniteQueryBehavior");function ds(t,{pages:e,pageParams:s}){let r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,s[r],s):void 0}n(ds,"getNextPageParam");function zr(t,{pages:e,pageParams:s}){return e.length>0?t.getPreviousPageParam?.(e[0],e,s[0],s):void 0}n(zr,"getPreviousPageParam");var ms=class extends Ue{static{n(this,"Query")}#e;#t;#s;#r;#n;#i;#o;#a;constructor(t){super(),this.#a=!1,this.#o=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#n=t.client,this.#r=this.#n.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#t=ps(this.options),this.state=t.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#i?.promise}setOptions(t){if(this.options={...this.#o,...t},t?._type&&(this.#e=t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=ps(this.options);e.data!==void 0&&(this.setState(fs(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(t,e){let s=Se(this.state.data,t,this.options);return this.#c({data:s,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),s}setState(t){this.#c({type:"setState",state:t})}cancel(t){let e=this.#i?.promise;return this.#i?.cancel(t),e?e.then(T).catch(T):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>A(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===he||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>j(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!Me(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(this.#i&&(this.#a||this.#h()?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#r.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}#h(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"}invalidate(){this.state.isInvalidated||this.#c({type:"invalidate"})}async fetch(t,e){if(this.state.fetchStatus!=="idle"&&this.#i?.status()!=="rejected"){if(this.state.data!==void 0&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(t&&this.setOptions(t),!this.options.queryFn){let u=this.observers.find(d=>d.options.queryFn);u&&this.setOptions(u.options)}let s=new AbortController,r=n(u=>{Object.defineProperty(u,"signal",{enumerable:!0,get:n(()=>(this.#a=!0,s.signal),"get")})},"addSignalProperty"),i=n(()=>{let u=_e(this.options,e),h=n(()=>{let l={client:this.#n,queryKey:this.queryKey,meta:this.meta};return r(l),l},"createQueryFnContext")();return this.#a=!1,this.options.persister?this.options.persister(u,h,this):u(h)},"fetchFn"),o=n(()=>{let u={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#n,state:this.state,fetchFn:i};return r(u),u},"createFetchContext")();(this.#e==="infinite"?ls(this.options.pages):this.options.behavior)?.onFetch(o,this),this.#s=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==o.fetchOptions?.meta)&&this.#c({type:"fetch",meta:o.fetchOptions?.meta}),this.#i=De({initialPromise:e?.initialPromise,fn:o.fetchFn,onCancel:n(u=>{u instanceof Le&&u.revert&&this.setState({...this.#s,fetchStatus:"idle"}),s.abort()},"onCancel"),onFail:n((u,d)=>{this.#c({type:"failed",failureCount:u,error:d})},"onFail"),onPause:n(()=>{this.#c({type:"pause"})},"onPause"),onContinue:n(()=>{this.#c({type:"continue"})},"onContinue"),retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:n(()=>!0,"canRun")});try{let u=await this.#i.start();if(u===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(u),this.#r.config.onSuccess?.(u,this),this.#r.config.onSettled?.(u,this.state.error,this),u}catch(u){if(u instanceof Le){if(u.silent)return this.#i.promise;if(u.revert){if(this.state.data===void 0)throw u;return this.state.data}}throw this.#c({type:"error",error:u}),this.#r.config.onError?.(u,this),this.#r.config.onSettled?.(this.state.data,u,this),u}finally{this.scheduleGc()}}#c(t){let e=n(s=>{switch(t.type){case"failed":return{...s,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...lt(s.data,this.options),fetchMeta:t.meta??null};case"success":let r={...s,...fs(t.data,t.dataUpdatedAt),dataUpdateCount:s.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#s=t.manual?r:void 0,r;case"error":let i=t.error;return{...s,error:i,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...t.state}}},"reducer");this.state=e(this.state),S.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:t})})}};function lt(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:dt(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}n(lt,"fetchState");function fs(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}n(fs,"successState");function ps(t){let e=typeof t.initialData=="function"?t.initialData():t.initialData,s=e!==void 0,r=s?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:s?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}n(ps,"getDefaultState");var pt=class extends U{static{n(this,"QueryObserver")}constructor(t,e){super(),this.options=e,this.#e=t,this.#a=null,this.#o=we(),this.bindMethods(),this.setOptions(e)}#e;#t=void 0;#s=void 0;#r=void 0;#n;#i;#o;#a;#h;#c;#p;#d;#l;#u;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),ys(this.#t,this.options)?this.#f():this.updateResult(),this.#v())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ft(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ft(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#S(),this.#w(),this.#t.removeObserver(this)}setOptions(t){let e=this.options,s=this.#t;if(this.options=this.#e.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof A(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#C(),this.#t.setOptions(this.options),e._defaulted&&!ue(this.options,e)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});let r=this.hasListeners();r&&bs(this.#t,s,this.options,e)&&this.#f(),this.updateResult(),r&&(this.#t!==s||A(this.options.enabled,this.#t)!==A(e.enabled,this.#t)||j(this.options.staleTime,this.#t)!==j(e.staleTime,this.#t))&&this.#y();let i=this.#b();r&&(this.#t!==s||A(this.options.enabled,this.#t)!==A(e.enabled,this.#t)||i!==this.#u)&&this.#g(i)}getOptimisticResult(t){let e=this.#e.getQueryCache().build(this.#e,t),s=this.createResult(e,t);return Vr(this,s)&&(this.#r=s,this.#i=this.options,this.#n=this.#t.state),s}getCurrentResult(){return this.#r}trackResult(t,e){return new Proxy(t,{get:n((s,r)=>(this.trackProp(r),e?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#o.status==="pending"&&this.#o.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(s,r)),"get")})}trackProp(t){this.#m.add(t)}getCurrentQuery(){return this.#t}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let e=this.#e.defaultQueryOptions(t),s=this.#e.getQueryCache().build(this.#e,e);return s.fetch().then(()=>this.createResult(s,e))}fetch(t){return this.#f({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#f(t){this.#C();let e=this.#t.fetch(this.options,t);return t?.throwOnError||(e=e.catch(T)),e}#y(){this.#S();let t=j(this.options.staleTime,this.#t);if(W.isServer()||this.#r.isStale||!ge(t))return;let s=Me(this.#r.dataUpdatedAt,t)+1;this.#d=$.setTimeout(()=>{this.#r.isStale||this.updateResult()},s)}#b(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#g(t){this.#w(),this.#u=t,!(W.isServer()||A(this.options.enabled,this.#t)===!1||!ge(this.#u)||this.#u===0)&&(this.#l=$.setInterval(()=>{(this.options.refetchIntervalInBackground||ce.isFocused())&&this.#f()},this.#u))}#v(){this.#y(),this.#g(this.#b())}#S(){this.#d!==void 0&&($.clearTimeout(this.#d),this.#d=void 0)}#w(){this.#l!==void 0&&($.clearInterval(this.#l),this.#l=void 0)}createResult(t,e){let s=this.#t,r=this.options,i=this.#r,a=this.#n,o=this.#i,u=t!==s?t.state:this.#s,{state:d}=t,h={...d},l=!1,f;if(e._optimisticResults){let R=this.hasListeners(),N=!R&&ys(t,e),X=R&&bs(t,s,e,r);(N||X)&&(h={...h,...lt(d.data,t.options)}),e._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:p,errorUpdatedAt:m,status:y}=h;f=h.data;let v=!1;if(e.placeholderData!==void 0&&f===void 0&&y==="pending"){let R;i?.isPlaceholderData&&e.placeholderData===o?.placeholderData?(R=i.data,v=!0):R=typeof e.placeholderData=="function"?e.placeholderData(this.#p?.state.data,this.#p):e.placeholderData,R!==void 0&&(y="success",f=Se(i?.data,R,e),l=!0)}if(e.select&&f!==void 0&&!v)if(i&&f===a?.data&&e.select===this.#h)f=this.#c;else try{this.#h=e.select,f=e.select(f),f=Se(i?.data,f,e),this.#c=f,this.#a=null}catch(R){this.#a=R}this.#a&&(p=this.#a,f=this.#c,m=Date.now(),y="error");let C=h.fetchStatus==="fetching",k=y==="pending",E=y==="error",w=k&&C,P=f!==void 0,x={status:y,fetchStatus:h.fetchStatus,isPending:k,isSuccess:y==="success",isError:E,isInitialLoading:w,isLoading:w,data:f,dataUpdatedAt:h.dataUpdatedAt,error:p,errorUpdatedAt:m,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:h.dataUpdateCount>u.dataUpdateCount||h.errorUpdateCount>u.errorUpdateCount,isFetching:C,isRefetching:C&&!k,isLoadingError:E&&!P,isPaused:h.fetchStatus==="paused",isPlaceholderData:l,isRefetchError:E&&P,isStale:mt(t,e),refetch:this.refetch,promise:this.#o,isEnabled:A(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){let R=x.data!==void 0,N=x.status==="error"&&!R,X=n(Oe=>{N?Oe.reject(x.error):R&&Oe.resolve(x.data)},"finalizeThenableIfPossible"),Vt=n(()=>{let Oe=this.#o=x.promise=we();X(Oe)},"recreateThenable"),Ie=this.#o;switch(Ie.status){case"pending":t.queryHash===s.queryHash&&X(Ie);break;case"fulfilled":(N||x.data!==Ie.value)&&Vt();break;case"rejected":(!N||x.error!==Ie.reason)&&Vt();break}}return x}updateResult(){let t=this.#r,e=this.createResult(this.#t,this.options);if(this.#n=this.#t.state,this.#i=this.options,this.#n.data!==void 0&&(this.#p=this.#t),ue(e,t))return;this.#r=e;let s=n(()=>{if(!t)return!0;let{notifyOnChangeProps:r}=this.options,i=typeof r=="function"?r():r;if(i==="all"||!i&&!this.#m.size)return!0;let a=new Set(i??this.#m);return this.options.throwOnError&&a.add("error"),Object.keys(this.#r).some(o=>{let c=o;return this.#r[c]!==t[c]&&a.has(c)})},"shouldNotifyListeners");this.#k({listeners:s()})}#C(){let t=this.#e.getQueryCache().build(this.#e,this.options);if(t===this.#t)return;let e=this.#t;this.#t=t,this.#s=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#v()}#k(t){S.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function Gr(t,e){return A(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&A(e.retryOnMount,t)===!1)}n(Gr,"shouldLoadOnMount");function ys(t,e){return Gr(t,e)||t.state.data!==void 0&&ft(t,e,e.refetchOnMount)}n(ys,"shouldFetchOnMount");function ft(t,e,s){if(A(e.enabled,t)!==!1&&j(e.staleTime,t)!=="static"){let r=typeof s=="function"?s(t):s;return r==="always"||r!==!1&&mt(t,e)}return!1}n(ft,"shouldFetchOn");function bs(t,e,s,r){return(t!==e||A(r.enabled,t)===!1)&&(!s.suspense||t.state.status!=="error")&&mt(t,s)}n(bs,"shouldFetchOptionally");function mt(t,e){return A(e.enabled,t)!==!1&&t.isStaleByTime(j(e.staleTime,t))}n(mt,"isStale");function Vr(t,e){return!ue(t.getCurrentResult(),e)}n(Vr,"shouldAssignObserverCurrentProperties");var gs=class extends Ue{static{n(this,"Mutation")}#e;#t;#s;#r;constructor(t){super(),this.#e=t.client,this.mutationId=t.mutationId,this.#s=t.mutationCache,this.#t=[],this.state=t.state||yt(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#t.includes(t)||(this.#t.push(t),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#t=this.#t.filter(e=>e!==t),this.scheduleGc(),this.#s.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#s.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(t){let e=n(()=>{this.#n({type:"continue"})},"onContinue"),s={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=De({fn:n(()=>this.options.mutationFn?this.options.mutationFn(t,s):Promise.reject(new Error("No mutationFn found")),"fn"),onFail:n((a,o)=>{this.#n({type:"failed",failureCount:a,error:o})},"onFail"),onPause:n(()=>{this.#n({type:"pause"})},"onPause"),onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:n(()=>this.#s.canRun(this),"canRun")});let r=this.state.status==="pending",i=!this.#r.canStart();try{if(r)e();else{this.#n({type:"pending",variables:t,isPaused:i}),this.#s.config.onMutate&&await this.#s.config.onMutate(t,this,s);let o=await this.options.onMutate?.(t,s);o!==this.state.context&&this.#n({type:"pending",context:o,variables:t,isPaused:i})}let a=await this.#r.start();return await this.#s.config.onSuccess?.(a,t,this.state.context,this,s),await this.options.onSuccess?.(a,t,this.state.context,s),await this.#s.config.onSettled?.(a,null,this.state.variables,this.state.context,this,s),await this.options.onSettled?.(a,null,t,this.state.context,s),this.#n({type:"success",data:a}),a}catch(a){try{await this.#s.config.onError?.(a,t,this.state.context,this,s)}catch(o){Promise.reject(o)}try{await this.options.onError?.(a,t,this.state.context,s)}catch(o){Promise.reject(o)}try{await this.#s.config.onSettled?.(void 0,a,this.state.variables,this.state.context,this,s)}catch(o){Promise.reject(o)}try{await this.options.onSettled?.(void 0,a,t,this.state.context,s)}catch(o){Promise.reject(o)}throw this.#n({type:"error",error:a}),a}finally{this.#s.runNext(this)}}#n(t){let e=n(s=>{switch(t.type){case"failed":return{...s,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...s,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:t.error,failureCount:s.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}},"reducer");this.state=e(this.state),S.batch(()=>{this.#t.forEach(s=>{s.onMutationUpdate(t)}),this.#s.notify({mutation:this,type:"updated",action:t})})}};function yt(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}n(yt,"getDefaultState");var vs=class extends U{static{n(this,"MutationCache")}constructor(t={}){super(),this.config=t,this.#e=new Set,this.#t=new Map,this.#s=0}#e;#t;#s;build(t,e,s){let r=new gs({client:t,mutationCache:this,mutationId:++this.#s,options:t.defaultMutationOptions(e),state:s});return this.add(r),r}add(t){this.#e.add(t);let e=Ke(t);if(typeof e=="string"){let s=this.#t.get(e);s?s.push(t):this.#t.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#e.delete(t)){let e=Ke(t);if(typeof e=="string"){let s=this.#t.get(e);if(s)if(s.length>1){let r=s.indexOf(t);r!==-1&&s.splice(r,1)}else s[0]===t&&this.#t.delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){let e=Ke(t);if(typeof e=="string"){let r=this.#t.get(e)?.find(i=>i.state.status==="pending");return!r||r===t}else return!0}runNext(t){let e=Ke(t);return typeof e=="string"?this.#t.get(e)?.find(r=>r!==t&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){S.batch(()=>{this.#e.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(t){let e={exact:!0,...t};return this.getAll().find(s=>Qe(e,s))}findAll(t={}){return this.getAll().filter(e=>Qe(t,e))}notify(t){S.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){let t=this.getAll().filter(e=>e.state.isPaused);return S.batch(()=>Promise.all(t.map(e=>e.continue().catch(T))))}};function Ke(t){return t.options.scope?.id}n(Ke,"scopeFor");var bt=class extends U{static{n(this,"MutationObserver")}#e;#t=void 0;#s;#r;constructor(t,e){super(),this.#e=t,this.setOptions(e),this.bindMethods(),this.#n()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){let e=this.options;this.options=this.#e.defaultMutationOptions(t),ue(this.options,e)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#s,observer:this}),e?.mutationKey&&this.options.mutationKey&&H(e.mutationKey)!==H(this.options.mutationKey)?this.reset():this.#s?.state.status==="pending"&&this.#s.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#s?.removeObserver(this)}onMutationUpdate(t){this.#n(),this.#i(t)}getCurrentResult(){return this.#t}reset(){this.#s?.removeObserver(this),this.#s=void 0,this.#n(),this.#i()}mutate(t,e){return this.#r=e,this.#s?.removeObserver(this),this.#s=this.#e.getMutationCache().build(this.#e,this.options),this.#s.addObserver(this),this.#s.execute(t)}#n(){let t=this.#s?.state??yt();this.#t={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#i(t){S.batch(()=>{if(this.#r&&this.hasListeners()){let e=this.#t.variables,s=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#r.onSuccess?.(t.data,e,s,r)}catch(i){Promise.reject(i)}try{this.#r.onSettled?.(t.data,null,e,s,r)}catch(i){Promise.reject(i)}}else if(t?.type==="error"){try{this.#r.onError?.(t.error,e,s,r)}catch(i){Promise.reject(i)}try{this.#r.onSettled?.(void 0,t.error,e,s,r)}catch(i){Promise.reject(i)}}}this.listeners.forEach(e=>{e(this.#t)})})}};var Ss=class extends U{static{n(this,"QueryCache")}constructor(t={}){super(),this.config=t,this.#e=new Map}#e;build(t,e,s){let r=e.queryKey,i=e.queryHash??ve(r,e),a=this.get(i);return a||(a=new ms({client:t,queryKey:r,queryHash:i,options:t.defaultQueryOptions(e),state:s,defaultOptions:t.getQueryDefaults(r)}),this.add(a)),a}add(t){this.#e.has(t.queryHash)||(this.#e.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){let e=this.#e.get(t.queryHash);e&&(t.destroy(),e===t&&this.#e.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){S.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#e.get(t)}getAll(){return[...this.#e.values()]}find(t){let e={exact:!0,...t};return this.getAll().find(s=>xe(e,s))}findAll(t={}){let e=this.getAll();return Object.keys(t).length>0?e.filter(s=>xe(t,s)):e}notify(t){S.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){S.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){S.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}};var gt=class{static{n(this,"QueryClient")}#e;#t;#s;#r;#n;#i;#o;#a;constructor(t={}){this.#e=t.queryCache||new Ss,this.#t=t.mutationCache||new vs,this.#s=t.defaultOptions||{},this.#r=new Map,this.#n=new Map,this.#i=0}mount(){this.#i++,this.#i===1&&(this.#o=ce.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#a=le.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#i--,this.#i===0&&(this.#o?.(),this.#o=void 0,this.#a?.(),this.#a=void 0)}isFetching(t){return this.#e.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#t.findAll({...t,status:"pending"}).length}getQueryData(t){let e=this.defaultQueryOptions({queryKey:t});return this.#e.get(e.queryHash)?.state.data}ensureQueryData(t){let e=this.defaultQueryOptions(t),s=this.#e.build(this,e),r=s.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&s.isStaleByTime(j(e.staleTime,s))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return this.#e.findAll(t).map(({queryKey:e,state:s})=>{let r=s.data;return[e,r]})}setQueryData(t,e,s){let r=this.defaultQueryOptions({queryKey:t}),a=this.#e.get(r.queryHash)?.state.data,o=ns(e,a);if(o!==void 0)return this.#e.build(this,r).setData(o,{...s,manual:!0})}setQueriesData(t,e,s){return S.batch(()=>this.#e.findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,s)]))}getQueryState(t){let e=this.defaultQueryOptions({queryKey:t});return this.#e.get(e.queryHash)?.state}removeQueries(t){let e=this.#e;S.batch(()=>{e.findAll(t).forEach(s=>{e.remove(s)})})}resetQueries(t,e){let s=this.#e;return S.batch(()=>(s.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){let s={revert:!0,...e},r=S.batch(()=>this.#e.findAll(t).map(i=>i.cancel(s)));return Promise.all(r).then(T).catch(T)}invalidateQueries(t,e={}){return S.batch(()=>(this.#e.findAll(t).forEach(s=>{s.invalidate()}),t?.refetchType==="none"?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e)))}refetchQueries(t,e={}){let s={...e,cancelRefetch:e.cancelRefetch??!0},r=S.batch(()=>this.#e.findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let a=i.fetch(void 0,s);return s.throwOnError||(a=a.catch(T)),i.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(r).then(T)}fetchQuery(t){let e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);let s=this.#e.build(this,e);return s.isStaleByTime(j(e.staleTime,s))?s.fetch(e):Promise.resolve(s.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(T).catch(T)}fetchInfiniteQuery(t){return t._type="infinite",this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(T).catch(T)}ensureInfiniteQueryData(t){return t._type="infinite",this.ensureQueryData(t)}resumePausedMutations(){return le.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#s}setDefaultOptions(t){this.#s=t}setQueryDefaults(t,e){this.#r.set(H(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){let e=[...this.#r.values()],s={};return e.forEach(r=>{ee(t,r.queryKey)&&Object.assign(s,r.defaultOptions)}),s}setMutationDefaults(t,e){this.#n.set(H(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){let e=[...this.#n.values()],s={};return e.forEach(r=>{ee(t,r.mutationKey)&&Object.assign(s,r.defaultOptions)}),s}defaultQueryOptions(t){if(t._defaulted)return t;let e={...this.#s.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=ve(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===he&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#s.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};var te=D(Z(),1);var Ce=D(Z(),1),Jr=D(nt(),1);function Yr(){let t=!1;return{clearReset:n(()=>{t=!1},"clearReset"),reset:n(()=>{t=!0},"reset"),isReset:n(()=>t,"isReset")}}n(Yr,"createValue");var Xr=Ce.createContext(Yr()),ws=n(()=>Ce.useContext(Xr),"useQueryErrorResetBoundary");var Cs=D(Z(),1);var ks=n((t,e,s)=>{let r=s?.state.error&&typeof t.throwOnError=="function"?de(t.throwOnError,[s.state.error,s]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},"ensurePreventErrorBoundaryRetry"),Ts=n(t=>{Cs.useEffect(()=>{t.clearReset()},[t])},"useClearResetErrorBoundary"),Es=n(({result:t,errorResetBoundary:e,throwOnError:s,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||de(s,[t.error,r])),"getHasError");var Ne=D(Z(),1);var Is=Ne.createContext(!1),Os=n(()=>Ne.useContext(Is),"useIsRestoring"),hh=Is.Provider;var Rs=n(t=>{if(t.suspense){let s=n(i=>i==="static"?i:Math.max(i??1e3,1e3),"clamp"),r=t.staleTime;t.staleTime=typeof r=="function"?(...i)=>s(r(...i)):s(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},"ensureSuspenseTimers"),As=n((t,e)=>t.isLoading&&t.isFetching&&!e,"willFetch"),Fs=n((t,e)=>t?.suspense&&e.isPending,"shouldSuspend"),vt=n((t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()}),"fetchOptimistic");function Ps(t,e,s){let r=Os(),i=ws(),a=be(s),o=a.defaultQueryOptions(t);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let c=a.getQueryCache().get(o.queryHash),u=t.subscribed!==!1;o._optimisticResults=r?"isRestoring":u?"optimistic":void 0,Rs(o),ks(o,i,c),Ts(i);let d=!a.getQueryCache().get(o.queryHash),[h]=te.useState(()=>new e(a,o)),l=h.getOptimisticResult(o),f=!r&&u;if(te.useSyncExternalStore(te.useCallback(p=>{let m=f?h.subscribe(S.batchCalls(p)):T;return h.updateResult(),m},[h,f]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),te.useEffect(()=>{h.setOptions(o)},[o,h]),Fs(o,l))throw vt(o,h,i);if(Es({result:l,errorResetBoundary:i,throwOnError:o.throwOnError,query:c,suspense:o.suspense}))throw l.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,l),o.experimental_prefetchInRender&&!W.isServer()&&As(l,r)&&(d?vt(o,h,i):c?.promise)?.catch(T).finally(()=>{h.updateResult()}),o.notifyOnChangeProps?l:h.trackResult(l)}n(Ps,"useBaseQuery");function Zr(t,e){return Ps(t,pt,e)}n(Zr,"useQuery");var G=D(Z(),1);function ei(t,e){let s=be(e),[r]=G.useState(()=>new bt(s,t));G.useEffect(()=>{r.setOptions(t)},[r,t]);let i=G.useSyncExternalStore(G.useCallback(o=>r.subscribe(S.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=G.useCallback((o,c)=>{r.mutate(o,c).catch(T)},[r]);if(i.error&&de(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}n(ei,"useMutation");var Qs=D(Yt(),1);var Q=D(Z(),1);var qe=n(t=>q(t),"o");var je=D(nt(),1);var Ms=n(t=>{t!==void 0&&(t.cancel({silent:!0}),t.setState({...t.state,data:void 0,dataUpdatedAt:0,error:null,fetchStatus:"idle",status:"pending"}))},"Q"),wt=class{static{n(this,"A")}constructor(e){this.client=e}client;entries=new Map;pushes=new Map;samples=new Map;identityWatched=new Set;listening=!1;hasConsumers(e){return this.entries.has(qe(e))}openSnapshotSample(e){let s=qe(e);return this.samples.set(s,(this.samples.get(s)??0)+1),{key:s,pushes:this.pushes.get(s)??0}}closeSnapshotSample(e){let s=(this.samples.get(e.key)??1)-1,r=(this.pushes.get(e.key)??0)===e.pushes;return s>0?(this.samples.set(e.key,s),r):(this.samples.delete(e.key),this.entries.has(e.key)||this.pushes.delete(e.key),r)}clearOnIdentityChange(e){this.listenForIdentityChange(),this.identityWatched.add(e)}stopClearingOnIdentityChange(e){this.identityWatched.delete(e)}subscribeIdentityEpoch=n(e=>(this.listenForIdentityChange(),this.client.onIdentityChange(e)),"subscribeIdentityEpoch");listenForIdentityChange(){this.listening||(this.listening=!0,this.client.onIdentityChange(()=>{for(let e of this.identityWatched)this.clearQueries(e)}))}clearQueries(e){let s=e.getQueryCache();for(let r of s.findAll({queryKey:["lunora"]}))Ms(r),r.getObserversCount()===0&&!this.hasConsumers(r.queryKey)&&s.remove(r)}attach(e,s,r,i,a,o={}){let c=qe(s),u=this.entries.get(c);if(!u){u={errorCallbacks:new Set,refCount:0,unsubscribe:void 0},this.entries.set(c,u);let l=u;try{u.unsubscribe=this.client.subscribe(r,i,f=>{if(this.pushes.set(c,(this.pushes.get(c)??0)+1),f===void 0){Ms(e.getQueryCache().find({exact:!0,queryKey:s}));return}e.setQueryData(s,f)},{onError:n(f=>{for(let p of l.errorCallbacks)p(f)},"onError"),shardKey:a})}catch(f){throw this.entries.delete(c),f}}u.refCount+=1;let{onError:d}=o;d&&u.errorCallbacks.add(d);let h=!1;return()=>{if(h)return;h=!0;let l=this.entries.get(c);l&&(l.refCount-=1,d&&l.errorCallbacks.delete(d),l.refCount<=0&&(l.unsubscribe?.(),this.entries.delete(c)))}}},xs=new WeakMap,St=n(t=>{let e=xs.get(t);return e||(e=new wt(t),xs.set(t,e)),e},"I"),_s=(0,Q.createContext)(null),ti=(0,Q.createContext)(!1),si=n(()=>new gt({defaultOptions:{mutations:{retry:0},queries:{gcTime:5*6e4,retry:0,staleTime:Number.POSITIVE_INFINITY}}}),"q"),ri=n(t=>{let e=(0,Qs.c)(20),{children:s,client:r,queryClient:i}=t,a=(0,Q.use)(ye),o;e[0]!==a||e[1]!==i?(o=n(()=>i??a??si(),"d"),e[0]=a,e[1]=i,e[2]=o):o=e[2];let[c]=(0,Q.useState)(o),u=i??a??c,d,h;e[3]!==r||e[4]!==u?(d=n(()=>{St(r).clearOnIdentityChange(u)},"u"),h=[r,u],e[3]=r,e[4]=u,e[5]=d,e[6]=h):(d=e[5],h=e[6]),(0,Q.useEffect)(d,h);let l=(0,Q.useRef)(r),f,p;e[7]!==r||e[8]!==u?(f=n(()=>{l.current!==r&&(St(l.current).stopClearingOnIdentityChange(u),l.current=r,St(r).clearQueries(u),u.invalidateQueries({queryKey:["lunora"]}))},"o"),p=[r,u],e[7]=r,e[8]=u,e[9]=f,e[10]=p):(f=e[9],p=e[10]),(0,Q.useEffect)(f,p);let[m]=(0,Q.useState)(r),y=r!==m,v;e[11]!==s||e[12]!==y?(v=(0,je.jsx)(ti,{value:y,children:s}),e[11]=s,e[12]=y,e[13]=v):v=e[13];let C;e[14]!==r||e[15]!==v?(C=(0,je.jsx)(_s,{value:r,children:v}),e[14]=r,e[15]=v,e[16]=C):C=e[16];let k=C;if(a===u)return k;let E;return e[17]!==k||e[18]!==u?(E=(0,je.jsx)(ot,{client:u,children:k}),e[17]=k,e[18]=u,e[19]=E):E=e[19],E},"V");var Ct=n(()=>{let t=(0,Q.use)(_s);if(!t)throw new b("INTERNAL","useLunora must be used inside <LunoraProvider />");return t},"_");var _=n(t=>new Promise((e,s)=>{t.addEventListener("success",()=>{e(t.result)}),t.addEventListener("error",()=>{s(t.error??new Error("IndexedDB request failed"))})}),"c"),Be=n((t,e,s,r)=>{let i;return()=>i||(i=new Promise((a,o)=>{let c=t.open(e,s);c.addEventListener("upgradeneeded",()=>{r(c.result)}),c.addEventListener("success",()=>{a(c.result)}),c.addEventListener("error",()=>{o(c.error??new Error("IndexedDB open failed"))})}),i)},"E"),$e=n((t,e)=>async(s,r)=>{let i=(await t()).transaction(e,s),a=await r(i.objectStore(e));return await new Promise((o,c)=>{i.addEventListener("complete",()=>{o()}),i.addEventListener("error",()=>{c(i.error??new Error("IndexedDB transaction failed"))}),i.addEventListener("abort",()=>{c(i.error??new Error("IndexedDB transaction aborted"))})}),a},"u");var ae=n((t,e,s)=>`${t}::${e}::${s??""}`,"T"),ii=500,ni=n((t,e)=>{if(!Number.isInteger(t)||t<1)throw new b("INTERNAL",`${e}: maxEntries must be a positive integer, got ${String(t)}`);return t},"E");var ai="lunora-query-cache",oi="query-cache",Ls="by_ts",ci=1,ui=n((t={})=>{let e=t.indexedDB??(typeof indexedDB>"u"?void 0:indexedDB);if(!e)throw new b("INTERNAL","createIndexedDbQueryCache: no IndexedDB available \u2014 pass `indexedDB` or use createInMemoryQueryCache()");let s=t.databaseName??ai,r=t.storeName??oi,i=ni(t.maxEntries??ii,"createIndexedDbQueryCache"),a=Be(e,s,ci,u=>{u.objectStoreNames.contains(r)||u.createObjectStore(r,{keyPath:"key"}).createIndex(Ls,"ts",{unique:!1})}),o=$e(a,r),c=n(async u=>{let d=await _(u.count())-i;d<=0||await new Promise((h,l)=>{let f=u.index(Ls).openCursor();f.addEventListener("success",()=>{let p=f.result;if(!p||d<=0){h();return}p.delete(),d-=1,p.continue()}),f.addEventListener("error",()=>{l(f.error??new Error("IndexedDB eviction failed"))})})},"y");return{clear:n(async()=>{await o("readwrite",u=>_(u.clear()))},"clear"),load:n(async()=>o("readonly",u=>_(u.getAll())),"load"),put:n(async(u,d)=>{await o("readwrite",async h=>{await _(h.put({...d,key:u})),await c(h)})},"put"),remove:n(async u=>{await o("readwrite",d=>_(d.delete(u)))},"remove")}},"N"),Ds=n(t=>{if(t!==!1){if(t)return t;if(!(typeof indexedDB>"u"))return ui()}},"L");var Us=n(()=>{let t=null;return{get:n(()=>t,"get"),set:n(e=>{t=e},"set")}},"r");var He=class{static{n(this,"u")}values=new Map;subscribers=new Map;get(e){return this.values.has(e.key)?this.values.get(e.key):e.defaultValue}set(e,s){if(s===void 0){this.reset(e);return}this.values.set(e.key,s),this.notify(e.key,s)}reset(e){this.values.delete(e.key),this.notify(e.key,e.defaultValue)}clear(){this.values.clear(),this.subscribers.clear()}subscribe(e,s){let r=this.subscribers.get(e.key);return r||(r=new Set,this.subscribers.set(e.key,r)),r.add(s),()=>{r.delete(s),r.size===0&&this.subscribers.delete(e.key)}}notify(e,s){let r=this.subscribers.get(e);if(r)for(let i of r)try{i(s)}catch{}}};var Ks=0,hi="lunora-bridge",di=1e3,li=3e3,We=class{static{n(this,"l")}bc;tabId;heartbeatInterval;leaderTimeout;knownLeader=void 0;leader=!1;running=!1;promotionPending=!1;lastHeartbeat=0;heartbeatTimer=void 0;leaderCheckTimer=void 0;onBecomeLeader;onStopBeingLeader;onConnectionStatus;onSubscriptionData;onLeaderClaimAnswered;onSubscriptionError;onSubscriptionSettled;constructor(e={}){if(Ks+=1,this.tabId=`tab_${String(Ks)}_${crypto.randomUUID()}`,this.heartbeatInterval=e.heartbeatInterval??di,this.leaderTimeout=e.leaderTimeout??li,this.onBecomeLeader=e.onBecomeLeader,this.onStopBeingLeader=e.onStopBeingLeader,this.onConnectionStatus=e.onConnectionStatus,this.onSubscriptionData=e.onSubscriptionData,this.onLeaderClaimAnswered=e.onLeaderClaimAnswered,this.onSubscriptionError=e.onSubscriptionError,this.onSubscriptionSettled=e.onSubscriptionSettled,typeof BroadcastChannel>"u"){this.bc=void 0;return}this.bc=new BroadcastChannel(e.channelName??hi),this.bc.addEventListener("message",s=>{this.handleMessage(s.data)})}start(){if(!this.running){if(this.running=!0,this.bc===void 0){this.becomeLeader();return}this.broadcast({type:"claim-leadership",tabId:this.tabId,ts:Date.now()}),setTimeout(()=>{this.running&&this.knownLeader===void 0&&this.becomeLeader()},this.leaderTimeout),this.leaderCheckTimer=setInterval(()=>{this.checkLeaderHealth()},this.leaderTimeout),this.heartbeatTimer=setInterval(()=>{this.sendHeartbeat()},this.heartbeatInterval)}}stop(){this.running=!1,this.leader&&(this.broadcast({type:"yield-leadership",tabId:this.tabId}),this.leader=!1,this.knownLeader=void 0,this.onStopBeingLeader?.()),this.heartbeatTimer!==void 0&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0),this.leaderCheckTimer!==void 0&&(clearInterval(this.leaderCheckTimer),this.leaderCheckTimer=void 0),this.bc?.close()}isLeader(){return this.leader}promoteImmediately(){this.running&&this.becomeLeader()}get leaderTabId(){return this.knownLeader}get id(){return this.tabId}get isRunning(){return this.running}broadcastSubscriptionData(e,s,r,i,a){this.leader&&this.broadcast({type:"subscription-data",tabId:this.tabId,key:e,data:s,...r===void 0?{}:{cursor:r},...i===void 0?{}:{epoch:i},...a===void 0?{}:{identity:a}})}broadcastSubscriptionError(e,s,r){this.leader&&this.broadcast({type:"subscription-error",tabId:this.tabId,key:e,error:s,...r===void 0?{}:{identity:r}})}broadcastSubscriptionSettled(e,s,r,i,a,o){this.leader&&this.broadcast({type:"subscription-settled",tabId:this.tabId,key:e,...s===void 0?{}:{cursor:s},...r===void 0?{}:{epoch:r},...i===void 0?{}:{lastMutationId:i},...a===void 0?{}:{clientId:a},...o===void 0?{}:{identity:o}})}broadcastConnectionStatus(e,s){this.leader&&this.broadcast({type:"connection-status",tabId:this.tabId,status:e,...s===void 0?{}:{identity:s}})}broadcast(e){this.bc?.postMessage(e)}handleMessage(e){switch(e.type){case"claim-leadership":{this.handleClaimLeadership(e);break}case"connection-status":{if(this.leader||e.tabId===this.tabId)break;this.onConnectionStatus?.(e.status,e.identity);break}case"heartbeat":{this.handleHeartbeat(e);break}case"subscription-data":{if(this.leader||e.tabId===this.tabId)break;this.onSubscriptionData?.(e.key,e.data,e.cursor,e.epoch,e.identity);break}case"subscription-error":{if(this.leader||e.tabId===this.tabId)break;this.onSubscriptionError?.(e.key,e.error,e.identity);break}case"subscription-settled":{if(this.leader||e.tabId===this.tabId)break;this.onSubscriptionSettled?.(e.key,e.cursor,e.epoch,e.lastMutationId,e.clientId,e.identity);break}case"yield-leadership":{this.knownLeader===e.tabId&&(this.knownLeader=void 0,this.running&&!this.leader&&this.claimAndPromote());break}}}handleClaimLeadership(e){if(e.tabId!==this.tabId){if(this.leader){this.broadcast({type:"heartbeat",tabId:this.tabId,ts:Date.now()}),this.onLeaderClaimAnswered?.();return}this.knownLeader===void 0&&e.tabId<this.tabId&&(this.knownLeader=e.tabId,this.lastHeartbeat=e.ts)}}handleHeartbeat(e){if(e.tabId!==this.tabId){if(this.leader){this.resolveLeaderVsLeaderTieBreak(e);return}this.lastHeartbeat=e.ts,this.knownLeader=e.tabId}}resolveLeaderVsLeaderTieBreak(e){e.tabId<this.tabId?(this.leader=!1,this.knownLeader=e.tabId,this.lastHeartbeat=e.ts,this.onStopBeingLeader?.()):this.broadcast({type:"heartbeat",tabId:this.tabId,ts:Date.now()})}becomeLeader(){this.leader||(this.leader=!0,this.knownLeader=this.tabId,this.lastHeartbeat=Date.now(),this.onBecomeLeader?.(),this.broadcast({type:"heartbeat",tabId:this.tabId,ts:Date.now()}))}sendHeartbeat(){this.leader&&this.broadcast({type:"heartbeat",tabId:this.tabId,ts:Date.now()})}checkLeaderHealth(){if(!(!this.running||this.leader)){if(this.knownLeader===void 0){this.claimAndPromote();return}Date.now()-this.lastHeartbeat>this.leaderTimeout&&(this.knownLeader=void 0,this.claimAndPromote())}}claimAndPromote(){this.promotionPending||(this.promotionPending=!0,this.broadcast({type:"claim-leadership",tabId:this.tabId,ts:Date.now()}),setTimeout(()=>{this.promotionPending=!1,this.running&&this.knownLeader===void 0&&this.becomeLeader()},this.leaderTimeout))}};var fi=n(t=>{if(t===null||typeof t!="object")return!1;let e=Object.getPrototypeOf(t);return e===null||e===Object.prototype},"y"),kt="_id",Tt="_creationTime",Et="page",Ns="pageDelta",pi=n(t=>{if(Array.isArray(t))return t;if(fi(t)&&Array.isArray(t[Et]))return t[Et]},"g"),mi=n(t=>{let e;for(let s of t){let r=s[Tt];if(typeof r=="number"){if(e!==void 0){if(r<e)return!0;if(r>e)return!1}e=r}}return!1},"A"),yi=n((t,e)=>{let s=e[Tt];if(typeof s!="number")return t.length;let r=mi(t);for(let[i,a]of t.entries()){let o=a[Tt];if(typeof o=="number"&&(r?o<s:o>s))return i}return t.length},"x"),bi=n(t=>{if(typeof t!="object"||t===null)return;let e=t[kt];return typeof e=="string"?e:void 0},"b"),gi=n(t=>{if(typeof t!="object"||t===null)return!1;let e=t;return typeof e.key=="string"&&typeof e.table=="string"&&(e.op==="insert"||e.op==="update"||e.op==="delete")},"D"),vi=n((t,e)=>{let s=[];for(let u of t){if(bi(u)===void 0)return;s.push(u)}let{key:r,op:i,row:a}=e;if(i==="delete"){let u=s.filter(d=>d[kt]!==r);return u.length===s.length?[...s]:u}if(a===void 0)return;let o=[...s],c=s.findIndex(u=>u[kt]===r);return c===-1?o.splice(yi(s,a),0,a):o[c]=a,o},"E"),Si=n((t,e)=>{let s=pi(t);if(s===void 0)return;let r=vi(s,e);return r===void 0||Array.isArray(t)?r:{...t,[Et]:r}},"I"),It=Symbol("lunora.unmergeableDelta"),qs=n((t,e)=>{if("data"in t&&t.data!==void 0)return I(t.data);let s=I(t.delta);return gi(s)?e===void 0?s:Si(e,s)??It:s},"P");var od=new Set(Object.keys(Jt)),z=class extends b{static{n(this,"R")}constructor(e,s){super("INTERNAL",e,{data:s})}};var ze=n(t=>{let e=t?.data?.retryAfterMs;return typeof e=="number"&&Number.isFinite(e)?e:void 0},"f"),Ot=new Set(["TOKEN_EXPIRED","UNAUTHENTICATED"]),Ge=n(t=>Ot.has(t?.code??""),"u");var ke=n((t={},e=Math.random)=>{let s=t.initialDelayMs??250,r=t.maxDelayMs??3e4,i=t.jitter??!0,a=0;return{next(){let o=Math.min(r,s*2**a);if(a+=1,!i)return o;let c=o/2;return Math.floor(c+e()*(o-c))},reset(){a=0}}},"s");var wi=1024,Ve=n(t=>{let e=t.maxBuffer??wi,s=[],r=[],i=!1,a,o=!1,c=n(()=>{let h=r.shift();if(!h)return!1;if(a)return h.reject(a),!0;if(s.length>0){let l=s.shift();return h.resolve({done:!1,value:l}),!0}return i?(h.resolve({done:!0,value:void 0}),!0):(r.unshift(h),!1)},"u"),u={complete(){if(!(i||a))for(i=!0;c(););},fail(h){if(!(i||a)){for(a=h,s.length=0;c(););t.onFail?.()}},push(h){if(!(i||a||o)){if(s.length>=e){u.fail(new b("STREAM_BACKPRESSURE",`stream buffer overflow (max=${e.toString()}); the consumer cannot keep up with the producer`));return}s.push(h),c()}}},d=n(()=>{if(!o){o=!0,i=!0,s.length=0;try{t.onCancel()}catch{}for(;c(););}},"c");return{handle:u,iterable:{cancel:d,[Symbol.asyncIterator](){return{next(){if(a)return Promise.reject(a);if(s.length>0){let h=s.shift();return Promise.resolve({done:!1,value:h})}return i?Promise.resolve({done:!0,value:void 0}):new Promise((h,l)=>{r.push({reject:l,resolve:h})})},return(){return d(),Promise.resolve({done:!0,value:void 0})}}}}}},"p");var Je=/^ /u,Ci=/^\d+$/u,ki=2147483647,Ti=10,js=n(t=>typeof t=="object"&&t!==null?JSON.stringify(t):String(t),"w"),Ei=n(t=>{let e="",s,r,i=[];for(let a of t.split(`
|
|
2
|
+
`))if(a.startsWith("event:"))e=a.slice(6).replace(Je,"");else if(a.startsWith("data:"))i.push(a.slice(5).replace(Je,""));else if(a.startsWith("id:")){let o=a.slice(3).replace(Je,"");o.includes("\0")||(s=o)}else if(a.startsWith("retry:")){let o=a.slice(6).replace(Je,"");Ci.test(o)&&Number.isSafeInteger(Number(o))&&(r=Math.min(Number(o),ki))}return{data:i.join(`
|
|
3
|
+
`),event:e,id:s,retry:r}},"H"),Ii=n((t,e,s)=>{let r=e.params??{},i=t.path.split("/").map(c=>{if(!c.startsWith(":"))return c;let u=c.slice(1),d=r[u];if(d===void 0)throw new b("HTTP_STREAM_MISSING_PARAM",`httpStream: missing path param ":${u}" for route ${t.path}`);return encodeURIComponent(js(d))}).join("/"),a=new URLSearchParams;for(let[c,u]of Object.entries(e.searchParams??{}))u!==void 0&&a.set(c,js(u));let o=a.toString();return`${s.endsWith("/")?s.slice(0,-1):s}${i}${o===""?"":`?${o}`}`},"x"),Oi=n((t,e)=>{if(t.event==="complete")return e.complete(),!0;if(t.event==="error"){let s={};try{s=JSON.parse(t.data)}catch{}let r=typeof s.message=="string"?s.message:"stream error",i=typeof s.code=="string"?s.code:"HTTP_STREAM_ERROR";return e.fail(new b(i,r)),!0}if((t.event===""||t.event==="message")&&t.data!=="")try{e.push(I(JSON.parse(t.data)))}catch{return e.fail(new b("HTTP_STREAM_BAD_CHUNK","httpStream: malformed SSE chunk (invalid JSON)")),!0}return!1},"k"),Ri=n(async(t,e,s)=>{let r=t.getReader(),i=new TextDecoder,a="",o=!1,c=n(h=>{let l=o?`\r${h}`:h;o=l.endsWith("\r"),o&&(l=l.slice(0,-1)),a+=l.replaceAll(`\r
|
|
4
|
+
`,`
|
|
5
|
+
`)},"p"),u=n(()=>{let h=a.indexOf(`
|
|
6
|
+
|
|
7
|
+
`);for(;h!==-1;){let l=Ei(a.slice(0,h));if(a=a.slice(h+2),s.onFrame?.(),l.id!==void 0&&s.onId?.(l.id),l.retry!==void 0&&s.onRetry?.(l.retry),Oi(l,e))return!0;h=a.indexOf(`
|
|
8
|
+
|
|
9
|
+
`)}return!1},"o"),d=n(()=>r.cancel().then(()=>{},()=>{}),"f");try{for(;;){let{done:h,value:l}=await r.read();if(h)break;if(c(i.decode(l,{stream:!0})),u())return await d(),!0}return c(i.decode()),u()}catch(h){throw await d(),h}},"F"),Ai=n(async(t,e)=>{e.aborted||await new Promise(s=>{let r,i=n(()=>{clearTimeout(r),s()},"d");r=setTimeout(()=>{e.removeEventListener("abort",i),s()},t),e.addEventListener("abort",i,{once:!0})})},"$"),Fi=n((t,e)=>{let s=Object.entries(t??{}).filter(([r])=>e===void 0||r.toLowerCase()!=="last-event-id");return{accept:"text/event-stream",...Object.fromEntries(s),...e===void 0?{}:{"last-event-id":e}}},"B"),Bs=n(t=>t instanceof Error&&"code"in t?t:new b("HTTP_STREAM_TRANSPORT",t instanceof Error?t.message:String(t),{cause:t}),"_"),$s=n((t,e,s={})=>{let r=s.fetch??(typeof fetch=="function"?fetch.bind(globalThis):void 0);if(!r)throw new b("INTERNAL","httpStream: no `fetch` implementation available");let i=Ii(t,e??{},s.baseUrl??""),a=new AbortController,o;s.signal&&(s.signal.aborted?a.abort():(o=n(()=>{a.abort()},"a"),s.signal.addEventListener("abort",o,{once:!0})));let c=n(()=>{o&&s.signal?.removeEventListener("abort",o)},"p"),{handle:u,iterable:d}=Ve({maxBuffer:s.maxBuffer,onCancel:n(()=>{a.abort()},"onCancel"),onFail:n(()=>{a.abort()},"onFail")}),h=s.reconnect??!1,l=ke(),{lastEventId:f}=s,p,m=0,y=n(()=>{l.reset(),m=0},"g"),v={},C=n(w=>{try{w()}catch(P){throw v.value={error:P},P}},"R"),k={onFrame:y,onId:n(w=>{C(()=>s.onEventId?.(w)),f=w},"onId"),onRetry:n(w=>{C(()=>s.onRetry?.(w)),p=w},"onRetry")},E=n(async()=>{let w=Fi(s.headers,f),P=new b("HTTP_STREAM_INTERRUPTED","httpStream: stream ended without a complete frame");try{let M=await r(i,{headers:w,method:t.method,signal:a.signal});if(!M.ok){await M.body?.cancel().catch(()=>{}),u.fail(new b("HTTP_STREAM_STATUS",`httpStream: request failed (status ${M.status.toString()})`,{status:M.status}));return}if(!M.body){u.fail(new b("HTTP_STREAM_NO_BODY","httpStream: response has no body"));return}return{completed:await Ri(M.body,u,k),error:P}}catch(M){if(a.signal.aborted){u.complete();return}if(v.value){let{error:x}=v.value;u.fail(x instanceof Error?x:new b("HTTP_STREAM_CALLBACK","httpStream: an onEventId/onRetry callback threw"));return}return{completed:!1,error:Bs(M)}}},"M");return(async()=>{try{for(;;){if(a.signal.aborted){u.complete();return}let w=await E();if(!w)return;if(w.completed||!h||m>=Ti){w.completed||u.fail(w.error);return}m+=1,await Ai(p??l.next(),a.signal)}}finally{c()}})().catch(w=>{if(a.signal.aborted){u.complete();return}u.fail(Bs(w))}),d},"J");var L=class t{static{n(this,"t")}static key(e,s,r){return`${e}::${q(s)}::${r??""}`}static keyOf(e){return`${e.fn.__lunoraRef}::${e.argsKey}::${e.shardKey??""}`}byKey=new Map;byId=new Map;get(e){return this.byKey.get(e)}getById(e){return this.byId.get(e)}add(e){this.byKey.set(t.keyOf(e),e),this.byId.set(e.id,e)}remove(e){let s=t.keyOf(e);this.byKey.get(s)===e&&this.byKey.delete(s),this.byId.delete(e.id)}all(){return[...this.byKey.values()]}clear(){this.byKey.clear(),this.byId.clear()}};function Ye(t){if(t!==void 0)return e=>{t(e)}}n(Ye,"b");var V=n((t,e)=>{for(let s of t)try{s(e)}catch{}},"d");var Rt=0,Hs=n(()=>Rt,"h"),Pi=n((t,e)=>{let s=t;for(let r of e)try{s=r.transform(s)}catch{}return s},"p"),Ws=n((t,e)=>{if(e!==t.lastValue){t.lastValue=e;for(let s of t.callbacks)try{s(e)}catch{}}},"d"),se=n((t,e)=>{Ws(t,Pi(e,t.optimisticLayers))},"y"),At=n((t,e)=>{let s;try{s=e(t.lastValue)}catch{return}let r={id:Symbol("optimistic"),transform:e},i=!1;t.optimisticLayers.push(r),Ws(t,s);let a=n(()=>{let c=t.optimisticLayers.findIndex(u=>u.id===r.id);return c===-1?!1:(t.optimisticLayers.splice(c,1),!0)},"l"),o=n(()=>{se(t,t.serverBase)},"s");return{confirm:n(c=>{if(c===void 0){a();return}r.commitCursor=c,Rt+=1,r.acknowledgedAt=Rt,t.serverCursor!==void 0&&t.serverCursor>=c&&a()&&o()},"confirm"),rollback:n(()=>{i||(i=!0,a(),o())},"rollback")}},"g"),Xe=n((t,e)=>{if(e===void 0||t.optimisticLayers.length===0)return!1;let s=t.optimisticLayers.length;return t.optimisticLayers=t.optimisticLayers.filter(r=>r.commitCursor===void 0||r.commitCursor>e),t.optimisticLayers.length!==s},"k"),zs=n((t,e)=>{t.optimisticLayers.length!==0&&(t.optimisticLayers=t.optimisticLayers.filter(s=>s.acknowledgedAt===void 0||s.acknowledgedAt>e))},"b"),fe=n(t=>{for(let e=t.length-1;e>=0;e-=1)t[e]?.()},"v"),Gs=n((t,e)=>{let s=[],r=[],i=n((a,o)=>t.get(L.key(a,o,e)),"c");return{confirms:s,rollbacks:r,store:{getAllQueries:n(a=>{let o=[];for(let c of t.all())c.fn.__lunoraRef===a.__lunoraRef&&(c.shardKey??"")===(e??"")&&o.push({args:c.args,value:c.lastValue});return o},"getAllQueries"),getQuery:n((a,o)=>i(a.__lunoraRef,o??{})?.lastValue,"getQuery"),setQuery:n((a,o,c)=>{let u=i(a.__lunoraRef,o??{});if(!u)return;let d=At(u,()=>c);d&&(s.push(d.confirm),r.push(d.rollback))},"setQuery")}}},"_");var Ft=n(t=>{if(t===null)return;let e=Number(t);if(Number.isFinite(e))return e>0?e*1e3:void 0;let s=Date.parse(t);if(Number.isNaN(s))return;let r=s-Date.now();return r>0?r:void 0},"f"),Mi=n((t,e)=>{let s=Ft(e);if(!(s===void 0||ze(t)!==void 0))return t.data===void 0?{retryAfterMs:s}:typeof t.data=="object"&&t.data!==null&&!Array.isArray(t.data)?{...t.data,retryAfterMs:s}:void 0},"v"),pe=n(t=>{let e=t?.error;return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0},"l"),xi=n(()=>new z("LunoraClient: batch slot carried no error envelope"),"m"),Vs=n((t,e)=>{let s=t.error,r=typeof s?.code=="string"?s.code:void 0,i=typeof s?.message=="string"?s.message:void 0;return{code:r,messageText:(typeof t.message=="string"?t.message:void 0)??i??e}},"s"),Js=n(t=>{let{code:e,messageText:s}=Vs(t,"stream error");return e===void 0?new Error(s):new b(e,s)},"g"),Pt=n(t=>{let{code:e,messageText:s}=Vs(t,"subscription error");return{message:s,...e===void 0?{}:{code:e}}},"A"),Ze=n(t=>{let e=new Error(t.message??"request failed");if(e.code=t.code,t.data!==void 0)try{e.data=I(t.data)}catch{}return t.hint!==void 0&&(e.hint=t.hint),t.docsUrl!==void 0&&(e.docsUrl=t.docsUrl),e},"n"),Mt=n((t,e)=>{let s=Ze(t),r=Mi(s,e);return r!==void 0&&(s.data=r),s},"y"),et=n(t=>{let e=pe(t);return e===void 0?xi():Ze(e)},"h");var Ys=0,Qi=n(()=>{if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();Ys+=1;let t=typeof crypto<"u"&&typeof crypto.getRandomValues=="function"?Array.from(crypto.getRandomValues(new Uint8Array(8)),e=>e.toString(16).padStart(2,"0")).join(""):Math.random().toString(16).slice(2,12);return`id_${Date.now().toString(36)}_${Ys.toString(36)}_${t}`},"d"),xt=n((t,e)=>t!==void 0&&e!==t,"f"),st=Qi,re=n((t,e,s,r)=>{if(t)try{t({error:s,mutationId:r,operation:e});return}catch{}console.warn(`[lunora] offline-queue persistence ${e} failed`,s)},"o"),tt=class{static{n(this,"l")}queueBeforeFirstConnect;maxItems;onPersistenceError;persistence;onEvict;onSizeChange;version;items=[];constructor(e={},s={}){this.maxItems=e.maxItems??1e3,this.queueBeforeFirstConnect=e.queueBeforeFirstConnect??!1,this.onPersistenceError=e.onPersistenceError,this.persistence=s.persistence,this.onEvict=s.onEvict,this.onSizeChange=s.onSizeChange,this.version=s.version}get size(){return this.items.length}enqueue(e){let s=e;s.id??=st(),this.items.push(s),this.persistence?.append({args:s.args,...s.baselineSeq===void 0?{}:{baselineSeq:s.baselineSeq},clientId:s.clientId,functionPath:s.functionPath,id:s.id,identity:s.identity,shardKey:s.shardKey,...this.version===void 0?{}:{version:this.version}}).catch(r=>{re(this.onPersistenceError,"append",r,s.id)}),this.evictOverflow(),this.notifySize()}async hydrate(){if(!this.persistence)return[];let e;try{e=await this.persistence.load()}catch(o){throw re(this.onPersistenceError,"load",o),o}let s=[],r=new Set(this.items.map(o=>o.id));for(let o of e)if(!r.has(o.id)){if(xt(this.version,o.version)){this.persistence.remove(o.id).catch(c=>{re(this.onPersistenceError,"remove",c,o.id)});continue}r.add(o.id),s.push({args:o.args,baselineSeq:o.baselineSeq,clientId:o.clientId,functionPath:o.functionPath,id:o.id,identity:o.identity,reject:n(()=>{},"reject"),resolve:n(()=>{},"resolve"),shardKey:o.shardKey})}this.items.unshift(...s),this.evictOverflow(),this.notifySize();let i=new Set(this.items),a=new Set;for(let o of s)i.has(o)&&a.add(o.shardKey);return[...a]}restampIdentity(e,s){for(let r of this.items){if(r.identity!==e)continue;r.identity=s;let{id:i}=r;if(!this.persistence||i===void 0)continue;let a={args:r.args,...r.baselineSeq===void 0?{}:{baselineSeq:r.baselineSeq},clientId:r.clientId,functionPath:r.functionPath,id:i,identity:s,shardKey:r.shardKey,...this.version===void 0?{}:{version:this.version}};this.rewriteStamp(i,a).catch(o=>{re(this.onPersistenceError,"replace",o,i)})}}hasPending(e){return this.items.some(s=>e(s))}drain(e){if(!e){let i=[...this.items];return this.items.length=0,this.notifySize(),i}let s=[],r=[];for(let i of this.items)(e(i)?s:r).push(i);return this.items.length=0,this.items.push(...r),this.notifySize(),s}requeue(e){e.length!==0&&(this.items.unshift(...e),this.notifySize())}drainConflict(){let e=[],s=[];for(let r of this.items)if(r.precondition!==void 0&&!r.precondition()){let i=new Error("offline mutation skipped: precondition failed before replay");i.code="OFFLINE_PRECONDITION_FAILED",r.reject(i),e.push(r)}else s.push(r);return e.length>0&&(this.items.length=0,this.items.push(...s),this.notifySize()),e}clear(){for(let e of this.items){let s=new Error("CLIENT_CLOSED");s.code="CLIENT_CLOSED",e.reject(s)}this.items.length=0,this.notifySize()}async rewriteStamp(e,s){let r=this.persistence;if(r)try{await r.replace(s)}catch(i){re(this.onPersistenceError,"replace",i,e)}}evictOverflow(){for(;this.items.length>this.maxItems;){let e=this.items.shift();if(e){e.id&&this.persistence?.remove(e.id).catch(r=>{re(this.onPersistenceError,"remove",r,e.id)});let s=new Error("offline queue overflow");s.code="OFFLINE_QUEUE_OVERFLOW",e.reject(s),this.onEvict?.(e,s)}}}notifySize(){this.onSizeChange?.(this.items.length)}};var _i="lunora-outbox",Li="offline-mutations",Qt="by_id",Di=n((t={})=>{let e=t.indexedDB??(typeof indexedDB>"u"?void 0:indexedDB);if(!e)throw new b("INTERNAL","createIndexedDbPersistence: no IndexedDB available \u2014 pass `indexedDB` or use createInMemoryPersistence()");let s=t.databaseName??_i,r=t.storeName??Li,i=Be(e,s,1,o=>{o.objectStoreNames.contains(r)||o.createObjectStore(r,{autoIncrement:!0}).createIndex(Qt,"id",{unique:!0})}),a=$e(i,r);return{append:n(async o=>{await a("readwrite",c=>_(c.add(o)))},"append"),clear:n(async()=>{await a("readwrite",o=>_(o.clear()))},"clear"),load:n(async()=>a("readonly",o=>_(o.getAll())),"load"),remove:n(async o=>{await a("readwrite",async c=>{let u=await _(c.index(Qt).getKey(o));u!==void 0&&await _(c.delete(u))})},"remove"),replace:n(async o=>{await a("readwrite",async c=>{let u=await _(c.index(Qt).getKey(o.id));u!==void 0&&await _(c.put(o,u))})},"replace")}},"w"),Xs=n((t,e=!0)=>{if(t!==!1){if(t)return t;if(!(!e||typeof indexedDB>"u"))return Di()}},"b");var Zs=n((t,e,s,r)=>{let i=t.peekActiveQuerySnapshot(e.__lunoraRef,s,r),a=i.present?q(i.value):void 0;return()=>{let o=t.peekActiveQuerySnapshot(e.__lunoraRef,s,r);return!i.present||!o.present?!0:q(o.value)===a}},"c");var _t=500,or=n((t,e)=>{if(t.size<e)return;let s=t.keys().next().value;s!==void 0&&t.delete(s)},"ge"),J="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",Ui=n(t=>{let e="",s=0,r=t.length-2;for(;s<r;s+=3){let a=t[s]<<16|t[s+1]<<8|t[s+2];e+=J.charAt(a>>18&63)+J.charAt(a>>12&63)+J.charAt(a>>6&63)+J.charAt(a&63)}let i=t.length-s;if(i===1){let a=t[s]<<16;e+=J.charAt(a>>18&63)+J.charAt(a>>12&63)}else if(i===2){let a=t[s]<<16|t[s+1]<<8;e+=J.charAt(a>>18&63)+J.charAt(a>>12&63)+J.charAt(a>>6&63)}return e},"et");new TextDecoder;var Ki=new TextEncoder,Ni=n(t=>Ui(Ki.encode(JSON.stringify(t))),"st"),qi="x-lunora-expect-subject",ji=n(t=>Ni({subject:t}),"it"),er=Symbol.for("lunora:session-change"),Bi="lunora:session-change",$i="better-auth.message",Hi="signout",cr=n(()=>{let t=globalThis,e=t[er];return e===void 0&&(e={detach:void 0,listeners:new Set,tab:`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`},t[er]=e),e},"Te"),Wi=n(()=>"document"in globalThis,"ct"),zi=n(async()=>{let t=[];for(let e of cr().listeners)try{t.push(e())}catch{}await Promise.allSettled(t)},"dt"),Gi=n((t,e)=>{if(t!==$i||e===null)return!1;try{let s=JSON.parse(e);return s?.event==="session"&&s.data?.trigger===Hi}catch{return!1}},"ht"),Vi=n(t=>{let e=[],s=n(()=>{zi().catch(()=>{})},"t"),r;try{r=typeof BroadcastChannel=="function"?new BroadcastChannel(Bi):void 0}catch{r=void 0}if(r!==void 0){let a=r;a.addEventListener("message",o=>{o.data?.type==="lunora:session-change"&&o.data.tab!==t&&s()}),e.push(()=>{a.close()})}let i=globalThis;if(typeof i.addEventListener=="function"){let a=n(o=>{Gi(o.key,o.newValue)&&s()},"n");i.addEventListener("storage",a),e.push(()=>{i.removeEventListener?.("storage",a)})}return()=>{for(let a of e)a()}},"ut"),Ji=n(t=>{let e=cr();return e.listeners.add(t),e.detach===void 0&&Wi()&&(e.detach=Vi(e.tab)),()=>{e.listeners.delete(t),e.listeners.size===0&&(e.detach?.(),e.detach=void 0)}},"lt"),Yi="/_lunora/rpc",Lt="/_lunora/rpc-batch",Xi="/_lunora/ws",Zi="/_lunora/admin/shard-traffic",en="/_lunora/admin/scheduled",tn="/_lunora/admin/scheduled/status",sn="/_lunora/admin/scheduled/ws",rn="/_lunora/admin/scheduled/cancel",tr="/_lunora/admin/scheduled/dead",nn="/_lunora/admin/scheduled/dead/retry",an="/_lunora/admin/scheduled/dead/cancel",on="/_lunora/admin/workflows/instances",cn="/_lunora/admin/workflows/instance",un="/_lunora/admin/workflows/status",Ht="/_lunora/admin/storage",hn="/_lunora/admin/storage/url",dn="/_lunora/admin/storage/buckets",ln="/_lunora/admin/functions",fn="/_lunora/admin/cron-jobs",pn="/_lunora/admin/cron-jobs/run",mn="/_lunora/admin/architecture",yn="/_lunora/admin/openapi",bn="/_lunora/admin/openrpc",gn="/_lunora/admin/global/tables",vn="/_lunora/admin/global/table",Sn="/_lunora/admin/global/facet",wn="/_lunora/admin/vector/indexes",Cn="/_lunora/admin/vector/query",kn="/_lunora/admin/logs/archive",Tn="/_lunora/admin/kv/namespaces",En="/_lunora/admin/kv/keys",Wt="/_lunora/admin/kv/value",In="/_lunora/admin/auth/users",On="/_lunora/admin/auth/sessions",Rn="/_lunora/admin/auth/users/create",An="/_lunora/admin/auth/users/role",Fn="/_lunora/admin/auth/users/ban",Pn="/_lunora/admin/auth/users/unban",Mn="/_lunora/admin/auth/users/password",xn="/_lunora/admin/auth/users/remove",Qn="/_lunora/admin/auth/users/impersonate",_n="/_lunora/admin/auth/sessions/revoke",Ln="/_lunora/admin/auth/sessions/revoke-all",Dn="/_lunora/admin/auth/capabilities",Un="/_lunora/admin/auth/users/update",Kn="/_lunora/admin/auth/accounts",Nn="/_lunora/admin/auth/accounts/unlink",qn="/_lunora/admin/auth/passkeys",jn="/_lunora/admin/auth/passkeys/delete",Bn="/_lunora/admin/auth/two-factor/disable",$n="/_lunora/admin/auth/organizations",Hn="/_lunora/admin/auth/organizations/members",Wn="/_lunora/admin/auth/organizations/invitations",zn="/_lunora/admin/auth/organizations/members/remove",Gn="/_lunora/admin/auth/organizations/invitations/cancel",Vn="/_lunora/admin/auth/config",Jn="/_lunora/admin/auth/sign-up-invitations",Yn="/_lunora/admin/auth/sign-up-invitations/create",Xn="/_lunora/admin/auth/sign-up-invitations/revoke",Zn="/_lunora/admin/auth/organizations/create",ea="/_lunora/admin/auth/organizations/update",ta="/_lunora/admin/auth/organizations/remove",sa="/_lunora/admin/auth/organizations/members/add",ra="/_lunora/admin/auth/organizations/members/invite",ia="/_lunora/admin/auth/organizations/members/role",na="/_lunora/admin/auth/organizations/teams",aa="/_lunora/admin/auth/organizations/teams/create",oa="/_lunora/admin/auth/organizations/teams/update",ca="/_lunora/admin/auth/organizations/teams/remove",ua="/_lunora/admin/auth/organizations/teams/members",ha="/_lunora/admin/auth/organizations/teams/members/add",da="/_lunora/admin/auth/organizations/teams/members/remove",la="/_lunora/admin/auth/organizations/roles",fa="/_lunora/admin/auth/organizations/roles/create",pa="/_lunora/admin/auth/organizations/roles/update",ma="/_lunora/admin/auth/organizations/roles/remove",ya="/api/auth",ba="/get-session",ga="lunora-ping",va=n(async t=>(t.assertOpen(),(await t.adminFetch(ln,"GET")).functions??[]),"Ls"),Sa=n(async t=>(t.assertOpen(),(await t.adminFetch(fn,"GET")).jobs??[]),"Ms"),wa=n(async(t,e)=>{t.assertOpen();let s=await t.adminFetch(pn,"POST",{name:e});return{name:s.name??e,ran:s.ran===!0}},"Us"),Ca=n(async t=>(t.assertOpen(),await t.adminFetch(yn,"GET")),"Ns"),ka=n(async t=>(t.assertOpen(),await t.adminFetch(mn,"GET")),"xs"),Ta=n(async t=>(t.assertOpen(),await t.adminFetch(bn,"GET")),"Ds"),Ea=n(async t=>(t.assertOpen(),await t.adminFetch(gn,"GET")),"Bs"),Ia=n(async(t,e)=>{t.assertOpen();let s=new URLSearchParams({table:e.table});return e.limit!==void 0&&s.set("limit",String(e.limit)),e.offset!==void 0&&s.set("offset",String(e.offset)),e.filters!==void 0&&e.filters.length>0&&s.set("filters",JSON.stringify(B(e.filters))),I(await t.adminFetch(`${vn}?${s.toString()}`,"GET"))},"Qs"),Oa=n(async(t,e)=>{t.assertOpen();let s=new URLSearchParams({column:e.column,table:e.table});return e.limit!==void 0&&s.set("limit",String(e.limit)),e.filters!==void 0&&e.filters.length>0&&s.set("filters",JSON.stringify(B(e.filters))),I(await t.adminFetch(`${Sn}?${s.toString()}`,"GET"))},"Ks"),zt=n(t=>t===void 0||t===""?"":`&bucket=${encodeURIComponent(t)}`,"ie"),sr=n(t=>t.startsWith("https://")?`wss://${t.slice(8)}`:t.startsWith("http://")?`ws://${t.slice(7)}`:t,"me"),ie=n((t,e)=>`${t.endsWith("/")?t.slice(0,-1):t}${e}`,"E"),F=n((t,e)=>{let s=new URLSearchParams;for(let[i,a]of Object.entries(e))a!==void 0&&a!==""&&s.set(i,String(a));let r=s.toString();return r===""?t:`${t}?${r}`},"S"),Ra=n(async t=>(t.assertOpen(),(await t.adminFetch(Tn,"GET")).namespaces??[]),"qs"),Aa=n(async(t,e)=>{t.assertOpen();let s=F(En,{cursor:e.cursor,limit:e.limit,namespace:e.namespace,prefix:e.prefix});return await t.adminFetch(s,"GET")},"Ws"),Fa=n(async(t,e)=>{t.assertOpen();let s=F(Wt,{key:e.key,namespace:e.namespace});return await t.adminFetch(s,"GET")},"js"),Pa=n(async(t,e)=>{t.assertOpen(),await t.adminFetch(Wt,"PUT",e)},"$s"),Ma=n(async(t,e)=>{t.assertOpen();let s=F(Wt,{key:e.key,namespace:e.namespace});await t.adminFetch(s,"DELETE")},"Gs"),xa=n(async(t,e)=>{t.assertOpen();let s=await t.adminFetch(Zi,"POST",{table:e});return{failed:s.failed??0,ok:s.ok??0,shards:s.shards??[]}},"Vs"),Qa=n(async(t,e={})=>{t.assertOpen();let s=await t.adminFetch(kn,"POST",e);return{nextCursor:s.nextCursor,rows:s.rows??[]}},"zs"),_a=n(async t=>{let e=[],s;for(;;){let r=await t(s);if(e.push(...Array.isArray(r.records)?r.records:[]),r.truncated!==!0||typeof r.cursor!="string"||r.cursor.length===0)return e;if(r.cursor===s)throw new Error("collectPages: the list did not advance its cursor \u2014 refusing to page forever");s=r.cursor}},"Js"),Gt=n(t=>"args"in t?{...t,args:I(t.args)}:t,"ne"),La=n(async t=>(t.assertOpen(),((await t.adminFetch(en,"GET")).records??[]).map(e=>Gt(e))),"Ys"),Da=n(async t=>{t.assertOpen();let e=await t.adminFetch(tn,"GET");return{backlog:e.backlog??0,inFlight:e.inFlight??0,pools:e.pools??[]}},"Xs"),Ua=n(async(t,e)=>(t.assertOpen(),{cancelled:(await t.adminFetch(rn,"POST",{id:e})).cancelled===!0}),"Zs"),Ka=n(async t=>(t.assertOpen(),(await _a(async e=>await t.adminFetch(e===void 0?tr:`${tr}?cursor=${encodeURIComponent(e)}`,"GET"))).map(e=>Gt(e))),"er"),Na=n(async(t,e)=>(t.assertOpen(),{retried:(await t.adminFetch(nn,"POST",{id:e})).retried===!0}),"tr"),qa=n(async(t,e)=>(t.assertOpen(),{removed:(await t.adminFetch(an,"POST",{id:e})).removed===!0}),"sr"),ja=n(async(t,e)=>{t.assertOpen();let s=new URLSearchParams({name:e.name});e.status!==void 0&&s.set("status",e.status),e.page!==void 0&&s.set("page",String(e.page)),e.perPage!==void 0&&s.set("perPage",String(e.perPage));let r=await t.adminFetch(`${on}?${s.toString()}`,"GET");return{configured:r.configured,instances:r.instances??[],page:r.page??1,perPage:r.perPage??e.perPage??0,totalCount:r.totalCount}},"rr"),Ba=n(async(t,e)=>{t.assertOpen();let s=new URLSearchParams({id:e.id,name:e.name}),r=await t.adminFetch(`${cn}?${s.toString()}`,"GET");return{createdOn:r.createdOn,endedOn:r.endedOn,error:r.error,id:r.id??e.id,output:r.output,params:r.params,startedOn:r.startedOn,status:r.status??"unknown",steps:r.steps??[]}},"ir"),$a=n(async(t,e)=>(t.assertOpen(),{status:(await t.adminFetch(un,"POST",{action:e.action,id:e.id,name:e.name})).status??"unknown"}),"nr"),Ha=n(async(t,e={})=>{t.assertOpen();let s=F(Ht,{bucket:e.bucket,cursor:e.cursor,limit:e.limit,prefix:e.prefix}),r=await t.adminFetch(s,"GET");return{cursor:r.cursor,objects:r.objects??[]}},"ar"),Wa=n(async(t,e,s)=>{t.assertOpen();let r=`${Ht}?key=${encodeURIComponent(e)}${zt(s?.bucket)}`,i=await t.adminFetch(r,"DELETE");return{deleted:i.deleted===!0,key:i.key??e}},"or"),za=n(async t=>(t.assertOpen(),(await t.adminFetch(dn,"GET")).buckets??[]),"cr"),Ga=n(async(t,e)=>{t.assertOpen();let s=`${Ht}?key=${encodeURIComponent(e.key)}${zt(e.bucket)}`,r=await t.adminFetch(s,"PUT",e.body,e.contentType);return{etag:r.etag,key:r.key??e.key}},"dr"),Va=n(async(t,e,s)=>{t.assertOpen();let r=s?.expiresInSeconds,i=r===void 0?"":`&expiresIn=${encodeURIComponent(r.toString())}`,a=`${hn}?key=${encodeURIComponent(e)}${i}${zt(s?.bucket)}`,o=await t.adminFetch(a,"GET");if(typeof o.url!="string")throw new TypeError("LunoraClient: storage URL endpoint returned no `url`");return o.url},"hr"),Ja=n(async t=>(t.assertOpen(),(await t.adminFetch(wn,"GET")).indexes??[]),"ur"),Ya=n(async(t,e)=>(t.assertOpen(),(await t.adminFetch(Cn,"POST",e)).matches??[]),"lr"),Y=n((t,e)=>{try{return B(t)}catch(s){let r=s instanceof Error?s.message:String(s);throw new TypeError(`LunoraClient: cannot encode ${e} \u2014 ${r}`,s instanceof Error?{cause:s}:void 0)}},"k"),rr=n(t=>{try{return B(t),!0}catch{return!1}},"pe"),ur=n(t=>t!==null&&typeof t=="object"&&("error"in t||"result"in t),"ve"),Xa=n((t,e)=>{let s=Array.from({length:e});for(let r of t){if(typeof r.id!="number"||r.id<0||r.id>=e)continue;if(!ur(r.body)){s[r.id]={error:et({}),ok:!1};continue}let i=r.body;s[r.id]="error"in i?{error:et(i),ok:!1}:{ok:!0,value:I(i.result)}}return s.map(r=>r??{error:new Error("batch call returned no result"),ok:!1})},"fr"),Dt=n((t,e)=>e!==null?{}:t===null?{expectSubject:null}:t?.startsWith("subj:")===!0?{expectSubject:t.slice(5)}:{},"V"),Za=3e4,eo=1e4,to=5e3,so=3,ro=250,io=5e3,no=5e3,ao=64,oo=3,co=1e4,uo=8,Ut=n(t=>t==="connected"||t==="polling","z"),g=n(t=>t??"","l"),K=n((t,e)=>{if(!t.socket||t.wsState!=="open")return!1;try{return t.socket.send(JSON.stringify(e)),!0}catch{return!1}},"g"),ho=n(t=>{if(!t.pendingStreams||t.pendingStreams.length===0)return;let e=t.pendingStreams;t.pendingStreams=[];for(let s of e)K(t,s)},"Er"),lo=new TextDecoder,fo=n(t=>{if(typeof t=="string")return t;if(t instanceof ArrayBuffer)return lo.decode(t)},"_r"),ne=class{static{n(this,"I")}listeners=new Set;add(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}emit(...e){let[s]=e;for(let r of this.listeners)try{r(s)}catch{}}clear(){this.listeners.clear()}},Ee=n(t=>{t.heartbeatTimer!==void 0&&(clearInterval(t.heartbeatTimer),t.heartbeatTimer=void 0)},"H"),po=n((t,e,s)=>{Ee(t),!(e<=0)&&(t.heartbeatTimer=setInterval(()=>{if(!t.socket)return;let{socket:r}=t;if(Date.now()-t.lastFrameAt>e*2.5){try{r.close()}catch{}s();return}try{r.send(ga)}catch{}},e))},"Ir"),ir=n((t,e,s,r)=>{let{WebSocketImpl:i,connectTimeoutMs:a,heartbeatIntervalMs:o}=s;if(i===void 0)throw new b("INTERNAL","no WebSocket implementation available");let c=new i(e);t.socket=c;let u=n(()=>{Ee(t),t.connectTimer!==void 0&&(clearTimeout(t.connectTimer),t.connectTimer=void 0),t.socket===c&&(t.socket=void 0)},"c"),d=n(h=>{u(),r.onClose(h)},"d");a>0&&(t.connectTimer=setTimeout(()=>{if(t.connectTimer=void 0,t.socket===c){try{c.close()}catch{}d()}},a)),c.addEventListener("open",()=>{if(t.socket===c){t.connectTimer!==void 0&&(clearTimeout(t.connectTimer),t.connectTimer=void 0),t.lastFrameAt=Date.now();try{r.onOpen?.()}catch(h){console.error("[lunora] connection open handler threw",h)}po(t,o,d)}}),c.addEventListener("message",h=>{if(t.socket===c){t.lastFrameAt=Date.now();try{r.onMessage(h)}catch(l){console.error("[lunora] server frame handler threw",l)}}}),c.addEventListener("close",h=>{t.socket===c&&d(h)}),c.addEventListener("error",()=>{t.socket===c&&d()})},"ye"),mo=n(t=>{let{afterFailedAttempts:e,intervalMs:s,onReachable:r,onStateChange:i,poll:a}=t,o=s>0&&e>0,c=0,u,d=!1,h=!1,l=n(()=>{u!==void 0&&(clearInterval(u),u=void 0,d=!1,i())},"u"),f=n(m=>{if(u!==void 0){if(!m){l();return}d||(d=!0,i()),r()}},"m"),p=n(()=>{h||(h=!0,a().then(f).finally(()=>{h=!1}).catch(()=>{}))},"p");return{isPolling:n(()=>u!==void 0&&d,"isPolling"),noteFailedOpen:n(()=>{c+=1,!(!o||u!==void 0||c<e)&&(u=setInterval(p,s),i(),p())},"noteFailedOpen"),noteOpen:n(()=>{c=0,l()},"noteOpen"),stop:l}},"Or"),yo=1e4,nr=n(async t=>{let e=new AbortController,s,r=new Promise((i,a)=>{s=setTimeout(()=>{e.abort(),a(new TypeError("LunoraClient: poll timed out"))},yo)});try{return await Promise.race([t(e.signal),r])}catch(i){throw e.signal.aborted?new TypeError("LunoraClient: poll timed out"):i}finally{clearTimeout(s)}},"Se"),hr=new Set(["DELIVERY_FENCED","RATE_LIMITED","SHARD_ERROR","SHARD_UNAVAILABLE","TOO_MANY_REQUESTS"]),bo=n(t=>{if(t instanceof z)return!0;let e=t?.code;return e===void 0||hr.has(e)||Ot.has(e)},"Pr"),dr=6e4,go=1e3,vo={401:"UNAUTHORIZED",403:"FORBIDDEN",404:"NOT_FOUND",413:"PAYLOAD_TOO_LARGE",429:"TOO_MANY_REQUESTS"},Te=n((t,e,s)=>{let r=Ft(s),i=r===void 0?void 0:{retryAfterMs:r},a=`LunoraClient: response carried no error envelope (status ${t.toString()}${e?` ${e}`:""})`;return t<400||t>=500||t===408?new z(a,i):new b(vo[t]??"BAD_REQUEST",a,{data:i})},"F"),Nt=n((t,e=Math.random)=>{let s=Math.min(go*2**Math.max(t-1,0),dr);return Math.round(s*(.5+e()*.5))},"Z"),So=n(t=>t instanceof z||hr.has(t?.code??""),"Lr"),wo=n((t,e,s)=>{let r=ze(t);return r!==void 0&&r>0?Math.min(r,dr):So(t)?Nt(e,s):void 0},"Mr"),Co=983040,ko=n(t=>typeof TextEncoder>"u"?t.length:new TextEncoder().encode(t).length,"Nr"),lr=new WeakSet,fr=n(t=>{let e=new b("WIRE_DECODE_FAILED",`LunoraClient: the call succeeded but its result could not be decoded (a mutation has still committed) \u2014 ${t instanceof Error?t.message:String(t)}`,{cause:t});return lr.add(e),e},"Ee"),rt=n(t=>t instanceof Error&&lr.has(t),"x"),To=n(t=>{let e=new Map;for(let s of t)typeof s.id=="number"&&ur(s.body)&&e.set(s.id,s.body);return e},"xr"),Eo=n(t=>{if(t===void 0)return{kind:"unanswered"};if("error"in t)return{error:et(t),kind:"errored"};try{return{commitCursor:t.commitCursor,kind:"committed",value:I(t.result)}}catch(e){return{commitCursor:t.commitCursor,error:fr(e),kind:"undecodable"}}},"Dr"),Kt=n((t,e)=>`${g(t)}\0${e}`,"J"),Io=n((t,e)=>{for(let s of e)s.op==="delete"?t.delete(s.key):s.value!==void 0&&t.set(s.key,s.value)},"Br"),qt=class{static{n(this,"Qr")}constructor(e){this.maxBuffers=e}maxBuffers;buffers=new Map;start(e,s){or(this.buffers,this.maxBuffers),this.buffers.set(Kt(e,s.pokeId),{baseCheckpoint:s.baseCheckpoint,bases:new Map,epoch:s.epoch,lastMutationId:new Map,parts:new Map,resets:new Set,undecodable:new Map})}part(e,s){let r=this.buffers.get(Kt(e,s.pokeId));if(!r)return;let i=[];try{for(let c of s.rowsPatch)i.push(c.value===void 0?c:{...c,value:I(c.value)})}catch(c){r.undecodable.set(s.shapeId,c);return}let a=r.parts.get(s.shapeId)??[];for(let c of i)a.push(c);r.parts.set(s.shapeId,a),s.lastMutationId!==void 0&&r.lastMutationId.set(s.shapeId,s.lastMutationId);let o=s.baseCheckpoint??r.baseCheckpoint;o!==void 0&&r.bases.set(s.shapeId,o),s.reset===!0&&r.resets.add(s.shapeId)}end(e,s){let r=Kt(e,s),i=this.buffers.get(r);return i&&this.buffers.delete(r),i}clear(){this.buffers.clear()}},Oo=n((t,e,s)=>{let r=e.parts.get(t.id)??[],i=e.resets.has(t.id),a=e.bases.get(t.id),o=e.epoch!==void 0&&t.serverEpoch!==void 0&&e.epoch!==t.serverEpoch,c=a!==void 0&&t.serverCursor!==void 0&&t.serverCursor!==a;if(!i&&(o||c))return t.rows.clear(),t.serverCursor=void 0,t.serverEpoch=void 0,"reseed";i&&t.rows.clear(),Io(t.rows,r),s.checkpoint!==void 0&&(t.serverCursor=s.checkpoint),s.epoch!==void 0&&(t.serverEpoch=s.epoch);let u=e.lastMutationId.get(t.id);return u!==void 0&&(t.lastMutationId=u),"applied"},"Kr"),ar=n(t=>{let e=[...t.rows.values()];for(let s of t.callbacks)try{s(e)}catch{}},"be"),Ro=n((t,e)=>{for(let[s,r]of e.undecodable){let i=t.get(s);i&&V(i.errorCallbacks,{code:"WIRE_DECODE_FAILED",message:`could not decode a poke for this shape \u2014 ${r instanceof Error?r.message:String(r)}`})}},"qr"),jt=n((t,e)=>{t.lastMutationId=Math.max(t.lastMutationId??0,e)},"ee"),Bt=n((t,e=!1)=>{for(let s of t.checkpointCallbacks)s({checkpoint:t.serverCursor,mutationId:t.lastMutationId,...e&&{rowsFollow:!0}})},"te"),pr=n((t,e,s)=>{t.serverBase=e,s.cursor!==void 0&&(t.serverCursor=s.cursor),s.epoch!==void 0&&(t.serverEpoch=s.epoch)},"Ae"),it=n((t,e)=>t!==void 0&&t!==e,"D"),Ao=n((t,e)=>e==="connected"&&t!=="connected"||e==="polling"&&t!=="connected"&&t!=="polling","Wr"),Fo=n(t=>{for(let e of t.activeSubscriptions())t.ensureSocket(e.shardKey),t.queueResubscribe(e);for(let e of t.queuedShardKeys())t.ensureSocket(e);t.broadcastStatus(t.computeStatus(),t.identityFingerprint())},"jr"),Po=n(t=>{t.closeConnections();let e=t.leader;e.status=void 0,e.wasEverConnected=!1},"$r"),Mo=n((t,e,s)=>{if(it(s,t.identityFingerprint()))return;let r=t.leader,i=Ao(r.status,e);r.status=e,e==="connected"&&(r.wasEverConnected=!0),t.emitConnectionStatus(),i&&t.flushOfflineQueues()},"Gr"),xo=n(t=>{t.isLeader()&&t.broadcastStatus(t.computeStatus(),t.identityFingerprint())},"Vr"),Qo=n((t,e,s,r,i,a)=>{if(it(a,t.identityFingerprint()))return;let o=t.subscription(e);o&&(t.dropCacheSeed(e),pr(o,s,r===void 0?{}:{cursor:r,epoch:i}),r!==void 0&&Xe(o,r),se(o,s))},"zr"),_o=n((t,e,s,r)=>{if(it(r,t.identityFingerprint()))return;let i=t.subscription(e);i&&V(i.errorCallbacks,s)},"Jr"),Lo=n((t,e,s,r,i,a,o)=>{if(it(o,t.identityFingerprint()))return;let c=t.subscription(e);c&&(t.ackAndAdvanceCursor(c,s,r),i!==void 0&&a===t.clientIdentifier()&&jt(c,i),Bt(c))},"Yr"),Do=n((t,e,s)=>t!==null||e&&s===null,"Xr"),Uo=[Ns],Ko=100,No=Promise.resolve(),$t=class t{static{n(this,"_e")}static MAX_POKE_BUFFERS=256;static createClientQuery(e,s){return{defaultValue:s,key:e}}url;wsUrl;adminHost={adminFetch:n((...e)=>this.adminFetch(...e),"adminFetch"),assertOpen:n(()=>{this.assertOpen()},"assertOpen")};clientQueryStore;wsToken;wsTokenGeneration=0;authBasePath;fetchImpl;WebSocketImpl;bookmark;reconnectOptions;connectTimeoutMs;heartbeatIntervalMs;managedSocketOptions;pollingFallbackAfterFailedAttempts;pollingFallbackIntervalMs;offlineQueue;outbox;clientId;shardCursors=new Map;defaultShardKey;readyResolved=!1;readyResolve;readyPromise;clientWatermarks=new Map;outboxMutationCounter=0;onPersistenceError;persistence;persistenceVersion;outboxLeaderRelease;queryCache;hydratedQueryCache=new Map;cacheSeededQueries=new Map;pendingCacheWrites=new Map;cacheFlushTimer;subscriptions=new L;tabCoordinator;leader={status:void 0,wasEverConnected:!1};connections=new Map;idleClosedShards=new Set;defaultConnectionContext;connectionContexts=new Map;connectionContextHolders=new Map;authToken=null;authSubject=void 0;subjectToken=null;sessionProbesInFlight=0;sessionProbeGeneration=0;identityQuestions=0;identityAnsweredAt=0;releaseSessionChangeListener;warnedIdentityDisagreement=!1;identityResolutionExpected=!1;identitySettled=!1;queuedIdentities=new Map;queuedOfflineShardKeys=new Set;closed=!1;authTokenListeners=new ne;statusListeners=new ne;roomFlushes=new Map;roomIdentityResets=new Set;tokenExpiredListeners=new ne;identityChangeListeners=new ne;retiredIdentities=0;authRefusalNotifiedFor;replayCredentials=new WeakMap;mutationSettledListeners=new ne;pendingChangeListeners=new ne;whisperHandlers=new Map;lastStatus="idle";nextSubId=0;nextStreamId=0;streams=new Map;adminSocketTeardowns=new Set;offlineFlushes=new Map;replayRetryState=new Map;replayRetryTimers=new Map;shapeSubscriptions=new Map;pokeAssembler=new qt(t.MAX_POKE_BUFFERS);nextShapeId=0;constructor(e){this.url=e.url,this.wsUrl=e.wsUrl??ie(sr(e.url),Xi),this.wsToken=e.wsToken;let s=e.authBasePath??ya;this.authBasePath=s.endsWith("/")?s.slice(0,-1):s,this.fetchImpl=e.fetch??(typeof fetch=="function"?fetch.bind(globalThis):void 0),this.WebSocketImpl=e.WebSocket??(typeof WebSocket=="function"?WebSocket:void 0),this.bookmark=e.bookmarkStorage??Us(),this.reconnectOptions=e.reconnect,this.heartbeatIntervalMs=e.heartbeatIntervalMs??Za,this.connectTimeoutMs=e.connectTimeoutMs??eo,this.managedSocketOptions={connectTimeoutMs:this.connectTimeoutMs,heartbeatIntervalMs:this.heartbeatIntervalMs,WebSocketImpl:this.WebSocketImpl},this.pollingFallbackIntervalMs=e.pollingFallback?.intervalMs??to,this.pollingFallbackAfterFailedAttempts=e.pollingFallback?.afterFailedAttempts??so,this.defaultConnectionContext=e.connectionContext,this.persistence=Xs(e.persistence,e.outbox===void 0),this.persistenceVersion=e.persistenceVersion,this.queryCache=Ds(e.queryCache),this.onPersistenceError=e.offlineQueue?.onPersistenceError,this.clientQueryStore=new He,e.crossTabSync?(this.tabCoordinator=this.createTabCoordinator(),this.tabCoordinator.start()):this.tabCoordinator=void 0,e.hydrateOnStart&&this.queryCache?this.readyPromise=new Promise(r=>{this.readyResolve=r}):(this.readyResolved=!0,this.readyPromise=No),this.offlineQueue=new tt(e.offlineQueue,{onEvict:n((r,i)=>{this.emitItemSettled(r,"rejected",i),this.releaseIdleShard(r.shardKey)},"onEvict"),onSizeChange:n(r=>{this.pendingChangeListeners.emit(r)},"onSizeChange"),persistence:this.persistence,version:e.persistenceVersion}),this.outbox=e.outbox,this.clientId=e.clientId??`client-${st()}`,this.persistence&&queueMicrotask(()=>{this.hydrateAsOutboxLeader()}),this.queryCache&&queueMicrotask(()=>{(async()=>{try{await this.hydrateQueryCache()}catch{}finally{this.readyResolved=!0,this.readyResolve?.()}})().catch(()=>{})}),"document"in globalThis&&(this.releaseSessionChangeListener=Ji(async()=>{!this.closed&&this.authToken===null&&await this.getCurrentUser().catch(()=>{})}))}setAuthToken(e,s){let r=this.authToken!==e,i=this.identityFingerprint(),a=this.authSubject===void 0||this.subjectToken===this.authToken,o=this.subjectAwaitingReconfirm(),c=this.isKnownNobody(),u=this.authToken;this.authToken=e,this.applySubject(e,s);let d=this.identityFingerprint();d!==i&&(!r&&e!==null&&a?(this.restampQueuedIdentity(i,d),this.restampWatermarks(i,d),this.restampConnectionIdentity(i,d),this.reseedFromHydratedCache()):!r&&e===null&&i===null&&a&&!c?(this.restampWatermarks(i,d),this.restampConnectionIdentity(i,d),this.reseedFromHydratedCache()):(this.rejectQueuedForIdentityChange(i),this.warnRefreshWithoutSubject(u,e),Do(i,c,e)&&this.evictPreviousIdentitySession()),this.restartTabCoordinatorForIdentity()),this.syncReadCacheToCredential(o),r&&this.authTokenListeners.emit(e),(d!==i||r||o)&&this.offlineQueue.size>0&&Ut(this.computeStatus())&&this.flushAllOfflineQueues()}getAuthToken(){return this.authToken}currentIdentity(){return this.identityFingerprint()}expectIdentityResolution(){this.identityResolutionExpected=!0}currentBaseline(e){return this.baselineCursorFor(e)}replayIdentityVerdict(e){let s=this.identityVerdict(e);if(s!=="match")return{verdict:s};let r=Object.freeze({});return this.replayCredentials.set(r,{authToken:this.authToken,stamp:e}),{credential:r,verdict:s}}clientIdentifier(){return this.clientId}confirmedMutationWatermark(e){return this.clientWatermarks.get(this.identityFingerprint()??"")?.get(e??"")??0}async callMutator(e,s,r){let i=r?.clientSeq;if(i!==void 0&&(!Number.isInteger(i)||i<=0))throw new b("INTERNAL",`callMutator: clientSeq must be a positive integer, got ${String(i)}`);let a=r?.shardKey??"",o=this.identityFingerprint(),c,u,d;try{u=await this.rpc(e,s,r?.shardKey,{captureBookmark:!0,clientId:this.clientId,clientSeq:i,onMutationAck:n(h=>{c=h},"onMutationAck")})}catch(h){if(!rt(h))throw h;d=h}if(c!==void 0&&c>(this.clientWatermarks.get(o??"")?.get(a)??0)){let h=this.clientWatermarks.get(o??"");h===void 0&&(or(this.clientWatermarks,uo),h=new Map,this.clientWatermarks.set(o??"",h)),h.set(a,c)}if(d!==void 0)throw d;return{applied:c===void 0||c===i,result:u}}onAuthTokenChange(e){return this.authTokenListeners.add(e)}onIdentityChange(e){return this.identityChangeListeners.add(e)}identityEpoch(){return this.retiredIdentities}async getCurrentUser(){if(this.identityResolutionExpected=!0,this.closed||!this.fetchImpl)return this.identitySettled=!0,null;let e={},s=this.authToken;this.authToken&&(e.authorization=`Bearer ${this.authToken}`),this.sessionProbesInFlight+=1,this.identityQuestions+=1,this.sessionProbeGeneration=this.identityQuestions;let r=this.sessionProbeGeneration;try{let i=await this.fetchImpl(ie(this.url,`${this.authBasePath}${ba}`),{credentials:"include",headers:e,method:"GET"});if(!i.ok)return this.identitySettled=!0,i.status===401&&this.adoptResolvedSubject(s,null,r),null;let a=(await i.json())?.user??null;return this.identitySettled=!0,this.adoptResolvedSubject(s,a,r),a}finally{this.releaseSessionProbe()}}setWsToken(e){this.wsToken!==e&&(this.wsToken=e,this.wsTokenGeneration+=1,this.resetRoomSends(),this.bounceShardSockets())}setConnectionContext(e,s={}){this.assertLeaderOwnedSurface("setConnectionContext");let r=g(s.shardKey);e===void 0?this.connectionContexts.delete(r):this.connectionContexts.set(r,e),this.refreshConnectionContext(r),e===void 0&&this.releaseIdleShard(s.shardKey)}acquireConnectionContext(e,s={}){if(this.followsAnotherTab())return()=>{};let r=g(s.shardKey),i={context:e},a=this.connectionContextHolders.get(r);a?a.push(i):this.connectionContextHolders.set(r,[i]),this.refreshConnectionContext(r);let o=!1;return()=>{if(o)return;o=!0;let c=this.connectionContextHolders.get(r);if(!c)return;let u=c.indexOf(i);u!==-1&&c.splice(u,1),c.length===0&&this.connectionContextHolders.delete(r),this.refreshConnectionContext(r),this.releaseIdleShard(s.shardKey)}}whisperSubscribe(e,s,r={}){this.assertLeaderOwnedSurface("whisperSubscribe");let i=g(r.shardKey),a=this.whisperHandlers.get(i);a||(a=new Map,this.whisperHandlers.set(i,a));let o=a.get(e),c=o===void 0;if(o||(o=new Set,a.set(e,o)),o.add(s),this.ensureSocket(r.shardKey),c){let u=this.getConnection(r.shardKey);u&&K(u,{topic:e,type:"whisper_subscribe"})}return()=>{let u=this.whisperHandlers.get(i),d=u?.get(e);if(!d?.delete(s)||d.size>0)return;u?.delete(e),u?.size===0&&this.whisperHandlers.delete(i);let h=this.getConnection(r.shardKey);h&&K(h,{topic:e,type:"whisper_unsubscribe"}),this.releaseIdleShard(r.shardKey)}}whisper(e,s,r={}){return this.assertLeaderOwnedSurface("whisper"),this.sendEncodedWhisper(e,Y(s??null,`whisper data for topic '${e}'`),r)}connectRoom(e,s,r={}){let i=`room:${e.name}`,a=this.whisperSubscribe(i,f=>{s.onMessage(f)},r),o=!1,c=[],u=n(()=>{c.length=0},"c"),d=n(()=>{for(;c.length>0&&this.roomSendsAdmitted(r.shardKey);){if(!this.sendEncodedWhisper(i,c[0],r))return;c.shift()}},"d"),h=g(r.shardKey),l=this.roomFlushes.get(h)??new Set;return l.add(d),this.roomFlushes.set(h,l),this.roomIdentityResets.add(u),{close:n(()=>{o=!0,c.length=0,l.delete(d),l.size===0&&this.roomFlushes.delete(h),this.roomIdentityResets.delete(u),a()},"close"),send:n(f=>{if(o||this.closed||this.WebSocketImpl===void 0)return!1;let p=Y(f,`room message for '${i}'`),m=typeof structuredClone=="function"?structuredClone(p):JSON.parse(JSON.stringify(p));return d(),c.length===0&&this.roomSendsAdmitted(r.shardKey)&&this.sendEncodedWhisper(i,m,r)?!0:c.length>=Ko?!1:(c.push(m),!0)},"send")}}onTokenExpired(e){return this.tokenExpiredListeners.add(e)}connectionStatus(){return this.computeStatus()}onConnectionStatus(e){let s=this.statusListeners.add(e);return e(this.computeStatus()),s}pendingCount(){return this.offlineQueue.size}debug(){let e=[],s=this.clientWatermarks.get(this.identityFingerprint()??""),r=new Set([...this.connections.keys(),...s?.keys()??[]]);for(let a of r){let o=this.connections.get(a);e.push({confirmedMutationWatermark:s?.get(a)??0,hasSocket:o?.socket!==void 0,shardKey:a===""?void 0:a,wasEverConnected:o?.wasEverConnected??!1,wsState:o?.wsState??"idle"})}let i=this.subscriptions.all().map(a=>({acked:a.acked,functionPath:a.fn.__lunoraRef,id:a.id,kind:"query",lastMutationId:a.lastMutationId,pendingOptimisticLayers:a.optimisticLayers.length,serverCursor:a.serverCursor,shardKey:a.shardKey,subscriberCount:a.callbacks.size}));for(let a of this.shapeSubscriptions.values())i.push({acked:a.serverCursor!==void 0,functionPath:`shape:${a.name}`,id:a.id,kind:"shape",lastMutationId:a.lastMutationId,pendingOptimisticLayers:0,rowCount:a.rows.size,serverCursor:a.serverCursor,shardKey:a.shardKey,subscriberCount:a.callbacks.size});return{clientId:this.clientId,closed:this.closed,connectionStatus:this.computeStatus(),pendingWrites:this.offlineQueue.size,shards:e.toSorted((a,o)=>(a.shardKey??"").localeCompare(o.shardKey??"")),subscriptions:i.toSorted((a,o)=>a.functionPath.localeCompare(o.functionPath))}}onPendingChange(e){let s=this.pendingChangeListeners.add(e);return e(this.offlineQueue.size),s}onMutationSettled(e){return this.mutationSettledListeners.add(e)}getWebSocketImpl(){return this.WebSocketImpl}getClientQuery(e){return this.clientQueryStore.get(e)}setClientQuery(e,s){this.clientQueryStore.set(e,s)}subscribeClientQuery(e,s){return this.clientQueryStore.subscribe(e,s)}resetClientQuery(e){this.clientQueryStore.reset(e)}snapshotPrecondition(e,s,r){return Zs(this,e,s,r)}whenReady(){return this.readyPromise}get isReady(){return this.readyResolved}peekHydratedQuery(e,s,r){return this.peekHydratedQueryByKey(e,q(s),r)}peekHydratedQueryByKey(e,s,r){if(!this.readyResolved)return;let i=ae(e,s,r),a=this.hydratedQueryCache.get(i);if(a!==void 0)return this.cachedQueryMatchesIdentity(a)?a.value:void 0}peekActiveQuerySnapshot(e,s,r){let i=L.key(e,s,r),a=this.subscriptions.get(i);return{present:a!==void 0,value:a?.lastValue}}async query(e,s,r={}){return this.assertOpen(),await this.rpc(e.__lunoraRef,s,r.shardKey,{attachBookmark:!0})}async batch(e){return this.sendBatch(e)}async mutation(e,s,r={}){let{value:i}=await this.runMutation(e,s,r);return i}canQueueOffline(e){let{wasEverConnected:s}=this.connectionGateState(e);return this.WebSocketImpl!==void 0&&(s||this.offlineQueue.queueBeforeFirstConnect)}async action(e,s,r={}){return this.assertOpen(),await this.rpc(e.__lunoraRef,s,r.shardKey,{attachBookmark:!0,captureBookmark:!0})}async importRows(e,s,r={}){this.assertOpen();let i=Math.max(1,Math.trunc(r.chunkSize??500)),a=r.toArgs??(h=>({rows:h})),o=s.length,c=0,u=0,d=0;for(let h=0;h<o;h+=i){let l=s.slice(h,h+i),f=d,{committed:p}=await this.runMutation(e,a(l),{...r.importId===void 0?{}:{mutationId:`${r.importId}:${String(f)}`},shardKey:r.shardKey});d+=1,c+=l.length,p&&(u+=l.length),r.onProgress?.({done:c,total:o})}return{chunks:d,imported:u,queued:c-u}}async shardTraffic(e){return xa(this.adminHost,e)}async listScheduledJobs(){return La(this.adminHost)}async schedulerStatus(){return Da(this.adminHost)}async cancelScheduledJob(e){return Ua(this.adminHost,e)}async listDeadJobs(){return Ka(this.adminHost)}async retryDeadJob(e){return Na(this.adminHost,e)}async removeDeadJob(e){return qa(this.adminHost,e)}async listWorkflowInstances(e){return ja(this.adminHost,e)}async getWorkflowInstance(e){return Ba(this.adminHost,e)}async setWorkflowInstanceStatus(e){return $a(this.adminHost,e)}subscribeScheduledJobs(e){if(this.assertOpen(),this.WebSocketImpl===void 0)return()=>{};let s=ie(sr(this.url),sn),r=ke(this.reconnectOptions),i={connectTimer:void 0,heartbeatTimer:void 0,lastFrameAt:0,socket:void 0},a,o=!1,c=n(()=>{o||this.closed||(a=setTimeout(h,r.next()))},"a"),u=n(f=>{if(o||this.WebSocketImpl===void 0)return;let p=f===void 0?s:`${s}?token=${encodeURIComponent(f)}`;ir(i,p,this.managedSocketOptions,{onClose:n(()=>{c()},"onClose"),onMessage:n(m=>{let y;try{y=JSON.parse(typeof m.data=="string"?m.data:"")}catch{return}y.type==="jobs"&&Array.isArray(y.records)&&(r.reset(),e(y.records.map(v=>Gt(v))))},"onMessage")})},"c"),d=n(async f=>{let p;try{p=await f()}catch{c();return}u(p)},"d"),h=n(()=>{if(o||this.WebSocketImpl===void 0)return;let{wsToken:f}=this;if(typeof f=="function"){d(f).catch(()=>{});return}u(f)},"h");h();let l=n(()=>{o=!0,a!==void 0&&(clearTimeout(a),a=void 0),i.connectTimer!==void 0&&(clearTimeout(i.connectTimer),i.connectTimer=void 0),Ee(i),i.socket?.close(),i.socket=void 0},"u");return this.adminSocketTeardowns.add(l),()=>{this.adminSocketTeardowns.delete(l),l()}}async listFunctions(){return va(this.adminHost)}async getCronJobs(){return Sa(this.adminHost)}async runCronJob(e){return wa(this.adminHost,e)}async fetchOpenApi(){return Ca(this.adminHost)}async fetchArchitecture(){return ka(this.adminHost)}async fetchOpenRpc(){return Ta(this.adminHost)}async listStorageObjects(e={}){return Ha(this.adminHost,e)}async deleteStorageObject(e,s){return Wa(this.adminHost,e,s)}async listStorageBuckets(){return za(this.adminHost)}async uploadStorageObject(e){return Ga(this.adminHost,e)}async signedStorageUrl(e,s){return Va(this.adminHost,e,s)}async listGlobalTables(){return Ea(this.adminHost)}async readGlobalTablePage(e){return Ia(this.adminHost,e)}async facetGlobalColumn(e){return Oa(this.adminHost,e)}async listVectorIndexes(){return Ja(this.adminHost)}async queryVectorIndex(e){return Ya(this.adminHost,e)}async queryLogArchive(e={}){return Qa(this.adminHost,e)}async listKvNamespaces(){return Ra(this.adminHost)}async listKvKeys(e){return Aa(this.adminHost,e)}async getKvValue(e){return Fa(this.adminHost,e)}async putKvValue(e){return Pa(this.adminHost,e)}async deleteKvKey(e){return Ma(this.adminHost,e)}async listAuthUsers(e={}){this.assertOpen();let s=F(In,{filterField:e.filterField,filterValue:e.filterValue,limit:e.limit,offset:e.offset,search:e.search,searchField:e.searchField,sortBy:e.sortBy,sortDirection:e.sortDirection});return await this.adminFetch(s,"GET")}async createAuthUser(e){return this.assertOpen(),await this.adminFetch(Rn,"POST",e)}async setAuthUserRole(e){return this.assertOpen(),await this.adminFetch(An,"POST",e)}async banAuthUser(e){return this.assertOpen(),await this.adminFetch(Fn,"POST",e)}async unbanAuthUser(e){return this.assertOpen(),await this.adminFetch(Pn,"POST",e)}async setAuthUserPassword(e){this.assertOpen(),await this.adminFetch(Mn,"POST",e)}async removeAuthUser(e){this.assertOpen(),await this.adminFetch(xn,"POST",e)}async impersonateAuthUser(e){return this.assertOpen(),await this.adminFetch(Qn,"POST",e)}async revokeAuthSession(e){this.assertOpen(),await this.adminFetch(_n,"POST",e)}async revokeAuthUserSessions(e){this.assertOpen(),await this.adminFetch(Ln,"POST",e)}async getAuthCapabilities(){return this.assertOpen(),await this.adminFetch(Dn,"GET")}async updateAuthUser(e){return this.assertOpen(),await this.adminFetch(Un,"POST",e)}async listAuthAccounts(e){return this.assertOpen(),await this.adminFetch(F(Kn,{userId:e.userId}),"GET")}async unlinkAuthAccount(e){this.assertOpen(),await this.adminFetch(Nn,"POST",e)}async listAuthPasskeys(e){return this.assertOpen(),await this.adminFetch(F(qn,{userId:e.userId}),"GET")}async deleteAuthPasskey(e){this.assertOpen(),await this.adminFetch(jn,"POST",e)}async disableAuthTwoFactor(e){this.assertOpen(),await this.adminFetch(Bn,"POST",e)}async listAuthOrganizations(e={}){return this.assertOpen(),await this.adminFetch(F($n,{limit:e.limit,offset:e.offset}),"GET")}async listAuthOrgMembers(e){this.assertOpen();let s=F(Hn,{limit:e.limit,offset:e.offset,organizationId:e.organizationId});return await this.adminFetch(s,"GET")}async listAuthOrgInvitations(e){this.assertOpen();let s=F(Wn,{limit:e.limit,offset:e.offset,organizationId:e.organizationId});return await this.adminFetch(s,"GET")}async listAuthSignUpInvitations(e={}){this.assertOpen();let s=F(Jn,{limit:e.limit,offset:e.offset});return await this.adminFetch(s,"GET")}async createAuthSignUpInvitation(e){return this.assertOpen(),await this.adminFetch(Yn,"POST",e)}async revokeAuthSignUpInvitation(e){this.assertOpen(),await this.adminFetch(Xn,"POST",e)}async removeAuthOrgMember(e){this.assertOpen(),await this.adminFetch(zn,"POST",e)}async cancelAuthOrgInvitation(e){this.assertOpen(),await this.adminFetch(Gn,"POST",e)}async getAuthConfig(){return this.assertOpen(),await this.adminFetch(Vn,"GET")}async createAuthOrganization(e){return this.assertOpen(),await this.adminFetch(Zn,"POST",e)}async updateAuthOrganization(e){return this.assertOpen(),await this.adminFetch(ea,"POST",e)}async deleteAuthOrganization(e){this.assertOpen(),await this.adminFetch(ta,"POST",e)}async addAuthOrgMember(e){return this.assertOpen(),await this.adminFetch(sa,"POST",e)}async inviteAuthOrgMember(e){return this.assertOpen(),await this.adminFetch(ra,"POST",e)}async setAuthOrgMemberRole(e){return this.assertOpen(),await this.adminFetch(ia,"POST",e)}async listAuthOrgTeams(e){this.assertOpen();let s=F(na,{limit:e.limit,offset:e.offset,organizationId:e.organizationId});return await this.adminFetch(s,"GET")}async createAuthOrgTeam(e){return this.assertOpen(),await this.adminFetch(aa,"POST",e)}async updateAuthOrgTeam(e){return this.assertOpen(),await this.adminFetch(oa,"POST",e)}async removeAuthOrgTeam(e){this.assertOpen(),await this.adminFetch(ca,"POST",e)}async listAuthOrgTeamMembers(e){this.assertOpen();let s=F(ua,{limit:e.limit,offset:e.offset,teamId:e.teamId});return await this.adminFetch(s,"GET")}async addAuthOrgTeamMember(e){return this.assertOpen(),await this.adminFetch(ha,"POST",e)}async removeAuthOrgTeamMember(e){this.assertOpen(),await this.adminFetch(da,"POST",e)}async listAuthOrgRoles(e){this.assertOpen();let s=F(la,{limit:e.limit,offset:e.offset,organizationId:e.organizationId});return await this.adminFetch(s,"GET")}async createAuthOrgRole(e){return this.assertOpen(),await this.adminFetch(fa,"POST",e)}async updateAuthOrgRole(e){return this.assertOpen(),await this.adminFetch(pa,"POST",e)}async deleteAuthOrgRole(e){this.assertOpen(),await this.adminFetch(ma,"POST",e)}async listAuthSessions(e={}){this.assertOpen();let s=F(On,{limit:e.limit,offset:e.offset,userId:e.userId});return await this.adminFetch(s,"GET")}subscribe(e,s,r,i={}){this.assertOpen();let a=s??{},o=L.key(e.__lunoraRef,a,i.shardKey),c=this.subscriptions.get(o),u=Ye(r),d=Ye(i.onError),h=Ye(i.onCheckpoint);if(!c){this.nextSubId+=1;let f=`sub_${this.nextSubId.toString()}`,p=q(a),m=this.takeHydratedCache(e.__lunoraRef,p,i.shardKey);c={acked:!1,args:a,argsKey:p,callbacks:new Set,checkpointCallbacks:new Set,errorCallbacks:new Set,fn:e,id:f,lastValue:m?.value,optimisticLayers:[],serverBase:m?.value,serverCursor:m?.serverCursor,shardKey:i.shardKey,wireArgs:Y(a,`args for '${e.__lunoraRef}'`),...m?.serverEpoch===void 0?{}:{serverEpoch:m.serverEpoch}},this.subscriptions.add(c),m!==void 0&&this.cacheSeededQueries.set(o,m)}if(c.callbacks.add(u),d&&c.errorCallbacks.add(d),h&&c.checkpointCallbacks.add(h),c.lastValue!==void 0)try{u(c.lastValue)}catch{}this.ensureSocket(i.shardKey),this.sendSubscribeIfOpen(c);let l=c;return()=>{l.callbacks.delete(u),d&&l.errorCallbacks.delete(d),h&&l.checkpointCallbacks.delete(h),l.callbacks.size===0&&(this.sendOrQueueUnsubscribe(l.shardKey,l.id,"unsubscribe"),this.returnCacheSeed(L.keyOf(l)),this.subscriptions.remove(l),this.releaseIdleShard(l.shardKey))}}subscribeShape(e,s,r={}){if(this.assertOpen(),this.followsAnotherTab()){let{onError:o}=r;return o!==void 0&&queueMicrotask(()=>{o({code:"NOT_IMPLEMENTED",message:"LunoraClient: `subscribeShape` is unavailable on a cross-tab follower tab. The `crossTabSync` channel only carries data from the leader tab outward and shape pokes are not part of that broadcast set, so this subscription could never resolve. Turn off `crossTabSync`, or use a `list`-backed collection, which IS relayed."})}),()=>{}}this.nextShapeId+=1;let i=`shape_${this.nextShapeId.toString()}`,a={args:e.args,callbacks:new Set([s]),errorCallbacks:r.onError?new Set([r.onError]):new Set,id:i,name:e.name,onCheckpoint:r.onCheckpoint,rows:new Map,shardKey:r.shardKey,wireArgs:e.args===void 0?void 0:Y(e.args,`shape args for '${e.name}'`)};return this.shapeSubscriptions.set(i,a),this.ensureSocket(r.shardKey),this.sendShapeSubscribeIfOpen(a),()=>{this.shapeSubscriptions.delete(i),this.sendOrQueueUnsubscribe(a.shardKey,i,"shape_unsubscribe"),this.releaseIdleShard(a.shardKey)}}stream(e,s,r={}){if(this.assertOpen(),this.WebSocketImpl===void 0)throw new b("INTERNAL","LunoraClient: streams require a WebSocket implementation");this.nextStreamId+=1;let i=`stream_${this.nextStreamId.toString()}`,{shardKey:a}=r,o=s??{},{handle:c,iterable:u}=Ve({maxBuffer:r.maxBuffer,onCancel:n(()=>{this.cancelStream(i,a)},"onCancel")});this.ensureSocket(a);let d=this.getConnection(a),h={id:i,query:{args:Y(o,`stream args for '${e.__lunoraRef}'`),functionPath:e.__lunoraRef,shardKey:a},type:"stream"},l={durable:r.durable===!0,generation:void 0,handle:c,lastSeq:0,message:h,shardKey:a};this.streams.set(i,l);let f=d?.wsState==="open"&&K(d,h);if(!f&&d===void 0)return this.forgetStream(i),c.fail(new b("STREAM_DISCONNECTED","stream unavailable: this tab is not the cross-tab WebSocket leader, so it holds no socket to stream over")),u;if(!f){for(d.pendingStreams=d.pendingStreams??[];d.pendingStreams.length>=ao;){let p=d.pendingStreams.shift()?.id,m=p?this.streams.get(p):void 0;m&&(m.handle.fail(new b("STREAM_QUEUE_OVERFLOW","stream-start frame evicted while socket was unreachable")),this.forgetStream(p))}d.pendingStreams.push(h)}return u}httpStream(e,s,r={}){if(this.closed)throw new b("CLIENT_CLOSED","LunoraClient is closed");if(!this.fetchImpl)throw new b("INTERNAL","LunoraClient: no `fetch` implementation available");let i={...this.authToken?{authorization:`Bearer ${this.authToken}`}:{},...r.headers};return $s(e,s,{baseUrl:this.url,fetch:this.fetchImpl,headers:i,maxBuffer:r.maxBuffer,signal:r.signal})}close(){this.closed=!0,this.releaseSessionChangeListener?.(),this.releaseSessionChangeListener=void 0,this.outboxLeaderRelease?.(),this.outboxLeaderRelease=void 0;for(let e of this.streams.values())e.handle.fail(new b("CLIENT_CLOSED","LunoraClient closed"));this.streams.clear();for(let e of this.connections.values())this.teardownConnection(e);for(let e of this.adminSocketTeardowns)e();this.adminSocketTeardowns.clear();for(let e of this.replayRetryTimers.values())clearTimeout(e);this.replayRetryTimers.clear(),this.replayRetryState.clear(),this.offlineQueue.clear(),this.queuedIdentities.clear(),this.cacheFlushTimer!==void 0&&(clearTimeout(this.cacheFlushTimer),this.cacheFlushTimer=void 0),this.pendingCacheWrites.size>0&&this.flushQueryCacheWrites().catch(()=>{}),this.authTokenListeners.clear(),this.statusListeners.clear(),this.tokenExpiredListeners.clear(),this.identityChangeListeners.clear(),this.mutationSettledListeners.clear(),this.pendingChangeListeners.clear(),this.whisperHandlers.clear(),this.roomFlushes.clear(),this.roomIdentityResets.clear(),this.shapeSubscriptions.clear(),this.pokeAssembler.clear(),this.subscriptions.clear(),this.clientQueryStore.clear(),this.hydratedQueryCache.clear(),this.cacheSeededQueries.clear(),this.tabCoordinator?.stop(),this.tabCoordinator=void 0}assertOpen(){if(this.closed)throw new b("INTERNAL","LunoraClient is closed")}followsAnotherTab(){let e=this.tabCoordinator;if(e===void 0||e.isLeader())return!1;let s=e.leaderTabId;return s!==void 0&&s!==e.id}assertLeaderOwnedSurface(e){if(this.followsAnotherTab())throw new b("NOT_IMPLEMENTED",`LunoraClient: \`${e}\` is unavailable on a cross-tab follower tab. The \`crossTabSync\` channel only carries data from the leader tab outward, so this call could never reach the server. Turn off \`crossTabSync\`, or keep \`${e}\` on the leader tab.`)}clearConnectionTimers(e){clearTimeout(e.reconnectTimer),clearTimeout(e.connectTimer),clearTimeout(e.stableTimer),e.reconnectTimer=void 0,e.connectTimer=void 0,e.stableTimer=void 0}shardInUse(e){let s=n(r=>g(r)===e,"t");return this.subscriptions.all().some(r=>s(r.shardKey))||[...this.shapeSubscriptions.values()].some(r=>s(r.shardKey))||[...this.streams.values()].some(r=>s(r.shardKey))||this.whisperHandlers.has(e)||this.connectionContexts.has(e)||this.connectionContextHolders.has(e)||this.offlineFlushes.has(e)||this.offlineQueue.hasPending(r=>s(r.shardKey))}releaseIdleShard(e){let s=g(e),r=this.connections.get(s);this.closed||s===""||r===void 0||(clearTimeout(r.idleTimer),r.idleTimer=setTimeout(()=>{r.idleTimer=void 0,!(this.closed||this.connections.get(s)!==r||this.shardInUse(s))&&(r.wasEverConnected&&this.idleClosedShards.add(s),this.teardownConnection(r),this.connections.delete(s),this.emitConnectionStatus())},no))}forgetStream(e){let s=this.streams.get(e);this.streams.delete(e),s&&this.releaseIdleShard(s.shardKey)}teardownConnection(e){e.polling.stop();let s=g(e.shardKey);for(let[i,a]of this.streams)g(a.shardKey)===s&&(a.handle.fail(new b("STREAM_DISCONNECTED","stream terminated: the connection carrying it was torn down")),this.streams.delete(i));e.pendingStreams=void 0,e.pendingUnsubscribes=[],this.clearResubscribeQueue(e),this.clearConnectionTimers(e),clearTimeout(e.idleTimer),e.idleTimer=void 0,Ee(e);let{socket:r}=e;if(r){e.socket=void 0;try{r.close()}catch{}}e.wsState="closed"}createTabCoordinator(){let e=`lunora-bridge::${this.url}::${this.identityFingerprint()??"anon"}`,s={activeSubscriptions:n(()=>this.subscriptions.all(),"activeSubscriptions"),broadcastStatus:n((r,i)=>this.tabCoordinator?.broadcastConnectionStatus(r,i),"broadcastStatus"),closeConnections:n(()=>{for(let[r,i]of this.connections)this.teardownConnection(i),this.connections.delete(r)},"closeConnections"),computeStatus:n(()=>this.computeStatus(),"computeStatus"),emitConnectionStatus:n(()=>{this.emitConnectionStatus()},"emitConnectionStatus"),ensureSocket:n(r=>{this.ensureSocket(r)},"ensureSocket"),flushOfflineQueues:n(()=>{this.flushAllOfflineQueues()},"flushOfflineQueues"),identityFingerprint:n(()=>this.identityFingerprint(),"identityFingerprint"),isLeader:n(()=>this.tabCoordinator?.isLeader()===!0,"isLeader"),leader:this.leader,queueResubscribe:n(r=>{this.queueResubscribe(r)},"queueResubscribe"),queuedShardKeys:n(()=>this.queuedOfflineShardKeys,"queuedShardKeys"),clientIdentifier:n(()=>this.clientId,"clientIdentifier"),dropCacheSeed:n(r=>{this.dropCacheSeed(r)},"dropCacheSeed"),ackAndAdvanceCursor:n((r,i,a)=>{this.ackAndAdvanceCursor(r,i,a)},"ackAndAdvanceCursor"),subscription:n(r=>this.subscriptions.get(r),"subscription")};return new We({channelName:e,onBecomeLeader:n(()=>{Fo(s)},"onBecomeLeader"),onStopBeingLeader:n(()=>{Po(s)},"onStopBeingLeader"),onConnectionStatus:n((r,i)=>{Mo(s,r,i)},"onConnectionStatus"),onSubscriptionData:n((r,i,a,o,c)=>{Qo(s,r,i,a,o,c)},"onSubscriptionData"),onLeaderClaimAnswered:n(()=>{xo(s)},"onLeaderClaimAnswered"),onSubscriptionError:n((r,i,a)=>{_o(s,r,i,a)},"onSubscriptionError"),onSubscriptionSettled:n((r,i,a,o,c,u)=>{Lo(s,r,i,a,o,c,u)},"onSubscriptionSettled")})}async sendBatch(e,s){if(this.assertOpen(),!this.fetchImpl)throw new b("INTERNAL","LunoraClient: no `fetch` implementation available");if(e.length===0)return[];let r=await this.fetchImpl(ie(this.url,Lt),{body:JSON.stringify({calls:e.map((c,u)=>({args:Y(c.args??{},`args for batch call '${c.fn.__lunoraRef}'`),functionPath:c.fn.__lunoraRef,id:u,shardKey:c.shardKey}))}),headers:this.rpcRequestHeaders({attachBookmark:!0}),method:"POST",signal:s}),i=r.headers.get("x-d1-bookmark");i&&this.bookmark.set(i);let a;try{a=await r.json()}catch{throw new b("INTERNAL",`LunoraClient: batch response was not JSON (status ${r.status.toString()})`)}let o=pe(a);if(!r.ok||o!==void 0&&!a.results)throw o!==void 0?Ze(o):new b("INTERNAL",`LunoraClient: batch request failed (status ${r.status.toString()})`);for(let c of a.results??[]){let u=c.body?.commitCursor;typeof c.id=="number"&&typeof u=="number"&&this.recordShardCursor(e[c.id]?.shardKey,u)}return Xa(a.results??[],e.length)}async runMutation(e,s,r){this.assertOpen();let i=s,a=r.mutationId??st(),o=this.takeReplayCredential(r.replayCredential),c=r.replayBaseline===void 0?this.baselineCursorFor(r.shardKey):r.replayBaseline??void 0,{confirms:u,rollbacks:d}=this.applyOptimisticUpdates(e.__lunoraRef,i,r.shardKey,r.optimistic);r.optimisticUpdate&&this.applyOptimisticUpdate(r.optimisticUpdate,s,r.shardKey,d,u);let h=this.offlineFlushes.get(g(r.shardKey));h!==void 0&&await h;let{hasSocket:l,idleClosed:f,polling:p,wasEverConnected:m,wsState:y}=this.connectionGateState(r.shardKey),{queueBeforeFirstConnect:v}=this.offlineQueue,C=m||v,k=this.WebSocketImpl!==void 0&&C,E=p||f,w=y==="connecting"&&C&&!E,P=y!=="open"&&!l&&k&&!E,M=k&&r.replayBaseline===void 0&&this.hasPendingWriteAhead(r.shardKey),x=n(async()=>this.enqueueOfflineMutation(e,i,r.shardKey,c,a,d,u,r.precondition,r.mutationId,o?.stamp),"ae");if(P||w||M)return x();let R;try{let N=await this.rpc(e.__lunoraRef,i,r.shardKey,{baselineSeq:c,captureBookmark:!0,...o?.flags,mutationId:a,onCommitCursor:n(X=>{R=X},"onCommitCursor")});for(let X of u)X(R);return{committed:!0,value:N}}catch(N){if(E&&k&&N instanceof TypeError&&rr(i))return x();throw this.settleFailedDirectWrite(N,R,u,d,o?.flags.authToken),N}}settleFailedDirectWrite(e,s,r,i,a){if(this.noteIdentityMismatch(e),a!==void 0&&this.noteReplayAuthRefusal(e,a),rt(e)){for(let o of r)o(s);return}fe(i)}async enqueueOfflineMutation(e,s,r,i,a,o,c,u,d,h){let l=h===void 0?this.identityFingerprint():h;if(this.outbox){this.outboxMutationCounter+=1;let f=this.outboxMutationCounter;try{await this.outbox.enqueue({args:s,baselineSeq:i,clientId:this.clientId,functionPath:e.__lunoraRef,idempotencyKey:d??`${this.clientId}:${String(f)}`,identity:l,mutationId:f,...o.length>0&&{onRejected:n(()=>{fe(o)},"onRejected")},shardKey:r})}catch(p){throw fe(o),p instanceof Error?p:new Error(String(p))}for(let p of c)p(void 0);return{committed:!1,value:void 0}}return{committed:!0,value:await new Promise((f,p)=>{let m={args:s,functionPath:e.__lunoraRef,liveAwaiter:!0,baselineSeq:i,id:a,clientId:this.clientId,identity:l,precondition:u,onCommit:n(y=>{for(let v of c)v(y)},"onCommit"),reject:n(y=>{this.queuedIdentities.delete(a),rt(y)||fe(o),p(y instanceof Error?y:new Error(String(y))),this.releaseIdleShard(r)},"reject"),resolve:f,shardKey:r};this.offlineQueue.enqueue(m),this.queuedOfflineShardKeys.add(r),this.ensureSocket(r),m.id!==void 0&&this.queuedIdentities.set(m.id,l)})}}hasPendingWriteAhead(e){if(this.outbox)return this.outbox.pending?.()??!1;let s=g(e);return this.offlineQueue.hasPending(r=>g(r.shardKey)===s)}async hydratePersistedQueue(){try{let e=await this.offlineQueue.hydrate();for(let s of e)this.queuedOfflineShardKeys.add(s),this.ensureSocket(s)}catch{}}hydrateAsOutboxLeader(){let e=n(()=>{this.hydratePersistedQueue().catch(()=>{})},"e"),s=globalThis.navigator?.locks;if(!s){e();return}s.request(`lunora:outbox-leader:${this.url}`,()=>(this.closed||e(),new Promise(r=>{if(this.closed){r();return}this.outboxLeaderRelease=r}))).catch(e)}async hydrateQueryCache(){if(this.queryCache)try{let e=await this.queryCache.load(),s=new Map;for(let r of this.subscriptions.all())s.set(ae(r.fn.__lunoraRef,r.argsKey,r.shardKey),r);for(let{key:r,...i}of e){if(xt(this.persistenceVersion,i.version)){this.queryCache.remove(r).catch(()=>{});continue}let a=s.get(r);if(a&&this.cachedQueryMatchesIdentity(i)){this.seedSubscriptionFromCache(a,i);continue}this.hydratedQueryCache.set(r,i)}}catch{}}seedSubscriptionFromCache(e,s){e.serverBase!==void 0||e.lastValue!==void 0||!this.cachedQueryMatchesIdentity(s)||(e.serverBase=s.value,e.serverCursor=s.serverCursor,s.serverEpoch!==void 0&&(e.serverEpoch=s.serverEpoch),this.cacheSeededQueries.set(ae(e.fn.__lunoraRef,e.argsKey,e.shardKey),s),se(e,s.value))}syncReadCacheToCredential(e){this.subjectAwaitingReconfirm()?this.revokeCacheSeededValues():e&&this.reseedFromHydratedCache()}dropCacheSeed(e){this.cacheSeededQueries.delete(e),this.hydratedQueryCache.delete(e)}returnCacheSeed(e){let s=this.cacheSeededQueries.get(e);s!==void 0&&(this.cacheSeededQueries.delete(e),this.hydratedQueryCache.set(e,s))}revokeCacheSeededValues(){if(this.cacheSeededQueries.size!==0){for(let[e,s]of this.cacheSeededQueries){let r=this.subscriptions.get(e);r!==void 0&&(r.serverBase=void 0,r.serverCursor=void 0,r.serverEpoch=void 0,se(r,void 0)),this.hydratedQueryCache.set(e,s)}this.cacheSeededQueries.clear()}}takeHydratedCache(e,s,r){let i=ae(e,s,r),a=this.hydratedQueryCache.get(i);if(!(a===void 0||!this.cachedQueryMatchesIdentity(a)))return this.hydratedQueryCache.delete(i),a}reseedFromHydratedCache(){if(this.hydratedQueryCache.size!==0)for(let e of this.subscriptions.all()){let s=ae(e.fn.__lunoraRef,e.argsKey,e.shardKey),r=this.hydratedQueryCache.get(s);r!==void 0&&this.cachedQueryMatchesIdentity(r)&&(this.hydratedQueryCache.delete(s),this.seedSubscriptionFromCache(e,r))}}persistQueryValue(e){let s=e.serverBase;if(!this.queryCache||s===void 0)return;let r=ae(e.fn.__lunoraRef,e.argsKey,e.shardKey),i=this.getConnection(e.shardKey)?.identity,a=i===void 0?this.identityFingerprint():i;a===null&&this.identityUnresolved()||(this.pendingCacheWrites.set(r,{identity:a,serverCursor:e.serverCursor,ts:Date.now(),value:s,...a===this.identityFingerprint()&&!this.subjectAwaitingReconfirm()?this.credentialStamp():{},...e.serverEpoch===void 0?{}:{serverEpoch:e.serverEpoch},...this.persistenceVersion===void 0?{}:{version:this.persistenceVersion}}),this.cacheFlushTimer??=setTimeout(()=>{this.flushQueryCacheWrites().catch(()=>{})},ro))}async flushQueryCacheWrites(){this.cacheFlushTimer=void 0;let{queryCache:e}=this;if(!e){this.pendingCacheWrites.clear();return}let s=[...this.pendingCacheWrites.entries()];this.pendingCacheWrites.clear(),await Promise.allSettled(s.map(async([r,i])=>e.put(r,i)))}computeStatus(){if(this.tabCoordinator&&!this.tabCoordinator.isLeader())return this.leader.status??"idle";let e=[...this.connections.values()];return e.length===0?"idle":e.some(s=>s.wsState==="open")?"connected":e.some(s=>s.polling.isPolling())?"polling":e.some(s=>s.wsState==="connecting")?"connecting":"offline"}baselineCursorFor(e){let s=g(e),r;for(let i of this.subscriptions.all())g(i.shardKey)!==s||i.serverCursor===void 0||(r=r===void 0?i.serverCursor:Math.max(r,i.serverCursor));return r}async pollSubscriptions(e){let s=g(e),r=[];for(let c of this.subscriptions.all())g(c.shardKey)===s&&(rr(c.args)?r.push(c):V(c.errorCallbacks,{code:"WIRE_ENCODE_FAILED",message:"could not encode this subscription's args for a poll"}));if(r.length===0)return this.probeOrigin();let i=Hs(),a=this.identityFingerprint(),o;try{o=await nr(async c=>this.sendBatch(r.map(u=>({args:u.args,fn:u.fn,shardKey:u.shardKey})),c))}catch(c){return!(c instanceof TypeError)}if(this.identityFingerprint()!==a)return!0;for(let[c,u]of r.entries()){let d=o[c];if(d!==void 0){if(!d.ok){V(u.errorCallbacks,{code:d.error.code,message:d.error.message});continue}this.handleDataMessage({data:B(d.value),id:u.id,type:"data"},i)}}return!0}async probeOrigin(){let{fetchImpl:e}=this;if(!e)return!1;try{return await nr(async s=>e(ie(this.url,Lt),{body:JSON.stringify({calls:[]}),headers:this.rpcRequestHeaders({}),method:"POST",signal:s})),!0}catch{return!1}}emitConnectionStatus(){let e=this.computeStatus();e!==this.lastStatus&&(this.lastStatus=e,this.statusListeners.emit(e),this.tabCoordinator?.isLeader()&&this.tabCoordinator.broadcastConnectionStatus(e,this.identityFingerprint()))}emitItemSettled(e,s,r){this.mutationSettledListeners.emit({args:e.args,code:r===void 0?void 0:r.code,error:r,functionPath:e.functionPath,hadAwaiter:e.liveAwaiter??!1,id:e.id??"",shardKey:e.shardKey,status:s})}applyOptimisticUpdates(e,s,r,i){let a=[],o=[];if(!i)return{confirms:a,rollbacks:o};let c=L.key(e,s,r),u=this.subscriptions.get(c);if(u){let d=At(u,i);d&&(a.push(d.confirm),o.push(d.rollback))}return{confirms:a,rollbacks:o}}applyOptimisticUpdate(e,s,r,i,a){let{confirms:o,rollbacks:c,store:u}=Gs(this.subscriptions,r);try{e(u,s)}catch{fe(c);return}i.push(...c),a.push(...o)}getConnection(e){return this.connections.get(g(e))}sendOrQueueUnsubscribe(e,s,r){let i=this.getConnection(e);i&&!K(i,{id:s,type:r})&&i.pendingUnsubscribes.push({id:s,type:r})}connectionGateState(e){if(this.tabCoordinator&&!this.tabCoordinator.isLeader()){let i="idle";return this.leader.status==="connected"?i="open":this.leader.status==="connecting"&&(i="connecting"),{hasSocket:!1,idleClosed:!1,polling:this.leader.status==="polling",wasEverConnected:this.leader.wasEverConnected,wsState:i}}let s=this.getConnection(e),r=s===void 0&&this.idleClosedShards.has(g(e));return{hasSocket:s?.socket!==void 0,idleClosed:r,polling:s?.polling.isPolling()??!1,wasEverConnected:s?.wasEverConnected??r,wsState:s?.wsState??"idle"}}getOrCreateConnection(e){let s=g(e),r=this.connections.get(s);return r||(r={connectTimer:void 0,heartbeatTimer:void 0,lastFrameAt:0,pendingUnsubscribes:[],polling:mo({afterFailedAttempts:this.pollingFallbackAfterFailedAttempts,intervalMs:this.pollingFallbackIntervalMs,onReachable:n(()=>{this.flushOfflineQueue(e).catch(()=>{})},"onReachable"),onStateChange:n(()=>{this.emitConnectionStatus()},"onStateChange"),poll:n(async()=>this.pollSubscriptions(e),"poll")}),reconnect:ke(this.reconnectOptions),reconnectTimer:void 0,resubscribePending:new Map,resubscribeQueue:[],shardKey:e,socket:void 0,stableTimer:void 0,wasEverConnected:this.idleClosedShards.delete(s),wsState:"idle"},this.connections.set(s,r)),r}wsUrlFor(e,s){let r=[];if(e!==void 0&&r.push(`shard=${encodeURIComponent(e)}`),s!==void 0&&r.push(`token=${encodeURIComponent(s)}`),r.length===0)return this.wsUrl;let i=this.wsUrl.includes("?")?"&":"?";return`${this.wsUrl}${i}${r.join("&")}`}rpcRequestHeaders(e,s){let r={"content-type":"application/json"};e.expectSubject!==void 0&&(r[qi]=ji(e.expectSubject));let i=this.shardCursors.get(this.cursorKeyFor(s));i!==void 0&&(r["x-lunora-min-seq"]=i.toString());let a=e.authToken===void 0?this.authToken:e.authToken;if(a&&(r.authorization=`Bearer ${a}`),e.mutationId&&(r["x-lunora-mutation-id"]=e.mutationId),(e.clientId!==void 0||e.mutationId!==void 0)&&(r["x-lunora-client-id"]=e.clientId??this.clientId),e.clientSeq!==void 0&&(r["x-lunora-client-seq"]=e.clientSeq.toString()),e.baselineSeq!==void 0&&(r["x-lunora-base-seq"]=e.baselineSeq.toString()),e.attachBookmark){let o=this.bookmark.get();o&&(r["x-d1-bookmark"]=o)}return r}async rpc(e,s,r,i={}){if(!this.fetchImpl)throw new z("LunoraClient: no `fetch` implementation available");let a=this.rpcRequestHeaders(i,r),o=i.authToken===void 0?this.authToken:i.authToken,c=await this.fetchImpl(ie(this.url,Yi),{body:JSON.stringify({args:Y(s,`args for '${e}'`),functionPath:e,shardKey:r}),headers:a,method:"POST"});if(i.captureBookmark){let l=c.headers.get("x-d1-bookmark");l&&this.bookmark.set(l)}let u;try{u=await c.json()}catch{throw Te(c.status,c.statusText,c.headers.get("retry-after"))}let d=u;if(typeof d!="object"||d===null||Array.isArray(d))throw Te(c.status,c.statusText,c.headers.get("retry-after"));let h=pe(u);if(h!==void 0)throw Mt(h,c.headers.get("retry-after"));if(!c.ok)throw Te(c.status,c.statusText,c.headers.get("retry-after"));i.onMutationAck?.(u.lastMutationId),i.onCommitCursor?.(u.commitCursor),this.noteCredentialAccepted(o),this.learnDefaultShardKey(c,r),this.recordShardCursor(r,u.commitCursor);try{return I(u.result)}catch(l){throw fr(l)}}async adminFetch(e,s,r,i){if(!this.fetchImpl)throw new b("INTERNAL","LunoraClient: no `fetch` implementation available");let a={};this.authToken&&(a.authorization=`Bearer ${this.authToken}`);let o=r instanceof ArrayBuffer||r instanceof Blob,c;r===void 0?c=void 0:o?(c=r,i!==void 0&&(a["content-type"]=i)):(c=JSON.stringify(r),a["content-type"]="application/json");let u=await this.fetchImpl(ie(this.url,e),{body:c,headers:a,method:s}),d;try{d=await u.json()}catch{let l=u.statusText?` ${u.statusText}`:"";throw new b("INTERNAL",`LunoraClient: response was not JSON (status ${u.status.toString()}${l})`)}let h=pe(d);if(h!==void 0){let l=new Error(h.message??"admin request failed");throw l.code=h.code,l}if(!u.ok){let l=u.statusText?` ${u.statusText}`:"";throw new b("INTERNAL",`LunoraClient: admin request failed (status ${u.status.toString()}${l})`)}return d}effectiveConnectionContext(e){let s=this.connectionContextHolders.get(e);return s&&s.length>0?s[s.length-1]?.context:this.connectionContexts.get(e)??this.defaultConnectionContext}refreshConnectionContext(e){let s=this.connections.get(e);s?.wsState==="open"&&this.sendConnectEnvelope(s)}sendConnectEnvelope(e){let s=this.effectiveConnectionContext(g(e.shardKey));K(e,{caps:Uo,clientId:this.clientId,id:"connect",type:"connect",...s===void 0?{}:{context:s}})}resendShapeSubscriptions(e){for(let s of this.shapeSubscriptions.values())g(s.shardKey)===g(e)&&this.sendShapeSubscribeIfOpen(s)}ensureSocket(e){if(this.closed||this.WebSocketImpl===void 0||this.tabCoordinator&&!this.tabCoordinator.isLeader())return;let s=this.getOrCreateConnection(e);if(!(s.wsState==="open"||s.wsState==="connecting")){if(s.wsState="connecting",this.emitConnectionStatus(),typeof this.wsToken=="function"){this.openSocketWithProvidedToken(s,e,this.wsToken).catch(()=>{});return}this.openSocket(s,e,this.wsToken)}}async openSocketWithProvidedToken(e,s,r){let i=this.wsTokenGeneration,a;try{a=await r()}catch{this.handleDisconnect(e);return}if(!(this.closed||this.WebSocketImpl===void 0||e.wsState!=="connecting"||e.socket!==void 0)){if(i!==this.wsTokenGeneration){typeof this.wsToken=="function"?await this.openSocketWithProvidedToken(e,s,this.wsToken):this.openSocket(e,s,this.wsToken);return}this.openSocket(e,s,a)}}openSocket(e,s,r){this.WebSocketImpl!==void 0&&(e.identity=this.identityFingerprint(),r===void 0&&this.authToken===null?(this.identityQuestions+=1,e.identityQuestion=this.identityQuestions):e.identityQuestion=void 0,e.retired=!1,ir(e,this.wsUrlFor(s,r),this.managedSocketOptions,{onClose:n(i=>{i?.code===4001&&this.notifyTokenExpired(),this.handleDisconnect(e)},"onClose"),onMessage:n(i=>{e.retired!==!0&&this.handleServerMessage(i.data,s)},"onMessage"),onOpen:n(()=>{e.wsState="open",e.wasEverConnected=!0,e.identityConfirmed=!1,e.roomsRejoined=!1,e.polling.noteOpen(),clearTimeout(e.stableTimer),e.stableTimer=setTimeout(()=>{e.wsState==="open"&&e.reconnect.reset()},io),this.emitConnectionStatus(),this.sendConnectEnvelope(e),this.markShardPendingAck(s),this.clearResubscribeQueue(e);for(let a of this.subscriptions.all())g(a.shardKey)===g(s)&&this.queueResubscribe(a);if(this.resendShapeSubscriptions(s),e.pendingUnsubscribes.length>0){let a=e.pendingUnsubscribes;e.pendingUnsubscribes=[];for(let{id:o,type:c}of a)K(e,{id:o,type:c});this.releaseIdleShard(s)}ho(e);let i=this.whisperHandlers.get(g(s));if(i)for(let a of i.keys())K(e,{topic:a,type:"whisper_subscribe"});e.roomsRejoined=!0,this.releaseRoomSends(s),this.flushOfflineQueue(s).catch(()=>{})},"onOpen")}))}cancelStream(e,s){let r=this.getConnection(s);r&&(r.pendingStreams=r.pendingStreams?.filter(i=>i.id!==e),K(r,{id:e,type:"unsubscribe"})),this.forgetStream(e)}handleDisconnect(e){if(this.closed||e.wsState==="idle"||e.wsState==="closed")return;e.wsState==="connecting"&&e.polling.noteFailedOpen(),Ee(e),this.clearConnectionTimers(e),e.socket=void 0,e.wsState="idle",this.emitConnectionStatus(),this.markShardPendingAck(e.shardKey),this.clearResubscribeQueue(e);let s=new Set((e.pendingStreams??[]).map(i=>i.id));for(let[i,a]of this.streams)if(!(g(a.shardKey)!==g(e.shardKey)||s.has(i))){if(a.durable){let o={...a.message,...a.generation===void 0?{}:{generation:a.generation},sinceChunk:a.lastSeq};a.message=o,e.pendingStreams=[...(e.pendingStreams??[]).filter(c=>c.id!==i),o];continue}a.handle.fail(new b("STREAM_DISCONNECTED","stream terminated: WebSocket disconnected")),this.forgetStream(i)}if(this.WebSocketImpl===void 0)return;let r=e.reconnect.next();e.reconnectTimer=setTimeout(()=>{e.reconnectTimer=void 0,this.ensureSocket(e.shardKey)},r)}markShardPendingAck(e){let s=g(e);for(let r of this.subscriptions.all())g(r.shardKey)===s&&(r.acked=!1)}queueResubscribe(e){let s=this.getConnection(e.shardKey);s&&(s.resubscribeQueue.push(e),this.drainResubscribeQueue(s))}drainResubscribeQueue(e){for(;e.resubscribePending.size<oo;){let s=e.resubscribeQueue.shift();if(!s)return;this.subscriptions.getById(s.id)&&this.sendSubscribeIfOpen(s)&&e.resubscribePending.set(s.id,setTimeout(()=>{this.releaseResubscribeSlot(e,s.id)},co))}}releaseResubscribeSlot(e,s){let r=e.resubscribePending.get(s);r!==void 0&&(clearTimeout(r),e.resubscribePending.delete(s),this.drainResubscribeQueue(e))}clearResubscribeQueue(e){for(let s of e.resubscribePending.values())clearTimeout(s);e.resubscribePending.clear(),e.resubscribeQueue=[]}sendSubscribeIfOpen(e){let s=this.getConnection(e.shardKey);if(s?.wsState!=="open"||e.acked)return!1;let r=e.serverCursor!==void 0&&e.serverBase!==void 0;return K(s,{id:e.id,query:{args:e.wireArgs,functionPath:e.fn.__lunoraRef,table:e.fn.__lunoraRef,...r?{sinceSeq:e.serverCursor}:{},...r&&e.serverEpoch!==void 0?{sinceEpoch:e.serverEpoch}:{}},type:"subscribe"})}sendShapeSubscribeIfOpen(e){let s=this.getConnection(e.shardKey);s?.wsState==="open"&&K(s,{id:e.id,shape:{name:e.name,...e.wireArgs===void 0?{}:{args:e.wireArgs}},type:"shape_subscribe",...e.serverCursor===void 0?{}:{sinceCheckpoint:e.serverCursor},...e.serverEpoch===void 0?{}:{sinceEpoch:e.serverEpoch}})}handleServerMessage(e,s){let r=fo(e);if(r===void 0)return;let i;try{i=JSON.parse(r)}catch{return}if(i.type!=="error"&&this.getConnection(s)?.reconnect.reset(),typeof i.id=="string"){let a=this.getConnection(s);a&&this.releaseResubscribeSlot(a,i.id)}switch(i.type){case"ack":{let a=this.subscriptions.getById(i.id);a&&(a.acked=!0);return}case"chunk":{let{data:a,generation:o,id:c,seq:u}=i,d=this.streams.get(c);d&&typeof u=="number"&&(d.lastSeq=u,typeof o=="number"&&(d.generation=o),d.durable=!0),d?.handle.push(I(a));return}case"complete":{this.handleCompleteMessage(i.id);return}case"data":case"delta":{this.handleDataMessage(i);return}case"error":{this.handleErrorMessage(i);break}case"identity":{this.handleIdentityFrame(i,s),this.confirmShardIdentity(s);break}case"pokeEnd":{this.handlePokeEnd(i,s);break}case"pokePart":{this.pokeAssembler.part(s,i);break}case"pokeStart":{this.pokeAssembler.start(s,i);break}case"resume":{this.handleResumeMessage(i);break}case"settled":{this.handleSettledMessage(i);break}case"whisper":{this.dispatchWhisper(i,s);break}}}handleErrorMessage(e){let s=e.error?.code;if(s==="TOKEN_EXPIRED"){this.notifyTokenExpired();return}if(s==="STREAM_ID_IN_USE")return;let{id:r}=e,i=r===void 0?void 0:this.streams.get(r);if(i&&r!==void 0){i.handle.fail(Js(e)),this.forgetStream(r);return}let a=r===void 0?void 0:this.subscriptions.getById(r);if(a){let c=Pt(e),u=this.identityFingerprint(),d=L.keyOf(a);V(a.errorCallbacks,c),this.tabCoordinator?.isLeader()&&this.tabCoordinator.broadcastSubscriptionError(d,c,u);return}let o=r===void 0?void 0:this.shapeSubscriptions.get(r);o&&V(o.errorCallbacks,Pt(e))}handlePokeEnd(e,s){let r=this.pokeAssembler.end(s,e.pokeId);if(r){Ro(this.shapeSubscriptions,r);for(let i of r.parts.keys()){let a=this.shapeSubscriptions.get(i);a&&!r.undecodable.has(i)&&this.applyPokePart(a,r,e)}}}applyPokePart(e,s,r){let i=Oo(e,s,r);if(ar(e),i==="reseed"){this.sendShapeSubscribeIfOpen(e);return}e.onCheckpoint?.({checkpoint:e.serverCursor,mutationId:e.lastMutationId})}resnapshotSubscription(e){e.acked=!1,e.serverCursor=void 0,e.serverEpoch=void 0,console.warn("[lunora] could not merge a row delta into the cached result; re-subscribing for a full snapshot"),this.sendSubscribeIfOpen(e)}handleDataMessage(e,s){let{id:r}=e,i=r?this.subscriptions.getById(r):void 0;if(!i)return;let a;try{a=qs(e,i.serverBase)}catch(o){V(i.errorCallbacks,{code:"WIRE_DECODE_FAILED",message:`could not decode a server frame for this subscription \u2014 ${o instanceof Error?o.message:String(o)}`});return}if(a===It){this.resnapshotSubscription(i);return}if(this.dropCacheSeed(L.keyOf(i)),pr(i,a,{cursor:e.cursor,epoch:e.epoch}),e.lastMutationId!==void 0&&(jt(i,e.lastMutationId),Bt(i,!0)),this.persistQueryValue(i),Xe(i,i.serverCursor),s!==void 0&&zs(i,s),se(i,a),this.tabCoordinator?.isLeader()){let o=L.keyOf(i);this.tabCoordinator.broadcastSubscriptionData(o,a,i.serverCursor,i.serverEpoch,this.identityFingerprint())}}handleResumeMessage(e){let s=this.subscriptions.getById(e.id);s&&this.ackAndAdvanceCursor(s,e.cursor,e.epoch)}handleSettledMessage(e){let s=this.subscriptions.getById(e.id);if(s&&(this.ackAndAdvanceCursor(s,e.cursor,e.epoch),e.lastMutationId!==void 0&&jt(s,e.lastMutationId),Bt(s),this.tabCoordinator?.isLeader())){let r=L.keyOf(s);this.tabCoordinator.broadcastSubscriptionSettled(r,s.serverCursor,s.serverEpoch,s.lastMutationId,this.clientId,this.identityFingerprint())}}ackAndAdvanceCursor(e,s,r){e.acked=!0,(s!==void 0&&s!==e.serverCursor||r!==void 0&&r!==e.serverEpoch)&&(s!==void 0&&(e.serverCursor=s),r!==void 0&&(e.serverEpoch=r),this.persistQueryValue(e),Xe(e,e.serverCursor)&&se(e,e.serverBase))}dispatchWhisper(e,s){let r=this.whisperHandlers.get(g(s))?.get(e.topic);if(!r)return;let i=I(e.data);for(let a of r)try{a(i,e.from)}catch{}}notifyTokenExpired(){this.tokenExpiredListeners.emit()}handleCompleteMessage(e){let s=this.streams.get(e);if(s){s.handle.complete(),this.forgetStream(e);return}let r=this.subscriptions.getById(e);r&&(r.acked=!1,V(r.errorCallbacks,{code:"SUBSCRIPTION_CANCELLED",message:"subscription was cancelled by the server"}))}unpersist(e){e&&this.persistence?.remove(e).catch(s=>{re(this.onPersistenceError,"remove",s,e)})}identityFingerprint(){if(this.authSubject!==void 0)return this.authSubject===null?null:`subj:${this.authSubject}`;let e=this.authToken;return e===null?null:this.hashToken(e)}hashToken(e){let s=2166136261,r=5381;for(let i=0;i<e.length;i+=1){let a=e.charCodeAt(i);s^=a,s=Math.imul(s,16777619),r=Math.imul(r,33)+a}return`${e.length.toString(36)}:${(s>>>0).toString(36)}:${(r>>>0).toString(36)}`}credentialStamp(){let e=this.authToken;return e===null?{}:{credential:this.hashToken(e)}}cachedQueryMatchesIdentity(e){return this.identityFingerprint()===null&&this.identityUnresolved()?!1:!this.subjectAwaitingReconfirm()&&e.identity===this.identityFingerprint()||this.isSameCredentialUnderTokenHash(e.identity)?!0:e.credential!==void 0&&e.credential===this.credentialStamp().credential}isSameCredentialUnderTokenHash(e){if(e===null||e.startsWith("subj:"))return!1;let s=this.authToken;return s===null?!1:this.hashToken(s)===e}releaseSessionProbe(){this.sessionProbesInFlight-=1,!(this.identityUnresolved()||this.identityFingerprint()!==null)&&!this.closed&&this.offlineQueue.size>0&&Ut(this.computeStatus())&&this.flushAllOfflineQueues()}identityUnresolved(){return this.sessionProbesInFlight>0?!0:this.identityResolutionExpected&&!this.identitySettled}adoptResolvedSubject(e,s,r){if(!(this.closed||this.authToken!==e||r!==this.sessionProbeGeneration)){if(e===null){this.adoptCookieSubject(s?.id??null,r);return}s!==null&&this.setAuthToken(e,s.id)}}adoptCookieSubject(e,s){return this.closed||this.authToken!==null||s<this.identityAnsweredAt?!1:(this.identityAnsweredAt=s,this.identitySettled=!0,this.setAuthToken(null,e),!0)}sendEncodedWhisper(e,s,r){this.ensureSocket(r.shardKey);let i=this.getConnection(r.shardKey),a=i!==void 0&&K(i,{data:s,topic:e,type:"whisper"});return this.releaseIdleShard(r.shardKey),a}roomSendsAdmitted(e){let s=this.getConnection(e);return s?.wsState==="open"&&s.retired!==!0&&s.identityConfirmed===!0&&s.roomsRejoined===!0}releaseRoomSends(e){if(this.roomSendsAdmitted(e))for(let s of this.roomFlushes.get(g(e))??[])s()}confirmShardIdentity(e){let s=this.getConnection(e);s!==void 0&&(s.identityConfirmed=!0),this.releaseRoomSends(e)}handleIdentityFrame(e,s){let r=this.getConnection(s)?.identityQuestion,{subject:i}=e;r===void 0||i!==null&&typeof i!="string"||this.adoptCookieSubject(i,r)||!this.closed&&this.authToken===null&&(i===null?null:`subj:${i}`)!==this.identityFingerprint()&&this.evictPreviousIdentitySession()}applySubject(e,s){if(s!==void 0){this.authSubject=s,this.subjectToken=e;return}(e===null&&this.authSubject!==null||e!==null&&this.authSubject===null)&&(this.authSubject=void 0,this.subjectToken=null)}isKnownNobody(){return this.authSubject===null&&this.authToken===null}subjectAwaitingReconfirm(){return this.authSubject!==void 0&&this.authSubject!==null&&this.subjectToken!==this.authToken}stampOf(e){let s=e.id===void 0?void 0:this.queuedIdentities.get(e.id);return s===void 0?e.identity:s}warnRefreshWithoutSubject(e,s){e===null||s===null||this.authSubject!==void 0||this.authRefusalNotifiedFor!==this.hashToken(e)||console.warn("[lunora] setAuthToken replaced a token that was just refused for a queued write, with no subject: without one a refresh reads as a user switch, so the held writes were discarded (OFFLINE_IDENTITY_CHANGED). Pass the user id, e.g. setAuthToken(token, user.id), to keep them across a refresh.")}rejectQueuedForIdentityChange(e){let s=this.offlineQueue.drain(),r=[];for(let i of s){if(this.identityVerdict(this.stampOf(i))!=="mismatch"){r.push(i);continue}this.queuedIdentities.delete(i.id??""),this.unpersist(i.id);let a=new Error("offline mutation discarded: auth identity changed before replay");a.code="OFFLINE_IDENTITY_CHANGED",i.reject(a),this.emitItemSettled(i,"rejected",a)}this.offlineQueue.requeue(r),e!==null&&this.clearQueryCacheForIdentityChange()}restampConnectionIdentity(e,s){for(let r of this.connections.values())r.identity===e&&(r.identity=s)}restampQueuedIdentity(e,s){for(let[r,i]of this.queuedIdentities)i===e&&this.queuedIdentities.set(r,s);this.offlineQueue.restampIdentity(e,s)}restampWatermarks(e,s){let r=e??"",i=this.clientWatermarks.get(r);if(i===void 0)return;this.clientWatermarks.delete(r);let a=s??"",o=this.clientWatermarks.get(a);if(o===void 0)this.clientWatermarks.set(a,i);else for(let[c,u]of i)o.set(c,u)}clearQueryCacheForIdentityChange(){this.revokeCacheSeededValues(),this.cacheFlushTimer!==void 0&&(clearTimeout(this.cacheFlushTimer),this.cacheFlushTimer=void 0),this.pendingCacheWrites.clear(),this.hydratedQueryCache.clear(),this.queryCache?.clear().catch(()=>{})}evictPreviousIdentitySession(){this.resetRoomSends(),this.revokeCacheSeededValues();for(let e of this.subscriptions.all())e.serverBase=void 0,e.serverCursor=void 0,e.serverEpoch=void 0,e.acked=!1,se(e,void 0);for(let e of this.shapeSubscriptions.values())e.rows.clear(),e.serverCursor=void 0,e.serverEpoch=void 0,ar(e);this.bounceShardSockets(),this.retiredIdentities+=1,this.identityChangeListeners.emit()}restartTabCoordinatorForIdentity(){if(!this.tabCoordinator)return;let e=this.tabCoordinator.isLeader();this.tabCoordinator.stop(),this.tabCoordinator=this.createTabCoordinator(),this.tabCoordinator.start(),e&&this.tabCoordinator.promoteImmediately()}resetRoomSends(){for(let e of this.roomIdentityResets)e()}bounceShardSockets(){for(let e of this.connections.values())if(e.socket){e.retired=!0;try{e.socket.close()}catch{}}}flushAllOfflineQueues(){for(let e of this.queuedOfflineShardKeys)this.flushOfflineQueue(e).catch(()=>{})}async flushOfflineQueue(e){let s=g(e),r=this.offlineFlushes.get(s);if(r===void 0&&this.offlineQueue.size===0)return;let i=(async()=>{await(r??Promise.resolve());let{authToken:a}=this;try{await this.drainOfflineQueue(e,a)}catch{}!this.closed&&this.authToken!==a&&this.offlineQueue.size>0&&Ut(this.computeStatus())&&this.flushOfflineQueue(e).catch(()=>{})})();this.offlineFlushes.set(s,i),await i,this.offlineFlushes.get(s)===i&&(this.offlineFlushes.delete(s),this.releaseIdleShard(e))}async drainOfflineQueue(e,s){let r=this.offlineQueue.drainConflict();for(let h of r){this.unpersist(h.id),this.queuedIdentities.delete(h.id??"");let l=new Error("offline mutation skipped: precondition failed before replay");l.code="OFFLINE_PRECONDITION_FAILED",this.emitItemSettled(h,"rejected",l)}let i=g(e),a=this.offlineQueue.drain(h=>g(h.shardKey)===i);if(a.length===0)return;let o=[],c=[];for(let h of a){let l=this.replayGateVerdict(h);l==="send"?o.push(h):l==="hold"&&c.push(h)}if(this.offlineQueue.requeue(c),c.length>0&&this.subjectAwaitingReconfirm()&&(this.getCurrentUser().catch(()=>{}),this.noteHeldRetryDelay(e)),o.length===0){this.scheduleRateLimitedRetry(e);return}let u=this.encodableOrSettleTerminal(o);if(u.length===0){this.scheduleRateLimitedRetry(e);return}if(u.length===1){await this.replaySequential(u,e,s),this.scheduleRateLimitedRetry(e);return}let d=[];for(let h=0;h<u.length;h+=_t){let l=u.slice(h,h+_t),f=await this.replayBatched(l,e,s);if(d.push(...f.requeue),f.stop){d.push(...u.slice(h+_t));break}}d.length>0&&this.offlineQueue.requeue(d),this.scheduleRateLimitedRetry(e)}noteHeldRetryDelay(e){let s=g(e),r=this.replayRetryState.get(s),i=(r?.attempts??0)+1;this.replayRetryState.set(s,{attempts:i,delayMs:Math.max(r?.delayMs??0,Nt(i))})}noteReplayRetryDelay(e,s,r){let i=g(e),a=this.replayRetryState.get(i),o=(a?.attempts??0)+1,c=wo(s,o)??(r===null&&Ge(s)?Nt(o):void 0);this.replayRetryState.set(i,{attempts:o,delayMs:c===void 0?a?.delayMs:Math.max(a?.delayMs??0,c)})}scheduleRateLimitedRetry(e){let s=g(e),r=this.replayRetryState.get(s),i=r?.delayMs;if(r===void 0||i===void 0||this.closed||this.offlineQueue.size===0){this.replayRetryState.delete(s);return}r.delayMs=void 0;let a=this.replayRetryTimers.get(s);a!==void 0&&clearTimeout(a),this.replayRetryTimers.set(s,setTimeout(()=>{this.replayRetryTimers.delete(s),this.flushOfflineQueue(e).catch(()=>{})},i))}encodableOrSettleTerminal(e){let s=[];for(let r of e)try{Y(r.args,`args for '${r.functionPath}'`),s.push(r)}catch(i){this.settleReplayTerminal(r,i instanceof Error?i:new Error(String(i)))}return s}identityVerdict(e){if(this.subjectAwaitingReconfirm())return"unknown";let s=this.identityFingerprint();return s===null&&this.identityUnresolved()?"unknown":e===s||e!==void 0&&this.isSameCredentialUnderTokenHash(e)?"match":s===null?"unknown":"mismatch"}replayGateVerdict(e){let s=this.stampOf(e);if(s===void 0)return this.queuedIdentities.delete(e.id??""),"send";let r=this.identityVerdict(s);if(r==="unknown")return"hold";if(this.queuedIdentities.delete(e.id??""),r==="match")return"send";this.unpersist(e.id);let i=new Error("offline mutation skipped: auth identity changed before replay");return i.code="OFFLINE_IDENTITY_CHANGED",e.reject(i),this.emitItemSettled(e,"rejected",i),"reject"}settleReplaySuccess(e,s,r){this.unpersist(e.id),this.recordShardCursor(e.shardKey,r),e.onCommit?.(r),e.resolve(s),this.emitItemSettled(e,"committed")}cursorKeyFor(e){return e??this.defaultShardKey??""}learnDefaultShardKey(e,s){let r=e.headers.get("x-lunora-shard-key");if(r===null||s!==void 0||this.defaultShardKey===r)return;this.defaultShardKey=r;let i=this.shardCursors.get("");i!==void 0&&(this.shardCursors.set(r,Math.max(this.shardCursors.get(r)??0,i)),this.shardCursors.delete(""))}recordShardCursor(e,s){if(typeof s!="number")return;let r=this.cursorKeyFor(e);this.shardCursors.set(r,Math.max(this.shardCursors.get(r)??0,s))}shouldRequeueReplayFailure(e,s){return this.noteIdentityMismatch(e)?!0:this.noteReplayAuthRefusal(e,s)||bo(e)}noteReplayAuthRefusal(e,s){if(!Ge(e))return!1;let r=this.hashToken(s??"");return s===this.authToken&&this.authRefusalNotifiedFor!==r&&(this.authRefusalNotifiedFor=r,this.notifyTokenExpired()),!0}noteCredentialAccepted(e){this.authRefusalNotifiedFor!==void 0&&this.authRefusalNotifiedFor===this.hashToken(e??"")&&(this.authRefusalNotifiedFor=void 0)}takeReplayCredential(e){if(e===void 0)return;let s=this.replayCredentials.get(e);if(s===void 0)throw new TypeError("LunoraClient: `replayCredential` must come from this client's `replayIdentityVerdict`, and is single use");return this.replayCredentials.delete(e),{flags:{authToken:s.authToken,...Dt(s.stamp,s.authToken)},stamp:s.stamp}}noteIdentityMismatch(e){if(e?.code!=="IDENTITY_MISMATCH")return!1;let s=this.identityFingerprint();return this.getCurrentUser().then(()=>{!this.warnedIdentityDisagreement&&this.identityFingerprint()===s&&(this.warnedIdentityDisagreement=!0,console.warn('[lunora] a replayed write was refused with IDENTITY_MISMATCH, but `/get-session` still names the same user. The worker\'s `resolveIdentity` must return the same `userId` as the better-auth `user.id`, and RPC requests must carry the session cookie (`credentials: "include"` on a cross-origin fetch).'))}).catch(()=>{}),!0}settleReplayUndecodable(e,s,r){this.unpersist(e.id),this.recordShardCursor(e.shardKey,r),e.onCommit?.(r),e.reject(s),this.emitItemSettled(e,"committed",s)}settleReplayTerminal(e,s){this.unpersist(e.id),e.reject(s),this.emitItemSettled(e,"rejected",s)}async replaySequential(e,s,r){for(let i=0;i<e.length;i+=1){let a=e[i];if(!a)continue;let o;try{let c=await this.rpc(a.functionPath,a.args,a.shardKey,{authToken:r,baselineSeq:a.baselineSeq,captureBookmark:!0,clientId:a.clientId??this.clientId,...Dt(a.identity,r),mutationId:a.id,onCommitCursor:n(u=>{o=u},"onCommitCursor")});this.settleReplaySuccess(a,c,o)}catch(c){if(rt(c)){this.settleReplayUndecodable(a,c,o);continue}if(!this.shouldRequeueReplayFailure(c,r)){this.settleReplayTerminal(a,c);continue}this.noteReplayRetryDelay(s,c,r),this.offlineQueue.requeue(e.slice(i));return}}}async replayBatched(e,s,r){if(!this.fetchImpl)return{requeue:e,stop:!0};let i=JSON.stringify({calls:e.map((d,h)=>({args:Y(d.args,`args for '${d.functionPath}'`),baselineSeq:d.baselineSeq,functionPath:d.functionPath,id:h,clientId:d.clientId??this.clientId,mutationId:d.id,shardKey:d.shardKey}))});if(e.length>1&&ko(i)>Co)return await this.replayBatchedHalves(e,s,r);let a;try{a=await this.fetchImpl(ie(this.url,Lt),{body:i,headers:this.rpcRequestHeaders({attachBookmark:!0,authToken:r,...Dt(e.find(d=>d.identity!==void 0)?.identity,r)}),method:"POST"})}catch{return{requeue:e,stop:!0}}let o=a.headers.get("x-d1-bookmark");if(o&&this.bookmark.set(o),a.status===413&&e.length>1)return await this.replayBatchedHalves(e,s,r);let c,u=a.headers.get("retry-after");try{c=await a.json()}catch{return this.settleWholeBatchError(e,Te(a.status,a.statusText,u),s,r)}if(!c.results){let d=pe(c),h=d===void 0?Te(a.status,a.statusText,u):Mt(d,u);return this.settleWholeBatchError(e,h,s,r)}return{requeue:this.settleReplayBatchSlots(e,c.results,s,r),stop:!1}}settleWholeBatchError(e,s,r,i){if(s instanceof z||s.code!==void 0&&this.shouldRequeueReplayFailure(s,i))return this.noteReplayRetryDelay(r,s,i),{requeue:e,stop:!0};for(let a of e)this.settleReplayTerminal(a,s);return{requeue:[],stop:!1}}async replayBatchedHalves(e,s,r){let i=Math.ceil(e.length/2),a=await this.replayBatched(e.slice(0,i),s,r);if(a.stop)return{requeue:[...a.requeue,...e.slice(i)],stop:!0};let o=await this.replayBatched(e.slice(i),s,r);return{requeue:[...a.requeue,...o.requeue],stop:o.stop}}settleReplayBatchSlots(e,s,r,i){let a=To(s),o=[],c=!1,u=!1;for(let[d,h]of e.entries()){let l=Eo(a.get(d));switch(l.kind){case"committed":{c=!0,this.settleReplaySuccess(h,l.value,l.commitCursor);break}case"errored":{u||=Ge(l.error),this.shouldRequeueReplayFailure(l.error,i)?(this.noteReplayRetryDelay(r,l.error,i),o.push(h)):this.settleReplayTerminal(h,l.error);break}case"unanswered":{o.push(h);break}default:c=!0,this.settleReplayUndecodable(h,l.error,l.commitCursor)}}return c&&!u&&this.noteCredentialAccepted(i),o}};var mr=D(Yt(),1),yr=D(Z(),1);var qo=n(()=>{let t=(0,mr.c)(4),e=Ct(),s,r,i;return t[0]!==e?(s=n(a=>e.onConnectionStatus(()=>{a()}),"o"),r=n(()=>e.connectionStatus(),"e"),i=n(()=>e.connectionStatus(),"s"),t[0]=e,t[1]=s,t[2]=r,t[3]=i):(s=t[1],r=t[2],i=t[3]),(0,yr.useSyncExternalStore)(s,r,i)},"S");export{me as a,Re as b,B as c,I as d,Ur as e,$t as f,Br as g,be as h,Zr as i,ei as j,ri as k,Ct as l,qo as m};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as c}from"./chunk-VESGIGMQ.js";import{i as e}from"./chunk-OQ6I6OXT.js";import{p as m}from"./chunk-HJHSQPHW.js";import{a as s,d as p,f as n}from"./chunk-I26MS5PJ.js";var f=p(n(),1);var h=s(r=>{let t=(0,f.c)(3),a=e(),o;return t[0]!==a||t[1]!==r?(o=s(i=>{c({shardKey:r,traceId:i}),m(a({to:"/traces"}))},"e"),t[0]=a,t[1]=r,t[2]=o):o=t[2],o},"u");export{h as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as P}from"./chunk-NNSCCLU4.js";import{c as K,d as X,e as z,f as L,h as B,i as E,j as G,k as q,l as A,m as O,n as W,o as $,p as D}from"./chunk-QSF3YY7X.js";import{a as F,b as H,c as I,d as S,e as J,f as M}from"./chunk-HCTJKP5J.js";import{d as C,o as j}from"./chunk-HJHSQPHW.js";import{a as f,d as T,f as U,g as V}from"./chunk-I26MS5PJ.js";var N=T(U(),1);var t=T(V(),1);var _=50,R={value:{colors:{dark:["var(--chart-1)"],light:["var(--chart-1)"]},label:"value"}},Q=f(r=>{let a=r.columns.find(e=>r.rows.length>0&&r.rows.every(n=>typeof n[e]=="number"))??null;return{label:r.columns.find(e=>e!==a)??null,value:a}},"D"),Y=f(r=>{let a=(0,N.c)(3),{data:e,kind:n}=r,l;return a[0]!==e||a[1]!==n?(l=(0,t.jsx)(G,{className:"h-full w-full",config:R,children:n==="area"?(0,t.jsxs)(E,{data:e,children:[(0,t.jsx)(K,{vertical:!1}),(0,t.jsx)(L,{axisLine:!1,dataKey:"label",tickLine:!1}),(0,t.jsx)(A,{content:(0,t.jsx)(q,{})}),(0,t.jsx)(z,{dataKey:"value",fill:"var(--color-value-0)",fillOpacity:.2,stroke:"var(--color-value-0)",type:"monotone"})]}):(0,t.jsxs)(B,{data:e,children:[(0,t.jsx)(K,{vertical:!1}),(0,t.jsx)(L,{axisLine:!1,dataKey:"label",tickLine:!1}),(0,t.jsx)(A,{content:(0,t.jsx)(q,{})}),(0,t.jsx)(X,{dataKey:"value",dot:!1,stroke:"var(--color-value-0)",strokeWidth:2,type:"monotone"})]})}),a[0]=e,a[1]=n,a[2]=l):l=a[2],l},"J"),na=f(r=>{let a=(0,N.c)(21),{axes:e,kind:n,result:l}=r,u=C(),o;a[0]!==l?(o=Q(l),a[0]=l,a[1]=o):o=a[1];let d=o,m;a[2]!==l.columns?(m=new Set(l.columns),a[2]=l.columns,a[3]=m):m=a[3];let s=m,c=e!==void 0&&s.has(e.x)?e.x:d.label,p;a[4]!==e?.y||a[5]!==s?(p=e?.y.find(i=>s.has(i)),a[4]=e?.y,a[5]=s,a[6]=p):p=a[6];let x=p,y=x??d.value,b;a[7]!==c||a[8]!==l.rows||a[9]!==y?(b=y===null?[]:l.rows.slice(0,_).map((i,w)=>({label:c===null?`#${(w+1).toString()}`:j(i[c]),value:Number(i[y])||0})),a[7]=c,a[8]=l.rows,a[9]=y,a[10]=b):b=a[10];let k=b;if(y===null){let i;a[11]!==u?(i=u("No numeric column to chart."),a[11]=u,a[12]=i):i=a[12];let w;return a[13]!==i?(w=(0,t.jsx)("p",{className:"p-4 text-sm text-muted-foreground","data-testid":"sql-chart-empty",children:i}),a[13]=i,a[14]=w):w=a[14],w}let h=n??(e!==void 0&&x!==void 0?e.kind:"bar"),v;a[15]!==k||a[16]!==h?(v=h==="bar"?(0,t.jsxs)(O,{className:"h-full w-full",config:R,data:k,children:[(0,t.jsx)($,{dataKey:"label"}),(0,t.jsx)(W,{dataKey:"value"}),(0,t.jsx)(D,{})]}):(0,t.jsx)(Y,{data:k,kind:h}),a[15]=k,a[16]=h,a[17]=v):v=a[17];let g;return a[18]!==h||a[19]!==v?(g=(0,t.jsx)("div",{className:"h-80 w-full p-3","data-chart-kind":h,"data-testid":"sql-chart",children:v}),a[18]=h,a[19]=v,a[20]=g):g=a[20],g},"oe"),oa=f(r=>{let a=(0,N.c)(19),{result:e}=r,n=C();if(e.columns.length===0){let s;a[0]!==e.rowCount||a[1]!==n?(s=n("{count} rows",{count:e.rowCount}),a[0]=e.rowCount,a[1]=n,a[2]=s):s=a[2];let c;return a[3]!==s?(c=(0,t.jsx)("p",{className:"p-4 text-sm text-muted-foreground",children:s}),a[3]=s,a[4]=c):c=a[4],c}let l;a[5]!==e.columns?(l=e.columns.map(Z),a[5]=e.columns,a[6]=l):l=a[6];let u;a[7]!==l?(u=(0,t.jsx)(H,{className:"sticky top-0 z-10 bg-muted",children:(0,t.jsx)(S,{children:l})}),a[7]=l,a[8]=u):u=a[8];let o;if(a[9]!==e.columns||a[10]!==e.rows){let s;a[12]!==e.columns?(s=f((c,p)=>(0,t.jsx)(S,{"data-testid":"sql-row",children:e.columns.map(x=>(0,t.jsx)(M,{className:"max-w-md truncate font-mono text-xs",children:(0,t.jsx)(P,{value:c[x]})},x))},p),"s"),a[12]=e.columns,a[13]=s):s=a[13],o=e.rows.map(s),a[9]=e.columns,a[10]=e.rows,a[11]=o}else o=a[11];let d;a[14]!==o?(d=(0,t.jsx)(I,{children:o}),a[14]=o,a[15]=d):d=a[15];let m;return a[16]!==u||a[17]!==d?(m=(0,t.jsxs)(F,{"data-testid":"sql-rows",children:[u,d]}),a[16]=u,a[17]=d,a[18]=m):m=a[18],m},"ne");function Z(r){return(0,t.jsx)(J,{children:r},r)}f(Z,"P");export{na as a,oa as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as l}from"./chunk-3YXASVTP.js";import{j as u}from"./chunk-BOMPSVRC.js";import{a as c}from"./chunk-QAQDMS6R.js";import{a as t,d as o,e as h,g as z,i as d}from"./chunk-I26MS5PJ.js";var p=o(h(),1);var a=p.forwardRef(t(function(e,r){let{render:n,className:k,disabled:s=!1,focusableWhenDisabled:g=!1,nativeButton:f=!0,style:B,...b}=e,{getButtonProps:m,buttonRef:x}=l({disabled:s,focusableWhenDisabled:g,native:f});return u("button",e,{state:{disabled:s},ref:[r,x],props:[b,m]})},"Button"));var v=o(z(),1);var y=c("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-xs font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2",xs:"h-6 gap-1 rounded-md px-2 text-xs has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-md px-2.5 has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2",icon:"size-8","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-md","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function W({className:i,variant:e="default",size:r="default",...n}){return(0,v.jsx)(a,{"data-slot":"button",className:d(y({variant:e,size:r,className:i})),...n})}t(W,"v");export{W as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as q}from"./chunk-JX6TE3LZ.js";import{a as k}from"./chunk-6QTAHSDD.js";import"./chunk-VESGIGMQ.js";import"./chunk-QSF3YY7X.js";import"./chunk-AUGKHAMQ.js";import"./chunk-WJRYEML4.js";import{a as A}from"./chunk-R6U22RSY.js";import{a as $}from"./chunk-YVR4SEPU.js";import"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import"./chunk-OQ6I6OXT.js";import"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import"./chunk-AUAECCXB.js";import{b as K}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as F}from"./chunk-53NRDRMS.js";import"./chunk-NCPW7WHO.js";import"./chunk-WK5TYZAF.js";import"./chunk-55UGUCQ6.js";import{a as T}from"./chunk-4ZEL6BYL.js";import{c as S}from"./chunk-W36YKEUZ.js";import"./chunk-6L2GY26N.js";import"./chunk-QAQDMS6R.js";import"./chunk-VGL7ERWQ.js";import{a as O}from"./chunk-RWVIV3U7.js";import{a as j,e as w}from"./chunk-2IKDEUCX.js";import{d as I,t as E}from"./chunk-HJHSQPHW.js";import{a as p,d as C,f as D,g as H}from"./chunk-I26MS5PJ.js";var M=C(D(),1);var m=C(H(),1);var L=p(s=>s.length===0?void 0:{max:Math.max(...s),mean:s.reduce((e,t)=>e+t,0)/s.length,min:Math.min(...s)},"F"),B=/^gen_ai\.evaluation\.(.+)\.score$/u,P=p(s=>{let e=[];for(let t of s)for(let n of t.spans)for(let[a,l]of Object.entries(n.attributes??{})){let o=B.exec(a);if(!o||typeof l!="number")continue;let i=o[1],c=n.attributes?.[`gen_ai.evaluation.${i}.label`];e.push({...typeof c=="string"?{label:c}:{},name:i,score:l,spanName:n.name,startTs:t.startTs+n.offsetMs,traceId:t.traceId})}return e.toSorted((t,n)=>n.startTs-t.startTs)},"q"),Q=p(s=>{let e=[];for(let t of s?.series??[]){let n=B.exec(t.name);n&&e.push({name:n[1],points:t.points})}return e},"D"),R=p((s,e)=>{let t=new Set([...s.map(a=>a.name),...e.map(a=>a.name)]),n=[];for(let a of t){let l=s.filter(r=>r.name===a),o=e.find(r=>r.name===a)?.points??[],i=o.at(-1)?.last??l[0]?.score,c=o.length>0?{max:Math.max(...o.map(r=>r.max)),mean:o.reduce((r,d)=>r+d.sum,0)/o.reduce((r,d)=>r+d.count,0),min:Math.min(...o.map(r=>r.min))}:L(l.map(r=>r.score));n.push({...i===void 0?{}:{latest:i},...c,name:a,points:o,runs:l})}return n.toSorted((a,l)=>a.name.localeCompare(l.name))},"H"),U=p(s=>Array.isArray(s?.traces)?s.traces:[],"L"),N=p(s=>s===void 0?"\u2014":s.toFixed(2),"y"),z=p(s=>{let e=(0,M.c)(34),{card:t,onOpenTrace:n}=s,a=I(),l;e[0]!==t.name?(l=(0,m.jsx)("h3",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"ev-name",children:t.name}),e[0]=t.name,e[1]=l):l=e[1];let o;e[2]!==t.latest?(o=N(t.latest),e[2]=t.latest,e[3]=o):o=e[3];let i;e[4]!==o?(i=(0,m.jsx)("span",{className:"font-mono text-lg text-foreground","data-testid":"ev-latest",children:o}),e[4]=o,e[5]=i):i=e[5];let c;e[6]!==l||e[7]!==i?(c=(0,m.jsxs)("div",{className:"flex items-baseline justify-between gap-3",children:[l,i]}),e[6]=l,e[7]=i,e[8]=c):c=e[8];let r;e[9]!==t.max||e[10]!==t.mean||e[11]!==t.min||e[12]!==a?(r=a("min {min} \xB7 mean {mean} \xB7 max {max}",{max:N(t.max),mean:N(t.mean),min:N(t.min)}),e[9]=t.max,e[10]=t.mean,e[11]=t.min,e[12]=a,e[13]=r):r=e[13];let d;e[14]!==r?(d=(0,m.jsx)("p",{className:"font-mono text-xs text-muted-foreground","data-testid":"ev-summary",children:r}),e[14]=r,e[15]=d):d=e[15];let u;e[16]!==t.name||e[17]!==t.points||e[18]!==a?(u=t.points.length>1?(0,m.jsx)(q,{ariaLabel:a("Score trend for {name}",{name:t.name}),className:"h-10 w-full",series:t.points.map(G),testId:"ev-trend"}):(0,m.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"ev-no-trend",children:a("No durable history yet \u2014 pass ctx.metrics to recordEvaluation to chart a trend.")}),e[16]=t.name,e[17]=t.points,e[18]=a,e[19]=u):u=e[19];let h;if(e[20]!==t.runs||e[21]!==n||e[22]!==a){let v;e[24]!==n||e[25]!==a?(v=p(f=>(0,m.jsxs)("div",{className:"flex items-center justify-between gap-2 font-mono text-xs","data-testid":"ev-run",children:[(0,m.jsxs)("span",{className:"truncate text-muted-foreground",children:[E(f.startTs)," \xB7 ",f.spanName]}),(0,m.jsxs)("span",{className:"flex items-center gap-2",children:[f.label===void 0?null:(0,m.jsx)(K,{variant:"outline",children:f.label}),(0,m.jsx)("span",{className:"text-foreground",children:N(f.score)}),n===void 0?null:(0,m.jsx)("button",{className:"text-muted-foreground underline-offset-2 hover:underline",onClick:p(()=>{n(f.traceId)},"onClick"),title:a("Open the trace {trace}",{trace:f.traceId}),type:"button",children:f.traceId.slice(0,8)})]})]},`${f.traceId}:${f.spanName}`),"x"),e[24]=n,e[25]=a,e[26]=v):v=e[26],h=t.runs.slice(0,5).map(v),e[20]=t.runs,e[21]=n,e[22]=a,e[23]=h}else h=e[23];let x;e[27]!==h?(x=(0,m.jsx)("div",{className:"flex flex-col gap-1",children:h}),e[27]=h,e[28]=x):x=e[28];let g;return e[29]!==c||e[30]!==d||e[31]!==u||e[32]!==x?(g=(0,m.jsx)(j,{"data-testid":"ev-card",children:(0,m.jsxs)(w,{className:"flex flex-col gap-3 p-4",children:[c,d,u,x]})}),e[29]=c,e[30]=d,e[31]=u,e[32]=x,e[33]=g):g=e[33],g},"P"),oe=p(s=>{let e=(0,M.c)(19),{initialShardKey:t}=s,n=I(),{queryShardKey:a,setShardKey:l,shardKey:o}=A(t),i=k(a),c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={},e[0]=c):c=e[0];let r;e[1]!==a?(r={live:!0,shardKey:a},e[1]=a,e[2]=r):r=e[2];let{data:d,error:u}=S(T.getTraces,c,r),h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h={},e[3]=h):h=e[3];let x;e[4]!==a?(x={live:!0,shardKey:a},e[4]=a,e[5]=x):x=e[5];let{data:g}=S(T.getMetricHistory,h,x),v;if(e[6]!==d||e[7]!==u||e[8]!==g||e[9]!==i||e[10]!==l||e[11]!==o||e[12]!==n){let f=R(P(U(d)),Q(g)),y;e[14]!==l||e[15]!==o?(y=(0,m.jsx)($,{onChange:l,testId:"ev-shard-input",value:o}),e[14]=l,e[15]=o,e[16]=y):y=e[16];let b;e[17]!==u?(b=u===null?null:(0,m.jsx)(F,{error:u,testId:"ev-error"}),e[17]=u,e[18]=b):b=e[18],v=(0,m.jsxs)("section",{className:"flex flex-col gap-4","data-testid":"ev-panel",children:[y,b,f.length===0?(0,m.jsx)(O,{description:n("Call recordEvaluation from a graded run and its score shows up here."),testId:"ev-empty",title:n("No evals recorded")}):(0,m.jsx)("div",{className:"grid gap-3 md:grid-cols-2",children:f.map(_=>(0,m.jsx)(z,{card:_,onOpenTrace:i},_.name))})]}),e[6]=d,e[7]=u,e[8]=g,e[9]=i,e[10]=l,e[11]=o,e[12]=n,e[13]=v}else v=e[13];return v},"re");function G(s){return s.last}p(G,"Q");export{oe as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as Oe,b as _e}from"./chunk-NGVP66OH.js";import{i as je,k as He}from"./chunk-GHQ2VDI2.js";import{a as Re,b as ye,c as Ie,d as Ee,e as Pe,g as Be,h as Ve}from"./chunk-E4PXACVL.js";import{I as Ae,J as Me,K as Se,L as Le,M as Fe,N as Te,b as U,l as De}from"./chunk-MVWZMWPD.js";import{b as we,c as Ge}from"./chunk-3YXASVTP.js";import{a as M,e as Ne}from"./chunk-AUAECCXB.js";import{a as Ce,c as ke,e as ge,i as ve,j as H}from"./chunk-BOMPSVRC.js";import{a as i,c as It,d as C,e as A,f as Et,g as xe,i as he}from"./chunk-I26MS5PJ.js";var Qe=C(Et(),1);var V={};It(V,{Indicator:()=>$e,Root:()=>Ye});var l=C(A(),1);function Ue(o){if(!o)return null;for(let e of o.elements){let r=e.tagName;if(r==="BUTTON"||r==="INPUT"){let a=e;if(a.type==="submit")return a}}return null}i(Ue,"getDefaultFormSubmitter");var qe="data-checked",We="data-unchecked";function q(o){return{checked(e){return o.indeterminate?{}:e?{[qe]:""}:{[We]:""}},...Re}}i(q,"getCheckboxStateAttributesMapping");var ze=C(A(),1);function Ke(o,e,r,a=!0,s){let[f,p]=ze.useState(),P=U(s?`${s}-label`:void 0),b=o??e??f;return M(()=>{let x=o||e||!a?void 0:Nt(r.current,P);f!==x&&p(x)}),b}i(Ke,"useAriaLabelledBy");function Nt(o,e){let r=Dt(o);if(r)return!r.id&&e&&(r.id=e),r.id||void 0}i(Nt,"getAriaLabelledBy");function Dt(o){if(!o)return;let e=o.parentElement;if(e&&e.tagName==="LABEL")return e;let r=o.id;if(r){let s=o.nextElementSibling;if(s&&s.htmlFor===r)return s}let a=o.labels;return a&&a[0]}i(Dt,"findAssociatedLabel");var W=C(A(),1);var Bt=W.createContext(void 0);function Je(){return W.useContext(Bt)}i(Je,"useCheckboxGroupContext");var z=C(A(),1);var ie=z.createContext(void 0);function Xe(){let o=z.useContext(ie);if(o===void 0)throw new Error(ke(14));return o}i(Xe,"useCheckboxRootContext");var S=C(xe(),1);var At="data-parent",Ye=l.forwardRef(i(function(e,r){let{checked:a,className:s,defaultChecked:f=!1,"aria-labelledby":p,disabled:P=!1,form:b,id:x,indeterminate:N=!1,inputRef:X,name:L,onCheckedChange:F,parent:u=!1,readOnly:y=!1,render:ae,required:I=!1,uncheckedValue:T,value:O,nativeButton:_=!1,style:Mt,...Ze}=e,{clearErrors:et}=Ie(),{disabled:tt,name:ot,setDirty:rt,setFilled:se,setFocused:de,setTouched:nt,state:ce,validationMode:it,validityData:at,validation:st}=ye(),dt=Be(),{labelId:ct,registerControlId:ut,getDescriptionProps:ue}=Ee(),n=Je(),k=n?.allValues===void 0?void 0:n.parent,w=k!==void 0,c=tt||dt.disabled||n?.disabled||P,E=ot??L,d=O??E,le=U(),lt=n?.registerControlId!==ut,Y=Pe({id:x||void 0,enabled:lt}),ft=_?Y:le,$={};w&&(u?$=k.getParentProps():d!==void 0&&($=k.getChildProps(d)));let{checked:fe=a,indeterminate:pt=N,onCheckedChange:mt,...bt}=$,Q=n?.value,G=l.useRef(null),{getButtonProps:xt,buttonRef:ht}=Ge({disabled:c,native:_}),D=n?.validation??st,[m,Ct]=Se({controlled:d!==void 0&&Q!==void 0&&!u?Q.includes(d):fe,default:f,name:"Checkbox",state:"checked"}),Z=w?!!fe:m,B=w&&pt||N;Ve(G,le,m,void 0,!n&&!c,L);let ee=k?.registerChildId,g=l.useRef(null),pe=D.registerInput,me=n?d:void 0,kt=l.useCallback(t=>pe(t,{controlRef:G,value:me}),[pe,me]),gt=ge(X,g,u?void 0:kt),vt=Ke(p,ct,g,!_,Y);M(()=>{g.current&&(g.current.indeterminate=B),n||se(m)},[m,B,n,se]),Le(m,()=>{n||(et(E),rt(m!==at.initialValue),D.change(m))});let Rt=Ce({checked:m,disabled:c,form:b,name:u?void 0:E,id:_?void 0:Y,required:I,ref:gt,style:E?_e:Oe,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(t){if(t.nativeEvent.defaultPrevented)return;if(y){t.preventDefault();return}let h=t.currentTarget.checked,v=Te(Fe.none,t.nativeEvent);if(F?.(h,v),!v.isCanceled&&(mt?.(h,v),!v.isCanceled&&(Ct(h),d!==void 0&&n!==void 0&&!u&&!w))){let R=h?[...n.value,d]:n.value.filter(j=>j!==d);n.setValue(R,v)}},onClick(t){t.stopPropagation()},onFocus(){G.current?.focus()}},O!==void 0?{value:(n?m&&O:O)||""}:ve,ue,t=>D.getValidationProps(c,t));l.useEffect(()=>{if(!k||d===void 0)return;let t=k.disabledStatesRef.current;return t.set(d,c),()=>{t.delete(d)}},[k,c,d]);let te=l.useMemo(()=>({...ce,checked:Z,disabled:c,readOnly:y,required:I,indeterminate:B}),[ce,Z,c,y,I,B]),yt=q(te),be=H("span",e,{state:te,ref:[ht,G,r],props:[{id:ft,role:"checkbox","aria-checked":B?"mixed":Z,"aria-readonly":y||void 0,"aria-required":I||void 0,"aria-labelledby":vt,[At]:u?"":void 0,onFocus(){c||de(!0)},onBlur(){let t=g.current;t&&(nt(!0),de(!1),it==="onBlur"&&D.commit(n?Q:t.checked))},onKeyDown(t){if(t.key!=="Enter"||(t.preventBaseUIHandler(),t.defaultPrevented))return;let h=g.current?.form??null,v=t.currentTarget,R=t.nativeEvent,j=t.preventDefault,re=R.preventDefault,ne=!1;t.preventDefault=()=>{ne=!0,j.call(t)},R.preventDefault=()=>{ne=!0,re.call(R)},re.call(R),Ne(v).queueMicrotask(()=>{t.preventDefault=j,R.preventDefault=re,ne||Ue(h)?.click()})},onClick(t){if(y||c)return;t.preventDefault();let h=g.current;h&&we(h,t)}},Ze,bt,xt,ue,t=>D.getValidationProps(c,t)],stateAttributesMapping:yt}),oe=be.props.id;return M(()=>{if(!(!ee||u||d===void 0||oe===void 0))return ee(d,oe)},[ee,u,d,oe]),(0,S.jsxs)(ie.Provider,{value:te,children:[be,!m&&!n&&E&&!u&&T!==void 0&&(0,S.jsx)("input",{type:"hidden",form:b,name:E,value:T,disabled:c}),(0,S.jsx)("input",{...Rt,suppressHydrationWarning:!0})]})},"CheckboxRoot"));var K=C(A(),1);var $e=K.forwardRef(i(function(e,r){let{render:a,className:s,style:f,keepMounted:p=!1,...P}=e,b=Xe(),x=b.checked||b.indeterminate,{mounted:N,transitionStatus:X,setMounted:L}=Me(x),F=K.useRef(null),u={...b,transitionStatus:X};Ae({batch:!0,enabled:!x,open:x,ref:F,onComplete(){x||L(!1)}});let ae={...q(b),...De},I=p||N,T=H("span",e,{ref:[r,F],state:u,stateAttributesMapping:ae,props:P});return I?T:null},"CheckboxIndicator"));var J=C(xe(),1);function Fo(o){let e=(0,Qe.c)(9),r,a;e[0]!==o?({className:r,...a}=o,e[0]=o,e[1]=r,e[2]=a):(r=e[1],a=e[2]);let s;e[3]!==r?(s=he("peer relative flex size-4 shrink-0 items-center justify-center rounded-md border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary",r),e[3]=r,e[4]=s):s=e[4];let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=(0,J.jsx)(V.Indicator,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:(0,J.jsx)(He,{icon:je,strokeWidth:2})}),e[5]=f):f=e[5];let p;return e[6]!==a||e[7]!==s?(p=(0,J.jsx)(V.Root,{"data-slot":"checkbox",className:s,...a,children:f}),e[6]=a,e[7]=s,e[8]=p):p=e[8],p}i(Fo,"v");export{Fo as a};
|