@objectstack/console 14.6.0 → 14.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.objectui-sha +1 -1
- package/dist/assets/{AdapterProvider-cnK1q1oP.js → AdapterProvider-BzVT9qYv.js} +1 -1
- package/dist/assets/{AiPendingActionsPage-mX_Izb42.js → AiPendingActionsPage-B4I03oil.js} +1 -1
- package/dist/assets/{ApiConsolePage-fUV9bmEg.js → ApiConsolePage-_wjPZg_8.js} +1 -1
- package/dist/assets/AppDocsIndex-B3Y96Lvd.js +1 -0
- package/dist/assets/{AppManagementPage-BRmzB5eR.js → AppManagementPage-DxZABvOm.js} +1 -1
- package/dist/assets/ApprovalsInboxPage-DAjFkDy9.js +1 -0
- package/dist/assets/{AuditLogPage-REsiCTKG.js → AuditLogPage-CuKdhFr9.js} +1 -1
- package/dist/assets/{ComponentNavView-B4EBSM-o.js → ComponentNavView-DebBry51.js} +1 -1
- package/dist/assets/CreateViewDialog-BCEk3ESW.js +1 -0
- package/dist/assets/DashboardView-Bi_ea9x6.js +1 -0
- package/dist/assets/{DeveloperHubPage-B6pD0HUk.js → DeveloperHubPage-CEFVU_4t.js} +1 -1
- package/dist/assets/DocShell-C09YMyAT.js +1 -0
- package/dist/assets/{ExpressionProvider-D94jBDAc.js → ExpressionProvider-gKUl8r3a.js} +1 -1
- package/dist/assets/{FlowRunsPage-C4Setjuz.js → FlowRunsPage-Of98wriv.js} +1 -1
- package/dist/assets/{IntegrationsPage-EOVS24Ho.js → IntegrationsPage-D2Eh-wKl.js} +2 -2
- package/dist/assets/{InterfaceListPage-BFlwb0U7.js → InterfaceListPage-BuAQSxuZ.js} +1 -1
- package/dist/assets/ManagedByBadge-3xVjmTY7.js +1 -0
- package/dist/assets/MarketplaceAccessDenied-YG6RAG6U.js +1 -0
- package/dist/assets/MarketplaceInstalledPage-BFESaZWD.js +1 -0
- package/dist/assets/MarketplacePackagePage-Vy7JiFQ0.js +4 -0
- package/dist/assets/MarketplacePage-C9kQ9UzP.js +1 -0
- package/dist/assets/MetadataInspector-Dc5CNMYV.js +1 -0
- package/dist/assets/{MetadataProvider-C8ABa_gQ.js → MetadataProvider-Bkb-vkjJ.js} +1 -1
- package/dist/assets/{MonacoImpl-nyLaER8_.js → MonacoImpl-_--K1JSa.js} +1 -1
- package/dist/assets/ObjectDataPage-B_qdf_tA.js +1 -0
- package/dist/assets/PageView-CO7Yco3U.js +1 -0
- package/dist/assets/ProfilePage--OycjBXX.js +1 -0
- package/dist/assets/PublicFormsPage-CI1LZQKt.js +1 -0
- package/dist/assets/RecordDetailView-BQzH8bIG.js +2 -0
- package/dist/assets/RecordFormPage-D3fuaSOR.js +1 -0
- package/dist/assets/ReportDefaultInspector-DfAMgr8D.js +3 -0
- package/dist/assets/ReportView-DyMm1CCA.js +2 -0
- package/dist/assets/{SearchResultsPage-B3ShD29d.js → SearchResultsPage-CVsVjc9k.js} +1 -1
- package/dist/assets/{SettingsHub-DgLunUQU.js → SettingsHub-DTr02Vxf.js} +1 -1
- package/dist/assets/{SettingsView-DFfL8vn4.js → SettingsView-BN_M8m7j.js} +1 -1
- package/dist/assets/{SystemHubPage-A9Z1FplZ.js → SystemHubPage-DGggPmsC.js} +1 -1
- package/dist/assets/abnfDiagram-VRR7QNED-BM2gIA2H.js +1 -0
- package/dist/assets/appRoute-C7XNGt8B.js +1 -0
- package/dist/assets/architecture-TIHT7OUA-X9gN3Z_J.js +1 -0
- package/dist/assets/architectureDiagram-ZJ3FMSHR-wyeItulr.js +36 -0
- package/dist/assets/assistantBus-CbDb2Mju.js +1 -0
- package/dist/assets/{blockDiagram-677ZJIJ3-BmONypzo.js → blockDiagram-677ZJIJ3-BybRqe6u.js} +2 -2
- package/dist/assets/{c4Diagram-LMCZKHZV-DqIiaVjm.js → c4Diagram-LMCZKHZV-CZhtNS_4.js} +2 -2
- package/dist/assets/channel-BAx__6e1.js +1 -0
- package/dist/assets/{chunk-32BRIVSS-BbTX8O4m.js → chunk-32BRIVSS-CjQ2uFsO.js} +1 -1
- package/dist/assets/{chunk-52WLFC77-DkgICN4F.js → chunk-52WLFC77-BBx3j8yk.js} +1 -1
- package/dist/assets/chunk-5FCAYU7R-w3UK8d6o.js +1 -0
- package/dist/assets/chunk-5HE753X5-Cg3JdNF3.js +1 -0
- package/dist/assets/chunk-5JV3BV7I-Dm-WSvPI.js +1 -0
- package/dist/assets/chunk-5TONJI2A-CQhZ6bam.js +2 -0
- package/dist/assets/chunk-BIQX33UG-_A6SWMTr.js +1 -0
- package/dist/assets/{chunk-C7G6YPKG-UMP_bNDd.js → chunk-C7G6YPKG-CrZlt4pv.js} +1 -1
- package/dist/assets/chunk-CQNSW5MT-DaOzt4Yv.js +1 -0
- package/dist/assets/chunk-CYSBUYHQ-Dr63T7GU.js +1 -0
- package/dist/assets/chunk-EMLP6XTP-BYfeYg3o.js +1 -0
- package/dist/assets/{chunk-EX3LRPZG-B0dJ64Ff.js → chunk-EX3LRPZG-x9nXH4xc.js} +2 -2
- package/dist/assets/{chunk-FWX5IMBZ-B8cCL4T7.js → chunk-FWX5IMBZ-cqzp-iMz.js} +1 -1
- package/dist/assets/{chunk-HOUHSVGY-B5nScni0.js → chunk-HOUHSVGY-Bfkm0El3.js} +1 -1
- package/dist/assets/{chunk-ICXQ74PX-zJg8KmvA.js → chunk-ICXQ74PX-WsDRuBhL.js} +1 -1
- package/dist/assets/chunk-JG7HCLWE-Dj9pjBYh.js +2 -0
- package/dist/assets/{chunk-KEIR6QF5-CxDrFr0l.js → chunk-KEIR6QF5-DtEGfq38.js} +4 -4
- package/dist/assets/{chunk-MOJQB5TN-DBKCpvOi.js → chunk-MOJQB5TN-K_QM_tTs.js} +1 -1
- package/dist/assets/chunk-MOZMSUNE-DxgOd8pF.js +1 -0
- package/dist/assets/{chunk-OGEWGWER-bKk51Nxt.js → chunk-OGEWGWER-CSkoB3Mi.js} +1 -1
- package/dist/assets/chunk-OSBZ3O6U-BSRxNamX.js +1 -0
- package/dist/assets/{chunk-PUDLZKDR-CKn_9iXM.js → chunk-PUDLZKDR-BUt9iFAU.js} +3 -3
- package/dist/assets/{chunk-Q4XR5HBZ-BP9atbVx.js → chunk-Q4XR5HBZ-B99LraLe.js} +1 -1
- package/dist/assets/chunk-QBLGF6JB-Xeo4xx7q.js +1 -0
- package/dist/assets/chunk-R7FJI6CG-D2Ok5kyf.js +1 -0
- package/dist/assets/{chunk-RYQCIY6F-B5RR1tIz.js → chunk-RYQCIY6F-CdJb5y8u.js} +1 -1
- package/dist/assets/chunk-U6XO7XAA-Cwwl_Wmn.js +2 -0
- package/dist/assets/{chunk-V7JOEXUC-DTerDTcg.js → chunk-V7JOEXUC-CzVnJgzj.js} +2 -2
- package/dist/assets/chunk-VAUOI2AC-HYDQgaka.js +1 -0
- package/dist/assets/{chunk-VR4S4FIN-jB_W-MHs.js → chunk-VR4S4FIN-B2IyRlJ4.js} +1 -1
- package/dist/assets/{chunk-WYO6CB5R-Cndg0Yo5.js → chunk-WYO6CB5R-C0_XZtpj.js} +2 -2
- package/dist/assets/chunk-XXDRQBXY-CtU5D9C8.js +1 -0
- package/dist/assets/chunk-YOTPTUD7-7OTU2RwK.js +1 -0
- package/dist/assets/{chunk-ZGVPDNZ5-BUUSzPje.js → chunk-ZGVPDNZ5-Bq7O6ELQ.js} +1 -1
- package/dist/assets/classDiagram-OUVF2IWQ-DiVkGMIZ.js +1 -0
- package/dist/assets/classDiagram-v2-EOCWNBFH-DiVkGMIZ.js +1 -0
- package/dist/assets/cose-bilkent-JH36ORCC-DqKYLwMN.js +1 -0
- package/dist/assets/cynefin-VYW2F7L2-C94HS-Ni.js +1 -0
- package/dist/assets/cynefinDiagram-TSTJHNR4-CFApUIdk.js +62 -0
- package/dist/assets/cytoscape.esm-CQFVGiJu.js +321 -0
- package/dist/assets/{dagre-VKFMJZFB-Crs38V5P.js → dagre-VKFMJZFB-D4HlgjaA.js} +1 -1
- package/dist/assets/{dagre-CXRCoUWR.js → dagre-dpRSp0QF.js} +1 -1
- package/dist/assets/data-adapter-CCueB_gY.js +7 -0
- package/dist/assets/diagram-FQU43EPY-BcnxfyH-.js +3 -0
- package/dist/assets/{diagram-G47NLZAW-CSNJrWDK.js → diagram-G47NLZAW-CJxJUVu9.js} +1 -1
- package/dist/assets/diagram-NH7WQ7WH-DmBVlyYR.js +24 -0
- package/dist/assets/{diagram-OA4YK3LP-C2A07yOA.js → diagram-OA4YK3LP-CkaF9SQg.js} +3 -3
- package/dist/assets/diagram-WEI45ONY-8cpfjoG3.js +41 -0
- package/dist/assets/{dist-YwlXXOlT.js → dist-B4b49_J4.js} +1 -1
- package/dist/assets/ebnfDiagram-CCIWWBDH-kX04JbNj.js +1 -0
- package/dist/assets/{erDiagram-Q63AITRT-DjK6P1sf.js → erDiagram-Q63AITRT-GjnOtXoL.js} +2 -2
- package/dist/assets/eventmodeling-45OFAUF4-BuchSCe8.js +1 -0
- package/dist/assets/{exceljs.min-Dpb6mnud.js → exceljs.min-BSnPgFSx.js} +1 -1
- package/dist/assets/flowDiagram-23GEKE2U-CpcHvuan.js +1 -0
- package/dist/assets/framework-DUXRLJaF.js +36 -0
- package/dist/assets/{ganttDiagram-NO4QXBWP-UPhpWlEd.js → ganttDiagram-NO4QXBWP-7HpPOGwX.js} +2 -2
- package/dist/assets/{getIcon-p-vXfFiY.js → getIcon-PwXhgLNw.js} +1 -1
- package/dist/assets/gitGraph-TEB2WS4Q-B2hHXR-t.js +1 -0
- package/dist/assets/gitGraphDiagram-IHSO6WYX-BgBKFUwZ.js +106 -0
- package/dist/assets/{graphlib-B8gBHxth.js → graphlib-DS17s2tU.js} +1 -1
- package/dist/assets/highlighted-body-OFNGDK62-Cdc_XtSh.js +1 -0
- package/dist/assets/{i18n-DGsfMUMn.js → i18n-DALEd5g8.js} +3 -3
- package/dist/assets/index-BCvtzf7n.css +2 -0
- package/dist/assets/index-C_G40cue.js +2 -0
- package/dist/assets/info-DKCQHKI2-B_PilpBz.js +1 -0
- package/dist/assets/infoDiagram-FWYZ7A6U-CTsG_9Mj.js +2 -0
- package/dist/assets/infrastructure-Bc4DRENl.js +3 -0
- package/dist/assets/{ishikawaDiagram-FXEZZL3T-DvmRhm8H.js → ishikawaDiagram-FXEZZL3T-DgMu6-jd.js} +2 -2
- package/dist/assets/{journeyDiagram-5HDEW3XC-DFf6bjOX.js → journeyDiagram-5HDEW3XC-CKI4PBJp.js} +2 -2
- package/dist/assets/{kanban-definition-HUTT4EX6-DLK5X8Ol.js → kanban-definition-HUTT4EX6-ChvGKWDx.js} +2 -2
- package/dist/assets/{katex-CddkPoXu.js → katex-B7rAX3Vi.js} +1 -1
- package/dist/assets/{map-DsCK-0Cs.js → map-BaFkSB1l.js} +1 -1
- package/dist/assets/mermaid-GHXKKRXX-D6paxo1u.js +1 -0
- package/dist/assets/mermaid-parser.core-B2-C9kB8.js +3 -0
- package/dist/assets/{mermaid.core-D3axazyv.js → mermaid.core-CskcjgHM.js} +2 -2
- package/dist/assets/metadata-admin-DYtDZDTS.js +23 -0
- package/dist/assets/{mindmap-definition-LN4V7U3C-DwbonLR_.js → mindmap-definition-LN4V7U3C-BSAiSefe.js} +2 -2
- package/dist/assets/packet-7NZHBO7P-qOo2g-vE.js +1 -0
- package/dist/assets/pegDiagram-2B236MQR-BUG9TR1Z.js +1 -0
- package/dist/assets/pie-RZYD4A2V-U1Vrb5_c.js +1 -0
- package/dist/assets/{pieDiagram-ENE6RG2P-D8jBhNXT.js → pieDiagram-ENE6RG2P-CqKv9PBi.js} +3 -3
- package/dist/assets/plugin-calendar-C5OJe0lx.js +1 -0
- package/dist/assets/{plugin-charts-DPNohuuV.js → plugin-charts-C4pZYso-.js} +2 -2
- package/dist/assets/plugin-chatbot-B6HiHZjD.js +120 -0
- package/dist/assets/plugin-dashboard-BMm8A0um.js +6 -0
- package/dist/assets/plugin-form-zDPLpTAc.js +1 -0
- package/dist/assets/plugin-gantt-Bdm-Yvii.js +102 -0
- package/dist/assets/plugin-grid-BJGu5-41.js +8 -0
- package/dist/assets/plugin-kanban-BN37MzOm.js +1 -0
- package/dist/assets/plugin-map-Bamjhlg6.js +1 -0
- package/dist/assets/{plugin-markdown-CFO9Lenx.js → plugin-markdown-Cg477jm9.js} +1 -1
- package/dist/assets/plugin-report-9ivqW5g0.js +59 -0
- package/dist/assets/plugin-timeline-C9C1_Un7.js +1 -0
- package/dist/assets/plugin-tree-BDrBkDUi.js +1 -0
- package/dist/assets/plugin-view-YLoG5wfy.js +1 -0
- package/dist/assets/plugins-views-DyIUCjnC.js +4 -0
- package/dist/assets/preferLocal-CKqyhTP9.js +1 -0
- package/dist/assets/{quadrantDiagram-ABIIQ3AL-Do3adYzz.js → quadrantDiagram-ABIIQ3AL-DyfgU6pe.js} +2 -2
- package/dist/assets/radar-I7S5WNFK-BXCATs_F.js +1 -0
- package/dist/assets/railroad-3IZDKUUU-M5RydKKn.js +1 -0
- package/dist/assets/railroad-abnf-AHOZXSZD-Cx_YZh-R.js +1 -0
- package/dist/assets/railroad-ebnf-EBAXGLYW-u_O-iXWA.js +1 -0
- package/dist/assets/railroad-peg-LSFZ7HO6-8zQc29Q0.js +1 -0
- package/dist/assets/railroadDiagram-RFXS5EU6-DOOVaoMM.js +1 -0
- package/dist/assets/{requirementDiagram-TGXJPOKE-CClkXauU.js → requirementDiagram-TGXJPOKE-B0370dfa.js} +2 -2
- package/dist/assets/{sankeyDiagram-HTMAVEWB-DlUFch6E.js → sankeyDiagram-HTMAVEWB-BAioZail.js} +2 -2
- package/dist/assets/{sequenceDiagram-DBY2YBRQ-BEDTwji4.js → sequenceDiagram-DBY2YBRQ-B20vuf87.js} +3 -3
- package/dist/assets/{skeletons-ySdMMgAT.js → skeletons-CnYUdj-X.js} +1 -1
- package/dist/assets/{src-X8yirhNO.js → src--kVwJFRS.js} +1 -1
- package/dist/assets/{src-D0ZYDfff.js → src-CKPhOIOh.js} +1 -1
- package/dist/assets/{src-CSRoqdRD.js → src-Cglm_8jd.js} +4 -4
- package/dist/assets/src-DD4w6yW2.js +18 -0
- package/dist/assets/src-LTygtqhe.js +1 -0
- package/dist/assets/{stateDiagram-2N3HPSRC-BN6M4MGy.js → stateDiagram-2N3HPSRC-BScu2B9X.js} +1 -1
- package/dist/assets/stateDiagram-v2-6OUMAXLB-9fyTUlZR.js +1 -0
- package/dist/assets/swimlanes-5IMT3BWC-VepjEXMA.js +1 -0
- package/dist/assets/swimlanesDiagram-G3AALYLV-i6IYZT2a.js +8 -0
- package/dist/assets/{timeline-definition-FHXFAJF6-B6Oiv_gP.js → timeline-definition-FHXFAJF6-CvpwpY5P.js} +2 -2
- package/dist/assets/treeView-QDETBFTQ-BiM0w_uS.js +1 -0
- package/dist/assets/treemap-6X3UGDF4-CuKHZODJ.js +1 -0
- package/dist/assets/{types-B99y2QyO.js → types-KTMf42UB.js} +1 -1
- package/dist/assets/ui-components-t1CVb1Ox.js +42 -0
- package/dist/assets/ui-layout-C7dEpbqb.js +1 -0
- package/dist/assets/use-book-data-Ddcv6p9p.js +1 -0
- package/dist/assets/{useMetadata-DemWIEqg.js → useMetadata-Ca0oaT4_.js} +1 -1
- package/dist/assets/{useOpenRecordList-B3tjtz1e.js → useOpenRecordList-C75NAaDm.js} +1 -1
- package/dist/assets/{usePackageL10n-CiFMHfKe.js → usePackageL10n-DfeTyD2w.js} +1 -1
- package/dist/assets/utils-Bxty7IIa.js +1 -0
- package/dist/assets/{vendor-charts-D_CNNxD5.js → vendor-charts-HLBqza5P.js} +6 -6
- package/dist/assets/vendor-dndkit-DoG7p74h.js +5 -0
- package/dist/assets/vendor-i18n-ByHglwq-.js +1 -0
- package/dist/assets/{vendor-icons-core-DvLgTVYc.js → vendor-icons-core-CO5pY7RP.js} +1 -1
- package/dist/assets/{vendor-markdown-BJvgKhXw.js → vendor-markdown-DlkSIxwM.js} +25 -25
- package/dist/assets/vendor-objectstack-BjCqbVaM.js +96 -0
- package/dist/assets/vendor-radix-CWCRv2pn.js +46 -0
- package/dist/assets/{vendor-react-BGDDiZfJ.js → vendor-react-BKSb6vFP.js} +3 -3
- package/dist/assets/vendor-sentry-C3ouQ5cr.js +501 -0
- package/dist/assets/{vendor-ui-utils-BzQBRdq3.js → vendor-ui-utils-D-WJ115h.js} +1 -1
- package/dist/assets/{vennDiagram-L72KCM5P-DqRcgOxS.js → vennDiagram-L72KCM5P-DlCQcm_6.js} +2 -2
- package/dist/assets/wardley-OPB4EBWU-zwaHU-Tl.js +1 -0
- package/dist/assets/{wardleyDiagram-EHGQE667-BDyIMWfB.js → wardleyDiagram-EHGQE667-mesER_Po.js} +3 -3
- package/dist/assets/{xychartDiagram-FW5EYKEG-BRNQk20I.js → xychartDiagram-FW5EYKEG-cODEcpNB.js} +2 -2
- package/dist/index.html +6 -6
- package/package.json +1 -1
- package/dist/assets/AppDocsIndex-Bzh_4ehZ.js +0 -1
- package/dist/assets/ApprovalsInboxPage-DKgnvZ-2.js +0 -1
- package/dist/assets/ConsoleFloatingChatbot-BW-g5YTu.js +0 -1
- package/dist/assets/CreateViewDialog-BhCe1ZPc.js +0 -1
- package/dist/assets/DashboardView-CUXRWKPH.js +0 -1
- package/dist/assets/ManagedByBadge-Dpgfl255.js +0 -1
- package/dist/assets/MarketplaceAccessDenied-DuO_FDoh.js +0 -1
- package/dist/assets/MarketplaceInstalledPage-4MFyBXDW.js +0 -1
- package/dist/assets/MarketplacePackagePage-BDeaeKiT.js +0 -4
- package/dist/assets/MarketplacePage-DXMWpCHb.js +0 -1
- package/dist/assets/MetadataInspector-YoFTAkMA.js +0 -1
- package/dist/assets/ObjectDataPage-BSvqdmym.js +0 -1
- package/dist/assets/PageView-Dlpz3HgH.js +0 -1
- package/dist/assets/ProfilePage-2H6e2j4o.js +0 -1
- package/dist/assets/PublicFormsPage-DXYBK10A.js +0 -1
- package/dist/assets/RecordDetailView-CEdkDgV8.js +0 -9
- package/dist/assets/RecordFormPage-Bj3lDGqC.js +0 -1
- package/dist/assets/ReportDefaultInspector-BNtsE5kW.js +0 -3
- package/dist/assets/ReportView-COxfnluU.js +0 -2
- package/dist/assets/abnfDiagram-VRR7QNED-o_fBNeYD.js +0 -1
- package/dist/assets/appRoute-1sYdkwBz.js +0 -1
- package/dist/assets/architecture-TIHT7OUA-BF_0SrOH.js +0 -1
- package/dist/assets/architectureDiagram-ZJ3FMSHR-Bk_LES5L.js +0 -36
- package/dist/assets/assistantBus-BFk4fCbM.js +0 -1
- package/dist/assets/channel-CvRTB8GE.js +0 -1
- package/dist/assets/chunk-VAUOI2AC-BrcFPe7Z.js +0 -1
- package/dist/assets/chunk-XXDRQBXY-DGANY6E3.js +0 -1
- package/dist/assets/classDiagram-OUVF2IWQ-BGL42sFI.js +0 -1
- package/dist/assets/classDiagram-v2-EOCWNBFH-BGL42sFI.js +0 -1
- package/dist/assets/cose-bilkent-JH36ORCC-DJ-X6wmF.js +0 -1
- package/dist/assets/cynefin-VYW2F7L2-CXt4AgYW.js +0 -1
- package/dist/assets/cynefinDiagram-TSTJHNR4-C5mKt5aU.js +0 -62
- package/dist/assets/cytoscape.esm-B3I8pqwA.js +0 -321
- package/dist/assets/data-adapter-CAqKExcJ.js +0 -7
- package/dist/assets/diagram-FQU43EPY-Bkx8ccpS.js +0 -3
- package/dist/assets/diagram-NH7WQ7WH-PaRAbfdR.js +0 -24
- package/dist/assets/diagram-WEI45ONY-BEyyGNpU.js +0 -41
- package/dist/assets/ebnfDiagram-CCIWWBDH-CtfwkNuv.js +0 -1
- package/dist/assets/eventmodeling-45OFAUF4-Dmacb12o.js +0 -1
- package/dist/assets/flowDiagram-23GEKE2U-DfQvGNQk.js +0 -1
- package/dist/assets/framework-CWU64Lvg.js +0 -36
- package/dist/assets/gitGraph-TEB2WS4Q-ChM6j6Bd.js +0 -1
- package/dist/assets/gitGraphDiagram-IHSO6WYX-B6Qcltd9.js +0 -106
- package/dist/assets/highlighted-body-OFNGDK62-CcYD5yKj.js +0 -1
- package/dist/assets/index-BhMd7RVY.js +0 -2
- package/dist/assets/index-Dt-GIgSI.css +0 -2
- package/dist/assets/info-DKCQHKI2-C0RTkygr.js +0 -1
- package/dist/assets/infoDiagram-FWYZ7A6U-CgEoZeWY.js +0 -2
- package/dist/assets/infrastructure-DexdbqHf.js +0 -3
- package/dist/assets/marketplaceApi-1mMRJWDq.js +0 -1
- package/dist/assets/mermaid-GHXKKRXX-DWvjDOK-.js +0 -1
- package/dist/assets/mermaid-parser.core-DV_Ys_OF.js +0 -6
- package/dist/assets/metadata-admin-R79BWSDJ.js +0 -23
- package/dist/assets/packet-7NZHBO7P-DSHvkxBR.js +0 -1
- package/dist/assets/pegDiagram-2B236MQR-B4IMkAIV.js +0 -1
- package/dist/assets/pie-RZYD4A2V-DjNUdL88.js +0 -1
- package/dist/assets/plugin-calendar-GOvhSPjZ.js +0 -1
- package/dist/assets/plugin-chatbot-BT49v2CR.js +0 -120
- package/dist/assets/plugin-dashboard-N2kUovsm.js +0 -6
- package/dist/assets/plugin-form-QFhBvb96.js +0 -1
- package/dist/assets/plugin-gantt-2HGBxhYq.js +0 -93
- package/dist/assets/plugin-grid-qkHiovZ2.js +0 -8
- package/dist/assets/plugin-kanban-D8kWLfql.js +0 -1
- package/dist/assets/plugin-map-CXsqUoPv.js +0 -1
- package/dist/assets/plugin-report-CH4uZunJ.js +0 -59
- package/dist/assets/plugin-timeline-3MSv2v9S.js +0 -1
- package/dist/assets/plugin-tree-_3HdWuAy.js +0 -1
- package/dist/assets/plugin-view-CTBpbehM.js +0 -1
- package/dist/assets/plugins-views-BxKprmRN.js +0 -4
- package/dist/assets/radar-I7S5WNFK-qO0bWLwF.js +0 -1
- package/dist/assets/railroad-3IZDKUUU-CAj9esX-.js +0 -1
- package/dist/assets/railroad-abnf-AHOZXSZD-Ci_Yg729.js +0 -1
- package/dist/assets/railroad-ebnf-EBAXGLYW-Tz7H2Jrw.js +0 -1
- package/dist/assets/railroad-peg-LSFZ7HO6-BJIalSaK.js +0 -1
- package/dist/assets/railroadDiagram-RFXS5EU6-DDA7XtKq.js +0 -1
- package/dist/assets/recordFormNavigation-8nEYNxNo.js +0 -1
- package/dist/assets/src-TG89vY9R.js +0 -18
- package/dist/assets/stateDiagram-v2-6OUMAXLB-DCaXJLPh.js +0 -1
- package/dist/assets/surfaceAgent-qmokOosD.js +0 -1
- package/dist/assets/swimlanes-5IMT3BWC-Bycq06w3.js +0 -1
- package/dist/assets/swimlanesDiagram-G3AALYLV-DWFAvAh7.js +0 -8
- package/dist/assets/treeView-QDETBFTQ-Cc2FYETg.js +0 -1
- package/dist/assets/treemap-6X3UGDF4-a4EjGpO3.js +0 -1
- package/dist/assets/ui-components-DHIW7RSX.js +0 -42
- package/dist/assets/ui-layout-DeDkO2oG.js +0 -1
- package/dist/assets/useRecordApprovals-R3Q7Bt7f.js +0 -1
- package/dist/assets/utils-Bixzg6Bz.js +0 -1
- package/dist/assets/vendor-dndkit-CzBh0_98.js +0 -5
- package/dist/assets/vendor-i18n-B6GOGCem.js +0 -1
- package/dist/assets/vendor-objectstack-6Mgxtaa1.js +0 -96
- package/dist/assets/vendor-radix-DCTEpigg.js +0 -46
- package/dist/assets/vendor-sentry-CHRc7_3y.js +0 -501
- package/dist/assets/wardley-OPB4EBWU-CuNyH0xZ.js +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ui-components-BL3SEdAz.css","./plugin-dashboard-DnNKJB60.css","./plugin-map-CsMXqW6n.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{o as e,r as t}from"./rolldown-runtime-DAXXjFlN.js";import{_ as n,a as r,c as i,d as a,f as o,g as s,h as c,i as l,l as u,m as d,r as f,s as p,u as m,y as h}from"./vendor-react-BKSb6vFP.js";import{a as g,c as _,d as v,i as y,l as b,m as x,p as S,r as C,s as ee,u as te}from"./infrastructure-Bc4DRENl.js";import{H as ne,L as re,R as w,Y as T,Yt as E,c as ie,l as D}from"./framework-DUXRLJaF.js";import{Ar as ae,As as oe,Bs as se,C as ce,Cr as O,Ha as k,Hs as le,Kr as ue,Ns as de,Oc as fe,P as pe,Pa as me,Qi as he,S as ge,Wi as _e,Xs as ve,Ya as ye,Yo as be,Yr as xe,Za as Se,aa as Ce,ai as we,ar as A,b as Te,dt as Ee,ft as De,io as Oe,ir as j,ja as ke,jc as Ae,ki as je,la as Me,lc as Ne,ln as M,ls as Pe,lt as Fe,nr as N,pn as P,pt as F,rr as I,sr as L,tr as R,ut as Ie,xs as Le,za as Re,zo as ze}from"./ui-components-t1CVb1Ox.js";import{r as z}from"./vendor-ui-utils-D-WJ115h.js";import{C as Be,E as B,S as Ve,T as He,_ as Ue,a as We,b as Ge,c as Ke,d as qe,f as Je,g as Ye,h as Xe,i as Ze,l as Qe,m as $e,n as et,o as tt,p as nt,r as rt,s as it,u as at,v as ot,w as st,x as ct,y as lt}from"./src-DD4w6yW2.js";import"./plugin-form-zDPLpTAc.js";import{k as ut}from"./RecordDetailView-BQzH8bIG.js";import{r as dt}from"./plugin-chatbot-B6HiHZjD.js";import{C as V,E as ft,O as pt,T as mt,b as ht,w as gt,x as _t}from"./MarketplaceAccessDenied-YG6RAG6U.js";import{a as vt,i as yt,o as bt}from"./plugin-grid-BJGu5-41.js";import"./plugins-views-DyIUCjnC.js";import"./plugin-view-YLoG5wfy.js";import{n as H}from"./componentRegistry-ByxoJqMW.js";import{r as xt,t as St}from"./plugin-markdown-Cg477jm9.js";import{t as U}from"./DocShell-C09YMyAT.js";import{a as Ct,i as W,l as wt,n as G,o as Tt,r as Et,s as Dt,t as Ot,u as kt}from"./use-book-data-Ddcv6p9p.js";import{n as At}from"./src-LTygtqhe.js";var K=e(h(),1),jt=e(n(),1),q=f(),Mt={type:`object-master-detail-form`,objectName:`expense_claim`,mode:`create`,formType:`simple`,title:`New Expense Claim`,submitText:`Create Claim`,fields:[`title`,`applicant`,`department`,`reason`,`currency`,`claim_status`,`payment_status`,`remarks`],details:[{title:`Expense Lines`,childObject:`expense_line`,relationshipField:`expense_claim`,amountField:`amount`,totalField:`total_amount`,columns:[{field:`expense_date`,label:`Date`,type:`date`},{field:`category`,label:`Category`,type:`select`,options:[{label:`Travel & Transport`,value:`travel_transport`},{label:`Lodging`,value:`lodging`},{label:`Meals & Entertainment`,value:`meals_entertainment`},{label:`Office Supplies`,value:`office_supplies`},{label:`Communications`,value:`communications`},{label:`Training & Conference`,value:`training_conference`},{label:`Client / Project`,value:`client_project`},{label:`Other`,value:`other`}]},{field:`description`,label:`Description`,type:`text`},{field:`merchant_vendor`,label:`Merchant`,type:`text`},{field:`amount`,label:`Amount`,type:`currency`}]}]},Nt=()=>(0,q.jsxs)(`div`,{className:`mx-auto max-w-3xl p-6`,children:[(0,q.jsx)(`h1`,{className:`mb-4 text-lg font-semibold`,children:`Dev · Master-Detail Form (ADR-0001)`}),(0,q.jsx)(T,{schema:Mt})]}),Pt={type:`element:definition-list`,properties:{columns:2,items:[{term:`Status`,description:`Active`},{term:`Owner`,description:`Ada Lovelace`},{term:`Plan`,description:`Enterprise`},{term:`Renewal`,description:`2026-12-01`}]}},Ft={type:`element:repeater`,properties:{object:`showcase_category`,titleField:`name`,fields:[`color`],limit:10,emptyText:`No categories`}},It=()=>(0,q.jsxs)(`div`,{className:`mx-auto max-w-2xl space-y-8 p-6`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h1`,{className:`mb-3 text-lg font-semibold`,children:`Dev · element:definition-list`}),(0,q.jsx)(`div`,{className:`rounded-lg border p-4`,children:(0,q.jsx)(T,{schema:Pt})})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h1`,{className:`mb-3 text-lg font-semibold`,children:`Dev · element:repeater (showcase_category)`}),(0,q.jsx)(`div`,{className:`rounded-lg border p-4`,children:(0,q.jsx)(T,{schema:Ft})})]})]}),J={type:`element:definition-list`,properties:{columns:2,items:[{term:`Status`,description:`Active`},{term:`Owner`,description:`Ada Lovelace`},{term:`Plan`,description:`Enterprise`},{term:`Renewal`,description:`2026-12-01`}]}},Lt=()=>{let{modalHandler:e,modalElement:t}=ut();return(0,q.jsxs)(`div`,{className:`space-y-4 p-6`,children:[(0,q.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Dev · Action modal transport`}),(0,q.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`One `,(0,q.jsx)(`code`,{children:`onModal`}),` handler, four placements, arbitrary SchemaNode content.`]}),(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,q.jsx)(O,{"data-testid":`open-center`,onClick:()=>e({placement:`center`,size:`lg`,title:`Center modal`,content:J}),children:`Center`}),(0,q.jsx)(O,{"data-testid":`open-side`,variant:`outline`,onClick:()=>e({placement:`side`,title:`Side drawer`,content:J}),children:`Side drawer`}),(0,q.jsx)(O,{"data-testid":`open-bottom`,variant:`outline`,onClick:()=>e({placement:`bottom`,title:`Bottom sheet`,content:J}),children:`Bottom sheet`}),(0,q.jsx)(O,{"data-testid":`open-fullscreen`,variant:`outline`,onClick:()=>e({placement:`fullscreen`,title:`Fullscreen`,content:J}),children:`Fullscreen`})]}),t]})},Rt=()=>{let[e,t]=K.useState([{},{}]);return(0,q.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-4 p-6`,children:[(0,q.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Dev · Line-item grid with a lookup cell`}),(0,q.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`The `,(0,q.jsx)(`code`,{children:`Account`}),` column is a real lookup picker bound to live `,(0,q.jsx)(`code`,{children:`showcase_account`}),`.`]}),(0,q.jsx)(Te,{value:e,onChange:t,field:{columns:[{field:`account`,label:`Account`,type:`lookup`,reference:`showcase_account`,displayField:`name`},{field:`note`,label:`Note`,type:`text`},{field:`amount`,label:`Amount`,type:`currency`}],total_field:`amount`}}),(0,q.jsx)(`pre`,{className:`rounded bg-muted p-3 text-xs`,"data-testid":`rows-json`,children:JSON.stringify(e)})]})},zt=[{id:`1`,name:`hotcrm-fix-verify`,org:`hotcrm-fix-verify`,type:`production`,status:`running`,host:`os-05ayzz.objectos.app`},{id:`2`,name:`Objectstack`,org:`Objectstack`,type:`production`,status:`running`,host:`os-0zpadn.objectos.app`},{id:`3`,name:`hotcrm`,org:`JIANGUO Zhuang's Workspace`,type:`production`,status:`running`,host:`os-48f50e60.objectos.app`}],Bt=[{name:`open`,label:`Open`,variant:`primary`},{name:`upgrade`,label:`Upgrade Plan`,variant:`primary`},{name:`rename`,label:`Rename`,variant:`secondary`},{name:`archive`,label:`Archive`,variant:`secondary`}],Vt=[{field:`name`,label:`名称`},{field:`org`,label:`所属组织`},{field:`type`,label:`类型`},{field:`status`,label:`状态`},{field:`host`,label:`公开主机名`}];function Ht({maxInlineRowActions:e}){return(0,q.jsx)(ne,{children:(0,q.jsx)(yt,{schema:{type:`object-grid`,objectName:`showcase_environment`,columns:Vt,data:{provider:`value`,items:zt},rowActionDefs:Bt,...e==null?{}:{maxInlineRowActions:e}}})})}var Ut=()=>(0,q.jsxs)(`div`,{className:`mx-auto max-w-none space-y-8 p-6`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Dev · Row-action overflow (default)`}),(0,q.jsxs)(`p`,{className:`mb-3 text-sm text-muted-foreground`,children:[`Two `,(0,q.jsx)(`code`,{children:`variant:'primary'`}),` row actions. Only `,(0,q.jsx)(`strong`,{children:`Open`}),` stays inline;`,(0,q.jsx)(`strong`,{children:` Upgrade Plan`}),` + the secondaries fold into the `,(0,q.jsx)(`code`,{children:`⋮`}),` menu. The actions column hugs its content and must never clip the inline button.`]}),(0,q.jsx)(`div`,{className:`rounded-lg border`,"data-testid":`grid-default`,children:(0,q.jsx)(Ht,{})})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Dev · Row-action overflow (maxInlineRowActions: 2)`}),(0,q.jsxs)(`p`,{className:`mb-3 text-sm text-muted-foreground`,children:[`Same data, author opts into two inline primaries — both `,(0,q.jsx)(`strong`,{children:`Open`}),` and`,(0,q.jsx)(`strong`,{children:` Upgrade Plan`}),` render inline and the column grows to fit them.`]}),(0,q.jsx)(`div`,{className:`rounded-lg border`,"data-testid":`grid-wide`,children:(0,q.jsx)(Ht,{maxInlineRowActions:2})})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Dev · Row-action sticky-right (narrow / horizontal scroll)`}),(0,q.jsxs)(`p`,{className:`mb-3 text-sm text-muted-foreground`,children:[`A deliberately narrow container so the table scrolls horizontally. The`,(0,q.jsx)(`strong`,{children:` 操作`}),` column stays pinned to the right edge (always reachable), while the first `,(0,q.jsx)(`strong`,{children:`名称`}),` column stays frozen on the left. Scroll the grid sideways to check both edges hold.`]}),(0,q.jsx)(`div`,{className:`max-w-md overflow-hidden rounded-lg border`,"data-testid":`grid-scroll`,children:(0,q.jsx)(Ht,{})})]})]});function Wt({endpoint:e,children:t}){let[n,r]=(0,K.useState)({});return(0,K.useEffect)(()=>{let t=!1;return fetch(e,{credentials:`include`,headers:{Accept:`application/json`}}).then(e=>e.ok?e.json():null).then(e=>{t||!e||r({currency:e.currency??void 0,locale:e.locale??void 0})}).catch(()=>{}),()=>{t=!0}},[e]),(0,q.jsx)(Ae,{value:n,children:t})}var Gt=(0,K.lazy)(()=>s(()=>import(`./SystemHubPage-DGggPmsC.js`).then(e=>({default:e.SystemHubPage})),__vite__mapDeps([0,1]),import.meta.url)),Kt=(0,K.lazy)(()=>s(()=>import(`./AppManagementPage-DxZABvOm.js`).then(e=>({default:e.AppManagementPage})),__vite__mapDeps([0,1]),import.meta.url)),qt=(0,K.lazy)(()=>s(()=>import(`./ProfilePage--OycjBXX.js`).then(e=>({default:e.ProfilePage})),__vite__mapDeps([0]),import.meta.url)),Jt=(0,K.lazy)(()=>s(()=>import(`./ApprovalsInboxPage-DAjFkDy9.js`).then(e=>({default:e.ApprovalsInboxPage})),__vite__mapDeps([0]),import.meta.url)),Yt=(0,K.lazy)(()=>s(()=>import(`./AiPendingActionsPage-B4I03oil.js`).then(e=>({default:e.AiPendingActionsPage})),__vite__mapDeps([0]),import.meta.url)),Xt=(0,K.lazy)(()=>s(()=>import(`./AuditLogPage-CuKdhFr9.js`).then(e=>({default:e.AuditLogPage})),__vite__mapDeps([0]),import.meta.url)),Zt=(0,K.lazy)(()=>s(()=>import(`./SettingsHub-DTr02Vxf.js`).then(e=>({default:e.SettingsHub})),__vite__mapDeps([0]),import.meta.url)),Qt=(0,K.lazy)(()=>s(()=>import(`./SettingsView-BN_M8m7j.js`).then(e=>({default:e.SettingsView})),__vite__mapDeps([0]),import.meta.url)),$t=(0,K.lazy)(()=>s(()=>import(`./DeveloperHubPage-CEFVU_4t.js`).then(e=>({default:e.DeveloperHubPage})),__vite__mapDeps([0]),import.meta.url)),en=(0,K.lazy)(()=>s(()=>import(`./ApiConsolePage-_wjPZg_8.js`).then(e=>({default:e.ApiConsolePage})),__vite__mapDeps([0,1]),import.meta.url)),tn=(0,K.lazy)(()=>s(()=>import(`./FlowRunsPage-Of98wriv.js`).then(e=>({default:e.FlowRunsPage})),__vite__mapDeps([0,1]),import.meta.url)),nn=(0,K.lazy)(()=>s(()=>import(`./PublicFormsPage-CI1LZQKt.js`).then(e=>({default:e.PublicFormsPage})),__vite__mapDeps([0,1]),import.meta.url)),rn=(0,K.lazy)(()=>s(()=>import(`./IntegrationsPage-D2Eh-wKl.js`).then(e=>({default:e.IntegrationsPage})),__vite__mapDeps([0]),import.meta.url)),an=(0,K.lazy)(()=>s(()=>Promise.resolve().then(()=>Rn),void 0,import.meta.url)),on=(0,K.lazy)(()=>s(()=>import(`./AppDocsIndex-B3Y96Lvd.js`),__vite__mapDeps([0,1]),import.meta.url)),sn=(0,K.lazy)(()=>s(()=>Promise.resolve().then(()=>Hn),void 0,import.meta.url)),cn=(0,K.lazy)(()=>s(()=>Promise.resolve().then(()=>Wn),void 0,import.meta.url));function ln(){let{objectName:e}=d(),t=a().pathname.replace(/\/(system\/)?objects(\/.*)?$/,``);return(0,q.jsx)(p,{to:e?`${t}/component/metadata/resource/${e}?type=object`:`${t}/component/metadata/resource?type=object`,replace:!0})}function un(){let{metadataType:e,itemName:t}=d(),n=a().pathname.replace(/\/(system\/)?metadata(\/.*)?$/,``),r=`${n}/component/metadata/resource`;return(0,q.jsx)(p,{to:e?t?`${r}/${t}?type=${e}`:`${r}?type=${e}`:`${n}/component/metadata/directory`,replace:!0})}var dn=(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(u,{path:`system`,element:(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(B,{}),children:(0,q.jsx)(Gt,{})})}),(0,q.jsx)(u,{path:`system/apps`,element:(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(B,{}),children:(0,q.jsx)(Kt,{})})}),(0,q.jsx)(u,{path:`system/profile`,element:(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(B,{}),children:(0,q.jsx)(qt,{})})}),(0,q.jsx)(u,{path:`system/approvals`,element:(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(B,{}),children:(0,q.jsx)(Jt,{})})}),(0,q.jsx)(u,{path:`system/ai-approvals`,element:(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(B,{}),children:(0,q.jsx)(Yt,{})})}),(0,q.jsx)(u,{path:`system/audit-log`,element:(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(B,{}),children:(0,q.jsx)(Xt,{})})}),(0,q.jsx)(u,{path:`system/settings`,element:(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(B,{}),children:(0,q.jsx)(Zt,{})})}),(0,q.jsx)(u,{path:`system/settings/:namespace`,element:(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(B,{}),children:(0,q.jsx)(Qt,{})})}),(0,q.jsx)(u,{path:`developer`,element:(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(B,{}),children:(0,q.jsx)($t,{})})}),(0,q.jsx)(u,{path:`developer/api-console`,element:(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(B,{}),children:(0,q.jsx)(en,{})})}),(0,q.jsx)(u,{path:`developer/flow-runs`,element:(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(B,{}),children:(0,q.jsx)(tn,{})})}),(0,q.jsx)(u,{path:`developer/public-forms`,element:(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(B,{}),children:(0,q.jsx)(nn,{})})}),(0,q.jsx)(u,{path:`developer/integrations`,element:(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(B,{}),children:(0,q.jsx)(rn,{})})}),(0,q.jsxs)(u,{path:`docs`,element:(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(B,{}),children:(0,q.jsx)(cn,{})}),children:[(0,q.jsx)(u,{index:!0,element:(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(B,{}),children:(0,q.jsx)(on,{})})}),(0,q.jsx)(u,{path:`:slug`,element:(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(B,{}),children:(0,q.jsx)(sn,{})})}),(0,q.jsx)(u,{path:`:slug/:name`,element:(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(B,{}),children:(0,q.jsx)(an,{})})})]}),(0,q.jsx)(u,{path:`system/objects`,element:(0,q.jsx)(ln,{})}),(0,q.jsx)(u,{path:`system/objects/:objectName`,element:(0,q.jsx)(ln,{})}),(0,q.jsx)(u,{path:`system/metadata`,element:(0,q.jsx)(un,{})}),(0,q.jsx)(u,{path:`system/metadata/:metadataType`,element:(0,q.jsx)(un,{})}),(0,q.jsx)(u,{path:`system/metadata/:metadataType/:itemName`,element:(0,q.jsx)(un,{})})]});function fn(){let e=(0,K.useMemo)(()=>ce({baseUrl:``}),[``]);return(0,q.jsx)(C,{endpoint:`/api/v1/auth/me/permissions`,loadingFallback:(0,q.jsx)(B,{}),children:(0,q.jsx)(Wt,{endpoint:`/api/v1/auth/me/localization`,children:(0,q.jsx)(ge,{adapter:e,children:(0,q.jsx)(Je,{extraRoutes:dn,extraRoutesNoApp:dn})})})})}function pn(e){let t=(e??[]).filter(e=>!!e?.name),n=t.find(e=>e.isDefault===!0);if(n)return`/apps/${n.name}`;let r=t.filter(e=>e.active!==!1&&e.hidden!==!0);return r.length===1?`/apps/${r[0].name}`:`/home`}function mn(){let{apps:e,loading:t}=w();return t?(0,q.jsx)(Ve,{}):(0,q.jsx)(p,{to:pn(e),replace:!0})}var hn=`/api/v1`,gn=new Set([`simple`,`tabbed`,`wizard`,`split`,`drawer`,`modal`]);function _n(e){let t=typeof e==`string`?parseInt(e,10):e;return t===1||t===2||t===3||t===4?t:2}function vn(e){if(Array.isArray(e))return e.map(e=>{if(typeof e==`string`)return{value:e,label:e};if(e&&typeof e==`object`){let t=String(e.value??e.id??``);return{value:t,label:String(e.label??e.name??t)}}return{value:String(e),label:String(e)}})}function yn(e,t){let n=e.sections??e.groups??[],r=t?.fields??{};return n.map(e=>{let t=_n(e.columns),n=[];for(let t of e.fields??[]){let e=typeof t==`string`?{field:t}:{...t},i=r[e.field]??{type:`text`};n.push({name:e.field,label:e.label??i.label??e.field,type:i.type??`text`,required:e.required??i.required??!1,readonly:e.readonly??!1,hidden:e.hidden??!1,placeholder:e.placeholder??i.placeholder,helpText:e.helpText??i.helpText,defaultValue:i.defaultValue,options:vn(i.options),maxLength:i.maxLength,colSpan:e.colSpan??1})}return{label:e.label,columns:t,collapsible:!!e.collapsible,collapsed:!!e.collapsed,fields:n}})}function bn(e,t){let n={};for(let r of e){r.defaultValue!==void 0&&(n[r.name]=r.defaultValue);let e=t.get(`prefill_${r.name}`);e!==null&&(n[r.name]=e)}return n}async function Y(e,t){return fetch(`${hn}${e}`,{credentials:`include`,headers:{"Content-Type":`application/json`,...t?.headers??{}},...t})}async function xn(e){let t=await Y(`/forms/${encodeURIComponent(e)}`);if(!t.ok){let e=await t.text().catch(()=>``);throw Error(`Failed to load form (${t.status}): ${e||t.statusText}`)}let n=await t.json();return{label:n.label??n.form?.label??n.object,object:n.object,form:n.form,objectSchema:n.objectSchema}}function Sn(e,t){let n=t,r=n?.item??n,i=r?.spec??r,a=i&&typeof i==`object`&&i.config&&typeof i.config==`object`&&(`viewKind`in i||`object`in i),o=i&&typeof i==`object`?i.viewKind:void 0;if(o&&o!==`form`)throw Error(`View "${e}" is a ${o} view, not a form view — check the action or link that targets it.`);let s=a?i.config:i;if(!o&&s&&typeof s==`object`&&typeof s.type==`string`&&!gn.has(s.type))throw Error(`View "${e}" is a ${s.type} view, not a form view — check the action or link that targets it.`);return{label:(a?i.label:void 0)??s?.label??e,object:(a?i.object:void 0)??s?.data?.object??i?.object,form:s}}async function Cn(e){let t=await Y(`/meta/view/${encodeURIComponent(e)}`);if(!t.ok)throw Error(`Form metadata not found: view/${e}`);let{label:n,object:r,form:i}=Sn(e,await t.json());if(!r)throw Error(`FormView "${e}" is missing an "object" target`);let a=null;try{let e=await Y(`/meta/object/${encodeURIComponent(r)}`);if(e.ok){let t=await e.json(),n=t?.item??t,i=n?.spec??n;i?.fields&&typeof i.fields==`object`&&(a={name:i.name??r,label:i.label,fields:i.fields})}}catch{}return{label:n,object:r,form:i,objectSchema:a}}async function wn(e,t){let n=await Y(`/forms/${encodeURIComponent(e)}/submit`,{method:`POST`,body:JSON.stringify(t)});if(!n.ok){let e=await n.text().catch(()=>``);throw Error(`Submit failed (${n.status}): ${e||n.statusText}`)}return n.json().catch(()=>({}))}async function Tn(e,t){let n=await Y(`/data/${encodeURIComponent(e)}`,{method:`POST`,body:JSON.stringify(t)});if(!n.ok){let e=await n.text().catch(()=>``);throw Error(`Create failed (${n.status}): ${e||n.statusText}`)}return n.json().catch(()=>({}))}var En=`w-full rounded-md border border-input bg-background px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring disabled:opacity-50`;function Dn({field:e,value:t,onChange:n}){let r={id:`f_${e.name}`,name:e.name,required:e.required,disabled:e.readonly,placeholder:e.placeholder,className:En},i=t??``;switch(e.type){case`textarea`:case`paragraph`:case`long_text`:return(0,q.jsx)(`textarea`,{...r,rows:5,maxLength:e.maxLength,value:String(i),onChange:e=>n(e.target.value)});case`number`:case`integer`:case`decimal`:case`currency`:return(0,q.jsx)(`input`,{...r,type:`number`,value:i===``?``:Number(i),onChange:e=>n(e.target.value===``?null:Number(e.target.value))});case`email`:return(0,q.jsx)(`input`,{...r,type:`email`,value:String(i),onChange:e=>n(e.target.value)});case`url`:return(0,q.jsx)(`input`,{...r,type:`url`,value:String(i),onChange:e=>n(e.target.value)});case`password`:return(0,q.jsx)(`input`,{...r,type:`password`,value:String(i),onChange:e=>n(e.target.value)});case`date`:return(0,q.jsx)(`input`,{...r,type:`date`,value:String(i),onChange:e=>n(e.target.value)});case`time`:return(0,q.jsx)(`input`,{...r,type:`time`,value:String(i),onChange:e=>n(e.target.value)});case`datetime`:case`timestamp`:return(0,q.jsx)(`input`,{...r,type:`datetime-local`,value:String(i),onChange:e=>n(e.target.value)});case`boolean`:case`toggle`:case`checkbox`:return(0,q.jsxs)(`label`,{className:`inline-flex items-center gap-2 text-sm`,children:[(0,q.jsx)(`input`,{id:r.id,name:r.name,type:`checkbox`,disabled:e.readonly,checked:!!i,onChange:e=>n(e.target.checked),className:`h-4 w-4 rounded border-input`}),(0,q.jsx)(`span`,{children:e.placeholder??e.label})]});case`select`:case`picklist`:case`enum`:{let t=e.options??[];return(0,q.jsxs)(`select`,{...r,value:String(i),onChange:e=>n(e.target.value),children:[(0,q.jsx)(`option`,{value:``,disabled:e.required,children:e.placeholder??`— Select —`}),t.map(e=>(0,q.jsx)(`option`,{value:e.value,children:e.label},e.value))]})}case`radio`:return(0,q.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:(e.options??[]).map(t=>(0,q.jsxs)(`label`,{className:`inline-flex items-center gap-1.5 text-sm`,children:[(0,q.jsx)(`input`,{type:`radio`,name:e.name,value:t.value,checked:String(i)===t.value,disabled:e.readonly,onChange:()=>n(t.value)}),(0,q.jsx)(`span`,{children:t.label})]},t.value))});default:return(0,q.jsx)(`input`,{...r,type:`text`,maxLength:e.maxLength,value:String(i),onChange:e=>n(e.target.value)})}}function On({mode:e}){let t=d(),[n]=c(),r=(e===`public`?t.slug:t.name)??``,[i,a]=(0,K.useState)(!0),[o,s]=(0,K.useState)(null),[l,u]=(0,K.useState)(null),[f,p]=(0,K.useState)({}),[m,h]=(0,K.useState)(!1),[g,_]=(0,K.useState)(!1);(0,K.useEffect)(()=>{let t=!1;return a(!0),s(null),(e===`public`?xn(r):Cn(r)).then(e=>{if(t)return;u(e);let r=yn(e.form,e.objectSchema).flatMap(e=>e.fields);p(bn(r,n))}).catch(e=>{t||s(e?.message??String(e))}).finally(()=>{t||a(!1)}),()=>{t=!0}},[e,r,n]);let v=(0,K.useMemo)(()=>l?yn(l.form,l.objectSchema):[],[l]),y=l?.form?.submitBehavior??{kind:`thank-you`};return i?(0,q.jsx)(`div`,{className:`flex min-h-[60vh] items-center justify-center`,children:(0,q.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Loading…`})}):o&&!l?(0,q.jsx)(`div`,{className:`mx-auto max-w-2xl p-6`,children:(0,q.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 p-4 text-sm text-destructive`,children:o})}):l?g&&y.kind===`thank-you`?(0,q.jsx)(`div`,{className:`mx-auto max-w-2xl p-6`,children:(0,q.jsxs)(`div`,{className:`rounded-md border bg-card p-6 text-center`,children:[(0,q.jsx)(`h2`,{className:`mb-2 text-lg font-semibold`,children:y.title??`Thanks!`}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:y.message??`Your submission has been received.`})]})}):g&&y.kind===`redirect`?(0,q.jsx)(`div`,{className:`mx-auto max-w-2xl p-6 text-center text-sm text-muted-foreground`,children:`Redirecting…`}):(0,q.jsxs)(`div`,{className:`mx-auto max-w-2xl p-4 sm:p-6`,children:[(0,q.jsxs)(`header`,{className:`mb-6`,children:[(0,q.jsx)(`h1`,{className:`text-xl font-semibold`,children:l.label}),l.form?.label&&l.form.label!==l.label&&(0,q.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:l.form.label})]}),(0,q.jsxs)(`form`,{onSubmit:async t=>{if(t.preventDefault(),l){h(!0),s(null);try{switch(e===`public`?await wn(r,f):await Tn(l.object,f),z.success(`Submitted`),y.kind){case`redirect`:{let e=y.delayMs??0;setTimeout(()=>window.location.assign(y.url),e),_(!0);break}case`continue`:{let e=v.flatMap(e=>e.fields);p(bn(e,n));break}default:_(!0);break}}catch(e){let t=e?.message??String(e);s(t),z.error(t)}finally{h(!1)}}},className:`space-y-6`,children:[v.map((e,t)=>(0,q.jsxs)(`section`,{className:`rounded-md border bg-card p-4 sm:p-5`,children:[e.label&&(0,q.jsx)(`h2`,{className:`mb-3 text-sm font-medium`,children:e.label}),(0,q.jsx)(`div`,{className:e.columns===1?`grid grid-cols-1 gap-4`:e.columns===2?`grid grid-cols-1 gap-4 sm:grid-cols-2`:e.columns===3?`grid grid-cols-1 gap-4 sm:grid-cols-3`:`grid grid-cols-1 gap-4 sm:grid-cols-4`,children:e.fields.filter(e=>!e.hidden).map(e=>(0,q.jsxs)(`div`,{className:e.colSpan===2?`sm:col-span-2`:e.colSpan===3?`sm:col-span-3`:e.colSpan===4?`sm:col-span-4`:``,children:[(0,q.jsxs)(`label`,{htmlFor:`f_${e.name}`,className:`mb-1 block text-xs font-medium text-foreground`,children:[e.label,e.required&&(0,q.jsx)(`span`,{className:`ml-0.5 text-destructive`,children:`*`})]}),(0,q.jsx)(Dn,{field:e,value:f[e.name],onChange:t=>p(n=>({...n,[e.name]:t}))}),e.helpText&&(0,q.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e.helpText})]},e.name))})]},t)),o&&(0,q.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive`,children:o}),(0,q.jsx)(`div`,{className:`flex justify-end gap-2`,children:(0,q.jsx)(`button`,{type:`submit`,disabled:m,className:`rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground shadow-sm hover:bg-primary/90 disabled:opacity-50`,children:m?`Submitting…`:`Submit`})})]})]}):null}function kn({enabled:e=!1,url:t=`/api/v1/dev/metadata-events`,debounceMs:n=400,reconnectDelayMs:r=2e3}){let i=(0,K.useRef)(null);return(0,K.useEffect)(()=>{if(!e||typeof window>`u`||typeof EventSource>`u`)return;let a=null,o=null,s=!1,c=e=>{i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{try{z.info(`Metadata changed (${e}) — reloading…`,{duration:800})}catch{}setTimeout(()=>{try{window.location.reload()}catch{}},150)},n)},l=e=>{try{let t=JSON.parse(e.data),n=t?.name?`${t.metadataType??`metadata`}:${t.name}`:`metadata`;c(n)}catch{c(`change`)}},u=e=>{let t=`rebuild`;try{t=JSON.parse(e.data)?.reason??t}catch{}c(t)},d=()=>{if(!s)try{a=new EventSource(t),a.addEventListener(`metadata-change`,l),a.addEventListener(`reload`,u),a.addEventListener(`error`,()=>{s||a?.readyState===EventSource.CLOSED&&(a=null,o=setTimeout(d,r))})}catch{o=setTimeout(d,r)}};return d(),()=>{if(s=!0,o&&clearTimeout(o),i.current&&clearTimeout(i.current),a)try{a.close()}catch{}}},[e,t,n,r]),null}function An(){let e={BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_SENTRY_DSN:`https://1373a588ceb9da150b11e64bf85f583d@o4510356161757184.ingest.us.sentry.io/4511439670673408`,VITE_SENTRY_ENVIRONMENT:`production`,VITE_SENTRY_SEND_DEFAULT_PII:`true`,VITE_SERVER_URL:``,VITE_USE_MOCK_SERVER:`false`}.VITE_SERVER_URL??``;return e?e.replace(/\/$/,``):typeof window<`u`?window.location.origin:``}function jn(){let{token:e}=d(),t=`${(0,K.useMemo)(()=>An(),[])}/api/v1`,[n,r]=(0,K.useState)(null),[i,a]=(0,K.useState)(null),[o,s]=(0,K.useState)(!0),[c,l]=(0,K.useState)(!1),[u,f]=(0,K.useState)(``),[p,m]=(0,K.useState)(null),h=(0,K.useCallback)(async n=>{if(e){s(!0),a(null);try{let i=new URL(`${t}/share-links/${encodeURIComponent(e)}/resolve`);n&&i.searchParams.set(`password`,n);let o=await fetch(i.toString(),{headers:{Accept:`application/json`}});if(o.status===401){l(!0),a(n?`Wrong password.`:null),s(!1);return}if(o.status===404){a(`This link is invalid or no longer available.`),s(!1);return}if(o.status===410){a(`This link has expired or was revoked.`),s(!1);return}if(!o.ok){let e=await o.json().catch(()=>null);a(e?.error?.message??`Failed to load (HTTP ${o.status}).`),s(!1);return}let c=await o.json(),u=`data`in c?c.data:{record:c.record,link:c.link,redactedFields:c.redactFields};r(u),l(!1)}catch(e){a(e?.message??`Failed to load shared content.`)}finally{s(!1)}}},[t,e]);(0,K.useEffect)(()=>{h()},[h]),(0,K.useEffect)(()=>{if(!n||n.link.object_name!==`ai_conversations`)return;let e=`${t}/share-links/${encodeURIComponent(n.link.token)}/messages`;fetch(e,{headers:{Accept:`application/json`}}).then(e=>e.ok?e.json():null).then(e=>m(e?.data??[])).catch(()=>m([]))},[t,n]);let g=(0,K.useMemo)(()=>p?Ue(lt(ot(p))):[],[p]);if(o)return(0,q.jsxs)(`div`,{className:`flex h-svh w-full items-center justify-center bg-background text-muted-foreground`,children:[(0,q.jsx)(k,{className:`mr-2 h-4 w-4 animate-spin`}),`Loading…`]});if(c)return(0,q.jsxs)(`div`,{className:`mx-auto flex h-svh max-w-md flex-col items-center justify-center gap-4 px-4 text-center`,children:[(0,q.jsx)(ye,{className:`h-8 w-8 text-muted-foreground`}),(0,q.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Password required`}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`The owner protected this link with a password.`}),(0,q.jsxs)(`form`,{className:`flex w-full flex-col gap-2`,onSubmit:e=>{e.preventDefault(),h(u)},children:[(0,q.jsx)(P,{htmlFor:`share-pw`,className:`sr-only`,children:`Password`}),(0,q.jsx)(M,{id:`share-pw`,type:`password`,value:u,onChange:e=>f(e.target.value),autoFocus:!0,placeholder:`Enter password`}),i&&(0,q.jsx)(`p`,{className:`text-xs text-destructive`,children:i}),(0,q.jsx)(O,{type:`submit`,size:`sm`,children:`Continue`})]})]});if(i)return(0,q.jsxs)(`div`,{className:`mx-auto flex h-svh max-w-md flex-col items-center justify-center gap-3 px-4 text-center`,children:[(0,q.jsx)(ue,{className:`h-8 w-8 text-amber-500`}),(0,q.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Can't open this link`}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i})]});if(!n)return null;if(n.link.object_name===`ai_conversations`){let e=n.record;return(0,q.jsxs)(`div`,{className:`mx-auto flex h-svh max-w-3xl flex-col bg-background`,children:[(0,q.jsxs)(`header`,{className:`sticky top-0 z-10 flex items-center gap-2 border-b bg-background px-4 py-3`,children:[(0,q.jsx)(ke,{className:`h-5 w-5 text-muted-foreground`}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`h1`,{className:`truncate text-sm font-semibold`,children:e.title??`Shared conversation`}),(0,q.jsx)(`p`,{className:`truncate text-[11px] text-muted-foreground`,children:`Read-only · Shared via ObjectStack`})]}),(0,q.jsx)(L,{variant:`outline`,className:`text-[10px] capitalize`,children:n.link.permission})]}),(0,q.jsx)(`main`,{className:`flex min-h-0 flex-1 flex-col`,children:p==null?(0,q.jsxs)(`div`,{className:`flex flex-1 items-center justify-center py-12 text-sm text-muted-foreground`,children:[(0,q.jsx)(k,{className:`mr-2 h-4 w-4 animate-spin`}),`Loading messages…`]}):p.length===0?(0,q.jsx)(`p`,{className:`py-12 text-center text-sm text-muted-foreground`,children:`This conversation has no messages yet.`}):(0,q.jsx)(dt,{readOnly:!0,surface:`plain`,messages:g,showAvatars:!0,maxHeight:`100%`,className:`flex-1`})}),(0,q.jsx)(`footer`,{className:`border-t bg-muted/30 px-4 py-2 text-center text-[11px] text-muted-foreground`,children:`Powered by ObjectStack`})]})}return(0,q.jsxs)(`div`,{className:`mx-auto flex h-svh max-w-3xl flex-col bg-background`,children:[(0,q.jsx)(`header`,{className:`border-b px-4 py-3`,children:(0,q.jsxs)(`h1`,{className:`text-sm font-semibold`,children:[`Shared `,n.link.object_name]})}),(0,q.jsxs)(`main`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,q.jsx)(`pre`,{className:`overflow-x-auto rounded-md border bg-muted/30 p-3 text-[12px]`,children:JSON.stringify(n.record,null,2)}),n.redactedFields&&n.redactedFields.length>0&&(0,q.jsxs)(`p`,{className:`mt-2 text-[11px] text-muted-foreground`,children:[`Some fields are hidden by the owner: `,n.redactedFields.join(`, `)]})]})]})}var Mn=/(^```[^\n]*\n[\s\S]*?\n```[ \t]*$|^~~~[^\n]*\n[\s\S]*?\n~~~[ \t]*$)/m,Nn=/(`[^`\n]+`)/,Pn=/\]\((?:\.\/)?([a-z][a-z0-9_]*)\.md(#[^)\s]*)?\)/g;function Fn(e){return e.split(Nn).map((e,t)=>t%2==1?e:e.replace(Pn,`](/docs/$1$2)`)).join(``)}function In(e){let t=[],n=e;for(;;){let e=Mn.exec(n);if(!e||e.index===void 0)return t.push(Fn(n)),t.join(``);t.push(Fn(n.slice(0,e.index)),e[0]),n=n.slice(e.index+e[0].length)}}function Ln({book:e,activeDoc:t,docHref:n}){return(0,q.jsxs)(`nav`,{"aria-label":e.label??e.name,className:`text-sm`,children:[e.label?(0,q.jsx)(`div`,{className:`mb-3 px-2 text-sm font-semibold text-foreground`,children:e.label}):null,(0,q.jsx)(`div`,{className:`space-y-5`,children:e.groups.map(e=>(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`div`,{className:`mb-1 px-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:e.label}),(0,q.jsx)(`ul`,{className:`space-y-0.5`,children:e.entries.map((e,i)=>{if(e.separator)return(0,q.jsx)(`li`,{className:`my-1.5 border-t border-border/60`,"aria-hidden":!0},`sep-${i}`);if(e.href)return(0,q.jsx)(`li`,{children:(0,q.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noreferrer`,className:`flex items-center gap-1.5 rounded px-2 py-1 text-muted-foreground hover:bg-muted/50 hover:text-foreground`,children:[(0,q.jsx)(`span`,{className:`truncate`,children:e.label??e.href}),(0,q.jsx)(be,{className:`h-3 w-3 shrink-0 opacity-60`})]})},`ext-${i}`);if(!e.doc)return null;let a=e.doc===t;return(0,q.jsx)(`li`,{children:(0,q.jsx)(r,{to:n(e.doc),"aria-current":a?`page`:void 0,className:`block truncate rounded px-2 py-1 transition ${a?`bg-primary/10 font-medium text-foreground`:`text-muted-foreground hover:bg-muted/50 hover:text-foreground`}`,children:e.label??e.doc})},e.doc)})})]},e.key))})]})}var Rn=t({default:()=>zn});function zn(){let{slug:e,name:t,appName:n}=d(),r=o(),i=re(),{t:a}=D(),[s,c]=(0,K.useState)(null),[l,u]=(0,K.useState)(`loading`),[f,p]=(0,K.useState)(``);(0,K.useEffect)(()=>{let e=!1;async function r(){if(!(!t||!i)){u(`loading`);try{let r=await i.getClient().meta.getItem(`doc`,t,n?{packageId:n}:void 0),a=r?.item??r?.data??r;if(e)return;a&&typeof a.content==`string`?(c({name:t,label:a.label,content:a.content}),u(`ready`)):u(`missing`)}catch(t){if(e)return;(t?.status??t?.response?.status)===404||/not found/i.test(t?.message??``)?u(`missing`):(p(t?.message??`Failed to load documentation`),u(`error`))}}}return r(),()=>{e=!0}},[t,n,i]);let m=(0,K.useCallback)(e=>{document.getElementById(e)?.scrollIntoView({behavior:`smooth`,block:`start`}),window.history.replaceState(null,``,`${window.location.pathname}${window.location.search}#${e}`)},[]),h=(0,K.useCallback)(e=>{if(e.defaultPrevented||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0)return;let t=e.target.closest(`a`)?.getAttribute(`href`);t&&(t.startsWith(`/docs/`)?(e.preventDefault(),r(t)):t.startsWith(`#`)&&(e.preventDefault(),m(decodeURIComponent(t.slice(1)))))},[r,m]),g=(0,K.useCallback)((e,t)=>{e.defaultPrevented||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0||(e.preventDefault(),m(t))},[m]),_=(0,K.useMemo)(()=>xt(s?.content??``),[s?.content]),v=a(`help.onThisPage`,{defaultValue:`On this page`}),{books:y,docs:b}=G(),x=n?`/apps/${n}/docs`:`/docs`,S=(0,K.useMemo)(()=>{let t=y.find(t=>W(t)===e);return t?wt(t,kt(t,b)):null},[y,b,e]),C=(0,K.useCallback)(t=>`${x}/${e}/${t}`,[x,e]);return l===`loading`?(0,q.jsx)(`div`,{className:`flex h-full items-center justify-center p-10 text-muted-foreground`,children:(0,q.jsx)(k,{className:`h-5 w-5 animate-spin`,"aria-label":`Loading documentation`})}):l===`missing`?(0,q.jsx)(U,{breadcrumb:t,children:(0,q.jsxs)(`div`,{className:`mx-auto flex max-w-3xl flex-col items-center gap-3 p-10 text-center`,children:[(0,q.jsx)(ze,{className:`h-10 w-10 text-muted-foreground`}),(0,q.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Documentation not found`}),(0,q.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`No document named `,(0,q.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5`,children:t}),` is installed. It may belong to a package that is not installed, or it was removed in a newer version.`]})]})}):l===`error`?(0,q.jsx)(U,{breadcrumb:t,children:(0,q.jsxs)(`div`,{className:`mx-auto flex max-w-3xl flex-col items-center gap-3 p-10 text-center`,children:[(0,q.jsx)(de,{className:`h-10 w-10 text-destructive`}),(0,q.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Failed to load documentation`}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:f})]})}):(0,q.jsxs)(U,{breadcrumb:s?.label??t,children:[S?(0,q.jsxs)(`details`,{className:`group mx-auto max-w-6xl px-4 pt-4 sm:px-6 lg:hidden`,children:[(0,q.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 rounded-md border bg-muted/30 px-3 py-2 text-sm font-medium [&::-webkit-details-marker]:hidden`,children:[(0,q.jsx)(me,{className:`h-4 w-4 text-muted-foreground`}),(0,q.jsx)(`span`,{className:`truncate`,children:S.label??`Contents`}),(0,q.jsx)(se,{className:`ml-auto h-4 w-4 text-muted-foreground transition-transform group-open:rotate-180`})]}),(0,q.jsx)(`div`,{className:`mt-2 rounded-md border p-3`,children:(0,q.jsx)(Ln,{book:S,activeDoc:t,docHref:C})})]}):null,(0,q.jsxs)(`div`,{className:`mx-auto flex gap-8 p-4 sm:p-6 ${S?`max-w-6xl`:`max-w-5xl`}`,children:[S?(0,q.jsx)(`aside`,{className:`hidden w-56 shrink-0 lg:block`,children:(0,q.jsx)(`nav`,{className:`sticky top-20 max-h-[calc(100vh-6rem)] overflow-auto pr-1`,children:(0,q.jsx)(Ln,{book:S,activeDoc:t,docHref:C})})}):null,(0,q.jsx)(`article`,{className:`min-w-0 max-w-3xl flex-1 [&_h1]:scroll-mt-24 [&_h2]:scroll-mt-24 [&_h3]:scroll-mt-24`,onClick:h,children:(0,q.jsx)(St,{schema:{type:`markdown`,content:In(s?.content??``)}})}),_.length>=3?(0,q.jsx)(`aside`,{className:`hidden xl:block w-56 shrink-0`,children:(0,q.jsxs)(`nav`,{"aria-label":v,className:`sticky top-20 max-h-[calc(100vh-6rem)] overflow-auto`,children:[(0,q.jsx)(`div`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:v}),(0,q.jsx)(`ul`,{className:`border-l border-border text-sm`,children:_.map(e=>(0,q.jsx)(`li`,{style:{paddingLeft:(e.depth-2)*12},children:(0,q.jsx)(`a`,{href:`#${e.id}`,onClick:t=>g(t,e.id),className:`-ml-px block border-l border-transparent py-0.5 pl-3 text-muted-foreground hover:border-primary hover:text-foreground`,children:e.text})},e.id))})]})}):null]})]})}function Bn(){let{books:e,docs:t,state:n,error:i}=G(),a=(0,K.useMemo)(()=>Ct(e,t),[e,t]);return n===`loading`?(0,q.jsx)(`div`,{className:`flex h-full items-center justify-center p-10 text-muted-foreground`,children:(0,q.jsx)(k,{className:`h-5 w-5 animate-spin`,"aria-label":`Loading documentation`})}):n===`error`?(0,q.jsxs)(`div`,{className:`mx-auto flex max-w-3xl flex-col items-center gap-3 p-10 text-center`,children:[(0,q.jsx)(de,{className:`h-10 w-10 text-destructive`}),(0,q.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Failed to load documentation`}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i})]}):(0,q.jsx)(U,{children:(0,q.jsxs)(`div`,{className:`mx-auto max-w-4xl p-4 sm:p-6`,children:[(0,q.jsxs)(`header`,{className:`mb-6`,children:[(0,q.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight`,children:`Documentation`}),(0,q.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Books and guides from your installed packages.`})]}),a.length===0?(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-16 text-center text-muted-foreground`,children:[(0,q.jsx)(Ne,{className:`h-10 w-10`}),(0,q.jsxs)(`p`,{className:`text-sm`,children:[`No documentation is installed. Packages ship docs as flat`,(0,q.jsx)(`code`,{className:`mx-1 rounded bg-muted px-1 py-0.5`,children:`src/docs/*.md`}),`files, organised by a `,(0,q.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5`,children:`book`}),` (ADR-0046).`]})]}):(0,q.jsx)(`ul`,{className:`grid items-stretch gap-3 sm:grid-cols-2`,children:a.map(e=>(0,q.jsx)(`li`,{className:`h-full`,children:(0,q.jsxs)(r,{to:`/docs/${e.slug}`,className:`flex h-full items-start gap-3 rounded-md border border-border p-3 hover:bg-muted/50`,children:[(0,q.jsx)(Ne,{className:`mt-0.5 h-5 w-5 shrink-0 text-muted-foreground`}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`div`,{className:`text-sm font-semibold`,children:e.label}),e.description?(0,q.jsx)(`div`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:e.description}):e.subtitle?(0,q.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-muted-foreground/70`,children:e.subtitle}):null,(0,q.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground/80`,children:[e.docCount,` `,e.docCount===1?`article`:`articles`]})]})]})},e.name))})]})})}function Vn(){let{slug:e,appName:t}=d(),{books:n,docs:r,state:i}=G(),a=(0,K.useMemo)(()=>n.find(t=>W(t)===e),[n,e]),o=(0,K.useMemo)(()=>a?Tt(wt(a,kt(a,r))):void 0,[a,r]);return i===`loading`?(0,q.jsx)(`div`,{className:`flex h-full items-center justify-center p-10 text-muted-foreground`,children:(0,q.jsx)(k,{className:`h-5 w-5 animate-spin`,"aria-label":`Loading documentation`})}):a&&o?(0,q.jsx)(p,{to:`${t?`/apps/${t}/docs`:`/docs`}/${e}/${o}`,replace:!0}):(0,q.jsx)(U,{breadcrumb:a?a.label??e:e,children:(0,q.jsx)(`div`,{className:`mx-auto flex max-w-3xl flex-col items-center gap-3 p-10 text-center`,children:a?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Ne,{className:`h-10 w-10 text-muted-foreground`}),(0,q.jsx)(`h1`,{className:`text-lg font-semibold`,children:a.label??e}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This book has no documents yet.`})]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ze,{className:`h-10 w-10 text-muted-foreground`}),(0,q.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Book not found`}),(0,q.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`No book named `,(0,q.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5`,children:e}),` is installed.`]})]})})})}var Hn=t({default:()=>Un});function Un(){let{slug:e,appName:t}=d(),{books:n,docs:r,state:i}=G();if(i===`loading`)return(0,q.jsx)(`div`,{className:`flex h-full items-center justify-center p-10 text-muted-foreground`,children:(0,q.jsx)(k,{className:`h-5 w-5 animate-spin`,"aria-label":`Loading documentation`})});if(e&&n.some(t=>W(t)===e))return(0,q.jsx)(Vn,{});let a=t?`/apps/${t}/docs`:`/docs`,o=e?Dt(e,n,r):null;return o&&e?(0,q.jsx)(p,{to:`${a}/${W(o)}/${e}`,replace:!0}):(0,q.jsx)(U,{breadcrumb:e,children:(0,q.jsxs)(`div`,{className:`mx-auto flex max-w-3xl flex-col items-center gap-3 p-10 text-center`,children:[(0,q.jsx)(ze,{className:`h-10 w-10 text-muted-foreground`}),(0,q.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Documentation not found`}),(0,q.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`No book or document named `,(0,q.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5`,children:e}),` is installed.`]})]})})}var Wn=t({default:()=>Gn});function Gn(){let e=Et();return(0,q.jsx)(Ot.Provider,{value:e,children:(0,q.jsx)(i,{})})}function Kn(e){let t=e.split(`:`)[0].toLowerCase();return/^cloud\./.test(t)}function qn(e){let t=e.split(`:`)[0].toLowerCase();return t===`localhost`||t===`127.0.0.1`||t===`[::1]`||t.endsWith(`.local`)}function Jn(){return typeof window>`u`?null:window.location.host||null}function Yn(){let e=V(),t=_t();return(0,q.jsxs)(`div`,{className:`flex items-center justify-center gap-2.5 select-none`,children:[(0,q.jsx)(`span`,{className:`inline-flex h-9 w-9 items-center justify-center rounded-xl bg-gradient-to-br from-indigo-500 to-indigo-600 text-white shadow-sm shadow-indigo-500/30 overflow-hidden`,children:t?(0,q.jsx)(`img`,{src:t,alt:e,className:`h-full w-full object-contain`}):(0,q.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`18`,height:`18`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,q.jsx)(`path`,{d:`M12 2 2 7l10 5 10-5-10-5Z`}),(0,q.jsx)(`path`,{d:`m2 17 10 5 10-5`}),(0,q.jsx)(`path`,{d:`m2 12 10 5 10-5`})]})}),(0,q.jsx)(`span`,{className:`text-lg font-semibold tracking-tight text-foreground`,children:e})]})}function X({children:e,formWidth:t=`sm`}){let{t:n}=D(),r=t===`md`?`max-w-md`:`max-w-sm`,i=Jn(),a=!!i&&!Kn(i)&&!qn(i);return(0,K.useEffect)(()=>{if(typeof document>`u`||!i)return;let e=document.title;return a&&(document.title=i),()=>{document.title=e}},[i,a]),(0,q.jsxs)(`div`,{className:`relative flex min-h-svh w-full items-center justify-center overflow-hidden bg-background p-6`,children:[(0,q.jsxs)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-0 -z-10`,children:[(0,q.jsx)(`div`,{className:`absolute inset-0 opacity-[0.35] dark:opacity-[0.25] [mask-image:radial-gradient(ellipse_at_center,black,transparent_72%)] [-webkit-mask-image:radial-gradient(ellipse_at_center,black,transparent_72%)]`,style:{backgroundImage:`radial-gradient(hsl(var(--border)) 1px, transparent 1px)`,backgroundSize:`22px 22px`}}),(0,q.jsx)(`div`,{className:`absolute left-1/2 top-1/2 h-[34rem] w-[34rem] -translate-x-1/2 -translate-y-1/2 rounded-full bg-gradient-to-br from-indigo-500/10 to-indigo-600/10 blur-3xl dark:from-indigo-500/10 dark:to-indigo-600/10`})]}),(0,q.jsxs)(`div`,{className:fe(`flex w-full flex-col gap-5`,r),children:[(0,q.jsx)(Yn,{}),a?(0,q.jsx)(`div`,{className:`flex justify-center`,children:(0,q.jsx)(`span`,{className:`rounded-full border border-border/60 bg-background/60 px-2 py-0.5 font-mono text-[10px] uppercase tracking-wide text-muted-foreground`,title:n(`auth.shell.tenantHostHint`,{defaultValue:`You are signing in to this workspace`}),children:i})}):null,e]})]})}function Xn(e){let t=`/api/v1/auth/oauth2/authorize${e}`,n=()=>window.location.assign(t);fetch(t,{credentials:`include`,redirect:`manual`,headers:{accept:`application/json`}}).then(async e=>{let t=await e.json().catch(()=>null),r=t?.url??t?.redirect_uri??t?.redirectURI;if(e.ok&&r){window.location.href=r;return}n()}).catch(n)}function Zn(e){return!!e&&e.startsWith(`/`)&&!e.startsWith(`//`)}function Qn(e){return e.startsWith(`/_`)?e:`./`.replace(/\/$/,``)+(e.startsWith(`/`)?e:`/${e}`)}function $n(e){return(0,q.jsx)(r,{to:e.href,className:e.className,children:e.children})}function er(){let{t:e}=D(),[t]=c(),n=t.get(`redirect`),{user:r,isLoading:i,organizations:a,isOrganizationsLoading:o,activeOrganization:s,switchOrganization:l,getAuthConfig:u}=S(),[d,f]=(0,K.useState)(!1),[p,m]=(0,K.useState)(!1),h=(0,K.useRef)(!1),[g,_]=(0,K.useState)(!1);(0,K.useLayoutEffect)(()=>{i||_(!0)},[i]);let v=(0,K.useMemo)(()=>{if(typeof window>`u`)return null;let e=new URLSearchParams(window.location.search),t=e.get(`redirect_uri`);if(!e.has(`client_id`)||!t)return null;try{return new URL(t).host}catch{return null}},[]),y=(0,K.useMemo)(()=>{let e=t.get(`error`);return e?{code:e,description:t.get(`error_description`)}:null},[]);if((0,K.useEffect)(()=>{let e=!1;return u().then(t=>{e||f(t?.emailPassword?.disableSignUp===!0)}).catch(()=>{}),()=>{e=!0}},[u]),(0,K.useEffect)(()=>{if(r){if(typeof window<`u`){let e=new URLSearchParams(window.location.search);if(e.has(`client_id`)&&e.has(`redirect_uri`)){h.current||(h.current=!0,Xn(window.location.search));return}}if(!s){if(o||p)return;if(a.length===1){m(!0),l(a[0].id).catch(()=>void 0).finally(()=>m(!1));return}if(a.length===0){window.location.assign(Qn(Zn(n)?n:`/`));return}window.location.assign(Qn(`/organizations`));return}p||window.location.assign(Qn(Zn(n)?n:`/`))}},[r,s,a,o,p,n,l]),i&&!g||r)return(0,q.jsx)(X,{children:(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-10 text-sm text-muted-foreground`,children:[(0,q.jsx)(`div`,{className:`size-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`}),(0,q.jsx)(`span`,{children:e(`auth.login.signingIn`,{defaultValue:`Signing you in…`})})]})});let b=n?`/register?redirect=${encodeURIComponent(n)}`:`/register`;return(0,q.jsx)(X,{formWidth:`md`,children:(0,q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[y?(0,q.jsx)(te,{message:e(`auth.login.errors.oauthCallbackFailed`,{defaultValue:`Single sign-on could not be completed — the sign-in link expired or was already used. Please try again.`})+(y.description?` (${y.description})`:` (${y.code})`)}):null,v?(0,q.jsxs)(`div`,{role:`status`,className:`flex items-start gap-3 rounded-md border border-primary/30 bg-primary/5 px-4 py-3 text-sm text-foreground`,children:[(0,q.jsx)(`span`,{className:`mt-0.5 inline-block size-2 shrink-0 rounded-full bg-primary`}),(0,q.jsx)(`span`,{children:e(`auth.login.ssoHandoff`,{target:v,defaultValue:`Continue to ${v}`})})]}):null,(0,q.jsx)(R,{className:`border-border/60 px-4 py-8 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:(0,q.jsx)(tr,{registerUrl:d?void 0:b,redirect:n})})]})})}function tr({registerUrl:e,redirect:t}){let{t:n}=D(),r=o(),i=(0,K.useRef)(``);return(0,K.useEffect)(()=>{let e=e=>{let t=e.target;t?.id===`login-email`&&(i.current=t.value)};return document.addEventListener(`input`,e,!0),()=>document.removeEventListener(`input`,e,!0)},[]),(0,q.jsx)(b,{onError:e=>{let n=e.message||``,a=e.code,o=n.toLowerCase();if(a===`EMAIL_NOT_VERIFIED`||o.includes(`email`)&&(o.includes(`verif`)||o.includes(`not verified`))){let e=new URLSearchParams;i.current&&e.set(`email`,i.current),t&&e.set(`redirect`,t),r(`/verify-email-prompt?${e.toString()}`)}},title:n(`auth.login.title`,{defaultValue:`Sign in to your account`}),description:n(`auth.login.description`,{defaultValue:`Enter your email and password to continue`}),registerUrl:e,forgotPasswordUrl:`/forgot-password`,linkComponent:$n,errorMessages:{INVALID_EMAIL_OR_PASSWORD:n(`auth.login.errors.invalidCredentials`,{defaultValue:`Invalid email or password`}),EMAIL_NOT_VERIFIED:n(`auth.login.errors.emailNotVerified`,{defaultValue:`Please verify your email address before signing in.`})},labels:{emailLabel:n(`auth.login.emailLabel`,{defaultValue:`Email`}),emailPlaceholder:n(`auth.login.emailPlaceholder`,{defaultValue:`name@example.com`}),emailOrPhoneLabel:n(`auth.login.emailOrPhoneLabel`,{defaultValue:`Email or phone number`}),emailOrPhonePlaceholder:n(`auth.login.emailOrPhonePlaceholder`,{defaultValue:`name@example.com or +1 555 000 0000`}),passwordLabel:n(`auth.login.passwordLabel`,{defaultValue:`Password`}),passwordPlaceholder:n(`auth.login.passwordPlaceholder`,{defaultValue:`Enter your password`}),forgotPasswordText:n(`auth.login.forgotPasswordText`,{defaultValue:`Forgot password?`}),submitButton:n(`auth.login.submitButton`,{defaultValue:`Sign In`}),submittingButton:n(`auth.login.submittingButton`,{defaultValue:`Signing in…`}),noAccountText:n(`auth.login.noAccountText`,{defaultValue:`Don't have an account?`}),signUpText:n(`auth.login.signUpText`,{defaultValue:`Sign up`}),phoneLabel:n(`auth.login.phoneLabel`,{defaultValue:`Phone number`}),phonePlaceholder:n(`auth.login.phonePlaceholder`,{defaultValue:`+1 555 000 0000`}),otpCodeLabel:n(`auth.login.otpCodeLabel`,{defaultValue:`Verification code`}),otpCodePlaceholder:n(`auth.login.otpCodePlaceholder`,{defaultValue:`6-digit code`}),sendOtpButton:n(`auth.login.sendOtpButton`,{defaultValue:`Get code`}),resendOtpCountdownText:n(`auth.login.resendOtpCountdownText`,{defaultValue:`Resend in {seconds}s`}),usePhoneOtpText:n(`auth.login.usePhoneOtpText`,{defaultValue:`Sign in with verification code`}),usePasswordSignInText:n(`auth.login.usePasswordSignInText`,{defaultValue:`Sign in with password instead`})}})}function nr(e){return!!e&&e.startsWith(`/`)&&!e.startsWith(`//`)}function rr(e){return e.startsWith(`/_`)?e:`./`.replace(/\/$/,``)+(e.startsWith(`/`)?e:`/${e}`)}function ir(e){return(0,q.jsx)(r,{to:e.href,className:e.className,children:e.children})}function ar(){let{t:e}=D(),t=o(),[n]=c(),r=n.get(`redirect`),{user:i,isLoading:a,organizations:s,isOrganizationsLoading:l,activeOrganization:u,switchOrganization:d,getAuthConfig:f}=S(),[p,m]=(0,K.useState)(null),[h,g]=(0,K.useState)(!1),v=(0,K.useRef)(!1),[y,b]=(0,K.useState)(!1);if((0,K.useLayoutEffect)(()=>{a||b(!0)},[a]),(0,K.useEffect)(()=>{let e=!1;return f().then(n=>{if(e)return;let i=n?.emailPassword?.disableSignUp===!0;if(m(i),i){let e=r?`?redirect=${encodeURIComponent(r)}`:``;t(`/login${e}`,{replace:!0})}}).catch(()=>{e||m(!1)}),()=>{e=!0}},[f,t,r]),(0,K.useEffect)(()=>{if(i){if(typeof window<`u`){let e=new URLSearchParams(window.location.search);if(e.has(`client_id`)&&e.has(`redirect_uri`)){v.current||(v.current=!0,Xn(window.location.search));return}}if(!u){if(l||h)return;if(s.length===1){g(!0),d(s[0].id).catch(()=>void 0).finally(()=>g(!1));return}if(s.length===0){window.location.assign(rr(nr(r)?r:`/`));return}window.location.assign(rr(`/organizations`));return}h||window.location.assign(rr(nr(r)?r:`/`))}},[i,u,s,l,h,r,d]),p===null||a&&!y||i)return(0,q.jsx)(X,{children:(0,q.jsx)(`div`,{className:`flex flex-col items-center gap-3 py-10 text-sm text-muted-foreground`,children:(0,q.jsx)(`div`,{className:`size-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`})})});let x=r?`/login?redirect=${encodeURIComponent(r)}`:`/login`;return(0,q.jsx)(X,{formWidth:`md`,children:(0,q.jsx)(R,{className:`border-border/60 px-4 py-8 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:(0,q.jsx)(_,{title:e(`auth.register.title`,{defaultValue:`Create your account`}),description:e(`auth.register.description`,{defaultValue:`Sign up to get started`}),loginUrl:x,linkComponent:ir,errorMessages:{USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL:e(`auth.register.errors.userExists`,{defaultValue:`An account with this email already exists. Try signing in instead.`}),USER_ALREADY_EXISTS:e(`auth.register.errors.userExists`,{defaultValue:`An account with this email already exists. Try signing in instead.`})},onVerificationRequired:e=>{let n=new URLSearchParams;n.set(`email`,e),r&&n.set(`redirect`,r),t(`/verify-email-prompt?${n.toString()}`,{replace:!0})},labels:{nameLabel:e(`auth.register.nameLabel`,{defaultValue:`Name`}),namePlaceholder:e(`auth.register.namePlaceholder`,{defaultValue:`John Doe`}),emailLabel:e(`auth.register.emailLabel`,{defaultValue:`Email`}),emailPlaceholder:e(`auth.register.emailPlaceholder`,{defaultValue:`name@example.com`}),passwordLabel:e(`auth.register.passwordLabel`,{defaultValue:`Password`}),passwordPlaceholder:e(`auth.register.passwordPlaceholder`,{defaultValue:`Create a password (min. 8 characters)`}),confirmPasswordLabel:e(`auth.register.confirmPasswordLabel`,{defaultValue:`Confirm password`}),confirmPasswordPlaceholder:e(`auth.register.confirmPasswordPlaceholder`,{defaultValue:`Confirm your password`}),passwordMismatchError:e(`auth.register.passwordMismatchError`,{defaultValue:`Passwords do not match`}),passwordTooShortError:e(`auth.register.passwordTooShortError`,{defaultValue:`Password must be at least 8 characters`}),submitButton:e(`auth.register.submitButton`,{defaultValue:`Create account`}),submittingButton:e(`auth.register.submittingButton`,{defaultValue:`Creating account…`}),hasAccountText:e(`auth.register.hasAccountText`,{defaultValue:`Already have an account?`}),signInText:e(`auth.register.signInText`,{defaultValue:`Sign in`})}})})})}function or(e){return(0,q.jsx)(r,{to:e.href,className:e.className,children:e.children})}function sr(){let{t:e}=D();return(0,q.jsx)(X,{formWidth:`md`,children:(0,q.jsx)(R,{className:`border-border/60 px-4 py-8 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:(0,q.jsx)(ee,{loginUrl:`/login`,linkComponent:or,title:e(`auth.forgotPassword.title`,{defaultValue:`Reset your password`}),description:e(`auth.forgotPassword.description`,{defaultValue:`Enter your email and we'll send you a reset link.`}),labels:{emailLabel:e(`auth.forgotPassword.emailLabel`,{defaultValue:`Email`}),emailPlaceholder:e(`auth.forgotPassword.emailPlaceholder`,{defaultValue:`name@example.com`}),submitButton:e(`auth.forgotPassword.submitButton`,{defaultValue:`Send reset link`}),submittingButton:e(`auth.forgotPassword.submittingButton`,{defaultValue:`Sending…`}),successTitle:e(`auth.forgotPassword.successTitle`,{defaultValue:`Check your email`}),successDescription:e(`auth.forgotPassword.successDescription`,{defaultValue:`If an account exists, a reset link has been sent.`}),backToSignInText:e(`auth.forgotPassword.backToSignInText`,{defaultValue:`Back to sign in`}),phoneLabel:e(`auth.forgotPassword.phoneLabel`,{defaultValue:`Phone number`}),phonePlaceholder:e(`auth.forgotPassword.phonePlaceholder`,{defaultValue:`+1 555 000 0000`}),otpCodeLabel:e(`auth.forgotPassword.otpCodeLabel`,{defaultValue:`Verification code`}),otpCodePlaceholder:e(`auth.forgotPassword.otpCodePlaceholder`,{defaultValue:`6-digit code`}),sendOtpButton:e(`auth.forgotPassword.sendOtpButton`,{defaultValue:`Get code`}),resendOtpCountdownText:e(`auth.forgotPassword.resendOtpCountdownText`,{defaultValue:`Resend in {seconds}s`}),newPasswordLabel:e(`auth.forgotPassword.newPasswordLabel`,{defaultValue:`New password`}),newPasswordPlaceholder:e(`auth.forgotPassword.newPasswordPlaceholder`,{defaultValue:`Enter a new password`}),resetButton:e(`auth.forgotPassword.resetButton`,{defaultValue:`Reset Password`}),usePhoneResetText:e(`auth.forgotPassword.usePhoneResetText`,{defaultValue:`Reset via SMS code`}),useEmailResetText:e(`auth.forgotPassword.useEmailResetText`,{defaultValue:`Reset via email instead`}),phoneSuccessTitle:e(`auth.forgotPassword.phoneSuccessTitle`,{defaultValue:`Password reset`}),phoneSuccessDescription:e(`auth.forgotPassword.phoneSuccessDescription`,{defaultValue:`Your password has been reset. You can now sign in with your new password.`}),rememberPasswordText:e(`auth.forgotPassword.rememberPasswordText`,{defaultValue:`Remember your password?`}),signInText:e(`auth.forgotPassword.signInText`,{defaultValue:`Sign in`})}})})})}function cr(){let{t:e}=D(),t=o(),[n]=c(),i=n.get(`token`),{resetPassword:a}=S(),[s,l]=(0,K.useState)(``),[u,d]=(0,K.useState)(``),[f,p]=(0,K.useState)(!1);return(0,q.jsx)(X,{children:(0,q.jsxs)(R,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[(0,q.jsxs)(j,{className:`text-center`,children:[(0,q.jsx)(A,{className:`text-xl tracking-tight`,children:e(`auth.resetPassword.title`,{defaultValue:`Set a new password`})}),(0,q.jsx)(I,{children:e(`auth.resetPassword.description`,{defaultValue:`Choose a password you have not used before.`})})]}),(0,q.jsx)(N,{children:i?(0,q.jsxs)(`form`,{onSubmit:async n=>{if(n.preventDefault(),s!==u){z.error(e(`auth.resetPassword.passwordsMismatch`,{defaultValue:`Passwords do not match`}));return}if(!i){z.error(e(`auth.resetPassword.missingToken`,{defaultValue:`Reset link is missing or expired`}));return}p(!0);try{await a(i,s),z.success(e(`auth.resetPassword.success`,{defaultValue:`Password updated`})),t(`/login`)}catch(t){z.error(e(`auth.resetPassword.failed`,{defaultValue:`Reset failed`}),{description:t.message})}finally{p(!1)}},className:`flex flex-col gap-4`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,q.jsx)(P,{htmlFor:`new-password`,children:e(`auth.resetPassword.newPassword`,{defaultValue:`New password`})}),(0,q.jsx)(M,{id:`new-password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,value:s,onChange:e=>l(e.target.value)})]}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,q.jsx)(P,{htmlFor:`confirm-password`,children:e(`auth.resetPassword.confirmPassword`,{defaultValue:`Confirm password`})}),(0,q.jsx)(M,{id:`confirm-password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,value:u,onChange:e=>d(e.target.value)})]}),(0,q.jsx)(O,{type:`submit`,className:`w-full`,disabled:f,children:f?e(`auth.resetPassword.submitting`,{defaultValue:`Updating…`}):e(`auth.resetPassword.submit`,{defaultValue:`Update password`})})]}):(0,q.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[e(`auth.resetPassword.invalidToken`,{defaultValue:`This reset link is invalid or has expired.`}),` `,(0,q.jsx)(r,{to:`/forgot-password`,className:`font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.resetPassword.requestNewLink`,{defaultValue:`Request a new link`})})]})})]})})}function lr(e){return e&&e.startsWith(`/`)&&!e.startsWith(`//`)?e:`/`}function ur(){let{t:e}=D(),t=o(),[n]=c(),i=lr(n.get(`next`)),{user:a,isLoading:s,setInitialPassword:l}=S(),[u,d]=(0,K.useState)(``),[f,p]=(0,K.useState)(``),[m,h]=(0,K.useState)(!1);return(0,q.jsx)(X,{children:(0,q.jsxs)(R,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[(0,q.jsxs)(j,{className:`text-center`,children:[(0,q.jsx)(A,{className:`text-xl tracking-tight`,children:e(`auth.setPassword.title`,{defaultValue:`Set a recovery password`})}),(0,q.jsx)(I,{children:e(`auth.setPassword.description`,{defaultValue:`You signed in via single sign-on. Set a local password so you can still sign in to this environment directly if SSO ever becomes unavailable.`})})]}),(0,q.jsx)(N,{children:!s&&!a?(0,q.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[e(`auth.setPassword.noSession`,{defaultValue:`Your session has expired.`}),` `,(0,q.jsx)(r,{to:`/login`,className:`font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.setPassword.backToSignIn`,{defaultValue:`Sign in again`})})]}):(0,q.jsxs)(`form`,{onSubmit:async n=>{if(n.preventDefault(),u!==f){z.error(e(`auth.setPassword.passwordsMismatch`,{defaultValue:`Passwords do not match`}));return}h(!0);try{await l(u),z.success(e(`auth.setPassword.success`,{defaultValue:`Local password set`})),t(i)}catch(t){z.error(e(`auth.setPassword.failed`,{defaultValue:`Could not set password`}),{description:t.message})}finally{h(!1)}},className:`flex flex-col gap-4`,children:[a?.email?(0,q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,q.jsx)(P,{htmlFor:`set-password-email`,children:e(`auth.setPassword.email`,{defaultValue:`Email`})}),(0,q.jsx)(M,{id:`set-password-email`,type:`email`,autoComplete:`username`,value:a.email,disabled:!0,className:`bg-muted text-muted-foreground`})]}):null,(0,q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,q.jsx)(P,{htmlFor:`new-password`,children:e(`auth.setPassword.newPassword`,{defaultValue:`New password`})}),(0,q.jsx)(M,{id:`new-password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,value:u,onChange:e=>d(e.target.value)})]}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,q.jsx)(P,{htmlFor:`confirm-password`,children:e(`auth.setPassword.confirmPassword`,{defaultValue:`Confirm password`})}),(0,q.jsx)(M,{id:`confirm-password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,value:f,onChange:e=>p(e.target.value)})]}),(0,q.jsx)(O,{type:`submit`,className:`w-full`,disabled:m,children:m?e(`auth.setPassword.submitting`,{defaultValue:`Saving…`}):e(`auth.setPassword.submit`,{defaultValue:`Set password`})})]})})]})})}var dr=`/api/v1/auth`;function fr(){let{t:e}=D(),[t]=c(),n=t.get(`token`),[i,a]=(0,K.useState)(`loading`),[o,s]=(0,K.useState)(``);return(0,K.useEffect)(()=>{if(!n){a(`error`),s(e(`auth.verifyEmail.missingToken`,{defaultValue:`Verification link is missing a token.`}));return}let t=!1;return(async()=>{try{let e=await fetch(`${dr}/verify-email`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({token:n})});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t?.message||`Verification failed: ${e.status}`)}t||a(`success`)}catch(n){t||(a(`error`),s(n.message||e(`auth.verifyEmail.errorDescription`,{defaultValue:`Verification failed. Please request a new link.`})))}})(),()=>{t=!0}},[n,e]),(0,q.jsx)(X,{children:(0,q.jsxs)(R,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[i===`loading`&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(j,{className:`text-center`,children:[(0,q.jsx)(A,{className:`text-xl tracking-tight`,children:e(`auth.verifyEmail.verifyingTitle`,{defaultValue:`Verifying…`})}),(0,q.jsx)(I,{children:e(`auth.verifyEmail.verifyingDescription`,{defaultValue:`Hang tight while we confirm your email.`})})]}),(0,q.jsx)(N,{className:`flex justify-center py-6`,children:(0,q.jsx)(`div`,{className:`h-10 w-10 animate-spin rounded-full border-4 border-muted border-t-primary`})})]}),i===`success`&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(j,{className:`text-center`,children:[(0,q.jsx)(`div`,{className:`mx-auto mb-2 flex size-12 items-center justify-center rounded-full bg-emerald-500/10 text-emerald-500 ring-1 ring-emerald-500/30`,children:(0,q.jsx)(oe,{className:`size-6`})}),(0,q.jsx)(A,{className:`text-xl tracking-tight`,children:e(`auth.verifyEmail.successTitle`,{defaultValue:`Email verified`})}),(0,q.jsx)(I,{children:e(`auth.verifyEmail.successDescription`,{defaultValue:`Your email is confirmed. You can now sign in.`})})]}),(0,q.jsx)(N,{className:`text-center`,children:(0,q.jsx)(r,{to:`/login`,className:`text-sm font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.verifyEmail.signInLink`,{defaultValue:`Go to sign in`})})})]}),i===`error`&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(j,{className:`text-center`,children:[(0,q.jsx)(`div`,{className:`mx-auto mb-2 flex size-12 items-center justify-center rounded-full bg-destructive/10 text-destructive ring-1 ring-destructive/30`,children:(0,q.jsx)(Le,{className:`size-6`})}),(0,q.jsx)(A,{className:`text-xl tracking-tight`,children:e(`auth.verifyEmail.errorTitle`,{defaultValue:`Verification failed`})}),(0,q.jsx)(I,{children:o||e(`auth.verifyEmail.errorDescription`,{defaultValue:`Verification failed. Please request a new link.`})})]}),(0,q.jsx)(N,{className:`text-center`,children:(0,q.jsx)(r,{to:`/login`,className:`text-sm font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.verifyEmail.backToSignIn`,{defaultValue:`Back to sign in`})})})]})]})})}function pr(){let{t:e}=D(),t=o(),[n]=c(),r=n.get(`email`)??``,i=n.get(`redirect`)??``,{sendVerificationEmail:a}=S(),[s,l]=(0,K.useState)(!1),[u,d]=(0,K.useState)(!1),[f,p]=(0,K.useState)(null);return(0,q.jsx)(X,{children:(0,q.jsxs)(R,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[(0,q.jsxs)(j,{className:`text-center`,children:[(0,q.jsx)(`div`,{className:`mx-auto mb-4 flex size-16 items-center justify-center rounded-full bg-primary/10`,children:(0,q.jsx)(Re,{className:`size-8 text-primary`})}),(0,q.jsx)(A,{className:`text-xl tracking-tight`,children:e(`auth.verifyEmail.title`,{defaultValue:`Verify your email address`})}),(0,q.jsx)(I,{children:e(`auth.verifyEmail.description`,{defaultValue:`We sent a verification link to your email address. Please click the link to verify your account.`})})]}),(0,q.jsx)(N,{children:(0,q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[r?(0,q.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[e(`auth.verifyEmail.sentTo`,{defaultValue:`Sent to:`}),` `,(0,q.jsx)(`span`,{className:`font-medium text-foreground`,children:r})]}):null,f?(0,q.jsxs)(`div`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:[(0,q.jsx)(`p`,{className:`font-medium`,children:e(`auth.verifyEmail.resendFailed`,{defaultValue:`Failed to resend verification email`})}),(0,q.jsx)(`p`,{className:`mt-1 text-destructive/90`,children:f})]}):null,(0,q.jsx)(O,{onClick:async()=>{if(!r){z.error(e(`auth.verifyEmail.resendFailed`,{defaultValue:`Cannot resend verification email`}),{description:e(`auth.verifyEmail.emailMissing`,{defaultValue:`Email address is missing`})});return}l(!0),p(null);try{await a(r,i||`/`),d(!0),z.success(e(`auth.verifyEmail.resentSuccess`,{defaultValue:`Verification email sent!`}),{description:e(`auth.verifyEmail.resentDescription`,{defaultValue:`Please check your inbox and click the verification link.`})})}catch(t){let n=t?.message?.trim()||e(`auth.verifyEmail.resendUnavailable`,{defaultValue:`Email delivery may not be configured for this environment. Contact support if this persists.`});d(!1),p(n),z.error(e(`auth.verifyEmail.resendFailed`,{defaultValue:`Failed to resend verification email`}),{description:n})}finally{l(!1)}},disabled:s||u,className:`w-full`,variant:u?`outline`:`default`,children:s?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(_e,{className:`mr-2 size-4 animate-spin`}),e(`auth.verifyEmail.resending`,{defaultValue:`Sending…`})]}):u?e(`auth.verifyEmail.resent`,{defaultValue:`Email sent! Check your inbox`}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(_e,{className:`mr-2 size-4`}),e(`auth.verifyEmail.resendButton`,{defaultValue:`Resend verification email`})]})}),(0,q.jsxs)(`div`,{className:`relative`,children:[(0,q.jsx)(`div`,{className:`absolute inset-0 flex items-center`,children:(0,q.jsx)(`span`,{className:`w-full border-t`})}),(0,q.jsx)(`div`,{className:`relative flex justify-center text-xs uppercase`,children:(0,q.jsx)(`span`,{className:`bg-card px-2 text-muted-foreground`,children:e(`auth.verifyEmail.or`,{defaultValue:`Or`})})})]}),(0,q.jsx)(O,{onClick:()=>{let e=i?`?redirect=${encodeURIComponent(i)}`:``;t(`/login${e}`)},variant:`ghost`,className:`w-full`,children:e(`auth.verifyEmail.backToLogin`,{defaultValue:`Back to login`})}),(0,q.jsx)(`p`,{className:`text-center text-xs text-muted-foreground`,children:e(`auth.verifyEmail.checkSpam`,{defaultValue:`Didn't receive the email? Check your spam folder or contact support.`})})]})})]})})}var mr=`/api/v1/auth`;function hr(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function gr(){let{t:e}=D(),t=o(),{user:n,signUp:r,refreshOrganizations:i,updateOrganization:a,createOrganization:s,switchOrganization:c}=S(),[l,u]=(0,K.useState)(``),[d,f]=(0,K.useState)(``),[p,m]=(0,K.useState)(``),[h,g]=(0,K.useState)(``),[_,v]=(0,K.useState)(!1),[y,b]=(0,K.useState)(null);return(0,K.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await fetch(`${mr}/bootstrap-status`,{credentials:`include`}),n=t.ok?await t.json().catch(()=>({})):{};e||b(n.hasOwner===!0)}catch{e||b(!1)}})(),()=>{e=!0}},[]),(0,K.useEffect)(()=>{y===!0&&!n&&t(`/login`,{replace:!0})},[y,n,t]),(0,K.useEffect)(()=>{n&&!_&&window.location.assign(`/`)},[n,_]),y===null?(0,q.jsx)(`div`,{className:`flex min-h-svh w-full items-center justify-center bg-muted`,children:(0,q.jsx)(`div`,{className:`h-8 w-8 animate-spin rounded-full border-4 border-muted-foreground/20 border-t-primary`})}):(0,q.jsx)(`div`,{className:`flex min-h-svh w-full items-center justify-center bg-muted p-6`,children:(0,q.jsx)(`div`,{className:`flex w-full max-w-md flex-col gap-6`,children:(0,q.jsxs)(R,{children:[(0,q.jsxs)(j,{className:`text-center`,children:[(0,q.jsx)(A,{children:e(`auth.setup.welcomeTitle`,{defaultValue:`Welcome to ObjectStack`})}),(0,q.jsx)(I,{children:e(`auth.setup.description`,{defaultValue:`Create the first owner account to finish setting up this deployment.`})})]}),(0,q.jsx)(N,{children:(0,q.jsxs)(`form`,{onSubmit:async t=>{t.preventDefault(),v(!0);try{await r(l,d,p);let e=h.trim();if(e)try{let t;for(let e=0;e<4&&!t?.id;e++)e>0&&await new Promise(e=>setTimeout(e,500)),t=(await i())?.[0];let n=hr(e),r;t?.id?(await a(t.id,{name:e,...n?{slug:n}:{}}),r=t.id):r=(await s({name:e,slug:n||`org-${Date.now().toString(36)}`}))?.id,r&&await c(r).catch(()=>void 0)}catch(e){console.warn(`[setup] organization rename/create failed`,e)}window.location.assign(`/`)}catch(t){z.error(e(`auth.setup.failed`,{defaultValue:`Setup failed`}),{description:t.message})}finally{v(!1)}},className:`flex flex-col gap-4`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,q.jsx)(P,{htmlFor:`name`,children:e(`auth.setup.yourName`,{defaultValue:`Your name`})}),(0,q.jsx)(M,{id:`name`,autoComplete:`name`,required:!0,value:l,onChange:e=>u(e.target.value)})]}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,q.jsx)(P,{htmlFor:`orgName`,children:e(`auth.setup.orgName`,{defaultValue:`Organization name`})}),(0,q.jsx)(M,{id:`orgName`,required:!0,placeholder:e(`auth.setup.orgNamePlaceholder`,{defaultValue:`Acme Inc.`}),value:h,onChange:e=>g(e.target.value)})]}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,q.jsx)(P,{htmlFor:`email`,children:e(`auth.setup.emailLabel`,{defaultValue:`Email`})}),(0,q.jsx)(M,{id:`email`,type:`email`,placeholder:e(`auth.setup.emailPlaceholder`,{defaultValue:`name@example.com`}),autoComplete:`email`,required:!0,value:d,onChange:e=>f(e.target.value)})]}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,q.jsx)(P,{htmlFor:`password`,children:e(`auth.setup.passwordLabel`,{defaultValue:`Password`})}),(0,q.jsx)(M,{id:`password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,placeholder:e(`auth.setup.passwordHint`,{defaultValue:`Minimum 8 characters`}),value:p,onChange:e=>m(e.target.value)})]}),(0,q.jsx)(O,{type:`submit`,className:`mt-2 w-full`,disabled:_,children:_?e(`auth.setup.submitting`,{defaultValue:`Setting up…`}):e(`auth.setup.submit`,{defaultValue:`Create owner account`})})]})})]})})})}var _r=`/api/v1/auth`;function vr(){let{t:e}=D(),t=o(),{user:n,isLoading:r}=S(),[i,a]=(0,K.useState)(!1),[s,c]=(0,K.useState)(null),l=typeof window<`u`?window.location.search:``,u=l.startsWith(`?`)?l.slice(1):l,d=new URLSearchParams(u),f=d.get(`client_id`)??void 0,p=d.get(`scope`)??``;(0,K.useEffect)(()=>{if(!r&&!n){let e=window.location.pathname+window.location.search;t(`/login?redirect=${encodeURIComponent(e)}`,{replace:!0})}},[n,r,t]),(0,K.useEffect)(()=>{if(!f)return;let e=!1;return fetch(`${_r}/oauth2/applications/${encodeURIComponent(f)}/public`,{credentials:`include`}).then(async t=>{if(!t.ok)return;let n=await t.json().catch(()=>({}));if(e)return;let r=n?.data??n;c(r)}).catch(()=>{}),()=>{e=!0}},[f]);let m=p.split(/\s+/).filter(Boolean),h=async t=>{a(!0);try{let n=await fetch(`${_r}/oauth2/consent`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({accept:t,oauth_query:u})}),r=await n.json().catch(()=>({}));if(!n.ok)throw Error(r?.message||`Consent failed: ${n.status}`);let i=r.redirect_uri??r.redirectURI??r.url;if(i){window.location.href=i;return}z(t?e(`oauth.consent.granted`,{defaultValue:`Access granted`}):e(`oauth.consent.denied`,{defaultValue:`Access denied`}),{description:e(`oauth.consent.noRedirect`,{defaultValue:`No redirect URL returned by the server.`})})}catch(t){z.error(e(`oauth.consent.failed`,{defaultValue:`Consent failed`}),{description:t.message})}finally{a(!1)}},g=s?.name??s?.client_name??f??e(`oauth.consent.unknownApp`,{defaultValue:`an application`});return(0,q.jsx)(`div`,{className:`flex min-h-svh w-full flex-1 items-center justify-center bg-background px-4`,children:(0,q.jsxs)(R,{className:`w-full max-w-md`,children:[(0,q.jsxs)(j,{className:`items-center text-center`,children:[(0,q.jsx)(`div`,{className:`mb-3 rounded-full border bg-muted p-3`,children:s?.icon||s?.logo_uri?(0,q.jsx)(`img`,{src:s.icon||s.logo_uri,alt:``,className:`h-8 w-8 rounded`,onError:e=>{e.currentTarget.style.display=`none`}}):(0,q.jsx)(Oe,{className:`h-7 w-7 text-muted-foreground`})}),(0,q.jsx)(A,{className:`text-xl`,children:e(`oauth.consent.title`,{appName:g,defaultValue:`${g} wants to access your account`})}),(0,q.jsx)(I,{children:e(`oauth.consent.request`,{appName:g,suffix:n?.email?` (${n.email})`:``,defaultValue:`${g} is requesting permission${n?.email?` for ${n.email}`:``}.`})})]}),(0,q.jsxs)(N,{className:`space-y-4`,children:[m.length>0&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`mb-2 text-sm font-medium`,children:e(`oauth.consent.willAllow`,{defaultValue:`This app will be able to:`})}),(0,q.jsx)(`ul`,{className:`space-y-1.5 rounded-md border bg-muted/40 p-3 text-sm`,children:m.map(t=>(0,q.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,q.jsx)(le,{className:`mt-0.5 h-4 w-4 text-green-600 dark:text-green-400`}),(0,q.jsx)(`span`,{children:yr(t,e)})]},t))})]}),(0,q.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 pt-2`,children:[(0,q.jsxs)(O,{variant:`outline`,onClick:()=>h(!1),disabled:i,children:[(0,q.jsx)(ae,{className:`mr-2 h-4 w-4`}),e(`oauth.consent.deny`,{defaultValue:`Deny`})]}),(0,q.jsxs)(O,{onClick:()=>h(!0),disabled:i,children:[(0,q.jsx)(le,{className:`mr-2 h-4 w-4`}),i?e(`oauth.consent.submitting`,{defaultValue:`Authorizing…`}):e(`oauth.consent.authorize`,{defaultValue:`Authorize`})]})]}),(0,q.jsx)(`p`,{className:`pt-2 text-center text-xs text-muted-foreground`,children:e(`oauth.consent.footer`,{defaultValue:`You can revoke access at any time from your account settings.`})})]})]})})}function yr(e,t){switch(e){case`openid`:return t(`oauth.consent.scope.openid`,{defaultValue:`Confirm your identity`});case`profile`:return t(`oauth.consent.scope.profile`,{defaultValue:`Read your basic profile (name, picture)`});case`email`:return t(`oauth.consent.scope.email`,{defaultValue:`Read your email address`});case`offline_access`:return t(`oauth.consent.scope.offlineAccess`,{defaultValue:`Stay signed in (refresh access)`});default:return e}}var br=`/api/v1/auth`;function Z({children:e}){return(0,q.jsx)(`div`,{className:`flex min-h-svh w-full flex-col items-center justify-center gap-6 bg-muted p-6 md:p-10`,children:(0,q.jsxs)(`div`,{className:`flex w-full max-w-sm flex-col gap-6`,children:[(0,q.jsxs)(`a`,{href:`#`,className:`flex items-center gap-2 self-center font-medium`,children:[(0,q.jsx)(`div`,{className:`flex size-6 items-center justify-center rounded-md bg-primary text-primary-foreground overflow-hidden`,children:_t()?(0,q.jsx)(`img`,{src:_t(),alt:V(),className:`h-full w-full object-contain`}):(0,q.jsx)(oe,{className:`size-4`})}),V()]}),(0,q.jsx)(`div`,{className:`flex flex-col gap-6`,children:e})]})})}function xr(){let{t:e}=D(),t=a(),[n]=c(),r=n.get(`user_code`)??n.get(`code`)??``,i=n.get(`runtime_name`)??``,s=n.get(`runtime_version`)??``,{user:l,isLoading:u}=S(),d=o(),[f,m]=(0,K.useState)(!1),[h,g]=(0,K.useState)(!1),[_,v]=(0,K.useState)(!1),[y,b]=(0,K.useState)(!1),[x,C]=(0,K.useState)(``);if(!r)return(0,q.jsx)(Z,{children:(0,q.jsx)(R,{children:(0,q.jsxs)(j,{className:`text-center`,children:[(0,q.jsx)(A,{children:e(`auth.device.invalidTitle`,{defaultValue:`Invalid device link`})}),(0,q.jsx)(I,{children:e(`auth.device.invalidDescription`,{defaultValue:`No device code was provided in the URL.`})})]})})});if(u)return(0,q.jsx)(Z,{children:(0,q.jsx)(R,{children:(0,q.jsx)(j,{className:`text-center`,children:(0,q.jsx)(I,{children:e(`auth.device.loading`,{defaultValue:`Loading…`})})})})});if(!l)return(0,q.jsx)(p,{to:`/login?redirect=${encodeURIComponent(`/auth/device${t.search}`)}`,replace:!0});if(_)return(0,q.jsx)(Z,{children:(0,q.jsx)(R,{children:(0,q.jsxs)(j,{className:`text-center`,children:[(0,q.jsx)(oe,{className:`mx-auto mb-2 h-10 w-10 text-green-500`}),(0,q.jsx)(A,{children:e(`auth.device.approvedTitle`,{defaultValue:`Device authorized`})}),(0,q.jsx)(I,{children:e(`auth.device.approvedDescription`,{defaultValue:`You can return to the device — it should sign in shortly.`})})]})})});if(y)return(0,q.jsx)(Z,{children:(0,q.jsx)(R,{children:(0,q.jsxs)(j,{className:`text-center`,children:[(0,q.jsx)(A,{children:e(`auth.device.deniedTitle`,{defaultValue:`Access denied`})}),(0,q.jsx)(I,{children:e(`auth.device.deniedDescription`,{defaultValue:`The device will not be granted access.`})})]})})});let ee=async()=>{await fetch(`${br}/device?user_code=${encodeURIComponent(r)}`,{credentials:`include`}).catch(()=>{})};return(0,q.jsx)(Z,{children:(0,q.jsxs)(R,{children:[(0,q.jsxs)(j,{className:`text-center`,children:[(0,q.jsx)(A,{children:e(`auth.device.title`,{defaultValue:`Authorize new device`})}),(0,q.jsx)(I,{children:e(`auth.device.subtitle`,{email:l.email,defaultValue:`Approve this device to sign in as ${l.email}.`})})]}),(0,q.jsxs)(N,{className:`space-y-4`,children:[i?(0,q.jsxs)(`div`,{className:`rounded-md border bg-background px-4 py-3 text-center`,children:[(0,q.jsx)(`p`,{className:`mb-1 text-xs text-muted-foreground`,children:e(`auth.device.requesterLabel`,{defaultValue:`Connection request from`})}),(0,q.jsx)(`p`,{className:`font-medium`,children:i}),s?(0,q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[V().toLowerCase(),` `,s]}):null]}):null,(0,q.jsxs)(`div`,{className:`rounded-md border bg-background px-4 py-3 text-center`,children:[(0,q.jsx)(`p`,{className:`mb-1 text-xs text-muted-foreground`,children:e(`auth.device.userCodeLabel`,{defaultValue:`Device code`})}),(0,q.jsx)(`p`,{className:`font-mono text-lg font-semibold tracking-widest`,children:r})]}),(0,q.jsx)(`p`,{className:`text-center text-xs text-muted-foreground`,children:e(`auth.device.approveWarning`,{defaultValue:`Only approve if you started this connection yourself a moment ago. Once approved, this runtime can access your organization's private packages.`})}),(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(`p`,{className:`text-center text-sm text-muted-foreground`,children:e(`auth.device.loggedInAs`,{email:l.email,defaultValue:`Signed in as ${l.email}`})}),x&&(0,q.jsx)(`p`,{className:`text-center text-sm text-destructive`,children:x}),(0,q.jsx)(O,{onClick:async()=>{C(``),m(!0);try{await ee();let t=await fetch(`${br}/device/approve`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({userCode:r})});if(!t.ok){let n=await t.json().catch(()=>({}));throw Error(n?.message??n?.error?.message??e(`auth.device.approveFailed`,{defaultValue:`Approval failed`}))}v(!0),z.success(e(`auth.device.approveSuccess`,{defaultValue:`Device authorized`}),{description:e(`auth.device.approveSuccessDescription`,{defaultValue:`You can close this window.`})})}catch(t){C(t?.message??e(`auth.device.approveFailed`,{defaultValue:`Approval failed`}))}finally{m(!1)}},className:`w-full`,disabled:f||h,children:f?e(`auth.device.approving`,{defaultValue:`Approving…`}):e(`auth.device.approve`,{defaultValue:`Approve device`})}),(0,q.jsx)(O,{onClick:async()=>{C(``),g(!0);try{await ee(),await fetch(`${br}/device/deny`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({userCode:r})}),b(!0)}catch(t){C(t?.message??e(`auth.device.denyFailed`,{defaultValue:`Failed to deny request`}))}finally{g(!1)}},variant:`outline`,className:`w-full`,disabled:f||h,children:h?e(`auth.device.denying`,{defaultValue:`Denying…`}):e(`auth.device.deny`,{defaultValue:`Deny request`})}),(0,q.jsx)(`div`,{className:`text-center`,children:(0,q.jsx)(`button`,{type:`button`,className:`text-sm text-muted-foreground underline-offset-4 hover:underline`,onClick:()=>d(`/`),children:e(`auth.device.cancel`,{defaultValue:`Cancel`})})})]})]})]})})}function Sr(){let{t:e}=D(),{invitationId:t}=d(),n=o(),{user:r,isLoading:i,acceptInvitation:a,rejectInvitation:s,refreshOrganizations:c}=S(),[l,u]=(0,K.useState)(!1),[f,p]=(0,K.useState)(!1);return(0,K.useEffect)(()=>{if(!i&&!r&&t){let e=`/accept-invitation/${t}`;n(`/login?redirect=${encodeURIComponent(e)}`,{replace:!0})}},[i,r,t,n]),t?(0,q.jsx)(`div`,{className:`flex min-h-svh w-full flex-col items-center justify-center gap-6 bg-muted p-6 md:p-10`,children:(0,q.jsx)(`div`,{className:`flex w-full max-w-sm flex-col gap-6`,children:(0,q.jsxs)(R,{children:[(0,q.jsxs)(j,{className:`text-center`,children:[(0,q.jsx)(A,{className:`text-xl`,children:e(`acceptInvitation.title`,{defaultValue:`Accept organization invitation`})}),(0,q.jsx)(I,{children:e(`acceptInvitation.description`,{defaultValue:`You've been invited to join an organization.`})})]}),(0,q.jsxs)(N,{className:`flex flex-col gap-3`,children:[(0,q.jsx)(O,{className:`w-full`,onClick:async()=>{u(!0);try{await a(t),await c().catch(()=>void 0),z.success(e(`acceptInvitation.accepted`,{defaultValue:`Invitation accepted`})),n(`/organizations`)}catch(t){z.error(e(`acceptInvitation.acceptFailed`,{defaultValue:`Could not accept`}),{description:t.message})}finally{u(!1)}},disabled:l||f,children:l?e(`acceptInvitation.accepting`,{defaultValue:`Accepting…`}):e(`acceptInvitation.accept`,{defaultValue:`Accept invitation`})}),(0,q.jsx)(O,{variant:`outline`,className:`w-full`,onClick:async()=>{p(!0);try{await s(t),z.success(e(`acceptInvitation.declined`,{defaultValue:`Invitation declined`})),n(`/organizations`)}catch(t){z.error(e(`acceptInvitation.declineFailed`,{defaultValue:`Could not decline`}),{description:t.message})}finally{p(!1)}},disabled:l||f,children:f?e(`acceptInvitation.declining`,{defaultValue:`Declining…`}):e(`acceptInvitation.decline`,{defaultValue:`Decline`})})]})]})})}):(0,q.jsx)(`div`,{className:`flex min-h-svh w-full flex-col items-center justify-center bg-muted p-6`,children:(0,q.jsx)(R,{className:`w-full max-w-sm`,children:(0,q.jsxs)(j,{className:`text-center`,children:[(0,q.jsx)(A,{className:`text-xl`,children:e(`acceptInvitation.invalidTitle`,{defaultValue:`Invalid invitation link`})}),(0,q.jsx)(I,{children:e(`acceptInvitation.invalidDescription`,{defaultValue:`The invitation id is missing from the URL.`})})]})})})}var Cr=`/api/v1/auth`;function wr(){try{if(typeof document>`u`)return`/`;let e=document.querySelector(`base`)?.getAttribute(`href`);return e&&new URL(e,window.location.origin).pathname.replace(/\/$/,``)||`/`}catch{return`/`}}var Tr=wr();function Er(){let e=a(),t=e.pathname+e.search;return(0,q.jsx)(p,{to:`/login${t&&t!==`/`?`?redirect=${encodeURIComponent(t)}`:``}`,replace:!0})}function Q({children:e,requireOrganization:t=!0}){return(0,q.jsx)(v,{fallback:(0,q.jsx)(Er,{}),loadingFallback:(0,q.jsx)(Ve,{}),children:(0,q.jsx)(Ge,{children:t?(0,q.jsx)(st,{children:e}):e})})}function Dr(){let{user:e}=S();return(0,q.jsx)(qe,{userId:e?.id,children:(0,q.jsx)(at,{})})}function Or(){return(0,K.useEffect)(()=>{document.title=V();let e=ht();if(e){let t=document.getElementById(`favicon`);t&&(t.href=e,t.type=e.endsWith(`.svg`)?`image/svg+xml`:`image/png`)}},[a()]),null}function kr(){return(0,q.jsxs)(x,{authUrl:Cr,children:[(0,q.jsx)($e,{position:`bottom-right`}),(0,q.jsx)(kn,{}),(0,q.jsxs)(l,{basename:Tr,children:[(0,q.jsx)(Or,{}),(0,q.jsx)(ct,{children:(0,q.jsxs)(m,{children:[(0,q.jsx)(u,{path:`/login`,element:(0,q.jsx)(er,{})}),(0,q.jsx)(u,{path:`/register`,element:(0,q.jsx)(ar,{})}),(0,q.jsx)(u,{path:`/forgot-password`,element:(0,q.jsx)(sr,{})}),(0,q.jsx)(u,{path:`/reset-password`,element:(0,q.jsx)(cr,{})}),(0,q.jsx)(u,{path:`/set-password`,element:(0,q.jsx)(ur,{})}),(0,q.jsx)(u,{path:`/verify-email`,element:(0,q.jsx)(fr,{})}),(0,q.jsx)(u,{path:`/verify-email-prompt`,element:(0,q.jsx)(pr,{})}),(0,q.jsx)(u,{path:`/setup`,element:(0,q.jsx)(gr,{})}),(0,q.jsx)(u,{path:`/oauth/consent`,element:(0,q.jsx)(vr,{})}),(0,q.jsx)(u,{path:`/auth/device`,element:(0,q.jsx)(xr,{})}),(0,q.jsx)(u,{path:`/accept-invitation/:invitationId`,element:(0,q.jsx)(Sr,{})}),(0,q.jsx)(u,{path:`/f/:slug`,element:(0,q.jsx)(On,{mode:`public`})}),(0,q.jsx)(u,{path:`/s/:token`,element:(0,q.jsx)(jn,{})}),(0,q.jsx)(u,{path:`/studio`,element:(0,q.jsx)(Q,{children:(0,q.jsxs)(`div`,{className:`flex min-h-screen flex-col bg-background text-foreground`,children:[(0,q.jsx)(`header`,{className:`flex shrink-0 items-center border-b px-3 py-2`,children:(0,q.jsx)(r,{to:`/home`,title:`返回主页`,className:`inline-flex items-center gap-1.5 rounded-md px-1.5 py-0.5 text-[13px] font-semibold hover:bg-muted`,children:V()})}),(0,q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,q.jsx)(et,{})})]})})}),(0,q.jsx)(u,{path:`/studio/:packageId`,element:(0,q.jsx)(p,{to:`data`,replace:!0})}),(0,q.jsx)(u,{path:`/studio/:packageId/:tab`,element:(0,q.jsx)(Q,{children:(0,q.jsx)(rt,{})})}),(0,q.jsx)(u,{path:`/forms/:name`,element:(0,q.jsx)(Q,{children:(0,q.jsx)(On,{mode:`internal`})})}),(0,q.jsxs)(u,{path:`/docs`,element:(0,q.jsx)(Q,{children:(0,q.jsx)(Gn,{})}),children:[(0,q.jsx)(u,{index:!0,element:(0,q.jsx)(Bn,{})}),(0,q.jsx)(u,{path:`:slug`,element:(0,q.jsx)(Un,{})}),(0,q.jsx)(u,{path:`:slug/:name`,element:(0,q.jsx)(zn,{})})]}),(0,q.jsx)(u,{path:`/home`,element:(0,q.jsx)(Q,{children:(0,q.jsx)(Dr,{})})}),(0,q.jsx)(u,{path:`/dev/master-detail`,element:(0,q.jsx)(Q,{children:(0,q.jsx)(Nt,{})})}),(0,q.jsx)(u,{path:`/dev/lists`,element:(0,q.jsx)(Q,{children:(0,q.jsx)(It,{})})}),(0,q.jsx)(u,{path:`/dev/modal`,element:(0,q.jsx)(Q,{children:(0,q.jsx)(Lt,{})})}),(0,q.jsx)(u,{path:`/dev/lookup`,element:(0,q.jsx)(Q,{children:(0,q.jsx)(Rt,{})})}),(0,q.jsx)(u,{path:`/dev/row-actions`,element:(0,q.jsx)(Q,{children:(0,q.jsx)(Ut,{})})}),(0,q.jsx)(u,{path:`/organizations`,element:(0,q.jsx)(Q,{requireOrganization:!1,children:(0,q.jsx)(Qe,{children:(0,q.jsx)(Ke,{})})})}),(0,q.jsxs)(u,{path:`/organizations/:slug`,element:(0,q.jsx)(Q,{requireOrganization:!1,children:(0,q.jsx)(it,{})}),children:[(0,q.jsx)(u,{index:!0,element:(0,q.jsx)(p,{to:`members`,replace:!0})}),(0,q.jsx)(u,{path:`members`,element:(0,q.jsx)(tt,{})}),(0,q.jsx)(u,{path:`invitations`,element:(0,q.jsx)(We,{})}),(0,q.jsx)(u,{path:`settings`,element:(0,q.jsx)(Ze,{})})]}),(0,q.jsx)(u,{path:`/system/*`,element:(0,q.jsx)(He,{})}),(0,q.jsx)(u,{path:`/ai`,element:(0,q.jsx)(Q,{children:(0,q.jsx)(Be,{children:(0,q.jsx)(Ye,{})})})}),(0,q.jsx)(u,{path:`/ai/:agent`,element:(0,q.jsx)(Q,{children:(0,q.jsx)(Be,{children:(0,q.jsx)(Ye,{})})})}),(0,q.jsx)(u,{path:`/ai/:agent/:conversationId`,element:(0,q.jsx)(Q,{children:(0,q.jsx)(Be,{children:(0,q.jsx)(Ye,{})})})}),(0,q.jsx)(u,{path:`/apps/:appName/*`,element:(0,q.jsx)(Q,{children:(0,q.jsx)(fn,{})})}),(0,q.jsx)(u,{path:`/`,element:(0,q.jsx)(Ge,{children:(0,q.jsx)(mn,{})})}),(0,q.jsx)(u,{path:`*`,element:(0,q.jsx)(p,{to:`/`,replace:!0})})]})})]})]})}async function Ar(e){try{let t=await fetch(`/api/v1/i18n/translations/${e}`);if(!t.ok)return console.warn(`[i18n] Failed to load translations for '${e}': HTTP ${t.status}`),{};let n=await t.json(),r;return r=n?.data?.translations&&typeof n.data.translations==`object`?n.data.translations:n,y(r)?g(r):r}catch(t){return console.warn(`[i18n] Failed to load translations for '${e}':`,t),{}}}var jr=`auth-session-token`,Mr=`auth-active-organization-id`;async function Nr(e){if(typeof window>`u`)return;let t=null;try{t=localStorage.getItem(jr)}catch{return}if(t)try{let n=await fetch(`${e}/get-session`,{method:`GET`,credentials:`omit`,headers:{Authorization:`Bearer ${t}`,Accept:`application/json`}});if(n.ok){let e=await n.json().catch(()=>null);if(e?.user??e?.data?.user??null)return}localStorage.removeItem(jr),localStorage.removeItem(Mr)}catch{}}function Pr(e,t){let n=Array.isArray(e.fields)?e.fields:Object.values(e.fields||{});return{id:e.name||`obj_${t}`,name:e.name||``,label:typeof e.label==`object`?e.label.defaultValue||e.label.key||``:e.label||e.name||``,pluralLabel:e.pluralLabel||e.plural_label||void 0,description:typeof e.description==`object`?e.description.defaultValue:e.description||void 0,icon:e.icon||void 0,group:e.name?.startsWith(`sys_`)?`System Objects`:`Custom Objects`,sortOrder:t,isSystem:e.name?.startsWith(`sys_`)||!1,enabled:e.enabled!==!1,fieldCount:n.length,relationships:Array.isArray(e.relationships)?e.relationships.map(e=>({relatedObject:e.object||e.relatedObject||``,type:e.type||`one-to-many`,label:e.label||e.name||void 0,foreignKey:e.foreign_key||e.foreignKey||void 0})):void 0}}function Fr(e,t){return{id:e.name||`fld_${t}`,name:e.name||``,label:typeof e.label==`object`?e.label.defaultValue||e.label.key||``:e.label||e.name||``,type:e.type||`text`,group:e.group||void 0,sortOrder:t,description:e.description||e.help||void 0,required:e.required||!1,unique:e.unique||!1,readonly:e.readonly||!1,hidden:e.hidden||!1,defaultValue:e.defaultValue||e.default_value||void 0,placeholder:e.placeholder||void 0,options:Array.isArray(e.options)?e.options.map(e=>typeof e==`string`?{label:e,value:e}:{label:e.label||e.value,value:e.value,color:e.color}):void 0,isSystem:e.readonly===!0&&(e.name===`id`||e.name===`createdAt`||e.name===`updatedAt`),externalId:e.externalId||!1,trackHistory:e.trackHistory||e.track_history||!1,indexed:e.indexed||!1,referenceTo:e.reference_to||e.referenceTo||void 0,formula:e.formula||void 0}}function Ir(e){let{objects:t}=w(),n=(0,K.useMemo)(()=>(t||[]).find(t=>t.name===e),[t,e]);return{object:(0,K.useMemo)(()=>n?Pr(n,0):null,[n]),fields:(0,K.useMemo)(()=>n?(Array.isArray(n.fields)?n.fields:Object.values(n.fields||{})).map(Fr):[],[n]),metadataObject:n}}function Lr({label:e,value:t,onSave:n,multiline:r=!1,disabled:i=!1,placeholder:a}){let[o,s]=(0,K.useState)(!1),[c,l]=(0,K.useState)(t),[u,d]=(0,K.useState)(!1),f=(0,K.useRef)(null),p=()=>{l(t),s(!0),setTimeout(()=>f.current?.focus(),0)},m=(0,K.useCallback)(async()=>{if(c===t){s(!1);return}d(!0);try{await n(c),s(!1)}catch{}finally{d(!1)}},[c,t,n]),h=()=>{l(t),s(!1)},g=e=>{e.key===`Enter`&&!r&&(e.preventDefault(),m()),e.key===`Escape`&&h()};return(0,q.jsxs)(`div`,{className:`space-y-1.5 group`,children:[(0,q.jsx)(`dt`,{className:`text-xs font-medium text-muted-foreground`,children:e}),(0,q.jsx)(`dd`,{children:o?(0,q.jsxs)(`div`,{className:`flex items-start gap-1.5`,children:[r?(0,q.jsx)(Fe,{ref:f,value:c,onChange:e=>l(e.target.value),onKeyDown:g,placeholder:a,rows:3,className:`text-sm flex-1 min-w-0`,disabled:u}):(0,q.jsx)(M,{ref:f,value:c,onChange:e=>l(e.target.value),onKeyDown:g,placeholder:a,className:`text-sm h-7 flex-1 min-w-0`,disabled:u}),(0,q.jsx)(`button`,{onClick:()=>void m(),disabled:u,className:`mt-0.5 p-1 rounded text-green-600 hover:bg-green-50 disabled:opacity-50 shrink-0`,"aria-label":`Save`,children:u?(0,q.jsx)(k,{className:`h-3.5 w-3.5 animate-spin`}):(0,q.jsx)(le,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(`button`,{onClick:h,disabled:u,className:`mt-0.5 p-1 rounded text-muted-foreground hover:bg-accent shrink-0`,"aria-label":`Cancel`,children:(0,q.jsx)(ae,{className:`h-3.5 w-3.5`})})]}):(0,q.jsxs)(`div`,{className:`flex items-center gap-2 min-h-7`,children:[(0,q.jsx)(`span`,{className:`text-sm flex-1 min-w-0 truncate`,children:t||(0,q.jsx)(`span`,{className:`text-muted-foreground italic`,children:a||`—`})}),!i&&(0,q.jsx)(`button`,{onClick:p,className:`p-1 rounded text-muted-foreground opacity-0 group-hover:opacity-100 hover:bg-accent transition-opacity shrink-0`,"aria-label":`Edit ${e}`,children:(0,q.jsx)(Ce,{className:`h-3 w-3`})})]})})]})}function Rr({schema:e}){let t=e.objectName,{object:n,fields:r,metadataObject:i}=Ir(t),{refresh:a}=w(),o=Xe(),s=(0,K.useCallback)(async(e,n)=>{if(!o||!i)return;let r={...i,[e]:n};try{await o.saveMetadataItem(`object`,t,r),await a(),z.success(`${e===`label`?`Display name`:`Field`} updated`)}catch(e){throw z.error(e?.message||`Failed to save`),e}},[o,i,t,a]);if(!n)return null;let c=n.isSystem;return(0,q.jsxs)(`div`,{className:`space-y-6`,"data-testid":`object-properties`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h3`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-4`,children:`基本信息`}),(0,q.jsxs)(`dl`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-5`,children:[(0,q.jsx)(Lr,{label:`显示名称`,value:n.label,onSave:e=>s(`label`,e),placeholder:`输入显示名称`,disabled:c}),(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`dt`,{className:`text-xs font-medium text-muted-foreground`,children:`API 名称`}),(0,q.jsx)(`dd`,{className:`text-sm font-mono bg-muted/50 rounded px-2 py-1 inline-block`,children:n.name})]}),(0,q.jsx)(Lr,{label:`复数名称`,value:n.pluralLabel||``,onSave:e=>s(`pluralLabel`,e),placeholder:`例如:客户们`,disabled:c}),(0,q.jsx)(Lr,{label:`分组`,value:n.group||``,onSave:e=>s(`group`,e),placeholder:`对象分组`,disabled:c}),(0,q.jsx)(`div`,{className:`sm:col-span-2`,children:(0,q.jsx)(Lr,{label:`描述`,value:n.description||``,onSave:e=>s(`description`,e),multiline:!0,placeholder:`输入对象描述`,disabled:c})})]})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h3`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-4`,children:`配置`}),(0,q.jsxs)(`dl`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-4`,children:[(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`dt`,{className:`text-xs font-medium text-muted-foreground`,children:`状态`}),(0,q.jsx)(`dd`,{children:(0,q.jsx)(L,{variant:n.enabled===!1?`secondary`:`default`,className:`font-normal`,children:n.enabled===!1?`已禁用`:`已启用`})})]}),(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`dt`,{className:`text-xs font-medium text-muted-foreground`,children:`字段数量`}),(0,q.jsxs)(`dd`,{className:`text-sm font-medium`,children:[n.fieldCount??r.length,` 个字段`]})]}),c&&(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`dt`,{className:`text-xs font-medium text-muted-foreground`,children:`类型`}),(0,q.jsx)(`dd`,{children:(0,q.jsx)(L,{variant:`secondary`,className:`font-normal`,children:`系统对象`})})]})]})]})]})}var zr=[{label:`一对多`,value:`one-to-many`},{label:`多对多`,value:`many-to-many`},{label:`一对一`,value:`one-to-one`},{label:`多对一`,value:`many-to-one`}];function Br({schema:e}){let t=e.objectName,{object:n,metadataObject:r}=Ir(t),{refresh:i}=w(),a=Xe(),[o,s]=(0,K.useState)(!1),[c,l]=(0,K.useState)(!1),[u,d]=(0,K.useState)({relatedObject:``,type:`one-to-many`,label:``,foreignKey:``}),f=(0,K.useCallback)(async()=>{if(!a||!r||!u.relatedObject.trim())return;let e={relatedObject:u.relatedObject.trim(),type:u.type,label:u.label.trim()||void 0,foreignKey:u.foreignKey.trim()||void 0},n={...r,relationships:[...Array.isArray(r.relationships)?r.relationships:[],e]};l(!0);try{await a.saveMetadataItem(`object`,t,n),await i(),z.success(`关联关系已添加`),s(!1),d({relatedObject:``,type:`one-to-many`,label:``,foreignKey:``})}catch(e){z.error(e?.message||`保存失败`)}finally{l(!1)}},[a,r,n,u,t,i]),p=(0,K.useCallback)(async e=>{if(!a||!r)return;let n=Array.isArray(r.relationships)?[...r.relationships]:[];n.splice(e,1);let o={...r,relationships:n};l(!0);try{await a.saveMetadataItem(`object`,t,o),await i(),z.success(`关联关系已删除`)}catch(e){z.error(e?.message||`删除失败`)}finally{l(!1)}},[a,r,t,i]);if(!n)return null;let m=n.relationships&&n.relationships.length>0;return(0,q.jsx)(`div`,{className:`space-y-4`,"data-testid":`relationships-section`,children:(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,q.jsx)(`h3`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:`关联关系`}),!n.isSystem&&(0,q.jsxs)(O,{size:`sm`,variant:`outline`,onClick:()=>s(e=>!e),className:`h-7 text-xs`,children:[(0,q.jsx)(he,{className:`h-3 w-3 mr-1`}),`添加关联`]})]}),o&&(0,q.jsxs)(`div`,{className:`mb-4 p-4 border rounded-lg bg-muted/30 space-y-3`,children:[(0,q.jsx)(`h4`,{className:`text-sm font-medium`,children:`新建关联关系`}),(0,q.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`label`,{className:`text-xs text-muted-foreground block mb-1`,children:`关联对象 *`}),(0,q.jsx)(M,{value:u.relatedObject,onChange:e=>d(t=>({...t,relatedObject:e.target.value})),placeholder:`例如:account`,className:`h-7 text-xs`})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`label`,{className:`text-xs text-muted-foreground block mb-1`,children:`关联类型`}),(0,q.jsx)(`select`,{value:u.type,onChange:e=>d(t=>({...t,type:e.target.value})),className:`w-full h-7 text-xs rounded-md border border-input bg-background px-2`,children:zr.map(e=>(0,q.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`label`,{className:`text-xs text-muted-foreground block mb-1`,children:`显示名称`}),(0,q.jsx)(M,{value:u.label,onChange:e=>d(t=>({...t,label:e.target.value})),placeholder:`可选`,className:`h-7 text-xs`})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`label`,{className:`text-xs text-muted-foreground block mb-1`,children:`外键字段`}),(0,q.jsx)(M,{value:u.foreignKey,onChange:e=>d(t=>({...t,foreignKey:e.target.value})),placeholder:`例如:account_id`,className:`h-7 text-xs`})]})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2 justify-end`,children:[(0,q.jsx)(O,{size:`sm`,variant:`ghost`,className:`h-7 text-xs`,onClick:()=>s(!1),disabled:c,children:`取消`}),(0,q.jsxs)(O,{size:`sm`,className:`h-7 text-xs`,onClick:()=>void f(),disabled:c||!u.relatedObject.trim(),children:[c?(0,q.jsx)(k,{className:`h-3 w-3 animate-spin mr-1`}):null,`保存`]})]})]}),m?(0,q.jsx)(`div`,{className:`space-y-2`,children:n.relationships?.map((e,t)=>(0,q.jsxs)(`div`,{className:`flex items-start gap-4 p-3 rounded-lg border bg-card hover:bg-accent/30 transition-colors group`,children:[(0,q.jsx)(L,{variant:`outline`,className:`text-xs shrink-0 mt-0.5`,children:zr.find(t=>t.value===e.type)?.label||e.type}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`p`,{className:`font-medium text-sm`,children:e.label||e.relatedObject}),e.label&&e.label!==e.relatedObject&&(0,q.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:[`关联对象: `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.relatedObject})]}),e.foreignKey&&(0,q.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:[`外键: `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.foreignKey})]})]}),!n.isSystem&&(0,q.jsx)(`button`,{onClick:()=>void p(t),disabled:c,className:`p-1 rounded text-muted-foreground opacity-0 group-hover:opacity-100 hover:text-destructive hover:bg-destructive/10 transition-all shrink-0`,"aria-label":`删除关联`,children:(0,q.jsx)(xe,{className:`h-3.5 w-3.5`})})]},t))}):!o&&(0,q.jsxs)(`div`,{className:`text-center py-8 px-4 border border-dashed rounded-lg`,children:[(0,q.jsx)(ye,{className:`h-8 w-8 mx-auto mb-2 text-muted-foreground opacity-40`}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`暂无关联关系。`}),!n.isSystem&&(0,q.jsxs)(O,{size:`sm`,variant:`outline`,className:`mt-3 h-7 text-xs`,onClick:()=>s(!0),children:[(0,q.jsx)(he,{className:`h-3 w-3 mr-1`}),`添加关联`]})]})]})})}function Vr({schema:e}){let t=e.objectName,{fields:n}=Ir(t),r=(0,K.useMemo)(()=>n.filter(e=>e.unique||e.name===`id`||e.externalId),[n]);return(0,q.jsx)(`div`,{className:`space-y-4`,"data-testid":`keys-section`,children:(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h3`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-4`,children:`唯一键`}),r.length>0?(0,q.jsx)(`div`,{className:`space-y-2`,children:r.map(e=>(0,q.jsxs)(`div`,{className:`flex items-start gap-4 p-3 rounded-lg border bg-card hover:bg-accent/30 transition-colors`,children:[(0,q.jsx)(L,{variant:e.name===`id`?`default`:`outline`,className:`text-xs shrink-0 mt-0.5`,children:e.name===`id`?`主键`:e.externalId?`外部 ID`:`唯一`}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`p`,{className:`font-medium text-sm`,children:e.label||e.name}),(0,q.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:[`类型: `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.type})]})]})]},e.name))}):(0,q.jsxs)(`div`,{className:`text-center py-8 px-4 border border-dashed rounded-lg`,children:[(0,q.jsx)(Oe,{className:`h-8 w-8 mx-auto mb-2 text-muted-foreground opacity-40`}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`未找到唯一键或主键。`})]})]})})}function Hr(e){return(0,q.jsx)(`div`,{className:`space-y-4`,"data-testid":`data-experience-section`,children:(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h3`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-4`,children:`数据体验`}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground mb-4`,children:`配置用户与此对象数据的交互方式`}),(0,q.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-4`,children:[(0,q.jsxs)(`div`,{className:`rounded-lg border p-5 text-center hover:bg-accent/30 transition-colors cursor-pointer`,"data-testid":`data-experience-forms`,children:[(0,q.jsx)(Me,{className:`h-7 w-7 mx-auto mb-2.5 text-muted-foreground`}),(0,q.jsx)(`p`,{className:`text-sm font-semibold mb-1`,children:`表单`}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`设计数据录入表单`})]}),(0,q.jsxs)(`div`,{className:`rounded-lg border p-5 text-center hover:bg-accent/30 transition-colors cursor-pointer`,"data-testid":`data-experience-views`,children:[(0,q.jsx)(Se,{className:`h-7 w-7 mx-auto mb-2.5 text-muted-foreground`}),(0,q.jsx)(`p`,{className:`text-sm font-semibold mb-1`,children:`视图`}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`配置列表和详情视图`})]}),(0,q.jsxs)(`div`,{className:`rounded-lg border p-5 text-center hover:bg-accent/30 transition-colors cursor-pointer`,"data-testid":`data-experience-dashboards`,children:[(0,q.jsx)(ve,{className:`h-7 w-7 mx-auto mb-2.5 text-muted-foreground`}),(0,q.jsx)(`p`,{className:`text-sm font-semibold mb-1`,children:`仪表盘`}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`构建可视化仪表盘`})]})]})]})})}function Ur({schema:e}){let t=e.objectName,{object:n}=Ir(t);return(0,q.jsx)(`div`,{className:`space-y-4`,"data-testid":`data-preview-section`,children:(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h3`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-4`,children:`数据预览`}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground mb-4`,children:`查看此对象的示例记录`}),(0,q.jsxs)(`div`,{className:`rounded-lg border border-dashed p-12 text-center`,children:[(0,q.jsx)(we,{className:`h-12 w-12 mx-auto mb-4 text-muted-foreground opacity-40`}),(0,q.jsx)(`p`,{className:`text-sm font-medium mb-1`,children:`示例数据`}),(0,q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`“`,n?.label||t,`” 的实时数据预览将在此处显示`]})]})]})})}function Wr(e,t){return{name:e.name,label:e.label,pluralLabel:e.pluralLabel,description:e.description,icon:e.icon,group:e.group,sortOrder:e.sortOrder,enabled:e.enabled,fields:t,relationships:e.relationships}}function Gr(e){return{name:e.name,label:e.label,type:e.type,group:e.group,description:e.description,required:e.required,unique:e.unique,readonly:e.readonly,hidden:e.hidden,defaultValue:e.defaultValue,placeholder:e.placeholder,options:e.options,externalId:e.externalId,trackHistory:e.trackHistory,indexed:e.indexed,referenceTo:e.referenceTo,formula:e.formula,sortOrder:e.sortOrder}}var Kr=class{adapter;constructor(e){this.adapter=e}async getItems(e){let t=await this.adapter.getClient().meta.getItems(e);return t&&typeof t==`object`&&`items`in t&&Array.isArray(t.items)?t.items:[]}async saveMetadataItem(e,t,n){await this.adapter.getClient().meta.saveItem(e,t,n),this.adapter.invalidateCache(`${e}:${t}`)}async deleteMetadataItem(e,t){await this.adapter.getClient().meta.saveItem(e,t,{name:t,enabled:!1,_deleted:!0}),this.adapter.invalidateCache(`${e}:${t}`)}async saveObject(e,t){let n=this.adapter.getClient(),r=Wr(e,t);await n.meta.saveItem(`object`,e.name,r),this.adapter.invalidateCache(`object:${e.name}`)}async deleteObject(e){await this.adapter.getClient().meta.saveItem(`object`,e,{name:e,enabled:!1,_deleted:!0}),this.adapter.invalidateCache(`object:${e}`)}async saveFields(e,t){let n=this.adapter.getClient(),r={};try{let t=await n.meta.getItem(`object`,e);r=t?.item??t??{}}catch{}let i={...r,name:e,fields:t.map(Gr)};await n.meta.saveItem(`object`,e,i),this.adapter.invalidateCache(`object:${e}`)}static diffObjects(e,t){let n=new Map(e.map(e=>[e.id,e])),r=new Map(t.map(e=>[e.id,e]));for(let[e,t]of r)if(!n.has(e))return{type:`create`,object:t};for(let[e,t]of n)if(!r.has(e))return{type:`delete`,object:t};for(let[e,t]of r){let r=n.get(e);if(r&&JSON.stringify(r)!==JSON.stringify(t))return{type:`update`,object:t}}return null}static diffFields(e,t){let n=new Map(e.map(e=>[e.id,e])),r=new Map(t.map(e=>[e.id,e]));for(let[e,t]of r)if(!n.has(e))return{type:`create`,field:t};for(let[e,t]of n)if(!r.has(e))return{type:`delete`,field:t};for(let[e,t]of r){let r=n.get(e);if(r&&JSON.stringify(r)!==JSON.stringify(t))return{type:`update`,field:t}}return null}};function qr({schema:e}){let t=e.objectName,{objects:n,refresh:r}=w(),i=Xe(),a=(0,K.useMemo)(()=>(n||[]).find(e=>e.name===t),[n,t]),o=(0,K.useMemo)(()=>a?(Array.isArray(a.fields)?a.fields:Object.values(a.fields||{})).map(Fr):[],[a]),[s,c]=(0,K.useState)(null),[l,u]=(0,K.useState)(!1),d=s??o,f=(0,K.useRef)(d),p=(0,K.useCallback)(async e=>{let n=f.current;if(c(e),f.current=e,!i){z.error(`Service unavailable — changes saved locally only`);return}let a=Kr.diffFields(n,e),o=a?a.type===`create`?`Field "${a.field.label||a.field.name}" created`:a.type===`update`?`Field "${a.field.label||a.field.name}" updated`:`Field "${a.field.label||a.field.name}" deleted`:`Field configuration updated`;u(!0);try{await i.saveFields(t,e),await r(),z.success(o)}catch(e){c(n),f.current=n,z.error(e?.message||`Failed to save field changes`)}finally{u(!1)}},[i,t,r]);return(0,q.jsxs)(`div`,{className:`space-y-3`,"data-testid":`field-management-section`,children:[l&&(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`field-saving-indicator`,children:[(0,q.jsx)(k,{className:`h-4 w-4 animate-spin`}),`Saving field changes…`]}),d.some(e=>e.isSystem)&&(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground bg-muted/50 rounded-md px-3 py-2`,"data-testid":`system-field-hint`,children:[(0,q.jsx)(de,{className:`h-3.5 w-3.5 shrink-0`}),`System fields (e.g. id, createdAt, updatedAt) are read-only and cannot be edited or deleted.`]}),(0,q.jsx)(At,{objectName:t,fields:d,onFieldsChange:p})]})}function Jr({schema:e}){let t=e.objectName,[n,r]=(0,K.useState)(`details`),i={type:`object-properties`,id:`${t}-properties`,objectName:t},a={type:`object-field-designer`,id:`${t}-field-designer`,objectName:t},o={type:`object-relationships`,id:`${t}-relationships`,objectName:t},s={type:`object-keys`,id:`${t}-keys`,objectName:t},c={type:`object-data-experience`,id:`${t}-data-experience`,objectName:t},l={type:`object-data-preview`,id:`${t}-data-preview`,objectName:t};return(0,q.jsx)(`div`,{className:`w-full`,"data-testid":`object-detail-tabs`,children:(0,q.jsxs)(Ie,{value:n,onValueChange:r,className:`w-full`,children:[(0,q.jsxs)(De,{className:`w-full justify-start border-b rounded-none bg-transparent p-0 h-auto`,children:[(0,q.jsxs)(F,{value:`details`,className:`relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:shadow-none`,children:[(0,q.jsx)(je,{className:`h-4 w-4 mr-2`}),`详情`]}),(0,q.jsxs)(F,{value:`fields`,className:`relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:shadow-none`,children:[(0,q.jsx)(Pe,{className:`h-4 w-4 mr-2`}),`字段`]}),(0,q.jsxs)(F,{value:`relationships`,className:`relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:shadow-none`,children:[(0,q.jsx)(ye,{className:`h-4 w-4 mr-2`}),`关联关系`]}),(0,q.jsxs)(F,{value:`data`,className:`relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:shadow-none`,children:[(0,q.jsx)(we,{className:`h-4 w-4 mr-2`}),`数据`]})]}),(0,q.jsx)(Ee,{value:`details`,className:`mt-6`,children:(0,q.jsx)(`div`,{className:`space-y-6`,children:(0,q.jsx)(T,{schema:i})})}),(0,q.jsx)(Ee,{value:`fields`,className:`mt-6`,children:(0,q.jsx)(`div`,{className:`space-y-6`,children:(0,q.jsx)(T,{schema:a})})}),(0,q.jsx)(Ee,{value:`relationships`,className:`mt-6`,children:(0,q.jsxs)(`div`,{className:`space-y-6`,children:[(0,q.jsx)(T,{schema:o}),(0,q.jsx)(T,{schema:s})]})}),(0,q.jsx)(Ee,{value:`data`,className:`mt-6`,children:(0,q.jsxs)(`div`,{className:`space-y-6`,children:[(0,q.jsx)(T,{schema:l}),(0,q.jsx)(T,{schema:c})]})})]})})}var $={namespace:`console`,category:`system`};E.register(`object-detail-tabs`,Jr,{...$,label:`Object Detail Tabs`,icon:`LayoutDashboard`}),E.register(`object-properties`,Rr,{...$,label:`Object Properties`,icon:`Settings2`}),E.register(`object-relationships`,Br,{...$,label:`Object Relationships`,icon:`Link2`}),E.register(`object-keys`,Vr,{...$,label:`Object Keys`,icon:`KeyRound`}),E.register(`object-data-experience`,Hr,{...$,label:`Data Experience`,icon:`LayoutList`}),E.register(`object-data-preview`,Ur,{...$,label:`Data Preview`,icon:`Table`}),E.register(`object-field-designer`,qr,{...$,label:`Field Designer`,icon:`Columns`});var Yr=(0,K.lazy)(()=>s(()=>import(`./ApiConsolePage-_wjPZg_8.js`).then(e=>({default:e.ApiConsolePage})),__vite__mapDeps([0,1]),import.meta.url)),Xr=(0,K.lazy)(()=>s(()=>import(`./FlowRunsPage-Of98wriv.js`).then(e=>({default:e.FlowRunsPage})),__vite__mapDeps([0,1]),import.meta.url)),Zr=(0,K.lazy)(()=>s(()=>import(`./PublicFormsPage-CI1LZQKt.js`).then(e=>({default:e.PublicFormsPage})),__vite__mapDeps([0,1]),import.meta.url));function Qr({label:e}){return(0,q.jsxs)(`div`,{className:`p-6 text-sm text-muted-foreground`,children:[`Loading `,e,`…`]})}H({ref:`developer:api-console`,label:`API Console`,source:`@object-ui/console`,component:e=>(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(Qr,{label:`API console`}),children:(0,q.jsx)(Yr,{...e})})}),H({ref:`developer:flow-runs`,label:`Flow Runs`,source:`@object-ui/console`,component:e=>(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(Qr,{label:`flow runs`}),children:(0,q.jsx)(Xr,{...e})})}),H({ref:`developer:public-forms`,label:`Public Forms`,source:`@object-ui/console`,component:e=>(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(Qr,{label:`public forms`}),children:(0,q.jsx)(Zr,{...e})})});var $r=(0,K.lazy)(()=>s(()=>import(`./src-DD4w6yW2.js`).then(e=>e.t).then(e=>({default:e.BuilderLanding})),__vite__mapDeps([0,1]),import.meta.url));H({ref:`studio:builder`,label:`应用构建`,source:`@object-ui/console`,component:e=>(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(`div`,{className:`p-6 text-sm text-muted-foreground`,children:`加载应用构建器…`}),children:(0,q.jsx)($r,{...e})})});var ei=(0,K.lazy)(()=>s(()=>import(`./ProfilePage--OycjBXX.js`).then(e=>({default:e.ProfilePage})),__vite__mapDeps([0]),import.meta.url));function ti(){let{t:e}=D();return(0,q.jsx)(`div`,{className:`p-6 text-sm text-muted-foreground`,children:e(`common.loading`,{defaultValue:`Loading...`})})}H({ref:`account:profile_card`,label:`My Profile`,source:`@object-ui/console`,component:e=>(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(ti,{}),children:(0,q.jsx)(ei,{...e})})});var ni=`/api/v1/auth`;nt(),E.registerLazy(`object-map`,()=>s(()=>import(`./plugin-map-Bamjhlg6.js`).then(e=>e.t),__vite__mapDeps([0,2]),import.meta.url),{namespace:`plugin-map`,category:`view`}),E.registerLazy(`map`,()=>s(()=>import(`./plugin-map-Bamjhlg6.js`).then(e=>e.t),__vite__mapDeps([0,2]),import.meta.url),{namespace:`view`,category:`view`}),E.registerLazy(`object-tree`,()=>s(()=>import(`./plugin-tree-BDrBkDUi.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`plugin-tree`,category:`view`}),E.registerLazy(`tree`,()=>s(()=>import(`./plugin-tree-BDrBkDUi.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`view`,category:`view`});for(let e of[`dashboard`,`metric`,`metric-card`,`object-metric`,`pivot`,`object-pivot`,`dashboard-grid`,`object-data-table`])E.registerLazy(e,()=>s(()=>import(`./plugin-dashboard-BMm8A0um.js`).then(e=>e.t),__vite__mapDeps([0,1]),import.meta.url),{namespace:`plugin-dashboard`,category:`view`});E.registerLazy(`chart`,()=>s(()=>import(`./plugin-charts-C4pZYso-.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`plugin-charts`,category:`chart`});for(let e of[`object-chart`,`bar-chart`,`pie-chart`,`donut-chart`,`radar-chart`,`scatter-chart`,`line-chart`,`area-chart`,`advanced-chart`,`chart:bar`])E.registerLazy(e,()=>s(()=>import(`./plugin-charts-C4pZYso-.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`plugin-charts`,category:`chart`});E.registerLazy(`object-gantt`,()=>s(()=>import(`./plugin-gantt-Bdm-Yvii.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`plugin-gantt`,category:`view`}),E.registerLazy(`gantt`,()=>s(()=>import(`./plugin-gantt-Bdm-Yvii.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`view`,category:`view`}),E.registerLazy(`markdown`,()=>s(()=>import(`./plugin-markdown-Cg477jm9.js`).then(e=>e.n),__vite__mapDeps([0]),import.meta.url),{namespace:`plugin-markdown`,category:`display`}),E.registerLazy(`object-timeline`,()=>s(()=>import(`./plugin-timeline-C9C1_Un7.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`plugin-timeline`,category:`view`}),E.registerLazy(`timeline`,()=>s(()=>import(`./plugin-timeline-C9C1_Un7.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`view`,category:`view`}),E.registerLazy(`object-calendar`,()=>s(()=>import(`./plugin-calendar-C5OJe0lx.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`plugin-calendar`,category:`view`}),E.registerLazy(`calendar`,()=>s(()=>import(`./plugin-calendar-C5OJe0lx.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`view`,category:`view`}),E.registerLazy(`calendar-view`,()=>s(()=>import(`./plugin-calendar-C5OJe0lx.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`plugin-calendar`,category:`view`}),E.registerLazy(`object-kanban`,()=>s(()=>import(`./plugin-kanban-BN37MzOm.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`plugin-kanban`,category:`view`}),E.registerLazy(`kanban`,()=>s(()=>import(`./plugin-kanban-BN37MzOm.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`view`,category:`view`});for(let e of[`kanban-ui`,`kanban-enhanced`])E.registerLazy(e,()=>s(()=>import(`./plugin-kanban-BN37MzOm.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`plugin-kanban`,category:`view`});E.registerLazy(`report`,()=>s(()=>import(`./plugin-report-9ivqW5g0.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`plugin-report`,category:`view`});for(let e of[`report-viewer`,`spec-report`])E.registerLazy(e,()=>s(()=>import(`./plugin-report-9ivqW5g0.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`plugin-report`,category:`view`});pe();var ri=``.replace(/\/+$/,``);Promise.all([pt(ri),Nr(ni)]).finally(()=>{document.title=V();let e=ht();if(e){let t=document.getElementById(`favicon`);t&&(t.href=e,t.type=e.endsWith(`.svg`)?`image/svg+xml`:`image/png`)}let t=vt({enabled:!0,name:V(),shortName:gt(),description:mt(),themeColor:ft(),backgroundColor:`#ffffff`,display:`standalone`,startUrl:`./`,scope:`./`,orientation:`any`,icons:[{src:e||`./favicon.svg`,sizes:`any`,type:`image/svg+xml`,purpose:`any`}]}),n=new Blob([JSON.stringify(t)],{type:`application/json`}),r=URL.createObjectURL(n),i=document.querySelector(`link[rel="manifest"]`);i&&i.remove();let a=document.createElement(`link`);a.rel=`manifest`,a.href=r,document.head.appendChild(a),jt.createRoot(document.getElementById(`root`)).render((0,q.jsx)(K.StrictMode,{children:(0,q.jsx)(bt,{pwa:{enabled:!0,name:V(),shortName:gt()},children:(0,q.jsx)(ie,{loadLanguage:Ar,children:(0,q.jsx)(kr,{})})})}))});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk-KEIR6QF5-DtEGfq38.js";import{n as e}from"./chunk-BIQX33UG-_A6SWMTr.js";export{e as createInfoServices};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{t}from"./src-CKPhOIOh.js";import{c as n}from"./chunk-WYO6CB5R-C0_XZtpj.js";import{t as r}from"./chunk-VAUOI2AC-HYDQgaka.js";import{n as i}from"./mermaid-parser.core-B2-C9kB8.js";var a={parse:e(async e=>{let n=await i(`info`,e);t.debug(n)},`parse`)},o={version:`11.16.0`},s={parser:a,db:{getVersion:e(()=>o.version,`getVersion`)},renderer:{draw:e((e,i,a)=>{t.debug(`rendering info diagram
|
|
2
|
+
`+e);let o=r(i);n(o,100,400,!0),o.append(`g`).append(`text`).attr(`x`,100).attr(`y`,40).attr(`class`,`version`).attr(`font-size`,32).style(`text-anchor`,`middle`).text(`v${a}`)},`draw`)}};export{s as diagram};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{r as t,y as n}from"./vendor-react-BKSb6vFP.js";var r=e(n(),1),i=new Set,a={emit(e){for(let t of Array.from(i))try{t(e)}catch{}},subscribe(e){return i.add(e),()=>{i.delete(e)}}};function o(e,t){if(e!==403||!t||typeof t!=`object`)return null;let n=t.error;if(!n||typeof n!=`object`)return null;let r=n.code;if(r===`MFA_REQUIRED`||r===`PASSWORD_EXPIRED`){let e=n.message;return{code:r,message:typeof e==`string`?e:``}}return null}var s=(0,r.createContext)(null);s.displayName=`AuthContext`;var c=`1.6.23`,l=Symbol.for(`better-auth:broadcast-channel`),u=()=>Math.floor(Date.now()/1e3),d=class{listeners=new Set;name;constructor(e=`better-auth.message`){this.name=e}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}post(e){if(!(typeof window>`u`))try{localStorage.setItem(this.name,JSON.stringify({...e,timestamp:u()}))}catch{}}setup(){if(typeof window>`u`||window.addEventListener===void 0)return()=>{};let e=e=>{if(e.key!==this.name)return;let t=JSON.parse(e.newValue??`{}`);t?.event!==`session`||!t?.data||this.listeners.forEach(e=>e(t))};return window.addEventListener(`storage`,e),()=>{window.removeEventListener(`storage`,e)}}};function f(e=`better-auth.message`){return globalThis[l]||(globalThis[l]=new d(e)),globalThis[l]}var p=[],m=0,h=null,g=4,_=globalThis.nanostoresGlobal||={epoch:0},v=()=>{for(m=0;m<p.length;m+=g)p[m](p[m+1].value,p[m+2],p[m+3]);p.length=0},y=e=>{let t=[],n={get(){return n.lc||n.listen(()=>{})(),n.value},init:e,lc:0,listen(e){return n.lc=t.push(e),()=>{for(let t=m+g;t<p.length;)p[t]===e?p.splice(t,g):t+=g;let r=t.indexOf(e);~r&&(t.splice(r,1),--n.lc||n.off())}},notify(e,r){_.epoch++;let i=!p.length&&!0;for(let i of t)h?.has(i)||(h?.add(i),p.push(i,n,e,r));i&&v()},off(){},set(e){let t=n.value;t!==e&&(n.value=e,n.notify(t))},subscribe(e){let t=n.listen(e);return e(n.value),t},value:e};return n},b=2,ee=5,x=6,S=10,te=(e,t,n,r)=>(e.events=e.events||{},e.events[n+S]||(e.events[n+S]=r(t=>{e.events[n].reduceRight((e,t)=>(t(e),e),{shared:{},...t})})),e.events[n]=e.events[n]||[],e.events[n].push(t),()=>{let r=e.events[n],i=r.indexOf(t);r.splice(i,1),r.length||(delete e.events[n],e.events[n+S](),delete e.events[n+S])}),C=(e,t)=>te(e,t,b,t=>{let n=e.set,r=e.setKey;return e.setKey&&=(n,i)=>{let a;if(t({abort:()=>{a=!0},changed:n,newValue:{...e.value,[n]:i}}),!a)return r(n,i)},e.set=e=>{let r;if(t({abort:()=>{r=!0},newValue:e}),!r)return n(e)},()=>{e.set=n,e.setKey=r}}),w=1e3,ne=(e,t)=>te(e,n=>{let r=t(n);r&&e.events[x].push(r)},ee,t=>{let n=e.listen;e.listen=(...r)=>(!e.lc&&!e.active&&(e.active=!0,t()),n(...r));let r=e.off;return e.events[x]=[],e.off=()=>{r(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let t of e.events[x])t();e.events[x]=[]}},w)},()=>{e.listen=n,e.off=r}});function T(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function E(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!E(e[n],t[n]))return!1;return!0}if(T(e)&&T(t)){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!(r in t)||!E(e[r],t[r]))return!1;return!0}return!1}function D(e,t){return C(e,({newValue:n,abort:r})=>{t(e.value,n)&&r()})}var O=Symbol.for(`better-auth:focus-manager`),k=class{listeners=new Set;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setFocused(e){this.listeners.forEach(t=>t(e))}setup(){if(typeof window>`u`||typeof document>`u`||window.addEventListener===void 0)return()=>{};let e=()=>{document.visibilityState===`visible`&&this.setFocused(!0)};return document.addEventListener(`visibilitychange`,e,!1),()=>{document.removeEventListener(`visibilitychange`,e,!1)}}};function re(){return globalThis[O]||(globalThis[O]=new k),globalThis[O]}var A=Symbol.for(`better-auth:online-manager`),j=class{listeners=new Set;isOnline=typeof navigator<`u`?navigator.onLine:!0;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setOnline(e){this.isOnline=e,this.listeners.forEach(t=>t(e))}setup(){if(typeof window>`u`||window.addEventListener===void 0)return()=>{};let e=()=>this.setOnline(!0),t=()=>this.setOnline(!1);return window.addEventListener(`online`,e,!1),window.addEventListener(`offline`,t,!1),()=>{window.removeEventListener(`online`,e,!1),window.removeEventListener(`offline`,t,!1)}}};function M(){return globalThis[A]||(globalThis[A]=new j),globalThis[A]}var ie={proto:/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,constructor:/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,protoShort:/"__proto__"\s*:/,constructorShort:/"constructor"\s*:/},N=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,P={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:1/0,"-infinity":-1/0},F=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function I(e){return e instanceof Date&&!isNaN(e.getTime())}function ae(e){let t=F.exec(e);if(!t)return null;let[,n,r,i,a,o,s,c,l,u,d]=t,f=new Date(Date.UTC(parseInt(n,10),parseInt(r,10)-1,parseInt(i,10),parseInt(a,10),parseInt(o,10),parseInt(s,10),c?parseInt(c.padEnd(3,`0`),10):0));if(l){let e=(parseInt(u,10)*60+parseInt(d,10))*(l===`+`?-1:1);f.setUTCMinutes(f.getUTCMinutes()+e)}return I(f)?f:null}function oe(e,t={}){let{strict:n=!1,warnings:r=!1,reviver:i,parseDates:a=!0}=t;if(typeof e!=`string`)return e;let o=e.trim(),s=o.toLowerCase();if(s.length<=9&&s in P)return P[s];if(!N.test(o)){if(n)throw SyntaxError(`[better-json] Invalid JSON`);return e}if(Object.entries(ie).some(([e,t])=>{let n=t.test(o);return n&&r&&console.warn(`[better-json] Detected potential prototype pollution attempt using ${e} pattern`),n})&&n)throw Error(`[better-json] Potential prototype pollution attempt detected`);try{return JSON.parse(o,(e,t)=>{if(e===`__proto__`||e===`constructor`&&t&&typeof t==`object`&&`prototype`in t){r&&console.warn(`[better-json] Dropping "${e}" key to prevent prototype pollution`);return}if(a&&typeof t==`string`){let e=ae(t);if(e)return e}return i?i(e,t):t})}catch(t){if(n)throw t;return e}}function L(e,t={strict:!0}){return oe(e,t)}var se=()=>typeof window>`u`;function ce(e,t){return E(e.data,t.data)&&e.error===t.error&&e.isPending===t.isPending&&e.isRefetching===t.isRefetching&&e.refetch===t.refetch}var R=(e,t,n,r)=>{let i=y({data:null,error:null,isPending:!0,isRefetching:!1,refetch:e=>a(e)});D(i,ce);let a=async e=>new Promise(a=>{let o=typeof r==`function`?r({data:i.get().data,error:i.get().error,isPending:i.get().isPending}):r;n(t,{...o,query:{...o?.query,...e?.query},async onSuccess(e){let t=i.get(),n=t.data!=null&&e.data!=null&&E(t.data,e.data)?t.data:e.data;i.set({data:n,error:null,isPending:!1,isRefetching:!1,refetch:i.value.refetch}),await o?.onSuccess?.(e)},async onError(e){let{request:t}=e,n=typeof t.retry==`number`?t.retry:t.retry?.attempts,r=t.retryAttempt||0;if(n&&r<n)return;let a=e.error.status===401;i.set({error:e.error,data:a?null:i.get().data,isPending:!1,isRefetching:!1,refetch:i.value.refetch}),await o?.onError?.(e)},async onRequest(e){let t=i.get();i.set({isPending:t.data===null,data:t.data,error:null,isRefetching:!0,refetch:i.value.refetch}),await o?.onRequest?.(e)}}).catch(e=>{i.set({error:e,data:i.get().data,isPending:!1,isRefetching:!1,refetch:i.value.refetch})}).finally(()=>{a(void 0)})});e=Array.isArray(e)?e:[e];let o=!1,s=[];for(let t of e){let e=t.subscribe(async()=>{se()||(o?await a():ne(i,()=>{let e=setTimeout(async()=>{o||(o=!0,await a())},0);return()=>{for(let e of s)e();clearTimeout(e)}}))});s.push(e)}return i},z=()=>Math.floor(Date.now()/1e3),B=5;function le(e){let{fetchSession:t,shouldPollSession:n=()=>!0,sessionSignal:r,options:i={}}=e,a=i.sessionOptions?.refetchInterval??0,o=i.sessionOptions?.refetchOnWindowFocus??!0,s=i.sessionOptions?.refetchWhenOffline??!1,c={isInitialized:!1,lastSessionRequest:0},l=()=>s||M().isOnline,u=e=>{if(l()){if(e?.event===`storage`){t();return}if(e?.event===`poll`){c.lastSessionRequest=z(),t();return}if(e?.event===`visibilitychange`){if(z()-c.lastSessionRequest<B)return;c.lastSessionRequest=z(),t();return}t()}},d=e=>{f().post({event:`session`,data:{trigger:e},clientId:Math.random().toString(36).substring(7)})},p=()=>{a&&a>0&&(c.pollInterval=setInterval(()=>{n()&&u({event:`poll`})},a*1e3))},m=()=>{c.unsubscribeBroadcast=f().subscribe(()=>{u({event:`storage`})})},h=()=>{o&&(c.unsubscribeFocus=re().subscribe(()=>{u({event:`visibilitychange`})}))},g=()=>{c.unsubscribeOnline=M().subscribe(e=>{e&&u({event:`visibilitychange`})})},_=()=>{c.unsubscribeSignal=r.listen(()=>{t()})};return{init:()=>{c.isInitialized||(c.isInitialized=!0,p(),m(),h(),g(),_(),c.cleanupBroadcastSetup=f().setup(),c.cleanupFocusSetup=re().setup(),c.cleanupOnlineSetup=M().setup())},cleanup:()=>{c.isInitialized&&(c.pollInterval&&=(clearInterval(c.pollInterval),void 0),c.unsubscribeBroadcast&&=(c.unsubscribeBroadcast(),void 0),c.unsubscribeFocus&&=(c.unsubscribeFocus(),void 0),c.unsubscribeOnline&&=(c.unsubscribeOnline(),void 0),c.unsubscribeSignal&&=(c.unsubscribeSignal(),void 0),c.cleanupBroadcastSetup&&=(c.cleanupBroadcastSetup(),void 0),c.cleanupFocusSetup&&=(c.cleanupFocusSetup(),void 0),c.cleanupOnlineSetup&&=(c.cleanupOnlineSetup(),void 0),c.isInitialized=!1,c.lastSessionRequest=0)},triggerRefetch:u,broadcastSessionUpdate:d}}var V=Object.create(null),H=e=>({}),U=new Proxy(V,{get(e,t){return H()[t]??V[t]},has(e,t){return t in H()||t in V},set(e,t,n){let r=H(!0);return r[t]=n,!0},deleteProperty(e,t){if(!t)return!1;let n=H(!0);return delete n[t],!0},ownKeys(){let e=H(!0);return Object.keys(e)}});U.NODE_ENV;function W(e,t){return typeof process<`u`?{}[e]??t:typeof Deno<`u`?Deno.env.get(e)??t:typeof Bun<`u`?Bun.env[e]??t:t}Object.freeze({get BETTER_AUTH_SECRET(){return W(`BETTER_AUTH_SECRET`)},get AUTH_SECRET(){return W(`AUTH_SECRET`)},get BETTER_AUTH_TELEMETRY(){return W(`BETTER_AUTH_TELEMETRY`)},get BETTER_AUTH_TELEMETRY_ID(){return W(`BETTER_AUTH_TELEMETRY_ID`)},get NODE_ENV(){return W(`NODE_ENV`,`development`)},get PACKAGE_VERSION(){return W(`PACKAGE_VERSION`,`0.0.0`)},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return W(`BETTER_AUTH_TELEMETRY_ENDPOINT`,``)}});function ue(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,{code:e,message:t,toString:()=>e}]))}function de(){let e=Object.getOwnPropertyDescriptor(Error,`stackTraceLimit`);return e===void 0?Object.isExtensible(Error):Object.prototype.hasOwnProperty.call(e,`writable`)?e.writable:e.set!==void 0}function fe(e){let t=e.split(`
|
|
2
|
+
at `);return t.length<=1?e:(t.splice(1,1),t.join(`
|
|
3
|
+
at `))}function pe(e,t){class n extends e{#e;constructor(...e){if(de()){let t=Error.stackTraceLimit;Error.stackTraceLimit=0,super(...e),Error.stackTraceLimit=t}else super(...e);let t=Error().stack;t&&(this.#e=fe(t.replace(/^Error/,this.name)))}get errorStack(){return this.#e}}return Object.defineProperty(n.prototype,"constructor",{get(){return t},enumerable:!1,configurable:!0}),n}var me={OK:200,CREATED:201,ACCEPTED:202,NO_CONTENT:204,MULTIPLE_CHOICES:300,MOVED_PERMANENTLY:301,FOUND:302,SEE_OTHER:303,NOT_MODIFIED:304,TEMPORARY_REDIRECT:307,BAD_REQUEST:400,UNAUTHORIZED:401,PAYMENT_REQUIRED:402,FORBIDDEN:403,NOT_FOUND:404,METHOD_NOT_ALLOWED:405,NOT_ACCEPTABLE:406,PROXY_AUTHENTICATION_REQUIRED:407,REQUEST_TIMEOUT:408,CONFLICT:409,GONE:410,LENGTH_REQUIRED:411,PRECONDITION_FAILED:412,PAYLOAD_TOO_LARGE:413,URI_TOO_LONG:414,UNSUPPORTED_MEDIA_TYPE:415,RANGE_NOT_SATISFIABLE:416,EXPECTATION_FAILED:417,"I'M_A_TEAPOT":418,MISDIRECTED_REQUEST:421,UNPROCESSABLE_ENTITY:422,LOCKED:423,FAILED_DEPENDENCY:424,TOO_EARLY:425,UPGRADE_REQUIRED:426,PRECONDITION_REQUIRED:428,TOO_MANY_REQUESTS:429,REQUEST_HEADER_FIELDS_TOO_LARGE:431,UNAVAILABLE_FOR_LEGAL_REASONS:451,INTERNAL_SERVER_ERROR:500,NOT_IMPLEMENTED:501,BAD_GATEWAY:502,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504,HTTP_VERSION_NOT_SUPPORTED:505,VARIANT_ALSO_NEGOTIATES:506,INSUFFICIENT_STORAGE:507,LOOP_DETECTED:508,NOT_EXTENDED:510,NETWORK_AUTHENTICATION_REQUIRED:511};pe(class extends Error{constructor(e=`INTERNAL_SERVER_ERROR`,t=void 0,n={},r=typeof e==`number`?e:me[e]){super(t?.message,t?.cause?{cause:t.cause}:void 0),this.status=e,this.body=t,this.headers=n,this.statusCode=r,this.name=`APIError`,this.status=e,this.headers=n,this.statusCode=r,this.body=t}},Error);var G=class extends Error{constructor(e,t){super(e,t),this.name=`BetterAuthError`,this.message=e,this.stack=``}},he=47;function ge(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===he;)t--;return t===e.length?e:e.slice(0,t)}function _e(e){try{return(ge(new URL(e).pathname)||`/`)!==`/`}catch{throw new G(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}function ve(e){try{let t=new URL(e);if(t.protocol!==`http:`&&t.protocol!==`https:`)throw new G(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){throw t instanceof G?t:new G(`Invalid base URL: ${e}. Please provide a valid base URL.`,{cause:t})}}function K(e,t=`/api/auth`){if(ve(e),_e(e))return e;let n=ge(e);return!t||t===`/`?n:(t=t.startsWith(`/`)?t:`/${t}`,`${n}${t}`)}function ye(e,t){return!e||e.trim()===``?!1:t===`proto`?e===`http`||e===`https`:t===`host`?[/\.\./,/\0/,/[\s]/,/^[.]/,/[<>'"]/,/javascript:/i,/file:/i,/data:/i].some(t=>t.test(e))?!1:/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*(:[0-9]{1,5})?$/.test(e)||/^(\d{1,3}\.){3}\d{1,3}(:[0-9]{1,5})?$/.test(e)||/^\[[0-9a-fA-F:]+\](:[0-9]{1,5})?$/.test(e)||/^localhost(:[0-9]{1,5})?$/i.test(e):!1}function be(e,t,n,r,i){if(e)return K(e,t);if(r!==!1){let e=U.BETTER_AUTH_URL||U.NEXT_PUBLIC_BETTER_AUTH_URL||U.PUBLIC_BETTER_AUTH_URL||U.NUXT_PUBLIC_BETTER_AUTH_URL||U.NUXT_PUBLIC_AUTH_URL||(U.BASE_URL===`/`?void 0:U.BASE_URL);if(e)return K(e,t)}let a=n?.headers.get(`x-forwarded-host`),o=n?.headers.get(`x-forwarded-proto`);if(a&&o&&i&&ye(o,`proto`)&&ye(a,`host`))try{return K(`${o}://${a}`,t)}catch{}if(n){let e=xe(n.url);if(!e)throw new G(`Could not get origin from request. Please provide a valid base URL.`);return K(e,t)}if(typeof window<`u`&&window.location)return K(window.location.origin,t)}function xe(e){try{let t=new URL(e);return t.origin===`null`?null:t.origin}catch{return null}}var Se=[`javascript:`,`data:`,`vbscript:`];function Ce(e){let t;try{t=new URL(e)}catch{return!0}return!Se.includes(t.protocol)}var we={id:`redirect`,name:`Redirect`,hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&Ce(e.data.url)&&typeof window<`u`&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}},Te=()=>typeof window>`u`;function Ee(e){return typeof e==`object`&&e&&`data`in e&&`error`in e?e:{data:e,error:null}}function De(e){return!e||e.session===null&&e.user===null?null:e}function Oe(e,t){return E(e.data,t.data)&&e.error===t.error&&e.isPending===t.isPending&&e.isRefetching===t.isRefetching&&e.refetch===t.refetch}function ke(e,t){let n=y(!1),r,i=e=>s(e),a=y({data:null,error:null,isPending:!0,isRefetching:!1,refetch:i});D(a,Oe);let o=e=>{if(r!==e)return;let t=a.get();r=void 0,!(!t.isPending&&!t.isRefetching)&&a.set({...t,isPending:!1,isRefetching:!1,refetch:i})},s=async t=>{r?.abort();let n=new AbortController;r=n;let s=a.get();a.set({...s,isPending:s.data===null,isRefetching:!0,error:null,refetch:i});try{let r=await e(`/get-session`,{method:`GET`,query:t?.query,signal:n.signal});if(n.signal.aborted){o(n);return}let{data:s,error:c}=Ee(r);if(s?.needsRefresh)try{let t=await e(`/get-session`,{method:`POST`,signal:n.signal});if(n.signal.aborted){o(n);return}({data:s,error:c}=Ee(t))}catch{if(n.signal.aborted){o(n);return}}if(c){let e=a.get(),t=c?.status===401;a.set({data:t?null:e.data,error:c,isPending:!1,isRefetching:!1,refetch:i});return}let l=De(s),u=a.get(),d=u.data!=null&&l!=null&&E(u.data,l)?u.data:l;a.set({data:d,error:null,isPending:!1,isRefetching:!1,refetch:i})}catch(e){if(n.signal.aborted){o(n);return}let t=a.get();a.set({data:t.data,error:e,isPending:!1,isRefetching:!1,refetch:i})}},c=()=>{};return ne(a,()=>{let e;Te()||(e=setTimeout(()=>{s()},0));let i=le({fetchSession:s,shouldPollSession:()=>a.get().data!=null,sessionSignal:n,options:t});return i.init(),c=i.broadcastSessionUpdate,()=>{e&&clearTimeout(e);let t=r;t?.abort(),t&&o(t),i.cleanup()}}),{session:a,$sessionSignal:n,broadcastSessionUpdate:e=>c(e)}}function Ae(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)===`[object Module]`:!0}function je(e,t,n=`.`,r){if(!Ae(t))return je(e,{},n,r);let i={...t};for(let t of Object.keys(e)){if(t===`__proto__`||t===`constructor`)continue;let a=e[t];a!=null&&(r&&r(i,t,a,n)||(Array.isArray(a)&&Array.isArray(i[t])?i[t]=[...a,...i[t]]:Ae(a)&&Ae(i[t])?i[t]=je(a,i[t],(n?`${n}.`:``)+t.toString(),r):i[t]=a))}return i}function Me(e){return(...t)=>t.reduce((t,n)=>je(t,n,``,e),{})}var Ne=Me(),Pe=Object.defineProperty,Fe=Object.defineProperties,Ie=Object.getOwnPropertyDescriptors,Le=Object.getOwnPropertySymbols,Re=Object.prototype.hasOwnProperty,ze=Object.prototype.propertyIsEnumerable,Be=(e,t,n)=>t in e?Pe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,q=(e,t)=>{for(var n in t||={})Re.call(t,n)&&Be(e,n,t[n]);if(Le)for(var n of Le(t))ze.call(t,n)&&Be(e,n,t[n]);return e},J=(e,t)=>Fe(e,Ie(t)),Ve=class extends Error{constructor(e,t,n){super(t||e.toString(),{cause:n}),this.status=e,this.statusText=t,this.error=n,Error.captureStackTrace(this,this.constructor)}},He=async(e,t)=>{let n=t||{},r={onRequest:[t?.onRequest],onResponse:[t?.onResponse],onSuccess:[t?.onSuccess],onError:[t?.onError],onRetry:[t?.onRetry]};if(!t||!t?.plugins)return{url:e,options:n,hooks:r};for(let i of t?.plugins||[]){if(i.init){let r=await i.init?.call(i,e.toString(),t);n=r.options||n,e=r.url}r.onRequest.push(i.hooks?.onRequest),r.onResponse.push(i.hooks?.onResponse),r.onSuccess.push(i.hooks?.onSuccess),r.onError.push(i.hooks?.onError),r.onRetry.push(i.hooks?.onRetry)}return{url:e,options:n,hooks:r}},Ue=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(){return this.options.delay}},We=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(e){return Math.min(this.options.maxDelay,this.options.baseDelay*2**e)}};function Ge(e){if(typeof e==`number`)return new Ue({type:`linear`,attempts:e,delay:1e3});switch(e.type){case`linear`:return new Ue(e);case`exponential`:return new We(e);default:throw Error(`Invalid retry strategy`)}}var Ke=async e=>{let t={},n=async e=>typeof e==`function`?await e():e;if(e?.auth){if(e.auth.type===`Bearer`){let r=await n(e.auth.token);if(!r)return t;t.authorization=`Bearer ${r}`}else if(e.auth.type===`Basic`){let[r,i]=await Promise.all([n(e.auth.username),n(e.auth.password)]);if(!r||!i)return t;t.authorization=`Basic ${btoa(`${r}:${i}`)}`}else if(e.auth.type===`Custom`){let[r,i]=await Promise.all([n(e.auth.prefix),n(e.auth.value)]);if(!i)return t;t.authorization=`${r??``} ${i}`}}return t},qe=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function Je(e){let t=e.headers.get(`content-type`),n=new Set([`image/svg`,`application/xml`,`application/xhtml`,`application/html`]);if(!t)return`json`;let r=t.split(`;`).shift()||``;return qe.test(r)?`json`:n.has(r)||r.startsWith(`text/`)?`text`:`blob`}function Ye(e){try{return JSON.parse(e),!0}catch{return!1}}function Xe(e){if(e===void 0)return!1;let t=typeof e;return t===`string`||t===`number`||t===`boolean`||t===null?!0:t===`object`?Array.isArray(e)?!0:e.buffer?!1:e.constructor&&e.constructor.name===`Object`||typeof e.toJSON==`function`:!1}function Ze(e){try{return JSON.parse(e)}catch{return e}}function Qe(e){return typeof e==`function`}function $e(e){if(e?.customFetchImpl)return e.customFetchImpl;if(typeof globalThis<`u`&&Qe(globalThis.fetch))return globalThis.fetch;if(typeof window<`u`&&Qe(window.fetch))return window.fetch;throw Error(`No fetch implementation found`)}function et(...e){let t={};for(let n of e)if(n)if(n instanceof Headers)n.forEach((e,n)=>{t[n]=e});else{let e=Array.isArray(n)?n:Object.entries(n);for(let[n,r]of e)r!=null&&(t[n]=r)}return t}async function tt(e){let t=new Headers(et(e?.headers,await Ke(e)));if(!t.has(`content-type`)){let n=nt(e?.body);n&&t.set(`content-type`,n)}return t}function nt(e){return Xe(e)?`application/json`:null}function rt(e){let t=e.get(`content-type`);return t?t.split(`;`)[0].trim().toLowerCase():null}function it(e,t){let{body:n}=e;return n?!Xe(n)||typeof n==`string`?n:rt(t)===`application/x-www-form-urlencoded`?new URLSearchParams(n).toString():JSON.stringify(n):null}function at(e,t){if(t?.method)return t.method.toUpperCase();if(e.startsWith(`@`)){let n=e.split(`@`)[1]?.split(`/`)[0];return lt.includes(n)?n.toUpperCase():t?.body?`POST`:`GET`}return t?.body?`POST`:`GET`}function ot(e,t){let n;return!e?.signal&&e?.timeout&&(n=setTimeout(()=>t?.abort(),e?.timeout)),{abortTimeout:n,clearTimeout:()=>{n&&clearTimeout(n)}}}var st=class e extends Error{constructor(t,n){super(n||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,e.prototype)}};async function ct(e,t){let n=await e[`~standard`].validate(t);if(n.issues)throw new st(n.issues);return n.value}var lt=[`get`,`post`,`put`,`patch`,`delete`],ut=e=>({id:`apply-schema`,name:`Apply Schema`,version:`1.0.0`,async init(t,n){let r=e.plugins?.find(e=>e.schema?.config?t.startsWith(e.schema.config.baseURL||``)||t.startsWith(e.schema.config.prefix||``):!1)?.schema||e.schema;if(r){let e=t;r.config?.prefix&&e.startsWith(r.config.prefix)&&(e=e.replace(r.config.prefix,``),r.config.baseURL&&(t=t.replace(r.config.prefix,r.config.baseURL))),r.config?.baseURL&&e.startsWith(r.config.baseURL)&&(e=e.replace(r.config.baseURL,``)),e.startsWith(`/`)&&e.charAt(1)===`@`&&(e=e.substring(1));let i=r.schema[e];if(i){let e=n?.headers;if(i.headers&&!n?.disableValidation){let t={};if(n?.headers){if(n.headers instanceof Headers)n.headers.forEach((e,n)=>{t[n.toLowerCase()]=e});else if(typeof n.headers==`object`)for(let[e,r]of Object.entries(n.headers))r!=null&&(t[e.toLowerCase()]=r)}let r=await ct(i.headers,t),a={};for(let[e,t]of Object.entries(r))a[e.toLowerCase()]=t;e=a}let r=J(q({},n),{method:i.method,output:i.output,headers:e});return n?.disableValidation||(r=J(q({},r),{body:i.input?await ct(i.input,n?.body):n?.body,params:i.params?await ct(i.params,n?.params):n?.params,query:i.query?await ct(i.query,n?.query):n?.query})),{url:t,options:r}}}return{url:t,options:n}}}),dt=e=>{async function t(t,n){let r=J(q(q({},e),n),{headers:et(e?.headers,n?.headers),plugins:[...e?.plugins||[],ut(e||{}),...n?.plugins||[]]});if(e?.catchAllError)try{return await ht(t,r)}catch(e){return{data:null,error:{status:500,statusText:`Fetch Error`,message:`Fetch related error. Captured by catchAllError option. See error property for more details.`,error:e}}}return await ht(t,r)}return t},ft=e=>e===`.`||e===`..`;function pt(e,t){let n=e;for(let[e,r]of t)n=n.replace(e,r);if(ft(n))throw TypeError(`Path parameters cannot be reserved path segments`);return encodeURIComponent(n)}function mt(e,t){let{baseURL:n,params:r,query:i}=t||{query:{},params:{},baseURL:``},a=e.startsWith(`http`)?e.split(`/`).slice(0,3).join(`/`):n||``;if(e.startsWith(`@`)){let t=e.toString().split(`@`)[1].split(`/`)[0];lt.includes(t)&&(e=e.replace(`@${t}/`,`/`))}a.endsWith(`/`)||(a+=`/`);let[o,s]=e.replace(a,``).split(`?`),c=new URLSearchParams(s);for(let[e,t]of Object.entries(i||{})){if(t==null)continue;let n;if(typeof t==`string`)n=t;else if(Array.isArray(t)){for(let n of t)c.append(e,n);continue}else n=JSON.stringify(t);c.set(e,n)}let l=new Map;if(r)if(Array.isArray(r)){let e=o.split(`/`).filter(e=>e.startsWith(`:`));for(let[t,n]of e.entries()){let e=r[t];l.set(n,String(e))}}else for(let[e,t]of Object.entries(r))l.set(`:${e}`,String(t));o=o.split(`/`).map(e=>pt(e,l)).join(`/`),o=o.replace(/^\/+/,``);let u=c.toString();return u=u.length>0?`?${u}`.replace(/\+/g,`%20`):``,a.startsWith(`http`)?new URL(`${o}${u}`,a):`${a}${o}${u}`}var ht=async(e,t)=>{let{hooks:n,url:r,options:i}=await He(e,t),a=$e(i),o=new AbortController,s=i.signal??o.signal,c=mt(r,i),l=await tt(i),u=it(i,l),d=at(r,i),f=J(q({},i),{url:c,headers:l,body:u,method:d,signal:s});for(let e of n.onRequest)if(e){let t=await e(f);typeof t==`object`&&t&&Object.assign(f,t)}(`pipeTo`in f&&typeof f.pipeTo==`function`||typeof t?.body?.pipe==`function`)&&(`duplex`in f||(f.duplex=`half`));let{clearTimeout:p}=ot(i,o),m=await a(f.url,f);p();let h={response:m,request:f};for(let e of n.onResponse)if(e){let n=await e(J(q({},h),{response:t?.hookOptions?.cloneResponse?m.clone():m}));n instanceof Response?m=n:typeof n==`object`&&n&&(m=n.response)}if(m.ok){if(f.method===`HEAD`)return{data:``,error:null};let e=Je(m),r={data:null,response:m,request:f};if(e===`json`||e===`text`){let e=await m.text();r.data=await(f.jsonParser??Ze)(e)}else r.data=await m[e]();f?.output&&f.output&&!f.disableValidation&&(r.data=await ct(f.output,r.data));for(let e of n.onSuccess)e&&await e(J(q({},r),{response:t?.hookOptions?.cloneResponse?m.clone():m}));return t?.throw?r.data:{data:r.data,error:null}}let g=t?.jsonParser??Ze,_=await m.text(),v=Ye(_),y=v?await g(_):null,b={response:m,responseText:_,request:f,error:J(q({},y),{status:m.status,statusText:m.statusText})};for(let e of n.onError)e&&await e(J(q({},b),{response:t?.hookOptions?.cloneResponse?m.clone():m}));if(t?.retry){let r=Ge(t.retry),i=t.retryAttempt??0;if(await r.shouldAttemptRetry(i,m)){for(let e of n.onRetry)e&&await e(h);let a=r.getDelay(i);return await new Promise(e=>setTimeout(e,a)),await ht(e,J(q({},t),{retryAttempt:i+1}))}}if(t?.throw)throw new Ve(m.status,m.statusText,v?y:_);return{data:null,error:J(q({},y),{status:m.status,statusText:m.statusText})}},gt=e=>{if(typeof process>`u`)return;let t=e??`/api/auth`;if({}.NEXT_PUBLIC_AUTH_URL)return{}.NEXT_PUBLIC_AUTH_URL;if(typeof window>`u`){if({}.NEXTAUTH_URL)try{return{}.NEXTAUTH_URL}catch{}if({}.VERCEL_URL)try{let e={}.VERCEL_URL.startsWith(`http`)?``:`https://`;return`${new URL(`${e}${{}.VERCEL_URL}`).origin}${t}`}catch{}}},_t=(e,t)=>{let n=`credentials`in Request.prototype,r=be(e?.baseURL,e?.basePath,void 0,t)??gt(e?.basePath)??`/api/auth`,i=e?.plugins?.flatMap(e=>e.fetchPlugins).filter(e=>e!==void 0)||[],a={id:`lifecycle-hooks`,name:`lifecycle-hooks`,hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:o,onError:s,onRequest:c,onResponse:l,...u}=e?.fetchOptions||{},d=dt({baseURL:r,...n?{credentials:`include`}:{},method:`GET`,jsonParser(e){return e?L(e,{strict:!1}):null},customFetchImpl:fetch,...u,plugins:[a,...u.plugins||[],...e?.disableDefaultFetchPlugins?[]:[we],...i]}),{$sessionSignal:f,session:p,broadcastSessionUpdate:m}=ke(d,e),h=e?.plugins||[],g={},_={$sessionSignal:f,session:p},v={"/sign-out":`POST`,"/revoke-sessions":`POST`,"/revoke-other-sessions":`POST`,"/delete-user":`POST`},y=[{signal:`$sessionSignal`,matcher(e){return e===`/sign-out`||e===`/update-user`||e===`/update-session`||e===`/sign-up/email`||e===`/sign-in/email`||e===`/delete-user`||e===`/verify-email`||e===`/revoke-sessions`||e===`/revoke-session`||e===`/revoke-other-sessions`||e===`/change-email`||e===`/change-password`},callback(e){e===`/sign-out`?m(`signout`):(e===`/update-user`||e===`/update-session`)&&m(`updateUser`)}}];for(let e of h)e.getAtoms&&Object.assign(_,e.getAtoms?.(d)),e.pathMethods&&Object.assign(v,e.pathMethods),e.atomListeners&&y.push(...e.atomListeners);let b={notify:e=>{_[e].set(!_[e].get())},listen:(e,t)=>{_[e].subscribe(t)},atoms:_};for(let t of h)t.getActions&&(g=Ne(t.getActions?.(d,b,e)??{},g));return{get baseURL(){return r},pluginsActions:g,pluginsAtoms:_,pluginPathMethods:v,atomListeners:y,$fetch:d,$store:b}};function vt(e){return typeof e==`object`&&!!e&&`get`in e&&typeof e.get==`function`&&`lc`in e&&typeof e.lc==`number`}function yt(e){return e.charAt(0).toUpperCase()+e.slice(1)}var bt=/[\p{Ll}\d]+|\p{Lu}+(?!\p{Ll})|\p{Lu}[\p{Ll}\d]+|\p{Lo}+/gu,xt=/['\u2019]/g;function St(e){return e.replace(xt,``).match(bt)??[]}function Ct(e){return St(e).map(e=>e.toLowerCase()).join(`-`)}function wt(e,t,n){let r=t[e],{fetchOptions:i,query:a,...o}=n||{};return r||(i?.method?i.method:o&&Object.keys(o).length>0?`POST`:`GET`)}function Tt(e,t,n,r,i){function a(o=[]){return new Proxy(function(){},{get(t,n){if(typeof n!=`string`||n===`then`||n===`catch`||n===`finally`)return;let r=[...o,n],i=e;for(let e of r)if(i&&typeof i==`object`&&e in i)i=i[e];else{i=void 0;break}return typeof i==`function`||vt(i)?i:a(r)},apply:async(e,a,s)=>{let c=`/`+o.map(Ct).join(`/`),l=s[0]||{},u=s[1]||{},{query:d,fetchOptions:f,...p}=l,m={...u,...f},h=wt(c,n,l);return await t(c,{...m,body:h===`GET`?void 0:{...p,...m?.body||{}},query:d||m?.query,method:h,async onSuccess(e){if(await m?.onSuccess?.(e),!i||m.disableSignal)return;let t=i.filter(e=>e.matcher(c));if(!t.length)return;let n=new Set;for(let e of t){let t=r[e.signal];if(!t)return;if(n.has(e.signal))continue;n.add(e.signal);let i=t.get();setTimeout(()=>{t.set(!i)},10),e.callback?.(c)}}})}})}return a()}function Et(e){let{pluginPathMethods:t,pluginsActions:n,pluginsAtoms:r,$fetch:i,atomListeners:a,$store:o}=_t(e),s={};for(let[e,t]of Object.entries(r))s[`use${yt(e)}`]=t;return Tt({...n,...s,$fetch:i,$store:o},i,t,r,a)}function Dt(e){return{success:!1,error:`You are not allowed to access resource: ${e}`}}function Ot(e){return{success:!1,error:`unauthorized to access resource "${e}"`}}function kt(e){return e===`OR`?`OR`:`AND`}function At(e){return Array.isArray(e)}function jt(e){if(At(e))return{actions:e,connector:`AND`};if(!e||typeof e!=`object`)throw new G(`Invalid access control request`);let{actions:t,connector:n}=e;return At(t)?{actions:t,connector:kt(n)}:{actions:[],connector:kt(n)}}function Mt(e,t){return typeof t==`string`&&e.includes(t)}function Nt(e,{actions:t,connector:n}){return t.length===0?!1:n===`OR`?t.some(t=>Mt(e,t)):t.every(t=>Mt(e,t))}function Pt(e){return{authorize(t,n=`AND`){let r=!1;for(let[i,a]of Object.entries(t)){let t=e[i];if(!t){if(n===`AND`)return Dt(i);continue}let o=Nt(t,jt(a));if(o&&(r=!0),o&&n===`OR`)return{success:!0};if(!o&&n===`AND`)return Ot(i)}return r?{success:!0}:{success:!1,error:`Not authorized`}},statements:e}}function Ft(e){return{newRole(e){return Pt(e)},statements:e}}var It=ue({YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_ORGANIZATION:`You are not allowed to create a new organization`,YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_ORGANIZATIONS:`You have reached the maximum number of organizations`,ORGANIZATION_ALREADY_EXISTS:`Organization already exists`,ORGANIZATION_SLUG_ALREADY_TAKEN:`Organization slug already taken`,ORGANIZATION_NOT_FOUND:`Organization not found`,USER_IS_NOT_A_MEMBER_OF_THE_ORGANIZATION:`User is not a member of the organization`,YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_ORGANIZATION:`You are not allowed to update this organization`,YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_ORGANIZATION:`You are not allowed to delete this organization`,NO_ACTIVE_ORGANIZATION:`No active organization`,USER_IS_ALREADY_A_MEMBER_OF_THIS_ORGANIZATION:`User is already a member of this organization`,MEMBER_NOT_FOUND:`Member not found`,ROLE_NOT_FOUND:`Role not found`,YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM:`You are not allowed to create a new team`,TEAM_ALREADY_EXISTS:`Team already exists`,TEAM_NOT_FOUND:`Team not found`,YOU_CANNOT_LEAVE_THE_ORGANIZATION_AS_THE_ONLY_OWNER:`You cannot leave the organization as the only owner`,YOU_CANNOT_LEAVE_THE_ORGANIZATION_WITHOUT_AN_OWNER:`You cannot leave the organization without an owner`,YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_MEMBER:`You are not allowed to delete this member`,YOU_ARE_NOT_ALLOWED_TO_INVITE_USERS_TO_THIS_ORGANIZATION:`You are not allowed to invite users to this organization`,USER_IS_ALREADY_INVITED_TO_THIS_ORGANIZATION:`User is already invited to this organization`,INVITATION_NOT_FOUND:`Invitation not found`,YOU_ARE_NOT_THE_RECIPIENT_OF_THE_INVITATION:`You are not the recipient of the invitation`,EMAIL_VERIFICATION_REQUIRED_BEFORE_ACCEPTING_OR_REJECTING_INVITATION:`Email verification required before accepting or rejecting invitation`,EMAIL_VERIFICATION_REQUIRED_FOR_INVITATION:`Email verification required to view or list invitations for the session email`,YOU_ARE_NOT_ALLOWED_TO_CANCEL_THIS_INVITATION:`You are not allowed to cancel this invitation`,INVITER_IS_NO_LONGER_A_MEMBER_OF_THE_ORGANIZATION:`Inviter is no longer a member of the organization`,YOU_ARE_NOT_ALLOWED_TO_INVITE_USER_WITH_THIS_ROLE:`You are not allowed to invite a user with this role`,FAILED_TO_RETRIEVE_INVITATION:`Failed to retrieve invitation`,YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_TEAMS:`You have reached the maximum number of teams`,UNABLE_TO_REMOVE_LAST_TEAM:`Unable to remove last team`,YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_MEMBER:`You are not allowed to update this member`,ORGANIZATION_MEMBERSHIP_LIMIT_REACHED:`Organization membership limit reached`,YOU_ARE_NOT_ALLOWED_TO_CREATE_TEAMS_IN_THIS_ORGANIZATION:`You are not allowed to create teams in this organization`,YOU_ARE_NOT_ALLOWED_TO_DELETE_TEAMS_IN_THIS_ORGANIZATION:`You are not allowed to delete teams in this organization`,YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_TEAM:`You are not allowed to update this team`,YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_TEAM:`You are not allowed to delete this team`,INVITATION_LIMIT_REACHED:`Invitation limit reached`,TEAM_MEMBER_LIMIT_REACHED:`Team member limit reached`,USER_IS_NOT_A_MEMBER_OF_THE_TEAM:`User is not a member of the team`,YOU_CAN_NOT_ACCESS_THE_MEMBERS_OF_THIS_TEAM:`You are not allowed to list the members of this team`,YOU_DO_NOT_HAVE_AN_ACTIVE_TEAM:`You do not have an active team`,YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM_MEMBER:`You are not allowed to create a new member`,YOU_ARE_NOT_ALLOWED_TO_REMOVE_A_TEAM_MEMBER:`You are not allowed to remove a team member`,YOU_ARE_NOT_ALLOWED_TO_ACCESS_THIS_ORGANIZATION:`You are not allowed to access this organization as an owner`,YOU_ARE_NOT_A_MEMBER_OF_THIS_ORGANIZATION:`You are not a member of this organization`,MISSING_AC_INSTANCE:`Dynamic Access Control requires a pre-defined ac instance on the server auth plugin. Read server logs for more information`,YOU_MUST_BE_IN_AN_ORGANIZATION_TO_CREATE_A_ROLE:`You must be in an organization to create a role`,YOU_ARE_NOT_ALLOWED_TO_CREATE_A_ROLE:`You are not allowed to create a role`,YOU_ARE_NOT_ALLOWED_TO_UPDATE_A_ROLE:`You are not allowed to update a role`,YOU_ARE_NOT_ALLOWED_TO_DELETE_A_ROLE:`You are not allowed to delete a role`,YOU_ARE_NOT_ALLOWED_TO_READ_A_ROLE:`You are not allowed to read a role`,YOU_ARE_NOT_ALLOWED_TO_LIST_A_ROLE:`You are not allowed to list a role`,YOU_ARE_NOT_ALLOWED_TO_GET_A_ROLE:`You are not allowed to get a role`,TOO_MANY_ROLES:`This organization has too many roles`,INVALID_RESOURCE:`The provided permission includes an invalid resource`,ROLE_NAME_IS_ALREADY_TAKEN:`That role name is already taken`,CANNOT_DELETE_A_PRE_DEFINED_ROLE:`Cannot delete a pre-defined role`,ROLE_IS_ASSIGNED_TO_MEMBERS:`Cannot delete a role that is assigned to members. Please reassign the members to a different role first`,INVALID_TEAM_ID:`Team id contains a reserved character`}),Lt=Ft({organization:[`update`,`delete`],member:[`create`,`update`,`delete`],invitation:[`create`,`cancel`],team:[`create`,`update`,`delete`],ac:[`create`,`read`,`update`,`delete`]}),Rt=Lt.newRole({organization:[`update`],invitation:[`create`,`cancel`],member:[`create`,`update`,`delete`],team:[`create`,`update`,`delete`],ac:[`create`,`read`,`update`,`delete`]}),zt=Lt.newRole({organization:[`update`,`delete`],member:[`create`,`update`,`delete`],invitation:[`create`,`cancel`],team:[`create`,`update`,`delete`],ac:[`create`,`read`,`update`,`delete`]}),Bt=Lt.newRole({organization:[],member:[],invitation:[],team:[],ac:[`read`]}),Vt={admin:Rt,owner:zt,member:Bt},Ht=(e,t)=>{if(!e.permissions)return!1;let n=e.role.split(`,`),r=e.options.creatorRole||`owner`,i=n.includes(r),a=e.allowCreatorAllPermissions||!1;if(i&&a)return!0;for(let r of n)if(t[r]?.authorize(e.permissions)?.success)return!0;return!1},Ut=e=>Ht(e,e.options.roles||Vt),Wt=e=>{let t=y(!1),n=y(!1),r=y(!1),i=y(!1),a={admin:Rt,member:Bt,owner:zt,...e?.roles};return{id:`organization`,version:c,$InferServerPlugin:{},getActions:(t,n,r)=>({$Infer:{ActiveOrganization:{},Organization:{},Invitation:{},Member:{},Team:{}},organization:{checkRolePermission:t=>Ut({role:t.role,options:{ac:e?.ac,roles:a},permissions:t.permissions})}}),getAtoms:e=>{let a=R(t,`/organization/list`,e,{method:`GET`});return{$listOrg:t,$activeOrgSignal:n,$activeMemberSignal:r,$activeMemberRoleSignal:i,activeOrganization:R([n],`/organization/get-full-organization`,e,()=>({method:`GET`})),listOrganizations:a,activeMember:R([n,r],`/organization/get-active-member`,e,{method:`GET`}),activeMemberRole:R([n,i],`/organization/get-active-member-role`,e,{method:`GET`})}},pathMethods:{"/organization/get-full-organization":`GET`,"/organization/list-user-teams":`GET`},atomListeners:[{matcher(e){return e===`/organization/create`||e===`/organization/delete`||e===`/organization/update`},signal:`$listOrg`},{matcher(e){return e===`/sign-out`||e.startsWith(`/organization`)},signal:`$activeOrgSignal`},{matcher(e){return e.startsWith(`/organization/set-active`)||e===`/organization/create`||e===`/organization/delete`||e===`/organization/remove-member`||e===`/organization/leave`||e===`/organization/accept-invitation`},signal:`$sessionSignal`},{matcher(e){return e.includes(`/organization/update-member-role`)||e.startsWith(`/organization/set-active`)},signal:`$activeMemberSignal`},{matcher(e){return e.includes(`/organization/update-member-role`)||e.startsWith(`/organization/set-active`)},signal:`$activeMemberRoleSignal`}],$ERROR_CODES:It}},Gt=ue({OTP_NOT_ENABLED:`OTP not enabled`,OTP_HAS_EXPIRED:`OTP has expired`,TOTP_NOT_ENABLED:`TOTP not enabled`,TWO_FACTOR_NOT_ENABLED:`Two factor isn't enabled`,BACKUP_CODES_NOT_ENABLED:`Backup codes aren't enabled`,INVALID_BACKUP_CODE:`Invalid backup code`,INVALID_CODE:`Invalid code`,TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE:`Too many attempts. Please request a new code.`,ACCOUNT_TEMPORARILY_LOCKED:`Too many failed verification attempts. Your account is temporarily locked. Please try again later.`,INVALID_TWO_FACTOR_COOKIE:`Invalid two factor cookie`}),Kt=e=>({id:`two-factor`,version:c,$InferServerPlugin:{},atomListeners:[{matcher:e=>e.startsWith(`/two-factor/`),signal:`$sessionSignal`}],pathMethods:{"/two-factor/disable":`POST`,"/two-factor/enable":`POST`,"/two-factor/send-otp":`POST`,"/two-factor/generate-backup-codes":`POST`,"/two-factor/get-totp-uri":`POST`,"/two-factor/verify-totp":`POST`,"/two-factor/verify-otp":`POST`,"/two-factor/verify-backup-code":`POST`},fetchPlugins:[{id:`two-factor`,name:`two-factor`,hooks:{async onSuccess(t){if(t.data?.twoFactorRedirect){if(e?.onTwoFactorRedirect){await e.onTwoFactorRedirect({twoFactorMethods:t.data.twoFactorMethods});return}e?.twoFactorPage&&typeof window<`u`&&Ce(e.twoFactorPage)&&(window.location.href=e.twoFactorPage)}}}}],$ERROR_CODES:Gt}),qt=`auth-session-token`,Y={_memoryToken:null,get(){try{if(typeof localStorage<`u`)return localStorage.getItem(qt)}catch{}return this._memoryToken},set(e){this._memoryToken=e;try{typeof localStorage<`u`&&localStorage.setItem(qt,e)}catch{}},clear(){this._memoryToken=null;try{typeof localStorage<`u`&&localStorage.removeItem(qt)}catch{}}};function Jt(e){let t=Error(e.message??`Auth request failed with status ${e.status}`);return e.code&&(t.code=e.code),t}function Yt(e){try{let t=new URL(e);return{origin:t.origin,basePath:t.pathname.replace(/\/$/,``)}}catch{return{origin:Xt()??`http://localhost`,basePath:e.replace(/\/$/,``)}}}function Xt(){try{if(typeof window<`u`&&window.location?.origin)return window.location.origin}catch{}}function Zt(){try{if(typeof document<`u`){let e=document.querySelector(`base`)?.getAttribute(`href`);if(e)return`${new URL(e,Xt()??`http://localhost`).pathname.replace(/\/$/,``)}/reset-password`}}catch{}return`/reset-password`}function Qt(e){let t=e||globalThis.fetch.bind(globalThis);return async(e,n)=>{let r=new Headers(n?.headers),i=Y.get();if(i){let t=typeof e==`string`?e:e instanceof URL?e.href:e.url;/\/api\//i.test(t)&&r.set(`Authorization`,`Bearer ${i}`)}let a=await t(e,{...n,headers:r}),o=a.headers.get(`set-auth-token`);return o&&Y.set(o),a}}function $t(e){let{baseURL:t,fetchFn:n}=e,{origin:r,basePath:i}=Yt(t),a=Qt(n),o=Et({baseURL:r,basePath:i,disableDefaultFetchPlugins:!0,fetchOptions:{customFetchImpl:a},plugins:[Wt(),Kt()]});async function s(e,t){let n=await a(`${r}${i}${e}`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify(t)}),o=await n.json().catch(()=>({}));if(!n.ok){let e=Error(o?.message??`Auth request failed with status ${n.status}`);throw o?.code&&(e.code=o.code),e.status=n.status,e}return o??{}}return{async signIn(e){let{data:t,error:n}=await o.signIn.email({email:e.email,password:e.password});if(n)throw Jt(n);let r=t;return r.session?.token&&Y.set(r.session.token),{user:r.user,session:r.session}},async signUp(e){let{data:t,error:n}=await o.signUp.email({email:e.email,password:e.password,name:e.name});if(n)throw Jt(n);let r=t,i=r.token??r.session?.token??null;i&&Y.set(i);let a=r.session??null;return!a&&i&&(a={token:i}),{user:r.user,session:a,requiresVerification:i===null}},async sendVerificationEmail(e,t){let{error:n}=await o.sendVerificationEmail({email:e,callbackURL:t});if(n)throw Error(n.message??`Auth request failed with status ${n.status}`)},async signOut(){let{error:e}=await o.signOut();if(Y.clear(),e)throw Error(e.message??`Auth request failed with status ${e.status}`)},async getSession(){let e=null;try{let t=await o.getSession();t.error||(e=t.data)}catch{}if(e){let t=e;return t.session?.token&&Y.set(t.session.token),{user:t.user,session:t.session}}if(Y.get())try{let e=await(n||globalThis.fetch.bind(globalThis))(`${r}${i}/get-session`,{method:`GET`,credentials:`include`,headers:{"Content-Type":`application/json`}});if(e.ok){let t=await e.json().catch(()=>null);if(t?.user&&t?.session)return t.session.token?Y.set(t.session.token):Y.clear(),{user:t.user,session:t.session};Y.clear()}}catch{}return null},async forgotPassword(e){let t=o,n=t.requestPasswordReset??t.forgetPassword;if(typeof n!=`function`)throw Error(`password reset is not available on this auth backend`);let{error:r}=await n({email:e,redirectTo:Zt()});if(r)throw Error(r.message??`Auth request failed with status ${r.status}`)},async resetPassword(e,t){let{error:n}=await o.resetPassword({token:e,newPassword:t});if(n)throw Error(n.message??`Auth request failed with status ${n.status}`)},async sendPhoneOtp(e){await s(`/phone-number/send-otp`,{phoneNumber:e})},async signInWithPhoneOtp(e,t){let n=await s(`/phone-number/verify`,{phoneNumber:e,code:t}),r=typeof n.token==`string`?n.token:void 0,i=n.user??null;if(!r||!i)throw Error(`No account is registered for this phone number.`);return Y.set(r),{user:i,session:{token:r}}},async signInWithPhonePassword(e,t){let n=await s(`/sign-in/phone-number`,{phoneNumber:e,password:t}),r=typeof n.token==`string`?n.token:void 0,i=n.user??null;if(!r||!i)throw Error(`Invalid phone number or password.`);return Y.set(r),{user:i,session:{token:r}}},async requestPhonePasswordReset(e){await s(`/phone-number/request-password-reset`,{phoneNumber:e})},async resetPasswordWithPhoneOtp(e,t,n){await s(`/phone-number/reset-password`,{phoneNumber:e,otp:t,newPassword:n})},async changePassword(e,t,n){let r=o.changePassword;if(typeof r!=`function`)throw Error(`change-password is not available on this auth backend`);let{error:i}=await r({currentPassword:e,newPassword:t,...n?.revokeOtherSessions==null?{}:{revokeOtherSessions:n.revokeOtherSessions}});if(i)throw Error(i.message??`Auth request failed with status ${i.status}`)},async enrollTotp(e){let t=o.twoFactor;if(!t||typeof t.enable!=`function`)throw Error(`two-factor enrollment is not available on this auth backend`);let{data:n,error:r}=await t.enable({password:e});if(r)throw Error(r.message??`Two-factor enable failed (${r.status??`?`})`);return{totpURI:n?.totpURI??``,backupCodes:n?.backupCodes??[]}},async verifyTotp(e){let t=o.twoFactor;if(!t||typeof t.verifyTotp!=`function`)throw Error(`two-factor verification is not available on this auth backend`);let{error:n}=await t.verifyTotp({code:e});if(n)throw Error(n.message??`Two-factor verification failed (${n.status??`?`})`)},async setInitialPassword(e){let t=`${r}${i}/set-initial-password`,n=await a(t,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({newPassword:e})});if(!n.ok){let e=`Set password failed with status ${n.status}`;try{let t=await n.json();t?.error?.message&&(e=t.error.message)}catch{}throw Error(e)}},async hasLocalPassword(){let e=`${r}${i}/list-accounts`;try{let t=await a(e,{method:`GET`,headers:{"Content-Type":`application/json`}});if(!t.ok)return!1;let n=await t.json();return(Array.isArray(n)?n:n&&`data`in n&&Array.isArray(n.data)?n.data:[]).some(e=>e?.providerId===`credential`)}catch{return!1}},async updateUser(e){let{data:t,error:n}=await o.updateUser(e);if(n)throw Error(n.message??`Auth request failed with status ${n.status}`);if(!t)throw Error(`Update user returned no data`);let r=t;return r&&typeof r==`object`&&`user`in r?r.user:r},async getConfig(){let e=`${r}${i}/config`,t=await a(e,{method:`GET`,headers:{"Content-Type":`application/json`}});if(!t.ok)throw Error(`Failed to load auth config (status ${t.status})`);let n=await t.json();return n&&typeof n==`object`&&`data`in n&&n.data?n.data:n},async signInWithProvider(e,t={}){let{type:n=`social`,callbackURL:r,errorCallbackURL:i}=t;if(n===`oidc`){let t=o.signIn.oauth2;if(!t)throw Error(`OIDC sign-in is not supported by this auth client build`);let{data:n,error:a}=await t({providerId:e,callbackURL:r,errorCallbackURL:i});if(a)throw Error(a.message??`Auth request failed with status ${a.status}`);if(!n?.url)throw Error(`Sign-in with "${e}" did not return a redirect URL — please try again or contact your administrator.`);typeof window<`u`&&(window.location.href=n.url);return}let{data:a,error:s}=await o.signIn.social({provider:e,callbackURL:r,errorCallbackURL:i});if(s)throw Error(s.message??`Auth request failed with status ${s.status}`);let c=a?.url;if(!c)throw Error(`Sign-in with "${e}" did not return a redirect URL — please try again or contact your administrator.`);typeof window<`u`&&(window.location.href=c)},async listOrganizations(){let{data:e,error:t}=await o.organization.list();if(t)throw Error(t.message??`Failed to list organizations`);return e??[]},async createOrganization(e){let{data:t,error:n}=await o.organization.create({name:e.name,slug:e.slug,logo:e.logo});if(n)throw Error(n.message??`Failed to create organization`);return t},async setActiveOrganization(e){let{data:t,error:n}=await o.organization.setActive({organizationId:e});if(n)throw Error(n.message??`Failed to set active organization`);return t??null},async getActiveOrganization(){let{data:e,error:t}=await o.organization.getFullOrganization();return t||!e?null:e},async getActiveMember(){let e=o.organization?.getActiveMember;if(typeof e!=`function`)return null;let{data:t,error:n}=await e();return n||!t?null:t},async getMembers(e){let{data:t,error:n}=await o.organization.listMembers({query:{organizationId:e}});if(n)throw Error(n.message??`Failed to get members`);let r=t;return Array.isArray(r)?r:r?.members??[]},async inviteMember(e){let{data:t,error:n}=await o.organization.inviteMember({organizationId:e.organizationId,email:e.email,role:e.role});if(n)throw Error(n.message??`Failed to invite member`);return t},async removeMember(e){let{error:t}=await o.organization.removeMember({organizationId:e.organizationId,memberIdOrUserId:e.memberIdOrUserId});if(t)throw Error(t.message??`Failed to remove member`)},async updateMemberRole(e){let{error:t}=await o.organization.updateMemberRole({organizationId:e.organizationId,memberId:e.memberId,role:e.role});if(t)throw Error(t.message??`Failed to update member role`)},async updateOrganization(e,t){let{data:n,error:r}=await o.organization.update({organizationId:e,data:t});if(r)throw Error(r.message??`Failed to update organization`);return n},async deleteOrganization(e){let{error:t}=await o.organization.delete({organizationId:e});if(t)throw Error(t.message??`Failed to delete organization`)},async leaveOrganization(e){let{error:t}=await o.organization.leave({organizationId:e});if(t)throw Error(t.message??`Failed to leave organization`)},async listInvitations(e){let{data:t,error:n}=await o.organization.listInvitations({query:{organizationId:e}});if(n)throw Error(n.message??`Failed to list invitations`);return t??[]},async cancelInvitation(e){let{error:t}=await o.organization.cancelInvitation({invitationId:e});if(t)throw Error(t.message??`Failed to cancel invitation`)},async getInvitation(e){let{data:t,error:n}=await o.organization.getInvitation({query:{id:e}});if(n)throw Error(n.message??`Failed to load invitation`);return t},async acceptInvitation(e){let{error:t}=await o.organization.acceptInvitation({invitationId:e});if(t)throw Error(t.message??`Failed to accept invitation`)},async rejectInvitation(e){let{error:t}=await o.organization.rejectInvitation({invitationId:e});if(t)throw Error(t.message??`Failed to reject invitation`)},async listUserInvitations(){let{data:e,error:t}=await o.organization.listUserInvitations();if(t)throw Error(t.message??`Failed to list invitations`);return e??[]}}}var en=`auth-active-organization-id`,tn={_memoryValue:null,get(){try{if(typeof localStorage<`u`)return localStorage.getItem(en)}catch{}return this._memoryValue},set(e){this._memoryValue=e;try{typeof localStorage<`u`&&localStorage.setItem(en,e)}catch{}},clear(){this._memoryValue=null;try{typeof localStorage<`u`&&localStorage.removeItem(en)}catch{}}};function nn(){return async(e,t)=>{let n=new Headers(t?.headers),r=typeof e==`string`?e:e instanceof URL?e.href:e.url,i=/\/api\//i.test(r),s=Y.get();s&&i&&n.set(`Authorization`,`Bearer ${s}`);let c=tn.get();if(c&&n.set(`X-Tenant-ID`,c),i&&!n.has(`Accept-Language`)&&typeof document<`u`){let e=document.documentElement.lang;e&&n.set(`Accept-Language`,e)}let l=await fetch(e,{...t,headers:n});if(i&&l.status===403)try{let e=o(l.status,await l.clone().json());e&&a.emit(e)}catch{}return l}}var X=t();function rn({authUrl:e,client:t,onAuthStateChange:n,enabled:i=!0,previewMode:o,children:c}){let l=(0,r.useMemo)(()=>t??$t({baseURL:e}),[t,e]),[u,d]=(0,r.useState)(null),[f,p]=(0,r.useState)(null),[m,h]=(0,r.useState)(!0),[g,_]=(0,r.useState)(null),[v,y]=(0,r.useState)(null),[b,ee]=(0,r.useState)([]),[x,S]=(0,r.useState)(null),[te,C]=(0,r.useState)(null),[w,ne]=(0,r.useState)(!1),T=o!=null,E=i&&!T?u!==null&&f!==null:!0;(0,r.useEffect)(()=>{if(T){let e=o.simulatedRole??`admin`,t=o.simulatedUserName??`Preview User`,n=o.expiresInSeconds??0;d({id:`preview-user`,email:`preview@preview.local`,name:t,role:e,roles:[e]}),p({token:`preview-token`,expiresAt:n>0?new Date(Date.now()+n*1e3):new Date(Date.now()+365*24*60*60*1e3)}),h(!1);return}if(!i){d({id:`guest`,email:`guest@local`,name:`Guest User`,role:`admin`}),p({token:`guest-token`,expiresAt:new Date(Date.now()+365*24*60*60*1e3)}),h(!1);return}let e=!1;async function t(){try{let t=await l.getSession();if(e)return;t&&(d(t.user),p(t.session))}catch(t){if(e)return;_(t instanceof Error?t:Error(String(t)))}finally{e||h(!1)}}return t(),()=>{e=!0}},[l,i,T,o]),(0,r.useEffect)(()=>{n?.({user:u,session:f,isAuthenticated:E,isLoading:m,error:g})},[u,f,E,m,g,n]);let D=(0,r.useCallback)(async(e,t)=>{h(!0),_(null);try{let n=await l.signIn({email:e,password:t});d(n.user),p(n.session)}catch(e){let t=e instanceof Error?e:Error(String(e));throw _(t),t}finally{h(!1)}},[l]),O=(0,r.useCallback)(async(e,t,n)=>{h(!0),_(null);try{let r=await l.signUp({name:e,email:t,password:n});return r.requiresVerification?{requiresVerification:!0}:(d(r.user),p(r.session),{requiresVerification:!1})}catch(e){let t=e instanceof Error?e:Error(String(e));throw _(t),t}finally{h(!1)}},[l]),k=(0,r.useCallback)(async()=>{h(!0);try{await l.signOut(),d(null),p(null),_(null)}catch(e){_(e instanceof Error?e:Error(String(e)))}finally{h(!1)}},[l]),re=(0,r.useCallback)(async e=>{_(null);try{let t=await l.updateUser(e);d(t)}catch(e){let t=e instanceof Error?e:Error(String(e));throw _(t),t}},[l]),A=(0,r.useCallback)(async e=>{_(null);try{await l.forgotPassword(e)}catch(e){let t=e instanceof Error?e:Error(String(e));throw _(t),t}},[l]),j=(0,r.useCallback)(async(e,t)=>{_(null);try{await l.sendVerificationEmail(e,t)}catch(e){let t=e instanceof Error?e:Error(String(e));throw _(t),t}},[l]),M=(0,r.useCallback)(async(e,t)=>{_(null);try{await l.resetPassword(e,t)}catch(e){let t=e instanceof Error?e:Error(String(e));throw _(t),t}},[l]),ie=(0,r.useCallback)(async e=>{_(null);try{await l.sendPhoneOtp(e)}catch(e){let t=e instanceof Error?e:Error(String(e));throw _(t),t}},[l]),N=(0,r.useCallback)(async(e,t)=>{h(!0),_(null);try{let n=await l.signInWithPhoneOtp(e,t);d(n.user),p(n.session)}catch(e){let t=e instanceof Error?e:Error(String(e));throw _(t),t}finally{h(!1)}},[l]),P=(0,r.useCallback)(async(e,t)=>{h(!0),_(null);try{let n=await l.signInWithPhonePassword(e,t);d(n.user),p(n.session)}catch(e){let t=e instanceof Error?e:Error(String(e));throw _(t),t}finally{h(!1)}},[l]),F=(0,r.useCallback)(async e=>{_(null);try{await l.requestPhonePasswordReset(e)}catch(e){let t=e instanceof Error?e:Error(String(e));throw _(t),t}},[l]),I=(0,r.useCallback)(async(e,t,n)=>{_(null);try{await l.resetPasswordWithPhoneOtp(e,t,n)}catch(e){let t=e instanceof Error?e:Error(String(e));throw _(t),t}},[l]);(0,r.useEffect)(()=>a.subscribe(e=>{y(t=>t??e)}),[]);let ae=(0,r.useCallback)(e=>l.enrollTotp(e),[l]),oe=(0,r.useCallback)(e=>l.verifyTotp(e),[l]),L=(0,r.useCallback)(async(e,t,n)=>{_(null);try{await l.changePassword(e,t,n)}catch(e){let t=e instanceof Error?e:Error(String(e));throw _(t),t}},[l]),se=(0,r.useCallback)(async e=>{_(null);try{await l.setInitialPassword(e)}catch(e){let t=e instanceof Error?e:Error(String(e));throw _(t),t}},[l]),ce=(0,r.useCallback)(()=>l.hasLocalPassword(),[l]),R=(0,r.useCallback)(()=>l.getConfig(),[l]),z=(0,r.useCallback)(async(e,t)=>{_(null);try{await l.signInWithProvider(e,t)}catch(e){let t=e instanceof Error?e:Error(String(e));throw _(t),t}},[l]),B=(0,r.useCallback)(async e=>{if(!(!i||T)){ne(!0);try{let t=await l.listOrganizations();if(e?.())return t;if(ee(t),t.length>0&&!x){let n=null;try{n=await l.getActiveOrganization()}catch{n=null}if(!n&&t.length===1)try{n=await l.setActiveOrganization(t[0].id)}catch{n=null}n&&!e?.()&&(S(n),tn.set(n.id))}return t}catch(t){e?.()||console.warn(`[AuthProvider] Failed to load organizations:`,t)}finally{e?.()||ne(!1)}}},[l,i,T,x]),le=(0,r.useCallback)(async()=>{if(!i||T){let e=T?o?.simulatedRole??`admin`:`admin`;C({id:`preview-member`,organizationId:x?.id??`preview-org`,userId:`preview-user`,role:e});return}if(!x){C(null);return}try{let e=await l.getActiveMember();C(e)}catch(e){console.warn(`[AuthProvider] Failed to load active member:`,e),C(null)}},[l,i,T,o,x]);(0,r.useEffect)(()=>{le()},[le]),(0,r.useEffect)(()=>{if(!(u&&i&&!T))return;let e=!1;return B(()=>e),()=>{e=!0}},[u,i,T]);let V=(0,r.useCallback)(async e=>{_(null);try{let t=await l.setActiveOrganization(e);S(t),t?tn.set(t.id):tn.clear()}catch(e){let t=e instanceof Error?e:Error(String(e));throw _(t),t}},[l]),H=(0,r.useCallback)(async e=>{_(null);try{let t=await l.createOrganization(e);return await B(),await V(t.id),t}catch(e){let t=e instanceof Error?e:Error(String(e));throw _(t),t}},[l,B,V]),U=(0,r.useCallback)(async(e,t)=>{let n=await l.updateOrganization(e,t);return await B(),x?.id===e&&S(n),n},[l,B,x]),W=(0,r.useCallback)(async e=>{await l.deleteOrganization(e),x?.id===e&&(S(null),tn.clear()),await B()},[l,x,B]),ue=(0,r.useCallback)(async e=>{await l.leaveOrganization(e),x?.id===e&&(S(null),tn.clear()),await B()},[l,x,B]),de=(0,r.useCallback)(e=>l.getMembers(e),[l]),fe=(0,r.useCallback)(e=>l.inviteMember(e),[l]),pe=(0,r.useCallback)(e=>l.removeMember(e),[l]),me=(0,r.useCallback)(e=>l.updateMemberRole(e),[l]),G=(0,r.useCallback)(e=>l.listInvitations(e),[l]),he=(0,r.useCallback)(e=>l.cancelInvitation(e),[l]),ge=(0,r.useCallback)(e=>l.getInvitation(e),[l]),_e=(0,r.useCallback)(async e=>{await l.acceptInvitation(e),await B()},[l,B]),ve=(0,r.useCallback)(e=>l.rejectInvitation(e),[l]),K=(0,r.useCallback)(()=>l.listUserInvitations(),[l]),ye=i&&!T,be=(0,r.useMemo)(()=>({user:u,session:f,isAuthenticated:E,isAuthEnabled:ye,isLoading:m,error:g,isPreviewMode:T,previewMode:T?o:null,signIn:D,signUp:O,signOut:k,updateUser:re,forgotPassword:A,sendVerificationEmail:j,resetPassword:M,sendPhoneOtp:ie,signInWithPhoneOtp:N,signInWithPhonePassword:P,requestPhonePasswordReset:F,resetPasswordWithPhoneOtp:I,changePassword:L,remediationRequired:v,setRemediationRequired:y,enrollTotp:ae,verifyTotp:oe,setInitialPassword:se,hasLocalPassword:ce,getAuthConfig:R,signInWithProvider:z,organizations:b,activeOrganization:x,activeMember:te,isOrganizationsLoading:w,switchOrganization:V,createOrganization:H,refreshOrganizations:B,updateOrganization:U,deleteOrganization:W,leaveOrganization:ue,getMembers:de,inviteMember:fe,removeMember:pe,updateMemberRole:me,listInvitations:G,cancelInvitation:he,getInvitation:ge,acceptInvitation:_e,rejectInvitation:ve,listUserInvitations:K}),[u,f,E,ye,m,g,T,o,D,O,k,re,A,j,M,L,se,ce,R,z,ie,N,P,F,I,v,ae,oe,b,x,te,w,V,H,B,U,W,ue,de,fe,pe,me,G,he,ge,_e,ve,K]);return(0,X.jsx)(s.Provider,{value:be,children:c})}function an(){return(0,r.useContext)(s)||{user:null,session:null,isAuthenticated:!1,isAuthEnabled:!1,isLoading:!1,error:null,isPreviewMode:!1,previewMode:null,signIn:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},signUp:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},signOut:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},updateUser:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},forgotPassword:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},sendVerificationEmail:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},resetPassword:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},sendPhoneOtp:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},signInWithPhoneOtp:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},signInWithPhonePassword:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},requestPhonePasswordReset:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},resetPasswordWithPhoneOtp:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},changePassword:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},remediationRequired:null,setRemediationRequired:()=>{},enrollTotp:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},verifyTotp:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},setInitialPassword:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},hasLocalPassword:async()=>!1,getAuthConfig:async()=>({}),signInWithProvider:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},organizations:[],activeOrganization:null,activeMember:null,isOrganizationsLoading:!1,switchOrganization:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},createOrganization:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},refreshOrganizations:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},updateOrganization:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},deleteOrganization:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},leaveOrganization:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},getMembers:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},inviteMember:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},removeMember:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},updateMemberRole:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},listInvitations:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},cancelInvitation:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},getInvitation:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},acceptInvitation:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},rejectInvitation:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},listUserInvitations:async()=>{throw Error(`useAuth must be used within an AuthProvider`)}}}var on=new Set([`owner`,`admin`,`super_admin`,`superadmin`,`platform_admin`,`system_admin`,`org_owner`,`org_admin`]);function sn(e){return typeof e==`string`&&on.has(e.toLowerCase())}function cn(){let{activeMember:e,user:t}=an();return!!(sn(e?.role)||sn(t?.role)||Array.isArray(t?.roles)&&t.roles.some(sn))}function ln({fallback:e=null,requiredRoles:t,loadingFallback:n,children:r}){let{isAuthenticated:i,isLoading:a,user:o}=an();if(a)return(0,X.jsx)(X.Fragment,{children:n??null});if(!i)return(0,X.jsx)(X.Fragment,{children:e});if(t&&t.length>0&&o){let n=o.roles??(o.role?[o.role]:[]);if(!t.some(e=>n.includes(e)))return(0,X.jsx)(X.Fragment,{children:e})}return(0,X.jsx)(X.Fragment,{children:r})}var Z=`flex h-11 w-full rounded-lg border border-input bg-background px-3.5 py-2 text-sm shadow-sm ring-offset-background transition-colors placeholder:text-muted-foreground hover:border-primary/40 focus-visible:border-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 focus-visible:ring-offset-1 disabled:cursor-not-allowed disabled:opacity-50`,un=`inline-flex h-11 w-full items-center justify-center gap-2 rounded-lg bg-gradient-to-r from-primary to-primary/85 px-4 py-2 text-sm font-medium text-primary-foreground shadow-sm ring-offset-background transition-[box-shadow,background-color,transform] hover:shadow-md hover:from-primary hover:to-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:ring-offset-2 active:scale-[0.99] disabled:pointer-events-none disabled:opacity-60 motion-reduce:transition-none motion-reduce:active:transform-none`,Q=`text-sm font-medium leading-none text-foreground`;function $(){return(0,X.jsxs)(`svg`,{className:`h-4 w-4 animate-spin`,viewBox:`0 0 24 24`,fill:`none`,"aria-hidden":`true`,children:[(0,X.jsx)(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),(0,X.jsx)(`path`,{className:`opacity-90`,d:`M4 12a8 8 0 018-8`,stroke:`currentColor`,strokeWidth:`4`,strokeLinecap:`round`})]})}function dn({className:e}){return(0,X.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:e??`h-4 w-4 shrink-0`,"aria-hidden":`true`,children:[(0,X.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,X.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`12`}),(0,X.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`})]})}function fn({className:e}){return(0,X.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`,strokeLinejoin:`round`,className:e??`h-7 w-7`,"aria-hidden":`true`,children:[(0,X.jsx)(`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`}),(0,X.jsx)(`path`,{d:`m22 6-10 7L2 6`})]})}function pn({icon:e,title:t,description:n}){return(0,X.jsxs)(`div`,{className:`flex flex-col items-center space-y-3 text-center`,children:[e&&(0,X.jsx)(`div`,{className:`flex h-12 w-12 items-center justify-center rounded-2xl bg-primary/10 text-primary ring-1 ring-primary/15`,children:e}),(0,X.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight text-foreground sm:text-[1.6rem]`,children:t}),n&&(0,X.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:n})]})}function mn({message:e}){return(0,X.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-destructive/30 bg-destructive/10 p-3 text-sm text-destructive`,role:`alert`,children:[(0,X.jsx)(dn,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,X.jsx)(`span`,{className:`leading-snug`,children:e})]})}function hn({label:e=`or`}){return(0,X.jsxs)(`div`,{className:`relative my-1`,children:[(0,X.jsx)(`div`,{className:`absolute inset-0 flex items-center`,"aria-hidden":`true`,children:(0,X.jsx)(`span`,{className:`w-full border-t border-border`})}),(0,X.jsx)(`div`,{className:`relative flex justify-center text-xs uppercase tracking-wider`,children:(0,X.jsx)(`span`,{className:`bg-background px-3 text-muted-foreground`,children:e})})]})}var gn={google:`Google`,github:`GitHub`,microsoft:`Microsoft`,apple:`Apple`,facebook:`Facebook`,twitter:`Twitter`,discord:`Discord`,gitlab:`GitLab`,linkedin:`LinkedIn`},_n={google:(0,X.jsx)(`svg`,{viewBox:`0 0 24 24`,className:`h-4 w-4`,"aria-hidden":`true`,children:(0,X.jsx)(`path`,{fill:`#EA4335`,d:`M12 10.2v3.9h5.5c-.24 1.4-1.7 4.1-5.5 4.1-3.3 0-6-2.74-6-6.1s2.7-6.1 6-6.1c1.88 0 3.14.8 3.86 1.5l2.64-2.55C16.84 3.36 14.66 2.4 12 2.4 6.92 2.4 2.8 6.52 2.8 11.6S6.92 20.8 12 20.8c6.92 0 9.2-4.86 9.2-7.4 0-.5-.06-.88-.14-1.2H12z`})}),github:(0,X.jsx)(`svg`,{viewBox:`0 0 24 24`,className:`h-4 w-4 fill-current`,"aria-hidden":`true`,children:(0,X.jsx)(`path`,{d:`M12 .5C5.65.5.5 5.65.5 12c0 5.08 3.29 9.39 7.86 10.91.58.11.79-.25.79-.56v-2.07c-3.2.7-3.87-1.37-3.87-1.37-.52-1.33-1.27-1.69-1.27-1.69-1.04-.71.08-.7.08-.7 1.15.08 1.76 1.18 1.76 1.18 1.02 1.75 2.68 1.25 3.34.96.1-.74.4-1.25.73-1.54-2.55-.29-5.24-1.28-5.24-5.69 0-1.26.45-2.29 1.18-3.1-.12-.29-.51-1.46.11-3.04 0 0 .97-.31 3.18 1.18a11.04 11.04 0 015.79 0c2.21-1.49 3.18-1.18 3.18-1.18.62 1.58.23 2.75.11 3.04.74.81 1.18 1.84 1.18 3.1 0 4.42-2.7 5.39-5.27 5.68.41.36.78 1.06.78 2.13v3.16c0 .31.21.68.8.56C20.21 21.39 23.5 17.08 23.5 12 23.5 5.65 18.35.5 12 .5z`})}),microsoft:(0,X.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:`h-4 w-4`,"aria-hidden":`true`,children:[(0,X.jsx)(`path`,{fill:`#F25022`,d:`M2 2h9.5v9.5H2z`}),(0,X.jsx)(`path`,{fill:`#7FBA00`,d:`M12.5 2H22v9.5h-9.5z`}),(0,X.jsx)(`path`,{fill:`#00A4EF`,d:`M2 12.5h9.5V22H2z`}),(0,X.jsx)(`path`,{fill:`#FFB900`,d:`M12.5 12.5H22V22h-9.5z`})]}),apple:(0,X.jsx)(`svg`,{viewBox:`0 0 24 24`,className:`h-4 w-4 fill-current`,"aria-hidden":`true`,children:(0,X.jsx)(`path`,{d:`M16.37 12.55c-.02-2.27 1.85-3.36 1.94-3.42-1.06-1.55-2.71-1.76-3.3-1.79-1.4-.14-2.74.83-3.45.83-.71 0-1.81-.81-2.98-.79-1.53.02-2.95.89-3.74 2.27-1.6 2.77-.41 6.86 1.14 9.11.76 1.1 1.66 2.34 2.83 2.3 1.14-.05 1.57-.74 2.94-.74 1.37 0 1.76.74 2.96.71 1.22-.02 2-1.12 2.75-2.23.87-1.28 1.22-2.52 1.24-2.59-.03-.01-2.38-.91-2.4-3.66zM14.1 5.31c.62-.76 1.05-1.81.93-2.86-.9.04-2 .6-2.65 1.35-.58.66-1.1 1.74-.96 2.76 1.01.08 2.04-.51 2.68-1.25z`})}),facebook:(0,X.jsx)(`svg`,{viewBox:`0 0 24 24`,className:`h-4 w-4`,"aria-hidden":`true`,children:(0,X.jsx)(`path`,{fill:`#1877F2`,d:`M24 12C24 5.37 18.63 0 12 0S0 5.37 0 12c0 5.99 4.39 10.95 10.13 11.85V15.47H7.08V12h3.05V9.36c0-3.01 1.79-4.67 4.53-4.67 1.31 0 2.69.23 2.69.23v2.96h-1.51c-1.49 0-1.96.93-1.96 1.88V12h3.33l-.53 3.47h-2.8v8.38C19.61 22.95 24 17.99 24 12z`})}),twitter:(0,X.jsx)(`svg`,{viewBox:`0 0 24 24`,className:`h-4 w-4 fill-current`,"aria-hidden":`true`,children:(0,X.jsx)(`path`,{d:`M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z`})}),discord:(0,X.jsx)(`svg`,{viewBox:`0 0 24 24`,className:`h-4 w-4`,"aria-hidden":`true`,children:(0,X.jsx)(`path`,{fill:`#5865F2`,d:`M20.32 4.37A19.79 19.79 0 0016.56 3l-.18.36a18.27 18.27 0 00-8.76 0L7.44 3a19.79 19.79 0 00-3.76 1.37C.99 8.4.27 12.34.63 16.22a19.94 19.94 0 006.07 3.07l.49-.7a13.2 13.2 0 01-2.07-.99c.17-.13.34-.27.5-.41a14.13 14.13 0 0012.76 0c.16.14.33.28.5.41-.66.4-1.36.73-2.07.99l.49.7a19.92 19.92 0 006.07-3.07c.43-4.5-.66-8.41-2.95-11.85zM8.52 14.12c-1.18 0-2.15-1.08-2.15-2.41 0-1.33.95-2.42 2.15-2.42 1.2 0 2.17 1.09 2.15 2.42 0 1.33-.96 2.41-2.15 2.41zm6.96 0c-1.18 0-2.15-1.08-2.15-2.41 0-1.33.95-2.42 2.15-2.42 1.2 0 2.17 1.09 2.15 2.42 0 1.33-.95 2.41-2.15 2.41z`})}),gitlab:(0,X.jsx)(`svg`,{viewBox:`0 0 24 24`,className:`h-4 w-4`,"aria-hidden":`true`,children:(0,X.jsx)(`path`,{fill:`#FC6D26`,d:`M23.6 9.6L23.57 9.5 20.3.81a.84.84 0 00-1.6.05L16.5 7.6H7.5L5.3.86a.84.84 0 00-1.6-.05L.43 9.5l-.03.1a5.84 5.84 0 001.94 6.74l.01.01.03.02 4.8 3.6 2.38 1.8 1.45 1.1a1 1 0 001.2 0l1.45-1.1 2.38-1.8 4.83-3.62.01-.01a5.84 5.84 0 001.93-6.74z`})}),linkedin:(0,X.jsx)(`svg`,{viewBox:`0 0 24 24`,className:`h-4 w-4`,"aria-hidden":`true`,children:(0,X.jsx)(`path`,{fill:`#0A66C2`,d:`M20.45 20.45h-3.55v-5.57c0-1.33-.02-3.04-1.85-3.04-1.85 0-2.13 1.45-2.13 2.94v5.67H9.36V9h3.41v1.56h.05c.48-.9 1.64-1.85 3.37-1.85 3.6 0 4.27 2.37 4.27 5.45v6.29zM5.34 7.43a2.06 2.06 0 11.01-4.13 2.06 2.06 0 010 4.13zM7.12 20.45H3.56V9h3.56v11.45zM22.22 0H1.77C.79 0 0 .77 0 1.72v20.56C0 23.23.79 24 1.77 24h20.45c.98 0 1.78-.77 1.78-1.72V1.72C24 .77 23.2 0 22.22 0z`})})};function vn({id:e}){let t=_n[e];return t?(0,X.jsx)(`span`,{className:`mr-2 flex h-4 w-4 items-center justify-center`,children:t}):(0,X.jsx)(`span`,{className:`mr-2 flex h-4 w-4 items-center justify-center rounded-sm bg-muted text-[10px] font-bold uppercase`,children:e[0]})}function yn({mode:e=`sign-in`,callbackURL:t,errorCallbackURL:n,dividerText:i=`or continue with email`,onProvidersResolved:a}){let{getAuthConfig:o,signInWithProvider:s}=an(),[c,l]=(0,r.useState)([]),[u,d]=(0,r.useState)(!0),[f,p]=(0,r.useState)(null),[m,h]=(0,r.useState)(null);if((0,r.useEffect)(()=>{let e=!1;return Promise.resolve().then(()=>o()).then(t=>{if(e)return;let n=(t?.socialProviders??[]).filter(e=>e.enabled);l(n),a?.(n.length>0)}).catch(t=>{e||(console.warn(`[SocialSignInButtons] failed to load auth config`,t),a?.(!1))}).finally(()=>{e||d(!1)}),()=>{e=!0}},[o]),u||c.length===0)return null;let g=e===`sign-in`?`Continue with`:`Sign up with`,_=typeof window<`u`?window.location.href:void 0,v=async e=>{if(!m){p(null),h(e.id);try{await s(e.id,{callbackURL:t??_,errorCallbackURL:n??t??_,type:e.type??`social`})}catch(e){p(e instanceof Error?e.message:String(e)),h(null)}}};return(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[f&&(0,X.jsx)(`div`,{className:`rounded-md bg-destructive/15 p-3 text-sm text-destructive`,role:`alert`,children:f}),c.map(e=>(0,X.jsxs)(`button`,{type:`button`,onClick:()=>v(e),disabled:m!==null,"aria-busy":m===e.id,className:`inline-flex h-10 w-full items-center justify-center rounded-md border border-input bg-background px-4 py-2 text-sm font-medium ring-offset-background transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50`,children:[m===e.id?(0,X.jsx)($,{}):(0,X.jsx)(vn,{id:e.id}),g,` `,gn[e.id]??e.name]},e.id)),(0,X.jsxs)(`div`,{className:`relative my-1`,children:[(0,X.jsx)(`div`,{className:`absolute inset-0 flex items-center`,children:(0,X.jsx)(`span`,{className:`w-full border-t`})}),(0,X.jsx)(`div`,{className:`relative flex justify-center text-xs uppercase`,children:(0,X.jsx)(`span`,{className:`bg-background px-2 text-muted-foreground`,children:i})})]})]})}function bn(e){let t=String(e??``).replace(/[\s\-().]/g,``);return/^\+?[0-9]{6,15}$/.test(t)?t:null}function xn(e){return typeof e!=`string`||e.includes(`@`)?!1:bn(e)!==null}var Sn=({href:e,className:t,children:n})=>(0,X.jsx)(`a`,{href:e,className:t,children:n}),Cn=()=>(0,X.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`h-6 w-6`,"aria-hidden":`true`,children:[(0,X.jsx)(`rect`,{x:`3`,y:`11`,width:`18`,height:`11`,rx:`2`}),(0,X.jsx)(`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`})]});function wn({onSuccess:e,onError:t,registerUrl:n=`/register`,forgotPasswordUrl:i=`/forgot-password`,title:a=`Sign in to your account`,description:o=`Enter your email and password to continue`,icon:s,hideIcon:c=!1,linkComponent:l=Sn,labels:u={},errorMessages:d}){let{signIn:f,isLoading:p,getAuthConfig:m,sendPhoneOtp:h,signInWithPhoneOtp:g,signInWithPhonePassword:_}=an(),[v,y]=(0,r.useState)(``),[b,ee]=(0,r.useState)(``),[x,S]=(0,r.useState)(null),[te,C]=(0,r.useState)(!1),[w,ne]=(0,r.useState)(!1),[T,E]=(0,r.useState)(`password`),[D,O]=(0,r.useState)(``),[k,re]=(0,r.useState)(``),[A,j]=(0,r.useState)(!1),[M,ie]=(0,r.useState)(!1),[N,P]=(0,r.useState)(0),[F,I]=(0,r.useState)(!1),[ae,oe]=(0,r.useState)(!1),[L,se]=(0,r.useState)(!1),[ce,R]=(0,r.useState)(!1),[z,B]=(0,r.useState)(!1);(0,r.useEffect)(()=>{let e=!1;return Promise.resolve().then(()=>m()).then(t=>{e||(oe(t?.features?.sso===!0),C(t?.features?.phoneNumberOtp===!0),ne(t?.features?.phoneNumber===!0),se(t?.features?.ssoEnforced===!0||t?.emailPassword?.enabled===!1))}).catch(()=>{}),()=>{e=!0}},[m]);let le=!L||ce,V={emailLabel:u.emailLabel??`Email`,emailPlaceholder:u.emailPlaceholder??`name@example.com`,emailOrPhoneLabel:u.emailOrPhoneLabel??`Email or phone number`,emailOrPhonePlaceholder:u.emailOrPhonePlaceholder??`name@example.com or +1 555 000 0000`,passwordLabel:u.passwordLabel??`Password`,passwordPlaceholder:u.passwordPlaceholder??`Enter your password`,forgotPasswordText:u.forgotPasswordText??`Forgot password?`,submitButton:u.submitButton??`Sign In`,submittingButton:u.submittingButton??`Signing in…`,noAccountText:u.noAccountText??`Don't have an account?`,signUpText:u.signUpText??`Sign up`,orText:u.orText??`or`,ssoButton:u.ssoButton??`Sign in with SSO`,usePasswordText:u.usePasswordText??`Use a password instead`,backToSsoText:u.backToSsoText??`Back to single sign-on`,ssoOnlyDescription:u.ssoOnlyDescription??`Sign in with your organization's single sign-on`,phoneLabel:u.phoneLabel??`Phone number`,phonePlaceholder:u.phonePlaceholder??`+1 555 000 0000`,otpCodeLabel:u.otpCodeLabel??`Verification code`,otpCodePlaceholder:u.otpCodePlaceholder??`6-digit code`,sendOtpButton:u.sendOtpButton??`Get code`,resendOtpCountdownText:u.resendOtpCountdownText??`Resend in {seconds}s`,usePhoneOtpText:u.usePhoneOtpText??`Sign in with verification code`,usePasswordSignInText:u.usePasswordSignInText??`Sign in with password instead`};(0,r.useEffect)(()=>{if(N<=0)return;let e=setTimeout(()=>P(e=>e>1?e-1:0),1e3);return()=>clearTimeout(e)},[N]);let H=async n=>{n.preventDefault(),S(null);try{T===`phone-otp`?await g(D.trim(),k.trim()):w&&xn(v)?await _(bn(v)??v.trim(),b):await f(v,b),e?.()}catch(e){let n=e instanceof Error?e:Error(String(e)),r=n.code;S(r&&d?.[r]||n.message),t?.(n)}},U=async()=>{if(!(!D.trim()||A||N>0)){S(null),j(!0);try{await h(D.trim()),ie(!0),P(60)}catch(e){let n=e instanceof Error?e:Error(String(e)),r=n.code;S(r&&d?.[r]||n.message),t?.(n)}finally{j(!1)}}},W=e=>{E(e),S(null)};return(0,X.jsxs)(`div`,{className:`mx-auto flex w-full flex-col justify-center space-y-7 sm:w-[400px]`,children:[(0,X.jsx)(pn,{icon:c?void 0:s??(0,X.jsx)(Cn,{}),title:a,description:L&&!ce?V.ssoOnlyDescription:o}),(0,X.jsxs)(`div`,{className:`space-y-5`,children:[(0,X.jsx)(yn,{mode:`sign-in`,onProvidersResolved:e=>I(e)}),le?T===`phone-otp`?(0,X.jsxs)(`form`,{onSubmit:H,className:`space-y-4`,children:[F&&(0,X.jsx)(hn,{label:V.orText}),x&&(0,X.jsx)(mn,{message:x}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`label`,{htmlFor:`login-phone`,className:Q,children:V.phoneLabel}),(0,X.jsx)(`input`,{id:`login-phone`,type:`tel`,placeholder:V.phonePlaceholder,value:D,onChange:e=>O(e.target.value),required:!0,autoComplete:`tel`,disabled:p,className:Z})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`label`,{htmlFor:`login-otp`,className:Q,children:V.otpCodeLabel}),(0,X.jsxs)(`div`,{className:`flex gap-2`,children:[(0,X.jsx)(`input`,{id:`login-otp`,type:`text`,inputMode:`numeric`,placeholder:V.otpCodePlaceholder,value:k,onChange:e=>re(e.target.value),required:!0,autoComplete:`one-time-code`,disabled:p,className:Z}),(0,X.jsxs)(`button`,{type:`button`,onClick:U,disabled:A||N>0||!D.trim()||p,className:`shrink-0 rounded-md border border-input bg-background px-3 py-2 text-sm font-medium transition-colors hover:bg-accent disabled:opacity-50`,children:[A&&(0,X.jsx)($,{}),N>0?V.resendOtpCountdownText.replace(`{seconds}`,String(N)):V.sendOtpButton]})]})]}),(0,X.jsxs)(`button`,{type:`submit`,disabled:p||!M,className:un,children:[p&&(0,X.jsx)($,{}),p?V.submittingButton:V.submitButton]}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>W(`password`),className:`w-full text-center text-xs text-muted-foreground underline-offset-4 transition-colors hover:text-primary hover:underline`,children:V.usePasswordSignInText})]}):(0,X.jsxs)(`form`,{onSubmit:H,className:`space-y-4`,children:[F&&(0,X.jsx)(hn,{label:V.orText}),x&&(0,X.jsx)(mn,{message:x}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`label`,{htmlFor:`login-email`,className:Q,children:w?V.emailOrPhoneLabel:V.emailLabel}),(0,X.jsx)(`input`,{id:`login-email`,type:w?`text`:`email`,inputMode:w?`text`:`email`,placeholder:w?V.emailOrPhonePlaceholder:V.emailPlaceholder,value:v,onChange:e=>y(e.target.value),required:!0,autoComplete:`username`,disabled:p,className:Z})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,X.jsx)(`label`,{htmlFor:`login-password`,className:Q,children:V.passwordLabel}),i&&(0,X.jsx)(l,{href:i,className:`text-xs text-muted-foreground underline-offset-4 transition-colors hover:text-primary hover:underline`,children:V.forgotPasswordText})]}),(0,X.jsx)(`input`,{id:`login-password`,type:`password`,placeholder:V.passwordPlaceholder,value:b,onChange:e=>ee(e.target.value),required:!0,autoComplete:`current-password`,disabled:p,className:Z})]}),(0,X.jsxs)(`button`,{type:`submit`,disabled:p,className:un,children:[p&&(0,X.jsx)($,{}),p?V.submittingButton:V.submitButton]}),ae&&(0,X.jsxs)(`button`,{type:`button`,onClick:async()=>{if(!z){if(S(null),xn(v)){S(`Enter your email address to sign in with SSO.`);return}B(!0);try{let e=window.location.pathname.replace(/\/login(?:\/.*)?$/,``),t=await fetch(`/api/v1/auth/sign-in/sso`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({email:v,callbackURL:e+`/home`}),credentials:`include`}),n=await t.json().catch(()=>({}));if(t.ok&&typeof n.url==`string`){window.location.href=n.url;return}S(n.message||`No SSO provider is configured for this email domain.`),B(!1)}catch(e){S(e instanceof Error?e.message:String(e)),B(!1)}}},disabled:p||z,"aria-busy":z,className:`flex w-full items-center justify-center rounded-md border border-input bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent disabled:opacity-50`,children:[z&&(0,X.jsx)($,{}),V.ssoButton]}),te&&(0,X.jsx)(`button`,{type:`button`,onClick:()=>W(`phone-otp`),className:`w-full text-center text-xs text-muted-foreground underline-offset-4 transition-colors hover:text-primary hover:underline`,children:V.usePhoneOtpText}),L&&ce&&(0,X.jsx)(`button`,{type:`button`,onClick:()=>R(!1),className:`w-full text-center text-xs text-muted-foreground underline-offset-4 transition-colors hover:text-primary hover:underline`,children:V.backToSsoText})]}):(0,X.jsxs)(`div`,{className:`space-y-4`,children:[x&&(0,X.jsx)(mn,{message:x}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>R(!0),className:`w-full text-center text-xs text-muted-foreground underline-offset-4 transition-colors hover:text-primary hover:underline`,children:V.usePasswordText})]})]}),n&&!L&&(0,X.jsxs)(`p`,{className:`px-8 text-center text-sm text-muted-foreground`,children:[V.noAccountText,` `,(0,X.jsx)(l,{href:n,className:`font-medium text-primary underline-offset-4 hover:underline focus-visible:outline-none focus-visible:underline`,children:V.signUpText})]})]})}var Tn=({href:e,className:t,children:n})=>(0,X.jsx)(`a`,{href:e,className:t,children:n}),En=()=>(0,X.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`h-6 w-6`,"aria-hidden":`true`,children:[(0,X.jsx)(`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`}),(0,X.jsx)(`circle`,{cx:`9`,cy:`7`,r:`4`}),(0,X.jsx)(`line`,{x1:`19`,y1:`8`,x2:`19`,y2:`14`}),(0,X.jsx)(`line`,{x1:`22`,y1:`11`,x2:`16`,y2:`11`})]});function Dn({onSuccess:e,onVerificationRequired:t,onError:n,loginUrl:i=`/login`,title:a=`Create an account`,description:o=`Enter your information to get started`,icon:s,hideIcon:c=!1,linkComponent:l=Tn,labels:u={},errorMessages:d}){let{signUp:f,isLoading:p}=an(),[m,h]=(0,r.useState)(``),[g,_]=(0,r.useState)(``),[v,y]=(0,r.useState)(``),[b,ee]=(0,r.useState)(``),[x,S]=(0,r.useState)(null),[te,C]=(0,r.useState)(!1),w={nameLabel:u.nameLabel??`Name`,namePlaceholder:u.namePlaceholder??`John Doe`,emailLabel:u.emailLabel??`Email`,emailPlaceholder:u.emailPlaceholder??`name@example.com`,passwordLabel:u.passwordLabel??`Password`,passwordPlaceholder:u.passwordPlaceholder??`Create a password (min. 8 characters)`,confirmPasswordLabel:u.confirmPasswordLabel??`Confirm Password`,confirmPasswordPlaceholder:u.confirmPasswordPlaceholder??`Confirm your password`,passwordMismatchError:u.passwordMismatchError??`Passwords do not match`,passwordTooShortError:u.passwordTooShortError??`Password must be at least 8 characters`,submitButton:u.submitButton??`Create Account`,submittingButton:u.submittingButton??`Creating account…`,hasAccountText:u.hasAccountText??`Already have an account?`,signInText:u.signInText??`Sign in`,orText:u.orText??`or`};return(0,X.jsxs)(`div`,{className:`mx-auto flex w-full flex-col justify-center space-y-7 sm:w-[400px]`,children:[(0,X.jsx)(pn,{icon:c?void 0:s??(0,X.jsx)(En,{}),title:a,description:o}),(0,X.jsxs)(`div`,{className:`space-y-5`,children:[(0,X.jsx)(yn,{mode:`sign-up`,onProvidersResolved:e=>C(e)}),(0,X.jsxs)(`form`,{onSubmit:async r=>{if(r.preventDefault(),S(null),v!==b){S(w.passwordMismatchError);return}if(v.length<8){S(w.passwordTooShortError);return}try{if((await f(m,g,v))?.requiresVerification){t?.(g);return}e?.()}catch(e){let t=e instanceof Error?e:Error(String(e)),r=t.code;S(r&&d?.[r]||t.message),n?.(t)}},className:`space-y-4`,children:[te&&(0,X.jsx)(hn,{label:w.orText}),x&&(0,X.jsx)(mn,{message:x}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`label`,{htmlFor:`register-name`,className:Q,children:w.nameLabel}),(0,X.jsx)(`input`,{id:`register-name`,type:`text`,placeholder:w.namePlaceholder,value:m,onChange:e=>h(e.target.value),required:!0,autoComplete:`name`,disabled:p,className:Z})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`label`,{htmlFor:`register-email`,className:Q,children:w.emailLabel}),(0,X.jsx)(`input`,{id:`register-email`,type:`email`,placeholder:w.emailPlaceholder,value:g,onChange:e=>_(e.target.value),required:!0,autoComplete:`email`,disabled:p,className:Z})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`label`,{htmlFor:`register-password`,className:Q,children:w.passwordLabel}),(0,X.jsx)(`input`,{id:`register-password`,type:`password`,placeholder:w.passwordPlaceholder,value:v,onChange:e=>y(e.target.value),required:!0,minLength:8,autoComplete:`new-password`,disabled:p,className:Z})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`label`,{htmlFor:`register-confirm-password`,className:Q,children:w.confirmPasswordLabel}),(0,X.jsx)(`input`,{id:`register-confirm-password`,type:`password`,placeholder:w.confirmPasswordPlaceholder,value:b,onChange:e=>ee(e.target.value),required:!0,minLength:8,autoComplete:`new-password`,disabled:p,className:Z})]}),(0,X.jsxs)(`button`,{type:`submit`,disabled:p,className:un,children:[p&&(0,X.jsx)($,{}),p?w.submittingButton:w.submitButton]})]})]}),i&&(0,X.jsxs)(`p`,{className:`px-8 text-center text-sm text-muted-foreground`,children:[w.hasAccountText,` `,(0,X.jsx)(l,{href:i,className:`font-medium text-primary underline-offset-4 hover:underline focus-visible:outline-none focus-visible:underline`,children:w.signInText})]})]})}var On=({href:e,className:t,children:n})=>(0,X.jsx)(`a`,{href:e,className:t,children:n}),kn=()=>(0,X.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`h-6 w-6`,"aria-hidden":`true`,children:(0,X.jsx)(`path`,{d:`M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4`})});function An({onSuccess:e,onError:t,loginUrl:n=`/login`,title:i=`Reset your password`,description:a=`Enter your email address and we'll send you a link to reset your password`,icon:o,hideIcon:s=!1,linkComponent:c=On,labels:l={}}){let{forgotPassword:u,isLoading:d,getAuthConfig:f,requestPhonePasswordReset:p,resetPasswordWithPhoneOtp:m}=an(),[h,g]=(0,r.useState)(``),[_,v]=(0,r.useState)(null),[y,b]=(0,r.useState)(!1),[ee,x]=(0,r.useState)(!1),[S,te]=(0,r.useState)(`email`),[C,w]=(0,r.useState)(``),[ne,T]=(0,r.useState)(``),[E,D]=(0,r.useState)(``),[O,k]=(0,r.useState)(!1),[re,A]=(0,r.useState)(!1),[j,M]=(0,r.useState)(0),[ie,N]=(0,r.useState)(!1),[P,F]=(0,r.useState)(!1);(0,r.useEffect)(()=>{let e=!1;return Promise.resolve().then(()=>f()).then(t=>{e||x(t?.features?.phoneNumberOtp===!0)}).catch(()=>{}),()=>{e=!0}},[f]),(0,r.useEffect)(()=>{if(j<=0)return;let e=setTimeout(()=>M(e=>e>1?e-1:0),1e3);return()=>clearTimeout(e)},[j]);let I={emailLabel:l.emailLabel??`Email`,emailPlaceholder:l.emailPlaceholder??`name@example.com`,submitButton:l.submitButton??`Send Reset Link`,submittingButton:l.submittingButton??`Sending…`,successTitle:l.successTitle??`Check your email`,successDescription:l.successDescription??`We've sent a password reset link to {{email}}. Please check your inbox.`,backToSignInText:l.backToSignInText??`Back to sign in`,rememberPasswordText:l.rememberPasswordText??`Remember your password?`,signInText:l.signInText??`Sign in`,phoneLabel:l.phoneLabel??`Phone number`,phonePlaceholder:l.phonePlaceholder??`+1 555 000 0000`,otpCodeLabel:l.otpCodeLabel??`Verification code`,otpCodePlaceholder:l.otpCodePlaceholder??`6-digit code`,sendOtpButton:l.sendOtpButton??`Get code`,resendOtpCountdownText:l.resendOtpCountdownText??`Resend in {seconds}s`,newPasswordLabel:l.newPasswordLabel??`New password`,newPasswordPlaceholder:l.newPasswordPlaceholder??`Enter a new password`,resetButton:l.resetButton??`Reset Password`,usePhoneResetText:l.usePhoneResetText??`Reset via SMS code`,useEmailResetText:l.useEmailResetText??`Reset via email instead`,phoneSuccessTitle:l.phoneSuccessTitle??`Password reset`,phoneSuccessDescription:l.phoneSuccessDescription??`Your password has been reset. You can now sign in with your new password.`},ae=async n=>{n.preventDefault(),v(null);try{await u(h),b(!0),e?.()}catch(e){let n=e instanceof Error?e:Error(String(e));v(n.message),t?.(n)}},oe=async()=>{if(!(!C.trim()||O||j>0)){v(null),k(!0);try{await p(C.trim()),A(!0),M(60)}catch(e){let n=e instanceof Error?e:Error(String(e));v(n.message),t?.(n)}finally{k(!1)}}},L=async n=>{n.preventDefault(),v(null),F(!0);try{await m(C.trim(),ne.trim(),E),N(!0),e?.()}catch(e){let n=e instanceof Error?e:Error(String(e));v(n.message),t?.(n)}finally{F(!1)}},se=e=>{te(e),v(null)};if(ie)return(0,X.jsxs)(`div`,{className:`mx-auto flex w-full flex-col justify-center space-y-7 sm:w-[400px]`,children:[(0,X.jsx)(pn,{icon:(0,X.jsx)(`span`,{className:`flex h-12 w-12 items-center justify-center rounded-2xl bg-emerald-500/10 text-emerald-600 ring-1 ring-emerald-500/15 dark:text-emerald-400`,children:(0,X.jsx)(fn,{})}),title:I.phoneSuccessTitle,description:I.phoneSuccessDescription}),n&&(0,X.jsx)(`p`,{className:`text-center text-sm text-muted-foreground`,children:(0,X.jsxs)(c,{href:n,className:`font-medium text-primary underline-offset-4 hover:underline focus-visible:outline-none focus-visible:underline`,children:[`← `,I.backToSignInText]})})]});if(y){let e=I.successDescription.includes(`{{email}}`)?I.successDescription.replace(`{{email}}`,h):`${I.successDescription} ${h}`;return(0,X.jsxs)(`div`,{className:`mx-auto flex w-full flex-col justify-center space-y-7 sm:w-[400px]`,children:[(0,X.jsx)(pn,{icon:(0,X.jsx)(`span`,{className:`flex h-12 w-12 items-center justify-center rounded-2xl bg-emerald-500/10 text-emerald-600 ring-1 ring-emerald-500/15 dark:text-emerald-400`,children:(0,X.jsx)(fn,{})}),title:I.successTitle,description:e}),n&&(0,X.jsx)(`p`,{className:`text-center text-sm text-muted-foreground`,children:(0,X.jsxs)(c,{href:n,className:`font-medium text-primary underline-offset-4 hover:underline focus-visible:outline-none focus-visible:underline`,children:[`← `,I.backToSignInText]})})]})}return(0,X.jsxs)(`div`,{className:`mx-auto flex w-full flex-col justify-center space-y-7 sm:w-[400px]`,children:[(0,X.jsx)(pn,{icon:s?void 0:o??(0,X.jsx)(kn,{}),title:i,description:a}),S===`phone`?(0,X.jsxs)(`form`,{onSubmit:L,className:`space-y-4`,children:[_&&(0,X.jsx)(mn,{message:_}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`label`,{htmlFor:`forgot-phone`,className:Q,children:I.phoneLabel}),(0,X.jsx)(`input`,{id:`forgot-phone`,type:`tel`,placeholder:I.phonePlaceholder,value:C,onChange:e=>w(e.target.value),required:!0,autoComplete:`tel`,disabled:P,className:Z})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`label`,{htmlFor:`forgot-otp`,className:Q,children:I.otpCodeLabel}),(0,X.jsxs)(`div`,{className:`flex gap-2`,children:[(0,X.jsx)(`input`,{id:`forgot-otp`,type:`text`,inputMode:`numeric`,placeholder:I.otpCodePlaceholder,value:ne,onChange:e=>T(e.target.value),required:!0,autoComplete:`one-time-code`,disabled:P,className:Z}),(0,X.jsxs)(`button`,{type:`button`,onClick:oe,disabled:O||j>0||!C.trim()||P,className:`shrink-0 rounded-md border border-input bg-background px-3 py-2 text-sm font-medium transition-colors hover:bg-accent disabled:opacity-50`,children:[O&&(0,X.jsx)($,{}),j>0?I.resendOtpCountdownText.replace(`{seconds}`,String(j)):I.sendOtpButton]})]})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`label`,{htmlFor:`forgot-new-password`,className:Q,children:I.newPasswordLabel}),(0,X.jsx)(`input`,{id:`forgot-new-password`,type:`password`,placeholder:I.newPasswordPlaceholder,value:E,onChange:e=>D(e.target.value),required:!0,autoComplete:`new-password`,disabled:P,className:Z})]}),(0,X.jsxs)(`button`,{type:`submit`,disabled:P||!re,className:un,children:[P&&(0,X.jsx)($,{}),P?I.submittingButton:I.resetButton]}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>se(`email`),className:`w-full text-center text-xs text-muted-foreground underline-offset-4 transition-colors hover:text-primary hover:underline`,children:I.useEmailResetText})]}):(0,X.jsxs)(`form`,{onSubmit:ae,className:`space-y-4`,children:[_&&(0,X.jsx)(mn,{message:_}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`label`,{htmlFor:`forgot-email`,className:Q,children:I.emailLabel}),(0,X.jsx)(`input`,{id:`forgot-email`,type:`email`,placeholder:I.emailPlaceholder,value:h,onChange:e=>g(e.target.value),required:!0,autoComplete:`email`,disabled:d,className:Z})]}),(0,X.jsxs)(`button`,{type:`submit`,disabled:d,className:un,children:[d&&(0,X.jsx)($,{}),d?I.submittingButton:I.submitButton]}),ee&&(0,X.jsx)(`button`,{type:`button`,onClick:()=>se(`phone`),className:`w-full text-center text-xs text-muted-foreground underline-offset-4 transition-colors hover:text-primary hover:underline`,children:I.usePhoneResetText})]}),n&&(0,X.jsxs)(`p`,{className:`px-8 text-center text-sm text-muted-foreground`,children:[I.rememberPasswordText,` `,(0,X.jsx)(c,{href:n,className:`font-medium text-primary underline-offset-4 hover:underline focus-visible:outline-none focus-visible:underline`,children:I.signInText})]})]})}function jn(e){return e?e.name?e.name.split(` `).map(e=>e[0]).join(``).toUpperCase().slice(0,2):e.email?.[0]?.toUpperCase()??`?`:`?`}function Mn(e){if(!e)return!1;let t=e.objects;if(!t||typeof t!=`object`||Array.isArray(t))return!1;for(let e of Object.values(t))if(e&&typeof e==`object`&&!Array.isArray(e)&&`fields`in e)return!0;return!1}var Nn=[`apps`,`messages`,`validationMessages`,`dashboards`,`globalActions`];function Pn(e){let t={},n={},r={},i=e.objects;if(i)for(let[e,a]of Object.entries(i)){if(!a||typeof a!=`object`)continue;let i={};a.label&&(i.label=a.label),a.pluralLabel&&(i.pluralLabel=a.pluralLabel),a.description&&(i.description=a.description);for(let[e,t]of Object.entries(a))e.startsWith(`_`)&&(i[e]=t);if(t[e]=i,a.fields&&typeof a.fields==`object`){let t=Object.entries(a.fields);for(let[i,a]of t)a?.label&&(n[e]||(n[e]={}),n[e][i]=a.label),a?.options&&typeof a.options==`object`&&Object.keys(a.options).length>0&&(r[e]||(r[e]={}),r[e][i]=a.options)}}let a={};Object.keys(t).length>0&&(a.objects=t),Object.keys(n).length>0&&(a.fields=n),Object.keys(r).length>0&&(a.fieldOptions=r);for(let t of Nn)e[t]!==void 0&&(a[t]=e[t]);let o=new Set([`objects`,...Nn]);for(let[t,n]of Object.entries(e))o.has(t)||(a[t]=n);return{app:a}}var Fn=(0,r.createContext)(null);Fn.displayName=`PermissionContext`;var In=`/api/v1/auth/me/permissions`;function Ln({endpoint:e=In,initialPermissions:t,loadingFallback:n=null,errorFallback:i,children:a}){let[o,s]=(0,r.useState)(t??null),[c,l]=(0,r.useState)(null),[u,d]=(0,r.useState)(!t),f=(0,r.useCallback)(async()=>{d(!0),l(null);try{let t=await fetch(e,{credentials:`include`,headers:{Accept:`application/json`}});if(!t.ok)throw Error(`Permissions endpoint returned ${t.status}`);let n=await t.json();s(n)}catch(e){l(e instanceof Error?e:Error(String(e)))}finally{d(!1)}},[e]);(0,r.useEffect)(()=>{t||f()},[f,t]);let p=(0,r.useCallback)((e,t,n)=>{if(!o)return!1;let r=(e??``).toLowerCase(),i=`${r}.${t}`,a=o.fields?.[i]??o.fields?.[`${e}.${t}`];if(a)return n===`read`?a.readable!==!1:a.editable!==!1;let s=o.objects?.[r]??o.objects?.[e]??o.objects?.[`*`];return s?n===`read`?s.allowRead!==!1:s.allowEdit!==!1:!0},[o]),m=(0,r.useCallback)((e,t)=>{if(!o)return{allowed:!1,reason:`permissions-loading`};let n=o.objects?.[e]??o.objects?.[`*`],r={read:`allowRead`,view:`allowRead`,create:`allowCreate`,update:`allowEdit`,edit:`allowEdit`,delete:`allowDelete`}[t]??`allowRead`,i=!n||n[r]!==!1;return{allowed:i,reason:i?void 0:`denied-by-permission-set`}},[o]),h=(0,r.useCallback)(e=>{if(!o)return[];let t=`${e}.`,n=[];for(let[e,r]of Object.entries(o.fields??{})){if(!e.startsWith(t))continue;let i=e.slice(t.length);n.push({field:i,read:r.readable!==!1,write:r.editable!==!1})}return n},[o]),g=(0,r.useCallback)(()=>void 0,[]),_=(0,r.useMemo)(()=>({check:m,checkField:p,getFieldPermissions:h,getRowFilter:g,roles:o?.roles??[],systemPermissions:o?.systemPermissions??[],hasCapabilities:e=>{let t=new Set(o?.systemPermissions??[]);return e.every(e=>t.has(e))},isLoaded:!u&&!c&&o!==null}),[m,p,h,g,o,u,c]);return u&&!o?(0,X.jsx)(X.Fragment,{children:n}):c&&!o?i?(0,X.jsx)(X.Fragment,{children:i(c,f)}):(0,X.jsx)(X.Fragment,{children:n}):(0,X.jsx)(Fn.Provider,{value:_,children:a})}function Rn(){let e=(0,r.useContext)(Fn);return(0,r.useMemo)(()=>e?{...e,can:(t,n)=>e.check(t,n).allowed,cannot:(t,n)=>!e.check(t,n).allowed}:{check:()=>({allowed:!0}),checkField:()=>!0,getFieldPermissions:()=>[],getRowFilter:()=>void 0,roles:[],systemPermissions:[],hasCapabilities:()=>!0,isLoaded:!1,can:()=>!0,cannot:()=>!1},[e])}function zn(e){let{checkField:t,getFieldPermissions:n}=Rn(),i=(0,r.useMemo)(()=>n(e),[n,e]);return(0,r.useMemo)(()=>({permissions:i,canRead:n=>t(e,n,`read`),canWrite:n=>t(e,n,`write`),readableFields:n=>n.filter(n=>t(e,n,`read`)),writableFields:n=>n.filter(n=>t(e,n,`write`))}),[i,t,e])}export{Pn as a,Dn as c,ln as d,cn as f,Y as g,nn as h,Mn as i,wn as l,rn as m,Rn as n,jn as o,an as p,Ln as r,An as s,zn as t,mn as u};
|
package/dist/assets/{ishikawaDiagram-FXEZZL3T-DvmRhm8H.js → ishikawaDiagram-FXEZZL3T-DgMu6-jd.js}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import"./src-
|
|
1
|
+
import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import"./src-CKPhOIOh.js";import{H as t,K as n,U as r,a as i,c as a,s as o,v as s,w as c,x as l,y as u}from"./chunk-WYO6CB5R-C0_XZtpj.js";import{t as d}from"./chunk-VAUOI2AC-HYDQgaka.js";import{p as f}from"./chunk-ICXQ74PX-WsDRuBhL.js";import{t as p}from"./rough.esm-CSKSodPl.js";var m=(function(){var t=e(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[1,4],r=[1,14],i=[1,12],a=[1,13],o=[6,7,8],s=[1,20],c=[1,18],l=[1,19],u=[6,7,11],d=[1,6,13,14],f=[1,23],p=[1,24],m=[1,6,7,11,13,14],h={trace:e(function(){},`trace`),yy:{},symbols_:{error:2,start:3,ishikawa:4,spaceLines:5,SPACELINE:6,NL:7,ISHIKAWA:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,TEXT:14,$accept:0,$end:1},terminals_:{2:`error`,6:`SPACELINE`,7:`NL`,8:`ISHIKAWA`,11:`EOF`,13:`SPACELIST`,14:`TEXT`},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,1],[12,1],[12,1]],performAction:e(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 6:case 7:return r;case 15:r.addNode(a[s-1].length,a[s].trim());break;case 16:r.addNode(0,a[s].trim());break}},`anonymous`),table:[{3:1,4:2,5:3,6:[1,5],8:n},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:n},{6:r,7:[1,10],9:9,12:11,13:i,14:a},t(o,[2,3]),{1:[2,2]},t(o,[2,4]),t(o,[2,5]),{1:[2,6],6:r,12:15,13:i,14:a},{6:r,9:16,12:11,13:i,14:a},{6:s,7:c,10:17,11:l},t(u,[2,18],{14:[1,21]}),t(u,[2,16]),t(u,[2,17]),{6:s,7:c,10:22,11:l},{1:[2,7],6:r,12:15,13:i,14:a},t(d,[2,14],{7:f,11:p}),t(m,[2,8]),t(m,[2,9]),t(m,[2,10]),t(u,[2,15]),t(d,[2,13],{7:f,11:p}),t(m,[2,11]),t(m,[2,12])],defaultActions:{2:[2,1],6:[2,2]},parseError:e(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:e(function(t){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(t,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;typeof g.yy.parseError==`function`?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}e(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}e(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
|
|
2
2
|
`+h.showPosition()+`
|
|
3
3
|
Expecting `+j.join(`, `)+`, got '`+(this.terminals_[S]||S)+`'`:`Parse error on line `+(l+1)+`: Unexpected `+(S==p?`end of input`:`'`+(this.terminals_[S]||S)+`'`),this.parseError(M,{text:h.match,token:this.terminals_[S]||S,line:h.yylineno,loc:v,expected:j})}if(T[0]instanceof Array&&T.length>1)throw Error(`Parse Error: multiple actions possible at state: `+w+`, token: `+S);switch(T[0]){case 1:r.push(S),a.push(h.yytext),o.push(h.yylloc),r.push(T[1]),S=null,C?(S=C,C=null):(u=h.yyleng,c=h.yytext,l=h.yylineno,v=h.yylloc,d>0&&d--);break;case 2:if(k=this.productions_[T[1]][1],D.$=a[a.length-k],D._$={first_line:o[o.length-(k||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(k||1)].first_column,last_column:o[o.length-1].last_column},y&&(D._$.range=[o[o.length-(k||1)].range[0],o[o.length-1].range[1]]),E=this.performAction.apply(D,[c,u,l,g.yy,T[1],a,o].concat(m)),E!==void 0)return E;k&&(r=r.slice(0,-1*k*2),a=a.slice(0,-1*k),o=o.slice(0,-1*k)),r.push(this.productions_[T[1]][0]),a.push(D.$),o.push(D._$),A=s[r[r.length-2]][r[r.length-1]],r.push(A);break;case 3:return!0}}return!0},`parse`)};h.lexer=(function(){return{EOF:1,parseError:e(function(e,t){if(this.yy.parser)this.yy.parser.parseError(e,t);else throw Error(e)},`parseError`),setInput:e(function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=``,this.conditionStack=[`INITIAL`],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},`setInput`),input:e(function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},`input`),unput:e(function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},`unput`),more:e(function(){return this._more=!0,this},`more`),reject:e(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError(`Lexical error on line `+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:``,token:null,line:this.yylineno});return this},`reject`),less:e(function(e){this.unput(this.match.slice(e))},`less`),pastInput:e(function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?`...`:``)+e.substr(-20).replace(/\n/g,``)},`pastInput`),upcomingInput:e(function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?`...`:``)).replace(/\n/g,``)},`upcomingInput`),showPosition:e(function(){var e=this.pastInput(),t=Array(e.length+1).join(`-`);return e+this.upcomingInput()+`
|
|
5
|
-
`+t+`^`},`showPosition`),test_match:e(function(e,t){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),r=e[0].match(/(?:\r\n?|\n).*/g),r&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],n=this.performAction.call(this,this.yy,this,t,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},`test_match`),next:e(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var e,t,n,r;this._more||(this.yytext=``,this.match=``);for(var i=this._currentRules(),a=0;a<i.length;a++)if(n=this._input.match(this.rules[i[a]]),n&&(!t||n[0].length>t[0].length)){if(t=n,r=a,this.options.backtrack_lexer){if(e=this.test_match(n,i[a]),e!==!1)return e;if(this._backtrack){t=!1;continue}else return!1}else if(!this.options.flex)break}return t?(e=this.test_match(t,i[r]),e
|
|
5
|
+
`+t+`^`},`showPosition`),test_match:e(function(e,t){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),r=e[0].match(/(?:\r\n?|\n).*/g),r&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],n=this.performAction.call(this,this.yy,this,t,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},`test_match`),next:e(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var e,t,n,r;this._more||(this.yytext=``,this.match=``);for(var i=this._currentRules(),a=0;a<i.length;a++)if(n=this._input.match(this.rules[i[a]]),n&&(!t||n[0].length>t[0].length)){if(t=n,r=a,this.options.backtrack_lexer){if(e=this.test_match(n,i[a]),e!==!1)return e;if(this._backtrack){t=!1;continue}else return!1}else if(!this.options.flex)break}return t?(e=this.test_match(t,i[r]),e!==!1&&e):this._input===``?this.EOF:this.parseError(`Lexical error on line `+(this.yylineno+1)+`. Unrecognized text.
|
|
6
6
|
`+this.showPosition(),{text:``,token:null,line:this.yylineno})},`next`),lex:e(function(){return this.next()||this.lex()},`lex`),begin:e(function(e){this.conditionStack.push(e)},`begin`),popState:e(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},`popState`),_currentRules:e(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},`_currentRules`),topState:e(function(e){return e=this.conditionStack.length-1-Math.abs(e||0),e>=0?this.conditionStack[e]:`INITIAL`},`topState`),pushState:e(function(e){this.begin(e)},`pushState`),stateStackSize:e(function(){return this.conditionStack.length},`stateStackSize`),options:{"case-insensitive":!0},performAction:e(function(e,t,n,r){switch(n){case 0:return 6;case 1:return 8;case 2:return 8;case 3:return 6;case 4:return 7;case 5:return 13;case 6:return 14;case 7:return 11}},`anonymous`),rules:[/^(?:\s*%%.*)/i,/^(?:ishikawa-beta\b)/i,/^(?:ishikawa\b)/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[\s]+)/i,/^(?:[^\n]+)/i,/^(?:$)/i],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7],inclusive:!0}}}})();function g(){this.yy={}}return e(g,`Parser`),g.prototype=h,h.Parser=g,new g})();m.parser=m;var h=m,g=class{constructor(){this.stack=[],this.clear=this.clear.bind(this),this.addNode=this.addNode.bind(this),this.getRoot=this.getRoot.bind(this)}static{e(this,`IshikawaDB`)}clear(){this.root=void 0,this.stack=[],this.baseLevel=void 0,i()}getRoot(){return this.root}addNode(e,t){let r=o.sanitizeText(t,l());if(!this.root){this.root={text:r,children:[]},this.stack=[{level:0,node:this.root}],n(r);return}this.baseLevel??=e;let i=e-this.baseLevel+1;for(i<=0&&(i=1);this.stack.length>1&&this.stack[this.stack.length-1].level>=i;)this.stack.pop();let a=this.stack[this.stack.length-1].node,s={text:r,children:[]};a.children.push(s),this.stack.push({level:i,node:s})}getAccTitle(){return u()}setAccTitle(e){r(e)}getAccDescription(){return s()}setAccDescription(e){t(e)}getDiagramTitle(){return c()}setDiagramTitle(e){n(e)}},_=14,v=250,y=30,b=60,x=5,S=82*Math.PI/180,C=Math.cos(S),w=Math.sin(S),T=e((e,t,n)=>{let r=e.node().getBBox(),i=r.width+t*2,o=r.height+t*2;a(e,o,i,n),e.attr(`viewBox`,`${r.x-t} ${r.y-t} ${i} ${o}`)},`applyPaddedViewBox`),E=e((e,t,n,r)=>{let i=r.db.getRoot();if(!i)return;let a=l(),{look:o,handDrawnSeed:s,themeVariables:c}=a,u=f(a.fontSize)[0]??_,m=o===`handDrawn`,h=i.children??[],g=a.ishikawa?.diagramPadding??20,y=a.ishikawa?.useMaxWidth??!1,b=d(t),x=b.append(`g`).attr(`class`,`ishikawa`),S=m?p.svg(b.node()):void 0,C=S?{roughSvg:S,seed:s??0,lineColor:c?.lineColor??`#333`,fillColor:c?.mainBkg??`#fff`}:void 0,w=`ishikawa-arrow-${t}`;m||x.append(`defs`).append(`marker`).attr(`id`,w).attr(`viewBox`,`0 0 10 10`).attr(`refX`,0).attr(`refY`,5).attr(`markerWidth`,6).attr(`markerHeight`,6).attr(`orient`,`auto`).append(`path`).attr(`d`,`M 10 0 L 0 5 L 10 10 Z`).attr(`class`,`ishikawa-arrow`);let E=0,k=v,A=m?void 0:L(x,E,k,E,k,`ishikawa-spine`);if(O(x,E,k,i.text,u,C),!h.length){m&&L(x,E,k,E,k,`ishikawa-spine`,C),T(b,g,y);return}E-=20;let j=h.filter((e,t)=>t%2==0),N=h.filter((e,t)=>t%2==1),P=D(j),F=D(N),I=P.total+F.total,R=v,z=v;if(I>0){let e=v*2,t=v*.3;R=Math.max(t,e*(P.total/I)),z=Math.max(t,e*(F.total/I))}let B=u*2;R=Math.max(R,P.max*B),z=Math.max(z,F.max*B),k=Math.max(R,v),A&&A.attr(`y1`,k).attr(`y2`,k),x.select(`.ishikawa-head-group`).attr(`transform`,`translate(0,${k})`);let V=Math.ceil(h.length/2);for(let e=0;e<V;e++){let t=x.append(`g`).attr(`class`,`ishikawa-pair`);for(let[n,r,i]of[[h[e*2],-1,R],[h[e*2+1],1,z]])n&&M(t,n,E,k,r,i,u,C);E=t.selectAll(`text`).nodes().reduce((e,t)=>Math.min(e,t.getBBox().x),1/0)}if(m)L(x,E,k,0,k,`ishikawa-spine`,C);else{A.attr(`x1`,E);let e=`url(#${w})`;x.selectAll(`line.ishikawa-branch, line.ishikawa-sub-branch`).attr(`marker-start`,e)}T(b,g,y)},`draw`),D=e(t=>{let n=e(e=>e.children.reduce((e,t)=>e+1+n(t),0),`countDescendants`);return t.reduce((e,t)=>{let r=n(t);return e.total+=r,e.max=Math.max(e.max,r),e},{total:0,max:0})},`sideStats`),O=e((e,t,n,r,i,a)=>{let o=Math.max(6,Math.floor(110/(i*.6))),s=e.append(`g`).attr(`class`,`ishikawa-head-group`).attr(`transform`,`translate(${t},${n})`),c=F(s,P(r,o),0,0,`ishikawa-head-label`,`start`,i),l=c.node().getBBox(),u=Math.max(60,l.width+6),d=Math.max(40,l.height*2+40),f=`M 0 ${-d/2} L 0 ${d/2} Q ${u*2.4} 0 0 ${-d/2} Z`;if(a){let e=a.roughSvg.path(f,{roughness:1.5,seed:a.seed,fill:a.fillColor,fillStyle:`hachure`,fillWeight:2.5,hachureGap:5,stroke:a.lineColor,strokeWidth:2});s.insert(()=>e,`:first-child`).attr(`class`,`ishikawa-head`)}else s.insert(`path`,`:first-child`).attr(`class`,`ishikawa-head`).attr(`d`,f);c.attr(`transform`,`translate(${(u-l.width)/2-l.x+3},${-l.y-l.height/2})`)},`drawHead`),k=e((t,n)=>{let r=[],i=[],a=e((e,t,o)=>{let s=n===-1?[...e].reverse():e;for(let e of s){let n=r.length,s=e.children??[];r.push({depth:o,text:P(e.text,15),parentIndex:t,childCount:s.length}),o%2==0?(i.push(n),s.length&&a(s,n,o+1)):(s.length&&a(s,n,o+1),i.push(n))}},`walk`);return a(t,-1,2),{entries:r,yOrder:i}},`flattenTree`),A=e((e,t,n,r,i,a,o)=>{let s=e.append(`g`).attr(`class`,`ishikawa-label-group`),c=F(s,t,n,r+11*i,`ishikawa-label cause`,`middle`,a).node().getBBox();if(o){let e=o.roughSvg.rectangle(c.x-20,c.y-2,c.width+40,c.height+4,{roughness:1.5,seed:o.seed,fill:o.fillColor,fillStyle:`hachure`,fillWeight:2.5,hachureGap:5,stroke:o.lineColor,strokeWidth:2});s.insert(()=>e,`:first-child`).attr(`class`,`ishikawa-label-box`)}else s.insert(`rect`,`:first-child`).attr(`class`,`ishikawa-label-box`).attr(`x`,c.x-20).attr(`y`,c.y-2).attr(`width`,c.width+40).attr(`height`,c.height+4)},`drawCauseLabel`),j=e((e,t,n,r,i,a)=>{let o=Math.sqrt(r*r+i*i);if(o===0)return;let s=r/o,c=i/o,l=-c*6,u=s*6,d=t,f=n,p=`M ${d} ${f} L ${d-s*6*2+l} ${f-c*6*2+u} L ${d-s*6*2-l} ${f-c*6*2-u} Z`,m=a.roughSvg.path(p,{roughness:1,seed:a.seed,fill:a.lineColor,fillStyle:`solid`,stroke:a.lineColor,strokeWidth:1});e.append(()=>m)},`drawArrowMarker`),M=e((e,t,n,r,i,a,o,s)=>{let c=t.children??[],l=a*(c.length?1:.2),u=-C*l,d=w*l*i,f=n+u,p=r+d;if(L(e,n,r,f,p,`ishikawa-branch`,s),s&&j(e,n,r,n-f,r-p,s),A(e,t.text,f,p,i,o,s),!c.length)return;let{entries:m,yOrder:h}=k(c,i),g=m.length,_=Array(g);for(let[e,t]of h.entries())_[t]=r+d*((e+1)/(g+1));let v=new Map;v.set(-1,{x0:n,y0:r,x1:f,y1:p,childCount:c.length,childrenDrawn:0});let S=-C,T=w*i,E=i<0?`ishikawa-label up`:`ishikawa-label down`;for(let[t,n]of m.entries()){let r=_[t],i=v.get(n.parentIndex),a=e.append(`g`).attr(`class`,`ishikawa-sub-group`),c=0,l=0,u=0;if(n.depth%2==0){let e=i.y1-i.y0;c=I(i.x0,i.x1,e?(r-i.y0)/e:.5),l=r,u=c-(n.childCount>0?b+n.childCount*x:y),L(a,c,r,u,r,`ishikawa-sub-branch`,s),s&&j(a,c,r,1,0,s),F(a,n.text,u,r,`ishikawa-label align`,`end`,o)}else{let e=i.childrenDrawn++;c=I(i.x0,i.x1,(i.childCount-e)/(i.childCount+1)),l=i.y0,u=c+S*((r-l)/T),L(a,c,l,u,r,`ishikawa-sub-branch`,s),s&&j(a,c,l,c-u,l-r,s),F(a,n.text,u,r,E,`end`,o)}n.childCount>0&&v.set(t,{x0:c,y0:l,x1:u,y1:r,childCount:n.childCount,childrenDrawn:0})}},`drawBranch`),N=e(e=>e.split(/<br\s*\/?>|\n/),`splitLines`),P=e((e,t)=>{if(e.length<=t)return e;let n=[];for(let r of e.split(/\s+/)){let e=n.length-1;e>=0&&n[e].length+1+r.length<=t?n[e]+=` `+r:n.push(r)}return n.join(`
|
|
7
7
|
`)},`wrapText`),F=e((e,t,n,r,i,a,o)=>{let s=N(t),c=o*1.05,l=e.append(`text`).attr(`class`,i).attr(`text-anchor`,a).attr(`x`,n).attr(`y`,r-(s.length-1)*c/2);for(let[e,t]of s.entries())l.append(`tspan`).attr(`x`,n).attr(`dy`,e===0?0:c).text(t);return l},`drawMultilineText`),I=e((e,t,n)=>e+(t-e)*n,`lerp`),L=e((e,t,n,r,i,a,o)=>{if(o){let s=o.roughSvg.line(t,n,r,i,{roughness:1.5,seed:o.seed,stroke:o.lineColor,strokeWidth:2});e.append(()=>s).attr(`class`,a);return}return e.append(`line`).attr(`class`,a).attr(`x1`,t).attr(`y1`,n).attr(`x2`,r).attr(`y2`,i)},`drawLine`),R={parser:h,get db(){return new g},renderer:{draw:E},styles:e(e=>`
|
|
8
8
|
.ishikawa .ishikawa-spine,
|