@lunora/studio 1.0.0-alpha.80 → 1.0.0-alpha.82
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 +35 -6
- package/dist/index.js +1 -1
- package/dist/mount.js +1 -1
- package/dist/packem_chunks/AdvisorHealthPanel.js +1 -0
- package/dist/packem_chunks/ApiTab.js +1 -1
- package/dist/packem_chunks/AuditPanel.js +1 -1
- package/dist/packem_chunks/ExportImportPanel.js +1 -1
- package/dist/packem_chunks/FileBrowser.js +1 -1
- package/dist/packem_chunks/FunctionRunner.js +1 -1
- package/dist/packem_chunks/FunctionStatsPanel.js +1 -1
- package/dist/packem_chunks/HealthPanel.js +1 -1
- package/dist/packem_chunks/InsightsPanel.js +1 -1
- package/dist/packem_chunks/LogsPanel.js +1 -1
- package/dist/packem_chunks/MailPanel.js +2 -2
- package/dist/packem_chunks/MetricsPanel.js +1 -1
- package/dist/packem_chunks/NotificationsPanel.js +1 -1
- package/dist/packem_chunks/PitrPanel.js +1 -1
- package/dist/packem_chunks/SchemaViewer.js +1 -1
- package/dist/packem_chunks/SecurityAdvisorPanel.js +1 -1
- package/dist/packem_chunks/SettingsPanel.js +1 -1
- package/dist/packem_chunks/SqlEditorPanel.js +6 -6
- package/dist/packem_chunks/TableEditor.js +1 -1
- package/dist/packem_chunks/agents-panel.js +1 -1
- package/dist/packem_chunks/auth-audit-panel.js +1 -1
- package/dist/packem_chunks/containers-panel.js +1 -1
- package/dist/packem_chunks/dashboards-panel.js +1 -1
- package/dist/packem_chunks/fanout-panel.js +1 -1
- package/dist/packem_chunks/flags-panel.js +1 -1
- package/dist/packem_chunks/issues-panel.js +1 -1
- package/dist/packem_chunks/kv-browser.js +1 -1
- package/dist/packem_chunks/log-drains-panel.js +1 -1
- package/dist/packem_chunks/migrations-route.js +1 -1
- package/dist/packem_chunks/organizations-panel.js +1 -1
- package/dist/packem_chunks/payments-panel.js +1 -1
- package/dist/packem_chunks/permissions-panel.js +1 -1
- package/dist/packem_chunks/queues-panel.js +1 -1
- package/dist/packem_chunks/rls-panel.js +1 -1
- package/dist/packem_chunks/storage-rules-panel.js +1 -1
- package/dist/packem_chunks/subscriptions-panel.js +1 -1
- package/dist/packem_chunks/traces-panel.js +1 -1
- package/dist/packem_chunks/workflows-panel.js +1 -1
- package/dist/packem_shared/ADMIN_FUNCTIONS-CZESgd10.js +1 -0
- package/dist/packem_shared/{ApiDocsPanel-DfUQ1ZAF.js → ApiDocsPanel-fYS9NiLg.js} +1 -1
- package/dist/packem_shared/DataBrowser-C4J4gVUu.js +1 -0
- package/dist/packem_shared/GlobalDataBrowser-CSttudUx.js +1 -0
- package/dist/packem_shared/{HomePanel-Dcs4a3Ax.js → HomePanel-BYsfMhKh.js} +1 -1
- package/dist/packem_shared/{MigrationsPanel-C2OnsqRb.js → MigrationsPanel-2JbQ2HwG.js} +1 -1
- package/dist/packem_shared/{Studio-B26_pT8J.js → Studio-Ba9x0dG_.js} +1 -1
- package/dist/packem_shared/{StudioApp-bXhJeLlZ.js → StudioApp-B_PRdg4h.js} +1 -1
- package/dist/packem_shared/{cf-links-gbDy51nR.js → cf-links-Dmg86v1D.js} +1 -1
- package/dist/packem_shared/{home-panel-CU6MWLHG.js → home-panel-B60-5YfI.js} +1 -1
- package/dist/packem_shared/stat-card-fm_TF1mo.js +1 -0
- package/dist/packem_shared/studio-CPuoAmjh.js +2 -0
- package/dist/packem_shared/table-list-sidebar-BRv3hTLX.js +1 -0
- package/dist/packem_shared/{use-sql-assistant-CHEu2-Rk.js → use-sql-assistant-BLG9unQN.js} +1 -1
- package/dist/standalone/{chunk-RQ7AFLIV.js → chunk-2QSHLBCO.js} +1 -1
- package/dist/standalone/{chunk-33CL6OHR.js → chunk-5SQRE3VR.js} +1 -1
- package/dist/standalone/{chunk-5CVJS7ON.js → chunk-6QP5N57V.js} +1 -1
- package/dist/standalone/chunk-73GRNONE.js +1 -0
- package/dist/standalone/{chunk-JRMMYIAF.js → chunk-74DN6HIE.js} +1 -1
- package/dist/standalone/{chunk-KZ3ALMMP.js → chunk-7H7LZRLP.js} +1 -1
- package/dist/standalone/{chunk-FOBRNWBG.js → chunk-7YKWP4QK.js} +1 -1
- package/dist/standalone/{chunk-T7IUZIF4.js → chunk-7ZUQE3KU.js} +1 -1
- package/dist/standalone/{chunk-P4YLIBCN.js → chunk-A3KUNMU6.js} +1 -1
- package/dist/standalone/{chunk-S2VVR7HI.js → chunk-B2H5DK55.js} +1 -1
- package/dist/standalone/{chunk-FNPJ7GJZ.js → chunk-BDJCCVB6.js} +1 -1
- package/dist/standalone/{chunk-KJB7YAKB.js → chunk-C7EOC2WS.js} +1 -1
- package/dist/standalone/{chunk-KLQYC6CC.js → chunk-CGLS2ILT.js} +1 -1
- package/dist/standalone/chunk-CPSGJSHY.js +1 -0
- package/dist/standalone/{chunk-RJP3WBZ4.js → chunk-CU6SCYQ7.js} +1 -1
- package/dist/standalone/chunk-DGBJE7YF.js +4 -0
- package/dist/standalone/{chunk-G6PSMGLD.js → chunk-DOZAODYC.js} +1 -1
- package/dist/standalone/chunk-EQZTSISX.js +1 -0
- package/dist/standalone/chunk-ERMTJYQF.js +1 -0
- package/dist/standalone/{chunk-QZGTH6WH.js → chunk-GB6LP6UJ.js} +1 -1
- package/dist/standalone/{chunk-GYKVBKT5.js → chunk-GM67EQJU.js} +1 -1
- package/dist/standalone/chunk-GN567L2T.js +1 -0
- package/dist/standalone/{chunk-L7R74G63.js → chunk-GWHM4C4N.js} +1 -1
- package/dist/standalone/{chunk-JLOWAJRR.js → chunk-GWQIPIYA.js} +1 -1
- package/dist/standalone/{chunk-6YTSSIEJ.js → chunk-HEB6GQQ6.js} +1 -1
- package/dist/standalone/chunk-HOR3JLUY.js +6 -0
- package/dist/standalone/{chunk-7LWMHTJ3.js → chunk-I6A5C46N.js} +1 -1
- package/dist/standalone/{chunk-H6YOWRFB.js → chunk-KAPSM6AI.js} +1 -1
- package/dist/standalone/{chunk-6NY7SPDL.js → chunk-KSRP7GZV.js} +1 -1
- package/dist/standalone/chunk-LLF5KWDZ.js +2 -0
- package/dist/standalone/chunk-NRCXRCJX.js +1 -0
- package/dist/standalone/chunk-OE465DVY.js +1 -0
- package/dist/standalone/{chunk-HJ3E4YF5.js → chunk-PXYWCZ7T.js} +1 -1
- package/dist/standalone/{chunk-PZVU2QMX.js → chunk-Q7QTRX2E.js} +1 -1
- package/dist/standalone/{chunk-E3NMX2VU.js → chunk-S4ILMYP5.js} +1 -1
- package/dist/standalone/{chunk-KC44QCN6.js → chunk-SDQBPFLO.js} +1 -1
- package/dist/standalone/chunk-SV52HB7D.js +1 -0
- package/dist/standalone/{chunk-WBYSSCV2.js → chunk-T242WITF.js} +1 -1
- package/dist/standalone/{chunk-VHWOCPRK.js → chunk-TBRZQICB.js} +1 -1
- package/dist/standalone/{chunk-6LNCYDZO.js → chunk-TQXZ7LG4.js} +1 -1
- package/dist/standalone/chunk-U457LHCO.js +1 -0
- package/dist/standalone/chunk-UBPYN4DU.js +1 -0
- package/dist/standalone/{chunk-34D36UCW.js → chunk-UDVB4URN.js} +1 -1
- package/dist/standalone/{chunk-6IKEW5LG.js → chunk-UETNCBWU.js} +1 -1
- package/dist/standalone/{chunk-OY2RVUZL.js → chunk-UU2QJMGJ.js} +1 -1
- package/dist/standalone/chunk-VC5SSRUP.js +1 -0
- package/dist/standalone/{chunk-GXSZH7VJ.js → chunk-VCXH5V3Z.js} +1 -1
- package/dist/standalone/{chunk-RNRJKBY3.js → chunk-VTLYN3CX.js} +1 -1
- package/dist/standalone/{chunk-3O3HAXW7.js → chunk-WDG4WFUV.js} +1 -1
- package/dist/standalone/{chunk-3STOIE7Q.js → chunk-WJGOI3FZ.js} +1 -1
- package/dist/standalone/{chunk-W6SAOXGH.js → chunk-WLZ7YPBH.js} +1 -1
- package/dist/standalone/{chunk-2VDFV5TD.js → chunk-WQVVA5NB.js} +1 -1
- package/dist/standalone/{chunk-TTGOOYLF.js → chunk-WZ3B3MEV.js} +1 -1
- package/dist/standalone/{chunk-SKW6J4VW.js → chunk-Y7A5NCXT.js} +1 -1
- package/dist/standalone/{chunk-IHQC7J35.js → chunk-YSRW5RNU.js} +1 -1
- package/dist/standalone/{chunk-GAX5IZYG.js → chunk-YTA2HGRD.js} +1 -1
- package/dist/standalone/chunk-ZHBIKP5G.js +1 -0
- package/dist/standalone/{chunk-CCVXYYPJ.js → chunk-ZK3XKFCI.js} +1 -1
- package/dist/standalone/studio.js +1 -1
- package/dist/styles.css +1 -1
- package/package.json +5 -5
- package/dist/packem_shared/ADMIN_FUNCTIONS-BnD4aovm.js +0 -1
- package/dist/packem_shared/DataBrowser-CuRlztBz.js +0 -1
- package/dist/packem_shared/GlobalDataBrowser-DB-vQ2_H.js +0 -1
- package/dist/packem_shared/studio-q-C-acL7.js +0 -2
- package/dist/packem_shared/table-list-sidebar-BFkSQwlB.js +0 -1
- package/dist/standalone/chunk-2GA4SHO7.js +0 -1
- package/dist/standalone/chunk-2WOIRKEI.js +0 -1
- package/dist/standalone/chunk-6PNPIW6I.js +0 -2
- package/dist/standalone/chunk-6YI4WJO4.js +0 -1
- package/dist/standalone/chunk-A74VSSA2.js +0 -4
- package/dist/standalone/chunk-CT5MMH4O.js +0 -1
- package/dist/standalone/chunk-GB6U2BPU.js +0 -1
- package/dist/standalone/chunk-GEDMLM4A.js +0 -6
- package/dist/standalone/chunk-S252DAFP.js +0 -1
- package/dist/standalone/chunk-XS5LDR52.js +0 -1
- package/dist/standalone/chunk-YJYTMQJI.js +0 -1
- package/dist/standalone/chunk-Z2V42P7J.js +0 -1
- /package/dist/standalone/{chunk-SKHEGARW.js → chunk-XF2B7P5A.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useLunora as Q}from"@lunora/react";import{useState as m,useEffect as te}from"react";import{u as W}from"../packem_shared/button-BkCrNcAs.js";import{c as J,u as L}from"../packem_shared/card-CIDGUN6K.js";import{E as M}from"../packem_shared/empty-state-Cg7t_8qu.js";import{u as ae}from"../packem_shared/input-JHu63lTv.js";import{n as U,d as _,m as x,p as i,f as q,u as d}from"../packem_shared/table-DdJBrClo.js";import{l as re}from"../packem_shared/textarea-Bu2-jKAs.js";import{N as ne}from"../packem_shared/use-admin-query-QJ-ibl5u.js";import{useT as V}from"../packem_shared/DEFAULT_LOCALE-BZ4NojpD.js";import{ADMIN_FUNCTIONS as B}from"../packem_shared/ADMIN_FUNCTIONS-BnD4aovm.js";import{f as A,b as E,d as H,g as X}from"../packem_shared/internal-BSIsQVC6.js";import{jsxs as s,jsx as e}from"react/jsx-runtime";const se=["queued","running","paused","waiting","complete","errored","terminated"],oe=["pause","resume","terminate"],le="WORKFLOWS_NOT_CONFIGURED",ie=o=>typeof o=="object"&&o!==null&&o.code===le,de=o=>{const r=o.error??o.output;if(r===void 0)return"—";try{return JSON.stringify(r)}catch{return"(unserializable)"}},ce=({loadDetail:o,loadInstances:r,readOnly:N,runAction:T,workflowName:g})=>{const I=Q(),n=V(),[h,k]=m(null),[S,$]=m(null),[v,j]=m(""),[b,f]=m(null),[F,C]=m(!1),[R,z]=m(null),p=o??(a=>I.getWorkflowInstance(a)),w=N?void 0:T??(r===void 0?a=>I.setWorkflowInstanceStatus(a):void 0),O=async()=>{f(null),C(!1);const a=v===""?void 0:v;try{if(r===void 0){const l=await I.listWorkflowInstances({name:g,status:a});if(l.configured===!1){k(null),C(!0);return}k(l.instances);return}k(await r({name:g,status:a}))}catch(l){k(null),ie(l)?C(!0):f(E(l))}};te(()=>{$(null),A(O())},[g,v]);const D=async a=>{f(null);try{$(await p({id:a,name:g}))}catch(l){f(E(l))}},K=async(a,l)=>{if(w!==void 0){z(a),f(null);try{await w({action:l,id:a,name:g}),await O()}catch(P){f(E(P))}z(null)}};return s("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[s("div",{className:"flex items-center justify-between gap-2",children:[e("h3",{className:"text-sm font-medium",children:n("Instance history")}),s("select",{"aria-label":n("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:a=>{j(a.target.value)},value:v,children:[e("option",{value:"",children:n("All statuses")}),se.map(a=>e("option",{value:a,children:a},a))]})]}),b!==null&&e("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:b}),F&&e(M,{description:n("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:n("Workflow inspection not configured")}),!F&&h!==null&&h.length===0&&e(M,{description:n("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:n("No instances")}),h!==null&&h.length>0&&e(J,{className:"overflow-hidden py-0",children:e(L,{className:"px-0",children:s(U,{"data-testid":"workflow-instances-table",children:[e(_,{children:s(x,{children:[e(i,{children:n("Instance id")}),e(i,{children:n("Status")}),e(i,{children:n("Created")}),e(i,{children:n("Ended")}),e(i,{"aria-label":n("Actions")})]})}),e(q,{children:h.map(a=>s(x,{"data-testid":`workflow-instance-${a.id}`,children:[e(d,{className:"font-mono text-xs",children:a.id}),e(d,{className:"font-mono text-xs",children:a.status}),e(d,{className:"text-muted-foreground tabular-nums",children:a.createdOn??"—"}),e(d,{className:"text-muted-foreground tabular-nums",children:a.endedOn??"—"}),e(d,{className:"text-right",children:s("div",{className:"flex justify-end gap-1.5",children:[e(W,{"data-testid":`workflow-instance-steps-${a.id}`,onClick:()=>{A(D(a.id))},size:"sm",type:"button",variant:"outline",children:n("Steps")}),w!==void 0&&oe.map(l=>e(W,{"data-testid":`workflow-instance-${l}-${a.id}`,disabled:R===a.id,onClick:()=>{A(K(a.id,l))},size:"sm",type:"button",variant:"ghost",children:n(l)},l))]})})]},a.id))})]})})}),S!==null&&e(J,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:s(L,{className:"flex flex-col gap-2 px-4 py-3",children:[s("div",{className:"flex items-center justify-between",children:[s("span",{className:"font-mono text-xs",children:[n("Steps")," · ",S.id]}),e(W,{"data-testid":"workflow-instance-detail-close",onClick:()=>{$(null)},size:"xs",type:"button",variant:"ghost",children:n("Close")})]}),S.steps.length===0?e("p",{className:"text-xs text-muted-foreground",children:n("This instance has no recorded steps yet.")}):s(U,{"data-testid":"workflow-instance-steps",children:[e(_,{children:s(x,{children:[e(i,{children:n("Step")}),e(i,{children:n("Type")}),e(i,{children:n("Attempts")}),e(i,{children:n("Started")}),e(i,{children:n("Output")})]})}),e(q,{children:S.steps.map((a,l)=>s(x,{"data-testid":`workflow-step-${String(l)}`,children:[e(d,{className:"font-mono text-xs",children:a.name}),e(d,{className:"text-xs text-muted-foreground",children:a.type??"—"}),e(d,{className:"tabular-nums",children:a.attempts??"—"}),e(d,{className:"text-muted-foreground tabular-nums",children:a.start??"—"}),e(d,{className:"font-mono text-xs text-muted-foreground",children:de(a)})]},`${a.name}:${String(l)}`))})]})]})})]})},me=X(B.createWorkflowInstance),ue=X(B.getWorkflowInstanceStatus),fe=o=>{if(o.error)return`${o.error.name}: ${o.error.message}`;if(o.output===void 0)return"—";try{return JSON.stringify(o.output)}catch{return"(unserializable)"}},he=(o,r)=>o.some(N=>N.exportName===r)?r:o[0]?.exportName??"",Oe=()=>{const o=Q(),r=V(),{data:N,error:T}=ne(B.listWorkflows,{}),[g,I]=m(""),[n,h]=m(""),[k,S]=m(""),[$,v]=m(!1),[j,b]=m(null),[f,F]=m([]),[C,R]=m(null),z=N!==void 0,p=Array.isArray(N?.workflows)?[...N.workflows].toSorted((t,u)=>t.exportName.localeCompare(u.exportName)):[],w=he(p,g),O=p.find(t=>t.exportName===w),D=t=>{F(u=>{const c=u.filter(y=>!(y.exportName===t.exportName&&y.id===t.id));return[t,...c]})},K=async()=>{const t=w;if(t==="")return;let u;const c=k.trim();if(c!=="")try{u=JSON.parse(c)}catch{b(r("Params must be valid JSON"));return}v(!0),b(null);try{const y=n.trim(),G=await o.query(me,{exportName:t,id:y===""?void 0:y,params:u},H(""));D({exportName:t,id:G.id,status:G.status}),h("")}catch(y){b(E(y))}v(!1)},a=()=>{A(K())},l=async(t,u)=>{R(u);try{const c=await o.query(ue,{exportName:t,id:u},H(""));D({error:c.error,exportName:t,id:c.id,output:c.output,status:c.status})}catch(c){b(E(c))}R(null)},P=t=>{I(t.target.value)},Y=t=>{h(t.target.value)},Z=t=>{S(t.target.value)},ee=t=>{const{export:u,id:c}=t.currentTarget.dataset;u!==void 0&&c!==void 0&&A(l(u,c))};return s("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[T!==null&&e("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:T}),e("p",{className:"text-sm text-muted-foreground",children:r("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")}),z&&p.length===0?e(M,{description:r("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:r("No workflows defined")}):e(J,{className:"overflow-hidden py-0",children:e(L,{className:"px-0",children:s(U,{"data-testid":"workflows-table",children:[e(_,{children:s(x,{children:[e(i,{children:r("Export")}),e(i,{children:r("Name")}),e(i,{children:r("Class")}),e(i,{children:r("Binding")})]})}),e(q,{children:p.map(t=>s(x,{"data-testid":`workflows-row-${t.exportName}`,children:[e(d,{className:"font-mono text-xs",children:t.exportName}),e(d,{className:"font-mono text-xs text-muted-foreground",children:t.name}),e(d,{className:"font-mono text-xs text-muted-foreground",children:t.className}),e(d,{className:"font-mono text-xs text-muted-foreground",children:t.binding})]},t.exportName))})]})})}),p.length>0&&s("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[e("h3",{className:"text-sm font-medium",children:r("Start instance")}),j!==null&&e("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:j}),s("div",{className:"flex flex-wrap items-center gap-2",children:[e("select",{"aria-label":r("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:P,value:w,children:p.map(t=>e("option",{value:t.exportName,children:t.exportName},t.exportName))}),e(ae,{"aria-label":r("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:Y,placeholder:r("Instance id (optional)"),value:n}),e(W,{"data-testid":"workflows-start-button",disabled:$||w==="",onClick:a,children:r($?"Starting…":"Start instance")})]}),e(re,{"aria-label":r("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:Z,placeholder:r("Params (JSON, optional)"),value:k})]}),f.length>0&&s("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[e("h3",{className:"text-sm font-medium",children:r("Instances")}),e(J,{className:"overflow-hidden py-0",children:e(L,{className:"px-0",children:s(U,{"data-testid":"workflows-instances-table",children:[e(_,{children:s(x,{children:[e(i,{children:r("Workflow")}),e(i,{children:r("Instance id")}),e(i,{children:r("Status")}),e(i,{children:r("Output")}),e(i,{})]})}),e(q,{children:f.map(t=>s(x,{"data-testid":`workflows-instance-${t.id}`,children:[e(d,{className:"font-mono text-xs",children:t.exportName}),e(d,{className:"font-mono text-xs text-muted-foreground",children:t.id}),e(d,{className:"font-mono text-xs",children:t.status}),e(d,{className:"font-mono text-xs text-muted-foreground",children:fe(t)}),e(d,{children:e(W,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:C===t.id,onClick:ee,size:"xs",variant:"outline",children:C===t.id?r("Refreshing…"):r("Refresh")})})]},`${t.exportName}:${t.id}`))})]})})})]}),O!==void 0&&e(ce,{workflowName:O.name})]})};export{Oe as default};
|
|
1
|
+
import{useLunora as Q}from"@lunora/react";import{useState as m,useEffect as te}from"react";import{u as W}from"../packem_shared/button-BkCrNcAs.js";import{c as J,u as L}from"../packem_shared/card-CIDGUN6K.js";import{E as M}from"../packem_shared/empty-state-Cg7t_8qu.js";import{u as ae}from"../packem_shared/input-JHu63lTv.js";import{n as U,d as _,m as x,p as i,f as q,u as d}from"../packem_shared/table-DdJBrClo.js";import{l as re}from"../packem_shared/textarea-Bu2-jKAs.js";import{N as ne}from"../packem_shared/use-admin-query-QJ-ibl5u.js";import{useT as V}from"../packem_shared/DEFAULT_LOCALE-BZ4NojpD.js";import{ADMIN_FUNCTIONS as B}from"../packem_shared/ADMIN_FUNCTIONS-CZESgd10.js";import{f as A,b as E,d as H,g as X}from"../packem_shared/internal-BSIsQVC6.js";import{jsxs as s,jsx as e}from"react/jsx-runtime";const se=["queued","running","paused","waiting","complete","errored","terminated"],oe=["pause","resume","terminate"],le="WORKFLOWS_NOT_CONFIGURED",ie=o=>typeof o=="object"&&o!==null&&o.code===le,de=o=>{const r=o.error??o.output;if(r===void 0)return"—";try{return JSON.stringify(r)}catch{return"(unserializable)"}},ce=({loadDetail:o,loadInstances:r,readOnly:N,runAction:T,workflowName:g})=>{const I=Q(),n=V(),[h,k]=m(null),[S,$]=m(null),[v,j]=m(""),[b,f]=m(null),[F,C]=m(!1),[R,z]=m(null),p=o??(a=>I.getWorkflowInstance(a)),w=N?void 0:T??(r===void 0?a=>I.setWorkflowInstanceStatus(a):void 0),O=async()=>{f(null),C(!1);const a=v===""?void 0:v;try{if(r===void 0){const l=await I.listWorkflowInstances({name:g,status:a});if(l.configured===!1){k(null),C(!0);return}k(l.instances);return}k(await r({name:g,status:a}))}catch(l){k(null),ie(l)?C(!0):f(E(l))}};te(()=>{$(null),A(O())},[g,v]);const D=async a=>{f(null);try{$(await p({id:a,name:g}))}catch(l){f(E(l))}},K=async(a,l)=>{if(w!==void 0){z(a),f(null);try{await w({action:l,id:a,name:g}),await O()}catch(P){f(E(P))}z(null)}};return s("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[s("div",{className:"flex items-center justify-between gap-2",children:[e("h3",{className:"text-sm font-medium",children:n("Instance history")}),s("select",{"aria-label":n("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:a=>{j(a.target.value)},value:v,children:[e("option",{value:"",children:n("All statuses")}),se.map(a=>e("option",{value:a,children:a},a))]})]}),b!==null&&e("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:b}),F&&e(M,{description:n("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:n("Workflow inspection not configured")}),!F&&h!==null&&h.length===0&&e(M,{description:n("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:n("No instances")}),h!==null&&h.length>0&&e(J,{className:"overflow-hidden py-0",children:e(L,{className:"px-0",children:s(U,{"data-testid":"workflow-instances-table",children:[e(_,{children:s(x,{children:[e(i,{children:n("Instance id")}),e(i,{children:n("Status")}),e(i,{children:n("Created")}),e(i,{children:n("Ended")}),e(i,{"aria-label":n("Actions")})]})}),e(q,{children:h.map(a=>s(x,{"data-testid":`workflow-instance-${a.id}`,children:[e(d,{className:"font-mono text-xs",children:a.id}),e(d,{className:"font-mono text-xs",children:a.status}),e(d,{className:"text-muted-foreground tabular-nums",children:a.createdOn??"—"}),e(d,{className:"text-muted-foreground tabular-nums",children:a.endedOn??"—"}),e(d,{className:"text-right",children:s("div",{className:"flex justify-end gap-1.5",children:[e(W,{"data-testid":`workflow-instance-steps-${a.id}`,onClick:()=>{A(D(a.id))},size:"sm",type:"button",variant:"outline",children:n("Steps")}),w!==void 0&&oe.map(l=>e(W,{"data-testid":`workflow-instance-${l}-${a.id}`,disabled:R===a.id,onClick:()=>{A(K(a.id,l))},size:"sm",type:"button",variant:"ghost",children:n(l)},l))]})})]},a.id))})]})})}),S!==null&&e(J,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:s(L,{className:"flex flex-col gap-2 px-4 py-3",children:[s("div",{className:"flex items-center justify-between",children:[s("span",{className:"font-mono text-xs",children:[n("Steps")," · ",S.id]}),e(W,{"data-testid":"workflow-instance-detail-close",onClick:()=>{$(null)},size:"xs",type:"button",variant:"ghost",children:n("Close")})]}),S.steps.length===0?e("p",{className:"text-xs text-muted-foreground",children:n("This instance has no recorded steps yet.")}):s(U,{"data-testid":"workflow-instance-steps",children:[e(_,{children:s(x,{children:[e(i,{children:n("Step")}),e(i,{children:n("Type")}),e(i,{children:n("Attempts")}),e(i,{children:n("Started")}),e(i,{children:n("Output")})]})}),e(q,{children:S.steps.map((a,l)=>s(x,{"data-testid":`workflow-step-${String(l)}`,children:[e(d,{className:"font-mono text-xs",children:a.name}),e(d,{className:"text-xs text-muted-foreground",children:a.type??"—"}),e(d,{className:"tabular-nums",children:a.attempts??"—"}),e(d,{className:"text-muted-foreground tabular-nums",children:a.start??"—"}),e(d,{className:"font-mono text-xs text-muted-foreground",children:de(a)})]},`${a.name}:${String(l)}`))})]})]})})]})},me=X(B.createWorkflowInstance),ue=X(B.getWorkflowInstanceStatus),fe=o=>{if(o.error)return`${o.error.name}: ${o.error.message}`;if(o.output===void 0)return"—";try{return JSON.stringify(o.output)}catch{return"(unserializable)"}},he=(o,r)=>o.some(N=>N.exportName===r)?r:o[0]?.exportName??"",Oe=()=>{const o=Q(),r=V(),{data:N,error:T}=ne(B.listWorkflows,{}),[g,I]=m(""),[n,h]=m(""),[k,S]=m(""),[$,v]=m(!1),[j,b]=m(null),[f,F]=m([]),[C,R]=m(null),z=N!==void 0,p=Array.isArray(N?.workflows)?[...N.workflows].toSorted((t,u)=>t.exportName.localeCompare(u.exportName)):[],w=he(p,g),O=p.find(t=>t.exportName===w),D=t=>{F(u=>{const c=u.filter(y=>!(y.exportName===t.exportName&&y.id===t.id));return[t,...c]})},K=async()=>{const t=w;if(t==="")return;let u;const c=k.trim();if(c!=="")try{u=JSON.parse(c)}catch{b(r("Params must be valid JSON"));return}v(!0),b(null);try{const y=n.trim(),G=await o.query(me,{exportName:t,id:y===""?void 0:y,params:u},H(""));D({exportName:t,id:G.id,status:G.status}),h("")}catch(y){b(E(y))}v(!1)},a=()=>{A(K())},l=async(t,u)=>{R(u);try{const c=await o.query(ue,{exportName:t,id:u},H(""));D({error:c.error,exportName:t,id:c.id,output:c.output,status:c.status})}catch(c){b(E(c))}R(null)},P=t=>{I(t.target.value)},Y=t=>{h(t.target.value)},Z=t=>{S(t.target.value)},ee=t=>{const{export:u,id:c}=t.currentTarget.dataset;u!==void 0&&c!==void 0&&A(l(u,c))};return s("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[T!==null&&e("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:T}),e("p",{className:"text-sm text-muted-foreground",children:r("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")}),z&&p.length===0?e(M,{description:r("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:r("No workflows defined")}):e(J,{className:"overflow-hidden py-0",children:e(L,{className:"px-0",children:s(U,{"data-testid":"workflows-table",children:[e(_,{children:s(x,{children:[e(i,{children:r("Export")}),e(i,{children:r("Name")}),e(i,{children:r("Class")}),e(i,{children:r("Binding")})]})}),e(q,{children:p.map(t=>s(x,{"data-testid":`workflows-row-${t.exportName}`,children:[e(d,{className:"font-mono text-xs",children:t.exportName}),e(d,{className:"font-mono text-xs text-muted-foreground",children:t.name}),e(d,{className:"font-mono text-xs text-muted-foreground",children:t.className}),e(d,{className:"font-mono text-xs text-muted-foreground",children:t.binding})]},t.exportName))})]})})}),p.length>0&&s("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[e("h3",{className:"text-sm font-medium",children:r("Start instance")}),j!==null&&e("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:j}),s("div",{className:"flex flex-wrap items-center gap-2",children:[e("select",{"aria-label":r("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:P,value:w,children:p.map(t=>e("option",{value:t.exportName,children:t.exportName},t.exportName))}),e(ae,{"aria-label":r("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:Y,placeholder:r("Instance id (optional)"),value:n}),e(W,{"data-testid":"workflows-start-button",disabled:$||w==="",onClick:a,children:r($?"Starting…":"Start instance")})]}),e(re,{"aria-label":r("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:Z,placeholder:r("Params (JSON, optional)"),value:k})]}),f.length>0&&s("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[e("h3",{className:"text-sm font-medium",children:r("Instances")}),e(J,{className:"overflow-hidden py-0",children:e(L,{className:"px-0",children:s(U,{"data-testid":"workflows-instances-table",children:[e(_,{children:s(x,{children:[e(i,{children:r("Workflow")}),e(i,{children:r("Instance id")}),e(i,{children:r("Status")}),e(i,{children:r("Output")}),e(i,{})]})}),e(q,{children:f.map(t=>s(x,{"data-testid":`workflows-instance-${t.id}`,children:[e(d,{className:"font-mono text-xs",children:t.exportName}),e(d,{className:"font-mono text-xs text-muted-foreground",children:t.id}),e(d,{className:"font-mono text-xs",children:t.status}),e(d,{className:"font-mono text-xs text-muted-foreground",children:fe(t)}),e(d,{children:e(W,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:C===t.id,onClick:ee,size:"xs",variant:"outline",children:C===t.id?r("Refreshing…"):r("Refresh")})})]},`${t.exportName}:${t.id}`))})]})})})]}),O!==void 0&&e(ce,{workflowName:O.name})]})};export{Oe as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const _="__lunora_admin__:",e={aiAvailable:"__lunora_admin__:aiAvailable",aiChartConfig:"__lunora_admin__:aiChartConfig",aiGenerateSql:"__lunora_admin__:aiGenerateSql",aiTableFilter:"__lunora_admin__:aiTableFilter",assignIssue:"__lunora_admin__:assignIssue",backRelationCounts:"__lunora_admin__:backRelationCounts",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",explainIssue:"__lunora_admin__:explainIssue",exportShard:"__lunora_admin__:exportShard",facetColumn:"__lunora_admin__:facetColumn",getAdvisories:"__lunora_admin__:getAdvisories",getAdvisorProcedures:"__lunora_admin__:getAdvisorProcedures",getAuditLog:"__lunora_admin__:getAuditLog",getAuthAuditLog:"__lunora_admin__:getAuthAuditLog",getAuthMetrics:"__lunora_admin__:getAuthMetrics",getCapturedMail:"__lunora_admin__:getCapturedMail",getFanoutMetrics:"__lunora_admin__:getFanoutMetrics",getFunctionStats:"__lunora_admin__:getFunctionStats",getIssues:"__lunora_admin__:getIssues",lintSql:"__lunora_admin__:lintSql",listFlags:"__lunora_admin__:listFlags",listPushSubscriptions:"__lunora_admin__:listPushSubscriptions",listQueues:"__lunora_admin__:listQueues",listSubscriptions:"__lunora_admin__:listSubscriptions",listTableIndexes:"__lunora_admin__:listTableIndexes",listWorkflows:"__lunora_admin__:listWorkflows",getLogs:"__lunora_admin__:getLogs",getMetricHistory:"__lunora_admin__:getMetricHistory",getMetricSeries:"__lunora_admin__:getMetricSeries",getMetrics:"__lunora_admin__:getMetrics",getPitrBookmark:"__lunora_admin__:getPitrBookmark",getQueryInsights:"__lunora_admin__:getQueryInsights",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",schemaHistory:"__lunora_admin__:schemaHistory",schemaVersion:"__lunora_admin__:schemaVersion",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{e as ADMIN_FUNCTIONS,_ as ADMIN_FUNCTION_PREFIX};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as E}from"react/compiler-runtime";import{useLunora as Y}from"@lunora/react";import{useState as M,useEffect as Z}from"react";import{u as Q}from"./button-BkCrNcAs.js";import{E as z}from"./empty-state-Cg7t_8qu.js";import{useT as L}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{ADMIN_FUNCTIONS as B}from"./ADMIN_FUNCTIONS-
|
|
1
|
+
import{c as E}from"react/compiler-runtime";import{useLunora as Y}from"@lunora/react";import{useState as M,useEffect as Z}from"react";import{u as Q}from"./button-BkCrNcAs.js";import{E as z}from"./empty-state-Cg7t_8qu.js";import{useT as L}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{ADMIN_FUNCTIONS as B}from"./ADMIN_FUNCTIONS-CZESgd10.js";import{c as ee,d as te,g as ae}from"./internal-BSIsQVC6.js";import{jsxs as A,jsx as m}from"react/jsx-runtime";const ne=ae(B.listTables),ie=["react","client","cli"],le=!1,oe={action:"action",mutation:"mutation",query:"query"},J=i=>{const e=i.indexOf(":");return e===-1?{file:"",fn:i}:{file:i.slice(0,e),fn:i.slice(e+1)}},U=({file:i,fn:e,kind:l})=>`await client.${oe[l]}(api.${i}.${e}, { /* args */ });`,re=i=>{const e=`api.${i.file}.${i.fn}`;switch(i.kind){case"action":return U(i);case"mutation":return`const ${i.fn} = useMutation(${e});`;default:return`const data = useQuery(${e}, { /* args */ });`}},se=({file:i,fn:e})=>`lunora run ${i}:${e} --args '{ }'`,de=i=>["// Read rows",`const rows = await ctx.db.query("${i}").collect();`,"","// Insert a row",`const id = await ctx.db.insert("${i}", { /* fields */ });`,"","// Generated types",`type Row = Doc<"${i}">;`,`type RowId = Id<"${i}">;`].join(`
|
|
2
2
|
`),ce=(i,e)=>{switch(i){case"cli":return se(e);case"client":return U(e);default:return re(e)}},V=i=>{const e=E(19),{code:l,label:o,testId:a}=i,n=L();let s;e[0]!==l?(s=()=>{ee(l)},e[0]=l,e[1]=s):s=e[1];const u=s;let t;e[2]!==o?(t=m("span",{className:"text-xs font-medium text-muted-foreground",children:o}),e[2]=o,e[3]=t):t=e[3];const c=`${a}-copy`;let r;e[4]!==n?(r=n("Copy"),e[4]=n,e[5]=r):r=e[5];let p;e[6]!==u||e[7]!==c||e[8]!==r?(p=m(Q,{"data-testid":c,onClick:u,size:"xs",type:"button",variant:"ghost",children:r}),e[6]=u,e[7]=c,e[8]=r,e[9]=p):p=e[9];let f;e[10]!==t||e[11]!==p?(f=A("div",{className:"flex items-center justify-between gap-2",children:[t,p]}),e[10]=t,e[11]=p,e[12]=f):f=e[12];let d;e[13]!==l||e[14]!==a?(d=m("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":a,children:l}),e[13]=l,e[14]=a,e[15]=d):d=e[15];let h;return e[16]!==f||e[17]!==d?(h=A("div",{className:"flex flex-col gap-1.5",children:[f,d]}),e[16]=f,e[17]=d,e[18]=h):h=e[18],h},pe=i=>{const e=E(50),{file:l,fn:o,kind:a}=i,n=L(),[s,u]=M("react");let t,c,r;if(e[0]!==l||e[1]!==o||e[2]!==a||e[3]!==n||e[4]!==s){const x={file:l,fn:o,kind:a};let I;e[8]!==n?(I=n("CLI"),e[8]=n,e[9]=I):I=e[9];let C;e[10]!==n?(C=n("Client"),e[10]=n,e[11]=C):C=e[11];let T;e[12]!==n?(T=n("React"),e[12]=n,e[13]=T):T=e[13];let _;e[14]!==I||e[15]!==C||e[16]!==T?(_={cli:I,client:C,react:T},e[14]=I,e[15]=C,e[16]=T,e[17]=_):_=e[17],r=_;let D;e[18]===Symbol.for("react.memo_cache_sentinel")?(D=P=>{u(P.currentTarget.dataset.tab)},e[18]=D):D=e[18],t=D,c=ce(s,x),e[0]=l,e[1]=o,e[2]=a,e[3]=n,e[4]=s,e[5]=t,e[6]=c,e[7]=r}else t=e[5],c=e[6],r=e[7];const p=c,f=a==="action"&&s==="react"&&!le,d=`api.${l}.${o}`;let h;e[19]!==d?(h=m("h2",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"api-fn-title",children:d}),e[19]=d,e[20]=h):h=e[20];let b;e[21]!==a||e[22]!==n?(b=n("Call this {kind} from your app.",{kind:a}),e[21]=a,e[22]=n,e[23]=b):b=e[23];let v;e[24]!==b?(v=m("p",{className:"text-xs text-muted-foreground",children:b}),e[24]=b,e[25]=v):v=e[25];let y;e[26]!==h||e[27]!==v?(y=A("div",{children:[h,v]}),e[26]=h,e[27]=v,e[28]=y):y=e[28];let k;e[29]!==n?(k=n("Snippet flavour"),e[29]=n,e[30]=k):k=e[30];let $;e[31]!==t||e[32]!==s||e[33]!==r?($=ie.map(x=>m(Q,{"aria-selected":s===x,"data-tab":x,"data-testid":`api-tab-${x}`,onClick:t,role:"tab",size:"xs",type:"button",variant:s===x?"default":"outline",children:r[x]},x)),e[31]=t,e[32]=s,e[33]=r,e[34]=$):$=e[34];let N;e[35]!==k||e[36]!==$?(N=m("div",{"aria-label":k,className:"flex gap-1.5","data-testid":"api-tabs",role:"tablist",children:$}),e[35]=k,e[36]=$,e[37]=N):N=e[37];const O=r[s],j=`api-snippet-${s}`;let w;e[38]!==p||e[39]!==O||e[40]!==j?(w=m(V,{code:p,label:O,testId:j}),e[38]=p,e[39]=O,e[40]=j,e[41]=w):w=e[41];let S;e[42]!==f||e[43]!==n?(S=f&&m("p",{className:"text-xs text-muted-foreground","data-testid":"api-action-note",children:n("Actions have no React hook — call them through the client.")}),e[42]=f,e[43]=n,e[44]=S):S=e[44];let R;return e[45]!==w||e[46]!==S||e[47]!==y||e[48]!==N?(R=A("div",{className:"flex flex-col gap-3","data-testid":"api-fn-doc",children:[y,N,w,S]}),e[45]=w,e[46]=S,e[47]=y,e[48]=N,e[49]=R):R=e[49],R},fe=i=>{const e=E(19),{name:l}=i,o=L();let a;e[0]!==l?(a=de(l),e[0]=l,e[1]=a):a=e[1];const n=a;let s;e[2]!==l?(s=m("h2",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"api-table-title",children:l}),e[2]=l,e[3]=s):s=e[3];let u;e[4]!==o?(u=o("Read and write this table through the typed data model."),e[4]=o,e[5]=u):u=e[5];let t;e[6]!==u?(t=m("p",{className:"text-xs text-muted-foreground",children:u}),e[6]=u,e[7]=t):t=e[7];let c;e[8]!==s||e[9]!==t?(c=A("div",{children:[s,t]}),e[8]=s,e[9]=t,e[10]=c):c=e[10];let r;e[11]!==o?(r=o("Data model"),e[11]=o,e[12]=r):r=e[12];let p;e[13]!==n||e[14]!==r?(p=m(V,{code:n,label:r,testId:"api-snippet-table"}),e[13]=n,e[14]=r,e[15]=p):p=e[15];let f;return e[16]!==c||e[17]!==p?(f=A("div",{className:"flex flex-col gap-3","data-testid":"api-table-doc",children:[c,p]}),e[16]=c,e[17]=p,e[18]=f):f=e[18],f},G=i=>{const e=E(8),{active:l,label:o,onSelect:a,testId:n,value:s}=i;let u;e[0]!==a||e[1]!==s?(u=()=>{a(s)},e[0]=a,e[1]=s,e[2]=u):u=e[2];const t=u,c=l?"page":void 0;let r;return e[3]!==o||e[4]!==t||e[5]!==c||e[6]!==n?(r=m("button",{"aria-current":c,className:"w-full truncate rounded-md px-2 py-1 text-start font-mono text-xs text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:bg-sidebar-accent aria-[current=page]:bg-sidebar-accent aria-[current=page]:font-medium aria-[current=page]:text-foreground","data-testid":n,onClick:t,type:"button",children:o}),e[3]=o,e[4]=t,e[5]=c,e[6]=n,e[7]=r):r=e[7],r},me=i=>{const e=new Map;for(const l of i){const{file:o,fn:a}=J(l.path),n=e.get(o)??[];n.push({fn:a,kind:l.kind,path:l.path}),e.set(o,n)}return[...e.entries()].map(([l,o])=>({file:l,items:o.toSorted((a,n)=>a.fn.localeCompare(n.fn))})).toSorted((l,o)=>l.file.localeCompare(o.file))},Se=i=>{const e=E(58),{functions:l,initialShardKey:o}=i,a=L(),n=Y(),[s,u]=M(null),[t,c]=M(null);let r,p;e[0]!==n||e[1]!==o?(r=()=>{let _=!1;return n.query(ne,{},te(o??"")).then(D=>(_||u(D),D)).catch(()=>{_||u([])}),()=>{_=!0}},p=[n,o],e[0]=n,e[1]=o,e[2]=r,e[3]=p):(r=e[2],p=e[3]),Z(r,p);let f,d,h,b,v,y,k,$,N,O;if(e[4]!==l||e[5]!==t||e[6]!==a||e[7]!==s){const _=l??[],D=me(_),P=(s??[]).map(ue).toSorted(he);let F;e[18]===Symbol.for("react.memo_cache_sentinel")?(F=g=>{c({kind:"fn",path:g})},e[18]=F):F=e[18];const W=F;let H;e[19]===Symbol.for("react.memo_cache_sentinel")?(H=g=>{c({kind:"table",name:g})},e[19]=H):H=e[19];const X=H;d=t?.kind==="fn"?_.find(g=>g.path===t.path):void 0,f=_.length>0||P.length>0,h=d===void 0?void 0:J(d.path),N="grid min-h-0 gap-6 md:grid-cols-[16rem_minmax(0,1fr)]",O="lunora-api-docs",e[20]!==a?(b=a("API resources"),e[20]=a,e[21]=b):b=e[21],v="flex flex-col gap-4 overflow-y-auto",y="api-rail";let K;e[22]!==t||e[23]!==a?(K=g=>A("div",{className:"flex flex-col gap-1",children:[m("span",{className:"px-2 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:g.file||a("(root)")}),g.items.map(q=>m(G,{active:t?.kind==="fn"&&t.path===q.path,label:q.fn,onSelect:W,testId:`api-rail-fn-${q.path}`,value:q.path},q.path))]},g.file),e[22]=t,e[23]=a,e[24]=K):K=e[24],k=D.map(K),$=P.length>0&&A("div",{className:"flex flex-col gap-1",children:[m("span",{className:"px-2 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Tables")}),P.map(g=>m(G,{active:t?.kind==="table"&&t.name===g,label:g,onSelect:X,testId:`api-rail-table-${g}`,value:g},g))]}),e[4]=l,e[5]=t,e[6]=a,e[7]=s,e[8]=f,e[9]=d,e[10]=h,e[11]=b,e[12]=v,e[13]=y,e[14]=k,e[15]=$,e[16]=N,e[17]=O}else f=e[8],d=e[9],h=e[10],b=e[11],v=e[12],y=e[13],k=e[14],$=e[15],N=e[16],O=e[17];let j;e[25]!==f||e[26]!==a?(j=!f&&m("p",{className:"px-2 text-xs text-muted-foreground","data-testid":"api-rail-empty",children:a("No functions or tables to document yet.")}),e[25]=f,e[26]=a,e[27]=j):j=e[27];let w;e[28]!==j||e[29]!==b||e[30]!==v||e[31]!==y||e[32]!==k||e[33]!==$?(w=A("nav",{"aria-label":b,className:v,"data-testid":y,children:[k,$,j]}),e[28]=j,e[29]=b,e[30]=v,e[31]=y,e[32]=k,e[33]=$,e[34]=w):w=e[34];let S;e[35]!==t||e[36]!==a?(S=t===null&&m(z,{description:a("Select a function or table to see how to call it from your app."),testId:"api-empty",title:a("API usage snippets")}),e[35]=t,e[36]=a,e[37]=S):S=e[37];let R;e[38]!==t?.kind||e[39]!==d||e[40]!==h?(R=t?.kind==="fn"&&d!==void 0&&h!==void 0&&m(pe,{file:h.file,fn:h.fn,kind:d.kind},d.path),e[38]=t?.kind,e[39]=d,e[40]=h,e[41]=R):R=e[41];let x;e[42]!==t?.kind||e[43]!==d||e[44]!==a?(x=t?.kind==="fn"&&d===void 0&&m(z,{testId:"api-empty",title:a("API usage snippets")}),e[42]=t?.kind,e[43]=d,e[44]=a,e[45]=x):x=e[45];let I;e[46]!==t?(I=t?.kind==="table"&&m(fe,{name:t.name}),e[46]=t,e[47]=I):I=e[47];let C;e[48]!==S||e[49]!==R||e[50]!==x||e[51]!==I?(C=A("div",{className:"min-w-0",children:[S,R,x,I]}),e[48]=S,e[49]=R,e[50]=x,e[51]=I,e[52]=C):C=e[52];let T;return e[53]!==w||e[54]!==C||e[55]!==N||e[56]!==O?(T=A("div",{className:N,"data-testid":O,children:[w,C]}),e[53]=w,e[54]=C,e[55]=N,e[56]=O,e[57]=T):T=e[57],T};function ue(i){return i.name}function he(i,e){return i.localeCompare(e)}export{le as REACT_HAS_ACTION_HOOK,se as buildCliSnippet,U as buildClientSnippet,re as buildReactSnippet,de as buildTableSnippet,Se as default,J as splitPath};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as j}from"react/compiler-runtime";import{useLunora as Ke}from"@lunora/react";import{useState as D,useMemo as et,useRef as De,useCallback as tt,useEffect as $e}from"react";import{ShardInput as Zt}from"./ShardInput-BVn2iCU0.js";import{N as je}from"./use-admin-query-QJ-ibl5u.js";import{ADMIN_FUNCTIONS as Y}from"./ADMIN_FUNCTIONS-CZESgd10.js";import{b as wt}from"./browser-storage-xjTyMKY0.js";import{h as Pe,f as oe,d as de,g as he,i as Xt}from"./internal-BSIsQVC6.js";import{k as Yt}from"./use-sql-assistant-BLG9unQN.js";import{ConfirmButton as nt}from"./ConfirmButton-CTL3f3kr.js";import{E as en}from"./empty-state-Cg7t_8qu.js";import{useT as ce}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{useReactTable as tn,getSortedRowModel as nn,getCoreRowModel as on,flexRender as ln}from"@tanstack/react-table";import{useVirtualizer as rn}from"@tanstack/react-virtual";import{f as at}from"./checkbox-StT4Gob6.js";import{c as qe}from"./utils-bhneXptQ.js";import{l as an}from"./virtual-rect-1o1veP7R.js";import{g as Ze,k as sn,v as dn}from"./data-grid-DcxyIXwG.js";import{jsx as u,jsxs as R,Fragment as Je}from"react/jsx-runtime";import{DataFilters as cn,toFilterClauses as Me}from"./DataFilters-B26ZeqBZ.js";import{r as un,i as mn}from"./grid-features-jnrD0SpX.js";import{_ as gn,i as ke,u as bn,a as fn,$ as pn}from"./table-list-sidebar-BRv3hTLX.js";import{M as yt}from"./modal-shell-CUwwWC2o.js";import ct from"./useDebounced-Ihdiid_k.js";import{r as hn,l as xn}from"./shard-history-DMEW5VBE.js";const ut=(l,e)=>{const n=[];for(const[o,t]of Object.entries(e))for(const r of t)r.ref===l&&n.push({column:r.name,table:o});return n.sort((o,t)=>o.table.localeCompare(t.table)||o.column.localeCompare(t.column)),n},st=l=>`${l.table}.${l.column}`,vn=/([a-z\d])([A-Z])/gu,wn=/[\s_-]+/u,yn=new Set(["access_token","api_key","apikey","card_number","client_secret","credit_card","cvv","passwd","password","private_key","pwd","refresh_token","secret","ssn","token"]),Sn=l=>{const e=l.replaceAll(vn,"$1 $2").split(wn).map(o=>o.toLowerCase()).filter(o=>o.length>0),n=new Set(e);for(let o=0;o<e.length-1;o+=1){const t=e[o],r=e[o+1];t===void 0||r===void 0||(n.add(`${t}${r}`),n.add(`${t}_${r}`))}return[...n]},mt="•••",Nn=l=>{let e=2166136261;for(let n=0;n<l.length;n+=1)e^=l.codePointAt(n)??0,e=Math.imul(e,16777619);return(e>>>0).toString(16).padStart(8,"0")},St=(l,e)=>{try{return e==="redact"?null:e==="hash"?l==null?l:Nn(typeof l=="string"?l:JSON.stringify(l)):mt}catch{return mt}},Cn=(l,e)=>{const n=new Map;for(const o of l)o.table===e&&n.set(o.column,o.strategy);return n},kn=l=>{for(const e of Sn(l))if(yn.has(e))return!0;return!1},$n=(l,e)=>{const n=e.filter(t=>!l.has(t)&&kn(t));if(n.length===0)return l;const o=new Map(l);for(const t of n)o.set(t,"redact");return o},Tn=(l,e,n)=>{if(!n.enabled)return l;const o=n.columns.get(e);return o===void 0?l:St(l,o)},gt=(l,e)=>!e.enabled||e.columns.size===0?l:l.map(n=>{const o={...n};for(const[t,r]of e.columns)t in o&&(o[t]=St(o[t],r));return o}),_n=(l,e,n,o,t=300)=>{if(o<=0)return{ids:new Set(l.map(c=>c.id)),leadPx:0,tailPx:0};const r=n-t,i=n+o+t,a=new Set;let d=0,s=0,g=0;for(const c of l){const m=c.getSize(),f=e.has(c.id),b=d+m>r&&d<i;f||b?a.add(c.id):d<r?s+=m:g+=m,d+=m}return{ids:a,leadPx:s,tailPx:g}},En=(l,e)=>{const n=new Map;let o=0;for(const t of l)e.has(t.id)&&(n.set(t.id,o),o+=t.getSize());return n},Rn=()=>{const l=j(11);let e;l[0]===Symbol.for("react.memo_cache_sentinel")?(e={},l[0]=e):e=l[0];const[n,o]=D(e);let t;l[1]===Symbol.for("react.memo_cache_sentinel")?(t=(f,b,p)=>{o(w=>({...w,[f]:{...w[f],[b]:p}}))},l[1]=t):t=l[1];const r=t;let i;l[2]===Symbol.for("react.memo_cache_sentinel")?(i=()=>{o({})},l[2]=i):i=l[2];const a=i;let d;l[3]!==n?(d=(f,b)=>{const p=n[f];return p!==void 0&&b in p?{value:p[b]}:void 0},l[3]=n,l[4]=d):d=l[4];const s=d;let g;l[5]!==n?(g=Object.values(n).reduce(Dn,0),l[5]=n,l[6]=g):g=l[6];const c=g;let m;return l[7]!==c||l[8]!==n||l[9]!==s?(m={clear:a,count:c,stage:r,staged:n,stagedValue:s},l[7]=c,l[8]=n,l[9]=s,l[10]=m):m=l[10],m},Mn=(l,e)=>{if(typeof e=="number"){const n=Number(l);return l.trim()===""||Number.isNaN(n)?l:n}if(typeof e=="boolean"){if(l==="true")return!0;if(l==="false")return!1}return l},Pn=l=>{const e=j(29),{changes:n,committing:o,onCommit:t,onDiscard:r}=l,i=ce();let a;e[0]!==n.length||e[1]!==i?(a=i("{count} pending changes",{count:n.length}),e[0]=n.length,e[1]=i,e[2]=a):a=e[2];let d;e[3]!==a?(d=u("span",{className:"font-mono text-[11px] tracking-wide uppercase text-warning","data-testid":"db-staged-count",children:a}),e[3]=a,e[4]=d):d=e[4];let s;e[5]!==o||e[6]!==i?(s=i(o?"Committing…":"Commit"),e[5]=o,e[6]=i,e[7]=s):s=e[7];let g;e[8]!==o||e[9]!==t||e[10]!==s?(g=u("button",{className:"ms-auto rounded-md bg-primary px-2.5 py-1 text-xs font-medium text-primary-foreground outline-none transition-colors hover:bg-primary/90 focus-visible:bg-primary/90 disabled:pointer-events-none disabled:opacity-50","data-testid":"db-staged-commit",disabled:o,onClick:t,type:"button",children:s}),e[8]=o,e[9]=t,e[10]=s,e[11]=g):g=e[11];let c;e[12]!==i?(c=i("Discard"),e[12]=i,e[13]=c):c=e[13];let m;e[14]!==o||e[15]!==r||e[16]!==c?(m=u("button",{className:"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","data-testid":"db-staged-discard",disabled:o,onClick:r,type:"button",children:c}),e[14]=o,e[15]=r,e[16]=c,e[17]=m):m=e[17];let f;e[18]!==d||e[19]!==g||e[20]!==m?(f=R("div",{className:"flex flex-wrap items-center gap-2",children:[d,g,m]}),e[18]=d,e[19]=g,e[20]=m,e[21]=f):f=e[21];let b;e[22]!==n?(b=n.map(In),e[22]=n,e[23]=b):b=e[23];let p;e[24]!==b?(p=u("ul",{className:"flex flex-col gap-1","data-testid":"db-staged-list",children:b}),e[24]=b,e[25]=p):p=e[25];let w;return e[26]!==f||e[27]!==p?(w=R("div",{className:"flex flex-col gap-2 border border-warning/40 bg-warning/5 p-3","data-testid":"db-staged",children:[f,p]}),e[26]=f,e[27]=p,e[28]=w):w=e[28],w};function Dn(l,e){return l+Object.keys(e).length}function In(l){return R("li",{className:"flex flex-wrap items-center gap-2 font-mono text-xs",children:[R("span",{className:"text-muted-foreground",children:[l.rowId,".",l.column]}),u("span",{className:"text-destructive line-through",children:Pe(l.oldValue)}),u("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"→"}),u("span",{className:"text-foreground",children:Pe(l.newValue)})]},`${l.rowId}:${l.column}`)}const bt=400,On=36,Fn={flex:"1 1 0%",minHeight:0,overflow:"auto",position:"relative"},zn={width:"100%"},jn={alignItems:"center",display:"flex",left:0,position:"absolute",top:0,width:"100%"},An={display:"flex",width:"100%"},ft={flex:"0 0 8.5rem",padding:"0.375rem 0.75rem"},Ln="2.5rem",Nt={alignItems:"center",display:"flex",flex:"0 0 2.5rem",justifyContent:"center",left:0,padding:"0.375rem 0",position:"sticky",zIndex:2},it=l=>({flex:"0 0 auto",overflow:"hidden",padding:"0.375rem 0.75rem",position:"relative",textOverflow:"ellipsis",whiteSpace:"nowrap",width:`${l.toString()}px`}),Ct=(l,e)=>({...it(l),left:`calc(${Ln} + ${e.toString()}px)`,position:"sticky",zIndex:2}),pt="rounded-md px-2 py-0.5 text-xs font-medium text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50",Bn=(l,e,n)=>e.enabled&&e.columns.has(n)?void 0:l,ot="__back__:",Vn=l=>`${ot}${l.table}.${l.column}`,qn=l=>{const e=j(3),{counts:n,rowId:o}=l;if(n===void 0){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=u("span",{className:"text-muted-foreground/50",children:"—"}),e[0]=i):i=e[0],i}const t=n[o]??0;let r;return e[1]!==t?(r=u("span",{className:"tabular-nums",children:t}),e[1]=t,e[2]=r):r=e[2],r},ve=l=>{for(const e of["id","__id__","_id"]){const n=l[e];if(typeof n=="string"||typeof n=="number")return String(n)}return null},kt=(l,e)=>ve(l)??`row-${e.toString()}`,Jn=8,Kn=l=>{const e=j(16),{anchor:n,state:o}=l,t=ce();let r;e[0]!==n.left||e[1]!==n.top?(r={left:n.left,position:"fixed",top:n.top,zIndex:50},e[0]=n.left,e[1]=n.top,e[2]=r):r=e[2];const i=r;let a;if(o==="loading"){let s;e[3]!==t?(s=t("Loading…"),e[3]=t,e[4]=s):s=e[4];let g;e[5]!==s?(g=u("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:s}),e[5]=s,e[6]=g):g=e[6],a=g}else if(o.row===null){let s;e[7]!==t?(s=t("No matching row."),e[7]=t,e[8]=s):s=e[8];let g;e[9]!==s?(g=u("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:s}),e[9]=s,e[10]=g):g=e[10],a=g}else{let s;if(e[11]!==o.row){const g=Object.entries(o.row).slice(0,Jn);s=u("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 px-3 py-2",children:g.map(oo)}),e[11]=o.row,e[12]=s}else s=e[12];a=s}let d;return e[13]!==a||e[14]!==i?(d=u("div",{className:"pointer-events-none w-72 overflow-hidden rounded-md border border-border bg-popover text-popover-foreground","data-testid":"db-ref-preview",role:"tooltip",style:i,children:a}),e[13]=a,e[14]=i,e[15]=d):d=e[15],d},Gn=l=>{const e=j(22),{column:n,id:o,onNavigate:t,onPreview:r,target:i}=l,[a,d]=D(null),[s,g]=D("idle");let c;e[0]!==o||e[1]!==t||e[2]!==i?(c=()=>{t(i,o)},e[0]=o,e[1]=t,e[2]=i,e[3]=c):c=e[3];const m=c;let f;e[4]!==o||e[5]!==r||e[6]!==s||e[7]!==i?(f=P=>{const x=P.currentTarget.getBoundingClientRect();d({left:x.left,top:x.bottom+4}),s==="idle"&&(g("loading"),oe((async()=>{try{g({row:await r(i,o)})}catch{g({row:null})}})()))},e[4]=o,e[5]=r,e[6]=s,e[7]=i,e[8]=f):f=e[8];const b=f;let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{d(null)},e[9]=p):p=e[9];const w=p,v=`db-ref-${n}`,h=`Open ${i} ${o}`;let y;e[10]!==o||e[11]!==m||e[12]!==b||e[13]!==v||e[14]!==h?(y=R("button",{"data-testid":v,onBlur:w,onClick:m,onFocus:b,onMouseEnter:b,onMouseLeave:w,title:h,type:"button",children:[o," ↗"]}),e[10]=o,e[11]=m,e[12]=b,e[13]=v,e[14]=h,e[15]=y):y=e[15];let C;e[16]!==a||e[17]!==s?(C=a!==null&&s!=="idle"&&u(Kn,{anchor:a,state:s}),e[16]=a,e[17]=s,e[18]=C):C=e[18];let N;return e[19]!==y||e[20]!==C?(N=R(Je,{children:[y,C]}),e[19]=y,e[20]=C,e[21]=N):N=e[21],N},Hn=l=>l==="asc"?" ▲":l==="desc"?" ▼":"",Qn="absolute end-1 top-1/2 hidden -translate-y-1/2 items-center justify-center rounded text-muted-foreground outline-none group-hover/cell:flex hover:text-foreground focus-visible:flex",ht=l=>{const e=j(8),{column:n,onExpand:o,value:t}=l;let r;e[0]!==n||e[1]!==o||e[2]!==t?(r=()=>{o(n,t)},e[0]=n,e[1]=o,e[2]=t,e[3]=r):r=e[3];const i=r,a=`db-expand-${n}`;let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=u("svg",{"aria-hidden":"true",className:"size-3",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:u("path",{d:"M9 21H5a2 2 0 0 1-2-2v-4m18 0v4a2 2 0 0 1-2 2h-4M3 9V5a2 2 0 0 1 2-2h4m6 0h4a2 2 0 0 1 2 2v4"})}),e[4]=d):d=e[4];let s;return e[5]!==i||e[6]!==a?(s=u("button",{"aria-label":"Expand cell",className:Qn,"data-testid":a,onClick:i,type:"button",children:d}),e[5]=i,e[6]=a,e[7]=s):s=e[7],s},Wn=l=>{const e=j(15),{column:n,initial:o,onCancel:t,onCommit:r,recordId:i}=l,a=De(null);let d,s;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{a.current?.select()},s=[],e[0]=d,e[1]=s):(d=e[0],s=e[1]),$e(d,s);let g;e[2]!==t||e[3]!==r?(g=v=>{v.key==="Enter"?(v.preventDefault(),r(v.currentTarget.value)):v.key==="Escape"&&(v.preventDefault(),t())},e[2]=t,e[3]=r,e[4]=g):g=e[4];const c=g;let m;e[5]!==r?(m=v=>{r(v.currentTarget.value)},e[5]=r,e[6]=m):m=e[6];const f=m,b=`db-cell-input-${i}-${n}`;let p;e[7]!==o?(p=Pe(o),e[7]=o,e[8]=p):p=e[8];let w;return e[9]!==n||e[10]!==f||e[11]!==c||e[12]!==b||e[13]!==p?(w=u("input",{"aria-label":n,className:"w-full rounded border border-ring bg-background px-1 py-0.5 font-mono text-xs outline-none","data-testid":b,defaultValue:p,onBlur:f,onKeyDown:c,ref:a}),e[9]=n,e[10]=f,e[11]=c,e[12]=b,e[13]=p,e[14]=w):w=e[14],w},Un=l=>{const e=j(68),{cell:n,edit:o,highlight:t,mask:r,refs:i}=l,a=n.column.id;let d,s,g,c;if(e[0]!==n||e[1]!==a||e[2]!==o||e[3]!==r||e[4]!==i.columns||e[5]!==i.onNavigate||e[6]!==i.onPreview){c=Symbol.for("react.early_return_sentinel");e:{s=n.getValue(),d=ve(n.row.original);const $=i.columns?.[a];if(r.enabled&&r.columns.has(a)){const T=`db-masked-${a}`,M=u(Ze,{value:Tn(s,a,r)});let _;e[11]!==T||e[12]!==M?(_=u("span",{className:"text-muted-foreground italic","data-testid":T,title:"Masked (preview)",children:M}),e[11]=T,e[12]=M,e[13]=_):_=e[13],c=_;break e}if($!==void 0&&(typeof s=="string"||typeof s=="number")&&String(s)!==""){const T=String(s),M=`${$}:${String(s)}`;let _;e[14]!==a||e[15]!==i.onNavigate||e[16]!==i.onPreview||e[17]!==T||e[18]!==M||e[19]!==$?(_=u(Gn,{column:a,id:T,onNavigate:i.onNavigate,onPreview:i.onPreview,target:$},M),e[14]=a,e[15]=i.onNavigate,e[16]=i.onPreview,e[17]=T,e[18]=M,e[19]=$,e[20]=_):_=e[20],c=_;break e}if(d===null){let T;e[21]!==s?(T=u(Ze,{value:s}),e[21]=s,e[22]=T):T=e[22];let M;e[23]!==a||e[24]!==o.onExpandCell||e[25]!==s?(M=u(ht,{column:a,onExpand:o.onExpandCell,value:s}),e[23]=a,e[24]=o.onExpandCell,e[25]=s,e[26]=M):M=e[26];let _;e[27]!==T||e[28]!==M?(_=R(Je,{children:[T,M]}),e[27]=T,e[28]=M,e[29]=_):_=e[29],c=_;break e}g=o.stagedValue(d,a)}e[0]=n,e[1]=a,e[2]=o,e[3]=r,e[4]=i.columns,e[5]=i.onNavigate,e[6]=i.onPreview,e[7]=d,e[8]=s,e[9]=g,e[10]=c}else d=e[7],s=e[8],g=e[9],c=e[10];if(c!==Symbol.for("react.early_return_sentinel"))return c;const m=g,f=m===void 0?s:m.value;let b;e[30]!==a||e[31]!==o?(b=o.editable&&o.editableColumn(a),e[30]=a,e[31]=o,e[32]=b):b=e[32];const p=b;if(o.editingCell!==null&&o.editingCell.rowId===d&&o.editingCell.column===a){let $;e[33]!==a||e[34]!==o||e[35]!==d||e[36]!==s?($=M=>{o.stage(d,a,Mn(M,s)),o.cancelEdit()},e[33]=a,e[34]=o,e[35]=d,e[36]=s,e[37]=$):$=e[37];let T;return e[38]!==a||e[39]!==f||e[40]!==o.cancelEdit||e[41]!==d||e[42]!==$?(T=u(Wn,{column:a,initial:f,onCancel:o.cancelEdit,onCommit:$,recordId:d}),e[38]=a,e[39]=f,e[40]=o.cancelEdit,e[41]=d,e[42]=$,e[43]=T):T=e[43],T}let w;m!==void 0?w="rounded bg-warning/15 px-1":p&&(w="cursor-text");let v;e[44]!==p||e[45]!==a||e[46]!==o||e[47]!==d?(v=p?()=>{o.startEdit(d,a)}:void 0,e[44]=p,e[45]=a,e[46]=o,e[47]=d,e[48]=v):v=e[48];const h=v,y=w,C=`db-cell-${d}-${a}`;let N;e[49]!==a||e[50]!==t||e[51]!==r?(N=Bn(t,r,a),e[49]=a,e[50]=t,e[51]=r,e[52]=N):N=e[52];let P;e[53]!==f||e[54]!==N?(P=u(Ze,{highlight:N,value:f}),e[53]=f,e[54]=N,e[55]=P):P=e[55];let x;e[56]!==w||e[57]!==h||e[58]!==C||e[59]!==P?(x=u("span",{className:y,"data-testid":C,onDoubleClick:h,children:P}),e[56]=w,e[57]=h,e[58]=C,e[59]=P,e[60]=x):x=e[60];let S;e[61]!==a||e[62]!==f||e[63]!==o.onExpandCell?(S=u(ht,{column:a,onExpand:o.onExpandCell,value:f}),e[61]=a,e[62]=f,e[63]=o.onExpandCell,e[64]=S):S=e[64];let k;return e[65]!==S||e[66]!==x?(k=R(Je,{children:[x,S]}),e[65]=S,e[66]=x,e[67]=k):k=e[67],k},Zn=l=>{l.preventDefault()},Xn=({draggedRef:l,header:e,masked:n=!1,onTogglePin:o,pinnedOffset:t,table:r})=>{const i=()=>{l.current=e.column.id},a=()=>{const d=l.current,s=e.column.id;if(l.current=null,d===null||d===s)return;const g=r.getState().columnOrder,c=(g.length>0?g:r.getAllLeafColumns().map(f=>f.id)).filter(f=>f!==d),m=c.indexOf(s);c.splice(m===-1?c.length:m,0,d),r.setColumnOrder(c)};return R("th",{className:qe("group/head text-start text-xs font-medium text-muted-foreground",t!==void 0&&"border-e border-border bg-muted"),draggable:!0,onDragOver:Zn,onDragStart:i,onDrop:a,style:t===void 0?it(e.getSize()):Ct(e.getSize(),t),children:[R("button",{className:"inline-flex max-w-full cursor-grab items-center gap-1 truncate outline-none hover:text-foreground","data-testid":`db-sort-${e.column.id}`,onClick:e.column.getToggleSortingHandler(),type:"button",children:[ln(e.column.columnDef.header,e.getContext()),Hn(e.column.getIsSorted())]}),n&&u("span",{className:"ms-1 inline-flex items-center rounded-sm bg-warning/15 px-1 text-[0.625rem] font-medium uppercase text-warning","data-testid":`db-mask-chip-${e.column.id}`,title:"This column is masked by a mask() policy",children:"masked"}),u("button",{"aria-label":t===void 0?`Pin ${e.column.id}`:`Unpin ${e.column.id}`,"aria-pressed":t!==void 0,className:qe("ms-1 rounded-sm px-1 text-[0.625rem] outline-none transition-opacity hover:bg-accent focus-visible:bg-accent",t===void 0?"opacity-0 group-hover/head:opacity-100 focus-visible:opacity-100":"opacity-100 text-foreground"),"data-testid":`db-pin-${e.column.id}`,onClick:()=>{o(e.column.id)},type:"button",children:"📌"}),u("span",{"aria-hidden":"true",className:"absolute inset-y-0 end-0 w-1 cursor-col-resize touch-none select-none hover:bg-ring/60 data-[resizing=true]:bg-ring","data-resizing":e.column.getIsResizing(),"data-testid":`db-resize-${e.column.id}`,onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler()})]})},Yn=l=>{const e=j(13),{table:n}=l,o=ce();let t;e[0]!==n?(t=g=>{n.toggleAllRowsSelected(g)},e[0]=n,e[1]=t):t=e[1];const r=t;let i;e[2]!==o?(i=o("Select all rows"),e[2]=o,e[3]=i):i=e[3];let a;e[4]!==n?(a=n.getIsAllRowsSelected(),e[4]=n,e[5]=a):a=e[5];let d;e[6]!==n?(d=n.getIsSomeRowsSelected()&&!n.getIsAllRowsSelected(),e[6]=n,e[7]=d):d=e[7];let s;return e[8]!==r||e[9]!==i||e[10]!==a||e[11]!==d?(s=u("th",{className:"bg-muted",style:Nt,children:u(at,{"aria-label":i,checked:a,"data-testid":"db-select-all",indeterminate:d,onCheckedChange:r})}),e[8]=r,e[9]=i,e[10]=a,e[11]=d,e[12]=s):s=e[12],s},eo=l=>{const e=j(17),{row:n}=l,o=ce();let t;e[0]!==n.original?(t=ve(n.original),e[0]=n.original,e[1]=t):t=e[1];const r=t;let i;e[2]!==n?(i=b=>{n.toggleSelected(b)},e[2]=n,e[3]=i):i=e[3];const a=i;let d;e[4]!==o?(d=o("Select row"),e[4]=o,e[5]=d):d=e[5];let s;e[6]!==n?(s=n.getIsSelected(),e[6]=n,e[7]=s):s=e[7];let g;e[8]!==n.index||e[9]!==n.original?(g=kt(n.original,n.index),e[8]=n.index,e[9]=n.original,e[10]=g):g=e[10];const c=`db-select-${g}`,m=r===null;let f;return e[11]!==a||e[12]!==d||e[13]!==s||e[14]!==c||e[15]!==m?(f=u("td",{className:"bg-background",style:Nt,children:u(at,{"aria-label":d,checked:s,"data-testid":c,disabled:m,onCheckedChange:a})}),e[11]=a,e[12]=d,e[13]=s,e[14]=c,e[15]=m,e[16]=f):f=e[16],f},to=l=>{const e=j(70),{edit:n,editable:o,mask:t,onDelete:r,onEdit:i,onInspect:a,highlight:d,backRelationCounts:s,onTogglePin:g,pinnedColumns:c,refs:m,tableModel:f}=l,{attachScroll:b,scrollLeft:p,scrollToIndex:w,table:v,tableRows:h,tbodyStyle:y,viewportWidth:C,virtualRows:N}=f,P=De(null),[x,S]=D(null);let k;e[0]!==v?(k=v.getVisibleLeafColumns(),e[0]=v,e[1]=k):k=e[1];const $=k.length;let T;e[2]!==x||e[3]!==$||e[4]!==n||e[5]!==v||e[6]!==h?(T=be=>{if(!["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Enter"].includes(be.key))return;be.preventDefault();const Q=x??{col:0,row:0};if(be.key==="Enter"){const ie=h[Q.row],X=v.getVisibleLeafColumns()[Q.col];if(ie!==void 0&&X!==void 0){const K=ve(ie.original);K!==null&&n.editableColumn(X.id)&&n.startEdit(K,X.id)}S(Q);return}let{col:te,row:se}=Q;e:switch(be.key){case"ArrowDown":{se=Math.min(se+1,h.length-1);break e}case"ArrowRight":{te=Math.min(te+1,$-1);break e}case"ArrowUp":{se=Math.max(se-1,0);break e}default:te=Math.max(te-1,0)}S({col:te,row:se})},e[2]=x,e[3]=$,e[4]=n,e[5]=v,e[6]=h,e[7]=T):T=e[7];const M=T;let _,L;e[8]!==x||e[9]!==w?(_=()=>{x!==null&&w(x.row)},L=[x,w],e[8]=x,e[9]=w,e[10]=_,e[11]=L):(_=e[10],L=e[11]),$e(_,L);let B,F,I,V,O,z,G,H,ue,le,Z,me,re,ge;if(e[12]!==x||e[13]!==b||e[14]!==s||e[15]!==n||e[16]!==o||e[17]!==d||e[18]!==t||e[19]!==r||e[20]!==i||e[21]!==M||e[22]!==a||e[23]!==g||e[24]!==c||e[25]!==m||e[26]!==p||e[27]!==v||e[28]!==h||e[29]!==y||e[30]!==C||e[31]!==N){const be=v.getVisibleLeafColumns().map(lo),Q=_n(be,c,p,C),te=En(v.getVisibleLeafColumns().map(ro),c),se=K=>{const ye=h[K.index],{original:Se}=ye,Ne=ve(Se),xe=kt(Se,K.index),Ce={...jn,height:`${K.size.toString()}px`,transform:`translateY(${K.start.toString()}px)`};return R("tr",{className:"border-b border-border text-xs transition-colors hover:bg-muted/50","data-testid":"db-row",style:Ce,children:[u(eo,{row:ye}),Q.leadPx>0&&u("td",{"aria-hidden":"true",style:{flex:`0 0 ${Q.leadPx.toString()}px`}}),ye.getVisibleCells().map((ne,Ie)=>{if(!Q.ids.has(ne.column.id))return null;const Te=te.get(ne.column.id),Oe=x!==null&&x.row===K.index&&x.col===Ie?" ring-1 ring-ring ring-inset":"";return u("td",{className:qe("group/cell truncate font-mono text-muted-foreground",Te!==void 0&&"border-e border-border bg-background",Oe),style:Te===void 0?it(ne.column.getSize()):Ct(ne.column.getSize(),Te),children:ne.column.id.startsWith(ot)?u(qn,{counts:s[ne.column.id.slice(ot.length)],rowId:xe}):u(Un,{cell:ne,edit:n,highlight:d,mask:t,refs:m})},ne.id)}),Q.tailPx>0&&u("td",{"aria-hidden":"true",style:{flex:`0 0 ${Q.tailPx.toString()}px`}}),R("td",{className:"flex items-center gap-1",style:ft,children:[u("button",{className:pt,"data-testid":`db-inspect-${xe}`,onClick:()=>{a(Se)},type:"button",children:"Details"}),o&&R(Je,{children:[u("button",{className:pt,"data-testid":`db-edit-${xe}`,disabled:Ne===null,onClick:()=>{i(Ne,Se)},type:"button",children:"Edit"}),u(nt,{confirmLabel:"Delete?",disabled:Ne===null,onConfirm:()=>{r(Ne)},testId:`db-delete-${xe}`,children:"Delete"})]})]})]},ye.id)};B=sn,ue="fill",I="db-scroll",V=M,O=b,z="grid",G=Fn,H=0,me="w-full text-xs",re="db-rows",ge=zn;let ie;e[46]!==v?(ie=u(Yn,{table:v}),e[46]=v,e[47]=ie):ie=e[47];let X;e[48]===Symbol.for("react.memo_cache_sentinel")?(X=u("th",{"aria-label":"Row actions",style:ft}),e[48]=X):X=e[48],F=u("thead",{className:"bg-muted/50",children:R("tr",{className:"border-b border-border",style:An,children:[ie,Q.leadPx>0&&u("th",{"aria-hidden":"true",style:{flex:`0 0 ${Q.leadPx.toString()}px`}}),v.getFlatHeaders().map(K=>Q.ids.has(K.column.id)?u(Xn,{draggedRef:P,header:K,masked:t.columns.has(K.column.id),onTogglePin:g,pinnedOffset:te.get(K.column.id),table:v},K.id):null),Q.tailPx>0&&u("th",{"aria-hidden":"true",style:{flex:`0 0 ${Q.tailPx.toString()}px`}}),X]})}),le=y,Z=N.map(K=>se(K)),e[12]=x,e[13]=b,e[14]=s,e[15]=n,e[16]=o,e[17]=d,e[18]=t,e[19]=r,e[20]=i,e[21]=M,e[22]=a,e[23]=g,e[24]=c,e[25]=m,e[26]=p,e[27]=v,e[28]=h,e[29]=y,e[30]=C,e[31]=N,e[32]=B,e[33]=F,e[34]=I,e[35]=V,e[36]=O,e[37]=z,e[38]=G,e[39]=H,e[40]=ue,e[41]=le,e[42]=Z,e[43]=me,e[44]=re,e[45]=ge}else B=e[32],F=e[33],I=e[34],V=e[35],O=e[36],z=e[37],G=e[38],H=e[39],ue=e[40],le=e[41],Z=e[42],me=e[43],re=e[44],ge=e[45];let ae;e[49]!==le||e[50]!==Z?(ae=u("tbody",{style:le,children:Z}),e[49]=le,e[50]=Z,e[51]=ae):ae=e[51];let W;e[52]!==F||e[53]!==ae||e[54]!==me||e[55]!==re||e[56]!==ge?(W=R("table",{className:me,"data-testid":re,style:ge,children:[F,ae]}),e[52]=F,e[53]=ae,e[54]=me,e[55]=re,e[56]=ge,e[57]=W):W=e[57];let q;e[58]!==I||e[59]!==V||e[60]!==O||e[61]!==z||e[62]!==G||e[63]!==H||e[64]!==W?(q=u("div",{"data-testid":I,onKeyDown:V,ref:O,role:z,style:G,tabIndex:H,children:W}),e[58]=I,e[59]=V,e[60]=O,e[61]=z,e[62]=G,e[63]=H,e[64]=W,e[65]=q):q=e[65];let we;return e[66]!==B||e[67]!==ue||e[68]!==q?(we=u(B,{layout:ue,children:q}),e[66]=B,e[67]=ue,e[68]=q,e[69]=we):we=e[69],we},no=(l,e,n,o=[])=>{const t=l?.columns,r=l?.rows,i=l?.refs,a=et(()=>{if(t===void 0)return[];const x=t.map(S=>({accessorFn:k=>k[S],header:i?.[S]===void 0?S:`${S} →`,id:S}));for(const S of o)x.push({accessorFn:()=>{},enableSorting:!1,header:`← ${S.table}`,id:Vn(S)});return x},[o,t,i]),d=et(()=>r??[],[r]),[s,g]=D({}),[c,m]=D({}),f=tn({columnResizeMode:"onChange",columns:a,data:d,defaultColumn:{minSize:80,size:200},enableColumnResizing:!0,enableRowSelection:x=>ve(x.original)!==null,getCoreRowModel:on(),getRowId:(x,S)=>ve(x)??`row-${S.toString()}`,getSortedRowModel:nn(),manualSorting:!0,onColumnVisibilityChange:m,onRowSelectionChange:g,onSortingChange:n,state:{columnVisibility:c,rowSelection:s,sorting:e}}),b=f.getRowModel().rows,p=De(null),w=rn({count:b.length,estimateSize:()=>On,getScrollElement:()=>p.current,initialRect:{height:bt,width:0},observeElementRect:(x,S)=>an(x,S,bt),overscan:8}),v=tt(x=>{w.scrollToIndex(x)},[w]),[h,y]=D({left:0,width:0}),C=tt(x=>{if(p.current=x,x===null)return;const S=()=>{y($=>$.left===x.scrollLeft&&$.width===x.clientWidth?$:{left:x.scrollLeft,width:x.clientWidth})};x.addEventListener("scroll",S,{passive:!0});const k=new ResizeObserver(S);return k.observe(x),()=>{x.removeEventListener("scroll",S),k.disconnect(),p.current=null}},[]),N=w.getVirtualItems(),P={display:"block",height:`${w.getTotalSize().toString()}px`,position:"relative"};return{attachScroll:C,scrollLeft:h.left,scrollToIndex:v,table:f,tableRows:b,tbodyStyle:P,viewportWidth:h.width,virtualRows:N}};function oo(l){const[e,n]=l;return R("div",{className:"contents",children:[u("dt",{className:"truncate font-mono text-[11px] text-muted-foreground",children:e}),u("dd",{className:"truncate font-mono text-[11px] text-foreground",title:Pe(n),children:Pe(n)})]},e)}function lo(l){return{getSize:()=>l.getSize(),id:l.id}}function ro(l){return{getSize:()=>l.getSize(),id:l.id}}const lt="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",ao=l=>{const e=j(22),{onCommit:n}=l,o=ce(),[t,r]=D(""),i=De(null);let a,d;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=()=>{i.current?.focus()},d=[],e[0]=a,e[1]=d):(a=e[0],d=e[1]),$e(a,d);let s;e[2]===Symbol.for("react.memo_cache_sentinel")?(s=y=>{r(y.target.value)},e[2]=s):s=e[2];const g=s;let c;e[3]!==t||e[4]!==n?(c=()=>{const y=t.trim();y!==""&&n(y)},e[3]=t,e[4]=n,e[5]=c):c=e[5];const m=c;let f;e[6]!==o?(f=o("Query name"),e[6]=o,e[7]=f):f=e[7];let b;e[8]!==o?(b=o("Query name"),e[8]=o,e[9]=b):b=e[9];let p;e[10]!==t||e[11]!==f||e[12]!==b?(p=u("input",{"aria-label":f,className:"h-7 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"db-save-query-name",onChange:g,placeholder:b,ref:i,value:t}),e[10]=t,e[11]=f,e[12]=b,e[13]=p):p=e[13];let w;e[14]!==o?(w=o("Save"),e[14]=o,e[15]=w):w=e[15];let v;e[16]!==m||e[17]!==w?(v=u("button",{className:lt,"data-testid":"db-save-query-confirm",onClick:m,type:"button",children:w}),e[16]=m,e[17]=w,e[18]=v):v=e[18];let h;return e[19]!==p||e[20]!==v?(h=R("span",{className:"inline-flex items-center gap-1",children:[p,v]}),e[19]=p,e[20]=v,e[21]=h):h=e[21],h},so=l=>{const e=j(27),{onApply:n,onCopyLink:o,onDelete:t,onSave:r,saved:i}=l,a=ce(),[d,s]=D(!1);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{s(!0)},e[0]=g):g=e[0];const c=g;let m;e[1]!==r?(m=x=>{r(x),s(!1)},e[1]=r,e[2]=m):m=e[2];const f=m;let b;e[3]!==n||e[4]!==i?(b=x=>{const S=i[Number(x.currentTarget.dataset.index)];S!==void 0&&n(S)},e[3]=n,e[4]=i,e[5]=b):b=e[5];const p=b;let w;e[6]!==t||e[7]!==i?(w=x=>{const S=i[Number(x.currentTarget.dataset.index)];S!==void 0&&t(S.name)},e[6]=t,e[7]=i,e[8]=w):w=e[8];const v=w;let h;e[9]!==a?(h=a("Copy link"),e[9]=a,e[10]=h):h=e[10];let y;e[11]!==o||e[12]!==h?(y=u("button",{className:lt,"data-testid":"db-copy-link",onClick:o,type:"button",children:h}),e[11]=o,e[12]=h,e[13]=y):y=e[13];let C;e[14]!==f||e[15]!==d||e[16]!==a?(C=d?u(ao,{onCommit:f}):u("button",{className:lt,"data-testid":"db-save-query",onClick:c,type:"button",children:a("Save query")}),e[14]=f,e[15]=d,e[16]=a,e[17]=C):C=e[17];let N;e[18]!==p||e[19]!==v||e[20]!==i||e[21]!==a?(N=i.length>0&&R("div",{className:"flex flex-wrap items-center gap-1","data-testid":"db-saved-queries",children:[u("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:a("Saved")}),i.map((x,S)=>R("span",{className:"inline-flex items-center overflow-hidden rounded-md border border-border",children:[u("button",{className:"px-2 py-0.5 text-xs text-foreground transition-colors hover:bg-accent","data-index":S,"data-testid":`db-saved-query-${x.name}`,onClick:p,type:"button",children:x.name}),u("button",{"aria-label":a("Delete saved query {name}",{name:x.name}),className:"border-l border-border px-1 py-0.5 text-xs text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive","data-index":S,"data-testid":`db-saved-query-delete-${x.name}`,onClick:v,type:"button",children:"✕"})]},x.name))]}),e[18]=p,e[19]=v,e[20]=i,e[21]=a,e[22]=N):N=e[22];let P;return e[23]!==y||e[24]!==C||e[25]!==N?(P=R("div",{className:"flex flex-wrap items-center gap-1.5","data-testid":"db-query-bar",children:[y,C,N]}),e[23]=y,e[24]=C,e[25]=N,e[26]=P):P=e[26],P},Ve="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 aria-pressed:bg-accent aria-pressed:text-accent-foreground disabled:pointer-events-none disabled:opacity-50",Ge="w-full rounded-md border border-border bg-background px-2 py-1 font-mono text-xs outline-none focus-visible:border-ring",io=/(?:_creationtime|(?:^|[a-z])(?:time|at))$/iu,co=(l,e)=>typeof e=="boolean"?"boolean":typeof e=="number"?io.test(l)?"date":"number":e!==null&&typeof e=="object"?"json":"text",uo=l=>{try{const e=JSON.parse(l);return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}catch{return null}},mo=l=>{const e=new Date(l),n=o=>String(o).padStart(2,"0");return`${e.getFullYear().toString()}-${n(e.getMonth()+1)}-${n(e.getDate())}T${n(e.getHours())}:${n(e.getMinutes())}`},go=l=>{const e=j(8),{column:n,onChange:o,value:t}=l;let r;e[0]!==n||e[1]!==o?(r=g=>{o(n,g)},e[0]=n,e[1]=o,e[2]=r):r=e[2];const i=r,a=t===!0,d=`db-field-${n}`;let s;return e[3]!==n||e[4]!==i||e[5]!==a||e[6]!==d?(s=u(at,{"aria-label":n,checked:a,"data-testid":d,onCheckedChange:i}),e[3]=n,e[4]=i,e[5]=a,e[6]=d,e[7]=s):s=e[7],s},bo=l=>{const e=j(8),{column:n,onChange:o,value:t}=l;let r;e[0]!==n||e[1]!==o?(r=g=>{const c=Number(g.target.value);g.target.value!==""&&!Number.isNaN(c)&&o(n,c)},e[0]=n,e[1]=o,e[2]=r):r=e[2];const i=r,a=`db-field-${n}`,d=typeof t=="number"?t:"";let s;return e[3]!==n||e[4]!==i||e[5]!==a||e[6]!==d?(s=u("input",{"aria-label":n,className:Ge,"data-testid":a,onChange:i,type:"number",value:d}),e[3]=n,e[4]=i,e[5]=a,e[6]=d,e[7]=s):s=e[7],s},fo=l=>{const e=j(10),{column:n,onChange:o,value:t}=l;let r;e[0]!==n||e[1]!==o?(r=g=>{const c=new Date(g.target.value).getTime();Number.isNaN(c)||o(n,c)},e[0]=n,e[1]=o,e[2]=r):r=e[2];const i=r,a=`db-field-${n}`;let d;e[3]!==t?(d=typeof t=="number"?mo(t):"",e[3]=t,e[4]=d):d=e[4];let s;return e[5]!==n||e[6]!==i||e[7]!==a||e[8]!==d?(s=u("input",{"aria-label":n,className:Ge,"data-testid":a,onChange:i,type:"datetime-local",value:d}),e[5]=n,e[6]=i,e[7]=a,e[8]=d,e[9]=s):s=e[9],s},po=l=>{const e=j(8),{column:n,onChange:o,value:t}=l;let r;e[0]!==n||e[1]!==o?(r=g=>{o(n,g.target.value)},e[0]=n,e[1]=o,e[2]=r):r=e[2];const i=r,a=`db-field-${n}`,d=typeof t=="string"?t:"";let s;return e[3]!==n||e[4]!==i||e[5]!==a||e[6]!==d?(s=u("input",{"aria-label":n,className:Ge,"data-testid":a,onChange:i,type:"text",value:d}),e[3]=n,e[4]=i,e[5]=a,e[6]=d,e[7]=s):s=e[7],s},ho=l=>{const e=j(20),{column:n,onChange:o,value:t}=l,r=ce();let i;e[0]!==t?(i=()=>JSON.stringify(t,null,2),e[0]=t,e[1]=i):i=e[1];const[a,d]=D(i),[s,g]=D(!1);let c;e[2]!==n||e[3]!==o?(c=y=>{const C=y.target.value;d(C);try{o(n,JSON.parse(C)),g(!1)}catch{g(!0)}},e[2]=n,e[3]=o,e[4]=c):c=e[4];const m=c,f=s&&"border-destructive";let b;e[5]!==f?(b=qe(Ge,"min-h-16",f),e[5]=f,e[6]=b):b=e[6];const p=`db-field-${n}`;let w;e[7]!==n||e[8]!==m||e[9]!==b||e[10]!==p||e[11]!==a?(w=u("textarea",{"aria-label":n,className:b,"data-testid":p,onChange:m,value:a}),e[7]=n,e[8]=m,e[9]=b,e[10]=p,e[11]=a,e[12]=w):w=e[12];let v;e[13]!==n||e[14]!==s||e[15]!==r?(v=s&&u("span",{className:"text-xs text-destructive","data-testid":`db-field-error-${n}`,children:r("Invalid JSON")}),e[13]=n,e[14]=s,e[15]=r,e[16]=v):v=e[16];let h;return e[17]!==w||e[18]!==v?(h=R("div",{className:"flex flex-col gap-1",children:[w,v]}),e[17]=w,e[18]=v,e[19]=h):h=e[19],h},xo=l=>{const e=j(43),{column:n,onChange:o,target:t,value:r}=l;let i;e[0]!==n||e[1]!==r?(i=co(n,r),e[0]=n,e[1]=r,e[2]=i):i=e[2];const a=i,d=`db-field-${n}`;let s;e[3]!==n?(s=u("span",{className:"font-mono",children:n}),e[3]=n,e[4]=s):s=e[4];let g;e[5]!==t?(g=t!==void 0&&R("span",{className:"rounded bg-muted px-1 font-mono text-[10px] tracking-wide uppercase",children:["→ ",t]}),e[5]=t,e[6]=g):g=e[6];let c;e[7]!==s||e[8]!==g?(c=R("span",{className:"flex items-center gap-1.5 font-medium text-muted-foreground",children:[s,g]}),e[7]=s,e[8]=g,e[9]=c):c=e[9];let m;e[10]!==n||e[11]!==a||e[12]!==o||e[13]!==r?(m=a==="boolean"&&u(go,{column:n,onChange:o,value:r}),e[10]=n,e[11]=a,e[12]=o,e[13]=r,e[14]=m):m=e[14];let f;e[15]!==n||e[16]!==a||e[17]!==o||e[18]!==r?(f=a==="number"&&u(bo,{column:n,onChange:o,value:r}),e[15]=n,e[16]=a,e[17]=o,e[18]=r,e[19]=f):f=e[19];let b;e[20]!==n||e[21]!==a||e[22]!==o||e[23]!==r?(b=a==="date"&&u(fo,{column:n,onChange:o,value:r}),e[20]=n,e[21]=a,e[22]=o,e[23]=r,e[24]=b):b=e[24];let p;e[25]!==n||e[26]!==a||e[27]!==o||e[28]!==r?(p=a==="json"&&u(ho,{column:n,onChange:o,value:r}),e[25]=n,e[26]=a,e[27]=o,e[28]=r,e[29]=p):p=e[29];let w;e[30]!==n||e[31]!==a||e[32]!==o||e[33]!==r?(w=a==="text"&&u(po,{column:n,onChange:o,value:r}),e[30]=n,e[31]=a,e[32]=o,e[33]=r,e[34]=w):w=e[34];let v;return e[35]!==w||e[36]!==d||e[37]!==c||e[38]!==m||e[39]!==f||e[40]!==b||e[41]!==p?(v=R("label",{className:"flex flex-col gap-1 text-xs",htmlFor:d,children:[c,m,f,b,p,w]}),e[35]=w,e[36]=d,e[37]=c,e[38]=m,e[39]=f,e[40]=b,e[41]=p,e[42]=v):v=e[42],v},vo=l=>{const e=j(48),{documentText:n,onCancel:o,onDocumentTextChange:t,onSave:r,refs:i}=l,a=ce();let d;e[0]!==n?(d=uo(n),e[0]=n,e[1]=d):d=e[1];const s=d,[g,c]=D(!1),m=!g&&s!==null;let f;e[2]!==s||e[3]!==t?(f=(O,z)=>{t(JSON.stringify({...s,[O]:z},null,2))},e[2]=s,e[3]=t,e[4]=f):f=e[4];const b=f;let p;e[5]!==t?(p=O=>{t(O.target.value)},e[5]=t,e[6]=p):p=e[6];const w=p;let v;e[7]===Symbol.for("react.memo_cache_sentinel")?(v=()=>{c(!1)},e[7]=v):v=e[7];const h=v;let y;e[8]===Symbol.for("react.memo_cache_sentinel")?(y=()=>{c(!0)},e[8]=y):y=e[8];const C=y,N=s===null;let P;e[9]!==a?(P=a("Form"),e[9]=a,e[10]=P):P=e[10];let x;e[11]!==m||e[12]!==N||e[13]!==P?(x=u("button",{"aria-pressed":m,className:Ve,"data-testid":"db-editor-form",disabled:N,onClick:h,type:"button",children:P}),e[11]=m,e[12]=N,e[13]=P,e[14]=x):x=e[14];const S=!m;let k;e[15]!==a?(k=a("JSON"),e[15]=a,e[16]=k):k=e[16];let $;e[17]!==k||e[18]!==S?($=u("button",{"aria-pressed":S,className:Ve,"data-testid":"db-editor-json",onClick:C,type:"button",children:k}),e[17]=k,e[18]=S,e[19]=$):$=e[19];let T;e[20]!==$||e[21]!==x?(T=R("div",{className:"flex items-center gap-1.5",children:[x,$]}),e[20]=$,e[21]=x,e[22]=T):T=e[22];let M;e[23]!==n||e[24]!==s||e[25]!==b||e[26]!==w||e[27]!==i||e[28]!==m||e[29]!==a?(M=m?u("div",{className:"flex flex-col gap-3","data-testid":"db-editor-fields",children:Object.entries(s).map(O=>{const[z,G]=O;return u(xo,{column:z,onChange:b,target:i?.[z],value:G},z)})}):u("textarea",{"aria-label":a("Row document JSON"),className:"min-h-28 w-full rounded-md border border-border bg-background px-2 py-1.5 font-mono text-xs outline-none focus-visible:border-ring","data-testid":"db-editor-doc",onChange:w,value:n}),e[23]=n,e[24]=s,e[25]=b,e[26]=w,e[27]=i,e[28]=m,e[29]=a,e[30]=M):M=e[30];let _;e[31]!==a?(_=a("Save"),e[31]=a,e[32]=_):_=e[32];let L;e[33]!==r||e[34]!==_?(L=u("button",{className:Ve,"data-testid":"db-editor-save",onClick:r,type:"button",children:_}),e[33]=r,e[34]=_,e[35]=L):L=e[35];let B;e[36]!==a?(B=a("Cancel"),e[36]=a,e[37]=B):B=e[37];let F;e[38]!==o||e[39]!==B?(F=u("button",{className:Ve,"data-testid":"db-editor-cancel",onClick:o,type:"button",children:B}),e[38]=o,e[39]=B,e[40]=F):F=e[40];let I;e[41]!==L||e[42]!==F?(I=R("div",{className:"flex items-center gap-1.5",children:[L,F]}),e[41]=L,e[42]=F,e[43]=I):I=e[43];let V;return e[44]!==T||e[45]!==M||e[46]!==I?(V=R("div",{className:"flex flex-col gap-2 border border-border bg-card p-3","data-testid":"db-editor",children:[T,M,I]}),e[44]=T,e[45]=M,e[46]=I,e[47]=V):V=e[47],V},ze="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 aria-pressed:bg-accent aria-pressed:text-accent-foreground",wo=l=>{const e=j(61),{columns:n,editable:o,filter:t,filters:r,hasMaskedColumns:i,liveError:a,maskOn:d,onAddRow:s,onBulkDelete:g,onAskAiFilter:c,onClearTable:m,onFilterChange:f,onFiltersChange:b,onGenerateRows:p,onShowJson:w,onShowTable:v,onToggleMask:h,total:y,viewMode:C}=l,N=ce(),P=C==="table";let x;e[0]!==v||e[1]!==P?(x=u("button",{"aria-pressed":P,className:ze,"data-testid":"db-view-table",onClick:v,type:"button",children:"Table"}),e[0]=v,e[1]=P,e[2]=x):x=e[2];const S=C==="json";let k;e[3]!==w||e[4]!==S?(k=u("button",{"aria-pressed":S,className:ze,"data-testid":"db-view-json",onClick:w,type:"button",children:"JSON"}),e[3]=w,e[4]=S,e[5]=k):k=e[5];let $;e[6]!==a||e[7]!==N?($=a===void 0?N("Live — changes stream in automatically"):N("Live unavailable: {liveError}",{liveError:a}),e[6]=a,e[7]=N,e[8]=$):$=e[8];const T=`size-1.5 rounded-full ${a===void 0?"bg-success":"bg-muted-foreground/50"}`;let M;e[9]!==T?(M=u("span",{"aria-hidden":"true",className:T}),e[9]=T,e[10]=M):M=e[10];let _;e[11]!==a||e[12]!==N?(_=N(a===void 0?"Live":"Live unavailable"),e[11]=a,e[12]=N,e[13]=_):_=e[13];let L;e[14]!==$||e[15]!==M||e[16]!==_?(L=R("span",{className:"inline-flex items-center gap-1.5 px-1 text-xs font-medium text-muted-foreground","data-testid":"db-live-indicator",role:"status",title:$,children:[M,_]}),e[14]=$,e[15]=M,e[16]=_,e[17]=L):L=e[17];let B;e[18]!==i||e[19]!==d||e[20]!==h||e[21]!==N?(B=i&&u("button",{"aria-pressed":d,className:ze,"data-testid":"db-mask-toggle",onClick:h,type:"button",children:N("Mask sensitive columns")}),e[18]=i,e[19]=d,e[20]=h,e[21]=N,e[22]=B):B=e[22];let F;e[23]!==o||e[24]!==s?(F=o&&u("button",{className:ze,"data-testid":"db-add-row",onClick:s,type:"button",children:"Add row"}),e[23]=o,e[24]=s,e[25]=F):F=e[25];let I;e[26]!==o||e[27]!==p||e[28]!==N?(I=o&&u("button",{className:ze,"data-testid":"db-generate-rows",onClick:p,type:"button",children:N("Generate rows")}),e[26]=o,e[27]=p,e[28]=N,e[29]=I):I=e[29];let V;e[30]!==o||e[31]!==t||e[32]!==r||e[33]!==g||e[34]!==y?(V=o&&y>0&&(t!==""||r.length>0)&&u(nt,{confirmLabel:`Delete ${y.toString()} matching?`,onConfirm:g,testId:"db-bulk-delete",children:`Delete ${y.toString()} matching`}),e[30]=o,e[31]=t,e[32]=r,e[33]=g,e[34]=y,e[35]=V):V=e[35];let O;e[36]!==o||e[37]!==t||e[38]!==r||e[39]!==m||e[40]!==y?(O=o&&y>0&&t===""&&r.length===0&&u(nt,{confirmLabel:`Clear all ${y.toString()} rows?`,onConfirm:m,testId:"db-clear-table",children:`Clear table (${y.toString()})`}),e[36]=o,e[37]=t,e[38]=r,e[39]=m,e[40]=y,e[41]=O):O=e[41];let z;e[42]!==B||e[43]!==F||e[44]!==I||e[45]!==V||e[46]!==O||e[47]!==x||e[48]!==k||e[49]!==L?(z=R("div",{className:"flex flex-wrap items-center gap-1.5",children:[x,k,L,B,F,I,V,O]}),e[42]=B,e[43]=F,e[44]=I,e[45]=V,e[46]=O,e[47]=x,e[48]=k,e[49]=L,e[50]=z):z=e[50];let G;e[51]!==n||e[52]!==t||e[53]!==r||e[54]!==c||e[55]!==f||e[56]!==b?(G=u(cn,{columns:n,filters:r,onAskAi:c,onFiltersChange:b,onSearchChange:f,search:t}),e[51]=n,e[52]=t,e[53]=r,e[54]=c,e[55]=f,e[56]=b,e[57]=G):G=e[57];let H;return e[58]!==z||e[59]!==G?(H=R("div",{className:"flex flex-col gap-2","data-testid":"db-view-toggle",children:[z,G]}),e[58]=z,e[59]=G,e[60]=H):H=e[60],H},yo=l=>{const e=j(101),{assistant:n,backRelations:o,browser:t,edit:r,editable:i,onAskAiFilter:a,onInspect:d,onOpenGenerateRows:s,onSaveQuery:g,page:c,preferences:m,queryBar:f,references:b}=l,p=m.maskColumns.size>0,w=n.unavailable?void 0:a;let v;e[0]!==t.addRow||e[1]!==t.bulkDelete||e[2]!==t.clearTable||e[3]!==t.columns||e[4]!==t.filter||e[5]!==t.filters||e[6]!==t.liveError||e[7]!==t.onFilterChange||e[8]!==t.onFiltersChange||e[9]!==t.showJson||e[10]!==t.showTable||e[11]!==t.total||e[12]!==t.viewMode||e[13]!==i||e[14]!==s||e[15]!==m.maskOn||e[16]!==m.onToggleMask||e[17]!==p||e[18]!==w?(v=u(wo,{columns:t.columns,editable:i,filter:t.filter,filters:t.filters,hasMaskedColumns:p,liveError:t.liveError,maskOn:m.maskOn,onAddRow:t.addRow,onAskAiFilter:w,onBulkDelete:t.bulkDelete,onClearTable:t.clearTable,onFilterChange:t.onFilterChange,onFiltersChange:t.onFiltersChange,onGenerateRows:s,onShowJson:t.showJson,onShowTable:t.showTable,onToggleMask:m.onToggleMask,total:t.total,viewMode:t.viewMode}),e[0]=t.addRow,e[1]=t.bulkDelete,e[2]=t.clearTable,e[3]=t.columns,e[4]=t.filter,e[5]=t.filters,e[6]=t.liveError,e[7]=t.onFilterChange,e[8]=t.onFiltersChange,e[9]=t.showJson,e[10]=t.showTable,e[11]=t.total,e[12]=t.viewMode,e[13]=i,e[14]=s,e[15]=m.maskOn,e[16]=m.onToggleMask,e[17]=p,e[18]=w,e[19]=v):v=e[19];let h;e[20]!==g||e[21]!==f?(h=f!==void 0&&u(so,{onApply:f.onApplyQuery,onCopyLink:f.onCopyLink,onDelete:f.onDeleteQuery,onSave:g,saved:f.saved}),e[20]=g,e[21]=f,e[22]=h):h=e[22];let y;e[23]!==o||e[24]!==t.onBulkDeleteSelected||e[25]!==t.selectedTable||e[26]!==t.table||e[27]!==t.viewMode||e[28]!==i||e[29]!==c||e[30]!==m.onToggleTranspose||e[31]!==m.transposed?(y=t.viewMode==="table"&&c.rows.length>0&&u(un,{backRelations:o.available,columns:c.columns,editable:i,enabledBackRelations:o.enabled,name:t.selectedTable??"export",onBulkDelete:t.onBulkDeleteSelected,onToggleBackRelation:o.onToggle,onToggleTranspose:m.onToggleTranspose,rows:c.rows,table:t.table.table,transposed:m.transposed}),e[23]=o,e[24]=t.onBulkDeleteSelected,e[25]=t.selectedTable,e[26]=t.table,e[27]=t.viewMode,e[28]=i,e[29]=c,e[30]=m.onToggleTranspose,e[31]=m.transposed,e[32]=y):y=e[32];let C;e[33]!==t.cancelEdit||e[34]!==t.editing||e[35]!==t.saveEdit||e[36]!==t.setEditorDocumentText||e[37]!==i||e[38]!==c?(C=i&&t.editing!==null&&u(vo,{documentText:t.editing.docText,onCancel:t.cancelEdit,onDocumentTextChange:t.setEditorDocumentText,onSave:t.saveEdit,refs:c.refs}),e[33]=t.cancelEdit,e[34]=t.editing,e[35]=t.saveEdit,e[36]=t.setEditorDocumentText,e[37]=i,e[38]=c,e[39]=C):C=e[39];let N;e[40]!==t.committing||e[41]!==t.discardStaged||e[42]!==t.onCommitStaged||e[43]!==t.stagedChanges||e[44]!==i?(N=i&&t.stagedChanges.length>0&&u(Pn,{changes:t.stagedChanges,committing:t.committing,onCommit:t.onCommitStaged,onDiscard:t.discardStaged}),e[40]=t.committing,e[41]=t.discardStaged,e[42]=t.onCommitStaged,e[43]=t.stagedChanges,e[44]=i,e[45]=N):N=e[45];let P;e[46]!==t.writeError?(P=t.writeError!==null&&u("p",{className:"text-sm text-destructive","data-testid":"db-write-error",role:"alert",children:t.writeError}),e[46]=t.writeError,e[47]=P):P=e[47];let x;e[48]!==v||e[49]!==h||e[50]!==y||e[51]!==C||e[52]!==N||e[53]!==P?(x=R("div",{className:"flex shrink-0 flex-col gap-2 border-b border-border px-4 py-3",children:[v,h,y,C,N,P]}),e[48]=v,e[49]=h,e[50]=y,e[51]=C,e[52]=N,e[53]=P,e[54]=x):x=e[54];let S;e[55]!==t.viewMode||e[56]!==c?(S=t.viewMode==="table"&&c.rows.length===0&&u("div",{className:"flex flex-1 items-center justify-center p-6",children:u(en,{description:"Rows you insert into this table will show up here.",icon:u("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:u("path",{d:"M4 5h16v14H4V5Zm0 5h16M10 10v9M4 14.5h16"})}),testId:"db-empty-rows",title:"This table is empty."})}),e[55]=t.viewMode,e[56]=c,e[57]=S):S=e[57];let k;e[58]!==t.viewMode||e[59]!==c||e[60]!==m.maskView||e[61]!==m.transposed?(k=t.viewMode==="table"&&c.rows.length>0&&m.transposed&&u(dn,{columns:c.columns,rows:gt(c.rows,m.maskView)}),e[58]=t.viewMode,e[59]=c,e[60]=m.maskView,e[61]=m.transposed,e[62]=k):k=e[62];let $;e[63]!==o||e[64]!==t.filter||e[65]!==t.onRowDelete||e[66]!==t.onRowEdit||e[67]!==t.table||e[68]!==t.viewMode||e[69]!==r||e[70]!==i||e[71]!==d||e[72]!==c||e[73]!==m.maskView||e[74]!==m.onTogglePin||e[75]!==m.pinnedColumns||e[76]!==m.transposed||e[77]!==b?($=t.viewMode==="table"&&c.rows.length>0&&!m.transposed&&u(to,{backRelationCounts:o.counts,edit:r,editable:i,highlight:t.filter,mask:m.maskView,onDelete:t.onRowDelete,onEdit:t.onRowEdit,onInspect:d,onTogglePin:m.onTogglePin,pinnedColumns:m.pinnedColumns,refs:b,tableModel:t.table}),e[63]=o,e[64]=t.filter,e[65]=t.onRowDelete,e[66]=t.onRowEdit,e[67]=t.table,e[68]=t.viewMode,e[69]=r,e[70]=i,e[71]=d,e[72]=c,e[73]=m.maskView,e[74]=m.onTogglePin,e[75]=m.pinnedColumns,e[76]=m.transposed,e[77]=b,e[78]=$):$=e[78];let T;e[79]!==t.viewMode||e[80]!==c||e[81]!==m.maskView?(T=t.viewMode==="json"&&u("pre",{className:"min-h-0 flex-1 overflow-auto border-t border-border bg-muted/30 p-3 text-xs","data-testid":"db-json",children:JSON.stringify(gt(c.rows,m.maskView),null,2)}),e[79]=t.viewMode,e[80]=c,e[81]=m.maskView,e[82]=T):T=e[82];let M;e[83]!==t.changePageSize||e[84]!==t.goNext||e[85]!==t.goPrevious||e[86]!==t.hasNext||e[87]!==t.hasPrevious||e[88]!==t.jumpToPage||e[89]!==t.pageSize||e[90]!==t.rangeEnd||e[91]!==t.rangeStart||e[92]!==t.total?(M=u("div",{className:"flex shrink-0 items-center border-t border-border px-4 py-2",children:u(gn,{hasNext:t.hasNext,hasPrevious:t.hasPrevious,onJumpToPage:t.jumpToPage,onNext:t.goNext,onPageSizeChange:t.changePageSize,onPrevious:t.goPrevious,pageSize:t.pageSize,prefix:"db",rangeEnd:t.rangeEnd,rangeStart:t.rangeStart,total:t.total})}),e[83]=t.changePageSize,e[84]=t.goNext,e[85]=t.goPrevious,e[86]=t.hasNext,e[87]=t.hasPrevious,e[88]=t.jumpToPage,e[89]=t.pageSize,e[90]=t.rangeEnd,e[91]=t.rangeStart,e[92]=t.total,e[93]=M):M=e[93];let _;return e[94]!==S||e[95]!==k||e[96]!==$||e[97]!==T||e[98]!==M||e[99]!==x?(_=R("div",{className:"flex min-h-0 flex-1 flex-col","data-testid":"db-page",children:[x,S,k,$,T,M]}),e[94]=S,e[95]=k,e[96]=$,e[97]=T,e[98]=M,e[99]=x,e[100]=_):_=e[100],_},So="/__lunora/seed",Xe=200,No=50,Co=(l,e)=>{const n=[];for(const o of l)o.pk!==!0&&o.ref!==void 0&&o.type==="id"&&(e[o.ref]??[]).length===0&&n.push(o.name);return n},ko=async l=>{const e=await fetch(So,{body:JSON.stringify(l),headers:{"Content-Type":"application/json"},method:"POST"}),n=await e.json();return e.ok&&n.rows!==void 0?{kind:"ok",rows:n.rows}:{kind:"error",message:n.error??`seed request failed (${String(e.status)})`}},$o="rounded-md border border-border px-3 py-1.5 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50",To="rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground outline-none transition-colors hover:bg-primary/90 focus-visible:bg-primary/90 disabled:pointer-events-none disabled:opacity-50",_o=({columns:l,fkPools:e,onClose:n,onInsertRows:o,table:t})=>{const r=ce(),[i,a]=D(10),[d,s]=D(!1),[g,c]=D(void 0),[m,f]=D(void 0),b=h=>{const y=Number(h.target.value);!Number.isNaN(y)&&y>=1&&a(Math.min(y,Xe))},p=async()=>{c(void 0),f(void 0),s(!0);try{const h=await ko({count:i,existingIds:e,seed:Date.now(),table:t});if(h.kind==="error"){c(h.message);return}const{rows:y}=h;if(y.length===0){c(r("No rows generated — all columns were skipped."));return}const C=await o(y);if(C!==void 0){c(C);return}f(y.length);const N=Co(l,e);N.length>0&&c(r("Inserted {count} rows. Skipped FK columns: {cols}",{cols:N.join(", "),count:y.length.toString()}))}finally{s(!1)}},w=()=>{oe(p())},v=l.filter(h=>h.pk!==!0);return R(yt,{label:r("Generate dummy rows"),onClose:n,panelTestId:"gen-rows-panel",testId:"gen-rows-overlay",variant:"dialog",children:[R("div",{className:"flex items-start justify-between",children:[R("div",{className:"flex flex-col gap-0.5",children:[u("h3",{className:"text-base text-foreground","data-testid":"gen-rows-title",children:r("Generate dummy rows")}),u("p",{className:"text-xs text-muted-foreground","data-testid":"gen-rows-desc",children:r("Seed {table} with Faker-generated rows. Existing rows are not affected.",{table:t})})]}),u("button",{className:"text-xs text-muted-foreground hover:text-foreground","data-testid":"gen-rows-close",onClick:n,type:"button",children:r("Close")})]}),R("div",{className:"flex items-center gap-2",children:[u("label",{className:"text-xs font-medium text-foreground",htmlFor:"gen-rows-count",children:r("Row count")}),u("input",{className:"w-20 rounded-md border border-border bg-background px-2 py-1 text-xs outline-none focus-visible:border-ring","data-testid":"gen-rows-count",id:"gen-rows-count",max:Xe,min:1,onChange:b,type:"number",value:i}),u("span",{className:"text-xs text-muted-foreground",children:r("(max {max})",{max:Xe.toString()})})]}),v.length>0&&R("div",{className:"flex flex-col gap-1",children:[u("p",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:r("Columns to seed")}),u("ul",{className:"flex flex-col gap-0.5","data-testid":"gen-rows-columns",children:v.map(h=>{const y=h.ref!==void 0&&h.type==="id",C=y&&(e[h.ref??""]??[]).length===0,N=C?"rounded bg-destructive/10 px-1 text-destructive":"rounded bg-muted px-1 text-muted-foreground",P=C?`gen-rows-fk-empty-${h.name}`:`gen-rows-fk-ok-${h.name}`,x=C?r("FK: no rows in {ref} — will skip",{ref:h.ref??""}):r("→ {ref}",{ref:h.ref??""});return R("li",{className:"flex items-center gap-1.5 font-mono text-xs",children:[u("span",{className:"text-foreground",children:h.name}),R("span",{className:"text-muted-foreground",children:["(",h.type,")"]}),h.optional&&u("span",{className:"rounded bg-muted px-1 font-mono text-[10px] tracking-wide uppercase",children:"optional"}),y&&u("span",{className:N,"data-testid":P,children:x})]},h.name)})})]}),g!==void 0&&u("p",{className:"text-xs text-destructive","data-testid":"gen-rows-error",role:"alert",children:g}),m!==void 0&&g===void 0&&u("p",{className:"text-xs text-success","data-testid":"gen-rows-success",children:r("Inserted {count} rows successfully.",{count:m.toString()})}),R("div",{className:"flex justify-end gap-2",children:[u("button",{className:$o,"data-testid":"gen-rows-cancel",onClick:n,type:"button",children:r("Cancel")}),u("button",{className:To,"data-testid":"gen-rows-generate",disabled:d,onClick:w,type:"button",children:r(d?"Inserting…":"Generate & insert")})]})]})},Eo=he(Y.backRelationCounts),Ro=(l,e,n,o)=>{const t=j(16),r=Ke();let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i={},t[0]=i):i=t[0];const[a,d]=D(i);let s;if(t[1]!==l||t[2]!==e){let v;t[4]!==l?(v=h=>l.has(st(h)),t[4]=l,t[5]=v):v=t[5],s=e.filter(v),t[1]=l,t[2]=e,t[3]=s}else s=t[3];const g=s;let c;t[6]!==n||t[7]!==g?(c=JSON.stringify([g,n]),t[6]=n,t[7]=g,t[8]=c):c=t[8];const m=c;let f;t[9]!==r||t[10]!==o||t[11]!==m?(f=async v=>{const[h,y]=JSON.parse(m);if(h.length===0||y.length===0){v.cancelled||d({});return}try{const C=await r.query(Eo,{ids:y,relations:h},de(o));v.cancelled||d(Object.fromEntries(C.relations.map(Mo)))}catch{}},t[9]=r,t[10]=o,t[11]=m,t[12]=f):f=t[12];const b=f;let p,w;return t[13]!==b?(p=()=>{const v={cancelled:!1};return oe(b(v)),()=>{v.cancelled=!0}},w=[b],t[13]=b,t[14]=p,t[15]=w):(p=t[14],w=t[15]),$e(p,w),a};function Mo(l){return[st(l),l.counts]}const rt=l=>{const e=l[0];return e===void 0?void 0:{column:e.id,direction:e.desc?"desc":"asc"}},$t=l=>l==null?"":typeof l=="object"?JSON.stringify(l):String(l),xt=l=>l.map(e=>({column:e.column,operator:e.operator,value:e.value===void 0?"":$t(e.value)})),vt=l=>l===void 0?[]:[{desc:l.direction==="desc",id:l.column}],Po=200,Do=20,Io=he(Y.readTablePage),Oo=he(Y.facetColumn),Ye=he(Y.writeRow),Fo=he(Y.deleteRows),zo=he(Y.clearTable),jo={},dt=new Set(["__doc__","__id__","_creationTime","_id","id"]),Ao=l=>{const e=l.__doc__;if(typeof e=="string")try{const o=JSON.parse(e);if(o!==null&&typeof o=="object"&&!Array.isArray(o))return o}catch{}const n={};for(const[o,t]of Object.entries(l))dt.has(o)||(n[o]=t);return n},Lo=({filters:l,offset:e,pageSize:n,search:o,sorting:t,table:r})=>({filters:Me(l),limit:n,offset:e,orderBy:rt(t),search:o,skipCount:!0,table:r}),Bo=({filters:l,search:e,table:n})=>({filters:Me(l),limit:1,search:e,table:n}),Vo=(l,e)=>{const n=new Map;for(const t of l?.rows??[]){const r=ve(t);r!==null&&n.set(r,t)}const o=[];for(const[t,r]of Object.entries(e))for(const[i,a]of Object.entries(r))o.push({column:i,newValue:a,oldValue:n.get(t)?.[i],rowId:t});return o},qo=l=>!dt.has(l),Jo=({initialFilters:l,initialOrderBy:e,initialSearch:n,initialShardKey:o,onSelectTable:t,onViewChange:r,pageSize:i,resolveBackRelations:a,tableParam:d})=>{const s=Ke(),[g,c]=D(i),[m,f]=D(o??""),b=d===void 0||d===""?null:d,[p,w]=D(0),[v,h]=D("table"),[y,C]=D(()=>vt(e)),[N,P]=D(n??""),x=ct(N.trim(),300),S=ct(m.trim(),400),[k,$]=D(()=>xt(l??[])),T=ke(k),{clearFacets:M,facets:_,refetchFacets:L,toggleFacet:B}=bn(),[F,I]=D(null),[V,O]=D(null),z=Rn(),[G,H]=D(null),[ue,le]=D(!1),Z=je(Y.listTables,jo,{live:!0,shardKey:S}),me=Z.data??null,re=Z.error,ge=Lo({filters:k,offset:p,pageSize:g,search:x,sorting:y,table:b??""}),ae=Bo({filters:k,search:x,table:b??""}),W=je(Y.readTablePage,ge,{enabled:b!==null,keepPreviousData:!1,live:!0,shardKey:S}),q=W.data??null,we=W.error,{liveError:be}=W,Q=je(Y.readTablePage,ae,{enabled:b!==null,live:!0,shardKey:S});$e(()=>{Z.data!==void 0&&hn(S)},[Z.data,S]);const te=E=>{t?.(E)},se=(E,A)=>{t?.(E,{search:A})},ie=async(E,A)=>{try{return(await s.query(Io,{filters:[],limit:Do,offset:0,search:A,table:E},de(S))).rows.find(ee=>ve(ee)===A)??null}catch{return null}},X=(E,A,ee,Re)=>_e=>s.query(Oo,{column:_e,filters:Me(ee),search:Re,table:A},de(E)),K=E=>{B(E,b===null?null:X(S,b,T.current,x))},ye=(E,A)=>{const ee=$t(A);$(Re=>[...Re.filter(_e=>_e.column!==E),{column:E,operator:"eq",value:ee}]),w(0)},Se=ke(X),Ne=ke(L),xe=ke(r);$e(()=>{b!==null&&Ne.current(Se.current(S,b,k,x))},[S,b,k,x]);const Ce=De(d);$e(()=>{b===null||xe.current===void 0||Ce.current!==d||xe.current({filters:Me(k),orderBy:rt(y),search:x,shard:S})},[b,d,k,y,x,S]);const ne=ke(l),Ie=ke(e),Te=ke(n),Oe=ke(o);$e(()=>{Ce.current!==d&&(Ce.current=d,queueMicrotask(()=>{const E=xt(ne.current??[]);C(vt(Ie.current)),P(Te.current??""),$(E),T.current=E,f(Oe.current??""),M(),z.clear(),H(null),w(0)}))},[d]);const Fe=E=>{b!==null&&w(Math.max(0,E))},He=(E,A)=>{H({column:A,rowId:E})},Qe=()=>{H(null)},Ae=async()=>{if(b!==null){O(null),le(!0);try{for(const[E,A]of Object.entries(z.staged))await s.query(Ye,{doc:A,id:E,op:"patch",table:b},de(S));z.clear(),H(null),W.refetch()}catch(E){O(E.message)}le(!1)}},We=()=>{z.clear(),H(null)},Ue=Vo(q,z.staged),Le=async(E,A,ee)=>{if(b===null)return;O(null);let Re;if(E!=="delete")try{Re=ee===void 0||ee.trim()===""?{}:JSON.parse(ee)}catch(_e){O(`Invalid JSON: ${_e.message}`);return}try{await s.query(Ye,{doc:Re,id:A??void 0,op:E,table:b},de(S)),I(null),W.refetch()}catch(_e){O(_e.message)}},Be=async(E,A)=>{if(b!==null){O(null);try{for(let ee=0;ee<Po&&(await s.query(E,A,de(S))).hasMore;ee+=1);w(0),W.refetch()}catch(ee){O(ee.message)}}},J=E=>{C(E),w(0)},U=et(()=>b===null?[]:a?.(b)??[],[a,b]),fe=no(q,y,J,U),pe={filters:Me(k),orderBy:rt(y),search:x,shard:m,table:b??void 0},Ee=Q.data?.total??(q===null?0:p+q.rows.length),Tt=p>0,_t=q!==null&&p+q.rows.length<Ee,Et=q===null||q.rows.length===0?0:p+1,Rt=q===null?0:p+q.rows.length,Mt=()=>{Z.refetch()},Pt=()=>{h("table")},Dt=()=>{h("json")},It=()=>{oe(Be(Fo,{filters:Me(T.current),search:x,table:b}))},Ot=()=>{oe(Be(zo,{table:b}))},Ft=E=>{P(E.target.value),w(0)},zt=E=>{$(E),w(0)},jt=()=>{O(null);const E={};for(const A of q?.columns??[])dt.has(A)||(E[A]="");I({docText:JSON.stringify(E,null,2),id:""})},At=E=>{I(A=>A===null?A:{docText:E,id:A.id})},Lt=()=>{F!==null&&oe(Le(F.id===""?"insert":"patch",F.id===""?null:F.id,F.docText))},Bt=()=>{I(null),O(null)},Vt=()=>{Fe(p-g)},qt=()=>{Fe(p+g)},Jt=E=>{Fe(Math.max(0,(E-1)*g))},Kt=E=>{c(E),w(0)},Gt=(E,A)=>{O(null),I({docText:JSON.stringify(Ao(A),null,2),id:E})},Ht=E=>{oe(Le("delete",E))},Qt=async E=>{if(!(b===null||E.length===0)){O(null);try{for(const A of E)await s.query(Ye,{id:A,op:"delete",table:b},de(S));W.refetch()}catch(A){O(A.message)}}},Wt=E=>{oe(Qt(E))},Ut=()=>{oe(Ae())};return{addRow:jt,bulkDelete:It,cancelCellEdit:Qe,cancelEdit:Bt,changePageSize:Kt,clearTable:Ot,columns:q?.columns??[],committing:ue,currentView:pe,discardStaged:We,editableColumn:qo,editing:F,editingCell:G,facetFilter:ye,facets:_,filter:N,filters:k,goNext:qt,goPrevious:Vt,hasNext:_t,hasPrevious:Tt,jumpToPage:Jt,liveError:be,loadTables:Mt,navigateToRef:se,onBulkDeleteSelected:Wt,onCommitStaged:Ut,onFilterChange:Ft,onFiltersChange:zt,onRowDelete:Ht,onRowEdit:Gt,page:q,previewRef:ie,pageError:we,pageSize:g,rangeEnd:Rt,rangeStart:Et,queryShardKey:S,saveEdit:Lt,selectedTable:b,selectTable:te,setEditorDocumentText:At,setShardKey:f,shardKey:m,showJson:Dt,showTable:Pt,stage:z.stage,stagedChanges:Ue,stagedValue:z.stagedValue,startCellEdit:He,table:fe,tables:me,tablesError:re,toggleFacet:K,total:Ee,viewMode:v,writeError:V}},Ko=[],Go=()=>{const l=j(1);let e;l[0]===Symbol.for("react.memo_cache_sentinel")?(e={},l[0]=e):e=l[0];const{data:n}=je(Y.maskPolicies,e);return Array.isArray(n?.columns)?n.columns:Ko},Ho="lunora-studio-pinned-columns",Qo=l=>{const e=j(24),{columns:n,initialPins:o,selectedTable:t}=l;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={},e[0]=r):r=e[0];const[i,a]=wt(Ho,r),d=t??"",s=i[d];let g;e[1]!==o||e[2]!==s?(g=s===void 0?new Set((o??"").split(",").filter(Wo)):new Set(s),e[1]=o,e[2]=s,e[3]=g):g=e[3];const c=g;let m;e[4]!==d||e[5]!==c||e[6]!==a?(m=M=>{a(_=>{const L=_[d]??[...c],B=L.includes(M)?L.filter(F=>F!==M):[...L,M];return{..._,[d]:B}})},e[4]=d,e[5]=c,e[6]=a,e[7]=m):m=e[7];const f=m,[b,p]=D(!1);let w;e[8]===Symbol.for("react.memo_cache_sentinel")?(w=()=>{p(Uo)},e[8]=w):w=e[8];const v=w,h=Go(),[y,C]=D(!0);let N;e[9]===Symbol.for("react.memo_cache_sentinel")?(N=()=>{C(Zo)},e[9]=N):N=e[9];const P=N;let x;if(e[10]!==n||e[11]!==h||e[12]!==t){const M=Cn(h,t??"");x=$n(M,n),e[10]=n,e[11]=h,e[12]=t,e[13]=x}else x=e[13];const S=x;let k;e[14]!==S||e[15]!==y?(k={columns:S,enabled:y},e[14]=S,e[15]=y,e[16]=k):k=e[16];const $=k;let T;return e[17]!==S||e[18]!==y||e[19]!==$||e[20]!==f||e[21]!==c||e[22]!==b?(T={maskColumns:S,maskOn:y,maskView:$,onToggleMask:P,onTogglePin:f,onToggleTranspose:v,pinnedColumns:c,transposed:b},e[17]=S,e[18]=y,e[19]=$,e[20]=f,e[21]=c,e[22]=b,e[23]=T):T=e[23],T};function Wo(l){return l!==""}function Uo(l){return!l}function Zo(l){return!l}const Xo=he(Y.describeTable),Yo=he(Y.readTablePage),el=he(Y.writeRow),tl=l=>{const e=l._id??l.id??l.__id__??"";return typeof e=="string"?e:typeof e=="number"?String(e):""},nl=l=>{const e=Ke(),[n,o]=D(!1),[t,r]=D(void 0),[i,a]=D(void 0),[d,s]=D(void 0),[g,c]=D({}),[m,f]=D(!1),[b,p]=D(void 0),w=async(v,h)=>{o(!0),r(v),a(h),s(void 0),c({}),p(void 0),f(!0);try{const y=await e.query(Xo,{table:v},de(h)),{columns:C}=y;s(C);const N={},P=C.filter(x=>x.ref!==void 0&&x.type==="id"&&x.pk!==!0);for(const x of P){if(x.ref===void 0)continue;const{ref:S}=x;if(N[S]===void 0)try{const k=await e.query(Yo,{filters:[],limit:No,offset:0,search:"",table:S},de(h));N[S]=k.rows.flatMap($=>tl($)||[])}catch{N[S]=[]}}c(N)}catch(y){p(y.message)}f(!1)};return{closeDialog:()=>{o(!1),r(void 0),a(void 0),s(void 0),c({}),p(void 0)},columnMeta:d,error:b,fkPools:g,insertBatch:async(v,h)=>{if(t===void 0||i===void 0)return"No table selected.";try{for(const y of v)await e.query(el,{doc:y,op:"insert",table:t},de(i));h(),l();return}catch(y){return y.message}},loading:m,open:n,openDialog:(v,h)=>{oe(w(v,h))},shardKey:i,table:t}},ol=()=>{const l=j(6),[e,n]=D(null);let o;l[0]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{n(null)},l[0]=o):o=l[0];const t=o,[r,i]=D(null);let a;l[1]===Symbol.for("react.memo_cache_sentinel")?(a=(m,f)=>{i({column:m,value:f})},l[1]=a):a=l[1];const d=a;let s;l[2]===Symbol.for("react.memo_cache_sentinel")?(s=()=>{i(null)},l[2]=s):s=l[2];const g=s;let c;return l[3]!==r||l[4]!==e?(c={closeExpandedCell:g,closeInspect:t,expandedCell:r,inspecting:e,onExpandCell:d,onInspect:n},l[3]=r,l[4]=e,l[5]=c):c=l[5],c},ll=/(?:_creationtime|(?:^|[a-z])(?:time|at))$/iu,rl=(l,e)=>typeof e=="number"&&ll.test(l),al=l=>{const e=j(26),{column:n,onNavigate:o,target:t,value:r}=l;let i;e[0]!==o||e[1]!==t||e[2]!==r?(i=()=>{t!==void 0&&o(t,String(r))},e[0]=o,e[1]=t,e[2]=r,e[3]=i):i=e[3];const a=i;if(r==null){let g;return e[4]===Symbol.for("react.memo_cache_sentinel")?(g=u("span",{className:"italic text-muted-foreground",children:"null"}),e[4]=g):g=e[4],g}if(t!==void 0&&(typeof r=="string"||typeof r=="number")&&String(r)!==""){const g=`rd-ref-${n}`,c=`Open ${t} ${String(r)}`,m=String(r);let f;return e[5]!==a||e[6]!==g||e[7]!==c||e[8]!==m?(f=R("button",{"data-testid":g,onClick:a,title:c,type:"button",children:[m," ↗"]}),e[5]=a,e[6]=g,e[7]=c,e[8]=m,e[9]=f):f=e[9],f}if(rl(n,r)){const g=`rd-ts-${n}`;let c;e[10]!==r?(c=r.toString(),e[10]=r,e[11]=c):c=e[11];let m;e[12]!==r?(m=Xt(r),e[12]=r,e[13]=m):m=e[13];let f;return e[14]!==g||e[15]!==c||e[16]!==m?(f=u("span",{"data-testid":g,title:c,children:m}),e[14]=g,e[15]=c,e[16]=m,e[17]=f):f=e[17],f}if(typeof r=="object"){let g;e[18]!==r?(g=JSON.stringify(r,null,2),e[18]=r,e[19]=g):g=e[19];let c;return e[20]!==g?(c=u("pre",{className:"m-0 overflow-auto rounded-md bg-muted/50 p-2 text-xs",children:g}),e[20]=g,e[21]=c):c=e[21],c}let d;e[22]!==r?(d=Pe(r),e[22]=r,e[23]=d):d=e[23];let s;return e[24]!==d?(s=u("span",{children:d}),e[24]=d,e[25]=s):s=e[25],s},sl=l=>{const e=j(21),{columns:n,onClose:o,onNavigate:t,refs:r,row:i}=l;let a;e[0]!==o||e[1]!==t?(a=(b,p)=>{t(b,p),o()},e[0]=o,e[1]=t,e[2]=a):a=e[2];const d=a;let s;e[3]===Symbol.for("react.memo_cache_sentinel")?(s=u("h3",{className:"m-0 text-base text-foreground",children:"Row detail"}),e[3]=s):s=e[3];let g;e[4]!==o?(g=R("div",{className:"mb-3 flex items-center justify-between",children:[s,u("button",{"data-testid":"rd-close",onClick:o,type:"button",children:"Close"})]}),e[4]=o,e[5]=g):g=e[5];let c;if(e[6]!==n||e[7]!==d||e[8]!==r||e[9]!==i){let b;e[11]!==d||e[12]!==r||e[13]!==i?(b=p=>R("div",{className:"border-t border-border py-2 first:border-t-0","data-testid":`rd-field-${p}`,children:[u("dt",{className:"mb-0.5 text-xs font-semibold text-muted-foreground",children:p}),u("dd",{className:"m-0",children:u(al,{column:p,onNavigate:d,target:r?.[p],value:i[p]})})]},p),e[11]=d,e[12]=r,e[13]=i,e[14]=b):b=e[14],c=n.map(b),e[6]=n,e[7]=d,e[8]=r,e[9]=i,e[10]=c}else c=e[10];let m;e[15]!==c?(m=u("dl",{"data-testid":"rd-fields",children:c}),e[15]=c,e[16]=m):m=e[16];let f;return e[17]!==o||e[18]!==g||e[19]!==m?(f=R(yt,{label:"Row detail",onClose:o,panelTestId:"rd-panel",testId:"rd-overlay",variant:"drawer",children:[g,m]}),e[17]=o,e[18]=g,e[19]=m,e[20]=f):f=e[20],f},il=50,dl=l=>{const e=j(8),{active:n,onPick:o,shard:t}=l;let r;e[0]!==o||e[1]!==t?(r=()=>{o(t)},e[0]=o,e[1]=t,e[2]=r):r=e[2];const i=r,a=`w-full rounded px-2 py-0.5 text-left text-xs transition-colors hover:bg-accent ${n?"bg-accent font-medium":""}`,d=`shard-explorer-item-${t}`;let s;return e[3]!==i||e[4]!==t||e[5]!==a||e[6]!==d?(s=u("button",{className:a,"data-testid":d,onClick:i,type:"button",children:t}),e[3]=i,e[4]=t,e[5]=a,e[6]=d,e[7]=s):s=e[7],s},cl=({onFetchTables:l,onSelect:e})=>{const n=ce(),[o]=D(()=>xn()),[t,r]=D(!1),[i,a]=D(void 0),[d,s]=D(void 0),[g,c]=D(!1),[m,f]=D(void 0),b=De(0),p=()=>{r(h=>!h)},w=async h=>{e(h),a(h),s(void 0),f(void 0),c(!0),b.current+=1;const y=b.current;try{const C=await l(h);b.current===y&&s(C?.slice(0,il))}catch(C){b.current===y&&f(C.message)}b.current===y&&c(!1)},v=h=>{oe(w(h))};return o.length===0?null:R("div",{"data-testid":"shard-explorer",children:[R("button",{"aria-controls":"shard-explorer-panel","aria-expanded":t,className:"inline-flex items-center gap-1 rounded-md border border-border px-2 py-1 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"shard-explorer-toggle",onClick:p,type:"button",children:[n("Shards seen"),u("span",{"aria-hidden":"true",className:`ml-0.5 transition-transform ${t?"rotate-180":""}`,children:"▾"})]}),t&&R("div",{className:"mt-1 flex flex-col gap-1 rounded-md border border-border bg-popover p-2","data-testid":"shard-explorer-panel",id:"shard-explorer-panel",children:[u("p",{className:"text-xs text-muted-foreground","data-testid":"shard-explorer-hint",children:n("Recently visited shards — click to switch")}),u("ul",{className:"flex flex-col gap-0.5","data-testid":"shard-explorer-list",children:o.map(h=>u("li",{children:u(dl,{active:i===h,onPick:v,shard:h})},h))}),i!==void 0&&R("div",{className:"mt-1 border-t border-border pt-1","data-testid":"shard-explorer-summary",children:[u("p",{className:"mb-1 text-xs font-medium text-foreground","data-testid":"shard-explorer-summary-title",children:n("{shard} tables",{shard:i})}),g&&u("p",{className:"text-xs text-muted-foreground","data-testid":"shard-explorer-loading",children:n("Loading…")}),m!==void 0&&u("p",{className:"text-xs text-destructive","data-testid":"shard-explorer-error",role:"alert",children:m}),!g&&m===void 0&&d?.length===0&&u("p",{className:"text-xs text-muted-foreground","data-testid":"shard-explorer-empty",children:n("No tables in this shard.")}),!g&&m===void 0&&d!==void 0&&d.length>0&&u("ul",{className:"flex flex-col gap-0.5","data-testid":"shard-explorer-tables",children:d.map(h=>R("li",{className:"flex items-center justify-between text-xs",children:[u("span",{"data-testid":`shard-explorer-table-${h.name}`,children:h.name}),u("span",{className:"text-muted-foreground","data-testid":`shard-explorer-rowcount-${h.name}`,children:h.rowCount})]},h.name))})]})]})]})},ul="lunora-studio-back-relations",ml={},gl=50,bl=[],fl=he(Y.listTables),pl=l=>{const e=j(10),{onFetchShardTables:n,onShardChange:o,schemaSwitch:t,shardKey:r}=l;let i;e[0]!==o||e[1]!==r?(i=u(Zt,{onChange:o,testId:"db-shard-input",value:r}),e[0]=o,e[1]=r,e[2]=i):i=e[2];let a;e[3]!==n||e[4]!==o?(a=u(cl,{onFetchTables:n,onSelect:o}),e[3]=n,e[4]=o,e[5]=a):a=e[5];let d;return e[6]!==t||e[7]!==i||e[8]!==a?(d=R("div",{className:"flex shrink-0 flex-col items-stretch gap-2 border-b border-border p-3",children:[t,i,a]}),e[6]=t,e[7]=i,e[8]=a,e[9]=d):d=e[9],d},Vl=({editable:l=!1,globalTableNames:e,initialFilters:n,initialOrderBy:o,initialPins:t,initialSearch:r,initialShardKey:i,onNavigateToGlobal:a,onSelectTable:d,onViewChange:s,pageSize:g=gl,queryBar:c,schemaSwitch:m,tableParam:f})=>{const b=je(Y.describeTables,{},{shardKey:i??""}).data?.columnsByTable??ml,[p,w]=wt(ul,{}),v=tt(J=>{const U=new Set(p[J]);return ut(J,b).filter(fe=>U.has(st(fe)))},[p,b]),h=Jo({initialFilters:n,initialOrderBy:o,initialSearch:r,initialShardKey:i,onSelectTable:d,onViewChange:s,pageSize:g,resolveBackRelations:v,tableParam:f}),{cancelCellEdit:y,columns:C,currentView:N,editableColumn:P,editingCell:x,facetFilter:S,facets:k,loadTables:$,navigateToRef:T,onFiltersChange:M,page:_,pageError:L,previewRef:B,queryShardKey:F,selectedTable:I,selectTable:V,setShardKey:O,shardKey:z,stage:G,stagedValue:H,startCellEdit:ue,tables:le,tablesError:Z,toggleFacet:me}=h,re=Yt(z),ge=J=>{oe((async()=>{const U=await re.suggestFilter(J,I??"");U!==void 0&&M(U.map(fe=>{const pe=fe.value,Ee=typeof pe=="string"||typeof pe=="number"||typeof pe=="boolean"?String(pe):"";return{column:fe.column,operator:fe.operator,value:Ee}}))})())},ae=I===null?[]:ut(I,b),W=new Set(p[I??""]),q=[];for(const J of _?.rows??[]){const U=J._id??J.id;typeof U=="string"&&U!==""&&q.push(U)}const we=Ro(W,ae,q,F),be=J=>{w(U=>{const fe=I??"",pe=U[fe]??[];return{...U,[fe]:pe.includes(J)?pe.filter(Ee=>Ee!==J):[...pe,J]}})},Q=Qo({columns:C,initialPins:t,selectedTable:I}),te=ol(),{closeExpandedCell:se,closeInspect:ie,expandedCell:X,inspecting:K,onExpandCell:ye}=te,Se=Ke(),Ne=async J=>await Se.query(fl,{},de(J)),xe=()=>{I!==null&&V(I)},{closeDialog:Ce,columnMeta:ne,fkPools:Ie,insertBatch:Te,open:Oe,openDialog:Fe}=nl(xe),He=()=>{I!==null&&Fe(I,z)},Qe=J=>Te(J,Ce),Ae=(J,U)=>{if(a!==void 0&&e?.has(J)===!0){a(J,U);return}T(J,U)},We=c?.onSaveQuery,Ue=J=>{We?.(J,N)},Le={cancelEdit:y,editable:l,editableColumn:P,editingCell:x,onExpandCell:ye,stage:G,stagedValue:H,startEdit:ue},Be={columns:_?.refs,onNavigate:Ae,onPreview:B};return R("div",{className:"flex h-full min-w-0","data-testid":"lunora-data-browser",children:[u(fn,{header:u(pl,{onFetchShardTables:Ne,onShardChange:O,schemaSwitch:m,shardKey:z}),onReload:$,onSelect:V,prefix:"db",selected:I,tables:le??bl}),R("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[Z!==null&&u("p",{className:"shrink-0 border-b border-border px-4 py-2 text-sm text-destructive","data-testid":"db-tables-error",role:"alert",children:Z}),_===null&&L===null&&u("div",{className:"flex flex-1 items-center justify-center p-6",children:u("p",{className:"text-sm text-muted-foreground",children:"Select a table to browse its rows."})}),L!==null&&u("p",{className:"shrink-0 border-b border-border px-4 py-2 text-sm text-destructive","data-testid":"db-page-error",role:"alert",children:L}),_!==null&&u(yo,{assistant:re,backRelations:{available:ae,counts:we,enabled:W,onToggle:be},browser:h,edit:Le,editable:l,onAskAiFilter:ge,onInspect:te.onInspect,onOpenGenerateRows:He,onSaveQuery:Ue,page:_,preferences:Q,queryBar:c,references:Be})]}),_!==null&&u(pn,{columns:C,facets:k,onFacetFilter:S,onToggleFacet:me}),K!==null&&_!==null&&u(sl,{columns:_.columns,onClose:ie,onNavigate:Ae,refs:_.refs,row:K}),X!==null&&u(mn,{column:X.column,onClose:se,value:X.value}),Oe&&I!==null&&ne!==void 0&&u(_o,{columns:ne,fkPools:Ie,onClose:Ce,onInsertRows:Qe,table:I})]})};export{Vl as DataBrowser};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useLunora as oe}from"@lunora/react";import{useState as L,useRef as G,useEffect as B}from"react";import{O as I}from"./use-admin-query-QJ-ibl5u.js";import{useAutoRefresh as ne}from"./DEFAULT_AUTO_REFRESH_MS-BCC8_4BQ.js";import{_ as ae,i as se,u as ie,a as ce,$ as de}from"./table-list-sidebar-BRv3hTLX.js";import{useT as J}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{b as ue}from"./cf-links-Dmg86v1D.js";import{c as A}from"react/compiler-runtime";import{d as me,m as U,f as fe,n as pe,p as ge,u as he}from"./table-DdJBrClo.js";import{k as be,g as xe}from"./data-grid-DcxyIXwG.js";import{jsx as r,jsxs as $}from"react/jsx-runtime";import{E as ve}from"./empty-state-Cg7t_8qu.js";const Ne=(t,e)=>{const a=t._id;return typeof a=="string"||typeof a=="number"?String(a):`row-${e.toString()}`},q=t=>t==null?"∅":t===""?"(empty)":typeof t=="object"?JSON.stringify(t):String(t),we=t=>{const e=A(33),{filters:a,onChangePageSize:f,onJumpToPage:i,onNext:u,onPrevious:s,onRemoveFilter:F,page:o,pageSize:b,pagination:x}=t,C=J(),{hasNext:v,hasPrevious:k,rangeEnd:p,rangeStart:R,total:_}=x;let N;e[0]!==a||e[1]!==F||e[2]!==C?(N=a.length>0&&r("div",{className:"flex shrink-0 flex-wrap items-center gap-1.5 border-b border-border px-4 py-2 text-xs","data-testid":"gdb-filters",children:a.map((d,y)=>$("span",{className:"inline-flex items-center gap-1 rounded border border-border bg-muted px-1.5 py-0.5","data-testid":"gdb-filter-chip",children:[r("span",{className:"font-medium text-foreground",children:d.column}),r("span",{className:"text-muted-foreground",children:"="}),r("span",{className:"font-mono text-foreground",children:q(d.value)}),r("button",{"aria-label":C("Remove filter"),className:"ml-0.5 text-muted-foreground hover:text-foreground","data-testid":"gdb-filter-remove",onClick:()=>{F(y)},type:"button",children:"✕"})]},`${d.column}:${q(d.value)}`))}),e[0]=a,e[1]=F,e[2]=C,e[3]=N):N=e[3];let w;e[4]!==o.columns?(w=o.columns.map(Se),e[4]=o.columns,e[5]=w):w=e[5];let m;e[6]!==w?(m=r(me,{children:r(U,{children:w})}),e[6]=w,e[7]=m):m=e[7];let c;if(e[8]!==o.columns||e[9]!==o.rows){let d;e[11]!==o.columns?(d=(y,E)=>r(U,{"data-testid":"gdb-row",children:o.columns.map(P=>r(he,{className:"max-w-xs truncate font-mono text-xs",children:r(xe,{value:y[P]})},P))},Ne(y,E)),e[11]=o.columns,e[12]=d):d=e[12],c=o.rows.map(d),e[8]=o.columns,e[9]=o.rows,e[10]=c}else c=e[10];let h;e[13]!==c?(h=r(fe,{children:c}),e[13]=c,e[14]=h):h=e[14];let g;e[15]!==m||e[16]!==h?(g=r(be,{layout:"fill",children:r("div",{className:"min-h-0 flex-1 overflow-auto",children:$(pe,{"data-testid":"gdb-rows",children:[m,h]})})}),e[15]=m,e[16]=h,e[17]=g):g=e[17];let n;e[18]!==v||e[19]!==k||e[20]!==f||e[21]!==i||e[22]!==u||e[23]!==s||e[24]!==b||e[25]!==p||e[26]!==R||e[27]!==_?(n=r("div",{className:"flex shrink-0 items-center border-t border-border px-4 py-2",children:r(ae,{hasNext:v,hasPrevious:k,onJumpToPage:i,onNext:u,onPageSizeChange:f,onPrevious:s,pageSize:b,prefix:"gdb",rangeEnd:p,rangeStart:R,total:_})}),e[18]=v,e[19]=k,e[20]=f,e[21]=i,e[22]=u,e[23]=s,e[24]=b,e[25]=p,e[26]=R,e[27]=_,e[28]=n):n=e[28];let S;return e[29]!==N||e[30]!==g||e[31]!==n?(S=$("div",{className:"flex min-h-0 flex-1 flex-col","data-testid":"gdb-page",children:[N,g,n]}),e[29]=N,e[30]=g,e[31]=n,e[32]=S):S=e[32],S};function Se(t){return r(ge,{children:t},t)}const ye=()=>{const t=A(8),e=J();let a;t[0]!==e?(a=e("Tables marked .global() (D1-backed, region-replicated) will appear here."),t[0]=e,t[1]=a):a=t[1];let f;t[2]===Symbol.for("react.memo_cache_sentinel")?(f=$("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[r("circle",{cx:"12",cy:"12",r:"9"}),r("path",{d:"M3 12h18M12 3a14 14 0 0 1 0 18 14 14 0 0 1 0-18Z"})]}),t[2]=f):f=t[2];let i;t[3]!==e?(i=e("No global tables."),t[3]=e,t[4]=i):i=t[4];let u;return t[5]!==a||t[6]!==i?(u=r("div",{className:"flex flex-1 items-center justify-center p-6",children:r(ve,{description:a,icon:f,testId:"gdb-empty",title:i})}),t[5]=a,t[6]=i,t[7]=u):u=t[7],u},$e=50,ke=[],Pe=[],De=({initialTable:t,onSelectTable:e,pageSize:a=$e,schemaSwitch:f}={})=>{const i=oe(),u=J(),[s,F]=L(t??null),[o,b]=L(0),[x,C]=L(a),[v,k]=L([]),p=se(v),{clearFacets:R,facets:_,refetchFacets:N,toggleFacet:w}=ie(),m=I(["lunora-global-tables"],()=>i.listGlobalTables()),c=m.data??null,h=m.error,g=I(["lunora-global-page",s??"",o,x,JSON.stringify(v)],()=>i.readGlobalTablePage({filters:v,limit:x,offset:o,table:s??""}),{enabled:s!==null,keepPreviousData:!1}),n=g.data??null,S=g.error,d=(l,T)=>z=>i.facetGlobalColumn({column:z,filters:T,table:l}),y=(l,T)=>{N(d(l,T))};ne(()=>{m.refetch(),s!==null&&(g.refetch(),y(s,p.current))},!0);const E=G(void 0),P=l=>{F(l),E.current=l,k([]),p.current=[],R(),b(0),e?.(l)},W=l=>{w(l,s===null?null:d(s,p.current))},M=l=>{k(l),p.current=l,b(0),s!==null&&y(s,l)},Z=(l,T)=>{M([...p.current.filter(z=>z.column!==l),{column:l,value:T}])},H=l=>{M(p.current.filter((T,z)=>z!==l))},O=G(P);B(()=>{O.current=P}),B(()=>{if(t===void 0||t===""||E.current===t)return;E.current=t;const l=t;queueMicrotask(()=>{O.current(l)})},[t]);const j=l=>{s!==null&&b(Math.max(0,l))},D=n?.total??0,K=o>0,Q=n!==null&&o+n.rows.length<D,V=n===null||n.rows.length===0?0:o+1,X=n===null?0:o+n.rows.length,Y=()=>{m.refetch()},ee=()=>{j(o-x)},te=()=>{j(o+x)},re=l=>{j(Math.max(0,(l-1)*x))},le=l=>{C(l),b(0)};return $("div",{className:"flex h-full min-w-0","data-testid":"lunora-global-data-browser",children:[r(ce,{header:$("div",{className:"flex shrink-0 flex-col items-stretch gap-2 border-b border-border p-3",children:[f,r("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"gdb-cf-link",href:ue,rel:"noreferrer",target:"_blank",children:u("Open in Cloudflare")})]}),onReload:Y,onSelect:P,prefix:"gdb",selected:s,tables:c??ke}),$("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[h!==null&&r("p",{className:"shrink-0 border-b border-border px-4 py-2 text-sm text-destructive","data-testid":"gdb-tables-error",role:"alert",children:h}),c!==null&&c.length===0&&r(ye,{}),S!==null&&r("p",{className:"shrink-0 border-b border-border px-4 py-2 text-sm text-destructive","data-testid":"gdb-page-error",role:"alert",children:S}),c!==null&&c.length>0&&n===null&&S===null&&r("div",{className:"flex flex-1 items-center justify-center p-6",children:r("p",{className:"text-sm text-muted-foreground",children:u("Select a table to browse its rows.")})}),n!==null&&r(we,{filters:v,onChangePageSize:le,onJumpToPage:re,onNext:te,onPrevious:ee,onRemoveFilter:H,page:n,pageSize:x,pagination:{hasNext:Q,hasPrevious:K,rangeEnd:X,rangeStart:V,total:D}})]}),r(de,{columns:n?.columns??Pe,facets:_,onFacetFilter:Z,onToggleFacet:W})]})};export{De as GlobalDataBrowser};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"react/compiler-runtime";import"@tanstack/react-router";import"react";import"./badge-BbuuAio7.js";import"./card-CIDGUN6K.js";import"./empty-state-Cg7t_8qu.js";import"./use-admin-query-QJ-ibl5u.js";import"./DEFAULT_LOCALE-BZ4NojpD.js";import"./ADMIN_FUNCTIONS-
|
|
1
|
+
import"react/compiler-runtime";import"@tanstack/react-router";import"react";import"./badge-BbuuAio7.js";import"./card-CIDGUN6K.js";import"./empty-state-Cg7t_8qu.js";import"./use-admin-query-QJ-ibl5u.js";import"./DEFAULT_LOCALE-BZ4NojpD.js";import"./ADMIN_FUNCTIONS-CZESgd10.js";import"./internal-BSIsQVC6.js";import"./utils-bhneXptQ.js";import"./DEFAULT_INSIGHT_THRESHOLDS-B-hcFVoi.js";import{H as b}from"./home-panel-B60-5YfI.js";import"react/jsx-runtime";export{b as HomePanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as $e}from"react/compiler-runtime";import{useLunora as ke}from"@lunora/react";import{useState as u,useEffect as Re}from"react";import{ConfirmButton as Ce}from"./ConfirmButton-CTL3f3kr.js";import{E as _e}from"./error-alert-t6cpEi0z.js";import{L as Ee}from"./live-status-CmuRLFKf.js";import{ShardInput as Le}from"./ShardInput-BVn2iCU0.js";import{g as Me}from"./badge-BbuuAio7.js";import{u as Ie}from"./button-BkCrNcAs.js";import{c as De,u as Ae}from"./card-CIDGUN6K.js";import{E as je}from"./empty-state-Cg7t_8qu.js";import{u as Fe}from"./input-JHu63lTv.js";import{p as ue}from"./label-6uP1obNF.js";import{n as Te,d as Be,m as he,p as h,f as Ke,u as p}from"./table-DdJBrClo.js";import{N as Oe}from"./use-admin-query-QJ-ibl5u.js";import qe from"./useDebounced-Ihdiid_k.js";import{useT as ze}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{ADMIN_FUNCTIONS as pe}from"./ADMIN_FUNCTIONS-
|
|
1
|
+
import{c as $e}from"react/compiler-runtime";import{useLunora as ke}from"@lunora/react";import{useState as u,useEffect as Re}from"react";import{ConfirmButton as Ce}from"./ConfirmButton-CTL3f3kr.js";import{E as _e}from"./error-alert-t6cpEi0z.js";import{L as Ee}from"./live-status-CmuRLFKf.js";import{ShardInput as Le}from"./ShardInput-BVn2iCU0.js";import{g as Me}from"./badge-BbuuAio7.js";import{u as Ie}from"./button-BkCrNcAs.js";import{c as De,u as Ae}from"./card-CIDGUN6K.js";import{E as je}from"./empty-state-Cg7t_8qu.js";import{u as Fe}from"./input-JHu63lTv.js";import{p as ue}from"./label-6uP1obNF.js";import{n as Te,d as Be,m as he,p as h,f as Ke,u as p}from"./table-DdJBrClo.js";import{N as Oe}from"./use-admin-query-QJ-ibl5u.js";import qe from"./useDebounced-Ihdiid_k.js";import{useT as ze}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{ADMIN_FUNCTIONS as pe}from"./ADMIN_FUNCTIONS-CZESgd10.js";import{i as Je,f as Pe,d as Ue,b as Ve,g as We}from"./internal-BSIsQVC6.js";import{r as Ge}from"./shard-history-DMEW5VBE.js";import{jsx as t,jsxs as o}from"react/jsx-runtime";const He=We(pe.runMigration),vr=a=>{const e=$e(99),{initialShardKey:ge}=a,ie=ke(),r=ze(),[i,fe]=u(ge??""),[g,be]=u(""),[f,ve]=u("up"),[l,xe]=u(!0),[b,ce]=u(!1),[c,ae]=u(null),[J,ne]=u(null);let P;e[0]!==i?(P=i.trim(),e[0]=i,e[1]=P):P=e[1];const s=qe(P,400);let U;e[2]!==i?(U=i.trim(),e[2]=i,e[3]=U):U=e[3];const V=U===s;let W;e[4]===Symbol.for("react.memo_cache_sentinel")?(W={},e[4]=W):W=e[4];let G;e[5]!==s?(G={live:!0,shardKey:s},e[5]=s,e[6]=G):G=e[6];const n=Oe(pe.migrationStatus,W,G),d=n.data?.migrations??null,oe=n.error,{errorSource:le,liveError:de}=n;let H,Q;e[7]!==s||e[8]!==n.data?(H=()=>{n.data!==void 0&&Ge(s)},Q=[n.data,s],e[7]=s,e[8]=n.data,e[9]=H,e[10]=Q):(H=e[9],Q=e[10]),Re(H,Q);let X;if(e[11]!==ie||e[12]!==f||e[13]!==l||e[14]!==g||e[15]!==i||e[16]!==n||e[17]!==r){const m=async()=>{const me=g.trim();if(me===""){ne(r("Enter a migration id")),ae(null);return}ce(!0),ne(null);try{const se=await ie.query(He,{direction:f,dryRun:l,id:me},Ue(i));ae(se),n.refetch()}catch(se){const Se=se;ae(null),ne(Ve(Se))}ce(!1)};X=()=>{Pe(m())},e[11]=ie,e[12]=f,e[13]=l,e[14]=g,e[15]=i,e[16]=n,e[17]=r,e[18]=X}else X=e[18];const Y=X;let Z;e[19]===Symbol.for("react.memo_cache_sentinel")?(Z=m=>{be(m.target.value)},e[19]=Z):Z=e[19];const ye=Z;let ee;e[20]===Symbol.for("react.memo_cache_sentinel")?(ee=m=>{ve(m.target.value==="down"?"down":"up")},e[20]=ee):ee=e[20];const Ne=ee;let re;e[21]===Symbol.for("react.memo_cache_sentinel")?(re=m=>{xe(m.target.checked)},e[21]=re):re=e[21];const we=re;let v;e[22]!==i?(v=t(Le,{onChange:fe,testId:"mg-shard-input",value:i}),e[22]=i,e[23]=v):v=e[23];let x;e[24]!==de?(x=t(Ee,{message:de,prefix:"mg"}),e[24]=de,e[25]=x):x=e[25];let y;e[26]!==v||e[27]!==x?(y=o("div",{className:"flex flex-wrap items-center gap-2",children:[v,x]}),e[26]=v,e[27]=x,e[28]=y):y=e[28];let N;e[29]!==oe||e[30]!==le?(N=oe!==null&&t(_e,{error:le,testId:"mg-status-error"}),e[29]=oe,e[30]=le,e[31]=N):N=e[31];let w;e[32]!==d||e[33]!==r?(w=d!==null&&d.length===0&&t(je,{description:r("Data migrations you run against this shard will be tracked here."),icon:t("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:t("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"})}),testId:"mg-empty",title:r("No migrations have run on this shard.")}),e[32]=d,e[33]=r,e[34]=w):w=e[34];let S;e[35]!==d||e[36]!==r?(S=d!==null&&d.length>0&&t(De,{className:"overflow-hidden py-0",children:t(Ae,{className:"px-0",children:o(Te,{"data-testid":"mg-table",children:[t(Be,{children:o(he,{children:[t(h,{children:r("id")}),t(h,{children:r("direction")}),t(h,{children:r("status")}),t(h,{children:r("processed")}),t(h,{children:r("changed")}),t(h,{children:r("updated")}),t(h,{children:r("error")})]})}),t(Ke,{children:d.map(Qe)})]})})}),e[35]=d,e[36]=r,e[37]=S):S=e[37];let $;e[38]!==r?($=r("Run migration"),e[38]=r,e[39]=$):$=e[39];let k;e[40]!==$?(k=t(ue,{children:$}),e[40]=$,e[41]=k):k=e[41];let R;e[42]!==r?(R=r("Migration id"),e[42]=r,e[43]=R):R=e[43];let C;e[44]!==r?(C=r("migration id"),e[44]=r,e[45]=C):C=e[45];let _;e[46]!==g||e[47]!==R||e[48]!==C?(_=t(Fe,{"aria-label":R,className:"w-auto","data-testid":"mg-id-input",onChange:ye,placeholder:C,value:g}),e[46]=g,e[47]=R,e[48]=C,e[49]=_):_=e[49];let E;e[50]!==r?(E=r("Direction"),e[50]=r,e[51]=E):E=e[51];let L;e[52]!==r?(L=r("up"),e[52]=r,e[53]=L):L=e[53];let M;e[54]!==L?(M=t("option",{value:"up",children:L}),e[54]=L,e[55]=M):M=e[55];let I;e[56]!==r?(I=r("down"),e[56]=r,e[57]=I):I=e[57];let D;e[58]!==I?(D=t("option",{value:"down",children:I}),e[58]=I,e[59]=D):D=e[59];let A;e[60]!==f||e[61]!==E||e[62]!==M||e[63]!==D?(A=o("select",{"aria-label":E,className:"flex h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs transition-colors outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 dark:bg-input/30","data-testid":"mg-direction",onChange:Ne,value:f,children:[M,D]}),e[60]=f,e[61]=E,e[62]=M,e[63]=D,e[64]=A):A=e[64];let j;e[65]!==l?(j=t("input",{checked:l,className:"size-4 accent-primary","data-testid":"mg-dry-run",id:"mg-dry-run",onChange:we,type:"checkbox"}),e[65]=l,e[66]=j):j=e[66];let F;e[67]!==r?(F=r("Dry run"),e[67]=r,e[68]=F):F=e[68];let T;e[69]!==j||e[70]!==F?(T=o(ue,{className:"flex items-center gap-1.5",htmlFor:"mg-dry-run",children:[j,F]}),e[69]=j,e[70]=F,e[71]=T):T=e[71];let B;e[72]!==l||e[73]!==Y||e[74]!==b||e[75]!==V||e[76]!==r?(B=l?t(Ie,{"data-testid":"mg-run",disabled:b||!V,onClick:Y,type:"button",children:r(b?"Running…":"Run")}):t(Ce,{confirmLabel:r(b?"Running…":"Run migration?"),disabled:b||!V,onConfirm:Y,testId:"mg-run",children:r("Run")}),e[72]=l,e[73]=Y,e[74]=b,e[75]=V,e[76]=r,e[77]=B):B=e[77];let K;e[78]!==_||e[79]!==A||e[80]!==T||e[81]!==B?(K=o("div",{className:"flex flex-wrap items-center gap-2",children:[_,A,T,B]}),e[78]=_,e[79]=A,e[80]=T,e[81]=B,e[82]=K):K=e[82];let O;e[83]!==k||e[84]!==K?(O=o("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs",children:[k,K]}),e[83]=k,e[84]=K,e[85]=O):O=e[85];let q;e[86]!==J?(q=J!==null&&t("pre",{className:"text-sm text-destructive whitespace-pre-wrap","data-testid":"mg-run-error",role:"alert",children:J}),e[86]=J,e[87]=q):q=e[87];let z;e[88]!==c||e[89]!==r?(z=c!==null&&o("p",{className:"text-sm text-muted-foreground","data-testid":"mg-run-result",children:[c.dryRun?r("Dry run: "):"",r("{status} — processed",{status:c.status}),c.processed,r(", changed"),c.changed]}),e[88]=c,e[89]=r,e[90]=z):z=e[90];let te;return e[91]!==y||e[92]!==N||e[93]!==w||e[94]!==S||e[95]!==O||e[96]!==q||e[97]!==z?(te=o("div",{className:"flex flex-col gap-3 pt-4","data-testid":"lunora-migrations",children:[y,N,w,S,O,q,z]}),e[91]=y,e[92]=N,e[93]=w,e[94]=S,e[95]=O,e[96]=q,e[97]=z,e[98]=te):te=e[98],te};function Qe(a){return o(he,{"data-testid":`mg-row-${a.id}`,children:[t(p,{children:a.id}),t(p,{children:a.direction}),t(p,{children:t(Me,{variant:"secondary",children:a.status})}),t(p,{children:a.processed}),t(p,{children:a.changed}),t(p,{children:Je(a.updatedAt)}),t(p,{children:a.error??""})]},a.id)}export{vr as MigrationsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"react/compiler-runtime";import"@tanstack/react-router";import"react";import{S as j}from"./studio-
|
|
1
|
+
import"react/compiler-runtime";import"@tanstack/react-router";import"react";import{S as j}from"./studio-CPuoAmjh.js";import"./ErrorBoundary-DvzYskH7.js";import"./operation-console-provider-BMJNtiyB.js";import"./badge-BbuuAio7.js";import"./input-JHu63lTv.js";import"./skeleton-C1wQ9M5t.js";import"./home-panel-B60-5YfI.js";import"./DEFAULT_LOCALE-BZ4NojpD.js";import"./StudioI18nProvider-CZ5h4nrV.js";import"./data-view-params-ClrV7XgF.js";import"./internal-BSIsQVC6.js";import"./utils-bhneXptQ.js";import"./CommandPalette--SQwfTW1.js";import"react/jsx-runtime";export{j as Studio};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as E}from"react/compiler-runtime";import{LunoraClient as z}from"@lunora/client";import{LunoraProvider as q}from"@lunora/react";import{useState as K,useEffect as U}from"react";import{ErrorBoundary as G}from"./ErrorBoundary-DvzYskH7.js";import{b as D,f as H,a as J,m as Q,S as V}from"./studio-
|
|
1
|
+
import{c as E}from"react/compiler-runtime";import{LunoraClient as z}from"@lunora/client";import{LunoraProvider as q}from"@lunora/react";import{useState as K,useEffect as U}from"react";import{ErrorBoundary as G}from"./ErrorBoundary-DvzYskH7.js";import{b as D,f as H,a as J,m as Q,S as V}from"./studio-CPuoAmjh.js";import X from"./useDebounced-Ihdiid_k.js";import{useT as M,createStudioI18n as Y}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{StudioI18nProvider as R}from"./StudioI18nProvider-CZ5h4nrV.js";import{r as Z}from"./internal-BSIsQVC6.js";import{h as j}from"./recording-client-DRAZEmzE.js";import F from"./STUDIO_ROOT_CLASS-C6MccdVk.js";import{a as B}from"./browser-storage-xjTyMKY0.js";import{c as W}from"./utils-bhneXptQ.js";import{u as ee}from"./button-BkCrNcAs.js";import{u as te}from"./input-JHu63lTv.js";import{jsx as b,jsxs as C}from"react/jsx-runtime";const O="lunora-studio-admin-token",oe=()=>{try{return B("session")?.getItem(O)??""}catch{return""}},ne=k=>{const e=B("session");if(e!==void 0)try{k===""?e.removeItem(O):e.setItem(O,k)}catch{}},re="/_lunora/admin/ws-token",le=k=>{const e=k;return typeof e?.token=="string"&&e.token.length>0&&typeof e.expiresAtMs=="number"},ae=k=>{const{adminToken:e,baseUrl:c}=k,o=k.fetchImpl??fetch;let n=c;for(;n.endsWith("/");)n=n.slice(0,-1);const s=`${n}${re}`;let t,r=!1,l;const m=async()=>{const f=await o(s,{headers:{authorization:`Bearer ${e}`},method:"POST"});if(f.status===404||f.status===405)return r=!0,e;if(!f.ok)throw new Error(`ws-token mint failed: ${String(f.status)}`);const a=await f.json().catch(()=>{});if(!le(a))throw new Error("ws-token mint failed: malformed response body");return t=a,a.token};return{getToken:async()=>r?e:t!==void 0&&t.expiresAtMs-1e4>Date.now()?t.token:(l??=m().finally(()=>{l=void 0}),l),invalidate:()=>{t=void 0}}},se=k=>{const e=E(42),{onSubmit:c}=k,o=M(),[n,s]=K("");let t;e[0]!==n?(t=n.trim(),e[0]=n,e[1]=t):t=e[1];const r=t;let l;e[2]!==c||e[3]!==r?(l=$=>{$.preventDefault(),r!==""&&c(r)},e[2]=c,e[3]=r,e[4]=l):l=e[4];const m=l;let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=b("div",{className:"h-10 w-10 text-foreground",children:b(H,{})}),e[5]=f):f=e[5];let a;e[6]!==o?(a=o("Connect to Lunora Studio"),e[6]=o,e[7]=a):a=e[7];let v;e[8]!==a?(v=b("h1",{className:"text-base font-semibold text-foreground",children:a}),e[8]=a,e[9]=v):v=e[9];let g;e[10]!==o?(g=o("Enter your admin token to access the studio."),e[10]=o,e[11]=g):g=e[11];let u;e[12]!==g?(u=b("p",{className:"text-[13px] text-muted-foreground",children:g}),e[12]=g,e[13]=u):u=e[13];let d;e[14]!==v||e[15]!==u?(d=C("div",{className:"flex flex-col items-center gap-3 text-center",children:[f,C("div",{className:"flex flex-col gap-1",children:[v,u]})]}),e[14]=v,e[15]=u,e[16]=d):d=e[16];let h;e[17]!==o?(h=o("admin token"),e[17]=o,e[18]=h):h=e[18];let i;e[19]!==h?(i=b("label",{className:"text-xs font-medium text-foreground",htmlFor:"lunora-studio-login-token",children:h}),e[19]=h,e[20]=i):i=e[20];let p;e[21]===Symbol.for("react.memo_cache_sentinel")?(p=$=>{s($.target.value)},e[21]=p):p=e[21];let x;e[22]!==n?(x=b(te,{autoComplete:"off",autoFocus:!0,"data-testid":"lunora-studio-login-token",id:"lunora-studio-login-token",onChange:p,placeholder:"LUNORA_ADMIN_TOKEN",type:"password",value:n}),e[22]=n,e[23]=x):x=e[23];let y;e[24]!==o?(y=o("From your worker's LUNORA_ADMIN_TOKEN — your project's .dev.vars in dev, or a deployment secret in production."),e[24]=o,e[25]=y):y=e[25];let I;e[26]!==y?(I=b("p",{className:"text-[11px] text-muted-foreground",children:y}),e[26]=y,e[27]=I):I=e[27];let S;e[28]!==i||e[29]!==x||e[30]!==I?(S=C("div",{className:"flex flex-col gap-1.5",children:[i,x,I]}),e[28]=i,e[29]=x,e[30]=I,e[31]=S):S=e[31];const _=r==="";let T;e[32]!==o?(T=o("Connect"),e[32]=o,e[33]=T):T=e[33];let w;e[34]!==_||e[35]!==T?(w=b(ee,{"data-testid":"lunora-studio-login-submit",disabled:_,type:"submit",children:T}),e[34]=_,e[35]=T,e[36]=w):w=e[36];let N;return e[37]!==m||e[38]!==S||e[39]!==w||e[40]!==d?(N=C("form",{className:"flex w-full max-w-sm flex-col gap-5 rounded-xl border border-border bg-card p-7 shadow-lg","data-testid":"lunora-studio-login",onSubmit:m,children:[d,S,w]}),e[37]=m,e[38]=S,e[39]=w,e[40]=d,e[41]=N):N=e[41],N},ie=k=>{const e=E(10),{i18n:c,onSubmit:o}=k,{resolvedTheme:n}=D(),s=n==="dark"&&"dark";let t;e[0]!==s?(t=W(F,s,"flex h-dvh items-center justify-center bg-sidebar p-6 text-sm text-foreground"),e[0]=s,e[1]=t):t=e[1];let r;e[2]!==o?(r=b(se,{onSubmit:o}),e[2]=o,e[3]=r):r=e[3];let l;e[4]!==c||e[5]!==r?(l=b(R,{i18n:c,children:r}),e[4]=c,e[5]=r,e[6]=l):l=e[6];let m;return e[7]!==t||e[8]!==l?(m=b("div",{className:t,"data-testid":"lunora-studio-login-root",children:l}),e[7]=t,e[8]=l,e[9]=m):m=e[9],m},de=k=>{const e=E(23),{basePath:c,chrome:o,studio:n}=k,s=M();let t;e[0]!==s?(t=s("Studio failed"),e[0]=s,e[1]=t):t=e[1];let r;e[2]!==s?(r=s("Studio"),e[2]=s,e[3]=r):r=e[3];let l;e[4]!==s?(l=s("Try again"),e[4]=s,e[5]=l):l=e[5];const m=n?.dataEditable,f=n?.functions,a=n?.initialShardKey,v=n?.openApiSpec,g=n?.openRpcSpec,u=n?.runAsIdentity,d=n?.scheduledCancel,h=n?.scheduledLoad,i=n?.schemaEditable;let p;e[6]!==c||e[7]!==o||e[8]!==d||e[9]!==h||e[10]!==i||e[11]!==m||e[12]!==f||e[13]!==a||e[14]!==v||e[15]!==g||e[16]!==u?(p=b(V,{basePath:c,chrome:o,dataEditable:m,functions:f,initialShardKey:a,openApiSpec:v,openRpcSpec:g,runAsIdentity:u,scheduledCancel:d,scheduledLoad:h,schemaEditable:i}),e[6]=c,e[7]=o,e[8]=d,e[9]=h,e[10]=i,e[11]=m,e[12]=f,e[13]=a,e[14]=v,e[15]=g,e[16]=u,e[17]=p):p=e[17];let x;return e[18]!==t||e[19]!==p||e[20]!==r||e[21]!==l?(x=b(G,{fallbackTitle:t,label:r,retryLabel:l,children:p}),e[18]=t,e[19]=p,e[20]=r,e[21]=l,e[22]=x):x=e[22],x},ce=k=>{const e=E(20),{basePath:c,clearToken:o,client:n,i18n:s,onTokenChange:t,rulesInstalled:r,studio:l,token:m}=k,{resolvedTheme:f}=D();let a;e[0]!==o||e[1]!==t||e[2]!==r||e[3]!==m?(a={clearToken:o,onTokenChange:t,rulesInstalled:r,token:m},e[0]=o,e[1]=t,e[2]=r,e[3]=m,e[4]=a):a=e[4];const v=a,g=f==="dark"&&"dark";let u;e[5]!==g?(u=W(F,g,"flex h-dvh flex-col overflow-hidden bg-sidebar text-sm text-foreground"),e[5]=g,e[6]=u):u=e[6];let d;e[7]!==c||e[8]!==v||e[9]!==l?(d=b(Q,{children:b(de,{basePath:c,chrome:v,studio:l})}),e[7]=c,e[8]=v,e[9]=l,e[10]=d):d=e[10];let h;e[11]!==s||e[12]!==d?(h=b(R,{i18n:s,children:d}),e[11]=s,e[12]=d,e[13]=h):h=e[13];let i;e[14]!==n||e[15]!==h?(i=b(q,{client:n,children:h}),e[14]=n,e[15]=h,e[16]=i):i=e[16];let p;return e[17]!==u||e[18]!==i?(p=b("div",{className:u,"data-testid":"lunora-studio-app",children:i}),e[17]=u,e[18]=i,e[19]=p):p=e[19],p},Ae=k=>{const e=E(27);let c;e[0]!==k?(c=k===void 0?{}:k,e[0]=k,e[1]=c):c=e[1];const{adminToken:o,basePath:n,baseUrl:s,client:t,rulesInstalled:r,studio:l,locale:m}=c;let f;e[2]!==o?(f=()=>o??oe(),e[2]=o,e[3]=f):f=e[3];const[a,v]=K(f);let g,u;e[4]!==a?(g=()=>{ne(a)},u=[a],e[4]=a,e[5]=g,e[6]=u):(g=e[5],u=e[6]),U(g,u);const d=X(a,300);let h;e:{if(t!==void 0){let A;e[7]!==t?(A=j(t),e[7]=t,e[8]=A):A=e[8],h=A;break e}let $;if(e[9]!==s||e[10]!==d){const A=Z(s),P=d===""?void 0:ae({adminToken:d,baseUrl:A}),L=new z({url:A,...P===void 0?{}:{wsToken:P.getToken}});P!==void 0&&(L.setAuthToken(d),L.onTokenExpired(P.invalidate)),$=j(L),e[9]=s,e[10]=d,e[11]=$}else $=e[11];h=$}const i=h;let p,x;e[12]!==i||e[13]!==t?(p=()=>()=>{t===void 0&&i.close()},x=[i,t],e[12]=i,e[13]=t,e[14]=p,e[15]=x):(p=e[14],x=e[15]),U(p,x);let y;e[16]===Symbol.for("react.memo_cache_sentinel")?(y=$=>{v($.target.value)},e[16]=y):y=e[16];const I=y;let S;e[17]===Symbol.for("react.memo_cache_sentinel")?(S=()=>{v("")},e[17]=S):S=e[17];const _=S;let T;e[18]!==m?(T=Y(m),e[18]=m,e[19]=T):T=e[19];const w=T;let N;return e[20]!==n||e[21]!==i||e[22]!==w||e[23]!==r||e[24]!==l||e[25]!==a?(N=b(J,{children:a===""?b(ie,{i18n:w,onSubmit:v}):b(ce,{basePath:n,clearToken:_,client:i,i18n:w,onTokenChange:I,rulesInstalled:r,studio:l,token:a})}),e[20]=n,e[21]=i,e[22]=w,e[23]=r,e[24]=l,e[25]=a,e[26]=N):N=e[26],N};export{Ae as StudioApp};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const s="https://dash.cloudflare.com/?to=/:account",L=`${s}/workers-and-pages/observability`,a=`${s}/workers-and-pages`,R=`${s}/r2`,r=`${s}/workers/d1`,o=`${s}/workers/durable-objects`;export{
|
|
1
|
+
const s="https://dash.cloudflare.com/?to=/:account",L=`${s}/workers-and-pages/observability`,a=`${s}/workers-and-pages`,R=`${s}/r2`,r=`${s}/workers/d1`,o=`${s}/workers/durable-objects`;export{a as C,L as a,r as b,o as c,R as d};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{c as L}from"react/compiler-runtime";import{useNavigate as Qe}from"@tanstack/react-router";import{useState as Ee,useEffect as Fe,lazy as nt,Suspense as at}from"react";import{g as Ye}from"./badge-BbuuAio7.js";import{u as Ze,c as K}from"./card-CIDGUN6K.js";import{E as rt}from"./empty-state-Cg7t_8qu.js";import{N as _e}from"./use-admin-query-QJ-ibl5u.js";import{useT as I}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{ADMIN_FUNCTIONS as Ne}from"./ADMIN_FUNCTIONS-
|
|
1
|
+
import{c as L}from"react/compiler-runtime";import{useNavigate as Qe}from"@tanstack/react-router";import{useState as Ee,useEffect as Fe,lazy as nt,Suspense as at}from"react";import{g as Ye}from"./badge-BbuuAio7.js";import{u as Ze,c as K}from"./card-CIDGUN6K.js";import{E as rt}from"./empty-state-Cg7t_8qu.js";import{N as _e}from"./use-admin-query-QJ-ibl5u.js";import{useT as I}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{ADMIN_FUNCTIONS as Ne}from"./ADMIN_FUNCTIONS-CZESgd10.js";import{f as Se,d as st,g as ot,r as lt,c as it,k as ct}from"./internal-BSIsQVC6.js";import{c as Xe}from"./utils-bhneXptQ.js";import{deriveInsights as dt}from"./DEFAULT_INSIGHT_THRESHOLDS-B-hcFVoi.js";import{useLunora as et}from"@lunora/react";import{jsx as r,jsxs as h}from"react/jsx-runtime";import{u as We}from"./button-BkCrNcAs.js";const mt=ot(Ne.studioFeatures),tt={analytics:!0,auth:!0,containers:!0,flags:!0,kv:!0,mail:!0,notifications:!0,payments:!0,queues:!0,scheduler:!0,storage:!0,vectors:!0,workflows:!0},ut=t=>{if(t===null||typeof t!="object")return tt;const e=t,a=n=>typeof e[n]=="boolean"?e[n]:!0;return{analytics:a("analytics"),auth:a("auth"),containers:a("containers"),flags:a("flags"),kv:a("kv"),mail:a("mail"),notifications:a("notifications"),payments:a("payments"),queues:a("queues"),scheduler:a("scheduler"),storage:a("storage"),vectors:a("vectors"),workflows:a("workflows")}},pt=()=>{const t=L(3),e=et(),[a,n]=Ee(tt);let s,o;return t[0]!==e?(s=()=>{Se((async()=>{try{n(ut(await e.query(mt,{},st(""))))}catch{}})())},o=[e],t[0]=e,t[1]=s,t[2]=o):(s=t[1],o=t[2]),Fe(s,o),a},ft=()=>{const t=L(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.6,viewBox:"0 0 24 24",children:r("path",{d:"m9 6 6 6-6 6",strokeLinecap:"round",strokeLinejoin:"round"})}),t[0]=e):e=t[0],e},ht=t=>{const e=L(24),{group:a}=t,n=I(),s=Qe();let o;e[0]!==a.tab||e[1]!==s?(o=()=>{Se(s({to:`/${a.tab}`}))},e[0]=a.tab,e[1]=s,e[2]=o):o=e[2];const l=o,i=a.bindings.length;let c;e[3]!==a.label?(c=r("span",{className:"text-sm font-medium text-foreground",children:a.label}),e[3]=a.label,e[4]=c):c=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=r(ft,{}),e[5]=u):u=e[5];let d;e[6]!==c?(d=h("div",{className:"flex items-center justify-between",children:[c,u]}),e[6]=c,e[7]=d):d=e[7];let p;e[8]!==i||e[9]!==n?(p=i===1?n("1 binding"):n("{count} bindings",{count:i}),e[8]=i,e[9]=n,e[10]=p):p=e[10];let m;e[11]!==p?(m=r("span",{className:"text-xs text-muted-foreground",children:p}),e[11]=p,e[12]=m):m=e[12];let f;e[13]!==i||e[14]!==a.bindings?(f=i>0&&r("div",{className:"flex flex-wrap gap-1.5",children:a.bindings.map(bt)}),e[13]=i,e[14]=a.bindings,e[15]=f):f=e[15];let g;e[16]!==d||e[17]!==m||e[18]!==f?(g=h(Ze,{className:"flex flex-col gap-2 py-4",children:[d,m,f]}),e[16]=d,e[17]=m,e[18]=f,e[19]=g):g=e[19];let x;return e[20]!==a.testId||e[21]!==l||e[22]!==g?(x=r(K,{className:"cursor-pointer gap-0 py-0 transition-colors hover:bg-muted/40","data-testid":a.testId,onClick:l,children:g}),e[20]=a.testId,e[21]=l,e[22]=g,e[23]=x):x=e[23],x},Ue=["kv","files","vectors"],gt=(t,e)=>[...t.filter(a=>a.tab!==e.tab),e].toSorted((a,n)=>Ue.indexOf(a.tab)-Ue.indexOf(n.tab)),xt=()=>{const t=L(19),e=et(),a=pt(),n=I();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=[],t[0]=s):s=t[0];const[o,l]=Ee(s);let i,c;if(t[1]!==e||t[2]!==a.kv||t[3]!==a.storage||t[4]!==a.vectors||t[5]!==n?(i=()=>{const g={cancelled:!1},x=[{enabled:a.kv,label:n("KV Namespaces"),load:async()=>(await e.listKvNamespaces()).map(yt),tab:"kv",testId:"home-binding-kv"},{enabled:a.storage,label:n("R2 Buckets"),load:()=>e.listStorageBuckets(),tab:"files",testId:"home-binding-r2"},{enabled:a.vectors,label:n("Vectorize Indexes"),load:async()=>(await e.listVectorIndexes()).map(vt),tab:"vectors",testId:"home-binding-vectors"}];for(const b of x)b.enabled&&Se((async()=>{try{const y=await b.load();if(!g.cancelled){const S={bindings:y,label:b.label,tab:b.tab,testId:b.testId};l(M=>gt(M,S))}}catch{}})());return()=>{g.cancelled=!0}},c=[e,a.kv,a.storage,a.vectors,n],t[1]=e,t[2]=a.kv,t[3]=a.storage,t[4]=a.vectors,t[5]=n,t[6]=i,t[7]=c):(i=t[6],c=t[7]),Fe(i,c),o.length===0)return null;let u;t[8]!==n?(u=n("Bindings"),t[8]=n,t[9]=u):u=t[9];let d;t[10]!==u?(d=r("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:u}),t[10]=u,t[11]=d):d=t[11];let p;t[12]!==o?(p=o.map(Nt),t[12]=o,t[13]=p):p=t[13];let m;t[14]!==p?(m=r("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:p}),t[14]=p,t[15]=m):m=t[15];let f;return t[16]!==d||t[17]!==m?(f=h("section",{className:"flex flex-col gap-3","data-testid":"home-bindings",children:[d,m]}),t[16]=d,t[17]=m,t[18]=f):f=t[18],f};function bt(t){return r(Ye,{variant:"secondary",children:t},t)}function yt(t){return t.binding}function vt(t){return t.name}function Nt(t){return r(ht,{group:t},t.tab)}const _t=[{name:"lunora_list_functions",summary:"list every query, mutation, and action with its path"},{name:"lunora_list_tables",summary:"list the schema's tables"},{name:"lunora_get_function_schema",summary:"read a function's argument JSON Schema before calling it"},{name:"lunora_run_query",summary:"run a read-only query"},{name:"lunora_run_mutation",summary:"run a mutation — writes; only when LUNORA_MCP_ALLOW_WRITES is set"},{name:"lunora_run_action",summary:"run an action — writes/effects; only when LUNORA_MCP_ALLOW_WRITES is set"}],St=t=>JSON.stringify({mcpServers:{lunora:{args:["-y","@lunora/mcp"],command:"npx",env:{LUNORA_ADMIN_TOKEN:"<your-admin-token>",LUNORA_URL:t}}}},null,2),kt=t=>{const e=_t.map(a=>`- ${a.name} — ${a.summary}`).join(`
|
|
2
2
|
`);return[`You have a Lunora MCP server connected to the deployment at ${t}.`,"It exposes this backend's functions and schema so you can inspect and operate it:",e,"",`Start by calling lunora_list_functions and lunora_list_tables to learn what exists, then lunora_get_function_schema before any run call. The full HTTP API is also documented at ${t}/_lunora/admin/openapi (that endpoint needs the same admin token the MCP server is configured with).`].join(`
|
|
3
3
|
`)},wt=1500,$t=()=>{const t=L(35),e=I();let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=lt(),t[0]=a):a=t[0];const n=a,[s,o]=Ee(null);let l,i;t[1]!==s?(l=()=>{if(s===null)return;const A=globalThis.setTimeout(()=>{o(null)},wt);return()=>{globalThis.clearTimeout(A)}},i=[s],t[1]=s,t[2]=l,t[3]=i):(l=t[2],i=t[3]),Fe(l,i);let c;t[4]===Symbol.for("react.memo_cache_sentinel")?(c=(A,C)=>{it(C)&&o(A)},t[4]=c):c=t[4];const u=c;let d;t[5]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{u("config",St(n))},t[5]=d):d=t[5];const p=d;let m;t[6]===Symbol.for("react.memo_cache_sentinel")?(m=()=>{u("prompt",kt(n))},t[6]=m):m=t[6];const f=m;let g;t[7]!==e?(g=e("Connect an AI agent"),t[7]=e,t[8]=g):g=t[8];let x;t[9]!==g?(x=r("span",{className:"text-sm font-medium text-foreground",children:g}),t[9]=g,t[10]=x):x=t[10];let b;t[11]!==e?(b=e("Drive this deployment from an AI agent over the Model Context Protocol — it can list functions and tables, read schemas, and run read-only queries. Writes stay off unless you opt in."),t[11]=e,t[12]=b):b=t[12];let y;t[13]!==b?(y=r("span",{className:"text-xs text-muted-foreground",children:b}),t[13]=b,t[14]=y):y=t[14];let S;t[15]!==x||t[16]!==y?(S=h("div",{className:"flex flex-col gap-1.5 p-4",children:[x,y]}),t[15]=x,t[16]=y,t[17]=S):S=t[17];let M;t[18]===Symbol.for("react.memo_cache_sentinel")?(M=r("code",{className:"font-mono text-xs text-muted-foreground","data-testid":"home-connect-agent-command",children:"npx -y @lunora/mcp"}),t[18]=M):M=t[18];let k;t[19]!==s||t[20]!==e?(k=e(s==="config"?"Copied":"Copy MCP config"),t[19]=s,t[20]=e,t[21]=k):k=t[21];let v;t[22]!==k?(v=r(We,{"data-testid":"home-connect-agent-copy-config",onClick:p,size:"xs",variant:"outline",children:k}),t[22]=k,t[23]=v):v=t[23];let w;t[24]!==s||t[25]!==e?(w=e(s==="prompt"?"Copied":"Copy agent prompt"),t[24]=s,t[25]=e,t[26]=w):w=t[26];let $;t[27]!==w?($=r(We,{"data-testid":"home-connect-agent-copy-prompt",onClick:f,size:"xs",variant:"outline",children:w}),t[27]=w,t[28]=$):$=t[28];let N;t[29]!==v||t[30]!==$?(N=h("div",{className:"flex flex-col gap-3 border-t border-border bg-muted/50 px-4 py-3",children:[M,h("div",{className:"flex flex-wrap gap-2",children:[v,$]})]}),t[29]=v,t[30]=$,t[31]=N):N=t[31];let _;return t[32]!==S||t[33]!==N?(_=h(K,{className:"gap-0 py-0","data-testid":"home-connect-agent",children:[S,N]}),t[32]=S,t[33]=N,t[34]=_):_=t[34],_},Lt=nt(()=>import("../packem_chunks/sparkline.js").then(t=>({default:t.Sparkline}))),Be=t=>{if(t<1e3)return`${String(Math.round(t))}ms`;const e=t>=1e4?0:1;return`${(t/1e3).toFixed(e)}s`},Mt=(t,e)=>{const a=Math.max(0,Math.round((e-t)/1e3));if(a<60)return`${String(a)}s ago`;const n=Math.round(a/60);if(n<60)return`${String(n)}m ago`;const s=Math.round(n/60);return s<24?`${String(s)}h ago`:`${String(Math.round(s/24))}d ago`},He=(t,e)=>{if(t===void 0||t.length===0)return[];const a=new Map;for(const n of t)a.set(n.bucketMs,(a.get(n.bucketMs)??0)+n[e]);return[...a.entries()].toSorted(([n],[s])=>n-s).map(([,n])=>n)},Je=(t,e=!0)=>{if(t.length<4)return null;const a=Math.floor(t.length/2),n=t.slice(0,a).reduce((l,i)=>l+i,0),s=t.slice(a).reduce((l,i)=>l+i,0);if(n===0)return null;const o=(s-n)/n*100;return{positive:e?o>=0:o<=0,text:`${o>=0?"+":""}${o.toFixed(1)}%`}},Oe=t=>{const e=L(24),{delta:a,footer:n,label:s,trend:o,unit:l,value:i}=t,c=I();let u;e[0]!==s?(u=r("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s}),e[0]=s,e[1]=u):u=e[1];let d;e[2]!==i?(d=r("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:i}),e[2]=i,e[3]=d):d=e[3];let p;e[4]!==l?(p=l!==void 0&&r("span",{className:"text-xs text-muted-foreground",children:l}),e[4]=l,e[5]=p):p=e[5];let m;e[6]!==d||e[7]!==p?(m=h("span",{className:"flex items-baseline gap-1.5",children:[d,p]}),e[6]=d,e[7]=p,e[8]=m):m=e[8];let f;e[9]!==o?(f=o!==void 0&&r(at,{fallback:r("div",{"aria-hidden":"true",className:"h-8 w-28"}),children:r(Lt,{data:o})}),e[9]=o,e[10]=f):f=e[10];let g;e[11]!==m||e[12]!==f?(g=h("div",{className:"flex items-center justify-between gap-3",children:[m,f]}),e[11]=m,e[12]=f,e[13]=g):g=e[13];let x;e[14]!==u||e[15]!==g?(x=h("div",{className:"flex flex-col gap-2.5 p-4",children:[u,g]}),e[14]=u,e[15]=g,e[16]=x):x=e[16];let b;e[17]!==a||e[18]!==n||e[19]!==c?(b=a==null?n!=null&&r("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:n}):h("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px]",children:[r("span",{className:Xe("font-semibold",a.positive?"text-success":"text-destructive"),children:a.text})," ",r("span",{className:"text-muted-foreground",children:c("vs. prev.")})]}),e[17]=a,e[18]=n,e[19]=c,e[20]=b):b=e[20];let y;return e[21]!==x||e[22]!==b?(y=h(K,{className:"justify-between gap-0 py-0",children:[x,b]}),e[21]=x,e[22]=b,e[23]=y):y=e[23],y},At=()=>{const t=L(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:r("path",{d:"m9 6 6 6-6 6"})}),t[0]=e):e=t[0],e},De=t=>{const e=L(7),{command:a,label:n}=t;let s;e[0]!==n?(s=r("div",{className:"p-4",children:r("span",{className:"text-sm font-medium text-foreground",children:n})}),e[0]=n,e[1]=s):s=e[1];let o;e[2]!==a?(o=r("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5",children:r("code",{className:"font-mono text-xs text-muted-foreground",children:a})}),e[2]=a,e[3]=o):o=e[3];let l;return e[4]!==s||e[5]!==o?(l=h(K,{className:"justify-between gap-0 py-0",children:[s,o]}),e[4]=s,e[5]=o,e[6]=l):l=e[6],l},Ge=t=>{const e=L(18),{count:a,onView:n,testId:s,title:o}=t,l=I();let i;e[0]!==o?(i=r("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o}),e[0]=o,e[1]=i):i=e[1];let c;e[2]!==a||e[3]!==l?(c=a===null?r("span",{className:"text-xs text-muted-foreground",children:l("No data yet")}):r(Ye,{variant:a>0?"destructive":"success",children:a>0?a:l("All clear")}),e[2]=a,e[3]=l,e[4]=c):c=e[4];let u;e[5]!==i||e[6]!==c?(u=h("div",{className:"flex items-start justify-between gap-2 p-4",children:[i,c]}),e[5]=i,e[6]=c,e[7]=u):u=e[7];let d;e[8]!==l?(d=l("View"),e[8]=l,e[9]=d):d=e[9];let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p=r(At,{}),e[10]=p):p=e[10];let m;e[11]!==n||e[12]!==d?(m=h("button",{className:"flex items-center gap-1 border-t border-border bg-muted/50 px-4 py-2.5 text-[12px] font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:bg-muted",onClick:n,type:"button",children:[d,p]}),e[11]=n,e[12]=d,e[13]=m):m=e[13];let f;return e[14]!==u||e[15]!==m||e[16]!==s?(f=h(K,{className:"justify-between gap-0 py-0","data-testid":s,children:[u,m]}),e[14]=u,e[15]=m,e[16]=s,e[17]=f):f=e[17],f},Ct=t=>{const e=L(7),{functions:a}=t,n=I();let s;if(e[0]!==a||e[1]!==n){const o=[...a].toSorted(Ot).slice(0,5);let l;e[3]!==n?(l=n("Top functions"),e[3]=n,e[4]=l):l=e[4];let i;e[5]!==l?(i=r("div",{className:"border-b border-border px-4 py-3",children:r("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:l})}),e[5]=l,e[6]=i):i=e[6],s=h(K,{className:"gap-0 py-0","data-testid":"home-top-functions",children:[i,o.length===0?r("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:n("No functions called yet.")}):h("div",{className:"divide-y divide-border",children:[h("div",{className:"grid grid-cols-[1fr_auto_auto_auto] gap-4 px-4 py-1.5 font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:[r("span",{children:n("Function")}),r("span",{className:"text-end",children:n("Calls")}),r("span",{className:"w-12 text-end",children:n("Avg")}),r("span",{className:"w-8 text-end",children:n("Err")})]}),o.map(Rt)]})]}),e[0]=a,e[1]=n,e[2]=s}else s=e[2];return s},It=t=>{const e=L(26),{subs:a}=t,n=I();let s;e[0]!==n?(s=n("Live connections"),e[0]=n,e[1]=s):s=e[1];let o;e[2]!==s?(o=r("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s}),e[2]=s,e[3]=o):o=e[3];const l=a?.totalConnections??0;let i;e[4]!==l?(i=l.toLocaleString(),e[4]=l,e[5]=i):i=e[5];let c;e[6]!==i?(c=r("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:i}),e[6]=i,e[7]=c):c=e[7];let u;e[8]!==n?(u=n("sockets"),e[8]=n,e[9]=u):u=e[9];let d;e[10]!==u?(d=r("span",{className:"text-xs text-muted-foreground",children:u}),e[10]=u,e[11]=d):d=e[11];let p;e[12]!==c||e[13]!==d?(p=h("span",{className:"flex items-baseline gap-1.5",children:[c,d]}),e[12]=c,e[13]=d,e[14]=p):p=e[14];const m=a?.totalSubscriptions??0;let f;e[15]!==m?(f=m.toLocaleString(),e[15]=m,e[16]=f):f=e[16];let g;e[17]!==n?(g=n("active subscriptions"),e[17]=n,e[18]=g):g=e[18];let x;e[19]!==f||e[20]!==g?(x=h("span",{className:"text-[11px] text-muted-foreground",children:[f," ",g]}),e[19]=f,e[20]=g,e[21]=x):x=e[21];let b;return e[22]!==x||e[23]!==o||e[24]!==p?(b=r(K,{"data-testid":"home-live-connections",children:h(Ze,{className:"flex flex-col gap-2.5 py-4",children:[o,p,x]})}),e[22]=x,e[23]=o,e[24]=p,e[25]=b):b=e[25],b},jt=t=>{const e=L(7),{entries:a}=t,n=I();let s;if(e[0]!==a||e[1]!==n){const o=Date.now();let l;e[3]!==n?(l=n("Recent activity"),e[3]=n,e[4]=l):l=e[4];let i;e[5]!==l?(i=r("div",{className:"border-b border-border px-4 py-3",children:r("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:l})}),e[5]=l,e[6]=i):i=e[6],s=h(K,{className:"gap-0 py-0","data-testid":"home-recent-activity",children:[i,a.length===0?r("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:n("No recent activity.")}):r("ul",{className:"divide-y divide-border",children:a.slice(0,5).map(c=>h("li",{className:"flex items-center justify-between gap-3 px-4 py-2 text-[13px]",children:[h("span",{className:"flex min-w-0 items-center gap-2",children:[r("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-muted-foreground/40"}),h("span",{className:"truncate text-foreground",children:[c.op,c.table!==void 0&&h("span",{className:"text-muted-foreground",children:[" · ",c.table,c.id===void 0?"":`#${c.id}`]})]})]}),r("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:Mt(c.ts,o)})]},c.seq))})]}),e[0]=a,e[1]=n,e[2]=s}else s=e[2];return s},Tt=t=>{const e=t.reduce((a,n)=>a+n.calls,0);return e===0?null:t.reduce((a,n)=>a+n.totalDurationMs,0)/e},Zt=t=>{const e=L(151),{initialShardKey:a}=t,n=I(),s=Qe(),o=a??"";let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={},e[0]=l):l=e[0];let i;e[1]!==o?(i={shardKey:o},e[1]=o,e[2]=i):i=e[2];const c=_e(Ne.getMetrics,l,i);let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u={},e[3]=u):u=e[3];let d;e[4]!==o?(d={shardKey:o},e[4]=o,e[5]=d):d=e[5];const p=_e(Ne.getFunctionStats,u,d);let m,f;e[6]===Symbol.for("react.memo_cache_sentinel")?(m={},f={shardKey:""},e[6]=m,e[7]=f):(m=e[6],f=e[7]);const g=_e(Ne.getSecurityAudit,m,f);let x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x={},e[8]=x):x=e[8];let b;e[9]!==o?(b={shardKey:o},e[9]=o,e[10]=b):b=e[10];const y=_e(Ne.listSubscriptions,x,b);let S;e[11]===Symbol.for("react.memo_cache_sentinel")?(S={},e[11]=S):S=e[11];let M;e[12]!==o?(M={shardKey:o},e[12]=o,e[13]=M):M=e[13];const k=_e(Ne.getAuditLog,S,M),v=c.data??null;let w,$,N,_,A,C,P,j,T,z,D,B,O,R,E,F,V,W;if(e[14]!==k.data||e[15]!==g.data||e[16]!==v||e[17]!==c.data||e[18]!==s||e[19]!==p.data||e[20]!==y.data||e[21]!==n){_=Array.isArray(p.data?.functions)?p.data.functions:[],P=y.data??null;let Le;e[40]!==k.data?(Le=Array.isArray(k.data?.entries)?k.data.entries:[],e[40]=k.data,e[41]=Le):Le=e[41],$=Le,A=c.data===void 0||p.data===void 0?null:dt(v,_).length,C=Array.isArray(g.data?.findings)?g.data.findings.length:null;let Me;e[42]!==s?(Me=()=>{Se(s({to:"/security"}))},e[42]=s,e[43]=Me):Me=e[43],W=Me;let Ae;e[44]!==s?(Ae=()=>{Se(s({to:"/insights"}))},e[44]=s,e[45]=Ae):Ae=e[45],V=Ae;const Ce=He(v?.history,"calls"),Ie=He(v?.history,"errors"),Ve=Tt(_),je=Math.max(0,..._.map(qt)),q=v?.cache;let Te;e[46]!==q?(Te=q!=null&&q.hits+q.misses>0?Math.round(q.hits/(q.hits+q.misses)*100):null,e[46]=q,e[47]=Te):Te=e[47],N=Te,E="flex flex-col gap-6",F="lunora-home",D="grid gap-3 sm:grid-cols-2 xl:grid-cols-4",B="home-health";const qe=Je(Ce);let xe;e[48]!==n?(xe=n("Requests"),e[48]=n,e[49]=xe):xe=e[49];const Ke=v?.requests??0;let be;e[50]!==Ke?(be=Ke.toLocaleString(),e[50]=Ke,e[51]=be):be=e[51],e[52]!==Ce||e[53]!==qe||e[54]!==xe||e[55]!==be?(O=r(Oe,{delta:qe,label:xe,trend:Ce,value:be}),e[52]=Ce,e[53]=qe,e[54]=xe,e[55]=be,e[56]=O):O=e[56];const Pe=Je(Ie,!1);let ye;e[57]!==n?(ye=n("Errors"),e[57]=n,e[58]=ye):ye=e[58];const ze=v?.errors??0;let ve;e[59]!==ze?(ve=ze.toLocaleString(),e[59]=ze,e[60]=ve):ve=e[60],e[61]!==Ie||e[62]!==Pe||e[63]!==ye||e[64]!==ve?(R=r(Oe,{delta:Pe,label:ye,trend:Ie,value:ve}),e[61]=Ie,e[62]=Pe,e[63]=ye,e[64]=ve,e[65]=R):R=e[65],w=Oe,e[66]!==je||e[67]!==n?(j=je>0?`${n("max")} ${Be(je)}`:void 0,e[66]=je,e[67]=n,e[68]=j):j=e[68],e[69]!==n?(T=n("Avg latency"),e[69]=n,e[70]=T):T=e[70],z=Ve===null?"—":Be(Ve),e[14]=k.data,e[15]=g.data,e[16]=v,e[17]=c.data,e[18]=s,e[19]=p.data,e[20]=y.data,e[21]=n,e[22]=w,e[23]=$,e[24]=N,e[25]=_,e[26]=A,e[27]=C,e[28]=P,e[29]=j,e[30]=T,e[31]=z,e[32]=D,e[33]=B,e[34]=O,e[35]=R,e[36]=E,e[37]=F,e[38]=V,e[39]=W}else w=e[22],$=e[23],N=e[24],_=e[25],A=e[26],C=e[27],P=e[28],j=e[29],T=e[30],z=e[31],D=e[32],B=e[33],O=e[34],R=e[35],E=e[36],F=e[37],V=e[38],W=e[39];let U;e[71]!==w||e[72]!==j||e[73]!==T||e[74]!==z?(U=r(w,{footer:j,label:T,value:z}),e[71]=w,e[72]=j,e[73]=T,e[74]=z,e[75]=U):U=e[75];let H;e[76]!==N||e[77]!==n?(H=N===null?void 0:`${String(N)}% ${n("cache hit")}`,e[76]=N,e[77]=n,e[78]=H):H=e[78];let J;e[79]!==n?(J=n("Database size"),e[79]=n,e[80]=J):J=e[80];const Re=v?.databaseSize??null;let G;e[81]!==Re?(G=ct(Re),e[81]=Re,e[82]=G):G=e[82];let Q;e[83]!==H||e[84]!==J||e[85]!==G?(Q=r(Oe,{footer:H,label:J,value:G}),e[83]=H,e[84]=J,e[85]=G,e[86]=Q):Q=e[86];let Y;e[87]!==D||e[88]!==B||e[89]!==O||e[90]!==R||e[91]!==U||e[92]!==Q?(Y=h("div",{className:D,"data-testid":B,children:[O,R,U,Q]}),e[87]=D,e[88]=B,e[89]=O,e[90]=R,e[91]=U,e[92]=Q,e[93]=Y):Y=e[93];let ke;e[94]===Symbol.for("react.memo_cache_sentinel")?(ke=r(xt,{}),e[94]=ke):ke=e[94];let Z;e[95]!==_?(Z=r("div",{className:"lg:col-span-2",children:r(Ct,{functions:_})}),e[95]=_,e[96]=Z):Z=e[96];let X;e[97]!==P?(X=r(It,{subs:P}),e[97]=P,e[98]=X):X=e[98];let ee;e[99]!==$?(ee=r(jt,{entries:$}),e[99]=$,e[100]=ee):ee=e[100];let te;e[101]!==X||e[102]!==ee?(te=h("div",{className:"flex flex-col gap-3",children:[X,ee]}),e[101]=X,e[102]=ee,e[103]=te):te=e[103];let ne;e[104]!==Z||e[105]!==te?(ne=h("div",{className:"grid gap-3 lg:grid-cols-3",children:[Z,te]}),e[104]=Z,e[105]=te,e[106]=ne):ne=e[106];let ae;e[107]!==n?(ae=n("Advisors"),e[107]=n,e[108]=ae):ae=e[108];let re;e[109]!==ae?(re=r("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:ae}),e[109]=ae,e[110]=re):re=e[110];let se;e[111]!==A||e[112]!==C||e[113]!==n||e[114]!==V||e[115]!==W?(se=C===0&&A===0?r(rt,{description:n("No security or performance issues detected."),icon:h("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[r("path",{d:"M12 3 4 6v5c0 5 3.4 8.5 8 10 4.6-1.5 8-5 8-10V6l-8-3Z"}),r("path",{d:"m9 12 2 2 4-4"})]}),testId:"home-advisors-clear",title:n("No issues found")}):h("div",{className:"grid gap-3 sm:grid-cols-2",children:[r(Ge,{count:C,onView:W,testId:"home-security",title:n("Security findings")}),r(Ge,{count:A,onView:V,testId:"home-performance",title:n("Performance issues")})]}),e[111]=A,e[112]=C,e[113]=n,e[114]=V,e[115]=W,e[116]=se):se=e[116];let oe;e[117]!==re||e[118]!==se?(oe=h("section",{className:"flex flex-col gap-3","data-testid":"home-advisors",children:[re,se]}),e[117]=re,e[118]=se,e[119]=oe):oe=e[119];let le;e[120]!==n?(le=n("Get connected"),e[120]=n,e[121]=le):le=e[121];let ie;e[122]!==le?(ie=r("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:le}),e[122]=le,e[123]=ie):ie=e[123];let ce;e[124]!==n?(ce=n("Client SDK"),e[124]=n,e[125]=ce):ce=e[125];let de;e[126]!==ce?(de=r(De,{command:"npm i @lunora/client",label:ce}),e[126]=ce,e[127]=de):de=e[127];let me;e[128]!==n?(me=n("React"),e[128]=n,e[129]=me):me=e[129];let ue;e[130]!==me?(ue=r(De,{command:"npm i @lunora/react",label:me}),e[130]=me,e[131]=ue):ue=e[131];let pe;e[132]!==n?(pe=n("CLI"),e[132]=n,e[133]=pe):pe=e[133];let fe;e[134]!==pe?(fe=r(De,{command:"lunora dev",label:pe}),e[134]=pe,e[135]=fe):fe=e[135];let he;e[136]!==de||e[137]!==ue||e[138]!==fe?(he=h("div",{className:"grid gap-3 sm:grid-cols-3",children:[de,ue,fe]}),e[136]=de,e[137]=ue,e[138]=fe,e[139]=he):he=e[139];let we;e[140]===Symbol.for("react.memo_cache_sentinel")?(we=r($t,{}),e[140]=we):we=e[140];let ge;e[141]!==ie||e[142]!==he?(ge=h("section",{className:"flex flex-col gap-3","data-testid":"home-get-connected",children:[ie,he,we]}),e[141]=ie,e[142]=he,e[143]=ge):ge=e[143];let $e;return e[144]!==E||e[145]!==F||e[146]!==Y||e[147]!==ne||e[148]!==oe||e[149]!==ge?($e=h("div",{className:E,"data-testid":F,children:[Y,ke,ne,oe,ge]}),e[144]=E,e[145]=F,e[146]=Y,e[147]=ne,e[148]=oe,e[149]=ge,e[150]=$e):$e=e[150],$e};function Ot(t,e){return e.calls-t.calls}function Rt(t){return h("div",{className:"grid grid-cols-[1fr_auto_auto_auto] items-center gap-4 px-4 py-2 text-[13px]",children:[r("span",{className:"truncate font-mono text-xs text-foreground",children:t.path}),r("span",{className:"text-end tabular-nums",children:t.calls.toLocaleString()}),r("span",{className:"w-12 text-end tabular-nums text-muted-foreground",children:Be(t.calls>0?t.totalDurationMs/t.calls:0)}),r("span",{className:Xe("w-8 text-end tabular-nums",t.errors>0?"text-destructive":"text-muted-foreground"),children:t.errors})]},t.path)}function qt(t){return t.maxDurationMs}export{Zt as H,pt as S};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as f}from"react/compiler-runtime";import{c as b}from"./card-CIDGUN6K.js";import{jsx as p,jsxs as x}from"react/jsx-runtime";const j=u=>{const e=f(16),{chart:c,footer:o,label:d,testId:i,value:m}=u;let t;e[0]!==d?(t=p("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:d}),e[0]=d,e[1]=t):t=e[1];let r;e[2]!==i||e[3]!==m?(r=p("span",{className:"truncate text-2xl font-semibold tabular-nums text-foreground","data-testid":i,children:m}),e[2]=i,e[3]=m,e[4]=r):r=e[4];let l;e[5]!==c||e[6]!==r?(l=x("div",{className:"flex items-center justify-between gap-3",children:[r,c]}),e[5]=c,e[6]=r,e[7]=l):l=e[7];let a;e[8]!==t||e[9]!==l?(a=x("div",{className:"flex flex-col gap-2.5 p-4",children:[t,l]}),e[8]=t,e[9]=l,e[10]=a):a=e[10];let s;e[11]!==o?(s=o!=null&&p("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:o}),e[11]=o,e[12]=s):s=e[12];let n;return e[13]!==a||e[14]!==s?(n=x(b,{className:"justify-between gap-0 py-0",children:[a,s]}),e[13]=a,e[14]=s,e[15]=n):n=e[15],n};export{j as g};
|