@lunora/studio 1.0.0-alpha.55 → 1.0.0-alpha.57
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/index.d.ts +5 -1
- package/dist/index.js +11 -11
- package/dist/mount.js +1 -1
- package/dist/packem_chunks/ApiTab.js +3 -3
- package/dist/packem_chunks/AuditPanel.js +4 -4
- package/dist/packem_chunks/ExportImportPanel.js +3 -3
- package/dist/packem_chunks/FileBrowser.js +3 -3
- package/dist/packem_chunks/FunctionRunner.js +2 -2
- package/dist/packem_chunks/FunctionStatsPanel.js +4 -4
- package/dist/packem_chunks/HealthPanel.js +3 -3
- package/dist/packem_chunks/InsightsPanel.js +4 -4
- package/dist/packem_chunks/LogsPanel.js +537 -89
- package/dist/packem_chunks/MailPanel.js +4 -4
- package/dist/packem_chunks/MetricsPanel.js +4 -4
- package/dist/packem_chunks/MigrationsPanel.js +4 -4
- package/dist/packem_chunks/PitrPanel.js +2 -2
- package/dist/packem_chunks/SchemaViewer.js +2 -2
- package/dist/packem_chunks/SecurityAdvisorPanel.js +3 -3
- package/dist/packem_chunks/SettingsPanel.js +3 -3
- package/dist/packem_chunks/SqlEditorPanel.js +5 -5
- package/dist/packem_chunks/TableEditor.js +3 -3
- package/dist/packem_chunks/agents-panel.js +4 -4
- package/dist/packem_chunks/analytics-panel.js +1 -1
- package/dist/packem_chunks/auth-config-panel.js +1 -1
- package/dist/packem_chunks/auth-sessions-panel.js +2 -2
- package/dist/packem_chunks/containers-panel.js +2 -2
- package/dist/packem_chunks/dashboards-panel.js +3 -3
- package/dist/packem_chunks/fanout-panel.js +3 -3
- package/dist/packem_chunks/flags-panel.js +3 -3
- package/dist/packem_chunks/issues-panel.js +321 -82
- package/dist/packem_chunks/kv-browser.js +3 -3
- package/dist/packem_chunks/log-drains-panel.js +1 -1
- package/dist/packem_chunks/organizations-panel.js +3 -3
- package/dist/packem_chunks/payments-panel.js +4 -4
- package/dist/packem_chunks/permissions-panel.js +4 -4
- package/dist/packem_chunks/queues-panel.js +4 -4
- package/dist/packem_chunks/rls-panel.js +3 -3
- package/dist/packem_chunks/schedule-panel.js +3 -3
- package/dist/packem_chunks/storage-rules-panel.js +3 -3
- package/dist/packem_chunks/subscriptions-panel.js +3 -3
- package/dist/packem_chunks/traces-panel.js +4 -4
- package/dist/packem_chunks/users-panel.js +3 -3
- package/dist/packem_chunks/vector-browser.js +1 -1
- package/dist/packem_chunks/workflows-panel.js +3 -3
- package/dist/packem_shared/{ADMIN_FUNCTIONS-C6TEeUiJ.js → ADMIN_FUNCTIONS-C1LXrovV.js} +4 -0
- package/dist/packem_shared/{ApiDocsPanel-CcC6ucbp.js → ApiDocsPanel-BBvinlRD.js} +2 -2
- package/dist/packem_shared/{ApiReferencePanel-Dd8pcswz.js → ApiReferencePanel-ChlRsAXU.js} +1 -1
- package/dist/packem_shared/{CommandPalette-BXV4eKf5.js → CommandPalette-BpkopP5f.js} +1 -1
- package/dist/packem_shared/{DataBrowser-BuFEPTiv.js → DataBrowser-BoinTGxr.js} +6 -6
- package/dist/packem_shared/{GlobalDataBrowser-D8h1fTL1.js → GlobalDataBrowser-BCaohHZ5.js} +3 -3
- package/dist/packem_shared/{HomePanel-2I1YZm0A.js → HomePanel-BpdGcW4L.js} +4 -4
- package/dist/packem_shared/{OpenRpcReferencePanel-CWaf0ZtX.js → OpenRpcReferencePanel-CIeQE1aE.js} +1 -1
- package/dist/packem_shared/{ScheduledJobs-Cz5Tr-M6.js → ScheduledJobs-BQzQo84k.js} +2 -2
- package/dist/packem_shared/{Studio-CCJBI2wP.js → Studio-BpnYw3lc.js} +4 -4
- package/dist/packem_shared/{StudioApp-Daeqxw2h.js → StudioApp-DRGVBnFx.js} +2 -2
- package/dist/packem_shared/{advisor-view-1RaDWED7.js → advisor-view-D95sN-wO.js} +1 -1
- package/dist/packem_shared/{data-grid-C9I16KWr.js → data-grid-BywzWfek.js} +1 -1
- package/dist/packem_shared/{error-alert-vIPQoN3Y.js → error-alert-D9uIFJUS.js} +1 -1
- package/dist/packem_shared/{grid-features-B_fZH4iQ.js → grid-features-ZOLhHKrR.js} +1 -1
- package/dist/packem_shared/{home-panel-DHHUtnKU.js → home-panel-Dmg4sNiv.js} +3 -3
- package/dist/packem_shared/{internal-zwBoOv24.js → internal-DzHCc2Rq.js} +10 -1
- package/dist/packem_shared/{reference-view-DUULLuOi.js → reference-view-DfXN7oWP.js} +1 -1
- package/dist/packem_shared/{result-chart-DZradBAS.js → result-chart-Bf9mbCIo.js} +1 -1
- package/dist/packem_shared/{select-UkNYCT3s.js → select-D9OwHEch.js} +1 -1
- package/dist/packem_shared/{studio-0479nrrm.js → studio-LL4iP8fZ.js} +3 -3
- package/dist/packem_shared/{table-list-sidebar-huX4VmgI.js → table-list-sidebar-gCE17v9B.js} +1 -1
- package/dist/packem_shared/{use-admin-query-BGJ010yZ.js → use-admin-query-C7JNuQp-.js} +1 -1
- package/dist/packem_shared/{use-async-submit-DGCtuDyz.js → use-async-submit-rnSk_jXl.js} +2 -2
- package/dist/standalone/{chunk-GVFODXW2.js → chunk-227DORM6.js} +1 -1
- package/dist/standalone/{chunk-RCSULEDU.js → chunk-27JTW53L.js} +1 -1
- package/dist/standalone/{chunk-RG4HLPM2.js → chunk-2BSDITP4.js} +1 -1
- package/dist/standalone/{chunk-D73WYMRU.js → chunk-2ICZ6HXQ.js} +1 -1
- package/dist/standalone/{chunk-EOE5NDMK.js → chunk-2TJVFKD2.js} +1 -1
- package/dist/standalone/{chunk-4AZYW2PI.js → chunk-2XUT4Z4W.js} +1 -1
- package/dist/standalone/{chunk-WOYQG5AM.js → chunk-2YTF6LJ6.js} +1 -1
- package/dist/standalone/{chunk-4F72YCTU.js → chunk-2YUYNNHQ.js} +1 -1
- package/dist/standalone/chunk-3HGNPZBN.js +1 -0
- package/dist/standalone/{chunk-N5FMEYSL.js → chunk-4Q66FL5S.js} +1 -1
- package/dist/standalone/{chunk-SPACAIAR.js → chunk-53J4JZ2D.js} +1 -1
- package/dist/standalone/{chunk-EPDC422O.js → chunk-67YMILPJ.js} +1 -1
- package/dist/standalone/{chunk-XCNYUUD6.js → chunk-AN4RKMKW.js} +1 -1
- package/dist/standalone/{chunk-W7ND56KZ.js → chunk-AYHAJL3Z.js} +1 -1
- package/dist/standalone/chunk-BIA2DLBR.js +1 -0
- package/dist/standalone/{chunk-S2G7OH5T.js → chunk-C7UZEQZ7.js} +2 -2
- package/dist/standalone/{chunk-3W4CSGDO.js → chunk-CENYZ5GF.js} +1 -1
- package/dist/standalone/{chunk-DVBY6YQK.js → chunk-CURAOCQJ.js} +1 -1
- package/dist/standalone/{chunk-FPKTXKPE.js → chunk-EFYZYQUA.js} +1 -1
- package/dist/standalone/{chunk-TTEEPVCN.js → chunk-EXNK5XAW.js} +1 -1
- package/dist/standalone/{chunk-FDWXYXOM.js → chunk-F2YMCQ6B.js} +1 -1
- package/dist/standalone/{chunk-JQPHZL2A.js → chunk-GF6GF6CF.js} +1 -1
- package/dist/standalone/{chunk-5XO36X4C.js → chunk-HBGS4SEX.js} +8 -8
- package/dist/standalone/{chunk-HNIDN3RX.js → chunk-HQ2CPGA4.js} +1 -1
- package/dist/standalone/{chunk-LJE6PGHD.js → chunk-IMVAYDPK.js} +1 -1
- package/dist/standalone/{chunk-CW7LZ4SR.js → chunk-J2DQ63SR.js} +1 -1
- package/dist/standalone/{chunk-VC2VDAUO.js → chunk-JM3ZISDM.js} +1 -1
- package/dist/standalone/{chunk-S5NTGHCG.js → chunk-JZLGLG4T.js} +1 -1
- package/dist/standalone/{chunk-G5CMK5GY.js → chunk-LABWKVKR.js} +1 -1
- package/dist/standalone/chunk-LFORIMS7.js +1 -0
- package/dist/standalone/{chunk-JHR3HKT5.js → chunk-LT2HPR6R.js} +2 -2
- package/dist/standalone/{chunk-MWH5LBNF.js → chunk-MBG7XWNH.js} +1 -1
- package/dist/standalone/chunk-MHGJUKCZ.js +1 -0
- package/dist/standalone/{chunk-ZUTFDG76.js → chunk-MJ4HATA2.js} +1 -1
- package/dist/standalone/{chunk-EIZG4GOM.js → chunk-N2E4TKRD.js} +1 -1
- package/dist/standalone/{chunk-CHNXZYAC.js → chunk-N5XX4HOL.js} +1 -1
- package/dist/standalone/{chunk-YS7NUMAN.js → chunk-NIC6UYAQ.js} +1 -1
- package/dist/standalone/{chunk-XG4TZSP4.js → chunk-NV5LO5I6.js} +1 -1
- package/dist/standalone/{chunk-VQ3YOUZB.js → chunk-OHCGUIOG.js} +1 -1
- package/dist/standalone/{chunk-G4GGGHEV.js → chunk-OPSAI5PZ.js} +1 -1
- package/dist/standalone/{chunk-YRE6TGXH.js → chunk-P7MZQ6VJ.js} +1 -1
- package/dist/standalone/{chunk-FBGC3RSU.js → chunk-PRHAIUWS.js} +1 -1
- package/dist/standalone/{chunk-LTCX3QOE.js → chunk-PYPWIYI2.js} +1 -1
- package/dist/standalone/{chunk-6LLFTVEI.js → chunk-QAW6AWOE.js} +1 -1
- package/dist/standalone/{chunk-XZWFP2GI.js → chunk-QVUQXJCT.js} +1 -1
- package/dist/standalone/{chunk-NAFKYFBZ.js → chunk-R4ALMCZA.js} +1 -1
- package/dist/standalone/{chunk-JGCRBFFO.js → chunk-RIZDNIW7.js} +1 -1
- package/dist/standalone/{chunk-IKVZUVHJ.js → chunk-S6PTK7Y2.js} +1 -1
- package/dist/standalone/{chunk-FXNS5NBY.js → chunk-SAQU44MF.js} +1 -1
- package/dist/standalone/{chunk-WA3DGSC2.js → chunk-T3R6VHAT.js} +1 -1
- package/dist/standalone/{chunk-AE3AKGOW.js → chunk-W3EYW2EA.js} +1 -1
- package/dist/standalone/{chunk-RDA4VTHI.js → chunk-WAX3RSAI.js} +1 -1
- package/dist/standalone/{chunk-FQUNSQLG.js → chunk-WMDH2CIZ.js} +1 -1
- package/dist/standalone/{chunk-SP7GSPKX.js → chunk-X34PHGZF.js} +1 -1
- package/dist/standalone/{chunk-PIB7VUVM.js → chunk-X3VAERRH.js} +1 -1
- package/dist/standalone/{chunk-Q3X7IMLF.js → chunk-XAGYDGI6.js} +1 -1
- package/dist/standalone/{chunk-OVSBLTAA.js → chunk-Y26ZIWUZ.js} +1 -1
- package/dist/standalone/{chunk-WCLFE2ZB.js → chunk-ZVQMTQYX.js} +1 -1
- package/dist/standalone/studio.js +1 -1
- package/dist/styles.css +1 -1
- package/package.json +3 -3
- package/dist/standalone/chunk-DWDILV2E.js +0 -1
- package/dist/standalone/chunk-EBTLTGG3.js +0 -1
- package/dist/standalone/chunk-G5RC7USY.js +0 -1
- package/dist/standalone/chunk-YNSFQKMM.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Q}from"./chunk-
|
|
1
|
+
import{a as Q}from"./chunk-2ICZ6HXQ.js";import"./chunk-XNJNSCLM.js";import{b as F}from"./chunk-2YUYNNHQ.js";import{a as O,b as $,c as j,d as S,e as n,f as c}from"./chunk-GTM65MVX.js";import{a as B,e as D}from"./chunk-Y572GMZE.js";import{b as k}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as L}from"./chunk-MHGJUKCZ.js";import"./chunk-C7UZEQZ7.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as _}from"./chunk-TAD43CG5.js";import{d as U}from"./chunk-HBGS4SEX.js";import"./chunk-ZXLEXF4X.js";import{a as R,e as M,g as z,h as J}from"./chunk-RRCPZMC2.js";var q=M(z(),1);var l=M(J(),1);var V=["read","insert","update","delete"],K=R((e,s)=>({delete:e("Delete"),insert:e("Insert"),read:e("Read"),update:e("Update")})[s],"operationLabel"),W=R(e=>{let s=new Map;for(let t of e){let r=s.get(t.table)??{operations:new Set,procedures:[],table:t.table};r.operations.add(t.on),r.procedures.includes(t.procedure)||r.procedures.push(t.procedure),s.set(t.table,r)}return[...s.values()].toSorted((t,r)=>t.table.localeCompare(r.table))},"groupByTable"),ie=R(()=>{let e=(0,q.c)(49),s=U(),t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t={},e[0]=t):t=e[0];let{data:r,error:C,errorSource:I}=F(L.rlsPolicies,t),f=r!==void 0,p,d,m,a,u,h,v,b,o;if(e[1]!==r||e[2]!==C||e[3]!==I||e[4]!==f||e[5]!==s){let G=W(Array.isArray(r?.policies)?r.policies:[]),P;e[15]!==r?(P=Array.isArray(r?.roles)?r.roles:[],e[15]=r,e[16]=P):P=e[16],d=P,v="flex flex-col gap-6",b="lunora-rls-panel",e[17]!==C||e[18]!==I?(o=C!==null&&(0,l.jsxDEV)(Q,{error:I,testId:"rls-error"},void 0,!1),e[17]=C,e[18]=I,e[19]=o):o=e[19],h="flex flex-col gap-2",p=B,m="overflow-hidden py-0";let A;e[20]!==s?(A=s("Policies"),e[20]=s,e[21]=A):A=e[21],e[22]!==A?(a=(0,l.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,l.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:A},void 0,!1)},void 0,!1),e[22]=A,e[23]=a):a=e[23],u=f&&G.length===0?(0,l.jsxDEV)(_,{description:s("No `definePolicy` is wired through `.use(rls(...))` in this deployment. Add one to guard a table's rows."),testId:"rls-policies-empty",title:s("No policies defined")},void 0,!1):(0,l.jsxDEV)(D,{className:"px-0",children:(0,l.jsxDEV)(O,{"data-testid":"rls-policies-table",children:[(0,l.jsxDEV)($,{children:(0,l.jsxDEV)(S,{children:[(0,l.jsxDEV)(n,{children:s("Table")},void 0,!1),V.map(i=>(0,l.jsxDEV)(n,{children:K(s,i)},i,!1)),(0,l.jsxDEV)(n,{children:s("Guarded by")},void 0,!1)]},void 0,!0)},void 0,!1),(0,l.jsxDEV)(j,{children:G.map(i=>(0,l.jsxDEV)(S,{"data-testid":`rls-table-${i.table}`,children:[(0,l.jsxDEV)(c,{className:"font-mono text-xs",children:i.table},void 0,!1),V.map(H=>(0,l.jsxDEV)(c,{children:i.operations.has(H)?(0,l.jsxDEV)(k,{variant:"secondary",children:s("Guarded")},void 0,!1):(0,l.jsxDEV)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"},void 0,!1)},H,!1)),(0,l.jsxDEV)(c,{className:"font-mono text-xs text-muted-foreground",children:i.procedures.join(", ")},void 0,!1)]},i.table,!0))},void 0,!1)]},void 0,!0)},void 0,!1),e[1]=r,e[2]=C,e[3]=I,e[4]=f,e[5]=s,e[6]=p,e[7]=d,e[8]=m,e[9]=a,e[10]=u,e[11]=h,e[12]=v,e[13]=b,e[14]=o}else p=e[6],d=e[7],m=e[8],a=e[9],u=e[10],h=e[11],v=e[12],b=e[13],o=e[14];let x;e[24]!==p||e[25]!==m||e[26]!==a||e[27]!==u?(x=(0,l.jsxDEV)(p,{className:m,children:[a,u]},void 0,!0),e[24]=p,e[25]=m,e[26]=a,e[27]=u,e[28]=x):x=e[28];let N;e[29]!==h||e[30]!==x?(N=(0,l.jsxDEV)("section",{className:h,children:x},void 0,!1),e[29]=h,e[30]=x,e[31]=N):N=e[31];let y;e[32]!==s?(y=s("Roles"),e[32]=s,e[33]=y):y=e[33];let g;e[34]!==y?(g=(0,l.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,l.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:y},void 0,!1)},void 0,!1),e[34]=y,e[35]=g):g=e[35];let T;e[36]!==f||e[37]!==d||e[38]!==s?(T=f&&d.length===0?(0,l.jsxDEV)(_,{description:s("No `defineRole` is registered via `rls(policies, { roles })`. Roles back `ctx.auth.can(...)` permission checks."),testId:"rls-roles-empty",title:s("No roles defined")},void 0,!1):(0,l.jsxDEV)(D,{className:"px-0",children:(0,l.jsxDEV)(O,{"data-testid":"rls-roles-table",children:[(0,l.jsxDEV)($,{children:(0,l.jsxDEV)(S,{children:[(0,l.jsxDEV)(n,{children:s("Role")},void 0,!1),(0,l.jsxDEV)(n,{children:s("Description")},void 0,!1),(0,l.jsxDEV)(n,{children:s("Permissions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,l.jsxDEV)(j,{children:d.map(Y)},void 0,!1)]},void 0,!0)},void 0,!1),e[36]=f,e[37]=d,e[38]=s,e[39]=T):T=e[39];let w;e[40]!==g||e[41]!==T?(w=(0,l.jsxDEV)("section",{className:"flex flex-col gap-2",children:(0,l.jsxDEV)(B,{className:"overflow-hidden py-0",children:[g,T]},void 0,!0)},void 0,!1),e[40]=g,e[41]=T,e[42]=w):w=e[42];let E;return e[43]!==w||e[44]!==v||e[45]!==b||e[46]!==o||e[47]!==N?(E=(0,l.jsxDEV)("div",{className:v,"data-testid":b,children:[o,N,w]},void 0,!0),e[43]=w,e[44]=v,e[45]=b,e[46]=o,e[47]=N,e[48]=E):E=e[48],E},"RlsPanel");function X(e){return(0,l.jsxDEV)(k,{variant:"outline",children:e},e,!1)}R(X,"_temp");function Y(e){return(0,l.jsxDEV)(S,{"data-testid":`rls-role-${e.name}`,children:[(0,l.jsxDEV)(c,{className:"font-mono text-xs",children:e.name},void 0,!1),(0,l.jsxDEV)(c,{className:"text-muted-foreground",children:e.description??""},void 0,!1),(0,l.jsxDEV)(c,{children:e.permissions.length===0?(0,l.jsxDEV)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"},void 0,!1):(0,l.jsxDEV)("span",{className:"flex flex-wrap gap-1",children:e.permissions.map(X)},void 0,!1)},void 0,!1)]},e.name,!0)}R(Y,"_temp2");export{ie as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _={assignIssue:"__lunora_admin__:assignIssue",clearCapturedMail:"__lunora_admin__:clearCapturedMail",clearQueueMessages:"__lunora_admin__:clearQueueMessages",clearTable:"__lunora_admin__:clearTable",createWorkflowInstance:"__lunora_admin__:createWorkflowInstance",deleteRows:"__lunora_admin__:deleteRows",describeTable:"__lunora_admin__:describeTable",describeTables:"__lunora_admin__:describeTables",exportShard:"__lunora_admin__:exportShard",facetColumn:"__lunora_admin__:facetColumn",getAdvisories:"__lunora_admin__:getAdvisories",getAuditLog:"__lunora_admin__:getAuditLog",getAuthMetrics:"__lunora_admin__:getAuthMetrics",getCapturedMail:"__lunora_admin__:getCapturedMail",getFanoutMetrics:"__lunora_admin__:getFanoutMetrics",getFunctionStats:"__lunora_admin__:getFunctionStats",getIssues:"__lunora_admin__:getIssues",listFlags:"__lunora_admin__:listFlags",listQueues:"__lunora_admin__:listQueues",listSubscriptions:"__lunora_admin__:listSubscriptions",listTableIndexes:"__lunora_admin__:listTableIndexes",listWorkflows:"__lunora_admin__:listWorkflows",getLogs:"__lunora_admin__:getLogs",getMetricSeries:"__lunora_admin__:getMetricSeries",getMetrics:"__lunora_admin__:getMetrics",getPitrBookmark:"__lunora_admin__:getPitrBookmark",getQueueMessages:"__lunora_admin__:getQueueMessages",getRequestLog:"__lunora_admin__:getRequestLog",getSecurityAudit:"__lunora_admin__:getSecurityAudit",getSettings:"__lunora_admin__:getSettings",getTraces:"__lunora_admin__:getTraces",getWorkflowInstanceStatus:"__lunora_admin__:getWorkflowInstanceStatus",ignoreIssue:"__lunora_admin__:ignoreIssue",importShard:"__lunora_admin__:importShard",listTables:"__lunora_admin__:listTables",maskPolicies:"__lunora_admin__:maskPolicies",migrationStatus:"__lunora_admin__:migrationStatus",pitrRestore:"__lunora_admin__:pitrRestore",readTablePage:"__lunora_admin__:readTablePage",replayQueueMessage:"__lunora_admin__:replayQueueMessage",resolveIssue:"__lunora_admin__:resolveIssue",rlsPolicies:"__lunora_admin__:rlsPolicies",runAs:"__lunora_admin__:runAs",runMigration:"__lunora_admin__:runMigration",runSql:"__lunora_admin__:runSql",sendQueueMessage:"__lunora_admin__:sendQueueMessage",sendTestMail:"__lunora_admin__:sendTestMail",setIssueSeverity:"__lunora_admin__:setIssueSeverity",storageOrphans:"__lunora_admin__:storageOrphans",storageReferences:"__lunora_admin__:storageReferences",storageRules:"__lunora_admin__:storageRules",studioFeatures:"__lunora_admin__:studioFeatures",writeRow:"__lunora_admin__:writeRow"};export{_ as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as ae}from"./chunk-4F72YCTU.js";import{a as $,b as F,c as D,d as p,e as l,f as i}from"./chunk-GTM65MVX.js";import{a as R,e as _}from"./chunk-Y572GMZE.js";import{a as se}from"./chunk-VLXV72QE.js";import{R as te}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as T}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-CKSHCYGC.js";import{a as K}from"./chunk-EBTLTGG3.js";import{f as Q}from"./chunk-S2G7OH5T.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as B}from"./chunk-TAD43CG5.js";import{d as V,f as X,g as Y,h as E,l as W}from"./chunk-5XO36X4C.js";import"./chunk-ZXLEXF4X.js";import{a as r,e as ee,f as re,h as le}from"./chunk-RRCPZMC2.js";var n=ee(re(),1);var e=ee(le(),1);var ie=["queued","running","paused","waiting","complete","errored","terminated"],ne=["pause","resume","terminate"],de="WORKFLOWS_NOT_CONFIGURED",ce=r(c=>typeof c=="object"&&c!==null&&c.code===de,"isNotConfigured"),fe=r(c=>{let s=c.error??c.output;if(s===void 0)return"\u2014";try{return JSON.stringify(s)}catch{return"(unserializable)"}},"formatStepPayload"),ue=r(({loadDetail:c,loadInstances:s,readOnly:y,runAction:L,workflowName:v})=>{let A=Q(),o=V(),[x,N]=(0,n.useState)(null),[k,I]=(0,n.useState)(null),[w,P]=(0,n.useState)(""),[g,h]=(0,n.useState)(null),[U,S]=(0,n.useState)(!1),[z,J]=(0,n.useState)(null),m=c??(a=>A.getWorkflowInstance(a)),O=y?void 0:L??(s===void 0?a=>A.setWorkflowInstanceStatus(a):void 0),j=r(async()=>{h(null),S(!1);let a=w===""?void 0:w;try{if(s===void 0){let d=await A.listWorkflowInstances({name:v,status:a});if(d.configured===!1){N(null),S(!0);return}N(d.instances);return}N(await s({name:v,status:a}))}catch(d){N(null),ce(d)?S(!0):h(E(d))}},"load");(0,n.useEffect)(()=>{I(null),W(j())},[v,w]);let G=r(async a=>{h(null);try{I(await m({id:a,name:v}))}catch(d){h(E(d))}},"openDetail"),H=r(async(a,d)=>{if(O!==void 0){J(a),h(null);try{await O({action:d,id:a,name:v}),await j()}catch(M){h(E(M))}finally{J(null)}}},"act");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,e.jsxDEV)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-medium",children:o("Instance history")},void 0,!1),(0,e.jsxDEV)("select",{"aria-label":o("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:r(a=>{P(a.target.value)},"onChange"),value:w,children:[(0,e.jsxDEV)("option",{value:"",children:o("All statuses")},void 0,!1),ie.map(a=>(0,e.jsxDEV)("option",{value:a,children:a},a,!1))]},void 0,!0)]},void 0,!0),g!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:g},void 0,!1),U&&(0,e.jsxDEV)(B,{description:o("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:o("Workflow inspection not configured")},void 0,!1),!U&&x!==null&&x.length===0&&(0,e.jsxDEV)(B,{description:o("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:o("No instances")},void 0,!1),x!==null&&x.length>0&&(0,e.jsxDEV)(R,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(_,{className:"px-0",children:(0,e.jsxDEV)($,{"data-testid":"workflow-instances-table",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:o("Instance id")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Status")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Created")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Ended")},void 0,!1),(0,e.jsxDEV)(l,{"aria-label":o("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:x.map(a=>(0,e.jsxDEV)(p,{"data-testid":`workflow-instance-${a.id}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:a.id},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:a.status},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground tabular-nums",children:a.createdOn??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground tabular-nums",children:a.endedOn??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"text-right",children:(0,e.jsxDEV)("div",{className:"flex justify-end gap-1.5",children:[(0,e.jsxDEV)(T,{"data-testid":`workflow-instance-steps-${a.id}`,onClick:r(()=>{W(G(a.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:o("Steps")},void 0,!1),O!==void 0&&ne.map(d=>(0,e.jsxDEV)(T,{"data-testid":`workflow-instance-${d}-${a.id}`,disabled:z===a.id,onClick:r(()=>{W(H(a.id,d))},"onClick"),size:"sm",type:"button",variant:"ghost",children:o(d)},d,!1))]},void 0,!0)},void 0,!1)]},a.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),k!==null&&(0,e.jsxDEV)(R,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,e.jsxDEV)(_,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,e.jsxDEV)("div",{className:"flex items-center justify-between",children:[(0,e.jsxDEV)("span",{className:"font-mono text-xs",children:[o("Steps")," \xB7 ",k.id]},void 0,!0),(0,e.jsxDEV)(T,{"data-testid":"workflow-instance-detail-close",onClick:r(()=>{I(null)},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Close")},void 0,!1)]},void 0,!0),k.steps.length===0?(0,e.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:o("This instance has no recorded steps yet.")},void 0,!1):(0,e.jsxDEV)($,{"data-testid":"workflow-instance-steps",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:o("Step")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Type")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Attempts")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Started")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Output")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:k.steps.map((a,d)=>(0,e.jsxDEV)(p,{"data-testid":`workflow-step-${String(d)}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:a.name},void 0,!1),(0,e.jsxDEV)(i,{className:"text-xs text-muted-foreground",children:a.type??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"tabular-nums",children:a.attempts??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground tabular-nums",children:a.start??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:fe(a)},void 0,!1)]},`${a.name}:${String(d)}`,!0))},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1)]},void 0,!0)},"WorkflowInstanceHistory"),me=X(K.createWorkflowInstance),ve=X(K.getWorkflowInstanceStatus),he=r(c=>{if(c.error)return`${c.error.name}: ${c.error.message}`;if(c.output===void 0)return"\u2014";try{return JSON.stringify(c.output)}catch{return"(unserializable)"}},"formatPayload"),Oe=r(()=>{let c=Q(),s=V(),{data:y,error:L}=ae(K.listWorkflows,{}),[v,A]=(0,n.useState)(""),[o,x]=(0,n.useState)(""),[N,k]=(0,n.useState)(""),[I,w]=(0,n.useState)(!1),[P,g]=(0,n.useState)(null),[h,U]=(0,n.useState)([]),[S,z]=(0,n.useState)(null),J=y!==void 0,m=(0,n.useMemo)(()=>Array.isArray(y?.workflows)?[...y.workflows].toSorted((t,u)=>t.exportName.localeCompare(u.exportName)):[],[y]),C=(0,n.useMemo)(()=>m.some(t=>t.exportName===v)?v:m[0]?.exportName??"",[m,v]),q=(0,n.useMemo)(()=>m.find(t=>t.exportName===C),[m,C]),O=r(t=>{U(u=>{let f=u.filter(b=>!(b.exportName===t.exportName&&b.id===t.id));return[t,...f]})},"upsertInstance"),j=r(async()=>{let t=C;if(t==="")return;let u,f=N.trim();if(f!=="")try{u=JSON.parse(f)}catch{g(s("Params must be valid JSON"));return}w(!0),g(null);try{let b=o.trim(),Z=await c.query(me,{exportName:t,id:b===""?void 0:b,params:u},Y(""));O({exportName:t,id:Z.id,status:Z.status}),x("")}catch(b){g(E(b))}finally{w(!1)}},"start"),G=r(()=>{W(j())},"startInstance"),H=r(async(t,u)=>{z(u);try{let f=await c.query(ve,{exportName:t,id:u},Y(""));O({error:f.error,exportName:t,id:f.id,output:f.output,status:f.status})}catch(f){g(E(f))}finally{z(null)}},"refreshInstance"),a=r(t=>{A(t.target.value)},"onSelectedExportChange"),d=r(t=>{x(t.target.value)},"onInstanceIdChange"),M=r(t=>{k(t.target.value)},"onParamsChange"),oe=r(t=>{let{export:u,id:f}=t.currentTarget.dataset;u!==void 0&&f!==void 0&&W(H(u,f))},"onRefreshClick");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[L!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:L},void 0,!1),(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:s("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")},void 0,!1),J&&m.length===0?(0,e.jsxDEV)(B,{description:s("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:s("No workflows defined")},void 0,!1):(0,e.jsxDEV)(R,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(_,{className:"px-0",children:(0,e.jsxDEV)($,{"data-testid":"workflows-table",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:s("Export")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Name")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Class")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Binding")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:m.map(t=>(0,e.jsxDEV)(p,{"data-testid":`workflows-row-${t.exportName}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:t.exportName},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.name},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.className},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.binding},void 0,!1)]},t.exportName,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),m.length>0&&(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-medium",children:s("Start instance")},void 0,!1),P!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:P},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)("select",{"aria-label":s("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:a,value:C,children:m.map(t=>(0,e.jsxDEV)("option",{value:t.exportName,children:t.exportName},t.exportName,!1))},void 0,!1),(0,e.jsxDEV)(te,{"aria-label":s("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:d,placeholder:s("Instance id (optional)"),value:o},void 0,!1),(0,e.jsxDEV)(T,{"data-testid":"workflows-start-button",disabled:I||C==="",onClick:G,children:s(I?"Starting\u2026":"Start instance")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)(se,{"aria-label":s("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:M,placeholder:s("Params (JSON, optional)"),value:N},void 0,!1)]},void 0,!0),h.length>0&&(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-medium",children:s("Instances")},void 0,!1),(0,e.jsxDEV)(R,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(_,{className:"px-0",children:(0,e.jsxDEV)($,{"data-testid":"workflows-instances-table",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:s("Workflow")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Instance id")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Status")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Output")},void 0,!1),(0,e.jsxDEV)(l,{},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:h.map(t=>(0,e.jsxDEV)(p,{"data-testid":`workflows-instance-${t.id}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:t.exportName},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.id},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:t.status},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:he(t)},void 0,!1),(0,e.jsxDEV)(i,{children:(0,e.jsxDEV)(T,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:S===t.id,onClick:oe,size:"xs",variant:"outline",children:S===t.id?s("Refreshing\u2026"):s("Refresh")},void 0,!1)},void 0,!1)]},`${t.exportName}:${t.id}`,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),q!==void 0&&(0,e.jsxDEV)(ue,{workflowName:q.name},void 0,!1)]},void 0,!0)},"WorkflowsPanel");export{Oe as default};
|
|
1
|
+
import{b as ae}from"./chunk-2YUYNNHQ.js";import{a as $,b as F,c as D,d as p,e as l,f as i}from"./chunk-GTM65MVX.js";import{a as R,e as _}from"./chunk-Y572GMZE.js";import{a as se}from"./chunk-VLXV72QE.js";import{R as te}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as T}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-CKSHCYGC.js";import{a as K}from"./chunk-MHGJUKCZ.js";import{f as Q}from"./chunk-C7UZEQZ7.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as B}from"./chunk-TAD43CG5.js";import{d as V,f as X,g as Y,h as E,m as W}from"./chunk-HBGS4SEX.js";import"./chunk-ZXLEXF4X.js";import{a as r,e as ee,f as re,h as le}from"./chunk-RRCPZMC2.js";var n=ee(re(),1);var e=ee(le(),1);var ie=["queued","running","paused","waiting","complete","errored","terminated"],ne=["pause","resume","terminate"],de="WORKFLOWS_NOT_CONFIGURED",ce=r(c=>typeof c=="object"&&c!==null&&c.code===de,"isNotConfigured"),fe=r(c=>{let s=c.error??c.output;if(s===void 0)return"\u2014";try{return JSON.stringify(s)}catch{return"(unserializable)"}},"formatStepPayload"),ue=r(({loadDetail:c,loadInstances:s,readOnly:y,runAction:L,workflowName:v})=>{let A=Q(),o=V(),[x,N]=(0,n.useState)(null),[k,I]=(0,n.useState)(null),[w,P]=(0,n.useState)(""),[g,h]=(0,n.useState)(null),[U,S]=(0,n.useState)(!1),[z,J]=(0,n.useState)(null),m=c??(a=>A.getWorkflowInstance(a)),O=y?void 0:L??(s===void 0?a=>A.setWorkflowInstanceStatus(a):void 0),j=r(async()=>{h(null),S(!1);let a=w===""?void 0:w;try{if(s===void 0){let d=await A.listWorkflowInstances({name:v,status:a});if(d.configured===!1){N(null),S(!0);return}N(d.instances);return}N(await s({name:v,status:a}))}catch(d){N(null),ce(d)?S(!0):h(E(d))}},"load");(0,n.useEffect)(()=>{I(null),W(j())},[v,w]);let G=r(async a=>{h(null);try{I(await m({id:a,name:v}))}catch(d){h(E(d))}},"openDetail"),H=r(async(a,d)=>{if(O!==void 0){J(a),h(null);try{await O({action:d,id:a,name:v}),await j()}catch(M){h(E(M))}finally{J(null)}}},"act");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,e.jsxDEV)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-medium",children:o("Instance history")},void 0,!1),(0,e.jsxDEV)("select",{"aria-label":o("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:r(a=>{P(a.target.value)},"onChange"),value:w,children:[(0,e.jsxDEV)("option",{value:"",children:o("All statuses")},void 0,!1),ie.map(a=>(0,e.jsxDEV)("option",{value:a,children:a},a,!1))]},void 0,!0)]},void 0,!0),g!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:g},void 0,!1),U&&(0,e.jsxDEV)(B,{description:o("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:o("Workflow inspection not configured")},void 0,!1),!U&&x!==null&&x.length===0&&(0,e.jsxDEV)(B,{description:o("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:o("No instances")},void 0,!1),x!==null&&x.length>0&&(0,e.jsxDEV)(R,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(_,{className:"px-0",children:(0,e.jsxDEV)($,{"data-testid":"workflow-instances-table",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:o("Instance id")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Status")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Created")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Ended")},void 0,!1),(0,e.jsxDEV)(l,{"aria-label":o("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:x.map(a=>(0,e.jsxDEV)(p,{"data-testid":`workflow-instance-${a.id}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:a.id},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:a.status},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground tabular-nums",children:a.createdOn??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground tabular-nums",children:a.endedOn??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"text-right",children:(0,e.jsxDEV)("div",{className:"flex justify-end gap-1.5",children:[(0,e.jsxDEV)(T,{"data-testid":`workflow-instance-steps-${a.id}`,onClick:r(()=>{W(G(a.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:o("Steps")},void 0,!1),O!==void 0&&ne.map(d=>(0,e.jsxDEV)(T,{"data-testid":`workflow-instance-${d}-${a.id}`,disabled:z===a.id,onClick:r(()=>{W(H(a.id,d))},"onClick"),size:"sm",type:"button",variant:"ghost",children:o(d)},d,!1))]},void 0,!0)},void 0,!1)]},a.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),k!==null&&(0,e.jsxDEV)(R,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,e.jsxDEV)(_,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,e.jsxDEV)("div",{className:"flex items-center justify-between",children:[(0,e.jsxDEV)("span",{className:"font-mono text-xs",children:[o("Steps")," \xB7 ",k.id]},void 0,!0),(0,e.jsxDEV)(T,{"data-testid":"workflow-instance-detail-close",onClick:r(()=>{I(null)},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Close")},void 0,!1)]},void 0,!0),k.steps.length===0?(0,e.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:o("This instance has no recorded steps yet.")},void 0,!1):(0,e.jsxDEV)($,{"data-testid":"workflow-instance-steps",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:o("Step")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Type")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Attempts")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Started")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Output")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:k.steps.map((a,d)=>(0,e.jsxDEV)(p,{"data-testid":`workflow-step-${String(d)}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:a.name},void 0,!1),(0,e.jsxDEV)(i,{className:"text-xs text-muted-foreground",children:a.type??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"tabular-nums",children:a.attempts??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground tabular-nums",children:a.start??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:fe(a)},void 0,!1)]},`${a.name}:${String(d)}`,!0))},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1)]},void 0,!0)},"WorkflowInstanceHistory"),me=X(K.createWorkflowInstance),ve=X(K.getWorkflowInstanceStatus),he=r(c=>{if(c.error)return`${c.error.name}: ${c.error.message}`;if(c.output===void 0)return"\u2014";try{return JSON.stringify(c.output)}catch{return"(unserializable)"}},"formatPayload"),Oe=r(()=>{let c=Q(),s=V(),{data:y,error:L}=ae(K.listWorkflows,{}),[v,A]=(0,n.useState)(""),[o,x]=(0,n.useState)(""),[N,k]=(0,n.useState)(""),[I,w]=(0,n.useState)(!1),[P,g]=(0,n.useState)(null),[h,U]=(0,n.useState)([]),[S,z]=(0,n.useState)(null),J=y!==void 0,m=(0,n.useMemo)(()=>Array.isArray(y?.workflows)?[...y.workflows].toSorted((t,u)=>t.exportName.localeCompare(u.exportName)):[],[y]),C=(0,n.useMemo)(()=>m.some(t=>t.exportName===v)?v:m[0]?.exportName??"",[m,v]),q=(0,n.useMemo)(()=>m.find(t=>t.exportName===C),[m,C]),O=r(t=>{U(u=>{let f=u.filter(b=>!(b.exportName===t.exportName&&b.id===t.id));return[t,...f]})},"upsertInstance"),j=r(async()=>{let t=C;if(t==="")return;let u,f=N.trim();if(f!=="")try{u=JSON.parse(f)}catch{g(s("Params must be valid JSON"));return}w(!0),g(null);try{let b=o.trim(),Z=await c.query(me,{exportName:t,id:b===""?void 0:b,params:u},Y(""));O({exportName:t,id:Z.id,status:Z.status}),x("")}catch(b){g(E(b))}finally{w(!1)}},"start"),G=r(()=>{W(j())},"startInstance"),H=r(async(t,u)=>{z(u);try{let f=await c.query(ve,{exportName:t,id:u},Y(""));O({error:f.error,exportName:t,id:f.id,output:f.output,status:f.status})}catch(f){g(E(f))}finally{z(null)}},"refreshInstance"),a=r(t=>{A(t.target.value)},"onSelectedExportChange"),d=r(t=>{x(t.target.value)},"onInstanceIdChange"),M=r(t=>{k(t.target.value)},"onParamsChange"),oe=r(t=>{let{export:u,id:f}=t.currentTarget.dataset;u!==void 0&&f!==void 0&&W(H(u,f))},"onRefreshClick");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[L!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:L},void 0,!1),(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:s("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")},void 0,!1),J&&m.length===0?(0,e.jsxDEV)(B,{description:s("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:s("No workflows defined")},void 0,!1):(0,e.jsxDEV)(R,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(_,{className:"px-0",children:(0,e.jsxDEV)($,{"data-testid":"workflows-table",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:s("Export")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Name")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Class")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Binding")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:m.map(t=>(0,e.jsxDEV)(p,{"data-testid":`workflows-row-${t.exportName}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:t.exportName},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.name},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.className},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.binding},void 0,!1)]},t.exportName,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),m.length>0&&(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-medium",children:s("Start instance")},void 0,!1),P!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:P},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)("select",{"aria-label":s("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:a,value:C,children:m.map(t=>(0,e.jsxDEV)("option",{value:t.exportName,children:t.exportName},t.exportName,!1))},void 0,!1),(0,e.jsxDEV)(te,{"aria-label":s("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:d,placeholder:s("Instance id (optional)"),value:o},void 0,!1),(0,e.jsxDEV)(T,{"data-testid":"workflows-start-button",disabled:I||C==="",onClick:G,children:s(I?"Starting\u2026":"Start instance")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)(se,{"aria-label":s("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:M,placeholder:s("Params (JSON, optional)"),value:N},void 0,!1)]},void 0,!0),h.length>0&&(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-medium",children:s("Instances")},void 0,!1),(0,e.jsxDEV)(R,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(_,{className:"px-0",children:(0,e.jsxDEV)($,{"data-testid":"workflows-instances-table",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:s("Workflow")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Instance id")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Status")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Output")},void 0,!1),(0,e.jsxDEV)(l,{},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:h.map(t=>(0,e.jsxDEV)(p,{"data-testid":`workflows-instance-${t.id}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:t.exportName},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.id},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:t.status},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:he(t)},void 0,!1),(0,e.jsxDEV)(i,{children:(0,e.jsxDEV)(T,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:S===t.id,onClick:oe,size:"xs",variant:"outline",children:S===t.id?s("Refreshing\u2026"):s("Refresh")},void 0,!1)},void 0,!1)]},`${t.exportName}:${t.id}`,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),q!==void 0&&(0,e.jsxDEV)(ue,{workflowName:q.name},void 0,!1)]},void 0,!0)},"WorkflowsPanel");export{Oe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as le}from"./chunk-N7SVJOHN.js";import{a as oe}from"./chunk-FQUNSQLG.js";import{a as se}from"./chunk-2K47A3P6.js";import{a as ae}from"./chunk-D73WYMRU.js";import"./chunk-XNJNSCLM.js";import{b as Z}from"./chunk-4F72YCTU.js";import{a as re}from"./chunk-FDWXYXOM.js";import{b as te}from"./chunk-4PC7IXNY.js";import"./chunk-2MLA6WFH.js";import{R as J}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import"./chunk-O3NAGRTR.js";import{b as G}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as ee}from"./chunk-EBTLTGG3.js";import"./chunk-S2G7OH5T.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as X}from"./chunk-TAD43CG5.js";import{d as Q,p as Y}from"./chunk-5XO36X4C.js";import"./chunk-ZXLEXF4X.js";import{a as S,e as q,f as de,g as ce,h as fe,j as z}from"./chunk-RRCPZMC2.js";var V=q(ce(),1),K=q(de(),1);var s=q(fe(),1);var me=.5,ne=S(o=>Math.min(100,Math.max(0,o)),"clampPercent"),ue=S((o,e)=>{if(!Number.isFinite(e)||e<=0)return{leftPercent:0,widthPercent:100};let r=ne(o.offsetMs/e*100),a=o.durationMs/e*100,t=Math.max(me,Math.min(ne(a),100-r));return{leftPercent:r,widthPercent:t}},"spanBar"),he=S((o,e)=>{let r=e.trim().toLowerCase();return r===""?[...o]:o.filter(a=>a.rootName.toLowerCase().includes(r)||a.functionPath.toLowerCase().includes(r))},"filterTraces"),U=S(o=>Number.isFinite(o)?o>0&&o<1?`${o.toFixed(2)}ms`:`${String(Math.round(o))}ms`:"\u2014","formatSpanDuration"),pe=14,ge=S(o=>Array.isArray(o?.traces)?o.traces:[],"tracesOf"),ve=S(o=>{let e=(0,V.c)(50),{span:r,traceDurationMs:a}=o,t=Q(),f;e[0]!==r||e[1]!==a?(f=ue(r,a),e[0]=r,e[1]=a,e[2]=f):f=e[2];let{leftPercent:u,widthPercent:_}=f,k;e[3]!==r.attributes?(k=le(r.attributes),e[3]=r.attributes,e[4]=k):k=e[4];let T=k,M=r.depth*pe,h;e[5]!==M?(h={paddingLeft:M},e[5]=M,e[6]=h):h=e[6];let x=h,b=`${String(u)}%`,n=`${String(_)}%`,l;e[7]!==b||e[8]!==n?(l={left:b,width:n},e[7]=b,e[8]=n,e[9]=l):l=e[9];let p=l,I=r.depth,i;e[10]!==r.ok||e[11]!==t?(i=r.ok?null:(0,s.jsxDEV)("span",{"aria-label":t("Errored span"),className:"mr-1 text-destructive","data-testid":"tr-span-error",role:"img",children:"\u25CF"},void 0,!1),e[10]=r.ok,e[11]=t,e[12]=i):i=e[12];let w;e[13]!==x||e[14]!==r.name||e[15]!==i?(w=(0,s.jsxDEV)("span",{className:"w-56 shrink-0 truncate",role:"gridcell",style:x,title:r.name,children:[i,r.name]},void 0,!0),e[13]=x,e[14]=r.name,e[15]=i,e[16]=w):w=e[16];let d;e[17]!==r.durationMs||e[18]!==r.offsetMs||e[19]!==t?(d=t("starts {offset} in, runs {duration}",{duration:U(r.durationMs),offset:U(r.offsetMs)}),e[17]=r.durationMs,e[18]=r.offsetMs,e[19]=t,e[20]=d):d=e[20];let N=r.ok?"bg-primary/70":"bg-destructive",c;e[21]!==N?(c=z("absolute inset-y-0 rounded-sm",N),e[21]=N,e[22]=c):c=e[22];let g;e[23]!==p||e[24]!==u||e[25]!==c||e[26]!==_?(g=(0,s.jsxDEV)("span",{className:c,"data-left":u,"data-testid":"tr-span-bar","data-width":_,style:p},void 0,!1),e[23]=p,e[24]=u,e[25]=c,e[26]=_,e[27]=g):g=e[27];let y;e[28]!==d||e[29]!==g?(y=(0,s.jsxDEV)("span",{"aria-label":d,className:"relative h-3 flex-1 overflow-hidden rounded-sm bg-muted",role:"gridcell",children:g},void 0,!1),e[28]=d,e[29]=g,e[30]=y):y=e[30];let m;e[31]!==r.durationMs?(m=U(r.durationMs),e[31]=r.durationMs,e[32]=m):m=e[32];let v;e[33]!==m?(v=(0,s.jsxDEV)("span",{className:"w-16 shrink-0 text-right tabular-nums text-muted-foreground",role:"gridcell",children:m},void 0,!1),e[33]=m,e[34]=v):v=e[34];let E;e[35]!==r.error?(E=r.error===void 0?null:(0,s.jsxDEV)("span",{className:"text-destructive","data-testid":"tr-span-error-message",title:r.error.message,children:`${r.error.type}: ${r.error.message}`},void 0,!1),e[35]=r.error,e[36]=E):E=e[36];let P;e[37]!==E?(P=(0,s.jsxDEV)("span",{className:"w-64 shrink-0 truncate text-muted-foreground",role:"gridcell",children:E},void 0,!1),e[37]=E,e[38]=P):P=e[38];let A;e[39]!==T?(A=T===""?null:(0,s.jsxDEV)("span",{"data-testid":"tr-span-attributes",title:T,children:T},void 0,!1),e[39]=T,e[40]=A):A=e[40];let C;e[41]!==A?(C=(0,s.jsxDEV)("span",{className:"w-64 shrink-0 truncate text-muted-foreground",role:"gridcell",children:A},void 0,!1),e[41]=A,e[42]=C):C=e[42];let $;return e[43]!==r.depth||e[44]!==w||e[45]!==y||e[46]!==v||e[47]!==P||e[48]!==C?($=(0,s.jsxDEV)("div",{className:"flex items-center gap-2 border-b border-border px-3 py-1.5 font-mono text-xs last:border-b-0 hover:bg-muted/50","data-depth":I,"data-testid":"tr-span-row",role:"row",children:[w,y,v,P,C]},void 0,!0),e[43]=r.depth,e[44]=w,e[45]=y,e[46]=v,e[47]=P,e[48]=C,e[49]=$):$=e[49],$},"SpanRow"),xe=S(o=>{let e=(0,V.c)(50),{expanded:r,onToggle:a,trace:t}=o,f=Q(),u;e[0]!==a||e[1]!==t.traceId?(u=S(()=>{a(t.traceId)},"t1"),e[0]=a,e[1]=t.traceId,e[2]=u):u=e[2];let _=u,k=`tr-row-${t.traceId}`,T=`tr-waterfall-${t.traceId}`,M=`tr-toggle-${t.traceId}`,h=r?"\u25BE":"\u25B8",x;e[3]!==h?(x=(0,s.jsxDEV)("span",{"aria-hidden":"true",className:"w-3 shrink-0 text-xs text-muted-foreground",children:h},void 0,!1),e[3]=h,e[4]=x):x=e[4];let b;e[5]!==t.rootName?(b=(0,s.jsxDEV)("span",{className:"w-56 shrink-0 truncate text-sm font-medium",title:t.rootName,children:t.rootName},void 0,!1),e[5]=t.rootName,e[6]=b):b=e[6];let n;e[7]!==t.functionPath?(n=(0,s.jsxDEV)("span",{className:"w-48 shrink-0 truncate font-mono text-xs text-muted-foreground",title:t.functionPath,children:t.functionPath},void 0,!1),e[7]=t.functionPath,e[8]=n):n=e[8];let l;e[9]!==t.durationMs?(l=U(t.durationMs),e[9]=t.durationMs,e[10]=l):l=e[10];let p;e[11]!==l?(p=(0,s.jsxDEV)("span",{className:"w-20 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground",children:l},void 0,!1),e[11]=l,e[12]=p):p=e[12];let I;e[13]!==f||e[14]!==t.spans.length?(I=f("{count} spans",{count:t.spans.length}),e[13]=f,e[14]=t.spans.length,e[15]=I):I=e[15];let i;e[16]!==I?(i=(0,s.jsxDEV)("span",{className:"w-20 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground",children:I},void 0,!1),e[16]=I,e[17]=i):i=e[17];let w=t.ok?"secondary":"destructive",d;e[18]!==f||e[19]!==t.ok?(d=t.ok?f("ok"):f("error"),e[18]=f,e[19]=t.ok,e[20]=d):d=e[20];let N;e[21]!==w||e[22]!==d?(N=(0,s.jsxDEV)("span",{className:"shrink-0",children:(0,s.jsxDEV)(G,{variant:w,children:d},void 0,!1)},void 0,!1),e[21]=w,e[22]=d,e[23]=N):N=e[23];let c;e[24]!==t.startTs?(c=Y(t.startTs),e[24]=t.startTs,e[25]=c):c=e[25];let g;e[26]!==c?(g=(0,s.jsxDEV)("span",{className:"flex-1 truncate text-right font-mono text-xs tabular-nums text-muted-foreground",children:c},void 0,!1),e[26]=c,e[27]=g):g=e[27];let y;e[28]!==r||e[29]!==_||e[30]!==p||e[31]!==i||e[32]!==N||e[33]!==g||e[34]!==T||e[35]!==M||e[36]!==x||e[37]!==b||e[38]!==n?(y=(0,s.jsxDEV)("button",{"aria-controls":T,"aria-expanded":r,className:"flex w-full items-center gap-3 px-3 py-2 text-left hover:bg-muted/50","data-testid":M,onClick:_,type:"button",children:[x,b,n,p,i,N,g]},void 0,!0),e[28]=r,e[29]=_,e[30]=p,e[31]=i,e[32]=N,e[33]=g,e[34]=T,e[35]=M,e[36]=x,e[37]=b,e[38]=n,e[39]=y):y=e[39];let m;e[40]!==r||e[41]!==f||e[42]!==t.durationMs||e[43]!==t.spans||e[44]!==t.traceId?(m=r&&(0,s.jsxDEV)("div",{"aria-label":f("Trace waterfall"),className:"bg-muted/20","data-testid":`tr-waterfall-${t.traceId}`,id:`tr-waterfall-${t.traceId}`,role:"grid",children:t.spans.map(E=>(0,s.jsxDEV)(ve,{span:E,traceDurationMs:t.durationMs},E.spanId,!1))},void 0,!1),e[40]=r,e[41]=f,e[42]=t.durationMs,e[43]=t.spans,e[44]=t.traceId,e[45]=m):m=e[45];let v;return e[46]!==y||e[47]!==m||e[48]!==k?(v=(0,s.jsxDEV)("div",{className:"border-b border-border last:border-b-0","data-testid":k,children:[y,m]},void 0,!0),e[46]=y,e[47]=m,e[48]=k,e[49]=v):v=e[49],v},"TraceRow"),Ae=S(o=>{let e=(0,V.c)(43),{initialShardKey:r}=o,a=Q(),[t,f]=(0,K.useState)(r??""),[u,_]=(0,K.useState)(""),[k,T]=(0,K.useState)(be),M;e[0]!==t?(M=t.trim(),e[0]=t,e[1]=M):M=e[1];let h=se(M,400),x;e[2]===Symbol.for("react.memo_cache_sentinel")?(x={},e[2]=x):x=e[2];let b;e[3]!==h?(b={live:!0,shardKey:h},e[3]=h,e[4]=b):b=e[4];let{data:n,error:l,errorSource:p,isLoading:I,liveError:i}=Z(ee.getTraces,x,b),w,d;e[5]!==n||e[6]!==h?(w=S(()=>{n!==void 0&&te(h)},"t4"),d=[n,h],e[5]=n,e[6]=h,e[7]=w,e[8]=d):(w=e[7],d=e[8]),(0,K.useEffect)(w,d);let N;if(e[9]!==n||e[10]!==l||e[11]!==p||e[12]!==k||e[13]!==I||e[14]!==i||e[15]!==u||e[16]!==t||e[17]!==a){let c=ge(n),g=n?.total??c.length,y=g>c.length,m=he(c,u),v;e[19]===Symbol.for("react.memo_cache_sentinel")?(v=S(L=>{_(L.target.value)},"t7"),e[19]=v):v=e[19];let E=v,P;e[20]===Symbol.for("react.memo_cache_sentinel")?(P=S(L=>{T(ie=>{let H=new Set(ie);return H.has(L)?H.delete(L):H.add(L),H})},"t8"),e[20]=P):P=e[20];let A=P,C=l===null&&m.length===0&&!I,$;e[21]!==t?($=(0,s.jsxDEV)(re,{onChange:f,testId:"tr-shard-input",value:t},void 0,!1),e[21]=t,e[22]=$):$=e[22];let R;e[23]!==a?(R=a("Search traces"),e[23]=a,e[24]=R):R=e[24];let B;e[25]!==a?(B=a("search trace or function"),e[25]=a,e[26]=B):B=e[26];let D;e[27]!==u||e[28]!==R||e[29]!==B?(D=(0,s.jsxDEV)(J,{"aria-label":R,className:"h-8 w-56","data-testid":"tr-search",onChange:E,placeholder:B,value:u},void 0,!1),e[27]=u,e[28]=R,e[29]=B,e[30]=D):D=e[30];let F;e[31]!==i?(F=(0,s.jsxDEV)(oe,{message:i,prefix:"tr"},void 0,!1),e[31]=i,e[32]=F):F=e[32];let j;e[33]!==D||e[34]!==F||e[35]!==$?(j=(0,s.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[$,D,F]},void 0,!0),e[33]=D,e[34]=F,e[35]=$,e[36]=j):j=e[36];let O;e[37]!==l||e[38]!==p?(O=l!==null&&(0,s.jsxDEV)(ae,{error:p,testId:"tr-error"},void 0,!1),e[37]=l,e[38]=p,e[39]=O):O=e[39];let W;e[40]!==C||e[41]!==a?(W=C&&(0,s.jsxDEV)(X,{description:a("Traces recorded with ctx.trace show up here as your app handles traffic. The span buffer resets when the shard hibernates."),icon:(0,s.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,s.jsxDEV)("path",{d:"M4 6h10M7 12h13M10 18h7"},void 0,!1)},void 0,!1),testId:"tr-empty",title:a("No traces")},void 0,!1),e[40]=C,e[41]=a,e[42]=W):W=e[42],N=(0,s.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-traces-panel",children:[j,O,W,l===null&&y&&(0,s.jsxDEV)("p",{className:"text-xs text-muted-foreground","data-testid":"tr-truncated",children:a("Showing the {shown} most recent of {total} traces in the buffer.",{shown:c.length,total:g})},void 0,!1),l===null&&m.length>0&&(0,s.jsxDEV)("div",{"aria-label":a("Recent traces"),className:"overflow-hidden rounded-xl border border-border shadow-xs","data-testid":"tr-list",children:m.map(L=>(0,s.jsxDEV)(xe,{expanded:k.has(L.traceId),onToggle:A,trace:L},L.traceId,!1))},void 0,!1)]},void 0,!0),e[9]=n,e[10]=l,e[11]=p,e[12]=k,e[13]=I,e[14]=i,e[15]=u,e[16]=t,e[17]=a,e[18]=N}else N=e[18];return N},"TracesPanel");function be(){return new Set}S(be,"_temp");export{Ae as TracesPanel};
|
|
1
|
+
import{a as le}from"./chunk-N7SVJOHN.js";import{a as oe}from"./chunk-WMDH2CIZ.js";import{a as se}from"./chunk-2K47A3P6.js";import{a as ae}from"./chunk-2ICZ6HXQ.js";import"./chunk-XNJNSCLM.js";import{b as Z}from"./chunk-2YUYNNHQ.js";import{a as re}from"./chunk-F2YMCQ6B.js";import{b as te}from"./chunk-4PC7IXNY.js";import"./chunk-2MLA6WFH.js";import{R as J}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import"./chunk-O3NAGRTR.js";import{b as G}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as ee}from"./chunk-MHGJUKCZ.js";import"./chunk-C7UZEQZ7.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as X}from"./chunk-TAD43CG5.js";import{d as Q,q as Y}from"./chunk-HBGS4SEX.js";import"./chunk-ZXLEXF4X.js";import{a as S,e as q,f as de,g as ce,h as fe,j as z}from"./chunk-RRCPZMC2.js";var V=q(ce(),1),K=q(de(),1);var s=q(fe(),1);var me=.5,ne=S(o=>Math.min(100,Math.max(0,o)),"clampPercent"),ue=S((o,e)=>{if(!Number.isFinite(e)||e<=0)return{leftPercent:0,widthPercent:100};let r=ne(o.offsetMs/e*100),a=o.durationMs/e*100,t=Math.max(me,Math.min(ne(a),100-r));return{leftPercent:r,widthPercent:t}},"spanBar"),he=S((o,e)=>{let r=e.trim().toLowerCase();return r===""?[...o]:o.filter(a=>a.rootName.toLowerCase().includes(r)||a.functionPath.toLowerCase().includes(r))},"filterTraces"),U=S(o=>Number.isFinite(o)?o>0&&o<1?`${o.toFixed(2)}ms`:`${String(Math.round(o))}ms`:"\u2014","formatSpanDuration"),pe=14,ge=S(o=>Array.isArray(o?.traces)?o.traces:[],"tracesOf"),ve=S(o=>{let e=(0,V.c)(50),{span:r,traceDurationMs:a}=o,t=Q(),f;e[0]!==r||e[1]!==a?(f=ue(r,a),e[0]=r,e[1]=a,e[2]=f):f=e[2];let{leftPercent:u,widthPercent:_}=f,k;e[3]!==r.attributes?(k=le(r.attributes),e[3]=r.attributes,e[4]=k):k=e[4];let T=k,M=r.depth*pe,h;e[5]!==M?(h={paddingLeft:M},e[5]=M,e[6]=h):h=e[6];let x=h,b=`${String(u)}%`,n=`${String(_)}%`,l;e[7]!==b||e[8]!==n?(l={left:b,width:n},e[7]=b,e[8]=n,e[9]=l):l=e[9];let p=l,I=r.depth,i;e[10]!==r.ok||e[11]!==t?(i=r.ok?null:(0,s.jsxDEV)("span",{"aria-label":t("Errored span"),className:"mr-1 text-destructive","data-testid":"tr-span-error",role:"img",children:"\u25CF"},void 0,!1),e[10]=r.ok,e[11]=t,e[12]=i):i=e[12];let w;e[13]!==x||e[14]!==r.name||e[15]!==i?(w=(0,s.jsxDEV)("span",{className:"w-56 shrink-0 truncate",role:"gridcell",style:x,title:r.name,children:[i,r.name]},void 0,!0),e[13]=x,e[14]=r.name,e[15]=i,e[16]=w):w=e[16];let d;e[17]!==r.durationMs||e[18]!==r.offsetMs||e[19]!==t?(d=t("starts {offset} in, runs {duration}",{duration:U(r.durationMs),offset:U(r.offsetMs)}),e[17]=r.durationMs,e[18]=r.offsetMs,e[19]=t,e[20]=d):d=e[20];let N=r.ok?"bg-primary/70":"bg-destructive",c;e[21]!==N?(c=z("absolute inset-y-0 rounded-sm",N),e[21]=N,e[22]=c):c=e[22];let g;e[23]!==p||e[24]!==u||e[25]!==c||e[26]!==_?(g=(0,s.jsxDEV)("span",{className:c,"data-left":u,"data-testid":"tr-span-bar","data-width":_,style:p},void 0,!1),e[23]=p,e[24]=u,e[25]=c,e[26]=_,e[27]=g):g=e[27];let y;e[28]!==d||e[29]!==g?(y=(0,s.jsxDEV)("span",{"aria-label":d,className:"relative h-3 flex-1 overflow-hidden rounded-sm bg-muted",role:"gridcell",children:g},void 0,!1),e[28]=d,e[29]=g,e[30]=y):y=e[30];let m;e[31]!==r.durationMs?(m=U(r.durationMs),e[31]=r.durationMs,e[32]=m):m=e[32];let v;e[33]!==m?(v=(0,s.jsxDEV)("span",{className:"w-16 shrink-0 text-right tabular-nums text-muted-foreground",role:"gridcell",children:m},void 0,!1),e[33]=m,e[34]=v):v=e[34];let E;e[35]!==r.error?(E=r.error===void 0?null:(0,s.jsxDEV)("span",{className:"text-destructive","data-testid":"tr-span-error-message",title:r.error.message,children:`${r.error.type}: ${r.error.message}`},void 0,!1),e[35]=r.error,e[36]=E):E=e[36];let P;e[37]!==E?(P=(0,s.jsxDEV)("span",{className:"w-64 shrink-0 truncate text-muted-foreground",role:"gridcell",children:E},void 0,!1),e[37]=E,e[38]=P):P=e[38];let A;e[39]!==T?(A=T===""?null:(0,s.jsxDEV)("span",{"data-testid":"tr-span-attributes",title:T,children:T},void 0,!1),e[39]=T,e[40]=A):A=e[40];let C;e[41]!==A?(C=(0,s.jsxDEV)("span",{className:"w-64 shrink-0 truncate text-muted-foreground",role:"gridcell",children:A},void 0,!1),e[41]=A,e[42]=C):C=e[42];let $;return e[43]!==r.depth||e[44]!==w||e[45]!==y||e[46]!==v||e[47]!==P||e[48]!==C?($=(0,s.jsxDEV)("div",{className:"flex items-center gap-2 border-b border-border px-3 py-1.5 font-mono text-xs last:border-b-0 hover:bg-muted/50","data-depth":I,"data-testid":"tr-span-row",role:"row",children:[w,y,v,P,C]},void 0,!0),e[43]=r.depth,e[44]=w,e[45]=y,e[46]=v,e[47]=P,e[48]=C,e[49]=$):$=e[49],$},"SpanRow"),xe=S(o=>{let e=(0,V.c)(50),{expanded:r,onToggle:a,trace:t}=o,f=Q(),u;e[0]!==a||e[1]!==t.traceId?(u=S(()=>{a(t.traceId)},"t1"),e[0]=a,e[1]=t.traceId,e[2]=u):u=e[2];let _=u,k=`tr-row-${t.traceId}`,T=`tr-waterfall-${t.traceId}`,M=`tr-toggle-${t.traceId}`,h=r?"\u25BE":"\u25B8",x;e[3]!==h?(x=(0,s.jsxDEV)("span",{"aria-hidden":"true",className:"w-3 shrink-0 text-xs text-muted-foreground",children:h},void 0,!1),e[3]=h,e[4]=x):x=e[4];let b;e[5]!==t.rootName?(b=(0,s.jsxDEV)("span",{className:"w-56 shrink-0 truncate text-sm font-medium",title:t.rootName,children:t.rootName},void 0,!1),e[5]=t.rootName,e[6]=b):b=e[6];let n;e[7]!==t.functionPath?(n=(0,s.jsxDEV)("span",{className:"w-48 shrink-0 truncate font-mono text-xs text-muted-foreground",title:t.functionPath,children:t.functionPath},void 0,!1),e[7]=t.functionPath,e[8]=n):n=e[8];let l;e[9]!==t.durationMs?(l=U(t.durationMs),e[9]=t.durationMs,e[10]=l):l=e[10];let p;e[11]!==l?(p=(0,s.jsxDEV)("span",{className:"w-20 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground",children:l},void 0,!1),e[11]=l,e[12]=p):p=e[12];let I;e[13]!==f||e[14]!==t.spans.length?(I=f("{count} spans",{count:t.spans.length}),e[13]=f,e[14]=t.spans.length,e[15]=I):I=e[15];let i;e[16]!==I?(i=(0,s.jsxDEV)("span",{className:"w-20 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground",children:I},void 0,!1),e[16]=I,e[17]=i):i=e[17];let w=t.ok?"secondary":"destructive",d;e[18]!==f||e[19]!==t.ok?(d=t.ok?f("ok"):f("error"),e[18]=f,e[19]=t.ok,e[20]=d):d=e[20];let N;e[21]!==w||e[22]!==d?(N=(0,s.jsxDEV)("span",{className:"shrink-0",children:(0,s.jsxDEV)(G,{variant:w,children:d},void 0,!1)},void 0,!1),e[21]=w,e[22]=d,e[23]=N):N=e[23];let c;e[24]!==t.startTs?(c=Y(t.startTs),e[24]=t.startTs,e[25]=c):c=e[25];let g;e[26]!==c?(g=(0,s.jsxDEV)("span",{className:"flex-1 truncate text-right font-mono text-xs tabular-nums text-muted-foreground",children:c},void 0,!1),e[26]=c,e[27]=g):g=e[27];let y;e[28]!==r||e[29]!==_||e[30]!==p||e[31]!==i||e[32]!==N||e[33]!==g||e[34]!==T||e[35]!==M||e[36]!==x||e[37]!==b||e[38]!==n?(y=(0,s.jsxDEV)("button",{"aria-controls":T,"aria-expanded":r,className:"flex w-full items-center gap-3 px-3 py-2 text-left hover:bg-muted/50","data-testid":M,onClick:_,type:"button",children:[x,b,n,p,i,N,g]},void 0,!0),e[28]=r,e[29]=_,e[30]=p,e[31]=i,e[32]=N,e[33]=g,e[34]=T,e[35]=M,e[36]=x,e[37]=b,e[38]=n,e[39]=y):y=e[39];let m;e[40]!==r||e[41]!==f||e[42]!==t.durationMs||e[43]!==t.spans||e[44]!==t.traceId?(m=r&&(0,s.jsxDEV)("div",{"aria-label":f("Trace waterfall"),className:"bg-muted/20","data-testid":`tr-waterfall-${t.traceId}`,id:`tr-waterfall-${t.traceId}`,role:"grid",children:t.spans.map(E=>(0,s.jsxDEV)(ve,{span:E,traceDurationMs:t.durationMs},E.spanId,!1))},void 0,!1),e[40]=r,e[41]=f,e[42]=t.durationMs,e[43]=t.spans,e[44]=t.traceId,e[45]=m):m=e[45];let v;return e[46]!==y||e[47]!==m||e[48]!==k?(v=(0,s.jsxDEV)("div",{className:"border-b border-border last:border-b-0","data-testid":k,children:[y,m]},void 0,!0),e[46]=y,e[47]=m,e[48]=k,e[49]=v):v=e[49],v},"TraceRow"),Ae=S(o=>{let e=(0,V.c)(43),{initialShardKey:r}=o,a=Q(),[t,f]=(0,K.useState)(r??""),[u,_]=(0,K.useState)(""),[k,T]=(0,K.useState)(be),M;e[0]!==t?(M=t.trim(),e[0]=t,e[1]=M):M=e[1];let h=se(M,400),x;e[2]===Symbol.for("react.memo_cache_sentinel")?(x={},e[2]=x):x=e[2];let b;e[3]!==h?(b={live:!0,shardKey:h},e[3]=h,e[4]=b):b=e[4];let{data:n,error:l,errorSource:p,isLoading:I,liveError:i}=Z(ee.getTraces,x,b),w,d;e[5]!==n||e[6]!==h?(w=S(()=>{n!==void 0&&te(h)},"t4"),d=[n,h],e[5]=n,e[6]=h,e[7]=w,e[8]=d):(w=e[7],d=e[8]),(0,K.useEffect)(w,d);let N;if(e[9]!==n||e[10]!==l||e[11]!==p||e[12]!==k||e[13]!==I||e[14]!==i||e[15]!==u||e[16]!==t||e[17]!==a){let c=ge(n),g=n?.total??c.length,y=g>c.length,m=he(c,u),v;e[19]===Symbol.for("react.memo_cache_sentinel")?(v=S(L=>{_(L.target.value)},"t7"),e[19]=v):v=e[19];let E=v,P;e[20]===Symbol.for("react.memo_cache_sentinel")?(P=S(L=>{T(ie=>{let H=new Set(ie);return H.has(L)?H.delete(L):H.add(L),H})},"t8"),e[20]=P):P=e[20];let A=P,C=l===null&&m.length===0&&!I,$;e[21]!==t?($=(0,s.jsxDEV)(re,{onChange:f,testId:"tr-shard-input",value:t},void 0,!1),e[21]=t,e[22]=$):$=e[22];let R;e[23]!==a?(R=a("Search traces"),e[23]=a,e[24]=R):R=e[24];let B;e[25]!==a?(B=a("search trace or function"),e[25]=a,e[26]=B):B=e[26];let D;e[27]!==u||e[28]!==R||e[29]!==B?(D=(0,s.jsxDEV)(J,{"aria-label":R,className:"h-8 w-56","data-testid":"tr-search",onChange:E,placeholder:B,value:u},void 0,!1),e[27]=u,e[28]=R,e[29]=B,e[30]=D):D=e[30];let F;e[31]!==i?(F=(0,s.jsxDEV)(oe,{message:i,prefix:"tr"},void 0,!1),e[31]=i,e[32]=F):F=e[32];let j;e[33]!==D||e[34]!==F||e[35]!==$?(j=(0,s.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[$,D,F]},void 0,!0),e[33]=D,e[34]=F,e[35]=$,e[36]=j):j=e[36];let O;e[37]!==l||e[38]!==p?(O=l!==null&&(0,s.jsxDEV)(ae,{error:p,testId:"tr-error"},void 0,!1),e[37]=l,e[38]=p,e[39]=O):O=e[39];let W;e[40]!==C||e[41]!==a?(W=C&&(0,s.jsxDEV)(X,{description:a("Traces recorded with ctx.trace show up here as your app handles traffic. The span buffer resets when the shard hibernates."),icon:(0,s.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,s.jsxDEV)("path",{d:"M4 6h10M7 12h13M10 18h7"},void 0,!1)},void 0,!1),testId:"tr-empty",title:a("No traces")},void 0,!1),e[40]=C,e[41]=a,e[42]=W):W=e[42],N=(0,s.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-traces-panel",children:[j,O,W,l===null&&y&&(0,s.jsxDEV)("p",{className:"text-xs text-muted-foreground","data-testid":"tr-truncated",children:a("Showing the {shown} most recent of {total} traces in the buffer.",{shown:c.length,total:g})},void 0,!1),l===null&&m.length>0&&(0,s.jsxDEV)("div",{"aria-label":a("Recent traces"),className:"overflow-hidden rounded-xl border border-border shadow-xs","data-testid":"tr-list",children:m.map(L=>(0,s.jsxDEV)(xe,{expanded:k.has(L.traceId),onToggle:A,trace:L},L.traceId,!1))},void 0,!1)]},void 0,!0),e[9]=n,e[10]=l,e[11]=p,e[12]=k,e[13]=I,e[14]=i,e[15]=u,e[16]=t,e[17]=a,e[18]=N}else N=e[18];return N},"TracesPanel");function be(){return new Set}S(be,"_temp");export{Ae as TracesPanel};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as M,b as E,c as O,d as B,e as R,f as D,g as _,h as J}from"./chunk-V43BLH4J.js";import{a as q}from"./chunk-AHILM3ZP.js";import{a as U}from"./chunk-
|
|
1
|
+
import{a as M,b as E,c as O,d as B,e as R,f as D,g as _,h as J}from"./chunk-V43BLH4J.js";import{a as q}from"./chunk-AHILM3ZP.js";import{a as U}from"./chunk-2YTF6LJ6.js";import{d as L,l as I,o as V}from"./chunk-HBGS4SEX.js";import{a as C,e as j,f as z,g as K,h as P}from"./chunk-RRCPZMC2.js";var T=j(K(),1),H=j(z(),1);var a=j(P(),1);var $="inline-flex items-center gap-1 rounded-md border border-border px-2.5 py-1 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50",W=/["\n,]/u,X=/^[=+\-@\t\r]/u,F=C(l=>{if(l==null)return"";let e;return typeof l=="string"?e=X.test(l)?` ${l}`:l:typeof l=="number"||typeof l=="boolean"||typeof l=="bigint"?e=String(l):e=JSON.stringify(l),W.test(e)?`"${e.replaceAll('"','""')}"`:e},"csvCell"),Y=C((l,e)=>{let o=l.map(n=>F(n)).join(","),s=e.map(n=>l.map(t=>F(n[t])).join(","));return[o,...s].join(`
|
|
2
2
|
`)},"toCsv"),Z=C(l=>JSON.stringify(l,null,2),"toJson"),G=500,Q=C(l=>`"${l.replaceAll('"','""')}"`,"sqlIdentifier"),ee=C(l=>l==null?"NULL":typeof l=="number"?Number.isFinite(l)?String(l):"NULL":typeof l=="bigint"?String(l):typeof l=="boolean"?l?"1":"0":`'${(typeof l=="string"?l:JSON.stringify(l)).replaceAll("'","''")}'`,"sqlLiteral"),te=C((l,e,o)=>{if(e.length===0||o.length===0)return"";let s=e.map(t=>Q(t)).join(", "),n=[];for(let t=0;t<o.length;t+=G){let r=o.slice(t,t+G).map(m=>` (${e.map(i=>ee(m[i])).join(", ")})`).join(`,
|
|
3
3
|
`);n.push(`INSERT INTO ${Q(l)} (${s}) VALUES
|
|
4
4
|
${r};`)}return n.join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as A}from"./chunk-
|
|
1
|
+
import{a as A}from"./chunk-2YUYNNHQ.js";import{a as y,e as I}from"./chunk-Y572GMZE.js";import{b as m}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as k}from"./chunk-C7UZEQZ7.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as C}from"./chunk-HBGS4SEX.js";import"./chunk-ZXLEXF4X.js";import{a as u,e as w,g as S,h as P}from"./chunk-RRCPZMC2.js";var N=w(S(),1);var a=w(P(),1);var z=[{key:"accounts",label:"Accounts"},{key:"admin",label:"Admin"},{key:"organization",label:"Organizations"},{key:"passkey",label:"Passkeys"},{key:"twoFactor",label:"Two-factor"}],b=u(e=>{if(e===void 0)return"\u2014";let l=[[86400,"d"],[3600,"h"],[60,"m"]];for(let[t,o]of l)if(e>=t&&e%t===0)return`${String(e/t)}${o}`;return`${String(e)}s`},"formatDuration"),h=u(e=>{let l=(0,N.c)(8),{children:t,heading:o,testId:r}=e,i;l[0]!==o?(i=(0,a.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o},void 0,!1)},void 0,!1),l[0]=o,l[1]=i):i=l[1];let s;l[2]!==t?(s=(0,a.jsxDEV)(I,{className:"p-3",children:t},void 0,!1),l[2]=t,l[3]=s):s=l[3];let c;return l[4]!==i||l[5]!==s||l[6]!==r?(c=(0,a.jsxDEV)(y,{className:"gap-0 py-0","data-testid":r,children:[i,s]},void 0,!0),l[4]=i,l[5]=s,l[6]=r,l[7]=c):c=l[7],c},"ConfigCard"),d=u(e=>{let l=(0,N.c)(7),{label:t,value:o}=e,r;l[0]!==t?(r=(0,a.jsxDEV)("span",{className:"text-sm",children:t},void 0,!1),l[0]=t,l[1]=r):r=l[1];let i;l[2]!==o?(i=(0,a.jsxDEV)("span",{className:"text-sm text-muted-foreground tabular-nums",children:o},void 0,!1),l[2]=o,l[3]=i):i=l[3];let s;return l[4]!==r||l[5]!==i?(s=(0,a.jsxDEV)("div",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs",children:[r,i]},void 0,!0),l[4]=r,l[5]=i,l[6]=s):s=l[6],s},"KeyValue"),O=u(()=>{let e=(0,N.c)(20),l=k(),t=C(),o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["lunora-auth-config"],e[0]=o):o=e[0];let r;e[1]!==l?(r=u(()=>l.getAuthConfig(),"t1"),e[1]=l,e[2]=r):r=e[2];let{data:i,error:s}=A(o,r),c;e[3]!==t?(c=u(n=>(0,a.jsxDEV)(m,{variant:n?"success":"outline",children:t(n?"Enabled":"Disabled")},void 0,!1),"t2"),e[3]=t,e[4]=c):c=e[4];let f=c,g;e[5]!==s?(g=s!==null&&(0,a.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"auth-config-error",role:"alert",children:s},void 0,!1),e[5]=s,e[6]=g):g=e[6];let p;e[7]!==i||e[8]!==s||e[9]!==t?(p=s===null&&i===void 0&&(0,a.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"auth-config-loading",children:t("Loading auth configuration\u2026")},void 0,!1),e[7]=i,e[8]=s,e[9]=t,e[10]=p):p=e[10];let v;e[11]!==i||e[12]!==s||e[13]!==f||e[14]!==t?(v=s===null&&i!==void 0&&(0,a.jsxDEV)(a.Fragment,{children:[(0,a.jsxDEV)(h,{heading:t("Enabled capabilities"),testId:"auth-config-capabilities",children:(0,a.jsxDEV)("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:z.map(n=>{let $=i.capabilities[n.key];return(0,a.jsxDEV)("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-cap-${n.key}`,children:[(0,a.jsxDEV)("span",{className:"text-sm",children:t(n.label)},void 0,!1),f($)]},n.key,!0)})},void 0,!1)},void 0,!1),(0,a.jsxDEV)(h,{heading:t("Plugins"),testId:"auth-config-plugins",children:i.plugins.length===0?(0,a.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:t("No plugins enabled.")},void 0,!1):(0,a.jsxDEV)("div",{className:"flex flex-wrap gap-2",children:i.plugins.map(L)},void 0,!1)},void 0,!1),(0,a.jsxDEV)(h,{heading:t("Sign-in methods"),testId:"auth-config-signin",children:(0,a.jsxDEV)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxDEV)(d,{label:t("Email & password"),value:f(i.emailAndPassword)},void 0,!1),(0,a.jsxDEV)(d,{label:t("Social providers"),value:i.socialProviders.length===0?t("None"):(0,a.jsxDEV)("span",{className:"flex flex-wrap justify-end gap-1",children:i.socialProviders.map(j)},void 0,!1)},void 0,!1)]},void 0,!0)},void 0,!1),i.organization.enabled&&(0,a.jsxDEV)(h,{heading:t("Organizations"),testId:"auth-config-org",children:(0,a.jsxDEV)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxDEV)(d,{label:t("Teams"),value:f(i.organization.teams)},void 0,!1),(0,a.jsxDEV)(d,{label:t("Custom roles"),value:f(i.organization.roles)},void 0,!1)]},void 0,!0)},void 0,!1),(0,a.jsxDEV)(h,{heading:t("Session policy"),testId:"auth-config-session",children:(0,a.jsxDEV)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxDEV)(d,{label:t("Expires in"),value:b(i.session.expiresIn)},void 0,!1),(0,a.jsxDEV)(d,{label:t("Refresh after"),value:b(i.session.updateAge)},void 0,!1),(0,a.jsxDEV)(d,{label:t("Fresh window"),value:b(i.session.freshAge)},void 0,!1),(0,a.jsxDEV)(d,{label:t("Cookie cache"),value:f(i.session.cookieCache===!0)},void 0,!1)]},void 0,!0)},void 0,!1),(0,a.jsxDEV)(h,{heading:t("Rate limit"),testId:"auth-config-ratelimit",children:(0,a.jsxDEV)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxDEV)(d,{label:t("Status"),value:f(i.rateLimit.enabled)},void 0,!1),i.rateLimit.enabled&&(0,a.jsxDEV)(a.Fragment,{children:[(0,a.jsxDEV)(d,{label:t("Max requests"),value:i.rateLimit.max??"\u2014"},void 0,!1),(0,a.jsxDEV)(d,{label:t("Window"),value:b(i.rateLimit.window)},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1),i.userFields.length>0&&(0,a.jsxDEV)(h,{heading:t("Plugin user fields"),testId:"auth-config-user-fields",children:(0,a.jsxDEV)("ul",{className:"flex flex-col gap-2",children:i.userFields.map(n=>(0,a.jsxDEV)("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-user-field-${n.name}`,children:[(0,a.jsxDEV)("span",{className:"flex flex-col",children:[(0,a.jsxDEV)("span",{className:"font-mono text-xs",children:n.name},void 0,!1),n.plugin!==void 0&&(0,a.jsxDEV)("span",{className:"text-[11px] text-muted-foreground",children:n.plugin},void 0,!1)]},void 0,!0),(0,a.jsxDEV)("span",{className:"flex items-center gap-1",children:[(0,a.jsxDEV)(m,{variant:"outline",children:n.type},void 0,!1),n.required&&(0,a.jsxDEV)(m,{variant:"secondary",children:t("required")},void 0,!1),n.unique&&(0,a.jsxDEV)(m,{variant:"secondary",children:t("unique")},void 0,!1)]},void 0,!0)]},n.name,!0))},void 0,!1)},void 0,!1),(0,a.jsxDEV)(y,{className:"gap-0 py-0",children:(0,a.jsxDEV)("p",{className:"px-4 py-3 text-xs text-muted-foreground","data-testid":"auth-config-note",children:t("OAuth providers, email templates, and rate limits are configured at deploy time in the better-auth setup and aren't editable here. See the Mail tab for email output.")},void 0,!1)},void 0,!1)]},void 0,!0),e[11]=i,e[12]=s,e[13]=f,e[14]=t,e[15]=v):v=e[15];let x;return e[16]!==g||e[17]!==p||e[18]!==v?(x=(0,a.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"auth-config",children:[g,p,v]},void 0,!0),e[16]=g,e[17]=p,e[18]=v,e[19]=x):x=e[19],x},"AuthConfigPanel");function L(e){return(0,a.jsxDEV)(m,{"data-testid":`auth-config-plugin-${e}`,variant:"outline",children:e},e,!1)}u(L,"_temp");function j(e){return(0,a.jsxDEV)(m,{"data-testid":`auth-config-provider-${e}`,variant:"outline",children:e},e,!1)}u(j,"_temp2");export{O as AuthConfigPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as S}from"./chunk-
|
|
1
|
+
import{a as S}from"./chunk-2ICZ6HXQ.js";import"./chunk-XNJNSCLM.js";import{b as T}from"./chunk-2YUYNNHQ.js";import{a as w,b as A,c as E,d as m,e as s,f as l}from"./chunk-GTM65MVX.js";import{a as N,e as b}from"./chunk-Y572GMZE.js";import{a as O}from"./chunk-VLXV72QE.js";import{a as k}from"./chunk-JSEXCW5Q.js";import{b as y}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as C}from"./chunk-MHGJUKCZ.js";import"./chunk-C7UZEQZ7.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as u}from"./chunk-TAD43CG5.js";import{d as h}from"./chunk-HBGS4SEX.js";import"./chunk-ZXLEXF4X.js";import{a as d,e as p,f as D,h as H}from"./chunk-RRCPZMC2.js";var n=p(D(),1);var e=p(H(),1);var K=d(a=>{let t=a.trim();if(t.length===0)return{context:void 0,error:null};try{let o=JSON.parse(t);return o===null||typeof o!="object"||Array.isArray(o)?{context:void 0,error:"Targeting context must be a JSON object."}:{context:o,error:null}}catch{return{context:void 0,error:"Targeting context is not valid JSON."}}},"parseContext"),R='{ "targetingKey": "user-123", "plan": "premium" }',M=d(a=>a.type==="object"?JSON.stringify(a.value):String(a.value),"formatValue"),Y=d(({initialShardKey:a=""})=>{let t=h(),[o,F]=(0,n.useState)(""),{context:f,error:g}=K(o),I=(0,n.useMemo)(()=>f===void 0?{}:{context:f},[f]),{data:i,error:J,errorSource:L,liveError:j}=T(C.listFlags,I,{live:!0,shardKey:a}),v=i!==void 0,V=i?.configured??!1,x=(0,n.useMemo)(()=>Array.isArray(i?.flags)?[...i.flags].toSorted((r,B)=>r.key.localeCompare(B.key)):[],[i]),c;return v&&!V?c=(0,e.jsxDEV)(u,{description:t("No @lunora/flags provider is wired in this deployment. Add lunora/flags.ts with defineFlags({ provider }) to gate code paths on feature flags."),testId:"flags-unconfigured",title:t("No flags provider configured")},void 0,!1):v&&x.length===0?c=(0,e.jsxDEV)(u,{description:t('A flags provider is configured, but no handler reads a flag yet. Call ctx.flags.boolean("key", false) in a query, mutation, or action.'),testId:"flags-empty",title:t("No flags read")},void 0,!1):c=(0,e.jsxDEV)(N,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(b,{className:"px-0",children:(0,e.jsxDEV)(w,{"data-testid":"flags-table",children:[(0,e.jsxDEV)(A,{children:(0,e.jsxDEV)(m,{children:[(0,e.jsxDEV)(s,{children:t("Key")},void 0,!1),(0,e.jsxDEV)(s,{children:t("Type")},void 0,!1),(0,e.jsxDEV)(s,{children:t("Value")},void 0,!1),(0,e.jsxDEV)(s,{children:t("Reason")},void 0,!1),(0,e.jsxDEV)(s,{children:t("Variant")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(E,{children:x.map(r=>(0,e.jsxDEV)(m,{"data-testid":`flags-row-${r.key}`,children:[(0,e.jsxDEV)(l,{className:"font-mono text-xs",children:r.key},void 0,!1),(0,e.jsxDEV)(l,{className:"font-mono text-xs text-muted-foreground",children:r.type},void 0,!1),(0,e.jsxDEV)(l,{className:"font-mono text-xs",children:M(r)},void 0,!1),(0,e.jsxDEV)(l,{children:r.errorCode===void 0?(0,e.jsxDEV)("span",{className:"font-mono text-xs text-muted-foreground",children:r.reason??"\u2014"},void 0,!1):(0,e.jsxDEV)(y,{"data-testid":`flags-error-${r.key}`,variant:"destructive",children:r.errorCode},void 0,!1)},void 0,!1),(0,e.jsxDEV)(l,{className:"font-mono text-xs text-muted-foreground",children:r.variant??"\u2014"},void 0,!1)]},r.key,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-flags-panel",children:[J!==null&&(0,e.jsxDEV)(S,{error:L,testId:"flags-error"},void 0,!1),(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:t('Feature flags are read in code with ctx.flags.<type>("key", default). They evaluate through the OpenFeature provider configured in lunora/flags.ts; edit the targeting context below to see how each flag resolves for a given audience.')},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-col gap-2",children:[(0,e.jsxDEV)(k,{htmlFor:"flags-targeting-context",children:t("Targeting context (JSON)")},void 0,!1),(0,e.jsxDEV)(O,{className:"font-mono text-xs","data-testid":"flags-context-input",id:"flags-targeting-context",onChange:d(r=>{F(r.target.value)},"onChange"),placeholder:R,rows:3,value:o},void 0,!1),g!==null&&(0,e.jsxDEV)("p",{className:"text-xs text-destructive","data-testid":"flags-context-error",role:"alert",children:t(g)},void 0,!1),j!==void 0&&(0,e.jsxDEV)("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"flags-live-error",role:"alert",children:t("Live updates unavailable; showing the last evaluation.")},void 0,!1)]},void 0,!0),c]},void 0,!0)},"FlagsPanel");export{Y as FlagsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as k,b as j}from"./chunk-VXM5H542.js";import{a as D}from"./chunk-
|
|
1
|
+
import{a as k,b as j}from"./chunk-VXM5H542.js";import{a as D}from"./chunk-WMDH2CIZ.js";import{a as O}from"./chunk-2K47A3P6.js";import{a as V}from"./chunk-2ICZ6HXQ.js";import"./chunk-XNJNSCLM.js";import{b as A}from"./chunk-2YUYNNHQ.js";import{a as _,b as z,c as B,d as f,e as l,f as n}from"./chunk-GTM65MVX.js";import{a as y,e as E}from"./chunk-Y572GMZE.js";import{a as M}from"./chunk-F2YMCQ6B.js";import"./chunk-4PC7IXNY.js";import"./chunk-2MLA6WFH.js";import{R as L}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import"./chunk-O3NAGRTR.js";import{b as T}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as H}from"./chunk-MHGJUKCZ.js";import"./chunk-C7UZEQZ7.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as I}from"./chunk-TAD43CG5.js";import{d as C,q as R}from"./chunk-HBGS4SEX.js";import"./chunk-ZXLEXF4X.js";import{a as i,e as w,f as ee,h as te}from"./chunk-RRCPZMC2.js";var o=w(ee(),1);var e=w(te(),1);var K=80,ae=i(s=>{if(s===void 0)return"";let t=JSON.stringify(s);return t.length>K?`${t.slice(0,K)}\u2026`:t},"formatDetail"),re=41,F=480,U=5,oe=i((s,t)=>k(s,d=>{t(d.height>0?d:{height:F,width:d.width})}),"observeViewportRect"),Se=i(({initialShardKey:s})=>{let t=C(),[d,G]=(0,o.useState)(s??""),[m,W]=(0,o.useState)(""),q=O(d.trim(),400),{data:v,error:p,errorSource:J,isLoading:P,liveError:Q}=A(H.getAuditLog,{},{live:!0,shardKey:q}),u=(0,o.useMemo)(()=>v?.entries??[],[v]),c=(0,o.useMemo)(()=>{let r=m.trim().toLowerCase();return r===""?u:u.filter(a=>a.op.toLowerCase().includes(r)||(a.table??"").toLowerCase().includes(r)||(a.id??"").toLowerCase().includes(r))},[u,m]),g=(0,o.useRef)(null),x=j({count:c.length,estimateSize:i(()=>re,"estimateSize"),getScrollElement:i(()=>g.current,"getScrollElement"),initialRect:{height:F,width:800},observeElementRect:oe,overscan:8}),h=x.getVirtualItems(),X=x.getTotalSize(),S=h[0]?.start??0,b=X-(h.at(-1)?.end??0),Z={height:S},$={height:b},Y=i(r=>{W(r.target.value)},"onSearchChange");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-audit",children:[(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)(M,{onChange:G,testId:"au-shard-input",value:d},void 0,!1),(0,e.jsxDEV)(D,{message:Q,prefix:"au"},void 0,!1),(0,e.jsxDEV)(L,{"aria-label":t("Filter audit log"),className:"h-8 w-48","data-testid":"au-search",onChange:Y,placeholder:t("filter op, table, id"),value:m},void 0,!1)]},void 0,!0),p!==null&&(0,e.jsxDEV)(V,{error:J,testId:"au-error"},void 0,!1),p===null&&!P&&c.length===0&&(0,e.jsxDEV)(I,{description:t("State-changing admin operations are recorded here."),icon:(0,e.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsxDEV)("path",{d:"M8 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2h-2M9 3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1V3Zm-1 9h8m-8 4h5"},void 0,!1)},void 0,!1),testId:"au-empty",title:t("No audit entries.")},void 0,!1),c.length>0&&(0,e.jsxDEV)(y,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(E,{className:"max-h-[30rem] overflow-auto px-0",ref:g,children:(0,e.jsxDEV)(_,{"data-testid":"au-table",children:[(0,e.jsxDEV)(z,{children:(0,e.jsxDEV)(f,{children:[(0,e.jsxDEV)(l,{children:t("time")},void 0,!1),(0,e.jsxDEV)(l,{children:t("op")},void 0,!1),(0,e.jsxDEV)(l,{children:t("table")},void 0,!1),(0,e.jsxDEV)(l,{children:t("id")},void 0,!1),(0,e.jsxDEV)(l,{children:t("detail")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(B,{children:[S>0&&(0,e.jsxDEV)("tr",{"aria-hidden":"true",children:(0,e.jsxDEV)("td",{colSpan:U,style:Z},void 0,!1)},void 0,!1),h.map(r=>{let a=c[r.index],N=ae(a.detail);return(0,e.jsxDEV)(f,{"data-testid":"au-row",children:[(0,e.jsxDEV)(n,{className:"text-muted-foreground tabular-nums",children:R(a.ts,"\u2014")},void 0,!1),(0,e.jsxDEV)(n,{children:(0,e.jsxDEV)(T,{variant:"secondary",children:a.op},void 0,!1)},void 0,!1),(0,e.jsxDEV)(n,{className:"font-medium",children:a.table??(0,e.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1),(0,e.jsxDEV)(n,{className:"max-w-[20ch] truncate font-mono text-xs",children:a.id??(0,e.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1),(0,e.jsxDEV)(n,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:N||void 0,children:N||(0,e.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1)]},a.seq,!0)}),b>0&&(0,e.jsxDEV)("tr",{"aria-hidden":"true",children:(0,e.jsxDEV)("td",{colSpan:U,style:$},void 0,!1)},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0)},"AuditPanel");export{Se as AuditPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Mt,b as ae}from"./chunk-GVFODXW2.js";import{a as Ft}from"./chunk-AHILM3ZP.js";import{a as Dt}from"./chunk-J6J54MBP.js";import{a as fe}from"./chunk-4F72YCTU.js";import{a as St,b as Nt,c as At,d as tt,e as ne,f as de}from"./chunk-GTM65MVX.js";import{a as kt,e as wt}from"./chunk-Y572GMZE.js";import{a as zt}from"./chunk-VLXV72QE.js";import{a as Tt}from"./chunk-JSEXCW5Q.js";import{R as W}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as j}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-CKSHCYGC.js";import{f as le}from"./chunk-S2G7OH5T.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as ce}from"./chunk-TAD43CG5.js";import{d as K,h as Ot,k as A,l as _t,p as $t}from"./chunk-5XO36X4C.js";import"./chunk-ZXLEXF4X.js";import{a as n,e as It,f as Jt,g as Bt,h as Ut}from"./chunk-RRCPZMC2.js";var G=It(Bt(),1);var P=It(Jt(),1);var o=It(Ut(),1);var jt=n(t=>{let e=JSON.parse(t);if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError("Expected a JSON object");return e},"parseJsonObject"),Ht=n(t=>{let e=jt(t),l={};for(let[d,f]of Object.entries(e)){if(!Array.isArray(f)||f.some(r=>typeof r!="string"))throw new TypeError(`"${d}" must map to an array of action strings`);l[d]=f}return l},"parsePermission"),Pt=n(t=>t==null||t===""?"":typeof t=="string"?t:JSON.stringify(t,null,2),"jsonInitial"),q=n(t=>{let e=(0,G.c)(6),{children:l,htmlFor:d,label:f}=t,r;e[0]!==d||e[1]!==f?(r=(0,o.jsxDEV)(Tt,{htmlFor:d,children:f},void 0,!1),e[0]=d,e[1]=f,e[2]=r):r=e[2];let i;return e[3]!==l||e[4]!==r?(i=(0,o.jsxDEV)("div",{className:"flex flex-col gap-1",children:[r,l]},void 0,!0),e[3]=l,e[4]=r,e[5]=i):i=e[5],i},"Field"),me=n(({busy:t,canSubmit:e,children:l,destructive:d=!1,error:f,onClose:r,onSubmit:i,submitLabel:s,testId:a,title:m})=>{let c=K();return(0,o.jsxDEV)(Ft,{label:m,onClose:r,panelTestId:`${a}-panel`,testId:`${a}-overlay`,variant:"dialog",children:[(0,o.jsxDEV)("h2",{className:"text-sm font-semibold text-foreground",children:m},void 0,!1),l,f!==null&&(0,o.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":`${a}-error`,role:"alert",children:f},void 0,!1),(0,o.jsxDEV)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,o.jsxDEV)(j,{"data-testid":`${a}-cancel`,onClick:r,size:"sm",type:"button",variant:"outline",children:c("Cancel")},void 0,!1),(0,o.jsxDEV)(j,{"data-testid":`${a}-submit`,disabled:t||!e,onClick:i,size:"sm",type:"button",variant:d?"destructive":"default",children:t?c("Saving\u2026"):s},void 0,!1)]},void 0,!0)]},void 0,!0)},"DialogForm"),Rt=n(t=>{let e=(0,G.c)(79),{mode:l,onClose:d,onDone:f,org:r}=t,i=le(),s=K(),{busy:a,error:m,run:c}=ae(),p;e[0]!==r?(p=r?A(r.name):"",e[0]=r,e[1]=p):p=e[1];let[u,g]=(0,P.useState)(p),k;e[2]!==r?(k=r?A(r.slug):"",e[2]=r,e[3]=k):k=e[3];let[h,y]=(0,P.useState)(k),w;e[4]!==r?(w=r?A(r.logo):"",e[4]=r,e[5]=w):w=e[5];let[b,I]=(0,P.useState)(w),[v,S]=(0,P.useState)(""),C;e[6]!==l||e[7]!==r?.metadata?(C=l==="edit"?Pt(r?.metadata):"",e[6]=l,e[7]=r?.metadata,e[8]=C):C=e[8];let[x,N]=(0,P.useState)(C),_;e[9]!==i||e[10]!==b||e[11]!==x||e[12]!==l||e[13]!==u||e[14]!==d||e[15]!==f||e[16]!==r?.id||e[17]!==v||e[18]!==c||e[19]!==h?(_=n(()=>{c(async()=>{let E=x.trim()===""?void 0:jt(x);l==="create"?await i.createAuthOrganization({logo:b.trim()===""?void 0:b.trim(),metadata:E,name:u.trim(),ownerId:v.trim()===""?void 0:v.trim(),slug:h.trim()===""?void 0:h.trim()}):await i.updateAuthOrganization({logo:b.trim()===""?void 0:b.trim(),metadata:E,name:u.trim()===""?void 0:u.trim(),organizationId:A(r?.id),slug:h.trim()===""?void 0:h.trim()}),f(),d()})},"t5"),e[9]=i,e[10]=b,e[11]=x,e[12]=l,e[13]=u,e[14]=d,e[15]=f,e[16]=r?.id,e[17]=v,e[18]=c,e[19]=h,e[20]=_):_=e[20];let D=_,z;e[21]!==l||e[22]!==u?(z=u.trim()!==""||l==="edit",e[21]=l,e[22]=u,e[23]=z):z=e[23];let $;e[24]!==l||e[25]!==s?($=s(l==="create"?"Create":"Save"),e[24]=l,e[25]=s,e[26]=$):$=e[26];let T;e[27]!==l||e[28]!==s?(T=s(l==="create"?"New organization":"Edit organization"),e[27]=l,e[28]=s,e[29]=T):T=e[29];let Q;e[30]!==s?(Q=s("name"),e[30]=s,e[31]=Q):Q=e[31];let H;e[32]===Symbol.for("react.memo_cache_sentinel")?(H=n(E=>{g(E.target.value)},"t10"),e[32]=H):H=e[32];let J;e[33]!==u?(J=(0,o.jsxDEV)(W,{"data-testid":"org-form-name",id:"org-form-name",onChange:H,value:u},void 0,!1),e[33]=u,e[34]=J):J=e[34];let L;e[35]!==J||e[36]!==Q?(L=(0,o.jsxDEV)(q,{htmlFor:"org-form-name",label:Q,children:J},void 0,!1),e[35]=J,e[36]=Q,e[37]=L):L=e[37];let B;e[38]!==s?(B=s("Slug (optional \u2014 derived from name)"),e[38]=s,e[39]=B):B=e[39];let V;e[40]===Symbol.for("react.memo_cache_sentinel")?(V=n(E=>{y(E.target.value)},"t14"),e[40]=V):V=e[40];let M;e[41]!==h?(M=(0,o.jsxDEV)(W,{"data-testid":"org-form-slug",id:"org-form-slug",onChange:V,value:h},void 0,!1),e[41]=h,e[42]=M):M=e[42];let F;e[43]!==B||e[44]!==M?(F=(0,o.jsxDEV)(q,{htmlFor:"org-form-slug",label:B,children:M},void 0,!1),e[43]=B,e[44]=M,e[45]=F):F=e[45];let U;e[46]!==s?(U=s("Logo URL (optional)"),e[46]=s,e[47]=U):U=e[47];let ie;e[48]===Symbol.for("react.memo_cache_sentinel")?(ie=n(E=>{I(E.target.value)},"t18"),e[48]=ie):ie=e[48];let X;e[49]!==b?(X=(0,o.jsxDEV)(W,{"data-testid":"org-form-logo",id:"org-form-logo",onChange:ie,value:b},void 0,!1),e[49]=b,e[50]=X):X=e[50];let Y;e[51]!==U||e[52]!==X?(Y=(0,o.jsxDEV)(q,{htmlFor:"org-form-logo",label:U,children:X},void 0,!1),e[51]=U,e[52]=X,e[53]=Y):Y=e[53];let Z;e[54]!==l||e[55]!==v||e[56]!==s?(Z=l==="create"&&(0,o.jsxDEV)(q,{htmlFor:"org-form-owner",label:s("Owner user id (optional)"),children:(0,o.jsxDEV)(W,{"data-testid":"org-form-owner",id:"org-form-owner",onChange:n(E=>{S(E.target.value)},"onChange"),value:v},void 0,!1)},void 0,!1),e[54]=l,e[55]=v,e[56]=s,e[57]=Z):Z=e[57];let ee;e[58]!==s?(ee=s("Metadata (JSON, optional)"),e[58]=s,e[59]=ee):ee=e[59];let oe;e[60]===Symbol.for("react.memo_cache_sentinel")?(oe=n(E=>{N(E.target.value)},"t23"),e[60]=oe):oe=e[60];let te;e[61]!==x?(te=(0,o.jsxDEV)(zt,{"data-testid":"org-form-metadata",id:"org-form-metadata",onChange:oe,value:x},void 0,!1),e[61]=x,e[62]=te):te=e[62];let O;e[63]!==ee||e[64]!==te?(O=(0,o.jsxDEV)(q,{htmlFor:"org-form-metadata",label:ee,children:te},void 0,!1),e[63]=ee,e[64]=te,e[65]=O):O=e[65];let se;return e[66]!==a||e[67]!==m||e[68]!==d||e[69]!==D||e[70]!==L||e[71]!==F||e[72]!==Y||e[73]!==Z||e[74]!==O||e[75]!==z||e[76]!==$||e[77]!==T?(se=(0,o.jsxDEV)(me,{busy:a,canSubmit:z,error:m,onClose:d,onSubmit:D,submitLabel:$,testId:"org-form",title:T,children:[L,F,Y,Z,O]},void 0,!0),e[66]=a,e[67]=m,e[68]=d,e[69]=D,e[70]=L,e[71]=F,e[72]=Y,e[73]=Z,e[74]=O,e[75]=z,e[76]=$,e[77]=T,e[78]=se):se=e[78],se},"OrgFormDialog"),Vt=n(t=>{let e=(0,G.c)(40),{onClose:l,onDone:d,organizationId:f}=t,r=le(),i=K(),{busy:s,error:a,run:m}=ae(),[c,p]=(0,P.useState)(""),[u,g]=(0,P.useState)(""),k;e[0]!==r||e[1]!==l||e[2]!==d||e[3]!==f||e[4]!==u||e[5]!==m||e[6]!==c?(k=n(()=>{m(async()=>{await r.addAuthOrgMember({organizationId:f,role:u.trim()===""?void 0:u.trim(),userId:c.trim()}),d(),l()})},"t1"),e[0]=r,e[1]=l,e[2]=d,e[3]=f,e[4]=u,e[5]=m,e[6]=c,e[7]=k):k=e[7];let h=k,y;e[8]!==c?(y=c.trim(),e[8]=c,e[9]=y):y=e[9];let w=y!=="",b;e[10]!==i?(b=i("Add member"),e[10]=i,e[11]=b):b=e[11];let I;e[12]!==i?(I=i("Add member"),e[12]=i,e[13]=I):I=e[13];let v;e[14]!==i?(v=i("User id"),e[14]=i,e[15]=v):v=e[15];let S;e[16]===Symbol.for("react.memo_cache_sentinel")?(S=n(T=>{p(T.target.value)},"t7"),e[16]=S):S=e[16];let C;e[17]!==c?(C=(0,o.jsxDEV)(W,{"data-testid":"org-add-member-user",id:"org-add-member-user",onChange:S,value:c},void 0,!1),e[17]=c,e[18]=C):C=e[18];let x;e[19]!==v||e[20]!==C?(x=(0,o.jsxDEV)(q,{htmlFor:"org-add-member-user",label:v,children:C},void 0,!1),e[19]=v,e[20]=C,e[21]=x):x=e[21];let N;e[22]!==i?(N=i("Role (optional)"),e[22]=i,e[23]=N):N=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=n(T=>{g(T.target.value)},"t11"),e[24]=_):_=e[24];let D;e[25]!==u?(D=(0,o.jsxDEV)(W,{"data-testid":"org-add-member-role",id:"org-add-member-role",onChange:_,value:u},void 0,!1),e[25]=u,e[26]=D):D=e[26];let z;e[27]!==N||e[28]!==D?(z=(0,o.jsxDEV)(q,{htmlFor:"org-add-member-role",label:N,children:D},void 0,!1),e[27]=N,e[28]=D,e[29]=z):z=e[29];let $;return e[30]!==s||e[31]!==a||e[32]!==l||e[33]!==h||e[34]!==z||e[35]!==w||e[36]!==b||e[37]!==I||e[38]!==x?($=(0,o.jsxDEV)(me,{busy:s,canSubmit:w,error:a,onClose:l,onSubmit:h,submitLabel:b,testId:"org-add-member",title:I,children:[x,z]},void 0,!0),e[30]=s,e[31]=a,e[32]=l,e[33]=h,e[34]=z,e[35]=w,e[36]=b,e[37]=I,e[38]=x,e[39]=$):$=e[39],$},"MemberAddDialog"),qt=n(t=>{let e=(0,G.c)(40),{onClose:l,onDone:d,organizationId:f}=t,r=le(),i=K(),{busy:s,error:a,run:m}=ae(),[c,p]=(0,P.useState)(""),[u,g]=(0,P.useState)(""),k;e[0]!==r||e[1]!==c||e[2]!==l||e[3]!==d||e[4]!==f||e[5]!==u||e[6]!==m?(k=n(()=>{m(async()=>{await r.inviteAuthOrgMember({email:c.trim(),organizationId:f,role:u.trim()===""?void 0:u.trim()}),d(),l()})},"t1"),e[0]=r,e[1]=c,e[2]=l,e[3]=d,e[4]=f,e[5]=u,e[6]=m,e[7]=k):k=e[7];let h=k,y;e[8]!==c?(y=c.trim(),e[8]=c,e[9]=y):y=e[9];let w=y!=="",b;e[10]!==i?(b=i("Send invitation"),e[10]=i,e[11]=b):b=e[11];let I;e[12]!==i?(I=i("Invite member"),e[12]=i,e[13]=I):I=e[13];let v;e[14]!==i?(v=i("email"),e[14]=i,e[15]=v):v=e[15];let S;e[16]===Symbol.for("react.memo_cache_sentinel")?(S=n(T=>{p(T.target.value)},"t7"),e[16]=S):S=e[16];let C;e[17]!==c?(C=(0,o.jsxDEV)(W,{"data-testid":"org-invite-member-email",id:"org-invite-member-email",onChange:S,type:"email",value:c},void 0,!1),e[17]=c,e[18]=C):C=e[18];let x;e[19]!==v||e[20]!==C?(x=(0,o.jsxDEV)(q,{htmlFor:"org-invite-member-email",label:v,children:C},void 0,!1),e[19]=v,e[20]=C,e[21]=x):x=e[21];let N;e[22]!==i?(N=i("Role (optional)"),e[22]=i,e[23]=N):N=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=n(T=>{g(T.target.value)},"t11"),e[24]=_):_=e[24];let D;e[25]!==u?(D=(0,o.jsxDEV)(W,{"data-testid":"org-invite-member-role",id:"org-invite-member-role",onChange:_,value:u},void 0,!1),e[25]=u,e[26]=D):D=e[26];let z;e[27]!==N||e[28]!==D?(z=(0,o.jsxDEV)(q,{htmlFor:"org-invite-member-role",label:N,children:D},void 0,!1),e[27]=N,e[28]=D,e[29]=z):z=e[29];let $;return e[30]!==s||e[31]!==a||e[32]!==l||e[33]!==h||e[34]!==z||e[35]!==w||e[36]!==b||e[37]!==I||e[38]!==x?($=(0,o.jsxDEV)(me,{busy:s,canSubmit:w,error:a,onClose:l,onSubmit:h,submitLabel:b,testId:"org-invite-member",title:I,children:[x,z]},void 0,!0),e[30]=s,e[31]=a,e[32]=l,e[33]=h,e[34]=z,e[35]=w,e[36]=b,e[37]=I,e[38]=x,e[39]=$):$=e[39],$},"MemberInviteDialog"),Gt=n(t=>{let e=(0,G.c)(32),{member:l,onClose:d,onDone:f}=t,r=le(),i=K(),{busy:s,error:a,run:m}=ae(),c;e[0]!==l.role?(c=A(l.role),e[0]=l.role,e[1]=c):c=e[1];let[p,u]=(0,P.useState)(c),g;e[2]!==r||e[3]!==l.id||e[4]!==d||e[5]!==f||e[6]!==p||e[7]!==m?(g=n(()=>{m(async()=>{await r.setAuthOrgMemberRole({memberId:A(l.id),role:p.trim()}),f(),d()})},"t2"),e[2]=r,e[3]=l.id,e[4]=d,e[5]=f,e[6]=p,e[7]=m,e[8]=g):g=e[8];let k=g,h;e[9]!==p?(h=p.trim(),e[9]=p,e[10]=h):h=e[10];let y=h!=="",w;e[11]!==i?(w=i("Save"),e[11]=i,e[12]=w):w=e[12];let b;e[13]!==i?(b=i("Change member role"),e[13]=i,e[14]=b):b=e[14];let I;e[15]!==i?(I=i("Role"),e[15]=i,e[16]=I):I=e[16];let v;e[17]===Symbol.for("react.memo_cache_sentinel")?(v=n(N=>{u(N.target.value)},"t8"),e[17]=v):v=e[17];let S;e[18]!==p?(S=(0,o.jsxDEV)(W,{"data-testid":"org-member-role-value",id:"org-member-role-value",onChange:v,value:p},void 0,!1),e[18]=p,e[19]=S):S=e[19];let C;e[20]!==I||e[21]!==S?(C=(0,o.jsxDEV)(q,{htmlFor:"org-member-role-value",label:I,children:S},void 0,!1),e[20]=I,e[21]=S,e[22]=C):C=e[22];let x;return e[23]!==s||e[24]!==a||e[25]!==d||e[26]!==k||e[27]!==C||e[28]!==y||e[29]!==w||e[30]!==b?(x=(0,o.jsxDEV)(me,{busy:s,canSubmit:y,error:a,onClose:d,onSubmit:k,submitLabel:w,testId:"org-member-role",title:b,children:C},void 0,!1),e[23]=s,e[24]=a,e[25]=d,e[26]=k,e[27]=C,e[28]=y,e[29]=w,e[30]=b,e[31]=x):x=e[31],x},"MemberRoleDialog"),Et=n(t=>{let e=(0,G.c)(36),{mode:l,onClose:d,onDone:f,organizationId:r,team:i}=t,s=le(),a=K(),{busy:m,error:c,run:p}=ae(),u;e[0]!==i?(u=i?A(i.name):"",e[0]=i,e[1]=u):u=e[1];let[g,k]=(0,P.useState)(u),h;e[2]!==s||e[3]!==l||e[4]!==g||e[5]!==d||e[6]!==f||e[7]!==r||e[8]!==p||e[9]!==i?.id?(h=n(()=>{p(async()=>{await(l==="create"?s.createAuthOrgTeam({name:g.trim(),organizationId:r}):s.updateAuthOrgTeam({name:g.trim(),teamId:A(i?.id)})),f(),d()})},"t2"),e[2]=s,e[3]=l,e[4]=g,e[5]=d,e[6]=f,e[7]=r,e[8]=p,e[9]=i?.id,e[10]=h):h=e[10];let y=h,w;e[11]!==g?(w=g.trim(),e[11]=g,e[12]=w):w=e[12];let b=w!=="",I;e[13]!==l||e[14]!==a?(I=a(l==="create"?"Create":"Save"),e[13]=l,e[14]=a,e[15]=I):I=e[15];let v;e[16]!==l||e[17]!==a?(v=a(l==="create"?"New team":"Rename team"),e[16]=l,e[17]=a,e[18]=v):v=e[18];let S;e[19]!==a?(S=a("name"),e[19]=a,e[20]=S):S=e[20];let C;e[21]===Symbol.for("react.memo_cache_sentinel")?(C=n(D=>{k(D.target.value)},"t8"),e[21]=C):C=e[21];let x;e[22]!==g?(x=(0,o.jsxDEV)(W,{"data-testid":"org-team-form-name",id:"org-team-form-name",onChange:C,value:g},void 0,!1),e[22]=g,e[23]=x):x=e[23];let N;e[24]!==S||e[25]!==x?(N=(0,o.jsxDEV)(q,{htmlFor:"org-team-form-name",label:S,children:x},void 0,!1),e[24]=S,e[25]=x,e[26]=N):N=e[26];let _;return e[27]!==m||e[28]!==c||e[29]!==d||e[30]!==y||e[31]!==N||e[32]!==b||e[33]!==I||e[34]!==v?(_=(0,o.jsxDEV)(me,{busy:m,canSubmit:b,error:c,onClose:d,onSubmit:y,submitLabel:I,testId:"org-team-form",title:v,children:N},void 0,!1),e[27]=m,e[28]=c,e[29]=d,e[30]=y,e[31]=N,e[32]=b,e[33]=I,e[34]=v,e[35]=_):_=e[35],_},"TeamFormDialog"),Kt=n(t=>{let e=(0,G.c)(30),{onClose:l,onDone:d,teamId:f}=t,r=le(),i=K(),{busy:s,error:a,run:m}=ae(),[c,p]=(0,P.useState)(""),u;e[0]!==r||e[1]!==l||e[2]!==d||e[3]!==m||e[4]!==f||e[5]!==c?(u=n(()=>{m(async()=>{await r.addAuthOrgTeamMember({teamId:f,userId:c.trim()}),d(),l()})},"t1"),e[0]=r,e[1]=l,e[2]=d,e[3]=m,e[4]=f,e[5]=c,e[6]=u):u=e[6];let g=u,k;e[7]!==c?(k=c.trim(),e[7]=c,e[8]=k):k=e[8];let h=k!=="",y;e[9]!==i?(y=i("Add member"),e[9]=i,e[10]=y):y=e[10];let w;e[11]!==i?(w=i("Add team member"),e[11]=i,e[12]=w):w=e[12];let b;e[13]!==i?(b=i("User id"),e[13]=i,e[14]=b):b=e[14];let I;e[15]===Symbol.for("react.memo_cache_sentinel")?(I=n(x=>{p(x.target.value)},"t7"),e[15]=I):I=e[15];let v;e[16]!==c?(v=(0,o.jsxDEV)(W,{"data-testid":"org-team-add-member-user",id:"org-team-add-member-user",onChange:I,value:c},void 0,!1),e[16]=c,e[17]=v):v=e[17];let S;e[18]!==b||e[19]!==v?(S=(0,o.jsxDEV)(q,{htmlFor:"org-team-add-member-user",label:b,children:v},void 0,!1),e[18]=b,e[19]=v,e[20]=S):S=e[20];let C;return e[21]!==s||e[22]!==a||e[23]!==l||e[24]!==g||e[25]!==h||e[26]!==y||e[27]!==w||e[28]!==S?(C=(0,o.jsxDEV)(me,{busy:s,canSubmit:h,error:a,onClose:l,onSubmit:g,submitLabel:y,testId:"org-team-add-member",title:w,children:S},void 0,!1),e[21]=s,e[22]=a,e[23]=l,e[24]=g,e[25]=h,e[26]=y,e[27]=w,e[28]=S,e[29]=C):C=e[29],C},"TeamMemberAddDialog"),Lt=n(t=>{let e=(0,G.c)(47),{mode:l,onClose:d,onDone:f,organizationId:r,role:i}=t,s=le(),a=K(),{busy:m,error:c,run:p}=ae(),u;e[0]!==i?(u=i?A(i.role):"",e[0]=i,e[1]=u):u=e[1];let[g,k]=(0,P.useState)(u),h;e[2]!==l||e[3]!==i?.permission?(h=l==="edit"?Pt(i?.permission):"",e[2]=l,e[3]=i?.permission,e[4]=h):h=e[4];let[y,w]=(0,P.useState)(h),b;e[5]!==s||e[6]!==l||e[7]!==g||e[8]!==d||e[9]!==f||e[10]!==r||e[11]!==y||e[12]!==i?.id||e[13]!==p?(b=n(()=>{p(async()=>{let T=Ht(y);await(l==="create"?s.createAuthOrgRole({organizationId:r,permission:T,role:g.trim()}):s.updateAuthOrgRole({permission:T,roleId:A(i?.id)})),f(),d()})},"t3"),e[5]=s,e[6]=l,e[7]=g,e[8]=d,e[9]=f,e[10]=r,e[11]=y,e[12]=i?.id,e[13]=p,e[14]=b):b=e[14];let I=b,v;e[15]!==l||e[16]!==g||e[17]!==y?(v=y.trim()!==""&&(l==="edit"||g.trim()!==""),e[15]=l,e[16]=g,e[17]=y,e[18]=v):v=e[18];let S;e[19]!==l||e[20]!==a?(S=a(l==="create"?"Create":"Save"),e[19]=l,e[20]=a,e[21]=S):S=e[21];let C;e[22]!==l||e[23]!==a?(C=a(l==="create"?"New role":"Edit role"),e[22]=l,e[23]=a,e[24]=C):C=e[24];let x;e[25]!==l||e[26]!==g||e[27]!==a?(x=l==="create"&&(0,o.jsxDEV)(q,{htmlFor:"org-role-form-name",label:a("Role name"),children:(0,o.jsxDEV)(W,{"data-testid":"org-role-form-name",id:"org-role-form-name",onChange:n(T=>{k(T.target.value)},"onChange"),value:g},void 0,!1)},void 0,!1),e[25]=l,e[26]=g,e[27]=a,e[28]=x):x=e[28];let N;e[29]!==a?(N=a('Permission (JSON, e.g. {"project":["create","update"]})'),e[29]=a,e[30]=N):N=e[30];let _;e[31]===Symbol.for("react.memo_cache_sentinel")?(_=n(T=>{w(T.target.value)},"t9"),e[31]=_):_=e[31];let D;e[32]!==y?(D=(0,o.jsxDEV)(zt,{"data-testid":"org-role-form-permission",id:"org-role-form-permission",onChange:_,value:y},void 0,!1),e[32]=y,e[33]=D):D=e[33];let z;e[34]!==D||e[35]!==N?(z=(0,o.jsxDEV)(q,{htmlFor:"org-role-form-permission",label:N,children:D},void 0,!1),e[34]=D,e[35]=N,e[36]=z):z=e[36];let $;return e[37]!==m||e[38]!==c||e[39]!==d||e[40]!==I||e[41]!==z||e[42]!==v||e[43]!==S||e[44]!==C||e[45]!==x?($=(0,o.jsxDEV)(me,{busy:m,canSubmit:v,error:c,onClose:d,onSubmit:I,submitLabel:S,testId:"org-role-form",title:C,children:[x,z]},void 0,!0),e[37]=m,e[38]=c,e[39]=d,e[40]=I,e[41]=z,e[42]=v,e[43]=S,e[44]=C,e[45]=x,e[46]=$):$=e[46],$},"RoleFormDialog"),Qt=n(t=>{let e=(0,G.c)(18),{action:l,message:d,onClose:f,onDone:r,testId:i,title:s}=t,a=K(),{busy:m,error:c,run:p}=ae(),u;e[0]!==l||e[1]!==f||e[2]!==r||e[3]!==p?(u=n(()=>{p(async()=>{await l(),r(),f()})},"t1"),e[0]=l,e[1]=f,e[2]=r,e[3]=p,e[4]=u):u=e[4];let g=u,k;e[5]!==a?(k=a("Delete"),e[5]=a,e[6]=k):k=e[6];let h;e[7]!==d?(h=(0,o.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:d},void 0,!1),e[7]=d,e[8]=h):h=e[8];let y;return e[9]!==m||e[10]!==c||e[11]!==f||e[12]!==g||e[13]!==k||e[14]!==h||e[15]!==i||e[16]!==s?(y=(0,o.jsxDEV)(me,{busy:m,canSubmit:!0,destructive:!0,error:c,onClose:f,onSubmit:g,submitLabel:k,testId:i,title:s,children:h},void 0,!1),e[9]=m,e[10]=c,e[11]=f,e[12]=g,e[13]=k,e[14]=h,e[15]=i,e[16]=s,e[17]=y):y=e[17],y},"ConfirmDialog"),lt=n(t=>{let e=(0,G.c)(13),{action:l,children:d,heading:f,testId:r}=t,i;e[0]!==f?(i=(0,o.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:f},void 0,!1),e[0]=f,e[1]=i):i=e[1];let s;e[2]!==l?(s=l!==void 0&&(0,o.jsxDEV)("div",{className:"flex items-center gap-2",children:l},void 0,!1),e[2]=l,e[3]=s):s=e[3];let a;e[4]!==i||e[5]!==s?(a=(0,o.jsxDEV)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[i,s]},void 0,!0),e[4]=i,e[5]=s,e[6]=a):a=e[6];let m;e[7]!==d?(m=(0,o.jsxDEV)(wt,{className:"px-0",children:d},void 0,!1),e[7]=d,e[8]=m):m=e[8];let c;return e[9]!==a||e[10]!==m||e[11]!==r?(c=(0,o.jsxDEV)(kt,{className:"overflow-hidden py-0","data-testid":r,children:[a,m]},void 0,!0),e[9]=a,e[10]=m,e[11]=r,e[12]=c):c=e[12],c},"SectionCard"),it=n(t=>{let e=(0,G.c)(23),{columns:l,rowActions:d,rowPrefix:f,rows:r}=t,i=K(),s;e[0]!==l?(s=l.map(Xt),e[0]=l,e[1]=s):s=e[1];let a;e[2]!==i?(a=i("Actions"),e[2]=i,e[3]=a):a=e[3];let m;e[4]!==a?(m=(0,o.jsxDEV)(ne,{"aria-label":a},void 0,!1),e[4]=a,e[5]=m):m=e[5];let c;e[6]!==s||e[7]!==m?(c=(0,o.jsxDEV)(Nt,{children:(0,o.jsxDEV)(tt,{children:[s,m]},void 0,!0)},void 0,!1),e[6]=s,e[7]=m,e[8]=c):c=e[8];let p;if(e[9]!==l||e[10]!==d||e[11]!==f||e[12]!==r){let k;e[14]!==l||e[15]!==d||e[16]!==f?(k=n(h=>{let y=A(h.id);return(0,o.jsxDEV)(tt,{"data-testid":`${f}-${y}`,children:[l.map(w=>(0,o.jsxDEV)(de,{className:w.className,children:w.render(h)},w.head,!1)),(0,o.jsxDEV)(de,{children:(0,o.jsxDEV)("div",{className:"flex justify-end gap-1",children:d(h)},void 0,!1)},void 0,!1)]},y,!0)},"t62"),e[14]=l,e[15]=d,e[16]=f,e[17]=k):k=e[17],p=r.map(k),e[9]=l,e[10]=d,e[11]=f,e[12]=r,e[13]=p}else p=e[13];let u;e[18]!==p?(u=(0,o.jsxDEV)(At,{children:p},void 0,!1),e[18]=p,e[19]=u):u=e[19];let g;return e[20]!==c||e[21]!==u?(g=(0,o.jsxDEV)(St,{children:[c,u]},void 0,!0),e[20]=c,e[21]=u,e[22]=g):g=e[22],g},"ManagedTable"),Wt=n(t=>{let e=(0,G.c)(219),{organizationId:l,rolesEnabled:d,teamsEnabled:f}=t,r=le(),i=K(),[s,a]=(0,P.useState)(null),[m,c]=(0,P.useState)(null),[p,u]=(0,P.useState)(!1),[g,k]=(0,P.useState)(null),h;e[0]!==l?(h=["lunora-auth-org-members",l],e[0]=l,e[1]=h):h=e[1];let y;e[2]!==r||e[3]!==l?(y=n(()=>r.listAuthOrgMembers({limit:200,organizationId:l}),"t2"),e[2]=r,e[3]=l,e[4]=y):y=e[4];let w=fe(h,y),b;e[5]!==l?(b=["lunora-auth-org-invitations",l],e[5]=l,e[6]=b):b=e[6];let I;e[7]!==r||e[8]!==l?(I=n(()=>r.listAuthOrgInvitations({limit:200,organizationId:l}),"t4"),e[7]=r,e[8]=l,e[9]=I):I=e[9];let v=fe(b,I),S;e[10]!==l?(S=["lunora-auth-org-teams",l],e[10]=l,e[11]=S):S=e[11];let C;e[12]!==r||e[13]!==l?(C=n(()=>r.listAuthOrgTeams({limit:200,organizationId:l}),"t6"),e[12]=r,e[13]=l,e[14]=C):C=e[14];let x;e[15]!==f?(x={enabled:f},e[15]=f,e[16]=x):x=e[16];let N=fe(S,C,x),_;e[17]!==l?(_=["lunora-auth-org-roles",l],e[17]=l,e[18]=_):_=e[18];let D;e[19]!==r||e[20]!==l?(D=n(()=>r.listAuthOrgRoles({limit:200,organizationId:l}),"t9"),e[19]=r,e[20]=l,e[21]=D):D=e[21];let z;e[22]!==d?(z={enabled:d},e[22]=d,e[23]=z):z=e[23];let $=fe(_,D,z),T;e[24]!==m?(T=["lunora-auth-org-team-members",m],e[24]=m,e[25]=T):T=e[25];let Q;e[26]!==r||e[27]!==m?(Q=n(()=>r.listAuthOrgTeamMembers({limit:200,teamId:m??""}),"t12"),e[26]=r,e[27]=m,e[28]=Q):Q=e[28];let H=m!==null,J;e[29]!==H?(J={enabled:H},e[29]=H,e[30]=J):J=e[30];let L=fe(T,Q,J),B;e[31]!==w.data?.rows?(B=w.data?.rows??[],e[31]=w.data?.rows,e[32]=B):B=e[32];let V=B,M;e[33]!==v.data?.rows?(M=v.data?.rows??[],e[33]=v.data?.rows,e[34]=M):M=e[34];let F=M,U;e[35]!==N.data?.rows?(U=N.data?.rows??[],e[35]=N.data?.rows,e[36]=U):U=e[36];let ie=U,X;e[37]!==$.data?.rows?(X=$.data?.rows??[],e[37]=$.data?.rows,e[38]=X):X=e[38];let Y=X,Z;e[39]!==m||e[40]!==L?(Z=m===null?[]:L.data?.rows??[],e[39]=m,e[40]=L,e[41]=Z):Z=e[41];let ee=Z,oe=w.error??v.error??N.error??$.error??L.error,te;e[42]!==v||e[43]!==w||e[44]!==d||e[45]!==$||e[46]!==m||e[47]!==L||e[48]!==f||e[49]!==N?(te=n(()=>{w.refetch(),v.refetch(),f&&N.refetch(),d&&$.refetch(),m!==null&&L.refetch()},"t20"),e[42]=v,e[43]=w,e[44]=d,e[45]=$,e[46]=m,e[47]=L,e[48]=f,e[49]=N,e[50]=te):te=e[50];let O=te;Dt(O,!0);let se;e[51]===Symbol.for("react.memo_cache_sentinel")?(se=n(()=>{a(null)},"t21"),e[51]=se):se=e[51];let E=se,ot;e[52]!==O?(ot=n(R=>{_t((async()=>{u(!0),k(null);try{await R(),O(),u(!1)}catch(gt){k(Ot(gt)),u(!1)}})())},"t22"),e[52]=O,e[53]=ot):ot=e[53];let re=ot,st;e[54]!==r||e[55]!==i?(st=n(R=>{let gt=A(R.id);a({action:n(async()=>{await r.removeAuthOrgTeam({teamId:gt}),c(xt=>xt===gt?null:xt)},"action"),kind:"confirm",message:i("Delete this team and its memberships? This cannot be undone."),testId:"org-team-delete",title:i("Delete team")})},"t23"),e[54]=r,e[55]=i,e[56]=st):st=e[56];let vt=st,ue;e[57]!==i?(ue=i("userId"),e[57]=i,e[58]=ue):ue=e[58];let ge;e[59]!==ue?(ge={head:ue,render:Yt},e[59]=ue,e[60]=ge):ge=e[60];let ve;e[61]!==i?(ve=i("role"),e[61]=i,e[62]=ve):ve=e[62];let he;e[63]!==ve?(he={head:ve,render:Zt},e[63]=ve,e[64]=he):he=e[64];let rt;e[65]!==ge||e[66]!==he?(rt=[ge,he],e[65]=ge,e[66]=he,e[67]=rt):rt=e[67];let ht=rt,be;e[68]!==i?(be=i("email"),e[68]=i,e[69]=be):be=e[69];let pe;e[70]!==be?(pe={head:be,render:el},e[70]=be,e[71]=pe):pe=e[71];let ye;e[72]!==i?(ye=i("role"),e[72]=i,e[73]=ye):ye=e[73];let Ce;e[74]!==ye?(Ce={head:ye,render:tl},e[74]=ye,e[75]=Ce):Ce=e[75];let xe;e[76]!==i?(xe=i("status"),e[76]=i,e[77]=xe):xe=e[77];let Ie;e[78]!==xe?(Ie={head:xe,render:ll},e[78]=xe,e[79]=Ie):Ie=e[79];let at;e[80]!==pe||e[81]!==Ce||e[82]!==Ie?(at=[pe,Ce,Ie],e[80]=pe,e[81]=Ce,e[82]=Ie,e[83]=at):at=e[83];let bt=at,ke;e[84]!==i?(ke=i("id"),e[84]=i,e[85]=ke):ke=e[85];let we;e[86]!==ke?(we={className:"font-mono text-xs",head:ke,render:il},e[86]=ke,e[87]=we):we=e[87];let Se;e[88]!==i?(Se=i("name"),e[88]=i,e[89]=Se):Se=e[89];let Ne;e[90]!==Se?(Ne={head:Se,render:ol},e[90]=Se,e[91]=Ne):Ne=e[91];let nt;e[92]!==we||e[93]!==Ne?(nt=[we,Ne],e[92]=we,e[93]=Ne,e[94]=nt):nt=e[94];let pt=nt,Ae;e[95]!==i?(Ae=i("userId"),e[95]=i,e[96]=Ae):Ae=e[96];let dt;e[97]!==Ae?(dt=[{head:Ae,render:sl}],e[97]=Ae,e[98]=dt):dt=e[98];let yt=dt,ze;e[99]!==i?(ze=i("role"),e[99]=i,e[100]=ze):ze=e[100];let De;e[101]!==ze?(De={head:ze,render:rl},e[101]=ze,e[102]=De):De=e[102];let Oe;e[103]!==i?(Oe=i("Permission"),e[103]=i,e[104]=Oe):Oe=e[104];let _e;e[105]!==Oe?(_e={className:"font-mono text-xs whitespace-pre-wrap",head:Oe,render:al},e[105]=Oe,e[106]=_e):_e=e[106];let mt;e[107]!==De||e[108]!==_e?(mt=[De,_e],e[107]=De,e[108]=_e,e[109]=mt):mt=e[109];let Ct=mt,$e;e[110]!==oe?($e=oe!==null&&(0,o.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"org-detail-error",role:"alert",children:oe},void 0,!1),e[110]=oe,e[111]=$e):$e=e[111];let Te;e[112]!==g?(Te=g!==null&&(0,o.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"org-action-error",role:"alert",children:g},void 0,!1),e[112]=g,e[113]=Te):Te=e[113];let ct;e[114]===Symbol.for("react.memo_cache_sentinel")?(ct=n(()=>{a({kind:"add-member"})},"t50"),e[114]=ct):ct=e[114];let Me;e[115]!==i?(Me=i("Add member"),e[115]=i,e[116]=Me):Me=e[116];let Fe;e[117]!==Me?(Fe=(0,o.jsxDEV)(j,{"data-testid":"org-open-add-member",onClick:ct,size:"xs",type:"button",variant:"outline",children:Me},void 0,!1),e[117]=Me,e[118]=Fe):Fe=e[118];let ft;e[119]===Symbol.for("react.memo_cache_sentinel")?(ft=n(()=>{a({kind:"invite-member"})},"t53"),e[119]=ft):ft=e[119];let Re;e[120]!==i?(Re=i("Invite member"),e[120]=i,e[121]=Re):Re=e[121];let Ee;e[122]!==Re?(Ee=(0,o.jsxDEV)(j,{"data-testid":"org-open-invite-member",onClick:ft,size:"xs",type:"button",variant:"outline",children:Re},void 0,!1),e[122]=Re,e[123]=Ee):Ee=e[123];let Le;e[124]!==Fe||e[125]!==Ee?(Le=(0,o.jsxDEV)(o.Fragment,{children:[Fe,Ee]},void 0,!0),e[124]=Fe,e[125]=Ee,e[126]=Le):Le=e[126];let je;e[127]!==i?(je=i("Members"),e[127]=i,e[128]=je):je=e[128];let Pe;e[129]!==p||e[130]!==r||e[131]!==ht||e[132]!==V||e[133]!==re||e[134]!==i?(Pe=V.length===0?(0,o.jsxDEV)("div",{className:"p-3",children:(0,o.jsxDEV)(ce,{testId:"org-members-empty",title:i("No members.")},void 0,!1)},void 0,!1):(0,o.jsxDEV)(it,{columns:ht,rowActions:n(R=>(0,o.jsxDEV)(o.Fragment,{children:[(0,o.jsxDEV)(j,{"data-testid":`org-member-role-${A(R.id)}`,onClick:n(()=>{a({kind:"member-role",member:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Change role")},void 0,!1),(0,o.jsxDEV)(j,{"data-testid":`org-remove-member-${A(R.id)}`,disabled:p,onClick:n(()=>{re(()=>r.removeAuthOrgMember({memberId:A(R.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Remove")},void 0,!1)]},void 0,!0),"rowActions"),rowPrefix:"org-member",rows:V},void 0,!1),e[129]=p,e[130]=r,e[131]=ht,e[132]=V,e[133]=re,e[134]=i,e[135]=Pe):Pe=e[135];let Qe;e[136]!==Le||e[137]!==je||e[138]!==Pe?(Qe=(0,o.jsxDEV)(lt,{action:Le,heading:je,testId:"org-members",children:Pe},void 0,!1),e[136]=Le,e[137]=je,e[138]=Pe,e[139]=Qe):Qe=e[139];let Je;e[140]!==p||e[141]!==r||e[142]!==bt||e[143]!==F||e[144]!==re||e[145]!==i?(Je=F.length>0&&(0,o.jsxDEV)(lt,{heading:i("Invitations"),testId:"org-invitations",children:(0,o.jsxDEV)(it,{columns:bt,rowActions:n(R=>(0,o.jsxDEV)(j,{"data-testid":`org-cancel-invitation-${A(R.id)}`,disabled:p,onClick:n(()=>{re(()=>r.cancelAuthOrgInvitation({invitationId:A(R.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Cancel")},void 0,!1),"rowActions"),rowPrefix:"org-invitation",rows:F},void 0,!1)},void 0,!1),e[140]=p,e[141]=r,e[142]=bt,e[143]=F,e[144]=re,e[145]=i,e[146]=Je):Je=e[146];let Be;e[147]!==vt||e[148]!==m||e[149]!==i||e[150]!==pt||e[151]!==ie||e[152]!==f?(Be=f&&(0,o.jsxDEV)(lt,{action:(0,o.jsxDEV)(j,{"data-testid":"org-open-create-team",onClick:n(()=>{a({kind:"team-create"})},"onClick"),size:"xs",type:"button",variant:"outline",children:i("New team")},void 0,!1),heading:i("Teams"),testId:"org-teams",children:ie.length===0?(0,o.jsxDEV)("div",{className:"p-3",children:(0,o.jsxDEV)(ce,{testId:"org-teams-empty",title:i("No teams.")},void 0,!1)},void 0,!1):(0,o.jsxDEV)(it,{columns:pt,rowActions:n(R=>(0,o.jsxDEV)(o.Fragment,{children:[(0,o.jsxDEV)(j,{"aria-pressed":m===A(R.id),"data-testid":`org-team-select-${A(R.id)}`,onClick:n(()=>{c(A(R.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Members")},void 0,!1),(0,o.jsxDEV)(j,{"data-testid":`org-team-rename-${A(R.id)}`,onClick:n(()=>{a({kind:"team-rename",team:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Rename")},void 0,!1),(0,o.jsxDEV)(j,{"data-testid":`org-team-delete-${A(R.id)}`,onClick:n(()=>{vt(R)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Delete")},void 0,!1)]},void 0,!0),"rowActions"),rowPrefix:"org-team",rows:ie},void 0,!1)},void 0,!1),e[147]=vt,e[148]=m,e[149]=i,e[150]=pt,e[151]=ie,e[152]=f,e[153]=Be):Be=e[153];let Ue;e[154]!==p||e[155]!==r||e[156]!==re||e[157]!==m||e[158]!==i||e[159]!==yt||e[160]!==ee||e[161]!==f?(Ue=f&&m!==null&&(0,o.jsxDEV)(lt,{action:(0,o.jsxDEV)(j,{"data-testid":"org-open-add-team-member",onClick:n(()=>{a({kind:"team-add-member",teamId:m})},"onClick"),size:"xs",type:"button",variant:"outline",children:i("Add member")},void 0,!1),heading:i("Team members"),testId:"org-team-members",children:ee.length===0?(0,o.jsxDEV)("div",{className:"p-3",children:(0,o.jsxDEV)(ce,{testId:"org-team-members-empty",title:i("No team members.")},void 0,!1)},void 0,!1):(0,o.jsxDEV)(it,{columns:yt,rowActions:n(R=>(0,o.jsxDEV)(j,{"data-testid":`org-team-remove-member-${A(R.id)}`,disabled:p,onClick:n(()=>{re(()=>r.removeAuthOrgTeamMember({teamMemberId:A(R.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Remove")},void 0,!1),"rowActions"),rowPrefix:"org-team-member",rows:ee},void 0,!1)},void 0,!1),e[154]=p,e[155]=r,e[156]=re,e[157]=m,e[158]=i,e[159]=yt,e[160]=ee,e[161]=f,e[162]=Ue):Ue=e[162];let He;e[163]!==r||e[164]!==Ct||e[165]!==Y||e[166]!==d||e[167]!==i?(He=d&&(0,o.jsxDEV)(lt,{action:(0,o.jsxDEV)(j,{"data-testid":"org-open-create-role",onClick:n(()=>{a({kind:"role-create"})},"onClick"),size:"xs",type:"button",variant:"outline",children:i("New role")},void 0,!1),heading:i("Roles"),testId:"org-roles",children:Y.length===0?(0,o.jsxDEV)("div",{className:"p-3",children:(0,o.jsxDEV)(ce,{testId:"org-roles-empty",title:i("No custom roles.")},void 0,!1)},void 0,!1):(0,o.jsxDEV)(it,{columns:Ct,rowActions:n(R=>(0,o.jsxDEV)(o.Fragment,{children:[(0,o.jsxDEV)(j,{"data-testid":`org-role-edit-${A(R.id)}`,onClick:n(()=>{a({kind:"role-edit",role:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Edit")},void 0,!1),(0,o.jsxDEV)(j,{"data-testid":`org-role-delete-${A(R.id)}`,onClick:n(()=>{a({action:n(()=>r.deleteAuthOrgRole({roleId:A(R.id)}),"action"),kind:"confirm",message:i("Delete this custom role? Members keeping it will lose its grants."),testId:"org-role-delete",title:i("Delete role")})},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Delete")},void 0,!1)]},void 0,!0),"rowActions"),rowPrefix:"org-role",rows:Y},void 0,!1)},void 0,!1),e[163]=r,e[164]=Ct,e[165]=Y,e[166]=d,e[167]=i,e[168]=He):He=e[168];let Ve;e[169]!==s?.kind||e[170]!==l||e[171]!==O?(Ve=s?.kind==="add-member"&&(0,o.jsxDEV)(Vt,{onClose:E,onDone:O,organizationId:l},void 0,!1),e[169]=s?.kind,e[170]=l,e[171]=O,e[172]=Ve):Ve=e[172];let qe;e[173]!==s?.kind||e[174]!==l||e[175]!==O?(qe=s?.kind==="invite-member"&&(0,o.jsxDEV)(qt,{onClose:E,onDone:O,organizationId:l},void 0,!1),e[173]=s?.kind,e[174]=l,e[175]=O,e[176]=qe):qe=e[176];let Ge;e[177]!==s||e[178]!==O?(Ge=s?.kind==="member-role"&&(0,o.jsxDEV)(Gt,{member:s.member,onClose:E,onDone:O},void 0,!1),e[177]=s,e[178]=O,e[179]=Ge):Ge=e[179];let Ke;e[180]!==s?.kind||e[181]!==l||e[182]!==O?(Ke=s?.kind==="team-create"&&(0,o.jsxDEV)(Et,{mode:"create",onClose:E,onDone:O,organizationId:l},void 0,!1),e[180]=s?.kind,e[181]=l,e[182]=O,e[183]=Ke):Ke=e[183];let We;e[184]!==s||e[185]!==l||e[186]!==O?(We=s?.kind==="team-rename"&&(0,o.jsxDEV)(Et,{mode:"edit",onClose:E,onDone:O,organizationId:l,team:s.team},void 0,!1),e[184]=s,e[185]=l,e[186]=O,e[187]=We):We=e[187];let Xe;e[188]!==s||e[189]!==O?(Xe=s?.kind==="team-add-member"&&(0,o.jsxDEV)(Kt,{onClose:E,onDone:O,teamId:s.teamId},void 0,!1),e[188]=s,e[189]=O,e[190]=Xe):Xe=e[190];let Ye;e[191]!==s?.kind||e[192]!==l||e[193]!==O?(Ye=s?.kind==="role-create"&&(0,o.jsxDEV)(Lt,{mode:"create",onClose:E,onDone:O,organizationId:l},void 0,!1),e[191]=s?.kind,e[192]=l,e[193]=O,e[194]=Ye):Ye=e[194];let Ze;e[195]!==s||e[196]!==l||e[197]!==O?(Ze=s?.kind==="role-edit"&&(0,o.jsxDEV)(Lt,{mode:"edit",onClose:E,onDone:O,organizationId:l,role:s.role},void 0,!1),e[195]=s,e[196]=l,e[197]=O,e[198]=Ze):Ze=e[198];let et;e[199]!==s||e[200]!==O?(et=s?.kind==="confirm"&&(0,o.jsxDEV)(Qt,{action:s.action,message:s.message,onClose:E,onDone:O,testId:s.testId,title:s.title},void 0,!1),e[199]=s,e[200]=O,e[201]=et):et=e[201];let ut;return e[202]!==$e||e[203]!==Te||e[204]!==Qe||e[205]!==Je||e[206]!==Be||e[207]!==Ue||e[208]!==He||e[209]!==Ve||e[210]!==qe||e[211]!==Ge||e[212]!==Ke||e[213]!==We||e[214]!==Xe||e[215]!==Ye||e[216]!==Ze||e[217]!==et?(ut=(0,o.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"org-detail",children:[$e,Te,Qe,Je,Be,Ue,He,Ve,qe,Ge,Ke,We,Xe,Ye,Ze,et]},void 0,!0),e[202]=$e,e[203]=Te,e[204]=Qe,e[205]=Je,e[206]=Be,e[207]=Ue,e[208]=He,e[209]=Ve,e[210]=qe,e[211]=Ge,e[212]=Ke,e[213]=We,e[214]=Xe,e[215]=Ye,e[216]=Ze,e[217]=et,e[218]=ut):ut=e[218],ut},"OrganizationDetail");function Xt(t){return(0,o.jsxDEV)(ne,{children:t.head},t.head,!1)}n(Xt,"_temp");function Yt(t){return(0,o.jsxDEV)("span",{className:"font-mono text-xs",children:A(t.userId)},void 0,!1)}n(Yt,"_temp2");function Zt(t){return A(t.role)}n(Zt,"_temp3");function el(t){return A(t.email)}n(el,"_temp4");function tl(t){return A(t.role)}n(tl,"_temp5");function ll(t){return A(t.status)}n(ll,"_temp6");function il(t){return A(t.id)}n(il,"_temp7");function ol(t){return A(t.name)}n(ol,"_temp8");function sl(t){return(0,o.jsxDEV)("span",{className:"font-mono text-xs",children:A(t.userId)},void 0,!1)}n(sl,"_temp9");function rl(t){return A(t.role)}n(rl,"_temp0");function al(t){return A(t.permission)}n(al,"_temp1");var Il=n(()=>{let t=(0,G.c)(62),e=le(),l=K(),{config:d,ready:f}=Mt(),r=d.capabilities.organization,[i,s]=(0,P.useState)(null),[a,m]=(0,P.useState)(null),c;t[0]===Symbol.for("react.memo_cache_sentinel")?(c=["lunora-auth-orgs"],t[0]=c):c=t[0];let p;t[1]!==e?(p=n(()=>e.listAuthOrganizations({limit:100}),"t1"),t[1]=e,t[2]=p):p=t[2];let u;t[3]!==r?(u={enabled:r},t[3]=r,t[4]=u):u=t[4];let g=fe(c,p,u),k=g.data?.rows??null,h;t[5]!==g?(h=n(()=>{g.refetch()},"t3"),t[5]=g,t[6]=h):h=t[6],Dt(h,r);let y;t[7]===Symbol.for("react.memo_cache_sentinel")?(y=n(()=>{m(null)},"t4"),t[7]=y):y=t[7];let w=y,b;t[8]!==g?(b=n(()=>{g.refetch()},"t5"),t[8]=g,t[9]=b):b=t[9];let I=b,v;t[10]===Symbol.for("react.memo_cache_sentinel")?(v=n(M=>{s(M)},"t6"),t[10]=v):v=t[10];let S=v;if(f&&!r){let M;t[11]!==l?(M=l("Enable the organization() plugin in your auth config to manage organizations here."),t[11]=l,t[12]=M):M=t[12];let F;t[13]!==l?(F=l("Organizations are not enabled."),t[13]=l,t[14]=F):F=t[14];let U;return t[15]!==M||t[16]!==F?(U=(0,o.jsxDEV)(ce,{description:M,testId:"org-disabled",title:F},void 0,!1),t[15]=M,t[16]=F,t[17]=U):U=t[17],U}let C;t[18]!==l?(C=l("Organizations"),t[18]=l,t[19]=C):C=t[19];let x;t[20]!==C?(x=(0,o.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:C},void 0,!1),t[20]=C,t[21]=x):x=t[21];let N;t[22]===Symbol.for("react.memo_cache_sentinel")?(N=n(()=>{m({kind:"create"})},"t9"),t[22]=N):N=t[22];let _;t[23]!==l?(_=l("New organization"),t[23]=l,t[24]=_):_=t[24];let D;t[25]!==_?(D=(0,o.jsxDEV)(j,{"data-testid":"org-new",onClick:N,size:"sm",type:"button",children:_},void 0,!1),t[25]=_,t[26]=D):D=t[26];let z;t[27]!==D||t[28]!==x?(z=(0,o.jsxDEV)("div",{className:"flex items-center justify-between",children:[x,D]},void 0,!0),t[27]=D,t[28]=x,t[29]=z):z=t[29];let $;t[30]!==g.error?($=g.error!==null&&(0,o.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"org-error",role:"alert",children:g.error},void 0,!1),t[30]=g.error,t[31]=$):$=t[31];let T;t[32]!==k||t[33]!==l?(T=k!==null&&k.length===0&&(0,o.jsxDEV)(ce,{testId:"org-empty",title:l("No organizations.")},void 0,!1),t[32]=k,t[33]=l,t[34]=T):T=t[34];let Q;t[35]!==k||t[36]!==i||t[37]!==l?(Q=k!==null&&k.length>0&&(0,o.jsxDEV)(kt,{className:"overflow-hidden py-0",children:(0,o.jsxDEV)(wt,{className:"px-0",children:(0,o.jsxDEV)(St,{"data-testid":"org-table",children:[(0,o.jsxDEV)(Nt,{children:(0,o.jsxDEV)(tt,{children:[(0,o.jsxDEV)(ne,{children:l("id")},void 0,!1),(0,o.jsxDEV)(ne,{children:l("name")},void 0,!1),(0,o.jsxDEV)(ne,{children:l("slug")},void 0,!1),(0,o.jsxDEV)(ne,{children:l("created")},void 0,!1),(0,o.jsxDEV)(ne,{"aria-label":l("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,o.jsxDEV)(At,{children:k.map(M=>{let F=A(M.id);return(0,o.jsxDEV)(tt,{"data-testid":`org-row-${F}`,children:[(0,o.jsxDEV)(de,{className:"font-mono text-xs",children:F},void 0,!1),(0,o.jsxDEV)(de,{children:A(M.name)},void 0,!1),(0,o.jsxDEV)(de,{children:A(M.slug)},void 0,!1),(0,o.jsxDEV)(de,{className:"text-muted-foreground tabular-nums",children:$t(M.createdAt)},void 0,!1),(0,o.jsxDEV)(de,{children:(0,o.jsxDEV)("div",{className:"flex justify-end gap-1",children:[(0,o.jsxDEV)(j,{"aria-pressed":i===F,"data-testid":`org-select-${F}`,onClick:n(()=>{S(F)},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Manage")},void 0,!1),(0,o.jsxDEV)(j,{"data-testid":`org-edit-${F}`,onClick:n(()=>{m({kind:"edit",org:M})},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Edit")},void 0,!1),(0,o.jsxDEV)(j,{"data-testid":`org-delete-${F}`,onClick:n(()=>{m({kind:"delete",org:M})},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Delete")},void 0,!1)]},void 0,!0)},void 0,!1)]},F,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),t[35]=k,t[36]=i,t[37]=l,t[38]=Q):Q=t[38];let H;t[39]!==d.organization||t[40]!==i?(H=i!==null&&(0,o.jsxDEV)(Wt,{organizationId:i,rolesEnabled:d.organization.roles,teamsEnabled:d.organization.teams},void 0,!1),t[39]=d.organization,t[40]=i,t[41]=H):H=t[41];let J;t[42]!==a?.kind||t[43]!==I?(J=a?.kind==="create"&&(0,o.jsxDEV)(Rt,{mode:"create",onClose:w,onDone:I},void 0,!1),t[42]=a?.kind,t[43]=I,t[44]=J):J=t[44];let L;t[45]!==a||t[46]!==I?(L=a?.kind==="edit"&&(0,o.jsxDEV)(Rt,{mode:"edit",onClose:w,onDone:I,org:a.org},void 0,!1),t[45]=a,t[46]=I,t[47]=L):L=t[47];let B;t[48]!==e||t[49]!==a||t[50]!==I||t[51]!==l?(B=a?.kind==="delete"&&(0,o.jsxDEV)(Qt,{action:n(async()=>{let M=A(a.org.id);await e.deleteAuthOrganization({organizationId:M}),s(F=>F===M?null:F)},"action"),message:l("Delete this organization? Its members, invitations, teams, and custom roles are removed. This cannot be undone."),onClose:w,onDone:I,testId:"org-delete",title:l("Delete organization")},void 0,!1),t[48]=e,t[49]=a,t[50]=I,t[51]=l,t[52]=B):B=t[52];let V;return t[53]!==z||t[54]!==$||t[55]!==T||t[56]!==Q||t[57]!==H||t[58]!==J||t[59]!==L||t[60]!==B?(V=(0,o.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-organizations",children:[z,$,T,Q,H,J,L,B]},void 0,!0),t[53]=z,t[54]=$,t[55]=T,t[56]=Q,t[57]=H,t[58]=J,t[59]=L,t[60]=B,t[61]=V):V=t[61],V},"OrganizationsPanel");export{Il as OrganizationsPanel};
|
|
1
|
+
import{a as Mt,b as ae}from"./chunk-227DORM6.js";import{a as Ft}from"./chunk-AHILM3ZP.js";import{a as Dt}from"./chunk-J6J54MBP.js";import{a as fe}from"./chunk-2YUYNNHQ.js";import{a as St,b as Nt,c as At,d as tt,e as ne,f as de}from"./chunk-GTM65MVX.js";import{a as kt,e as wt}from"./chunk-Y572GMZE.js";import{a as zt}from"./chunk-VLXV72QE.js";import{a as Tt}from"./chunk-JSEXCW5Q.js";import{R as W}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as j}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-CKSHCYGC.js";import{f as le}from"./chunk-C7UZEQZ7.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as ce}from"./chunk-TAD43CG5.js";import{d as K,h as Ot,l as A,m as _t,q as $t}from"./chunk-HBGS4SEX.js";import"./chunk-ZXLEXF4X.js";import{a as n,e as It,f as Jt,g as Bt,h as Ut}from"./chunk-RRCPZMC2.js";var G=It(Bt(),1);var P=It(Jt(),1);var o=It(Ut(),1);var jt=n(t=>{let e=JSON.parse(t);if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError("Expected a JSON object");return e},"parseJsonObject"),Ht=n(t=>{let e=jt(t),l={};for(let[d,f]of Object.entries(e)){if(!Array.isArray(f)||f.some(r=>typeof r!="string"))throw new TypeError(`"${d}" must map to an array of action strings`);l[d]=f}return l},"parsePermission"),Pt=n(t=>t==null||t===""?"":typeof t=="string"?t:JSON.stringify(t,null,2),"jsonInitial"),q=n(t=>{let e=(0,G.c)(6),{children:l,htmlFor:d,label:f}=t,r;e[0]!==d||e[1]!==f?(r=(0,o.jsxDEV)(Tt,{htmlFor:d,children:f},void 0,!1),e[0]=d,e[1]=f,e[2]=r):r=e[2];let i;return e[3]!==l||e[4]!==r?(i=(0,o.jsxDEV)("div",{className:"flex flex-col gap-1",children:[r,l]},void 0,!0),e[3]=l,e[4]=r,e[5]=i):i=e[5],i},"Field"),me=n(({busy:t,canSubmit:e,children:l,destructive:d=!1,error:f,onClose:r,onSubmit:i,submitLabel:s,testId:a,title:m})=>{let c=K();return(0,o.jsxDEV)(Ft,{label:m,onClose:r,panelTestId:`${a}-panel`,testId:`${a}-overlay`,variant:"dialog",children:[(0,o.jsxDEV)("h2",{className:"text-sm font-semibold text-foreground",children:m},void 0,!1),l,f!==null&&(0,o.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":`${a}-error`,role:"alert",children:f},void 0,!1),(0,o.jsxDEV)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,o.jsxDEV)(j,{"data-testid":`${a}-cancel`,onClick:r,size:"sm",type:"button",variant:"outline",children:c("Cancel")},void 0,!1),(0,o.jsxDEV)(j,{"data-testid":`${a}-submit`,disabled:t||!e,onClick:i,size:"sm",type:"button",variant:d?"destructive":"default",children:t?c("Saving\u2026"):s},void 0,!1)]},void 0,!0)]},void 0,!0)},"DialogForm"),Rt=n(t=>{let e=(0,G.c)(79),{mode:l,onClose:d,onDone:f,org:r}=t,i=le(),s=K(),{busy:a,error:m,run:c}=ae(),p;e[0]!==r?(p=r?A(r.name):"",e[0]=r,e[1]=p):p=e[1];let[u,g]=(0,P.useState)(p),k;e[2]!==r?(k=r?A(r.slug):"",e[2]=r,e[3]=k):k=e[3];let[h,y]=(0,P.useState)(k),w;e[4]!==r?(w=r?A(r.logo):"",e[4]=r,e[5]=w):w=e[5];let[b,I]=(0,P.useState)(w),[v,S]=(0,P.useState)(""),C;e[6]!==l||e[7]!==r?.metadata?(C=l==="edit"?Pt(r?.metadata):"",e[6]=l,e[7]=r?.metadata,e[8]=C):C=e[8];let[x,N]=(0,P.useState)(C),_;e[9]!==i||e[10]!==b||e[11]!==x||e[12]!==l||e[13]!==u||e[14]!==d||e[15]!==f||e[16]!==r?.id||e[17]!==v||e[18]!==c||e[19]!==h?(_=n(()=>{c(async()=>{let E=x.trim()===""?void 0:jt(x);l==="create"?await i.createAuthOrganization({logo:b.trim()===""?void 0:b.trim(),metadata:E,name:u.trim(),ownerId:v.trim()===""?void 0:v.trim(),slug:h.trim()===""?void 0:h.trim()}):await i.updateAuthOrganization({logo:b.trim()===""?void 0:b.trim(),metadata:E,name:u.trim()===""?void 0:u.trim(),organizationId:A(r?.id),slug:h.trim()===""?void 0:h.trim()}),f(),d()})},"t5"),e[9]=i,e[10]=b,e[11]=x,e[12]=l,e[13]=u,e[14]=d,e[15]=f,e[16]=r?.id,e[17]=v,e[18]=c,e[19]=h,e[20]=_):_=e[20];let D=_,z;e[21]!==l||e[22]!==u?(z=u.trim()!==""||l==="edit",e[21]=l,e[22]=u,e[23]=z):z=e[23];let $;e[24]!==l||e[25]!==s?($=s(l==="create"?"Create":"Save"),e[24]=l,e[25]=s,e[26]=$):$=e[26];let T;e[27]!==l||e[28]!==s?(T=s(l==="create"?"New organization":"Edit organization"),e[27]=l,e[28]=s,e[29]=T):T=e[29];let Q;e[30]!==s?(Q=s("name"),e[30]=s,e[31]=Q):Q=e[31];let H;e[32]===Symbol.for("react.memo_cache_sentinel")?(H=n(E=>{g(E.target.value)},"t10"),e[32]=H):H=e[32];let J;e[33]!==u?(J=(0,o.jsxDEV)(W,{"data-testid":"org-form-name",id:"org-form-name",onChange:H,value:u},void 0,!1),e[33]=u,e[34]=J):J=e[34];let L;e[35]!==J||e[36]!==Q?(L=(0,o.jsxDEV)(q,{htmlFor:"org-form-name",label:Q,children:J},void 0,!1),e[35]=J,e[36]=Q,e[37]=L):L=e[37];let B;e[38]!==s?(B=s("Slug (optional \u2014 derived from name)"),e[38]=s,e[39]=B):B=e[39];let V;e[40]===Symbol.for("react.memo_cache_sentinel")?(V=n(E=>{y(E.target.value)},"t14"),e[40]=V):V=e[40];let M;e[41]!==h?(M=(0,o.jsxDEV)(W,{"data-testid":"org-form-slug",id:"org-form-slug",onChange:V,value:h},void 0,!1),e[41]=h,e[42]=M):M=e[42];let F;e[43]!==B||e[44]!==M?(F=(0,o.jsxDEV)(q,{htmlFor:"org-form-slug",label:B,children:M},void 0,!1),e[43]=B,e[44]=M,e[45]=F):F=e[45];let U;e[46]!==s?(U=s("Logo URL (optional)"),e[46]=s,e[47]=U):U=e[47];let ie;e[48]===Symbol.for("react.memo_cache_sentinel")?(ie=n(E=>{I(E.target.value)},"t18"),e[48]=ie):ie=e[48];let X;e[49]!==b?(X=(0,o.jsxDEV)(W,{"data-testid":"org-form-logo",id:"org-form-logo",onChange:ie,value:b},void 0,!1),e[49]=b,e[50]=X):X=e[50];let Y;e[51]!==U||e[52]!==X?(Y=(0,o.jsxDEV)(q,{htmlFor:"org-form-logo",label:U,children:X},void 0,!1),e[51]=U,e[52]=X,e[53]=Y):Y=e[53];let Z;e[54]!==l||e[55]!==v||e[56]!==s?(Z=l==="create"&&(0,o.jsxDEV)(q,{htmlFor:"org-form-owner",label:s("Owner user id (optional)"),children:(0,o.jsxDEV)(W,{"data-testid":"org-form-owner",id:"org-form-owner",onChange:n(E=>{S(E.target.value)},"onChange"),value:v},void 0,!1)},void 0,!1),e[54]=l,e[55]=v,e[56]=s,e[57]=Z):Z=e[57];let ee;e[58]!==s?(ee=s("Metadata (JSON, optional)"),e[58]=s,e[59]=ee):ee=e[59];let oe;e[60]===Symbol.for("react.memo_cache_sentinel")?(oe=n(E=>{N(E.target.value)},"t23"),e[60]=oe):oe=e[60];let te;e[61]!==x?(te=(0,o.jsxDEV)(zt,{"data-testid":"org-form-metadata",id:"org-form-metadata",onChange:oe,value:x},void 0,!1),e[61]=x,e[62]=te):te=e[62];let O;e[63]!==ee||e[64]!==te?(O=(0,o.jsxDEV)(q,{htmlFor:"org-form-metadata",label:ee,children:te},void 0,!1),e[63]=ee,e[64]=te,e[65]=O):O=e[65];let se;return e[66]!==a||e[67]!==m||e[68]!==d||e[69]!==D||e[70]!==L||e[71]!==F||e[72]!==Y||e[73]!==Z||e[74]!==O||e[75]!==z||e[76]!==$||e[77]!==T?(se=(0,o.jsxDEV)(me,{busy:a,canSubmit:z,error:m,onClose:d,onSubmit:D,submitLabel:$,testId:"org-form",title:T,children:[L,F,Y,Z,O]},void 0,!0),e[66]=a,e[67]=m,e[68]=d,e[69]=D,e[70]=L,e[71]=F,e[72]=Y,e[73]=Z,e[74]=O,e[75]=z,e[76]=$,e[77]=T,e[78]=se):se=e[78],se},"OrgFormDialog"),Vt=n(t=>{let e=(0,G.c)(40),{onClose:l,onDone:d,organizationId:f}=t,r=le(),i=K(),{busy:s,error:a,run:m}=ae(),[c,p]=(0,P.useState)(""),[u,g]=(0,P.useState)(""),k;e[0]!==r||e[1]!==l||e[2]!==d||e[3]!==f||e[4]!==u||e[5]!==m||e[6]!==c?(k=n(()=>{m(async()=>{await r.addAuthOrgMember({organizationId:f,role:u.trim()===""?void 0:u.trim(),userId:c.trim()}),d(),l()})},"t1"),e[0]=r,e[1]=l,e[2]=d,e[3]=f,e[4]=u,e[5]=m,e[6]=c,e[7]=k):k=e[7];let h=k,y;e[8]!==c?(y=c.trim(),e[8]=c,e[9]=y):y=e[9];let w=y!=="",b;e[10]!==i?(b=i("Add member"),e[10]=i,e[11]=b):b=e[11];let I;e[12]!==i?(I=i("Add member"),e[12]=i,e[13]=I):I=e[13];let v;e[14]!==i?(v=i("User id"),e[14]=i,e[15]=v):v=e[15];let S;e[16]===Symbol.for("react.memo_cache_sentinel")?(S=n(T=>{p(T.target.value)},"t7"),e[16]=S):S=e[16];let C;e[17]!==c?(C=(0,o.jsxDEV)(W,{"data-testid":"org-add-member-user",id:"org-add-member-user",onChange:S,value:c},void 0,!1),e[17]=c,e[18]=C):C=e[18];let x;e[19]!==v||e[20]!==C?(x=(0,o.jsxDEV)(q,{htmlFor:"org-add-member-user",label:v,children:C},void 0,!1),e[19]=v,e[20]=C,e[21]=x):x=e[21];let N;e[22]!==i?(N=i("Role (optional)"),e[22]=i,e[23]=N):N=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=n(T=>{g(T.target.value)},"t11"),e[24]=_):_=e[24];let D;e[25]!==u?(D=(0,o.jsxDEV)(W,{"data-testid":"org-add-member-role",id:"org-add-member-role",onChange:_,value:u},void 0,!1),e[25]=u,e[26]=D):D=e[26];let z;e[27]!==N||e[28]!==D?(z=(0,o.jsxDEV)(q,{htmlFor:"org-add-member-role",label:N,children:D},void 0,!1),e[27]=N,e[28]=D,e[29]=z):z=e[29];let $;return e[30]!==s||e[31]!==a||e[32]!==l||e[33]!==h||e[34]!==z||e[35]!==w||e[36]!==b||e[37]!==I||e[38]!==x?($=(0,o.jsxDEV)(me,{busy:s,canSubmit:w,error:a,onClose:l,onSubmit:h,submitLabel:b,testId:"org-add-member",title:I,children:[x,z]},void 0,!0),e[30]=s,e[31]=a,e[32]=l,e[33]=h,e[34]=z,e[35]=w,e[36]=b,e[37]=I,e[38]=x,e[39]=$):$=e[39],$},"MemberAddDialog"),qt=n(t=>{let e=(0,G.c)(40),{onClose:l,onDone:d,organizationId:f}=t,r=le(),i=K(),{busy:s,error:a,run:m}=ae(),[c,p]=(0,P.useState)(""),[u,g]=(0,P.useState)(""),k;e[0]!==r||e[1]!==c||e[2]!==l||e[3]!==d||e[4]!==f||e[5]!==u||e[6]!==m?(k=n(()=>{m(async()=>{await r.inviteAuthOrgMember({email:c.trim(),organizationId:f,role:u.trim()===""?void 0:u.trim()}),d(),l()})},"t1"),e[0]=r,e[1]=c,e[2]=l,e[3]=d,e[4]=f,e[5]=u,e[6]=m,e[7]=k):k=e[7];let h=k,y;e[8]!==c?(y=c.trim(),e[8]=c,e[9]=y):y=e[9];let w=y!=="",b;e[10]!==i?(b=i("Send invitation"),e[10]=i,e[11]=b):b=e[11];let I;e[12]!==i?(I=i("Invite member"),e[12]=i,e[13]=I):I=e[13];let v;e[14]!==i?(v=i("email"),e[14]=i,e[15]=v):v=e[15];let S;e[16]===Symbol.for("react.memo_cache_sentinel")?(S=n(T=>{p(T.target.value)},"t7"),e[16]=S):S=e[16];let C;e[17]!==c?(C=(0,o.jsxDEV)(W,{"data-testid":"org-invite-member-email",id:"org-invite-member-email",onChange:S,type:"email",value:c},void 0,!1),e[17]=c,e[18]=C):C=e[18];let x;e[19]!==v||e[20]!==C?(x=(0,o.jsxDEV)(q,{htmlFor:"org-invite-member-email",label:v,children:C},void 0,!1),e[19]=v,e[20]=C,e[21]=x):x=e[21];let N;e[22]!==i?(N=i("Role (optional)"),e[22]=i,e[23]=N):N=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=n(T=>{g(T.target.value)},"t11"),e[24]=_):_=e[24];let D;e[25]!==u?(D=(0,o.jsxDEV)(W,{"data-testid":"org-invite-member-role",id:"org-invite-member-role",onChange:_,value:u},void 0,!1),e[25]=u,e[26]=D):D=e[26];let z;e[27]!==N||e[28]!==D?(z=(0,o.jsxDEV)(q,{htmlFor:"org-invite-member-role",label:N,children:D},void 0,!1),e[27]=N,e[28]=D,e[29]=z):z=e[29];let $;return e[30]!==s||e[31]!==a||e[32]!==l||e[33]!==h||e[34]!==z||e[35]!==w||e[36]!==b||e[37]!==I||e[38]!==x?($=(0,o.jsxDEV)(me,{busy:s,canSubmit:w,error:a,onClose:l,onSubmit:h,submitLabel:b,testId:"org-invite-member",title:I,children:[x,z]},void 0,!0),e[30]=s,e[31]=a,e[32]=l,e[33]=h,e[34]=z,e[35]=w,e[36]=b,e[37]=I,e[38]=x,e[39]=$):$=e[39],$},"MemberInviteDialog"),Gt=n(t=>{let e=(0,G.c)(32),{member:l,onClose:d,onDone:f}=t,r=le(),i=K(),{busy:s,error:a,run:m}=ae(),c;e[0]!==l.role?(c=A(l.role),e[0]=l.role,e[1]=c):c=e[1];let[p,u]=(0,P.useState)(c),g;e[2]!==r||e[3]!==l.id||e[4]!==d||e[5]!==f||e[6]!==p||e[7]!==m?(g=n(()=>{m(async()=>{await r.setAuthOrgMemberRole({memberId:A(l.id),role:p.trim()}),f(),d()})},"t2"),e[2]=r,e[3]=l.id,e[4]=d,e[5]=f,e[6]=p,e[7]=m,e[8]=g):g=e[8];let k=g,h;e[9]!==p?(h=p.trim(),e[9]=p,e[10]=h):h=e[10];let y=h!=="",w;e[11]!==i?(w=i("Save"),e[11]=i,e[12]=w):w=e[12];let b;e[13]!==i?(b=i("Change member role"),e[13]=i,e[14]=b):b=e[14];let I;e[15]!==i?(I=i("Role"),e[15]=i,e[16]=I):I=e[16];let v;e[17]===Symbol.for("react.memo_cache_sentinel")?(v=n(N=>{u(N.target.value)},"t8"),e[17]=v):v=e[17];let S;e[18]!==p?(S=(0,o.jsxDEV)(W,{"data-testid":"org-member-role-value",id:"org-member-role-value",onChange:v,value:p},void 0,!1),e[18]=p,e[19]=S):S=e[19];let C;e[20]!==I||e[21]!==S?(C=(0,o.jsxDEV)(q,{htmlFor:"org-member-role-value",label:I,children:S},void 0,!1),e[20]=I,e[21]=S,e[22]=C):C=e[22];let x;return e[23]!==s||e[24]!==a||e[25]!==d||e[26]!==k||e[27]!==C||e[28]!==y||e[29]!==w||e[30]!==b?(x=(0,o.jsxDEV)(me,{busy:s,canSubmit:y,error:a,onClose:d,onSubmit:k,submitLabel:w,testId:"org-member-role",title:b,children:C},void 0,!1),e[23]=s,e[24]=a,e[25]=d,e[26]=k,e[27]=C,e[28]=y,e[29]=w,e[30]=b,e[31]=x):x=e[31],x},"MemberRoleDialog"),Et=n(t=>{let e=(0,G.c)(36),{mode:l,onClose:d,onDone:f,organizationId:r,team:i}=t,s=le(),a=K(),{busy:m,error:c,run:p}=ae(),u;e[0]!==i?(u=i?A(i.name):"",e[0]=i,e[1]=u):u=e[1];let[g,k]=(0,P.useState)(u),h;e[2]!==s||e[3]!==l||e[4]!==g||e[5]!==d||e[6]!==f||e[7]!==r||e[8]!==p||e[9]!==i?.id?(h=n(()=>{p(async()=>{await(l==="create"?s.createAuthOrgTeam({name:g.trim(),organizationId:r}):s.updateAuthOrgTeam({name:g.trim(),teamId:A(i?.id)})),f(),d()})},"t2"),e[2]=s,e[3]=l,e[4]=g,e[5]=d,e[6]=f,e[7]=r,e[8]=p,e[9]=i?.id,e[10]=h):h=e[10];let y=h,w;e[11]!==g?(w=g.trim(),e[11]=g,e[12]=w):w=e[12];let b=w!=="",I;e[13]!==l||e[14]!==a?(I=a(l==="create"?"Create":"Save"),e[13]=l,e[14]=a,e[15]=I):I=e[15];let v;e[16]!==l||e[17]!==a?(v=a(l==="create"?"New team":"Rename team"),e[16]=l,e[17]=a,e[18]=v):v=e[18];let S;e[19]!==a?(S=a("name"),e[19]=a,e[20]=S):S=e[20];let C;e[21]===Symbol.for("react.memo_cache_sentinel")?(C=n(D=>{k(D.target.value)},"t8"),e[21]=C):C=e[21];let x;e[22]!==g?(x=(0,o.jsxDEV)(W,{"data-testid":"org-team-form-name",id:"org-team-form-name",onChange:C,value:g},void 0,!1),e[22]=g,e[23]=x):x=e[23];let N;e[24]!==S||e[25]!==x?(N=(0,o.jsxDEV)(q,{htmlFor:"org-team-form-name",label:S,children:x},void 0,!1),e[24]=S,e[25]=x,e[26]=N):N=e[26];let _;return e[27]!==m||e[28]!==c||e[29]!==d||e[30]!==y||e[31]!==N||e[32]!==b||e[33]!==I||e[34]!==v?(_=(0,o.jsxDEV)(me,{busy:m,canSubmit:b,error:c,onClose:d,onSubmit:y,submitLabel:I,testId:"org-team-form",title:v,children:N},void 0,!1),e[27]=m,e[28]=c,e[29]=d,e[30]=y,e[31]=N,e[32]=b,e[33]=I,e[34]=v,e[35]=_):_=e[35],_},"TeamFormDialog"),Kt=n(t=>{let e=(0,G.c)(30),{onClose:l,onDone:d,teamId:f}=t,r=le(),i=K(),{busy:s,error:a,run:m}=ae(),[c,p]=(0,P.useState)(""),u;e[0]!==r||e[1]!==l||e[2]!==d||e[3]!==m||e[4]!==f||e[5]!==c?(u=n(()=>{m(async()=>{await r.addAuthOrgTeamMember({teamId:f,userId:c.trim()}),d(),l()})},"t1"),e[0]=r,e[1]=l,e[2]=d,e[3]=m,e[4]=f,e[5]=c,e[6]=u):u=e[6];let g=u,k;e[7]!==c?(k=c.trim(),e[7]=c,e[8]=k):k=e[8];let h=k!=="",y;e[9]!==i?(y=i("Add member"),e[9]=i,e[10]=y):y=e[10];let w;e[11]!==i?(w=i("Add team member"),e[11]=i,e[12]=w):w=e[12];let b;e[13]!==i?(b=i("User id"),e[13]=i,e[14]=b):b=e[14];let I;e[15]===Symbol.for("react.memo_cache_sentinel")?(I=n(x=>{p(x.target.value)},"t7"),e[15]=I):I=e[15];let v;e[16]!==c?(v=(0,o.jsxDEV)(W,{"data-testid":"org-team-add-member-user",id:"org-team-add-member-user",onChange:I,value:c},void 0,!1),e[16]=c,e[17]=v):v=e[17];let S;e[18]!==b||e[19]!==v?(S=(0,o.jsxDEV)(q,{htmlFor:"org-team-add-member-user",label:b,children:v},void 0,!1),e[18]=b,e[19]=v,e[20]=S):S=e[20];let C;return e[21]!==s||e[22]!==a||e[23]!==l||e[24]!==g||e[25]!==h||e[26]!==y||e[27]!==w||e[28]!==S?(C=(0,o.jsxDEV)(me,{busy:s,canSubmit:h,error:a,onClose:l,onSubmit:g,submitLabel:y,testId:"org-team-add-member",title:w,children:S},void 0,!1),e[21]=s,e[22]=a,e[23]=l,e[24]=g,e[25]=h,e[26]=y,e[27]=w,e[28]=S,e[29]=C):C=e[29],C},"TeamMemberAddDialog"),Lt=n(t=>{let e=(0,G.c)(47),{mode:l,onClose:d,onDone:f,organizationId:r,role:i}=t,s=le(),a=K(),{busy:m,error:c,run:p}=ae(),u;e[0]!==i?(u=i?A(i.role):"",e[0]=i,e[1]=u):u=e[1];let[g,k]=(0,P.useState)(u),h;e[2]!==l||e[3]!==i?.permission?(h=l==="edit"?Pt(i?.permission):"",e[2]=l,e[3]=i?.permission,e[4]=h):h=e[4];let[y,w]=(0,P.useState)(h),b;e[5]!==s||e[6]!==l||e[7]!==g||e[8]!==d||e[9]!==f||e[10]!==r||e[11]!==y||e[12]!==i?.id||e[13]!==p?(b=n(()=>{p(async()=>{let T=Ht(y);await(l==="create"?s.createAuthOrgRole({organizationId:r,permission:T,role:g.trim()}):s.updateAuthOrgRole({permission:T,roleId:A(i?.id)})),f(),d()})},"t3"),e[5]=s,e[6]=l,e[7]=g,e[8]=d,e[9]=f,e[10]=r,e[11]=y,e[12]=i?.id,e[13]=p,e[14]=b):b=e[14];let I=b,v;e[15]!==l||e[16]!==g||e[17]!==y?(v=y.trim()!==""&&(l==="edit"||g.trim()!==""),e[15]=l,e[16]=g,e[17]=y,e[18]=v):v=e[18];let S;e[19]!==l||e[20]!==a?(S=a(l==="create"?"Create":"Save"),e[19]=l,e[20]=a,e[21]=S):S=e[21];let C;e[22]!==l||e[23]!==a?(C=a(l==="create"?"New role":"Edit role"),e[22]=l,e[23]=a,e[24]=C):C=e[24];let x;e[25]!==l||e[26]!==g||e[27]!==a?(x=l==="create"&&(0,o.jsxDEV)(q,{htmlFor:"org-role-form-name",label:a("Role name"),children:(0,o.jsxDEV)(W,{"data-testid":"org-role-form-name",id:"org-role-form-name",onChange:n(T=>{k(T.target.value)},"onChange"),value:g},void 0,!1)},void 0,!1),e[25]=l,e[26]=g,e[27]=a,e[28]=x):x=e[28];let N;e[29]!==a?(N=a('Permission (JSON, e.g. {"project":["create","update"]})'),e[29]=a,e[30]=N):N=e[30];let _;e[31]===Symbol.for("react.memo_cache_sentinel")?(_=n(T=>{w(T.target.value)},"t9"),e[31]=_):_=e[31];let D;e[32]!==y?(D=(0,o.jsxDEV)(zt,{"data-testid":"org-role-form-permission",id:"org-role-form-permission",onChange:_,value:y},void 0,!1),e[32]=y,e[33]=D):D=e[33];let z;e[34]!==D||e[35]!==N?(z=(0,o.jsxDEV)(q,{htmlFor:"org-role-form-permission",label:N,children:D},void 0,!1),e[34]=D,e[35]=N,e[36]=z):z=e[36];let $;return e[37]!==m||e[38]!==c||e[39]!==d||e[40]!==I||e[41]!==z||e[42]!==v||e[43]!==S||e[44]!==C||e[45]!==x?($=(0,o.jsxDEV)(me,{busy:m,canSubmit:v,error:c,onClose:d,onSubmit:I,submitLabel:S,testId:"org-role-form",title:C,children:[x,z]},void 0,!0),e[37]=m,e[38]=c,e[39]=d,e[40]=I,e[41]=z,e[42]=v,e[43]=S,e[44]=C,e[45]=x,e[46]=$):$=e[46],$},"RoleFormDialog"),Qt=n(t=>{let e=(0,G.c)(18),{action:l,message:d,onClose:f,onDone:r,testId:i,title:s}=t,a=K(),{busy:m,error:c,run:p}=ae(),u;e[0]!==l||e[1]!==f||e[2]!==r||e[3]!==p?(u=n(()=>{p(async()=>{await l(),r(),f()})},"t1"),e[0]=l,e[1]=f,e[2]=r,e[3]=p,e[4]=u):u=e[4];let g=u,k;e[5]!==a?(k=a("Delete"),e[5]=a,e[6]=k):k=e[6];let h;e[7]!==d?(h=(0,o.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:d},void 0,!1),e[7]=d,e[8]=h):h=e[8];let y;return e[9]!==m||e[10]!==c||e[11]!==f||e[12]!==g||e[13]!==k||e[14]!==h||e[15]!==i||e[16]!==s?(y=(0,o.jsxDEV)(me,{busy:m,canSubmit:!0,destructive:!0,error:c,onClose:f,onSubmit:g,submitLabel:k,testId:i,title:s,children:h},void 0,!1),e[9]=m,e[10]=c,e[11]=f,e[12]=g,e[13]=k,e[14]=h,e[15]=i,e[16]=s,e[17]=y):y=e[17],y},"ConfirmDialog"),lt=n(t=>{let e=(0,G.c)(13),{action:l,children:d,heading:f,testId:r}=t,i;e[0]!==f?(i=(0,o.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:f},void 0,!1),e[0]=f,e[1]=i):i=e[1];let s;e[2]!==l?(s=l!==void 0&&(0,o.jsxDEV)("div",{className:"flex items-center gap-2",children:l},void 0,!1),e[2]=l,e[3]=s):s=e[3];let a;e[4]!==i||e[5]!==s?(a=(0,o.jsxDEV)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[i,s]},void 0,!0),e[4]=i,e[5]=s,e[6]=a):a=e[6];let m;e[7]!==d?(m=(0,o.jsxDEV)(wt,{className:"px-0",children:d},void 0,!1),e[7]=d,e[8]=m):m=e[8];let c;return e[9]!==a||e[10]!==m||e[11]!==r?(c=(0,o.jsxDEV)(kt,{className:"overflow-hidden py-0","data-testid":r,children:[a,m]},void 0,!0),e[9]=a,e[10]=m,e[11]=r,e[12]=c):c=e[12],c},"SectionCard"),it=n(t=>{let e=(0,G.c)(23),{columns:l,rowActions:d,rowPrefix:f,rows:r}=t,i=K(),s;e[0]!==l?(s=l.map(Xt),e[0]=l,e[1]=s):s=e[1];let a;e[2]!==i?(a=i("Actions"),e[2]=i,e[3]=a):a=e[3];let m;e[4]!==a?(m=(0,o.jsxDEV)(ne,{"aria-label":a},void 0,!1),e[4]=a,e[5]=m):m=e[5];let c;e[6]!==s||e[7]!==m?(c=(0,o.jsxDEV)(Nt,{children:(0,o.jsxDEV)(tt,{children:[s,m]},void 0,!0)},void 0,!1),e[6]=s,e[7]=m,e[8]=c):c=e[8];let p;if(e[9]!==l||e[10]!==d||e[11]!==f||e[12]!==r){let k;e[14]!==l||e[15]!==d||e[16]!==f?(k=n(h=>{let y=A(h.id);return(0,o.jsxDEV)(tt,{"data-testid":`${f}-${y}`,children:[l.map(w=>(0,o.jsxDEV)(de,{className:w.className,children:w.render(h)},w.head,!1)),(0,o.jsxDEV)(de,{children:(0,o.jsxDEV)("div",{className:"flex justify-end gap-1",children:d(h)},void 0,!1)},void 0,!1)]},y,!0)},"t62"),e[14]=l,e[15]=d,e[16]=f,e[17]=k):k=e[17],p=r.map(k),e[9]=l,e[10]=d,e[11]=f,e[12]=r,e[13]=p}else p=e[13];let u;e[18]!==p?(u=(0,o.jsxDEV)(At,{children:p},void 0,!1),e[18]=p,e[19]=u):u=e[19];let g;return e[20]!==c||e[21]!==u?(g=(0,o.jsxDEV)(St,{children:[c,u]},void 0,!0),e[20]=c,e[21]=u,e[22]=g):g=e[22],g},"ManagedTable"),Wt=n(t=>{let e=(0,G.c)(219),{organizationId:l,rolesEnabled:d,teamsEnabled:f}=t,r=le(),i=K(),[s,a]=(0,P.useState)(null),[m,c]=(0,P.useState)(null),[p,u]=(0,P.useState)(!1),[g,k]=(0,P.useState)(null),h;e[0]!==l?(h=["lunora-auth-org-members",l],e[0]=l,e[1]=h):h=e[1];let y;e[2]!==r||e[3]!==l?(y=n(()=>r.listAuthOrgMembers({limit:200,organizationId:l}),"t2"),e[2]=r,e[3]=l,e[4]=y):y=e[4];let w=fe(h,y),b;e[5]!==l?(b=["lunora-auth-org-invitations",l],e[5]=l,e[6]=b):b=e[6];let I;e[7]!==r||e[8]!==l?(I=n(()=>r.listAuthOrgInvitations({limit:200,organizationId:l}),"t4"),e[7]=r,e[8]=l,e[9]=I):I=e[9];let v=fe(b,I),S;e[10]!==l?(S=["lunora-auth-org-teams",l],e[10]=l,e[11]=S):S=e[11];let C;e[12]!==r||e[13]!==l?(C=n(()=>r.listAuthOrgTeams({limit:200,organizationId:l}),"t6"),e[12]=r,e[13]=l,e[14]=C):C=e[14];let x;e[15]!==f?(x={enabled:f},e[15]=f,e[16]=x):x=e[16];let N=fe(S,C,x),_;e[17]!==l?(_=["lunora-auth-org-roles",l],e[17]=l,e[18]=_):_=e[18];let D;e[19]!==r||e[20]!==l?(D=n(()=>r.listAuthOrgRoles({limit:200,organizationId:l}),"t9"),e[19]=r,e[20]=l,e[21]=D):D=e[21];let z;e[22]!==d?(z={enabled:d},e[22]=d,e[23]=z):z=e[23];let $=fe(_,D,z),T;e[24]!==m?(T=["lunora-auth-org-team-members",m],e[24]=m,e[25]=T):T=e[25];let Q;e[26]!==r||e[27]!==m?(Q=n(()=>r.listAuthOrgTeamMembers({limit:200,teamId:m??""}),"t12"),e[26]=r,e[27]=m,e[28]=Q):Q=e[28];let H=m!==null,J;e[29]!==H?(J={enabled:H},e[29]=H,e[30]=J):J=e[30];let L=fe(T,Q,J),B;e[31]!==w.data?.rows?(B=w.data?.rows??[],e[31]=w.data?.rows,e[32]=B):B=e[32];let V=B,M;e[33]!==v.data?.rows?(M=v.data?.rows??[],e[33]=v.data?.rows,e[34]=M):M=e[34];let F=M,U;e[35]!==N.data?.rows?(U=N.data?.rows??[],e[35]=N.data?.rows,e[36]=U):U=e[36];let ie=U,X;e[37]!==$.data?.rows?(X=$.data?.rows??[],e[37]=$.data?.rows,e[38]=X):X=e[38];let Y=X,Z;e[39]!==m||e[40]!==L?(Z=m===null?[]:L.data?.rows??[],e[39]=m,e[40]=L,e[41]=Z):Z=e[41];let ee=Z,oe=w.error??v.error??N.error??$.error??L.error,te;e[42]!==v||e[43]!==w||e[44]!==d||e[45]!==$||e[46]!==m||e[47]!==L||e[48]!==f||e[49]!==N?(te=n(()=>{w.refetch(),v.refetch(),f&&N.refetch(),d&&$.refetch(),m!==null&&L.refetch()},"t20"),e[42]=v,e[43]=w,e[44]=d,e[45]=$,e[46]=m,e[47]=L,e[48]=f,e[49]=N,e[50]=te):te=e[50];let O=te;Dt(O,!0);let se;e[51]===Symbol.for("react.memo_cache_sentinel")?(se=n(()=>{a(null)},"t21"),e[51]=se):se=e[51];let E=se,ot;e[52]!==O?(ot=n(R=>{_t((async()=>{u(!0),k(null);try{await R(),O(),u(!1)}catch(gt){k(Ot(gt)),u(!1)}})())},"t22"),e[52]=O,e[53]=ot):ot=e[53];let re=ot,st;e[54]!==r||e[55]!==i?(st=n(R=>{let gt=A(R.id);a({action:n(async()=>{await r.removeAuthOrgTeam({teamId:gt}),c(xt=>xt===gt?null:xt)},"action"),kind:"confirm",message:i("Delete this team and its memberships? This cannot be undone."),testId:"org-team-delete",title:i("Delete team")})},"t23"),e[54]=r,e[55]=i,e[56]=st):st=e[56];let vt=st,ue;e[57]!==i?(ue=i("userId"),e[57]=i,e[58]=ue):ue=e[58];let ge;e[59]!==ue?(ge={head:ue,render:Yt},e[59]=ue,e[60]=ge):ge=e[60];let ve;e[61]!==i?(ve=i("role"),e[61]=i,e[62]=ve):ve=e[62];let he;e[63]!==ve?(he={head:ve,render:Zt},e[63]=ve,e[64]=he):he=e[64];let rt;e[65]!==ge||e[66]!==he?(rt=[ge,he],e[65]=ge,e[66]=he,e[67]=rt):rt=e[67];let ht=rt,be;e[68]!==i?(be=i("email"),e[68]=i,e[69]=be):be=e[69];let pe;e[70]!==be?(pe={head:be,render:el},e[70]=be,e[71]=pe):pe=e[71];let ye;e[72]!==i?(ye=i("role"),e[72]=i,e[73]=ye):ye=e[73];let Ce;e[74]!==ye?(Ce={head:ye,render:tl},e[74]=ye,e[75]=Ce):Ce=e[75];let xe;e[76]!==i?(xe=i("status"),e[76]=i,e[77]=xe):xe=e[77];let Ie;e[78]!==xe?(Ie={head:xe,render:ll},e[78]=xe,e[79]=Ie):Ie=e[79];let at;e[80]!==pe||e[81]!==Ce||e[82]!==Ie?(at=[pe,Ce,Ie],e[80]=pe,e[81]=Ce,e[82]=Ie,e[83]=at):at=e[83];let bt=at,ke;e[84]!==i?(ke=i("id"),e[84]=i,e[85]=ke):ke=e[85];let we;e[86]!==ke?(we={className:"font-mono text-xs",head:ke,render:il},e[86]=ke,e[87]=we):we=e[87];let Se;e[88]!==i?(Se=i("name"),e[88]=i,e[89]=Se):Se=e[89];let Ne;e[90]!==Se?(Ne={head:Se,render:ol},e[90]=Se,e[91]=Ne):Ne=e[91];let nt;e[92]!==we||e[93]!==Ne?(nt=[we,Ne],e[92]=we,e[93]=Ne,e[94]=nt):nt=e[94];let pt=nt,Ae;e[95]!==i?(Ae=i("userId"),e[95]=i,e[96]=Ae):Ae=e[96];let dt;e[97]!==Ae?(dt=[{head:Ae,render:sl}],e[97]=Ae,e[98]=dt):dt=e[98];let yt=dt,ze;e[99]!==i?(ze=i("role"),e[99]=i,e[100]=ze):ze=e[100];let De;e[101]!==ze?(De={head:ze,render:rl},e[101]=ze,e[102]=De):De=e[102];let Oe;e[103]!==i?(Oe=i("Permission"),e[103]=i,e[104]=Oe):Oe=e[104];let _e;e[105]!==Oe?(_e={className:"font-mono text-xs whitespace-pre-wrap",head:Oe,render:al},e[105]=Oe,e[106]=_e):_e=e[106];let mt;e[107]!==De||e[108]!==_e?(mt=[De,_e],e[107]=De,e[108]=_e,e[109]=mt):mt=e[109];let Ct=mt,$e;e[110]!==oe?($e=oe!==null&&(0,o.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"org-detail-error",role:"alert",children:oe},void 0,!1),e[110]=oe,e[111]=$e):$e=e[111];let Te;e[112]!==g?(Te=g!==null&&(0,o.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"org-action-error",role:"alert",children:g},void 0,!1),e[112]=g,e[113]=Te):Te=e[113];let ct;e[114]===Symbol.for("react.memo_cache_sentinel")?(ct=n(()=>{a({kind:"add-member"})},"t50"),e[114]=ct):ct=e[114];let Me;e[115]!==i?(Me=i("Add member"),e[115]=i,e[116]=Me):Me=e[116];let Fe;e[117]!==Me?(Fe=(0,o.jsxDEV)(j,{"data-testid":"org-open-add-member",onClick:ct,size:"xs",type:"button",variant:"outline",children:Me},void 0,!1),e[117]=Me,e[118]=Fe):Fe=e[118];let ft;e[119]===Symbol.for("react.memo_cache_sentinel")?(ft=n(()=>{a({kind:"invite-member"})},"t53"),e[119]=ft):ft=e[119];let Re;e[120]!==i?(Re=i("Invite member"),e[120]=i,e[121]=Re):Re=e[121];let Ee;e[122]!==Re?(Ee=(0,o.jsxDEV)(j,{"data-testid":"org-open-invite-member",onClick:ft,size:"xs",type:"button",variant:"outline",children:Re},void 0,!1),e[122]=Re,e[123]=Ee):Ee=e[123];let Le;e[124]!==Fe||e[125]!==Ee?(Le=(0,o.jsxDEV)(o.Fragment,{children:[Fe,Ee]},void 0,!0),e[124]=Fe,e[125]=Ee,e[126]=Le):Le=e[126];let je;e[127]!==i?(je=i("Members"),e[127]=i,e[128]=je):je=e[128];let Pe;e[129]!==p||e[130]!==r||e[131]!==ht||e[132]!==V||e[133]!==re||e[134]!==i?(Pe=V.length===0?(0,o.jsxDEV)("div",{className:"p-3",children:(0,o.jsxDEV)(ce,{testId:"org-members-empty",title:i("No members.")},void 0,!1)},void 0,!1):(0,o.jsxDEV)(it,{columns:ht,rowActions:n(R=>(0,o.jsxDEV)(o.Fragment,{children:[(0,o.jsxDEV)(j,{"data-testid":`org-member-role-${A(R.id)}`,onClick:n(()=>{a({kind:"member-role",member:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Change role")},void 0,!1),(0,o.jsxDEV)(j,{"data-testid":`org-remove-member-${A(R.id)}`,disabled:p,onClick:n(()=>{re(()=>r.removeAuthOrgMember({memberId:A(R.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Remove")},void 0,!1)]},void 0,!0),"rowActions"),rowPrefix:"org-member",rows:V},void 0,!1),e[129]=p,e[130]=r,e[131]=ht,e[132]=V,e[133]=re,e[134]=i,e[135]=Pe):Pe=e[135];let Qe;e[136]!==Le||e[137]!==je||e[138]!==Pe?(Qe=(0,o.jsxDEV)(lt,{action:Le,heading:je,testId:"org-members",children:Pe},void 0,!1),e[136]=Le,e[137]=je,e[138]=Pe,e[139]=Qe):Qe=e[139];let Je;e[140]!==p||e[141]!==r||e[142]!==bt||e[143]!==F||e[144]!==re||e[145]!==i?(Je=F.length>0&&(0,o.jsxDEV)(lt,{heading:i("Invitations"),testId:"org-invitations",children:(0,o.jsxDEV)(it,{columns:bt,rowActions:n(R=>(0,o.jsxDEV)(j,{"data-testid":`org-cancel-invitation-${A(R.id)}`,disabled:p,onClick:n(()=>{re(()=>r.cancelAuthOrgInvitation({invitationId:A(R.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Cancel")},void 0,!1),"rowActions"),rowPrefix:"org-invitation",rows:F},void 0,!1)},void 0,!1),e[140]=p,e[141]=r,e[142]=bt,e[143]=F,e[144]=re,e[145]=i,e[146]=Je):Je=e[146];let Be;e[147]!==vt||e[148]!==m||e[149]!==i||e[150]!==pt||e[151]!==ie||e[152]!==f?(Be=f&&(0,o.jsxDEV)(lt,{action:(0,o.jsxDEV)(j,{"data-testid":"org-open-create-team",onClick:n(()=>{a({kind:"team-create"})},"onClick"),size:"xs",type:"button",variant:"outline",children:i("New team")},void 0,!1),heading:i("Teams"),testId:"org-teams",children:ie.length===0?(0,o.jsxDEV)("div",{className:"p-3",children:(0,o.jsxDEV)(ce,{testId:"org-teams-empty",title:i("No teams.")},void 0,!1)},void 0,!1):(0,o.jsxDEV)(it,{columns:pt,rowActions:n(R=>(0,o.jsxDEV)(o.Fragment,{children:[(0,o.jsxDEV)(j,{"aria-pressed":m===A(R.id),"data-testid":`org-team-select-${A(R.id)}`,onClick:n(()=>{c(A(R.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Members")},void 0,!1),(0,o.jsxDEV)(j,{"data-testid":`org-team-rename-${A(R.id)}`,onClick:n(()=>{a({kind:"team-rename",team:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Rename")},void 0,!1),(0,o.jsxDEV)(j,{"data-testid":`org-team-delete-${A(R.id)}`,onClick:n(()=>{vt(R)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Delete")},void 0,!1)]},void 0,!0),"rowActions"),rowPrefix:"org-team",rows:ie},void 0,!1)},void 0,!1),e[147]=vt,e[148]=m,e[149]=i,e[150]=pt,e[151]=ie,e[152]=f,e[153]=Be):Be=e[153];let Ue;e[154]!==p||e[155]!==r||e[156]!==re||e[157]!==m||e[158]!==i||e[159]!==yt||e[160]!==ee||e[161]!==f?(Ue=f&&m!==null&&(0,o.jsxDEV)(lt,{action:(0,o.jsxDEV)(j,{"data-testid":"org-open-add-team-member",onClick:n(()=>{a({kind:"team-add-member",teamId:m})},"onClick"),size:"xs",type:"button",variant:"outline",children:i("Add member")},void 0,!1),heading:i("Team members"),testId:"org-team-members",children:ee.length===0?(0,o.jsxDEV)("div",{className:"p-3",children:(0,o.jsxDEV)(ce,{testId:"org-team-members-empty",title:i("No team members.")},void 0,!1)},void 0,!1):(0,o.jsxDEV)(it,{columns:yt,rowActions:n(R=>(0,o.jsxDEV)(j,{"data-testid":`org-team-remove-member-${A(R.id)}`,disabled:p,onClick:n(()=>{re(()=>r.removeAuthOrgTeamMember({teamMemberId:A(R.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Remove")},void 0,!1),"rowActions"),rowPrefix:"org-team-member",rows:ee},void 0,!1)},void 0,!1),e[154]=p,e[155]=r,e[156]=re,e[157]=m,e[158]=i,e[159]=yt,e[160]=ee,e[161]=f,e[162]=Ue):Ue=e[162];let He;e[163]!==r||e[164]!==Ct||e[165]!==Y||e[166]!==d||e[167]!==i?(He=d&&(0,o.jsxDEV)(lt,{action:(0,o.jsxDEV)(j,{"data-testid":"org-open-create-role",onClick:n(()=>{a({kind:"role-create"})},"onClick"),size:"xs",type:"button",variant:"outline",children:i("New role")},void 0,!1),heading:i("Roles"),testId:"org-roles",children:Y.length===0?(0,o.jsxDEV)("div",{className:"p-3",children:(0,o.jsxDEV)(ce,{testId:"org-roles-empty",title:i("No custom roles.")},void 0,!1)},void 0,!1):(0,o.jsxDEV)(it,{columns:Ct,rowActions:n(R=>(0,o.jsxDEV)(o.Fragment,{children:[(0,o.jsxDEV)(j,{"data-testid":`org-role-edit-${A(R.id)}`,onClick:n(()=>{a({kind:"role-edit",role:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Edit")},void 0,!1),(0,o.jsxDEV)(j,{"data-testid":`org-role-delete-${A(R.id)}`,onClick:n(()=>{a({action:n(()=>r.deleteAuthOrgRole({roleId:A(R.id)}),"action"),kind:"confirm",message:i("Delete this custom role? Members keeping it will lose its grants."),testId:"org-role-delete",title:i("Delete role")})},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Delete")},void 0,!1)]},void 0,!0),"rowActions"),rowPrefix:"org-role",rows:Y},void 0,!1)},void 0,!1),e[163]=r,e[164]=Ct,e[165]=Y,e[166]=d,e[167]=i,e[168]=He):He=e[168];let Ve;e[169]!==s?.kind||e[170]!==l||e[171]!==O?(Ve=s?.kind==="add-member"&&(0,o.jsxDEV)(Vt,{onClose:E,onDone:O,organizationId:l},void 0,!1),e[169]=s?.kind,e[170]=l,e[171]=O,e[172]=Ve):Ve=e[172];let qe;e[173]!==s?.kind||e[174]!==l||e[175]!==O?(qe=s?.kind==="invite-member"&&(0,o.jsxDEV)(qt,{onClose:E,onDone:O,organizationId:l},void 0,!1),e[173]=s?.kind,e[174]=l,e[175]=O,e[176]=qe):qe=e[176];let Ge;e[177]!==s||e[178]!==O?(Ge=s?.kind==="member-role"&&(0,o.jsxDEV)(Gt,{member:s.member,onClose:E,onDone:O},void 0,!1),e[177]=s,e[178]=O,e[179]=Ge):Ge=e[179];let Ke;e[180]!==s?.kind||e[181]!==l||e[182]!==O?(Ke=s?.kind==="team-create"&&(0,o.jsxDEV)(Et,{mode:"create",onClose:E,onDone:O,organizationId:l},void 0,!1),e[180]=s?.kind,e[181]=l,e[182]=O,e[183]=Ke):Ke=e[183];let We;e[184]!==s||e[185]!==l||e[186]!==O?(We=s?.kind==="team-rename"&&(0,o.jsxDEV)(Et,{mode:"edit",onClose:E,onDone:O,organizationId:l,team:s.team},void 0,!1),e[184]=s,e[185]=l,e[186]=O,e[187]=We):We=e[187];let Xe;e[188]!==s||e[189]!==O?(Xe=s?.kind==="team-add-member"&&(0,o.jsxDEV)(Kt,{onClose:E,onDone:O,teamId:s.teamId},void 0,!1),e[188]=s,e[189]=O,e[190]=Xe):Xe=e[190];let Ye;e[191]!==s?.kind||e[192]!==l||e[193]!==O?(Ye=s?.kind==="role-create"&&(0,o.jsxDEV)(Lt,{mode:"create",onClose:E,onDone:O,organizationId:l},void 0,!1),e[191]=s?.kind,e[192]=l,e[193]=O,e[194]=Ye):Ye=e[194];let Ze;e[195]!==s||e[196]!==l||e[197]!==O?(Ze=s?.kind==="role-edit"&&(0,o.jsxDEV)(Lt,{mode:"edit",onClose:E,onDone:O,organizationId:l,role:s.role},void 0,!1),e[195]=s,e[196]=l,e[197]=O,e[198]=Ze):Ze=e[198];let et;e[199]!==s||e[200]!==O?(et=s?.kind==="confirm"&&(0,o.jsxDEV)(Qt,{action:s.action,message:s.message,onClose:E,onDone:O,testId:s.testId,title:s.title},void 0,!1),e[199]=s,e[200]=O,e[201]=et):et=e[201];let ut;return e[202]!==$e||e[203]!==Te||e[204]!==Qe||e[205]!==Je||e[206]!==Be||e[207]!==Ue||e[208]!==He||e[209]!==Ve||e[210]!==qe||e[211]!==Ge||e[212]!==Ke||e[213]!==We||e[214]!==Xe||e[215]!==Ye||e[216]!==Ze||e[217]!==et?(ut=(0,o.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"org-detail",children:[$e,Te,Qe,Je,Be,Ue,He,Ve,qe,Ge,Ke,We,Xe,Ye,Ze,et]},void 0,!0),e[202]=$e,e[203]=Te,e[204]=Qe,e[205]=Je,e[206]=Be,e[207]=Ue,e[208]=He,e[209]=Ve,e[210]=qe,e[211]=Ge,e[212]=Ke,e[213]=We,e[214]=Xe,e[215]=Ye,e[216]=Ze,e[217]=et,e[218]=ut):ut=e[218],ut},"OrganizationDetail");function Xt(t){return(0,o.jsxDEV)(ne,{children:t.head},t.head,!1)}n(Xt,"_temp");function Yt(t){return(0,o.jsxDEV)("span",{className:"font-mono text-xs",children:A(t.userId)},void 0,!1)}n(Yt,"_temp2");function Zt(t){return A(t.role)}n(Zt,"_temp3");function el(t){return A(t.email)}n(el,"_temp4");function tl(t){return A(t.role)}n(tl,"_temp5");function ll(t){return A(t.status)}n(ll,"_temp6");function il(t){return A(t.id)}n(il,"_temp7");function ol(t){return A(t.name)}n(ol,"_temp8");function sl(t){return(0,o.jsxDEV)("span",{className:"font-mono text-xs",children:A(t.userId)},void 0,!1)}n(sl,"_temp9");function rl(t){return A(t.role)}n(rl,"_temp0");function al(t){return A(t.permission)}n(al,"_temp1");var Il=n(()=>{let t=(0,G.c)(62),e=le(),l=K(),{config:d,ready:f}=Mt(),r=d.capabilities.organization,[i,s]=(0,P.useState)(null),[a,m]=(0,P.useState)(null),c;t[0]===Symbol.for("react.memo_cache_sentinel")?(c=["lunora-auth-orgs"],t[0]=c):c=t[0];let p;t[1]!==e?(p=n(()=>e.listAuthOrganizations({limit:100}),"t1"),t[1]=e,t[2]=p):p=t[2];let u;t[3]!==r?(u={enabled:r},t[3]=r,t[4]=u):u=t[4];let g=fe(c,p,u),k=g.data?.rows??null,h;t[5]!==g?(h=n(()=>{g.refetch()},"t3"),t[5]=g,t[6]=h):h=t[6],Dt(h,r);let y;t[7]===Symbol.for("react.memo_cache_sentinel")?(y=n(()=>{m(null)},"t4"),t[7]=y):y=t[7];let w=y,b;t[8]!==g?(b=n(()=>{g.refetch()},"t5"),t[8]=g,t[9]=b):b=t[9];let I=b,v;t[10]===Symbol.for("react.memo_cache_sentinel")?(v=n(M=>{s(M)},"t6"),t[10]=v):v=t[10];let S=v;if(f&&!r){let M;t[11]!==l?(M=l("Enable the organization() plugin in your auth config to manage organizations here."),t[11]=l,t[12]=M):M=t[12];let F;t[13]!==l?(F=l("Organizations are not enabled."),t[13]=l,t[14]=F):F=t[14];let U;return t[15]!==M||t[16]!==F?(U=(0,o.jsxDEV)(ce,{description:M,testId:"org-disabled",title:F},void 0,!1),t[15]=M,t[16]=F,t[17]=U):U=t[17],U}let C;t[18]!==l?(C=l("Organizations"),t[18]=l,t[19]=C):C=t[19];let x;t[20]!==C?(x=(0,o.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:C},void 0,!1),t[20]=C,t[21]=x):x=t[21];let N;t[22]===Symbol.for("react.memo_cache_sentinel")?(N=n(()=>{m({kind:"create"})},"t9"),t[22]=N):N=t[22];let _;t[23]!==l?(_=l("New organization"),t[23]=l,t[24]=_):_=t[24];let D;t[25]!==_?(D=(0,o.jsxDEV)(j,{"data-testid":"org-new",onClick:N,size:"sm",type:"button",children:_},void 0,!1),t[25]=_,t[26]=D):D=t[26];let z;t[27]!==D||t[28]!==x?(z=(0,o.jsxDEV)("div",{className:"flex items-center justify-between",children:[x,D]},void 0,!0),t[27]=D,t[28]=x,t[29]=z):z=t[29];let $;t[30]!==g.error?($=g.error!==null&&(0,o.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"org-error",role:"alert",children:g.error},void 0,!1),t[30]=g.error,t[31]=$):$=t[31];let T;t[32]!==k||t[33]!==l?(T=k!==null&&k.length===0&&(0,o.jsxDEV)(ce,{testId:"org-empty",title:l("No organizations.")},void 0,!1),t[32]=k,t[33]=l,t[34]=T):T=t[34];let Q;t[35]!==k||t[36]!==i||t[37]!==l?(Q=k!==null&&k.length>0&&(0,o.jsxDEV)(kt,{className:"overflow-hidden py-0",children:(0,o.jsxDEV)(wt,{className:"px-0",children:(0,o.jsxDEV)(St,{"data-testid":"org-table",children:[(0,o.jsxDEV)(Nt,{children:(0,o.jsxDEV)(tt,{children:[(0,o.jsxDEV)(ne,{children:l("id")},void 0,!1),(0,o.jsxDEV)(ne,{children:l("name")},void 0,!1),(0,o.jsxDEV)(ne,{children:l("slug")},void 0,!1),(0,o.jsxDEV)(ne,{children:l("created")},void 0,!1),(0,o.jsxDEV)(ne,{"aria-label":l("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,o.jsxDEV)(At,{children:k.map(M=>{let F=A(M.id);return(0,o.jsxDEV)(tt,{"data-testid":`org-row-${F}`,children:[(0,o.jsxDEV)(de,{className:"font-mono text-xs",children:F},void 0,!1),(0,o.jsxDEV)(de,{children:A(M.name)},void 0,!1),(0,o.jsxDEV)(de,{children:A(M.slug)},void 0,!1),(0,o.jsxDEV)(de,{className:"text-muted-foreground tabular-nums",children:$t(M.createdAt)},void 0,!1),(0,o.jsxDEV)(de,{children:(0,o.jsxDEV)("div",{className:"flex justify-end gap-1",children:[(0,o.jsxDEV)(j,{"aria-pressed":i===F,"data-testid":`org-select-${F}`,onClick:n(()=>{S(F)},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Manage")},void 0,!1),(0,o.jsxDEV)(j,{"data-testid":`org-edit-${F}`,onClick:n(()=>{m({kind:"edit",org:M})},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Edit")},void 0,!1),(0,o.jsxDEV)(j,{"data-testid":`org-delete-${F}`,onClick:n(()=>{m({kind:"delete",org:M})},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Delete")},void 0,!1)]},void 0,!0)},void 0,!1)]},F,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),t[35]=k,t[36]=i,t[37]=l,t[38]=Q):Q=t[38];let H;t[39]!==d.organization||t[40]!==i?(H=i!==null&&(0,o.jsxDEV)(Wt,{organizationId:i,rolesEnabled:d.organization.roles,teamsEnabled:d.organization.teams},void 0,!1),t[39]=d.organization,t[40]=i,t[41]=H):H=t[41];let J;t[42]!==a?.kind||t[43]!==I?(J=a?.kind==="create"&&(0,o.jsxDEV)(Rt,{mode:"create",onClose:w,onDone:I},void 0,!1),t[42]=a?.kind,t[43]=I,t[44]=J):J=t[44];let L;t[45]!==a||t[46]!==I?(L=a?.kind==="edit"&&(0,o.jsxDEV)(Rt,{mode:"edit",onClose:w,onDone:I,org:a.org},void 0,!1),t[45]=a,t[46]=I,t[47]=L):L=t[47];let B;t[48]!==e||t[49]!==a||t[50]!==I||t[51]!==l?(B=a?.kind==="delete"&&(0,o.jsxDEV)(Qt,{action:n(async()=>{let M=A(a.org.id);await e.deleteAuthOrganization({organizationId:M}),s(F=>F===M?null:F)},"action"),message:l("Delete this organization? Its members, invitations, teams, and custom roles are removed. This cannot be undone."),onClose:w,onDone:I,testId:"org-delete",title:l("Delete organization")},void 0,!1),t[48]=e,t[49]=a,t[50]=I,t[51]=l,t[52]=B):B=t[52];let V;return t[53]!==z||t[54]!==$||t[55]!==T||t[56]!==Q||t[57]!==H||t[58]!==J||t[59]!==L||t[60]!==B?(V=(0,o.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-organizations",children:[z,$,T,Q,H,J,L,B]},void 0,!0),t[53]=z,t[54]=$,t[55]=T,t[56]=Q,t[57]=H,t[58]=J,t[59]=L,t[60]=B,t[61]=V):V=t[61],V},"OrganizationsPanel");export{Il as OrganizationsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as $}from"./chunk-
|
|
1
|
+
import{a as $}from"./chunk-WMDH2CIZ.js";import{a as W}from"./chunk-2YTF6LJ6.js";import{a as _}from"./chunk-2K47A3P6.js";import{a as q}from"./chunk-2ICZ6HXQ.js";import"./chunk-XNJNSCLM.js";import{b as H}from"./chunk-2YUYNNHQ.js";import{a as G,b as P,c as V,d as b,e as i,f as o}from"./chunk-GTM65MVX.js";import{a as k,e as B}from"./chunk-Y572GMZE.js";import{a as y}from"./chunk-JSEXCW5Q.js";import{a as U}from"./chunk-F2YMCQ6B.js";import{b as Q}from"./chunk-4PC7IXNY.js";import"./chunk-2MLA6WFH.js";import{R as w}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as L}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{b as T}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as g}from"./chunk-MHGJUKCZ.js";import{f as M}from"./chunk-C7UZEQZ7.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as A}from"./chunk-TAD43CG5.js";import{d as S,f as F,g as K,h as O,m as j,q as z}from"./chunk-HBGS4SEX.js";import"./chunk-ZXLEXF4X.js";import{a as n,e as D,f as le,h as ce}from"./chunk-RRCPZMC2.js";var a=D(le(),1);var e=D(ce(),1);var ue=F(g.runMigration),we=n(({initialShardKey:J})=>{let X=M(),r=S(),[c,Y]=(0,a.useState)(J??""),[x,Z]=(0,a.useState)(""),[R,ee]=(0,a.useState)("up"),[f,re]=(0,a.useState)(!0),[u,N]=(0,a.useState)(!1),[d,h]=(0,a.useState)(null),[C,p]=(0,a.useState)(null),m=_(c.trim(),400),I=c.trim()===m,s=H(g.migrationStatus,{},{live:!0,shardKey:m}),l=s.data?.migrations??null,te=s.error,{errorSource:ae,liveError:ie}=s;(0,a.useEffect)(()=>{s.data!==void 0&&Q(m)},[s.data,m]);let oe=n(async()=>{let t=x.trim();if(t===""){p(r("Enter a migration id")),h(null);return}N(!0),p(null);try{let v=await X.query(ue,{direction:R,dryRun:f,id:t},K(c));h(v),s.refetch()}catch(v){h(null),p(O(v))}finally{N(!1)}},"run"),E=n(()=>{j(oe())},"runMigration"),ne=n(t=>{Z(t.target.value)},"onIdChange"),se=n(t=>{ee(t.target.value==="down"?"down":"up")},"onDirectionChange"),de=n(t=>{re(t.target.checked)},"onDryRunChange");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-migrations",children:[(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)(U,{onChange:Y,testId:"mg-shard-input",value:c},void 0,!1),(0,e.jsxDEV)($,{message:ie,prefix:"mg"},void 0,!1)]},void 0,!0),te!==null&&(0,e.jsxDEV)(q,{error:ae,testId:"mg-status-error"},void 0,!1),l!==null&&l.length===0&&(0,e.jsxDEV)(A,{description:r("Data migrations you run against this shard will be tracked here."),icon:(0,e.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsxDEV)("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"},void 0,!1)},void 0,!1),testId:"mg-empty",title:r("No migrations have run on this shard.")},void 0,!1),l!==null&&l.length>0&&(0,e.jsxDEV)(k,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(B,{className:"px-0",children:(0,e.jsxDEV)(G,{"data-testid":"mg-table",children:[(0,e.jsxDEV)(P,{children:(0,e.jsxDEV)(b,{children:[(0,e.jsxDEV)(i,{children:r("id")},void 0,!1),(0,e.jsxDEV)(i,{children:r("direction")},void 0,!1),(0,e.jsxDEV)(i,{children:r("status")},void 0,!1),(0,e.jsxDEV)(i,{children:r("processed")},void 0,!1),(0,e.jsxDEV)(i,{children:r("changed")},void 0,!1),(0,e.jsxDEV)(i,{children:r("updated")},void 0,!1),(0,e.jsxDEV)(i,{children:r("error")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(V,{children:l.map(t=>(0,e.jsxDEV)(b,{"data-testid":`mg-row-${t.id}`,children:[(0,e.jsxDEV)(o,{children:t.id},void 0,!1),(0,e.jsxDEV)(o,{children:t.direction},void 0,!1),(0,e.jsxDEV)(o,{children:(0,e.jsxDEV)(T,{variant:"secondary",children:t.status},void 0,!1)},void 0,!1),(0,e.jsxDEV)(o,{children:t.processed},void 0,!1),(0,e.jsxDEV)(o,{children:t.changed},void 0,!1),(0,e.jsxDEV)(o,{children:z(t.updatedAt)},void 0,!1),(0,e.jsxDEV)(o,{children:t.error??""},void 0,!1)]},t.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs",children:[(0,e.jsxDEV)(y,{children:r("Run migration")},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)(w,{"aria-label":r("Migration id"),className:"w-auto","data-testid":"mg-id-input",onChange:ne,placeholder:r("migration id"),value:x},void 0,!1),(0,e.jsxDEV)("select",{"aria-label":r("Direction"),className:"flex h-9 rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"mg-direction",onChange:se,value:R,children:[(0,e.jsxDEV)("option",{value:"up",children:r("up")},void 0,!1),(0,e.jsxDEV)("option",{value:"down",children:r("down")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)(y,{className:"flex items-center gap-1.5",htmlFor:"mg-dry-run",children:[(0,e.jsxDEV)("input",{checked:f,className:"size-4 accent-primary","data-testid":"mg-dry-run",id:"mg-dry-run",onChange:de,type:"checkbox"},void 0,!1),r("Dry run")]},void 0,!0),f?(0,e.jsxDEV)(L,{"data-testid":"mg-run",disabled:u||!I,onClick:E,size:"sm",type:"button",children:r(u?"Running\u2026":"Run")},void 0,!1):(0,e.jsxDEV)(W,{confirmLabel:r(u?"Running\u2026":"Run migration?"),disabled:u||!I,onConfirm:E,testId:"mg-run",children:r("Run")},void 0,!1)]},void 0,!0)]},void 0,!0),C!==null&&(0,e.jsxDEV)("pre",{className:"text-sm text-destructive whitespace-pre-wrap","data-testid":"mg-run-error",role:"alert",children:C},void 0,!1),d!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"mg-run-result",children:[d.dryRun?r("Dry run: "):"",r("{status} \u2014 processed",{status:d.status}),d.processed,r(", changed"),d.changed]},void 0,!0)]},void 0,!0)},"MigrationsPanel");export{we as MigrationsPanel};
|