@objectstack/console 15.0.0 → 15.1.1
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-CSP_T07G.js → AdapterProvider-BFaddpzn.js} +1 -1
- package/dist/assets/{AiPendingActionsPage-BNh8Cf9P.js → AiPendingActionsPage-CvBOdCmI.js} +1 -1
- package/dist/assets/ApiConsolePage-BETRFRmt.js +1 -0
- package/dist/assets/{AppDocsIndex-DFB1tmTx.js → AppDocsIndex-BYY7DwDn.js} +1 -1
- package/dist/assets/{AppManagementPage-D2jMv3L-.js → AppManagementPage-ct829ZDs.js} +1 -1
- package/dist/assets/ApprovalsInboxPage-CLRfOCfN.js +1 -0
- package/dist/assets/AuditLogPage-DrVbfMwo.js +1 -0
- package/dist/assets/{ComponentNavView-C8ngAwyN.js → ComponentNavView-BdBCf414.js} +1 -1
- package/dist/assets/CreateViewDialog-C1plmcyi.js +1 -0
- package/dist/assets/DashboardView-YwIvqU1F.js +1 -0
- package/dist/assets/{DeveloperHubPage-VBsID8Fk.js → DeveloperHubPage-Cv1WYOxY.js} +1 -1
- package/dist/assets/{DocShell-ChTlUxMm.js → DocShell-CLtiW77i.js} +1 -1
- package/dist/assets/ExpressionProvider-E8d0a2zy.js +1 -0
- package/dist/assets/FlowRunsPage-Kk2pQjuI.js +1 -0
- package/dist/assets/{IntegrationsPage-BR2TkAoB.js → IntegrationsPage-3Mmj9WPX.js} +2 -2
- package/dist/assets/InterfaceListPage-BEv_Whkh.js +1 -0
- package/dist/assets/ManagedByBadge-h6zYSYEw.js +1 -0
- package/dist/assets/MarketplaceAccessDenied-BBrk9Zzt.js +1 -0
- package/dist/assets/MarketplaceInstalledPage-Baul16n9.js +1 -0
- package/dist/assets/MarketplacePackagePage-C4BoxM9O.js +4 -0
- package/dist/assets/MarketplacePage-CIiUcu2P.js +1 -0
- package/dist/assets/MetadataInspector-Ty_bVFlI.js +1 -0
- package/dist/assets/MetadataProvider-Dw6hFBw2.js +1 -0
- package/dist/assets/ObjectDataPage-C0VN22jG.js +1 -0
- package/dist/assets/PageView-9Qd343Y8.js +1 -0
- package/dist/assets/ProfilePage-DotFPbJV.js +1 -0
- package/dist/assets/PublicFormsPage-DIXBuC2U.js +1 -0
- package/dist/assets/RecordDetailView-WbRO9Qfl.js +2 -0
- package/dist/assets/RecordFormPage-CVM9R6n6.js +1 -0
- package/dist/assets/ReportDefaultInspector-Dfj5Pq4K.js +3 -0
- package/dist/assets/ReportView-BuAo4KRU.js +2 -0
- package/dist/assets/SearchResultsPage-BXtahiUa.js +1 -0
- package/dist/assets/{SettingsHub-Begm6jy7.js → SettingsHub-Cbb36Ak1.js} +1 -1
- package/dist/assets/SettingsView-MqDu9fQ0.js +1 -0
- package/dist/assets/{SystemHubPage-C4J7Le-p.js → SystemHubPage-CRlHp6zs.js} +1 -1
- package/dist/assets/data-adapter-BaT0fWzy.js +9 -0
- package/dist/assets/framework-CavAJOoG.js +6 -0
- package/dist/assets/{getIcon-BZsP3YSU.js → getIcon-CJv2JJRu.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-BPN_aS-T.js → highlighted-body-OFNGDK62-CmEyqxRh.js} +1 -1
- package/dist/assets/i18n--Ef6MgVx.js +9 -0
- package/dist/assets/index-DwHOkKSZ.css +2 -0
- package/dist/assets/index-sUYxMYg4.js +2 -0
- package/dist/assets/infrastructure-1EBA2wrr.js +3 -0
- package/dist/assets/mermaid-GHXKKRXX-B608OHDp.js +1 -0
- package/dist/assets/metadata-admin-CaWsYPuu.js +25 -0
- package/dist/assets/plugin-calendar-lTyyzuqa.js +1 -0
- package/dist/assets/plugin-charts-CXDDqZeY.js +7 -0
- package/dist/assets/plugin-chatbot-CGYrsTXi.js +120 -0
- package/dist/assets/plugin-dashboard-oozFEUjN.js +6 -0
- package/dist/assets/plugin-form-Hw4-ReuX.js +1 -0
- package/dist/assets/plugin-gantt-DIrw5DOt.js +102 -0
- package/dist/assets/plugin-grid-QB7O_mff.js +8 -0
- package/dist/assets/plugin-kanban-C3U_tMs4.js +1 -0
- package/dist/assets/plugin-map-Lz3zZGqA.js +1 -0
- package/dist/assets/{plugin-markdown-DgBcCCgO.js → plugin-markdown-CeSEfSMe.js} +1 -1
- package/dist/assets/plugin-report-CMTOJSLw.js +59 -0
- package/dist/assets/plugin-timeline-CKcNCEwi.js +1 -0
- package/dist/assets/plugin-tree-BLG1qg4e.js +1 -0
- package/dist/assets/plugin-view-CwV64XEY.js +1 -0
- package/dist/assets/plugins-views-CoEgR96I.js +4 -0
- package/dist/assets/{skeletons-Bf9TL3pG.js → skeletons-DGSWW9zt.js} +1 -1
- package/dist/assets/src-1qbKZhoo.js +1 -0
- package/dist/assets/{src-C6-lrmoQ.js → src-2Uisncjb.js} +1 -1
- package/dist/assets/src-DXuM24AK.js +18 -0
- package/dist/assets/{types-033eBMjb.js → types-C7NHW0h6.js} +1 -1
- package/dist/assets/ui-components-CHaxvtjc.js +72 -0
- package/dist/assets/{ui-layout-FqyUicdD.js → ui-layout-BLgfeXIq.js} +1 -1
- package/dist/assets/{use-book-data-BThfYUpK.js → use-book-data-BwZnHc4z.js} +1 -1
- package/dist/assets/{useMetadata-D5f_5ULL.js → useMetadata-IV9x2kG3.js} +1 -1
- package/dist/assets/vendor-objectstack-BTM1m7k5.js +104 -0
- package/dist/index.html +4 -4
- package/package.json +1 -1
- package/dist/assets/ApiConsolePage-Btr9hRka.js +0 -1
- package/dist/assets/ApprovalsInboxPage-CT4IXwpE.js +0 -1
- package/dist/assets/AuditLogPage-BdYvwcAH.js +0 -1
- package/dist/assets/CreateViewDialog-DcjN_AhY.js +0 -1
- package/dist/assets/DashboardView-CLJM8Cfl.js +0 -1
- package/dist/assets/ExpressionProvider-CHaGm5wf.js +0 -1
- package/dist/assets/FlowRunsPage-DdOav-6T.js +0 -1
- package/dist/assets/InterfaceListPage-Ca4VNsGg.js +0 -1
- package/dist/assets/ManagedByBadge-Cdy82I7A.js +0 -1
- package/dist/assets/MarketplaceAccessDenied-B6Tg5g6l.js +0 -1
- package/dist/assets/MarketplaceInstalledPage-DBmVXCVz.js +0 -1
- package/dist/assets/MarketplacePackagePage-Mt1pHE8U.js +0 -4
- package/dist/assets/MarketplacePage-D9CLlhnk.js +0 -1
- package/dist/assets/MetadataInspector-Bqe7rY0S.js +0 -1
- package/dist/assets/MetadataProvider-DqPZ6rV2.js +0 -1
- package/dist/assets/ObjectDataPage-Cz_pMsIv.js +0 -1
- package/dist/assets/PageView-CLvQYEdi.js +0 -1
- package/dist/assets/ProfilePage-BDJLPRAf.js +0 -1
- package/dist/assets/PublicFormsPage-BRflG64R.js +0 -1
- package/dist/assets/RecordDetailView-w6IBQ1cm.js +0 -2
- package/dist/assets/RecordFormPage-inJKFR63.js +0 -1
- package/dist/assets/ReportDefaultInspector-BZaG6IPJ.js +0 -3
- package/dist/assets/ReportView-CSAIx2AR.js +0 -2
- package/dist/assets/SearchResultsPage-DsnzRV3B.js +0 -1
- package/dist/assets/SettingsView-C4UULiJk.js +0 -1
- package/dist/assets/data-adapter-Mo_lVy1U.js +0 -7
- package/dist/assets/framework-BL3BtpKU.js +0 -36
- package/dist/assets/i18n-BsjEVcp4.js +0 -9
- package/dist/assets/index-CRgNx-tU.js +0 -2
- package/dist/assets/index-D1n9Ue1P.css +0 -2
- package/dist/assets/infrastructure-Bc4DRENl.js +0 -3
- package/dist/assets/mermaid-GHXKKRXX-BBQimMyN.js +0 -1
- package/dist/assets/metadata-admin-DHwo5kSi.js +0 -23
- package/dist/assets/plugin-calendar-BTCkHFNk.js +0 -1
- package/dist/assets/plugin-charts-DugftiGR.js +0 -7
- package/dist/assets/plugin-chatbot-Cq19aZcF.js +0 -120
- package/dist/assets/plugin-dashboard-CaQs1s4M.js +0 -6
- package/dist/assets/plugin-form-6ug8Woph.js +0 -1
- package/dist/assets/plugin-gantt-SwenNrGL.js +0 -102
- package/dist/assets/plugin-grid-a0e-qAUn.js +0 -8
- package/dist/assets/plugin-kanban-B9xzSYs9.js +0 -1
- package/dist/assets/plugin-map-DnfptTJp.js +0 -1
- package/dist/assets/plugin-report-Dny_M7U-.js +0 -59
- package/dist/assets/plugin-timeline-8zgO0jxJ.js +0 -1
- package/dist/assets/plugin-tree-Bzgro7b4.js +0 -1
- package/dist/assets/plugin-view-DfJ5SCdu.js +0 -1
- package/dist/assets/plugins-views-CoobEMX4.js +0 -4
- package/dist/assets/src-BMWmj9Zz.js +0 -1
- package/dist/assets/src-CQwyy7m_.js +0 -18
- package/dist/assets/ui-components-Y3D5-fgK.js +0 -42
- package/dist/assets/vendor-objectstack-BjCqbVaM.js +0 -96
|
@@ -1,2 +0,0 @@
|
|
|
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-BL3BtpKU.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-Y3D5-fgK.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-CQwyy7m_.js";import"./plugin-form-6ug8Woph.js";import{k as ut}from"./RecordDetailView-w6IBQ1cm.js";import{r as dt}from"./plugin-chatbot-Cq19aZcF.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-B6Tg5g6l.js";import{a as vt,i as yt,o as bt}from"./plugin-grid-a0e-qAUn.js";import"./plugins-views-CoobEMX4.js";import"./plugin-view-DfJ5SCdu.js";import{n as H}from"./componentRegistry-ByxoJqMW.js";import{r as xt,t as St}from"./plugin-markdown-DgBcCCgO.js";import{t as U}from"./DocShell-ChTlUxMm.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-BThfYUpK.js";import{n as At}from"./src-BMWmj9Zz.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-C4J7Le-p.js`).then(e=>({default:e.SystemHubPage})),__vite__mapDeps([0,1]),import.meta.url)),Kt=(0,K.lazy)(()=>s(()=>import(`./AppManagementPage-D2jMv3L-.js`).then(e=>({default:e.AppManagementPage})),__vite__mapDeps([0,1]),import.meta.url)),qt=(0,K.lazy)(()=>s(()=>import(`./ProfilePage-BDJLPRAf.js`).then(e=>({default:e.ProfilePage})),__vite__mapDeps([0]),import.meta.url)),Jt=(0,K.lazy)(()=>s(()=>import(`./ApprovalsInboxPage-CT4IXwpE.js`).then(e=>({default:e.ApprovalsInboxPage})),__vite__mapDeps([0]),import.meta.url)),Yt=(0,K.lazy)(()=>s(()=>import(`./AiPendingActionsPage-BNh8Cf9P.js`).then(e=>({default:e.AiPendingActionsPage})),__vite__mapDeps([0]),import.meta.url)),Xt=(0,K.lazy)(()=>s(()=>import(`./AuditLogPage-BdYvwcAH.js`).then(e=>({default:e.AuditLogPage})),__vite__mapDeps([0]),import.meta.url)),Zt=(0,K.lazy)(()=>s(()=>import(`./SettingsHub-Begm6jy7.js`).then(e=>({default:e.SettingsHub})),__vite__mapDeps([0]),import.meta.url)),Qt=(0,K.lazy)(()=>s(()=>import(`./SettingsView-C4UULiJk.js`).then(e=>({default:e.SettingsView})),__vite__mapDeps([0]),import.meta.url)),$t=(0,K.lazy)(()=>s(()=>import(`./DeveloperHubPage-VBsID8Fk.js`).then(e=>({default:e.DeveloperHubPage})),__vite__mapDeps([0]),import.meta.url)),en=(0,K.lazy)(()=>s(()=>import(`./ApiConsolePage-Btr9hRka.js`).then(e=>({default:e.ApiConsolePage})),__vite__mapDeps([0,1]),import.meta.url)),tn=(0,K.lazy)(()=>s(()=>import(`./FlowRunsPage-DdOav-6T.js`).then(e=>({default:e.FlowRunsPage})),__vite__mapDeps([0,1]),import.meta.url)),nn=(0,K.lazy)(()=>s(()=>import(`./PublicFormsPage-BRflG64R.js`).then(e=>({default:e.PublicFormsPage})),__vite__mapDeps([0,1]),import.meta.url)),rn=(0,K.lazy)(()=>s(()=>import(`./IntegrationsPage-BR2TkAoB.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-DFB1tmTx.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-Btr9hRka.js`).then(e=>({default:e.ApiConsolePage})),__vite__mapDeps([0,1]),import.meta.url)),Xr=(0,K.lazy)(()=>s(()=>import(`./FlowRunsPage-DdOav-6T.js`).then(e=>({default:e.FlowRunsPage})),__vite__mapDeps([0,1]),import.meta.url)),Zr=(0,K.lazy)(()=>s(()=>import(`./PublicFormsPage-BRflG64R.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-CQwyy7m_.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-BDJLPRAf.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-DnfptTJp.js`).then(e=>e.t),__vite__mapDeps([0,2]),import.meta.url),{namespace:`plugin-map`,category:`view`}),E.registerLazy(`map`,()=>s(()=>import(`./plugin-map-DnfptTJp.js`).then(e=>e.t),__vite__mapDeps([0,2]),import.meta.url),{namespace:`view`,category:`view`}),E.registerLazy(`object-tree`,()=>s(()=>import(`./plugin-tree-Bzgro7b4.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`plugin-tree`,category:`view`}),E.registerLazy(`tree`,()=>s(()=>import(`./plugin-tree-Bzgro7b4.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-CaQs1s4M.js`).then(e=>e.t),__vite__mapDeps([0,1]),import.meta.url),{namespace:`plugin-dashboard`,category:`view`});E.registerLazy(`chart`,()=>s(()=>import(`./plugin-charts-DugftiGR.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-DugftiGR.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`plugin-charts`,category:`chart`});E.registerLazy(`object-gantt`,()=>s(()=>import(`./plugin-gantt-SwenNrGL.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`plugin-gantt`,category:`view`}),E.registerLazy(`gantt`,()=>s(()=>import(`./plugin-gantt-SwenNrGL.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`view`,category:`view`}),E.registerLazy(`markdown`,()=>s(()=>import(`./plugin-markdown-DgBcCCgO.js`).then(e=>e.n),__vite__mapDeps([0]),import.meta.url),{namespace:`plugin-markdown`,category:`display`}),E.registerLazy(`object-timeline`,()=>s(()=>import(`./plugin-timeline-8zgO0jxJ.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`plugin-timeline`,category:`view`}),E.registerLazy(`timeline`,()=>s(()=>import(`./plugin-timeline-8zgO0jxJ.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`view`,category:`view`}),E.registerLazy(`object-calendar`,()=>s(()=>import(`./plugin-calendar-BTCkHFNk.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`plugin-calendar`,category:`view`}),E.registerLazy(`calendar`,()=>s(()=>import(`./plugin-calendar-BTCkHFNk.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`view`,category:`view`}),E.registerLazy(`calendar-view`,()=>s(()=>import(`./plugin-calendar-BTCkHFNk.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`plugin-calendar`,category:`view`}),E.registerLazy(`object-kanban`,()=>s(()=>import(`./plugin-kanban-B9xzSYs9.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`plugin-kanban`,category:`view`}),E.registerLazy(`kanban`,()=>s(()=>import(`./plugin-kanban-B9xzSYs9.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-B9xzSYs9.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`plugin-kanban`,category:`view`});E.registerLazy(`report`,()=>s(()=>import(`./plugin-report-Dny_M7U-.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-Dny_M7U-.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,{})})})}))});
|