@lunora/studio 1.0.0-alpha.120 → 1.0.0-alpha.122
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.js +1 -1
- package/dist/packem_chunks/ApiTab.js +1 -1
- package/dist/packem_shared/{ApiReferencePanel-DXrGI45U.js → ApiReferencePanel-CZDVN7zg.js} +1 -1
- package/dist/packem_shared/{OpenRpcReferencePanel-DkYBLJGb.js → OpenRpcReferencePanel-XoYdKuMg.js} +1 -1
- package/dist/packem_shared/reference-view-DY3CaRxH.js +13 -0
- package/dist/standalone/{chunk-QXLU6YPU.js → chunk-2AJMY73I.js} +1 -1
- package/dist/standalone/{chunk-D3ZLKFO4.js → chunk-2EWSVBWG.js} +1 -1
- package/dist/standalone/{chunk-2VLBFSIX.js → chunk-2FFV3NB7.js} +1 -1
- package/dist/standalone/{chunk-BKW7FMAU.js → chunk-2HW5M4MK.js} +1 -1
- package/dist/standalone/{chunk-6KJLNWPJ.js → chunk-33TNFS73.js} +1 -1
- package/dist/standalone/{chunk-WFABZPAK.js → chunk-3K4F3B56.js} +1 -1
- package/dist/standalone/{chunk-4DJQV5UA.js → chunk-3WFIPW6W.js} +1 -1
- package/dist/standalone/{chunk-2RASQG3R.js → chunk-4HWTEDVV.js} +1 -1
- package/dist/standalone/{chunk-T5SC5RAD.js → chunk-4O7MEQMU.js} +1 -1
- package/dist/standalone/{chunk-L6ATKZKO.js → chunk-5DEXJ766.js} +1 -1
- package/dist/standalone/{chunk-TCKQ4E5Y.js → chunk-5VKIJNHE.js} +1 -1
- package/dist/standalone/{chunk-XUX7B54Z.js → chunk-7EOXUWAI.js} +1 -1
- package/dist/standalone/{chunk-5COHJLQF.js → chunk-7MO56FXL.js} +1 -1
- package/dist/standalone/{chunk-PRWFHSHC.js → chunk-AVBUV42G.js} +1 -1
- package/dist/standalone/{chunk-6QKKYBML.js → chunk-B6YM5NAF.js} +1 -1
- package/dist/standalone/{chunk-W3PCX3TU.js → chunk-DXXXNZ3P.js} +1 -1
- package/dist/standalone/{chunk-DYKGLIBC.js → chunk-E4RVRJHD.js} +1 -1
- package/dist/standalone/{chunk-ATGYWQUI.js → chunk-EIWXXEVA.js} +1 -1
- package/dist/standalone/{chunk-J2GQE4PW.js → chunk-FKXX3Y2J.js} +1 -1
- package/dist/standalone/{chunk-JIPVSPSG.js → chunk-FS7FGJOU.js} +1 -1
- package/dist/standalone/{chunk-P4QIDUCY.js → chunk-GDC3W3DZ.js} +1 -1
- package/dist/standalone/{chunk-2F6FYL5O.js → chunk-GISVVEPU.js} +1 -1
- package/dist/standalone/{chunk-RSG2DVHH.js → chunk-GNN5HJ56.js} +1 -1
- package/dist/standalone/{chunk-YN2KHW3B.js → chunk-ICQTVV6U.js} +1 -1
- package/dist/standalone/{chunk-B3BKR5ZW.js → chunk-JCSDJBBZ.js} +1 -1
- package/dist/standalone/{chunk-RK5XWYUL.js → chunk-K3SXMDKL.js} +1 -1
- package/dist/standalone/{chunk-KWGHNORP.js → chunk-KJNDUIZG.js} +1 -1
- package/dist/standalone/{chunk-PS66CRK5.js → chunk-KNI5YDPT.js} +1 -1
- package/dist/standalone/{chunk-BYJZGWWY.js → chunk-KR6SZXOI.js} +1 -1
- package/dist/standalone/{chunk-VDSFYFDH.js → chunk-KTEVBZIV.js} +1 -1
- package/dist/standalone/{chunk-P54YTPHL.js → chunk-MHB2TOAK.js} +1 -1
- package/dist/standalone/{chunk-XFU6YBYL.js → chunk-MTGEDJQH.js} +1 -1
- package/dist/standalone/{chunk-A44VDLY3.js → chunk-N7PPYEHW.js} +1 -1
- package/dist/standalone/{chunk-YTYRZTG6.js → chunk-NIUA7EHL.js} +1 -1
- package/dist/standalone/{chunk-GTEXP4P3.js → chunk-O4RQGUJ7.js} +1 -1
- package/dist/standalone/{chunk-WYSR5F77.js → chunk-OCZ2IP5A.js} +1 -1
- package/dist/standalone/{chunk-GK2UBSBQ.js → chunk-PAJQOSEU.js} +1 -1
- package/dist/standalone/{chunk-D52S7TOI.js → chunk-PGTCEMBA.js} +1 -1
- package/dist/standalone/{chunk-WIFYD4A6.js → chunk-POD66K2Y.js} +1 -1
- package/dist/standalone/{chunk-KPQROFH5.js → chunk-QBONDY5I.js} +1 -1
- package/dist/standalone/{chunk-2QLWSNDL.js → chunk-R7EV3YND.js} +1 -1
- package/dist/standalone/{chunk-G3NGXYJY.js → chunk-RAFPVMXJ.js} +1 -1
- package/dist/standalone/{chunk-QLG2EJU3.js → chunk-SQSMHFA7.js} +1 -1
- package/dist/standalone/{chunk-5JF2HAU4.js → chunk-TCAX32PK.js} +1 -1
- package/dist/standalone/{chunk-27IF4PXG.js → chunk-TDH7K7E7.js} +1 -1
- package/dist/standalone/{chunk-5HICO276.js → chunk-THTL2KBP.js} +1 -1
- package/dist/standalone/{chunk-R3G55P4J.js → chunk-TI5RJJRX.js} +1 -1
- package/dist/standalone/{chunk-QDGAB4R2.js → chunk-TKKRBSUB.js} +1 -1
- package/dist/standalone/{chunk-QKN5EHEF.js → chunk-U2FRMJAN.js} +1 -1
- package/dist/standalone/{chunk-6J5TEYI5.js → chunk-U32MMDFO.js} +1 -1
- package/dist/standalone/chunk-UDCFI5NF.js +14 -0
- package/dist/standalone/{chunk-XRC7KEEN.js → chunk-UFUOW6UJ.js} +1 -1
- package/dist/standalone/{chunk-4PVSXT34.js → chunk-VJQAOU2U.js} +1 -1
- package/dist/standalone/{chunk-4LVLLM6B.js → chunk-VTFMI4DC.js} +1 -1
- package/dist/standalone/{chunk-4Y2QHI65.js → chunk-XYWLXNTV.js} +1 -1
- package/dist/standalone/{chunk-R52YOHVU.js → chunk-ZWATJNSU.js} +1 -1
- package/dist/standalone/studio.js +1 -1
- package/package.json +5 -5
- package/dist/packem_shared/reference-view-CxW7paCK.js +0 -12
- package/dist/standalone/chunk-XTNSQYXW.js +0 -13
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{StudioApp as r}from"./packem_shared/StudioApp-Bxmtp-Fi.js";import{CommandPalette as a,openCommandPalette as f}from"./packem_shared/CommandPalette-kQLn0xlS.js";import{S as m}from"./packem_shared/studio-Cvdwfzxm.js";import{ConfirmButton as l}from"./packem_shared/ConfirmButton-Cj2SOapE.js";import{default as s}from"./packem_shared/ConnectionBadge-Bh16X9-u.js";import{ErrorBoundary as d}from"./packem_shared/ErrorBoundary-BWNF98VF.js";import{ShardInput as P}from"./packem_shared/ShardInput-CdawpUiS.js";import{default as A}from"./packem_chunks/AdvisorHealthPanel.js";import{DEFAULT_INSIGHT_THRESHOLDS as I,deriveInsights as T}from"./packem_shared/DEFAULT_INSIGHT_THRESHOLDS-1Lrg55IV.js";import{InsightsPanel as g}from"./packem_chunks/InsightsPanel.js";import{default as F}from"./packem_chunks/SecurityAdvisorPanel.js";import{default as h}from"./packem_shared/ApiDocsPanel-BMzLPgvv.js";import{default as C}from"./packem_shared/ApiReferencePanel-
|
|
1
|
+
import{StudioApp as r}from"./packem_shared/StudioApp-Bxmtp-Fi.js";import{CommandPalette as a,openCommandPalette as f}from"./packem_shared/CommandPalette-kQLn0xlS.js";import{S as m}from"./packem_shared/studio-Cvdwfzxm.js";import{ConfirmButton as l}from"./packem_shared/ConfirmButton-Cj2SOapE.js";import{default as s}from"./packem_shared/ConnectionBadge-Bh16X9-u.js";import{ErrorBoundary as d}from"./packem_shared/ErrorBoundary-BWNF98VF.js";import{ShardInput as P}from"./packem_shared/ShardInput-CdawpUiS.js";import{default as A}from"./packem_chunks/AdvisorHealthPanel.js";import{DEFAULT_INSIGHT_THRESHOLDS as I,deriveInsights as T}from"./packem_shared/DEFAULT_INSIGHT_THRESHOLDS-1Lrg55IV.js";import{InsightsPanel as g}from"./packem_chunks/InsightsPanel.js";import{default as F}from"./packem_chunks/SecurityAdvisorPanel.js";import{default as h}from"./packem_shared/ApiDocsPanel-BMzLPgvv.js";import{default as C}from"./packem_shared/ApiReferencePanel-CZDVN7zg.js";import{default as O}from"./packem_chunks/ApiTab.js";import{default as N}from"./packem_shared/OpenRpcReferencePanel-XoYdKuMg.js";import{DataBrowser as U}from"./packem_shared/DataBrowser-C68K5QHO.js";import{DataFilters as b,toFilterClauses as v}from"./packem_shared/DataFilters-3nbW0uax.js";import{GlobalDataBrowser as y}from"./packem_shared/GlobalDataBrowser-BHFgEqMl.js";import{TableEditor as q}from"./packem_chunks/TableEditor.js";import{ExportImportPanel as V}from"./packem_chunks/ExportImportPanel.js";import{MigrationsPanel as j}from"./packem_shared/MigrationsPanel-CLRWwPyL.js";import{PitrPanel as z}from"./packem_chunks/PitrPanel.js";import{FunctionRunner as Q}from"./packem_chunks/FunctionRunner.js";import{FunctionStatsPanel as Y}from"./packem_chunks/FunctionStatsPanel.js";import{DeploymentHealthPanel as $}from"./packem_chunks/DeploymentHealthPanel.js";import{H as oe}from"./packem_shared/home-panel-ecz6-nHV.js";import{AuditPanel as te}from"./packem_chunks/AuditPanel.js";import{LogsPanel as fe}from"./packem_chunks/LogsPanel.js";import{MailPanel as me}from"./packem_chunks/MailPanel.js";import{ScheduledJobs as le}from"./packem_shared/ScheduledJobs-DRmOKtDa.js";import{default as se}from"./packem_chunks/NotificationsPanel.js";import{HealthPanel as de}from"./packem_chunks/HealthPanel.js";import{aggregateMetrics as Pe,shardsToAggregate as Se}from"./packem_shared/aggregateMetrics-A-Y7OH6R.js";import{MetricsPanel as ce}from"./packem_chunks/MetricsPanel.js";import{SchemaViewer as Te}from"./packem_chunks/SchemaViewer.js";import{SettingsPanel as ge}from"./packem_chunks/SettingsPanel.js";import{SqlEditorPanel as Fe}from"./packem_chunks/SqlEditorPanel.js";import{FileBrowser as he}from"./packem_chunks/FileBrowser.js";import{DEFAULT_AUTO_REFRESH_MS as Ce,useAutoRefresh as He}from"./packem_shared/DEFAULT_AUTO_REFRESH_MS-DuULO4XM.js";import{default as Le}from"./packem_shared/useDebounced-DVeQ5-oW.js";import{DEFAULT_LOCALE as Me,createStudioI18n as Ue,studioI18n as Be,useT as be}from"./packem_shared/DEFAULT_LOCALE-A1Yg5ORA.js";import{StudioI18nProvider as we}from"./packem_shared/StudioI18nProvider-Bl547evf.js";import{ADMIN_FUNCTIONS as Ge,ADMIN_FUNCTION_PREFIX as qe}from"./packem_shared/ADMIN_FUNCTIONS-B6z7VLYt.js";import{default as Ve}from"./packem_shared/STUDIO_ROOT_CLASS-C6MccdVk.js";export{Ge as ADMIN_FUNCTIONS,qe as ADMIN_FUNCTION_PREFIX,A as AdvisorHealthPanel,h as ApiDocsPanel,C as ApiReferencePanel,O as ApiTab,te as AuditPanel,a as CommandPalette,l as ConfirmButton,s as ConnectionBadge,Ce as DEFAULT_AUTO_REFRESH_MS,I as DEFAULT_INSIGHT_THRESHOLDS,Me as DEFAULT_LOCALE,U as DataBrowser,b as DataFilters,$ as DeploymentHealthPanel,d as ErrorBoundary,V as ExportImportPanel,he as FileBrowser,Q as FunctionRunner,Y as FunctionStatsPanel,y as GlobalDataBrowser,de as HealthPanel,oe as HomePanel,g as InsightsPanel,fe as LogsPanel,me as MailPanel,ce as MetricsPanel,j as MigrationsPanel,se as NotificationsPanel,N as OpenRpcReferencePanel,z as PitrPanel,Ve as STUDIO_ROOT_CLASS,le as ScheduledJobs,Te as SchemaViewer,F as SecurityAdvisorPanel,ge as SettingsPanel,P as ShardInput,Fe as SqlEditorPanel,m as Studio,r as StudioApp,we as StudioI18nProvider,q as TableEditor,Pe as aggregateMetrics,Ue as createStudioI18n,T as deriveInsights,f as openCommandPalette,Se as shardsToAggregate,Be as studioI18n,v as toFilterClauses,He as useAutoRefresh,Le as useDebounced,be as useT};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as L}from"react/compiler-runtime";import{useState as F}from"react";import{B as K}from"../packem_shared/button-BOPLD1un.js";import{useT as Y}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.js";import D from"../packem_shared/ApiDocsPanel-BMzLPgvv.js";import M from"../packem_shared/ApiReferencePanel-
|
|
1
|
+
import{c as L}from"react/compiler-runtime";import{useState as F}from"react";import{B as K}from"../packem_shared/button-BOPLD1un.js";import{useT as Y}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.js";import D from"../packem_shared/ApiDocsPanel-BMzLPgvv.js";import M from"../packem_shared/ApiReferencePanel-CZDVN7zg.js";import W from"../packem_shared/OpenRpcReferencePanel-XoYdKuMg.js";import{jsx as r,jsxs as E}from"react/jsx-runtime";const _=["reference","snippets"],q=["openapi","openrpc"],k=V=>{const e=L(51),{functions:R,initialShardKey:N,openApiSpec:T,openRpcSpec:I}=V,t=Y(),[i,$]=F("reference"),[a,j]=F("openapi");let s;e[0]!==t?(s=t("Reference"),e[0]=t,e[1]=s):s=e[1];let o;e[2]!==t?(o=t("Snippets"),e[2]=t,e[3]=o):o=e[3];let w;e[4]!==s||e[5]!==o?(w={reference:s,snippets:o},e[4]=s,e[5]=o,e[6]=w):w=e[6];const O=w;let n;e[7]!==t?(n=t("OpenAPI"),e[7]=t,e[8]=n):n=e[8];let c;e[9]!==t?(c=t("OpenRPC"),e[9]=t,e[10]=c):c=e[10];let g;e[11]!==n||e[12]!==c?(g={openapi:n,openrpc:c},e[11]=n,e[12]=c,e[13]=g):g=e[13];const C=g;let S;e[14]===Symbol.for("react.memo_cache_sentinel")?(S=l=>{$(l.currentTarget.dataset.view)},e[14]=S):S=e[14];const z=S;let A;e[15]===Symbol.for("react.memo_cache_sentinel")?(A=l=>{j(l.currentTarget.dataset.format)},e[15]=A):A=e[15];const B=A;let p;e[16]!==t?(p=t("API view"),e[16]=t,e[17]=p):p=e[17];let f;e[18]!==i||e[19]!==O?(f=_.map(l=>r(K,{"aria-selected":i===l,"data-testid":`api-view-${l}`,"data-view":l,onClick:z,role:"tab",size:"sm",type:"button",variant:i===l?"default":"outline",children:O[l]},l)),e[18]=i,e[19]=O,e[20]=f):f=e[20];let m;e[21]!==f||e[22]!==p?(m=r("div",{"aria-label":p,className:"flex gap-1.5","data-testid":"api-view-toggle",role:"tablist",children:f}),e[21]=f,e[22]=p,e[23]=m):m=e[23];let d;e[24]!==a||e[25]!==C||e[26]!==t||e[27]!==i?(d=i==="reference"&&r("div",{"aria-label":t("API spec format"),className:"flex gap-1.5","data-testid":"api-format-toggle",role:"tablist",children:q.map(l=>r(K,{"aria-selected":a===l,"data-format":l,"data-testid":`api-format-${l}`,onClick:B,role:"tab",size:"sm",type:"button",variant:a===l?"default":"outline",children:C[l]},l))}),e[24]=a,e[25]=C,e[26]=t,e[27]=i,e[28]=d):d=e[28];let b;e[29]!==m||e[30]!==d?(b=E("div",{className:"flex shrink-0 flex-wrap items-center gap-3 border-b border-border px-6 py-3",children:[m,d]}),e[29]=m,e[30]=d,e[31]=b):b=e[31];let v;e[32]!==R||e[33]!==N||e[34]!==i?(v=i==="snippets"&&r("div",{className:"min-h-0 flex-1 overflow-y-auto p-6",children:r(D,{functions:R,initialShardKey:N})}),e[32]=R,e[33]=N,e[34]=i,e[35]=v):v=e[35];let h;e[36]!==a||e[37]!==T||e[38]!==i?(h=i==="reference"&&a==="openapi"&&r(M,{spec:T}),e[36]=a,e[37]=T,e[38]=i,e[39]=h):h=e[39];let u;e[40]!==a||e[41]!==I||e[42]!==i?(u=i==="reference"&&a==="openrpc"&&r(W,{spec:I}),e[40]=a,e[41]=I,e[42]=i,e[43]=u):u=e[43];let x;e[44]!==v||e[45]!==h||e[46]!==u?(x=E("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[v,h,u]}),e[44]=v,e[45]=h,e[46]=u,e[47]=x):x=e[47];let P;return e[48]!==b||e[49]!==x?(P=E("div",{className:"flex min-h-0 flex-1 flex-col","data-testid":"lunora-api-tab",children:[b,x]}),e[48]=b,e[49]=x,e[50]=P):P=e[50],P};export{k as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as k}from"react/compiler-runtime";import{useLunora as v}from"@lunora/react";import{E as h}from"./empty-state-B939z6K2.js";import{S as g}from"./skeleton-DFBBaJU6.js";import{u as O,R as S}from"./reference-view-
|
|
1
|
+
import{c as k}from"react/compiler-runtime";import{useLunora as v}from"@lunora/react";import{E as h}from"./empty-state-B939z6K2.js";import{S as g}from"./skeleton-DFBBaJU6.js";import{u as O,R as S}from"./reference-view-DY3CaRxH.js";import{useT as A}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{jsxs as I,jsx as m}from"react/jsx-runtime";const P=["get","post","put","patch","delete","head","options","trace"],y=r=>r?.content?.["application/json"]?.schema,j=(r,e)=>Object.entries(r.responses??{}).map(([i,s])=>{const c=s.$ref?.replace("#/components/responses/",""),n=c===void 0?s:e.components?.responses?.[c]??s;return{description:n.description,schema:y(n),status:i}}),b=(r,e,i,s,c)=>{const n=y(s.requestBody),l=n?.properties?.functionPath?.const,t=typeof l=="string"?l:void 0,f=t===void 0?n:n?.properties?.args,a=s.operationId??`${i} ${e}`;return{argsSchema:f,description:s.description,functionPath:t,httpPath:e,key:r,kind:s["x-lunora-function-kind"],method:i.toUpperCase(),operationId:a,requestSchema:n,responses:j(s,c),summary:s.summary??a,tags:s.tags??[],title:s.summary??a}},x=r=>{const e=[];for(const[i,s]of Object.entries(r.paths??{})){const c=i.includes("#")?i.slice(0,i.indexOf("#")):i;for(const n of P){const l=s[n];l!==void 0&&e.push(b(i,c,n,l,r))}}return e},w=r=>{const e=r??{},i=x(e),s=new Map((e.tags??[]).map(t=>[t.name,t.description])),c=new Set,n=[],l=t=>{if(c.has(t))return;c.add(t);const f=i.filter(a=>(a.tags[0]??"")===t);f.length>0&&n.push({description:s.get(t),name:t,operations:f})};for(const t of e.tags??[])l(t.name);for(const t of i)l(t.tags[0]??"");return{groups:n,operationByKey:new Map(i.map(t=>[t.key,t])),server:e.servers?.[0]?.url,title:e.info?.title??"API reference",version:e.info?.version}},R=r=>{const{paths:e}=r;return e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0},T=r=>{const e=r;return R(e)?{kind:"empty"}:{kind:"ready",spec:e}},B=r=>{const e=k(23),{spec:i}=r,s=A(),c=v();let n;e[0]!==c?(n=()=>c.fetchOpenApi(),e[0]=c,e[1]=n):n=e[1];const t=O(i,n,T);let f;e[2]!==t.kind||e[3]!==t.spec?(f=t.kind==="ready"?w(t.spec):void 0,e[2]=t.kind,e[3]=t.spec,e[4]=f):f=e[4];const a=f;if(t.kind==="loading"){let o;return e[5]===Symbol.for("react.memo_cache_sentinel")?(o=I("div",{className:"flex flex-col gap-4","data-testid":"api-reference-loading",children:[m(g,{className:"h-8 w-48"}),m(g,{className:"h-64 w-full"})]}),e[5]=o):o=e[5],o}if(t.kind==="error"){let o;e[6]!==t.message||e[7]!==s?(o=s("Couldn't load the OpenAPI spec: {message}",{message:t.message}),e[6]=t.message,e[7]=s,e[8]=o):o=e[8];let p;e[9]!==s?(p=s("API reference unavailable"),e[9]=s,e[10]=p):p=e[10];let d;return e[11]!==o||e[12]!==p?(d=m(h,{description:o,testId:"api-reference-error",title:p}),e[11]=o,e[12]=p,e[13]=d):d=e[13],d}if(t.kind==="empty"||a===void 0){let o;e[14]!==s?(o=s("Run `lunora codegen` and wire `_generated/openapi.json` to the worker to render the API reference here."),e[14]=s,e[15]=o):o=e[15];let p;e[16]!==s?(p=s("No OpenAPI spec configured"),e[16]=s,e[17]=p):p=e[17];let d;return e[18]!==o||e[19]!==p?(d=m(h,{description:o,testId:"api-reference-empty",title:p}),e[18]=o,e[19]=p,e[20]=d):d=e[20],d}let u;return e[21]!==a?(u=m(S,{model:a}),e[21]=a,e[22]=u):u=e[22],u};export{B as default};
|
package/dist/packem_shared/{OpenRpcReferencePanel-DkYBLJGb.js → OpenRpcReferencePanel-XoYdKuMg.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as k}from"react/compiler-runtime";import{useLunora as O}from"@lunora/react";import{E as g}from"./empty-state-B939z6K2.js";import{S as y}from"./skeleton-DFBBaJU6.js";import{u as R,R as S}from"./reference-view-
|
|
1
|
+
import{c as k}from"react/compiler-runtime";import{useLunora as O}from"@lunora/react";import{E as g}from"./empty-state-B939z6K2.js";import{S as y}from"./skeleton-DFBBaJU6.js";import{u as R,R as S}from"./reference-view-DY3CaRxH.js";import{useT as P}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{jsxs as h,jsx as l}from"react/jsx-runtime";const x=n=>(n.params??[]).find(e=>e.name==="args")??(n.params??[])[0],v=n=>n["x-tags"]?.[0]?.name??(n.name.includes(":")?n.name.slice(0,n.name.indexOf(":")):""),w=n=>{const e=x(n)?.schema;return{argsSchema:e,description:n.description,functionPath:n.name,httpPath:"/_lunora/rpc",key:n.name,kind:n["x-lunora-function-kind"],method:"POST",operationId:n.name,requestSchema:e,responses:[{description:n.result?.name,schema:n.result?.schema,status:"200"}],summary:n.summary??n.name,tags:[v(n)],title:n.summary??n.name}},I=n=>{const e=n??{},m=(e.methods??[]).map(a=>w(a)),r=new Map;for(const a of m){const i=a.tags[0]??"",s=r.get(i)??[];s.push(a),r.set(i,s)}return{groups:[...r.entries()].map(([a,i])=>({name:a,operations:i.toSorted((s,p)=>s.operationId.localeCompare(p.operationId))})).toSorted((a,i)=>a.name.localeCompare(i.name)),operationByKey:new Map(m.map(a=>[a.key,a])),title:e.info?.title??"API reference",version:e.info?.version}},C=n=>n.methods===void 0||n.methods.length===0,N=n=>{const e=n;return C(e)?{kind:"empty"}:{kind:"ready",spec:e}},T=n=>{const e=k(23),{spec:m}=n,r=P(),f=O();let a;e[0]!==f?(a=()=>f.fetchOpenRpc(),e[0]=f,e[1]=a):a=e[1];const s=R(m,a,N);let p;e[2]!==s.kind||e[3]!==s.spec?(p=s.kind==="ready"?I(s.spec):void 0,e[2]=s.kind,e[3]=s.spec,e[4]=p):p=e[4];const u=p;if(s.kind==="loading"){let t;return e[5]===Symbol.for("react.memo_cache_sentinel")?(t=h("div",{className:"flex flex-col gap-4","data-testid":"openrpc-reference-loading",children:[l(y,{className:"h-8 w-48"}),l(y,{className:"h-64 w-full"})]}),e[5]=t):t=e[5],t}if(s.kind==="error"){let t;e[6]!==s.message||e[7]!==r?(t=r("Couldn't load the OpenRPC spec: {message}",{message:s.message}),e[6]=s.message,e[7]=r,e[8]=t):t=e[8];let o;e[9]!==r?(o=r("API reference unavailable"),e[9]=r,e[10]=o):o=e[10];let c;return e[11]!==t||e[12]!==o?(c=l(g,{description:t,testId:"openrpc-reference-error",title:o}),e[11]=t,e[12]=o,e[13]=c):c=e[13],c}if(s.kind==="empty"||u===void 0){let t;e[14]!==r?(t=r("Run `lunora codegen --api-spec openrpc` and wire `_generated/openrpc.json` to the worker to render the OpenRPC reference here."),e[14]=r,e[15]=t):t=e[15];let o;e[16]!==r?(o=r("No OpenRPC spec configured"),e[16]=r,e[17]=o):o=e[17];let c;return e[18]!==t||e[19]!==o?(c=l(g,{description:t,testId:"openrpc-reference-empty",title:o}),e[18]=t,e[19]=o,e[20]=c):c=e[20],c}let d;return e[21]!==u?(d=l(S,{model:u}),e[21]=u,e[22]=d):d=e[22],d};export{T as default};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import{c as P}from"react/compiler-runtime";import{useState as L,useEffect as ie,createContext as ae,use as le}from"react";import{b as z,g as X,f as de,k as ce,c as ue,d as fe}from"./internal-7bgd8inO.js";import{SentIcon as me,Copy01Icon as pe,Search01Icon as he}from"@hugeicons/core-free-icons";import{HugeiconsIcon as W}from"@hugeicons/react";import{I as ge}from"./input-CY5W3wzv.js";import{useT as J}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{B as q}from"./button-BOPLD1un.js";import{jsx as i,jsxs as N,Fragment as xe}from"react/jsx-runtime";import{B as be}from"./badge-cAk9Di1Q.js";import{ShardInput as ve}from"./ShardInput-CdawpUiS.js";import{L as U}from"./label-BOUo-DP0.js";import{T as ye}from"./textarea-DpO3i-Qo.js";import{LunoraError as Ne}from"@lunora/errors";import{useLunora as Se}from"@lunora/react";import{c as Y}from"./utils-bhneXptQ.js";const kt=function(t,e,r){const s=P(10);let n;s[0]===Symbol.for("react.memo_cache_sentinel")?(n={kind:"loading"},s[0]=n):n=s[0];const[o,l]=L(n);let a,m;s[1]!==r||s[2]!==e||s[3]!==t?(a=()=>{if(t!==void 0)return;let c=!1;return e().then(u=>(c||l(r(u)),u)).catch(u=>{c||l({kind:"error",message:z(u)})}),()=>{c=!0}},m=[r,e,t],s[1]=r,s[2]=e,s[3]=t,s[4]=a,s[5]=m):(a=s[4],m=s[5]),ie(a,m);let d;return s[6]!==r||s[7]!==o||s[8]!==t?(d=t===void 0?o:r(t),s[6]=r,s[7]=o,s[8]=t,s[9]=d):d=s[9],d},ke=t=>typeof t=="number"?"number":typeof t=="boolean"?"boolean":"string",Q=t=>{if(t.enum!==void 0&&t.enum.length>0)return t.enum;if(t.anyOf!==void 0&&t.anyOf.length>0&&t.anyOf.every(e=>e.const!==void 0))return t.anyOf.map(e=>e.const)},F=t=>t===void 0?"any":t.const!==void 0?JSON.stringify(t.const):t.enum!==void 0&&t.enum.length>0?t.enum.map(e=>JSON.stringify(e)).join(" | "):t.anyOf!==void 0&&t.anyOf.length>0?t.anyOf.map(e=>F(e)).join(" | "):t.type==="array"?`array<${F(t.items)}>`:t.type??"any",we=t=>{const e=Q(t);return e!==void 0?t.type??ke(e[0]):F(t)},Oe=t=>{const e=Q(t);return e===void 0?void 0:e.map(r=>JSON.stringify(r)).join(" | ")},$e=t=>{const e=[];t.minimum!==void 0?e.push(`${String(t.minimum)} ≤`):t.exclusiveMinimum!==void 0&&e.push(`${String(t.exclusiveMinimum)} <`);const r=e.length>0;e.push("value"),t.maximum!==void 0?e.push(`≤ ${String(t.maximum)}`):t.exclusiveMaximum!==void 0&&e.push(`< ${String(t.exclusiveMaximum)}`);const s=e.length>(r?2:1);return r||s?e.join(" "):void 0},Te=t=>{if(t.type==="object"&&t.properties!==void 0)return t;if(t.type==="array"&&t.items?.type==="object"&&t.items.properties!==void 0)return t.items},D=t=>{if(t===void 0)return null;if(t.const!==void 0)return t.const;if(t.enum!==void 0&&t.enum.length>0)return t.enum[0];if(t.anyOf!==void 0&&t.anyOf.length>0)return D(t.anyOf[0]);switch(t.type){case"array":return[];case"boolean":return!1;case"number":return 0;case"object":{const e={};for(const[r,s]of Object.entries(t.properties??{}))e[r]=D(s);return e}case"string":return"";default:return null}},K=t=>{const e=P(7),{label:r,value:s}=t;let n;e[0]!==r?(n=i("span",{className:"text-muted-foreground",children:r}),e[0]=r,e[1]=n):n=e[1];let o;e[2]!==s?(o=i("span",{className:"text-foreground",children:s}),e[2]=s,e[3]=o):o=e[3];let l;return e[4]!==n||e[5]!==o?(l=N("span",{className:"inline-flex items-center gap-1 rounded border border-border px-1.5 py-0.5 font-mono text-[10px]",children:[n,o]}),e[4]=n,e[5]=o,e[6]=l):l=e[6],l},Ee=t=>{const e=P(40),{name:r,required:s,schema:n}=t,o=J();let l;e[0]!==n?(l=$e(n),e[0]=n,e[1]=l):l=e[1];const a=l;let m;e[2]!==n?(m=Oe(n),e[2]=n,e[3]=m):m=e[3];const d=m,c=n["x-lunora-table"],u=n.format!==void 0||a!==void 0||d!==void 0||c!==void 0;let v;e[4]!==n?(v=Te(n),e[4]=n,e[5]=v):v=e[5];const b=v,f=s?"*":"?";let p;e[6]!==f?(p=i("span",{className:"text-muted-foreground",children:f}),e[6]=f,e[7]=p):p=e[7];let y;e[8]!==r||e[9]!==p?(y=N("span",{className:"font-mono text-foreground",children:[r,p]}),e[8]=r,e[9]=p,e[10]=y):y=e[10];let k;e[11]!==n?(k=we(n),e[11]=n,e[12]=k):k=e[12];let h;e[13]!==k?(h=i("span",{className:"font-mono text-muted-foreground",children:k}),e[13]=k,e[14]=h):h=e[14];let g;e[15]!==y||e[16]!==h?(g=N("div",{className:"flex items-baseline gap-2",children:[y,h]}),e[15]=y,e[16]=h,e[17]=g):g=e[17];let x;e[18]!==n.description?(x=n.description!==void 0&&i("p",{className:"max-w-prose text-muted-foreground",children:n.description}),e[18]=n.description,e[19]=x):x=e[19];let S;e[20]!==u||e[21]!==a||e[22]!==c||e[23]!==n.format||e[24]!==o||e[25]!==d?(S=u&&N("div",{className:"flex flex-wrap gap-1",children:[n.format!==void 0&&i(K,{label:o("Format"),value:n.format}),a!==void 0&&i(K,{label:o("Range"),value:a}),d!==void 0&&i(K,{label:o("Value in"),value:d}),c!==void 0&&i(K,{label:o("relation"),value:c})]}),e[20]=u,e[21]=a,e[22]=c,e[23]=n.format,e[24]=o,e[25]=d,e[26]=S):S=e[26];let O;e[27]!==x||e[28]!==S||e[29]!==g?(O=N("div",{className:"flex flex-col gap-1 py-2",children:[g,x,S]}),e[27]=x,e[28]=S,e[29]=g,e[30]=O):O=e[30];const w=O;if(b===void 0){let $;return e[31]!==w?($=i("div",{className:"border-b border-border/50 last:border-b-0",children:w}),e[31]=w,e[32]=$):$=e[32],$}let T;e[33]!==w?(T=i("summary",{className:"cursor-pointer marker:text-muted-foreground",children:w}),e[33]=w,e[34]=T):T=e[34];let A;e[35]!==b?(A=i("div",{className:"mb-2 ml-2 border-l border-border pl-3",children:i(Z,{schema:b})}),e[35]=b,e[36]=A):A=e[36];let E;return e[37]!==T||e[38]!==A?(E=N("details",{className:"border-b border-border/50 last:border-b-0",children:[T,A]}),e[37]=T,e[38]=A,e[39]=E):E=e[39],E},Z=t=>{const e=P(7),{schema:r}=t;let s;e[0]!==r.required?(s=new Set(r.required),e[0]=r.required,e[1]=s):s=e[1];const n=s;let o;e[2]!==r.properties?(o=Object.entries(r.properties??{}),e[2]=r.properties,e[3]=o):o=e[3];const l=o;let a;return e[4]!==n||e[5]!==l?(a=i("div",{className:"flex flex-col",children:l.map(m=>{const[d,c]=m;return i(Ee,{name:d,required:n.has(d),schema:c},d)})}),e[4]=n,e[5]=l,e[6]=a):a=e[6],a},V=t=>{const e=P(10),{schema:r,testId:s}=t;if(r?.type!=="object"||Object.keys(r.properties??{}).length===0){let l;e[0]!==r?(l=F(r),e[0]=r,e[1]=l):l=e[1];let a;return e[2]!==l||e[3]!==s?(a=i("p",{className:"font-mono text-xs text-muted-foreground","data-testid":s,children:l}),e[2]=l,e[3]=s,e[4]=a):a=e[4],a}let n;e[5]!==r?(n=i(Z,{schema:r}),e[5]=r,e[6]=n):n=e[6];let o;return e[7]!==n||e[8]!==s?(o=i("div",{className:"text-xs","data-testid":s,children:n}),e[7]=n,e[8]=s,e[9]=o):o=e[9],o},Ce=["curl","javascript","lunora"],Ae={lunora:"Lunora",curl:"cURL",javascript:"JavaScript"},Ie=t=>`api.${t.replaceAll(/[/:]/g,".")}`,Re=t=>{const e=D(t.argsSchema)??{};return t.functionPath===void 0?e:{args:e,functionPath:t.functionPath}},je=(t,e,r)=>{const s=`${r}${e.httpPath}`,n=JSON.stringify(Re(e),void 0,2),o=JSON.stringify(D(e.argsSchema)??{},void 0,2);switch(t){case"curl":{const l=e.method!=="GET"&&e.method!=="HEAD",a=[`curl -X ${e.method} ${JSON.stringify(s)}`];return l&&a.push(' -H "Content-Type: application/json"',` -d '${n}'`),a.join(` \\
|
|
2
|
+
`)}case"lunora":return e.functionPath===void 0?`await fetch(${JSON.stringify(e.httpPath)}, { method: ${JSON.stringify(e.method)} });`:`import { useLunora } from "@lunora/react";
|
|
3
|
+
import { api } from "./_generated/api";
|
|
4
|
+
|
|
5
|
+
const client = useLunora();
|
|
6
|
+
await client.${e.kind??"query"}(${Ie(e.functionPath)}, ${o});`;default:{const a=e.method!=="GET"&&e.method!=="HEAD"?`{
|
|
7
|
+
method: ${JSON.stringify(e.method)},
|
|
8
|
+
headers: { "Content-Type": "application/json" },
|
|
9
|
+
body: JSON.stringify(${n}),
|
|
10
|
+
}`:`{ method: ${JSON.stringify(e.method)} }`;return`const response = await fetch(${JSON.stringify(s)}, ${a});
|
|
11
|
+
const data = await response.json();`}}},Pe=t=>{const e=P(24),{operation:r,server:s}=t,n=J(),[o,l]=L("curl");let a;e[0]!==r||e[1]!==o||e[2]!==s?(a=je(o,r,s),e[0]=r,e[1]=o,e[2]=s,e[3]=a):a=e[3];const m=a;let d;e[4]!==m?(d=()=>{X(m)},e[4]=m,e[5]=d):d=e[5];const c=d;let u;e[6]===Symbol.for("react.memo_cache_sentinel")?(u=x=>{l(x.currentTarget.dataset.sample)},e[6]=u):u=e[6];const v=u;let b;e[7]!==o?(b=Ce.map(x=>i("button",{"aria-selected":o===x,className:"rounded px-2 py-0.5 text-xs text-muted-foreground transition-colors hover:text-foreground aria-selected:bg-muted aria-selected:font-medium aria-selected:text-foreground","data-sample":x,"data-testid":`api-sample-${x}`,onClick:v,role:"tab",type:"button",children:Ae[x]},x)),e[7]=o,e[8]=b):b=e[8];let f;e[9]!==b?(f=i("div",{className:"flex gap-1",role:"tablist",children:b}),e[9]=b,e[10]=f):f=e[10];let p;e[11]!==n?(p=n("Copy"),e[11]=n,e[12]=p):p=e[12];let y;e[13]!==c||e[14]!==p?(y=i(q,{"data-testid":"api-sample-copy",onClick:c,size:"xs",type:"button",variant:"ghost",children:p}),e[13]=c,e[14]=p,e[15]=y):y=e[15];let k;e[16]!==f||e[17]!==y?(k=N("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2",children:[f,y]}),e[16]=f,e[17]=y,e[18]=k):k=e[18];let h;e[19]!==m?(h=i("pre",{className:"overflow-auto px-3 pb-3 font-mono text-xs","data-testid":"api-sample-source",children:m}),e[19]=m,e[20]=h):h=e[20];let g;return e[21]!==k||e[22]!==h?(g=N("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card","data-testid":"api-code-samples",children:[k,h]}),e[21]=k,e[22]=h,e[23]=g):g=e[23],g},Le={blue:"text-info",emerald:"text-success",neutral:"text-muted-foreground",orange:"text-warning",red:"text-destructive",violet:"text-royal-amethyst"},_e=t=>{switch(t.toUpperCase()){case"DELETE":return"red";case"GET":return"emerald";case"PATCH":return"orange";case"POST":return"blue";case"PUT":return"orange";default:return"neutral"}},Be=t=>{switch(t){case"action":return"violet";case"mutation":return"orange";case"query":return"emerald";default:return"neutral"}},H=t=>{const e=P(7),{kind:r,method:s,testId:n}=t;let o;e[0]!==r||e[1]!==s?(o=r??s.toUpperCase(),e[0]=r,e[1]=s,e[2]=o):o=e[2];const l=o,a=r===void 0?_e(s):Be(r),m=`${Le[a]} font-mono text-[10px] tracking-wide uppercase`;let d;return e[3]!==l||e[4]!==m||e[5]!==n?(d=i(be,{className:m,"data-testid":n,variant:"ghost",children:l}),e[3]=l,e[4]=m,e[5]=n,e[6]=d):d=e[6],d},ee=t=>t.startsWith("2")?"text-emerald-600 dark:text-emerald-400":t==="default"||t.startsWith("4")||t.startsWith("5")?"text-red-600 dark:text-red-400":"text-muted-foreground",te=t=>t.startsWith("2")?"bg-emerald-500":t==="default"||t.startsWith("4")||t.startsWith("5")?"bg-red-500":"bg-muted-foreground",Me=new Set([" ",`
|
|
12
|
+
`,"\r"]),G=" ",Je=t=>{let e="";for(const n of t)Me.has(n)||(e+=n);let r=0,s=e.length;for(;r<s&&(e[r]??"")<=G;)r+=1;for(;s>r&&(e[s-1]??"")<=G;)s-=1;return e.slice(r,s)},De=/^(?:[a-z][\d+.a-z-]*:)?\/\//i,Ke=(t,e)=>{const r=globalThis.location?.origin??"",s=e===""?r:e,n=Je(t);if(s===""){if(De.test(n))throw new Error(`restDispatch: refusing to send the admin token off-origin (${n} names its own host and there is no origin to check it against)`);return n}const o=new URL(n,s);if(o.origin!==new URL(s).origin)throw new Error(`restDispatch: refusing to send the admin token off-origin (${o.origin} is not ${s})`);return o.toString()},Fe=async(t,e,r,s)=>{const n=t.method!=="GET"&&t.method!=="HEAD",o=Ke(t.httpPath,r),a=await(await fetch(o,{body:n?JSON.stringify(e):void 0,headers:{...n?{"content-type":"application/json"}:{},...s===null||s===""?{}:{authorization:`Bearer ${s}`}},method:t.method})).text();try{return JSON.parse(a)}catch{return a}},ze=t=>JSON.stringify(D(t.argsSchema)??{},void 0,2),re=ae(null),se=()=>{const t=le(re);if(t===null)throw new Ne("INTERNAL","useOperationRun must be used within an OperationRunProvider");return t},We=({children:t,operation:e})=>{const r=J(),s=Se(),[n,o]=L(()=>ze(e)),[l,a]=L(""),[m,d]=L("idle"),[c,u]=L(void 0),[v,b]=L(null),[f,p]=L(null),y=async()=>{let g;try{g=n.trim()===""?{}:JSON.parse(n)}catch(S){d("error"),u(void 0),p(null),b(r("Invalid JSON args: {message}",{message:z(S)}));return}d("running"),b(null);const x=performance.now();try{const S=await(e.functionPath===void 0?Fe(e,g,s.url,s.getAuthToken()):ce(s,e.kind,ue(e.functionPath),g,fe(l)));u(S),p(Math.round(performance.now()-x)),d("success")}catch(S){u(void 0),p(Math.round(performance.now()-x)),b(z(S)),d("error")}};return i(re,{value:{argsText:n,durationMs:f,error:v,operation:e,response:c,send:()=>{de(y())},setArgsText:o,setShardKey:a,shardKey:l,status:m},children:t})},qe=()=>{const t=P(48),e=J(),{argsText:r,operation:s,send:n,setArgsText:o,setShardKey:l,shardKey:a,status:m}=se();let d;t[0]!==o?(d=C=>{o(C.target.value)},t[0]=o,t[1]=d):d=t[1];const c=d;let u;t[2]!==n?(u=C=>{C.key==="Enter"&&(C.metaKey||C.ctrlKey)&&(C.preventDefault(),n())},t[2]=n,t[3]=u):u=t[3];const v=u,b=m==="running";let f;t[4]!==s.kind||t[5]!==s.method?(f=i(H,{kind:s.kind,method:s.method,testId:"api-try-method"}),t[4]=s.kind,t[5]=s.method,t[6]=f):f=t[6];const p=s.functionPath??s.httpPath;let y;t[7]!==p?(y=i("code",{className:"min-w-0 flex-1 truncate font-mono text-xs text-foreground",children:p}),t[7]=p,t[8]=y):y=t[8];const k=b?"animate-pulse":void 0;let h;t[9]!==k?(h=i(W,{className:k,icon:me,strokeWidth:2}),t[9]=k,t[10]=h):h=t[10];let g;t[11]!==b||t[12]!==e?(g=e(b?"Sending…":"Send"),t[11]=b,t[12]=e,t[13]=g):g=t[13];let x;t[14]!==b||t[15]!==n||t[16]!==h||t[17]!==g?(x=N(q,{"data-testid":"api-try-send",disabled:b,onClick:n,size:"sm",type:"button",children:[h,g]}),t[14]=b,t[15]=n,t[16]=h,t[17]=g,t[18]=x):x=t[18];let S;t[19]!==f||t[20]!==y||t[21]!==x?(S=N("div",{className:"flex items-center gap-2 border-b border-border bg-muted px-3 py-2",children:[f,y,x]}),t[19]=f,t[20]=y,t[21]=x,t[22]=S):S=t[22];let O;t[23]!==e?(O=e("Arguments (JSON)"),t[23]=e,t[24]=O):O=t[24];let w;t[25]!==O?(w=i(U,{htmlFor:"api-try-args",children:O}),t[25]=O,t[26]=w):w=t[26];let T;t[27]!==r?(T=r.split(`
|
|
13
|
+
`),t[27]=r,t[28]=T):T=t[28];const A=Math.min(12,Math.max(3,T.length));let E;t[29]!==r||t[30]!==c||t[31]!==v||t[32]!==A?(E=i(ye,{className:"font-mono text-xs","data-testid":"api-try-args",id:"api-try-args",onChange:c,onKeyDown:v,rows:A,spellCheck:!1,value:r}),t[29]=r,t[30]=c,t[31]=v,t[32]=A,t[33]=E):E=t[33];let $;t[34]!==w||t[35]!==E?($=N("div",{className:"flex flex-col gap-1.5",children:[w,E]}),t[34]=w,t[35]=E,t[36]=$):$=t[36];let I;t[37]!==s.functionPath||t[38]!==l||t[39]!==a||t[40]!==e?(I=s.functionPath!==void 0&&N("div",{className:"flex flex-col gap-1.5",children:[i(U,{htmlFor:"shard-input",children:e("Shard key (optional)")}),i(ve,{id:"shard-input",onChange:l,testId:"shard-input",value:a})]}),t[37]=s.functionPath,t[38]=l,t[39]=a,t[40]=e,t[41]=I):I=t[41];let R;t[42]!==$||t[43]!==I?(R=N("div",{className:"flex flex-col gap-3 p-3",children:[$,I]}),t[42]=$,t[43]=I,t[44]=R):R=t[44];let j;return t[45]!==R||t[46]!==S?(j=N("div",{className:"overflow-hidden rounded-xl border border-border bg-card","data-testid":"api-try-it",children:[S,R]}),t[45]=R,t[46]=S,t[47]=j):j=t[47],j},He=t=>{const e=P(51),{operation:r}=t,s=J(),n=`api-operation-${r.operationId}`,o=r.key;let l;e[0]!==r.kind||e[1]!==r.method?(l=i(H,{kind:r.kind,method:r.method,testId:"api-operation-method"}),e[0]=r.kind,e[1]=r.method,e[2]=l):l=e[2];const a=r.functionPath??r.httpPath;let m;e[3]!==a?(m=i("code",{className:"truncate font-mono text-xs text-muted-foreground",children:a}),e[3]=a,e[4]=m):m=e[4];let d;e[5]!==l||e[6]!==m?(d=N("div",{className:"flex items-center gap-2",children:[l,m]}),e[5]=l,e[6]=m,e[7]=d):d=e[7];let c;e[8]!==r.title?(c=i("h1",{className:"text-lg font-semibold text-foreground","data-testid":"api-operation-title",children:r.title}),e[8]=r.title,e[9]=c):c=e[9];let u;e[10]!==r.description?(u=r.description!==void 0&&i("p",{className:"text-sm text-muted-foreground",children:r.description}),e[10]=r.description,e[11]=u):u=e[11];let v;e[12]!==d||e[13]!==c||e[14]!==u?(v=N("header",{className:"sticky top-0 z-10 -mx-6 -mt-6 flex flex-col gap-2 border-b border-border bg-background px-6 pt-6 pb-3",children:[d,c,u]}),e[12]=d,e[13]=c,e[14]=u,e[15]=v):v=e[15];let b;e[16]!==s?(b=s("Try it"),e[16]=s,e[17]=b):b=e[17];let f;e[18]!==b?(f=i("h2",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:b}),e[18]=b,e[19]=f):f=e[19];let p;e[20]===Symbol.for("react.memo_cache_sentinel")?(p=i(qe,{}),e[20]=p):p=e[20];let y;e[21]!==f?(y=N("section",{className:"flex flex-col gap-2",children:[f,p]}),e[21]=f,e[22]=y):y=e[22];let k;e[23]!==s?(k=s("Request arguments"),e[23]=s,e[24]=k):k=e[24];let h;e[25]!==k?(h=i("h2",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:k}),e[25]=k,e[26]=h):h=e[26];let g;e[27]!==r.argsSchema?(g=i(V,{schema:r.argsSchema,testId:"api-operation-args"}),e[27]=r.argsSchema,e[28]=g):g=e[28];let x;e[29]!==h||e[30]!==g?(x=N("section",{className:"flex flex-col gap-2",children:[h,g]}),e[29]=h,e[30]=g,e[31]=x):x=e[31];let S;e[32]!==s?(S=s("Response body"),e[32]=s,e[33]=S):S=e[33];let O;e[34]!==S?(O=i("h2",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:S}),e[34]=S,e[35]=O):O=e[35];let w;if(e[36]!==r.responses||e[37]!==s){let E;e[39]!==s?(E=$=>N("div",{className:"flex flex-col gap-1.5 rounded-xl border border-border bg-card p-3",children:[N("div",{className:"flex items-center justify-between gap-2",children:[N("span",{className:`inline-flex items-center gap-1.5 font-mono text-xs font-semibold ${ee($.status)}`,children:[i("span",{className:`size-1.5 rounded-full ${te($.status)}`}),$.status]}),$.schema!==void 0&&i("span",{className:"rounded border border-border px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:s("application/json")})]}),$.description!==void 0&&i("p",{className:"text-xs text-muted-foreground",children:$.description}),$.schema!==void 0&&i(V,{schema:$.schema,testId:`api-response-${$.status}`})]},$.status),e[39]=s,e[40]=E):E=e[40],w=r.responses.map(E),e[36]=r.responses,e[37]=s,e[38]=w}else w=e[38];let T;e[41]!==O||e[42]!==w?(T=N("section",{className:"flex flex-col gap-3",children:[O,w]}),e[41]=O,e[42]=w,e[43]=T):T=e[43];let A;return e[44]!==r.key||e[45]!==n||e[46]!==y||e[47]!==x||e[48]!==T||e[49]!==v?(A=N("div",{className:"flex flex-col gap-6 duration-200 animate-in fade-in-0 slide-in-from-bottom-1","data-testid":n,children:[v,y,x,T]},o),e[44]=r.key,e[45]=n,e[46]=y,e[47]=x,e[48]=T,e[49]=v,e[50]=A):A=e[50],A},Ue={boolean:"text-royal-amethyst",key:"text-sky-sapphire",number:"text-warning",plain:"",string:"text-success"},Ve=/"(?:[^"\\]|\\.)*"|\b(?:true|false|null)\b|-?\d+(?:\.\d+)?/g,Ge=/^\s*:/,Xe=(t,e,r)=>r.startsWith('"')?Ge.test(t.slice(e))?"key":"string":r==="true"||r==="false"||r==="null"?"boolean":"number",Ye=t=>{const e=[];let r=0;for(const s of t.matchAll(Ve)){const{index:n}=s,o=s[0],l=n+o.length;n>r&&e.push({kind:"plain",start:r,text:t.slice(r,n)}),e.push({kind:Xe(t,l,o),start:n,text:o}),r=l}return r<t.length&&e.push({kind:"plain",start:r,text:t.slice(r)}),e},Qe=t=>{const e=P(4),{code:r}=t;let s;e[0]!==r?(s=Ye(r).map(Ze),e[0]=r,e[1]=s):s=e[1];let n;return e[2]!==s?(n=i(xe,{children:s}),e[2]=s,e[3]=n):n=e[3],n};function Ze(t){return i("span",{className:Ue[t.kind],children:t.text},t.start)}const ne="__live__",et=t=>t.schema===void 0?"":JSON.stringify(D(t.schema),void 0,2),tt=(t,e,r)=>r?t??"":e===void 0?"":JSON.stringify(e,void 0,2),rt=t=>{const e=P(18),{active:r,running:s,showError:n}=t,o=J();if(s){let u;e[0]!==o?(u=o("Sending…"),e[0]=o,e[1]=u):u=e[1];let v;return e[2]!==u?(v=i("p",{className:"px-3 py-3 text-xs text-muted-foreground","data-testid":"api-response-running",children:u}),e[2]=u,e[3]=v):v=e[3],v}if(r===void 0||r.body===""){let u;e[4]!==r?.live||e[5]!==o?(u=r?.live===!0?o("Send a request to see the response."):o("No example for this response."),e[4]=r?.live,e[5]=o,e[6]=u):u=e[6];let v;return e[7]!==u?(v=i("p",{className:"px-3 py-3 text-xs text-muted-foreground","data-testid":"api-response-idle",children:u}),e[7]=u,e[8]=v):v=e[8],v}const l=n&&"text-destructive";let a;e[9]!==l?(a=Y("max-h-[28rem] overflow-auto px-3 py-3 font-mono text-xs",l),e[9]=l,e[10]=a):a=e[10];const m=n?"api-response-error":"api-response-body";let d;e[11]!==r.body||e[12]!==n?(d=n?r.body:i(Qe,{code:r.body}),e[11]=r.body,e[12]=n,e[13]=d):d=e[13];let c;return e[14]!==a||e[15]!==m||e[16]!==d?(c=i("pre",{className:a,"data-testid":m,children:d}),e[14]=a,e[15]=m,e[16]=d,e[17]=c):c=e[17],c},st=({durationMs:t,error:e,failed:r,operation:s,ran:n,response:o,t:l})=>{const a=s.responses.map(d=>({body:et(d),durationMs:null,id:d.status,label:d.status,live:!1,status:d.status}));return n?[{body:tt(e,o,r),durationMs:t,id:ne,label:l("Live"),live:!0,status:r?"error":"200"},...a]:a},nt=()=>{const t=P(19),e=J(),{durationMs:r,error:s,operation:n,response:o,status:l}=se(),a=l==="running",m=l==="error",d=l==="success"||m,c=st({durationMs:r,error:s,failed:m,operation:n,ran:d,response:o,t:e}),u=d?ne:c.find(ot)?.id??c[0]?.id??"",[v,b]=L(null),f=c.find(C=>C.id===(v??u))??c[0];let p;t[0]===Symbol.for("react.memo_cache_sentinel")?(p=C=>{const{id:_}=C.currentTarget.dataset;_!==void 0&&b(_)},t[0]=p):p=t[0];const y=p,k=()=>{f!==void 0&&X(f.body)},h=f?.live===!0?f.durationMs:null,g=f?.live===!0&&f.status==="error",x="flex min-h-0 flex-col rounded-xl border border-border bg-card",S="api-response-panel";let O;t[1]!==e?(O=e("Response"),t[1]=e,t[2]=O):O=t[2];let w;t[3]!==O?(w=i("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:O}),t[3]=O,t[4]=w):w=t[4];const T=h!==null&&i("span",{className:"font-mono text-[10px] text-muted-foreground",children:e("{ms} ms",{ms:h})}),A=f!==void 0&&f.body!==""&&i(q,{"aria-label":e("Copy"),"data-testid":"api-response-copy",onClick:k,size:"icon-xs",type:"button",variant:"ghost",children:i(W,{icon:pe,strokeWidth:2})});let E;t[5]!==T||t[6]!==A?(E=N("div",{className:"flex items-center gap-2",children:[T,A]}),t[5]=T,t[6]=A,t[7]=E):E=t[7];let $;t[8]!==w||t[9]!==E?($=N("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2",children:[w,E]}),t[8]=w,t[9]=E,t[10]=$):$=t[10];const I=c.length>0&&i("div",{className:"flex gap-1 overflow-x-auto border-b border-border px-2 py-1.5",role:"tablist",children:c.map(C=>{const _=C.id===f?.id;return N("button",{"aria-selected":_,className:Y("inline-flex items-center gap-1.5 rounded px-2 py-0.5 font-mono text-xs transition-colors hover:text-foreground aria-selected:bg-muted aria-selected:font-medium",_?ee(C.status):"text-muted-foreground"),"data-id":C.id,"data-testid":C.live?"api-response-tab-live":`api-response-tab-${C.status}`,onClick:y,role:"tab",type:"button",children:[i("span",{className:`size-1.5 rounded-full ${te(C.status)}`}),C.label]},C.id)})});let R;t[11]!==f||t[12]!==a||t[13]!==g?(R=i(rt,{active:f,running:a,showError:g}),t[11]=f,t[12]=a,t[13]=g,t[14]=R):R=t[14];let j;return t[15]!==R||t[16]!==$||t[17]!==I?(j=N("div",{className:x,"data-testid":S,children:[$,I,R]}),t[15]=R,t[16]=$,t[17]=I,t[18]=j):j=t[18],j};function ot(t){return t.status.startsWith("2")}const it=(t,e)=>{const r=e.trim().toLowerCase();return r===""?t:t.map(s=>({...s,operations:s.operations.filter(n=>`${n.summary} ${n.operationId}`.toLowerCase().includes(r))})).filter(s=>s.operations.length>0)},wt=t=>{const e=P(53),{model:r}=t,s=J(),n=r.groups[0]?.operations[0]?.key??"",[o,l]=L(n),[a,m]=L("");let d;e[0]!==n||e[1]!==r.operationByKey||e[2]!==o?(d=r.operationByKey.get(o)??r.operationByKey.get(n),e[0]=n,e[1]=r.operationByKey,e[2]=o,e[3]=d):d=e[3];const c=d;let u,v,b,f,p,y,k,h,g,x;if(e[4]!==a||e[5]!==r.groups||e[6]!==r.server||e[7]!==c?.key||e[8]!==s){u=it(r.groups,a);let E;e[19]===Symbol.for("react.memo_cache_sentinel")?(E=M=>{const{key:B}=M.currentTarget.dataset;B!==void 0&&l(B)},e[19]=E):E=e[19];const $=E;let I;e[20]===Symbol.for("react.memo_cache_sentinel")?(I=M=>{m(M.target.value)},e[20]=I):I=e[20];const R=I;v=r.server??"",g="grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[16rem_minmax(0,1fr)_22rem]",x="api-reference",e[21]!==s?(p=s("API operations"),e[21]=s,e[22]=p):p=e[22],y="flex min-h-0 flex-col overflow-y-auto border-r border-border",k="api-reference-nav";let j;e[23]===Symbol.for("react.memo_cache_sentinel")?(j=i(W,{className:"pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-muted-foreground",icon:he,strokeWidth:2}),e[23]=j):j=e[23];let C;e[24]!==s?(C=s("Filter operations"),e[24]=s,e[25]=C):C=e[25],e[26]!==a||e[27]!==C?(h=i("div",{className:"sticky top-0 z-10 border-b border-border bg-sidebar p-2",children:N("div",{className:"relative",children:[j,i(ge,{className:"h-7 pl-7","data-testid":"api-filter",onChange:R,placeholder:C,value:a})]})}),e[26]=a,e[27]=C,e[28]=h):h=e[28],b="flex flex-col gap-4 p-2";let _;e[29]!==c?.key||e[30]!==s?(_=M=>N("div",{className:"flex flex-col gap-1",children:[N("div",{className:"flex items-center justify-between px-2",children:[i("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:M.name||s("(root)")}),i("span",{className:"font-mono text-[10px] text-muted-foreground/70",children:M.operations.length})]}),M.operations.map(B=>{const oe=B.key===c?.key;return N("button",{"aria-current":oe?"page":void 0,className:"flex items-center justify-between gap-2 rounded-md border-l-2 border-transparent px-2 py-1 text-start text-xs text-muted-foreground transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground aria-[current=page]:border-primary aria-[current=page]:bg-sidebar-accent aria-[current=page]:font-medium aria-[current=page]:text-foreground","data-key":B.key,"data-testid":`api-nav-${B.operationId}`,onClick:$,type:"button",children:[i("span",{className:"truncate",children:B.summary}),i(H,{kind:B.kind,method:B.method})]},B.key)})]},M.name),e[29]=c?.key,e[30]=s,e[31]=_):_=e[31],f=u.map(_),e[4]=a,e[5]=r.groups,e[6]=r.server,e[7]=c?.key,e[8]=s,e[9]=u,e[10]=v,e[11]=b,e[12]=f,e[13]=p,e[14]=y,e[15]=k,e[16]=h,e[17]=g,e[18]=x}else u=e[9],v=e[10],b=e[11],f=e[12],p=e[13],y=e[14],k=e[15],h=e[16],g=e[17],x=e[18];let S;e[32]!==u.length||e[33]!==s?(S=u.length===0&&i("p",{className:"px-2 py-1 text-xs text-muted-foreground","data-testid":"api-nav-empty",children:s("No operations match your filter.")}),e[32]=u.length,e[33]=s,e[34]=S):S=e[34];let O;e[35]!==S||e[36]!==b||e[37]!==f?(O=N("div",{className:b,children:[f,S]}),e[35]=S,e[36]=b,e[37]=f,e[38]=O):O=e[38];let w;e[39]!==O||e[40]!==p||e[41]!==y||e[42]!==k||e[43]!==h?(w=N("nav",{"aria-label":p,className:y,"data-testid":k,children:[h,O]}),e[39]=O,e[40]=p,e[41]=y,e[42]=k,e[43]=h,e[44]=w):w=e[44];let T;e[45]!==c||e[46]!==v?(T=c===void 0?i("div",{className:"lg:col-span-2"}):N(We,{operation:c,children:[i("div",{className:"min-w-0 overflow-y-auto p-6","data-testid":"api-reference-main",children:i(He,{operation:c})}),N("aside",{className:"flex min-w-0 flex-col gap-4 overflow-y-auto border-border p-4 lg:border-l","data-testid":"api-reference-aside",children:[i(Pe,{operation:c,server:v}),i(nt,{})]})]},c.key),e[45]=c,e[46]=v,e[47]=T):T=e[47];let A;return e[48]!==w||e[49]!==T||e[50]!==g||e[51]!==x?(A=N("div",{className:g,"data-testid":x,children:[w,T]}),e[48]=w,e[49]=T,e[50]=g,e[51]=x,e[52]=A):A=e[52],A};export{wt as R,kt as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as we}from"./chunk-5XMZP64Z.js";import{a as Ne}from"./chunk-CAOUXOL7.js";import{b as ve,c as ye}from"./chunk-2SFSTQS4.js";import{a as ge}from"./chunk-NIX2QSSN.js";import{a as xe}from"./chunk-E6P2ERQV.js";import"./chunk-VZCS5GXZ.js";import"./chunk-DKSLOJDQ.js";import{a as fe}from"./chunk-CKTKI4IY.js";import{a as he}from"./chunk-6UN4V2HB.js";import{b as pe}from"./chunk-KVSQKUWD.js";import"./chunk-ZHPDAJBM.js";import{P as me}from"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as oe}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as be}from"./chunk-B3BKR5ZW.js";import"./chunk-PZ4QDWTI.js";import"./chunk-P4QIDUCY.js";import"./chunk-F7JOSNAT.js";import{a as ce}from"./chunk-DZGOHOOE.js";import{c as ie}from"./chunk-L6ATKZKO.js";import"./chunk-YTYRZTG6.js";import"./chunk-RCZTUWG3.js";import{a as ue}from"./chunk-UANVABQG.js";import{d as U,s as de}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as m,d as le,e as $e,f as Ce,g as Le,i as te}from"./chunk-R5ZTCHCE.js";var B=le(Ce(),1),O=le($e(),1);var s=le(Le(),1);var Te=.5,Me=4,Ie=m(n=>Math.min(100,Math.max(0,n)),"ce"),Pe=m((n,e)=>{if(!Number.isFinite(e)||e<=0)return{leftPercent:0,widthPercent:100};let t=Ie(n.offsetMs/e*100),a=n.durationMs/e*100,l=Math.max(Te,Math.min(Ie(a),100-t));return{leftPercent:t,widthPercent:l}},"Le"),Ke=m((n,e,t=!1)=>{let a=e.trim().toLowerCase(),l=t?n.filter(r=>!r.ok):n;return a===""?[...l]:l.filter(r=>r.rootName.toLowerCase().includes(a)||r.functionPath.toLowerCase().includes(a)||r.traceId.toLowerCase().includes(a)||r.spans.some(o=>o.name.toLowerCase().includes(a)||o.spanId.toLowerCase().includes(a)))},"Ce"),G=m(n=>Number.isFinite(n)?n>0&&n<1?`${n.toFixed(2)}ms`:`${String(Math.round(n))}ms`:"\u2014","q"),De=m(n=>!Number.isFinite(n)||n<=0?[]:Array.from({length:Me},(e,t)=>{let a=(t+1)/Me;return{label:G(n*a),percent:a*100}}),"Ee"),Se=m(n=>{if(typeof n=="string")return n;try{return JSON.stringify(n)}catch{return String(n)}},"ue"),ee=m(n=>{let e=(0,B.c)(7),{label:t,value:a}=n,l;e[0]!==t?(l=(0,s.jsx)("dt",{className:"w-40 shrink-0 text-muted-foreground",children:t}),e[0]=t,e[1]=l):l=e[1];let r;e[2]!==a?(r=(0,s.jsx)("dd",{className:"min-w-0 break-all",children:a}),e[2]=a,e[3]=r):r=e[3];let o;return e[4]!==l||e[5]!==r?(o=(0,s.jsxs)("div",{className:"flex gap-2",children:[l,r]}),e[4]=l,e[5]=r,e[6]=o):o=e[6],o},"Y"),Fe=m(n=>{let e=(0,B.c)(68),{span:t}=n,a=U(),l,r,o,d,i,u;if(e[0]!==t.attributes||e[1]!==t.durationMs||e[2]!==t.error||e[3]!==t.events||e[4]!==t.kind||e[5]!==t.offsetMs||e[6]!==t.parentSpanId||e[7]!==t.spanId||e[8]!==a){let $=Object.entries(t.attributes??{}),_;e[15]!==t.events?(_=t.events??[],e[15]=t.events,e[16]=_):_=e[16],l=_,r="border-t border-border bg-background/60 px-3 py-2 font-mono text-xs",o="tr-span-detail";let y;e[17]!==a?(y=a("Span ID"),e[17]=a,e[18]=y):y=e[18];let w;e[19]!==t.spanId||e[20]!==y?(w=(0,s.jsx)(ee,{label:y,value:t.spanId}),e[19]=t.spanId,e[20]=y,e[21]=w):w=e[21];let M;e[22]!==a?(M=a("Parent span ID"),e[22]=a,e[23]=M):M=e[23];let p;e[24]!==t.parentSpanId||e[25]!==a?(p=t.parentSpanId===""?a("\u2014 (trace root)"):t.parentSpanId,e[24]=t.parentSpanId,e[25]=a,e[26]=p):p=e[26];let h;e[27]!==p||e[28]!==M?(h=(0,s.jsx)(ee,{label:M,value:p}),e[27]=p,e[28]=M,e[29]=h):h=e[29];let b;e[30]!==a?(b=a("Kind"),e[30]=a,e[31]=b):b=e[31];let C=t.kind??"internal",S;e[32]!==b||e[33]!==C?(S=(0,s.jsx)(ee,{label:b,value:C}),e[32]=b,e[33]=C,e[34]=S):S=e[34];let I;e[35]!==a?(I=a("Started at"),e[35]=a,e[36]=I):I=e[36];let g;e[37]!==t.offsetMs||e[38]!==a?(g=a("+{offset}",{offset:G(t.offsetMs)}),e[37]=t.offsetMs,e[38]=a,e[39]=g):g=e[39];let x;e[40]!==I||e[41]!==g?(x=(0,s.jsx)(ee,{label:I,value:g}),e[40]=I,e[41]=g,e[42]=x):x=e[42];let k;e[43]!==a?(k=a("Duration"),e[43]=a,e[44]=k):k=e[44];let f;e[45]!==t.durationMs?(f=G(t.durationMs),e[45]=t.durationMs,e[46]=f):f=e[46];let N;e[47]!==k||e[48]!==f?(N=(0,s.jsx)(ee,{label:k,value:f}),e[47]=k,e[48]=f,e[49]=N):N=e[49],e[50]!==h||e[51]!==S||e[52]!==x||e[53]!==N||e[54]!==w?(d=(0,s.jsxs)("dl",{className:"flex flex-col gap-1",children:[w,h,S,x,N]}),e[50]=h,e[51]=S,e[52]=x,e[53]=N,e[54]=w,e[55]=d):d=e[55],e[56]!==t.error?(i=t.error!==void 0&&(0,s.jsxs)("div",{className:"mt-2 rounded-md border border-destructive/40 bg-destructive/10 px-2 py-1.5","data-testid":"tr-detail-error",children:[(0,s.jsx)("span",{className:"font-semibold text-destructive",children:t.error.type}),(0,s.jsx)("p",{className:"whitespace-pre-wrap break-all text-destructive",children:t.error.message})]}),e[56]=t.error,e[57]=i):i=e[57],u=$.length>0&&(0,s.jsxs)("div",{className:"mt-2","data-testid":"tr-detail-attributes",children:[(0,s.jsx)("p",{className:"mb-1 text-muted-foreground",children:a("Attributes")}),(0,s.jsx)("dl",{className:"flex flex-col gap-1",children:$.map(je)})]}),e[0]=t.attributes,e[1]=t.durationMs,e[2]=t.error,e[3]=t.events,e[4]=t.kind,e[5]=t.offsetMs,e[6]=t.parentSpanId,e[7]=t.spanId,e[8]=a,e[9]=l,e[10]=r,e[11]=o,e[12]=d,e[13]=i,e[14]=u}else l=e[9],r=e[10],o=e[11],d=e[12],i=e[13],u=e[14];let c;e[58]!==l||e[59]!==a?(c=l.length>0&&(0,s.jsxs)("div",{className:"mt-2","data-testid":"tr-detail-events",children:[(0,s.jsx)("p",{className:"mb-1 text-muted-foreground",children:a("Events")}),(0,s.jsx)("ul",{className:"flex flex-col gap-1",children:l.map(Oe)})]}),e[58]=l,e[59]=a,e[60]=c):c=e[60];let v;return e[61]!==r||e[62]!==o||e[63]!==d||e[64]!==i||e[65]!==u||e[66]!==c?(v=(0,s.jsxs)("div",{className:r,"data-testid":o,children:[d,i,u,c]}),e[61]=r,e[62]=o,e[63]=d,e[64]=i,e[65]=u,e[66]=c,e[67]=v):v=e[67],v},"Pe");function je(n){let[e,t]=n;return(0,s.jsx)(ee,{label:e,value:Se(t)},e)}m(je,"Fe");function Ee(n){let[e,t]=n;return`${e}=${Se(t)}`}m(Ee,"Ke");function Oe(n){return(0,s.jsxs)("li",{className:"flex gap-2",children:[(0,s.jsx)("span",{className:"shrink-0 tabular-nums text-muted-foreground",children:de(n.ts)}),(0,s.jsx)(oe,{variant:"secondary",children:n.name}),(0,s.jsx)("span",{className:"min-w-0 break-all text-muted-foreground",children:Object.entries(n.attributes??{}).map(Ee).join(" ")})]},`${n.name}:${String(n.ts)}`)}m(Oe,"Ae");var Be=14,ke="grid grid-cols-[14rem_1fr_4rem_16rem_16rem] items-center gap-2 px-3",Re=m(n=>{let e=(0,B.c)(17),{traceDurationMs:t}=n,a,l,r,o,d,i;if(e[0]!==t){i=Symbol.for("react.early_return_sentinel");e:{let v=De(t);if(v.length===0){i=null;break e}e[7]===Symbol.for("react.memo_cache_sentinel")?(r=te(ke,"border-b border-border py-1 font-mono text-[10px] text-muted-foreground"),e[7]=r):r=e[7],o="tr-ruler",e[8]===Symbol.for("react.memo_cache_sentinel")?(d=(0,s.jsx)("span",{}),e[8]=d):d=e[8],a="relative h-3",l=v.map(ze)}e[0]=t,e[1]=a,e[2]=l,e[3]=r,e[4]=o,e[5]=d,e[6]=i}else a=e[1],l=e[2],r=e[3],o=e[4],d=e[5],i=e[6];if(i!==Symbol.for("react.early_return_sentinel"))return i;let u;e[9]!==a||e[10]!==l?(u=(0,s.jsx)("span",{className:a,children:l}),e[9]=a,e[10]=l,e[11]=u):u=e[11];let c;return e[12]!==r||e[13]!==o||e[14]!==d||e[15]!==u?(c=(0,s.jsxs)("div",{className:r,"data-testid":o,children:[d,u]}),e[12]=r,e[13]=o,e[14]=d,e[15]=u,e[16]=c):c=e[16],c},"Re"),We=m(n=>{let e=(0,B.c)(60),{span:t,traceDurationMs:a}=n,l=U(),[r,o]=(0,O.useState)(!1),d;e[0]!==t||e[1]!==a?(d=Pe(t,a),e[0]=t,e[1]=a,e[2]=d):d=e[2];let{leftPercent:i,widthPercent:u}=d,c;e[3]!==t.attributes?(c=Ne(t.attributes),e[3]=t.attributes,e[4]=c):c=e[4];let v=c,$=t.depth*Be,_;e[5]!==$?(_={paddingLeft:$},e[5]=$,e[6]=_):_=e[6];let y=_,w=`${String(i)}%`,M=`${String(u)}%`,p;e[7]!==w||e[8]!==M?(p={left:w,width:M},e[7]=w,e[8]=M,e[9]=p):p=e[9];let h=p,b;e[10]===Symbol.for("react.memo_cache_sentinel")?(b=m(()=>{o(Je)},"h"),e[10]=b):b=e[10];let C=b,S=t.depth,I=`tr-span-detail-${t.spanId}`,g;e[11]!==t.durationMs||e[12]!==t.error||e[13]!==t.name||e[14]!==t.offsetMs||e[15]!==l?(g=l("{name}, {duration}, starts {offset} in{failure}",{duration:G(t.durationMs),failure:t.error===void 0?"":l(", failed: {message}",{message:t.error.message}),name:t.name,offset:G(t.offsetMs)}),e[11]=t.durationMs,e[12]=t.error,e[13]=t.name,e[14]=t.offsetMs,e[15]=l,e[16]=g):g=e[16];let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=te(ke,"w-full border-b border-border py-1.5 text-left font-mono text-xs hover:bg-muted/50"),e[17]=x):x=e[17];let k=`tr-span-toggle-${t.spanId}`,f;e[18]!==t.ok?(f=t.ok?null:(0,s.jsx)("span",{"aria-hidden":"true",className:"mr-1 text-destructive","data-testid":"tr-span-error",children:"\u25CF"}),e[18]=t.ok,e[19]=f):f=e[19];let N;e[20]!==y||e[21]!==t.name||e[22]!==f?(N=(0,s.jsxs)("span",{className:"truncate",style:y,title:t.name,children:[f,t.name]}),e[20]=y,e[21]=t.name,e[22]=f,e[23]=N):N=e[23];let R=t.ok?"bg-primary/70":"bg-destructive",L;e[24]!==R?(L=te("absolute inset-y-0 rounded-sm",R),e[24]=R,e[25]=L):L=e[25];let E;e[26]!==h||e[27]!==i||e[28]!==L||e[29]!==u?(E=(0,s.jsx)("span",{"aria-hidden":"true",className:"relative h-3 overflow-hidden rounded-sm bg-muted",children:(0,s.jsx)("span",{className:L,"data-left":i,"data-testid":"tr-span-bar","data-width":u,style:h})}),e[26]=h,e[27]=i,e[28]=L,e[29]=u,e[30]=E):E=e[30];let W;e[31]!==t.durationMs?(W=G(t.durationMs),e[31]=t.durationMs,e[32]=W):W=e[32];let D;e[33]!==W?(D=(0,s.jsx)("span",{className:"text-right tabular-nums text-muted-foreground",children:W}),e[33]=W,e[34]=D):D=e[34];let q;e[35]!==t.error?(q=t.error===void 0?null:(0,s.jsx)("span",{className:"text-destructive","data-testid":"tr-span-error-message",title:t.error.message,children:`${t.error.type}: ${t.error.message}`}),e[35]=t.error,e[36]=q):q=e[36];let T;e[37]!==q?(T=(0,s.jsx)("span",{className:"truncate text-muted-foreground",children:q}),e[37]=q,e[38]=T):T=e[38];let z;e[39]!==v?(z=v===""?null:(0,s.jsx)("span",{"data-testid":"tr-span-attributes",title:v,children:v}),e[39]=v,e[40]=z):z=e[40];let P;e[41]!==z?(P=(0,s.jsx)("span",{className:"truncate text-muted-foreground",children:z}),e[41]=z,e[42]=P):P=e[42];let J;e[43]!==r||e[44]!==I||e[45]!==g||e[46]!==k||e[47]!==N||e[48]!==E||e[49]!==D||e[50]!==T||e[51]!==P?(J=(0,s.jsxs)("button",{"aria-controls":I,"aria-expanded":r,"aria-label":g,className:x,"data-testid":k,onClick:C,type:"button",children:[N,E,D,T,P]}),e[43]=r,e[44]=I,e[45]=g,e[46]=k,e[47]=N,e[48]=E,e[49]=D,e[50]=T,e[51]=P,e[52]=J):J=e[52];let F;e[53]!==r||e[54]!==t?(F=r&&(0,s.jsx)("div",{id:`tr-span-detail-${t.spanId}`,children:(0,s.jsx)(Fe,{span:t})}),e[53]=r,e[54]=t,e[55]=F):F=e[55];let K;return e[56]!==t.depth||e[57]!==J||e[58]!==F?(K=(0,s.jsxs)("li",{"data-depth":S,"data-testid":"tr-span-row",children:[J,F]}),e[56]=t.depth,e[57]=J,e[58]=F,e[59]=K):K=e[59],K},"Be"),qe=m(n=>{let e=(0,B.c)(15),{durationMs:t,spans:a}=n,l=U(),r;e[0]!==t?(r=(0,s.jsx)(Re,{traceDurationMs:t}),e[0]=t,e[1]=r):r=e[1];let o;e[2]!==l?(o=l("Trace waterfall"),e[2]=l,e[3]=o):o=e[3];let d;if(e[4]!==t||e[5]!==a){let c;e[7]!==t?(c=m(v=>(0,s.jsx)(We,{span:v,traceDurationMs:t},v.spanId),"c"),e[7]=t,e[8]=c):c=e[8],d=a.map(c),e[4]=t,e[5]=a,e[6]=d}else d=e[6];let i;e[9]!==o||e[10]!==d?(i=(0,s.jsx)("ul",{"aria-label":o,children:d}),e[9]=o,e[10]=d,e[11]=i):i=e[11];let u;return e[12]!==r||e[13]!==i?(u=(0,s.jsxs)(s.Fragment,{children:[r,i]}),e[12]=r,e[13]=i,e[14]=u):u=e[14],u},"Oe");function ze(n){return(0,s.jsx)("span",{className:te("absolute inset-y-0 border-l border-border/70",n.percent===100?"-translate-x-full pr-1":"pl-1"),style:{left:`${String(n.percent)}%`},children:n.label},n.percent)}m(ze,"je");function Je(n){return!n}m(Je,"We");var Ue=m(n=>Array.isArray(n?.traces)?n.traces:[],"Ue"),Ge=m(n=>{let e=(0,B.c)(12),{entries:t}=n,a=U(),l;e[0]!==t.length||e[1]!==a?(l=a("Logs ({count})",{count:t.length}),e[0]=t.length,e[1]=a,e[2]=l):l=e[2];let r;e[3]!==l?(r=(0,s.jsx)("p",{className:"mb-1 font-mono text-xs text-muted-foreground",children:l}),e[3]=l,e[4]=r):r=e[4];let o;e[5]!==t?(o=t.map(Qe),e[5]=t,e[6]=o):o=e[6];let d;e[7]!==o?(d=(0,s.jsx)("div",{role:"grid",children:o}),e[7]=o,e[8]=d):d=e[8];let i;return e[9]!==r||e[10]!==d?(i=(0,s.jsxs)("div",{className:"border-t border-border px-3 py-2","data-testid":"tr-logs",children:[r,d]}),e[9]=r,e[10]=d,e[11]=i):i=e[11],i},"qe"),He=m(n=>{let e=(0,B.c)(50),{expanded:t,logs:a,onToggle:l,trace:r}=n,o=U(),d;e[0]!==l||e[1]!==r.traceId?(d=m(()=>{l(r.traceId)},"i"),e[0]=l,e[1]=r.traceId,e[2]=d):d=e[2];let i=d,u=`tr-row-${r.traceId}`,c=`tr-waterfall-${r.traceId}`,v=`tr-toggle-${r.traceId}`,$=t?"\u25BE":"\u25B8",_;e[3]!==$?(_=(0,s.jsx)("span",{"aria-hidden":"true",className:"w-3 shrink-0 text-xs text-muted-foreground",children:$}),e[3]=$,e[4]=_):_=e[4];let y;e[5]!==r.rootName?(y=(0,s.jsx)("span",{className:"w-56 shrink-0 truncate text-sm font-medium",title:r.rootName,children:r.rootName}),e[5]=r.rootName,e[6]=y):y=e[6];let w;e[7]!==r.functionPath?(w=(0,s.jsx)("span",{className:"w-48 shrink-0 truncate font-mono text-xs text-muted-foreground",title:r.functionPath,children:r.functionPath}),e[7]=r.functionPath,e[8]=w):w=e[8];let M;e[9]!==r.durationMs?(M=G(r.durationMs),e[9]=r.durationMs,e[10]=M):M=e[10];let p;e[11]!==M?(p=(0,s.jsx)("span",{className:"w-20 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground",children:M}),e[11]=M,e[12]=p):p=e[12];let h;e[13]!==o||e[14]!==r.spans.length?(h=o("{count} spans",{count:r.spans.length}),e[13]=o,e[14]=r.spans.length,e[15]=h):h=e[15];let b;e[16]!==h?(b=(0,s.jsx)("span",{className:"w-20 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground",children:h}),e[16]=h,e[17]=b):b=e[17];let C=r.ok?"secondary":"destructive",S;e[18]!==o||e[19]!==r.ok?(S=r.ok?o("ok"):o("error"),e[18]=o,e[19]=r.ok,e[20]=S):S=e[20];let I;e[21]!==C||e[22]!==S?(I=(0,s.jsx)("span",{className:"shrink-0",children:(0,s.jsx)(oe,{variant:C,children:S})}),e[21]=C,e[22]=S,e[23]=I):I=e[23];let g;e[24]!==r.startTs?(g=de(r.startTs),e[24]=r.startTs,e[25]=g):g=e[25];let x;e[26]!==g?(x=(0,s.jsx)("span",{className:"flex-1 truncate text-right font-mono text-xs tabular-nums text-muted-foreground",children:g}),e[26]=g,e[27]=x):x=e[27];let k;e[28]!==t||e[29]!==i||e[30]!==p||e[31]!==b||e[32]!==I||e[33]!==x||e[34]!==c||e[35]!==v||e[36]!==_||e[37]!==y||e[38]!==w?(k=(0,s.jsxs)("button",{"aria-controls":c,"aria-expanded":t,className:"flex w-full items-center gap-3 px-3 py-2 text-left hover:bg-muted/50","data-testid":v,onClick:i,type:"button",children:[_,y,w,p,b,I,x]}),e[28]=t,e[29]=i,e[30]=p,e[31]=b,e[32]=I,e[33]=x,e[34]=c,e[35]=v,e[36]=_,e[37]=y,e[38]=w,e[39]=k):k=e[39];let f;e[40]!==t||e[41]!==a||e[42]!==r.durationMs||e[43]!==r.spans||e[44]!==r.traceId?(f=t&&(0,s.jsxs)("div",{className:"bg-muted/20","data-testid":`tr-waterfall-${r.traceId}`,id:`tr-waterfall-${r.traceId}`,children:[(0,s.jsx)(qe,{durationMs:r.durationMs,spans:r.spans}),a.length>0&&(0,s.jsx)(Ge,{entries:a})]}),e[40]=t,e[41]=a,e[42]=r.durationMs,e[43]=r.spans,e[44]=r.traceId,e[45]=f):f=e[45];let N;return e[46]!==k||e[47]!==f||e[48]!==u?(N=(0,s.jsxs)("div",{className:"border-b border-border last:border-b-0","data-testid":u,children:[k,f]}),e[46]=k,e[47]=f,e[48]=u,e[49]=N):N=e[49],N},"ze"),ft=m(n=>{let e=(0,B.c)(58),{initialShardKey:t}=n,a=U(),[l]=(0,O.useState)(ve),{queryShardKey:r,setShardKey:o,shardKey:d}=fe(l?.shardKey!==void 0&&l.shardKey!==""?l.shardKey:t??""),[i,u]=(0,O.useState)(l?.traceId??""),[c,v]=(0,O.useState)(!1),[$,_]=(0,O.useState)(Ae),y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y=[],e[0]=y):y=e[0],(0,O.useEffect)(Ve,y);let w;e[1]===Symbol.for("react.memo_cache_sentinel")?(w={},e[1]=w):w=e[1];let M;e[2]!==r?(M={live:!0,shardKey:r},e[2]=r,e[3]=M):M=e[3];let{data:p,error:h,errorSource:b,isLoading:C,liveError:S}=ie(ce.getTraces,w,M),I;e[4]===Symbol.for("react.memo_cache_sentinel")?(I={},e[4]=I):I=e[4];let g=$.size>0,x;e[5]!==r||e[6]!==g?(x={enabled:g,live:!0,shardKey:r},e[5]=r,e[6]=g,e[7]=x):x=e[7];let{data:k}=ie(ce.getLogs,I,x),f,N;e[8]!==p||e[9]!==r?(f=m(()=>{p!==void 0&&pe(r)},"p"),N=[p,r],e[8]=p,e[9]=r,e[10]=f,e[11]=N):(f=e[10],N=e[11]),(0,O.useEffect)(f,N);let R;if(e[12]!==p||e[13]!==h||e[14]!==b||e[15]!==$||e[16]!==C||e[17]!==S||e[18]!==k?.entries||e[19]!==c||e[20]!==i||e[21]!==o||e[22]!==d||e[23]!==a){let L=Ue(p),E=p?.total??L.length,W=E>L.length,D=Ke(L,i,c),q=Map.groupBy((k?.entries??[]).toReversed(),Xe),T;e[25]===Symbol.for("react.memo_cache_sentinel")?(T=m(j=>{u(j.target.value)},"C"),e[25]=T):T=e[25];let z=T,P;e[26]===Symbol.for("react.memo_cache_sentinel")?(P=m(j=>{_(_e=>{let ne=new Set(_e);return ne.has(j)?ne.delete(j):ne.add(j),ne})},"E"),e[26]=P):P=e[26];let J=P,F=h===null&&D.length===0&&!C,K;e[27]!==o||e[28]!==d?(K=(0,s.jsx)(he,{onChange:o,testId:"tr-shard-input",value:d}),e[27]=o,e[28]=d,e[29]=K):K=e[29];let H;e[30]!==a?(H=a("Search traces"),e[30]=a,e[31]=H):H=e[31];let Q;e[32]!==a?(Q=a("search trace, span, or function"),e[32]=a,e[33]=Q):Q=e[33];let A;e[34]!==i||e[35]!==H||e[36]!==Q?(A=(0,s.jsx)(me,{"aria-label":H,className:"h-8 w-56","data-testid":"tr-search",onChange:z,placeholder:Q,value:i}),e[34]=i,e[35]=H,e[36]=Q,e[37]=A):A=e[37];let V;e[38]!==c?(V=(0,s.jsx)(ge,{checked:c,"data-testid":"tr-only-errors",id:"tr-only-errors",onCheckedChange:v}),e[38]=c,e[39]=V):V=e[39];let X;e[40]!==a?(X=a("Errors only"),e[40]=a,e[41]=X):X=e[41];let Y;e[42]!==V||e[43]!==X?(Y=(0,s.jsxs)("label",{className:"flex items-center gap-2 text-xs text-muted-foreground",htmlFor:"tr-only-errors",children:[V,X]}),e[42]=V,e[43]=X,e[44]=Y):Y=e[44];let Z;e[45]!==S?(Z=(0,s.jsx)(xe,{message:S,prefix:"tr"}),e[45]=S,e[46]=Z):Z=e[46];let re;e[47]!==K||e[48]!==A||e[49]!==Y||e[50]!==Z?(re=(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[K,A,Y,Z]}),e[47]=K,e[48]=A,e[49]=Y,e[50]=Z,e[51]=re):re=e[51];let ae;e[52]!==h||e[53]!==b?(ae=h!==null&&(0,s.jsx)(be,{error:b,testId:"tr-error"}),e[52]=h,e[53]=b,e[54]=ae):ae=e[54];let se;e[55]!==F||e[56]!==a?(se=F&&(0,s.jsx)(ue,{description:a("Traces recorded with ctx.trace show up here as your app handles traffic. The span buffer resets when the shard hibernates."),icon:(0,s.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,s.jsx)("path",{d:"M4 6h10M7 12h13M10 18h7"})}),testId:"tr-empty",title:a("No traces")}),e[55]=F,e[56]=a,e[57]=se):se=e[57],R=(0,s.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-traces-panel",children:[re,ae,se,h===null&&W&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"tr-truncated",children:a("Showing the {shown} most recent of {total} traces in the buffer.",{shown:L.length,total:E})}),h===null&&D.length>0&&(0,s.jsx)("div",{"aria-label":a("Recent traces"),className:"overflow-hidden rounded-xl border border-border shadow-xs","data-testid":"tr-list",children:D.map(j=>(0,s.jsx)(He,{expanded:$.has(j.traceId),logs:q.get(j.traceId)??[],onToggle:J,trace:j},j.traceId))})]}),e[12]=p,e[13]=h,e[14]=b,e[15]=$,e[16]=C,e[17]=S,e[18]=k?.entries,e[19]=c,e[20]=i,e[21]=o,e[22]=d,e[23]=a,e[24]=R}else R=e[24];return R},"gt");function Qe(n,e){return(0,s.jsx)("div",{className:"flex items-center border-b border-border py-1 font-mono text-xs last:border-b-0","data-testid":"tr-log-row",role:"row",children:(0,s.jsx)(we,{entry:n})},`${String(e)}:${String(n.timestamp)}`)}m(Qe,"Ge");function Ae(){return new Set}m(Ae,"He");function Ve(){ye()}m(Ve,"Je");function Xe(n){return n.traceId}m(Xe,"Qe");export{ft as default};
|
|
1
|
+
import{b as we}from"./chunk-5XMZP64Z.js";import{a as Ne}from"./chunk-CAOUXOL7.js";import{b as ve,c as ye}from"./chunk-2SFSTQS4.js";import{a as ge}from"./chunk-NIX2QSSN.js";import{a as xe}from"./chunk-E6P2ERQV.js";import"./chunk-VZCS5GXZ.js";import"./chunk-DKSLOJDQ.js";import{a as fe}from"./chunk-CKTKI4IY.js";import{a as he}from"./chunk-6UN4V2HB.js";import{b as pe}from"./chunk-KVSQKUWD.js";import"./chunk-ZHPDAJBM.js";import{P as me}from"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as oe}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as be}from"./chunk-JCSDJBBZ.js";import"./chunk-PZ4QDWTI.js";import"./chunk-GDC3W3DZ.js";import"./chunk-F7JOSNAT.js";import{a as ce}from"./chunk-DZGOHOOE.js";import{c as ie}from"./chunk-5DEXJ766.js";import"./chunk-NIUA7EHL.js";import"./chunk-RCZTUWG3.js";import{a as ue}from"./chunk-UANVABQG.js";import{d as U,s as de}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as m,d as le,e as $e,f as Ce,g as Le,i as te}from"./chunk-R5ZTCHCE.js";var B=le(Ce(),1),O=le($e(),1);var s=le(Le(),1);var Te=.5,Me=4,Ie=m(n=>Math.min(100,Math.max(0,n)),"ce"),Pe=m((n,e)=>{if(!Number.isFinite(e)||e<=0)return{leftPercent:0,widthPercent:100};let t=Ie(n.offsetMs/e*100),a=n.durationMs/e*100,l=Math.max(Te,Math.min(Ie(a),100-t));return{leftPercent:t,widthPercent:l}},"Le"),Ke=m((n,e,t=!1)=>{let a=e.trim().toLowerCase(),l=t?n.filter(r=>!r.ok):n;return a===""?[...l]:l.filter(r=>r.rootName.toLowerCase().includes(a)||r.functionPath.toLowerCase().includes(a)||r.traceId.toLowerCase().includes(a)||r.spans.some(o=>o.name.toLowerCase().includes(a)||o.spanId.toLowerCase().includes(a)))},"Ce"),G=m(n=>Number.isFinite(n)?n>0&&n<1?`${n.toFixed(2)}ms`:`${String(Math.round(n))}ms`:"\u2014","q"),De=m(n=>!Number.isFinite(n)||n<=0?[]:Array.from({length:Me},(e,t)=>{let a=(t+1)/Me;return{label:G(n*a),percent:a*100}}),"Ee"),Se=m(n=>{if(typeof n=="string")return n;try{return JSON.stringify(n)}catch{return String(n)}},"ue"),ee=m(n=>{let e=(0,B.c)(7),{label:t,value:a}=n,l;e[0]!==t?(l=(0,s.jsx)("dt",{className:"w-40 shrink-0 text-muted-foreground",children:t}),e[0]=t,e[1]=l):l=e[1];let r;e[2]!==a?(r=(0,s.jsx)("dd",{className:"min-w-0 break-all",children:a}),e[2]=a,e[3]=r):r=e[3];let o;return e[4]!==l||e[5]!==r?(o=(0,s.jsxs)("div",{className:"flex gap-2",children:[l,r]}),e[4]=l,e[5]=r,e[6]=o):o=e[6],o},"Y"),Fe=m(n=>{let e=(0,B.c)(68),{span:t}=n,a=U(),l,r,o,d,i,u;if(e[0]!==t.attributes||e[1]!==t.durationMs||e[2]!==t.error||e[3]!==t.events||e[4]!==t.kind||e[5]!==t.offsetMs||e[6]!==t.parentSpanId||e[7]!==t.spanId||e[8]!==a){let $=Object.entries(t.attributes??{}),_;e[15]!==t.events?(_=t.events??[],e[15]=t.events,e[16]=_):_=e[16],l=_,r="border-t border-border bg-background/60 px-3 py-2 font-mono text-xs",o="tr-span-detail";let y;e[17]!==a?(y=a("Span ID"),e[17]=a,e[18]=y):y=e[18];let w;e[19]!==t.spanId||e[20]!==y?(w=(0,s.jsx)(ee,{label:y,value:t.spanId}),e[19]=t.spanId,e[20]=y,e[21]=w):w=e[21];let M;e[22]!==a?(M=a("Parent span ID"),e[22]=a,e[23]=M):M=e[23];let p;e[24]!==t.parentSpanId||e[25]!==a?(p=t.parentSpanId===""?a("\u2014 (trace root)"):t.parentSpanId,e[24]=t.parentSpanId,e[25]=a,e[26]=p):p=e[26];let h;e[27]!==p||e[28]!==M?(h=(0,s.jsx)(ee,{label:M,value:p}),e[27]=p,e[28]=M,e[29]=h):h=e[29];let b;e[30]!==a?(b=a("Kind"),e[30]=a,e[31]=b):b=e[31];let C=t.kind??"internal",S;e[32]!==b||e[33]!==C?(S=(0,s.jsx)(ee,{label:b,value:C}),e[32]=b,e[33]=C,e[34]=S):S=e[34];let I;e[35]!==a?(I=a("Started at"),e[35]=a,e[36]=I):I=e[36];let g;e[37]!==t.offsetMs||e[38]!==a?(g=a("+{offset}",{offset:G(t.offsetMs)}),e[37]=t.offsetMs,e[38]=a,e[39]=g):g=e[39];let x;e[40]!==I||e[41]!==g?(x=(0,s.jsx)(ee,{label:I,value:g}),e[40]=I,e[41]=g,e[42]=x):x=e[42];let k;e[43]!==a?(k=a("Duration"),e[43]=a,e[44]=k):k=e[44];let f;e[45]!==t.durationMs?(f=G(t.durationMs),e[45]=t.durationMs,e[46]=f):f=e[46];let N;e[47]!==k||e[48]!==f?(N=(0,s.jsx)(ee,{label:k,value:f}),e[47]=k,e[48]=f,e[49]=N):N=e[49],e[50]!==h||e[51]!==S||e[52]!==x||e[53]!==N||e[54]!==w?(d=(0,s.jsxs)("dl",{className:"flex flex-col gap-1",children:[w,h,S,x,N]}),e[50]=h,e[51]=S,e[52]=x,e[53]=N,e[54]=w,e[55]=d):d=e[55],e[56]!==t.error?(i=t.error!==void 0&&(0,s.jsxs)("div",{className:"mt-2 rounded-md border border-destructive/40 bg-destructive/10 px-2 py-1.5","data-testid":"tr-detail-error",children:[(0,s.jsx)("span",{className:"font-semibold text-destructive",children:t.error.type}),(0,s.jsx)("p",{className:"whitespace-pre-wrap break-all text-destructive",children:t.error.message})]}),e[56]=t.error,e[57]=i):i=e[57],u=$.length>0&&(0,s.jsxs)("div",{className:"mt-2","data-testid":"tr-detail-attributes",children:[(0,s.jsx)("p",{className:"mb-1 text-muted-foreground",children:a("Attributes")}),(0,s.jsx)("dl",{className:"flex flex-col gap-1",children:$.map(je)})]}),e[0]=t.attributes,e[1]=t.durationMs,e[2]=t.error,e[3]=t.events,e[4]=t.kind,e[5]=t.offsetMs,e[6]=t.parentSpanId,e[7]=t.spanId,e[8]=a,e[9]=l,e[10]=r,e[11]=o,e[12]=d,e[13]=i,e[14]=u}else l=e[9],r=e[10],o=e[11],d=e[12],i=e[13],u=e[14];let c;e[58]!==l||e[59]!==a?(c=l.length>0&&(0,s.jsxs)("div",{className:"mt-2","data-testid":"tr-detail-events",children:[(0,s.jsx)("p",{className:"mb-1 text-muted-foreground",children:a("Events")}),(0,s.jsx)("ul",{className:"flex flex-col gap-1",children:l.map(Oe)})]}),e[58]=l,e[59]=a,e[60]=c):c=e[60];let v;return e[61]!==r||e[62]!==o||e[63]!==d||e[64]!==i||e[65]!==u||e[66]!==c?(v=(0,s.jsxs)("div",{className:r,"data-testid":o,children:[d,i,u,c]}),e[61]=r,e[62]=o,e[63]=d,e[64]=i,e[65]=u,e[66]=c,e[67]=v):v=e[67],v},"Pe");function je(n){let[e,t]=n;return(0,s.jsx)(ee,{label:e,value:Se(t)},e)}m(je,"Fe");function Ee(n){let[e,t]=n;return`${e}=${Se(t)}`}m(Ee,"Ke");function Oe(n){return(0,s.jsxs)("li",{className:"flex gap-2",children:[(0,s.jsx)("span",{className:"shrink-0 tabular-nums text-muted-foreground",children:de(n.ts)}),(0,s.jsx)(oe,{variant:"secondary",children:n.name}),(0,s.jsx)("span",{className:"min-w-0 break-all text-muted-foreground",children:Object.entries(n.attributes??{}).map(Ee).join(" ")})]},`${n.name}:${String(n.ts)}`)}m(Oe,"Ae");var Be=14,ke="grid grid-cols-[14rem_1fr_4rem_16rem_16rem] items-center gap-2 px-3",Re=m(n=>{let e=(0,B.c)(17),{traceDurationMs:t}=n,a,l,r,o,d,i;if(e[0]!==t){i=Symbol.for("react.early_return_sentinel");e:{let v=De(t);if(v.length===0){i=null;break e}e[7]===Symbol.for("react.memo_cache_sentinel")?(r=te(ke,"border-b border-border py-1 font-mono text-[10px] text-muted-foreground"),e[7]=r):r=e[7],o="tr-ruler",e[8]===Symbol.for("react.memo_cache_sentinel")?(d=(0,s.jsx)("span",{}),e[8]=d):d=e[8],a="relative h-3",l=v.map(ze)}e[0]=t,e[1]=a,e[2]=l,e[3]=r,e[4]=o,e[5]=d,e[6]=i}else a=e[1],l=e[2],r=e[3],o=e[4],d=e[5],i=e[6];if(i!==Symbol.for("react.early_return_sentinel"))return i;let u;e[9]!==a||e[10]!==l?(u=(0,s.jsx)("span",{className:a,children:l}),e[9]=a,e[10]=l,e[11]=u):u=e[11];let c;return e[12]!==r||e[13]!==o||e[14]!==d||e[15]!==u?(c=(0,s.jsxs)("div",{className:r,"data-testid":o,children:[d,u]}),e[12]=r,e[13]=o,e[14]=d,e[15]=u,e[16]=c):c=e[16],c},"Re"),We=m(n=>{let e=(0,B.c)(60),{span:t,traceDurationMs:a}=n,l=U(),[r,o]=(0,O.useState)(!1),d;e[0]!==t||e[1]!==a?(d=Pe(t,a),e[0]=t,e[1]=a,e[2]=d):d=e[2];let{leftPercent:i,widthPercent:u}=d,c;e[3]!==t.attributes?(c=Ne(t.attributes),e[3]=t.attributes,e[4]=c):c=e[4];let v=c,$=t.depth*Be,_;e[5]!==$?(_={paddingLeft:$},e[5]=$,e[6]=_):_=e[6];let y=_,w=`${String(i)}%`,M=`${String(u)}%`,p;e[7]!==w||e[8]!==M?(p={left:w,width:M},e[7]=w,e[8]=M,e[9]=p):p=e[9];let h=p,b;e[10]===Symbol.for("react.memo_cache_sentinel")?(b=m(()=>{o(Je)},"h"),e[10]=b):b=e[10];let C=b,S=t.depth,I=`tr-span-detail-${t.spanId}`,g;e[11]!==t.durationMs||e[12]!==t.error||e[13]!==t.name||e[14]!==t.offsetMs||e[15]!==l?(g=l("{name}, {duration}, starts {offset} in{failure}",{duration:G(t.durationMs),failure:t.error===void 0?"":l(", failed: {message}",{message:t.error.message}),name:t.name,offset:G(t.offsetMs)}),e[11]=t.durationMs,e[12]=t.error,e[13]=t.name,e[14]=t.offsetMs,e[15]=l,e[16]=g):g=e[16];let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=te(ke,"w-full border-b border-border py-1.5 text-left font-mono text-xs hover:bg-muted/50"),e[17]=x):x=e[17];let k=`tr-span-toggle-${t.spanId}`,f;e[18]!==t.ok?(f=t.ok?null:(0,s.jsx)("span",{"aria-hidden":"true",className:"mr-1 text-destructive","data-testid":"tr-span-error",children:"\u25CF"}),e[18]=t.ok,e[19]=f):f=e[19];let N;e[20]!==y||e[21]!==t.name||e[22]!==f?(N=(0,s.jsxs)("span",{className:"truncate",style:y,title:t.name,children:[f,t.name]}),e[20]=y,e[21]=t.name,e[22]=f,e[23]=N):N=e[23];let R=t.ok?"bg-primary/70":"bg-destructive",L;e[24]!==R?(L=te("absolute inset-y-0 rounded-sm",R),e[24]=R,e[25]=L):L=e[25];let E;e[26]!==h||e[27]!==i||e[28]!==L||e[29]!==u?(E=(0,s.jsx)("span",{"aria-hidden":"true",className:"relative h-3 overflow-hidden rounded-sm bg-muted",children:(0,s.jsx)("span",{className:L,"data-left":i,"data-testid":"tr-span-bar","data-width":u,style:h})}),e[26]=h,e[27]=i,e[28]=L,e[29]=u,e[30]=E):E=e[30];let W;e[31]!==t.durationMs?(W=G(t.durationMs),e[31]=t.durationMs,e[32]=W):W=e[32];let D;e[33]!==W?(D=(0,s.jsx)("span",{className:"text-right tabular-nums text-muted-foreground",children:W}),e[33]=W,e[34]=D):D=e[34];let q;e[35]!==t.error?(q=t.error===void 0?null:(0,s.jsx)("span",{className:"text-destructive","data-testid":"tr-span-error-message",title:t.error.message,children:`${t.error.type}: ${t.error.message}`}),e[35]=t.error,e[36]=q):q=e[36];let T;e[37]!==q?(T=(0,s.jsx)("span",{className:"truncate text-muted-foreground",children:q}),e[37]=q,e[38]=T):T=e[38];let z;e[39]!==v?(z=v===""?null:(0,s.jsx)("span",{"data-testid":"tr-span-attributes",title:v,children:v}),e[39]=v,e[40]=z):z=e[40];let P;e[41]!==z?(P=(0,s.jsx)("span",{className:"truncate text-muted-foreground",children:z}),e[41]=z,e[42]=P):P=e[42];let J;e[43]!==r||e[44]!==I||e[45]!==g||e[46]!==k||e[47]!==N||e[48]!==E||e[49]!==D||e[50]!==T||e[51]!==P?(J=(0,s.jsxs)("button",{"aria-controls":I,"aria-expanded":r,"aria-label":g,className:x,"data-testid":k,onClick:C,type:"button",children:[N,E,D,T,P]}),e[43]=r,e[44]=I,e[45]=g,e[46]=k,e[47]=N,e[48]=E,e[49]=D,e[50]=T,e[51]=P,e[52]=J):J=e[52];let F;e[53]!==r||e[54]!==t?(F=r&&(0,s.jsx)("div",{id:`tr-span-detail-${t.spanId}`,children:(0,s.jsx)(Fe,{span:t})}),e[53]=r,e[54]=t,e[55]=F):F=e[55];let K;return e[56]!==t.depth||e[57]!==J||e[58]!==F?(K=(0,s.jsxs)("li",{"data-depth":S,"data-testid":"tr-span-row",children:[J,F]}),e[56]=t.depth,e[57]=J,e[58]=F,e[59]=K):K=e[59],K},"Be"),qe=m(n=>{let e=(0,B.c)(15),{durationMs:t,spans:a}=n,l=U(),r;e[0]!==t?(r=(0,s.jsx)(Re,{traceDurationMs:t}),e[0]=t,e[1]=r):r=e[1];let o;e[2]!==l?(o=l("Trace waterfall"),e[2]=l,e[3]=o):o=e[3];let d;if(e[4]!==t||e[5]!==a){let c;e[7]!==t?(c=m(v=>(0,s.jsx)(We,{span:v,traceDurationMs:t},v.spanId),"c"),e[7]=t,e[8]=c):c=e[8],d=a.map(c),e[4]=t,e[5]=a,e[6]=d}else d=e[6];let i;e[9]!==o||e[10]!==d?(i=(0,s.jsx)("ul",{"aria-label":o,children:d}),e[9]=o,e[10]=d,e[11]=i):i=e[11];let u;return e[12]!==r||e[13]!==i?(u=(0,s.jsxs)(s.Fragment,{children:[r,i]}),e[12]=r,e[13]=i,e[14]=u):u=e[14],u},"Oe");function ze(n){return(0,s.jsx)("span",{className:te("absolute inset-y-0 border-l border-border/70",n.percent===100?"-translate-x-full pr-1":"pl-1"),style:{left:`${String(n.percent)}%`},children:n.label},n.percent)}m(ze,"je");function Je(n){return!n}m(Je,"We");var Ue=m(n=>Array.isArray(n?.traces)?n.traces:[],"Ue"),Ge=m(n=>{let e=(0,B.c)(12),{entries:t}=n,a=U(),l;e[0]!==t.length||e[1]!==a?(l=a("Logs ({count})",{count:t.length}),e[0]=t.length,e[1]=a,e[2]=l):l=e[2];let r;e[3]!==l?(r=(0,s.jsx)("p",{className:"mb-1 font-mono text-xs text-muted-foreground",children:l}),e[3]=l,e[4]=r):r=e[4];let o;e[5]!==t?(o=t.map(Qe),e[5]=t,e[6]=o):o=e[6];let d;e[7]!==o?(d=(0,s.jsx)("div",{role:"grid",children:o}),e[7]=o,e[8]=d):d=e[8];let i;return e[9]!==r||e[10]!==d?(i=(0,s.jsxs)("div",{className:"border-t border-border px-3 py-2","data-testid":"tr-logs",children:[r,d]}),e[9]=r,e[10]=d,e[11]=i):i=e[11],i},"qe"),He=m(n=>{let e=(0,B.c)(50),{expanded:t,logs:a,onToggle:l,trace:r}=n,o=U(),d;e[0]!==l||e[1]!==r.traceId?(d=m(()=>{l(r.traceId)},"i"),e[0]=l,e[1]=r.traceId,e[2]=d):d=e[2];let i=d,u=`tr-row-${r.traceId}`,c=`tr-waterfall-${r.traceId}`,v=`tr-toggle-${r.traceId}`,$=t?"\u25BE":"\u25B8",_;e[3]!==$?(_=(0,s.jsx)("span",{"aria-hidden":"true",className:"w-3 shrink-0 text-xs text-muted-foreground",children:$}),e[3]=$,e[4]=_):_=e[4];let y;e[5]!==r.rootName?(y=(0,s.jsx)("span",{className:"w-56 shrink-0 truncate text-sm font-medium",title:r.rootName,children:r.rootName}),e[5]=r.rootName,e[6]=y):y=e[6];let w;e[7]!==r.functionPath?(w=(0,s.jsx)("span",{className:"w-48 shrink-0 truncate font-mono text-xs text-muted-foreground",title:r.functionPath,children:r.functionPath}),e[7]=r.functionPath,e[8]=w):w=e[8];let M;e[9]!==r.durationMs?(M=G(r.durationMs),e[9]=r.durationMs,e[10]=M):M=e[10];let p;e[11]!==M?(p=(0,s.jsx)("span",{className:"w-20 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground",children:M}),e[11]=M,e[12]=p):p=e[12];let h;e[13]!==o||e[14]!==r.spans.length?(h=o("{count} spans",{count:r.spans.length}),e[13]=o,e[14]=r.spans.length,e[15]=h):h=e[15];let b;e[16]!==h?(b=(0,s.jsx)("span",{className:"w-20 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground",children:h}),e[16]=h,e[17]=b):b=e[17];let C=r.ok?"secondary":"destructive",S;e[18]!==o||e[19]!==r.ok?(S=r.ok?o("ok"):o("error"),e[18]=o,e[19]=r.ok,e[20]=S):S=e[20];let I;e[21]!==C||e[22]!==S?(I=(0,s.jsx)("span",{className:"shrink-0",children:(0,s.jsx)(oe,{variant:C,children:S})}),e[21]=C,e[22]=S,e[23]=I):I=e[23];let g;e[24]!==r.startTs?(g=de(r.startTs),e[24]=r.startTs,e[25]=g):g=e[25];let x;e[26]!==g?(x=(0,s.jsx)("span",{className:"flex-1 truncate text-right font-mono text-xs tabular-nums text-muted-foreground",children:g}),e[26]=g,e[27]=x):x=e[27];let k;e[28]!==t||e[29]!==i||e[30]!==p||e[31]!==b||e[32]!==I||e[33]!==x||e[34]!==c||e[35]!==v||e[36]!==_||e[37]!==y||e[38]!==w?(k=(0,s.jsxs)("button",{"aria-controls":c,"aria-expanded":t,className:"flex w-full items-center gap-3 px-3 py-2 text-left hover:bg-muted/50","data-testid":v,onClick:i,type:"button",children:[_,y,w,p,b,I,x]}),e[28]=t,e[29]=i,e[30]=p,e[31]=b,e[32]=I,e[33]=x,e[34]=c,e[35]=v,e[36]=_,e[37]=y,e[38]=w,e[39]=k):k=e[39];let f;e[40]!==t||e[41]!==a||e[42]!==r.durationMs||e[43]!==r.spans||e[44]!==r.traceId?(f=t&&(0,s.jsxs)("div",{className:"bg-muted/20","data-testid":`tr-waterfall-${r.traceId}`,id:`tr-waterfall-${r.traceId}`,children:[(0,s.jsx)(qe,{durationMs:r.durationMs,spans:r.spans}),a.length>0&&(0,s.jsx)(Ge,{entries:a})]}),e[40]=t,e[41]=a,e[42]=r.durationMs,e[43]=r.spans,e[44]=r.traceId,e[45]=f):f=e[45];let N;return e[46]!==k||e[47]!==f||e[48]!==u?(N=(0,s.jsxs)("div",{className:"border-b border-border last:border-b-0","data-testid":u,children:[k,f]}),e[46]=k,e[47]=f,e[48]=u,e[49]=N):N=e[49],N},"ze"),ft=m(n=>{let e=(0,B.c)(58),{initialShardKey:t}=n,a=U(),[l]=(0,O.useState)(ve),{queryShardKey:r,setShardKey:o,shardKey:d}=fe(l?.shardKey!==void 0&&l.shardKey!==""?l.shardKey:t??""),[i,u]=(0,O.useState)(l?.traceId??""),[c,v]=(0,O.useState)(!1),[$,_]=(0,O.useState)(Ae),y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y=[],e[0]=y):y=e[0],(0,O.useEffect)(Ve,y);let w;e[1]===Symbol.for("react.memo_cache_sentinel")?(w={},e[1]=w):w=e[1];let M;e[2]!==r?(M={live:!0,shardKey:r},e[2]=r,e[3]=M):M=e[3];let{data:p,error:h,errorSource:b,isLoading:C,liveError:S}=ie(ce.getTraces,w,M),I;e[4]===Symbol.for("react.memo_cache_sentinel")?(I={},e[4]=I):I=e[4];let g=$.size>0,x;e[5]!==r||e[6]!==g?(x={enabled:g,live:!0,shardKey:r},e[5]=r,e[6]=g,e[7]=x):x=e[7];let{data:k}=ie(ce.getLogs,I,x),f,N;e[8]!==p||e[9]!==r?(f=m(()=>{p!==void 0&&pe(r)},"p"),N=[p,r],e[8]=p,e[9]=r,e[10]=f,e[11]=N):(f=e[10],N=e[11]),(0,O.useEffect)(f,N);let R;if(e[12]!==p||e[13]!==h||e[14]!==b||e[15]!==$||e[16]!==C||e[17]!==S||e[18]!==k?.entries||e[19]!==c||e[20]!==i||e[21]!==o||e[22]!==d||e[23]!==a){let L=Ue(p),E=p?.total??L.length,W=E>L.length,D=Ke(L,i,c),q=Map.groupBy((k?.entries??[]).toReversed(),Xe),T;e[25]===Symbol.for("react.memo_cache_sentinel")?(T=m(j=>{u(j.target.value)},"C"),e[25]=T):T=e[25];let z=T,P;e[26]===Symbol.for("react.memo_cache_sentinel")?(P=m(j=>{_(_e=>{let ne=new Set(_e);return ne.has(j)?ne.delete(j):ne.add(j),ne})},"E"),e[26]=P):P=e[26];let J=P,F=h===null&&D.length===0&&!C,K;e[27]!==o||e[28]!==d?(K=(0,s.jsx)(he,{onChange:o,testId:"tr-shard-input",value:d}),e[27]=o,e[28]=d,e[29]=K):K=e[29];let H;e[30]!==a?(H=a("Search traces"),e[30]=a,e[31]=H):H=e[31];let Q;e[32]!==a?(Q=a("search trace, span, or function"),e[32]=a,e[33]=Q):Q=e[33];let A;e[34]!==i||e[35]!==H||e[36]!==Q?(A=(0,s.jsx)(me,{"aria-label":H,className:"h-8 w-56","data-testid":"tr-search",onChange:z,placeholder:Q,value:i}),e[34]=i,e[35]=H,e[36]=Q,e[37]=A):A=e[37];let V;e[38]!==c?(V=(0,s.jsx)(ge,{checked:c,"data-testid":"tr-only-errors",id:"tr-only-errors",onCheckedChange:v}),e[38]=c,e[39]=V):V=e[39];let X;e[40]!==a?(X=a("Errors only"),e[40]=a,e[41]=X):X=e[41];let Y;e[42]!==V||e[43]!==X?(Y=(0,s.jsxs)("label",{className:"flex items-center gap-2 text-xs text-muted-foreground",htmlFor:"tr-only-errors",children:[V,X]}),e[42]=V,e[43]=X,e[44]=Y):Y=e[44];let Z;e[45]!==S?(Z=(0,s.jsx)(xe,{message:S,prefix:"tr"}),e[45]=S,e[46]=Z):Z=e[46];let re;e[47]!==K||e[48]!==A||e[49]!==Y||e[50]!==Z?(re=(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[K,A,Y,Z]}),e[47]=K,e[48]=A,e[49]=Y,e[50]=Z,e[51]=re):re=e[51];let ae;e[52]!==h||e[53]!==b?(ae=h!==null&&(0,s.jsx)(be,{error:b,testId:"tr-error"}),e[52]=h,e[53]=b,e[54]=ae):ae=e[54];let se;e[55]!==F||e[56]!==a?(se=F&&(0,s.jsx)(ue,{description:a("Traces recorded with ctx.trace show up here as your app handles traffic. The span buffer resets when the shard hibernates."),icon:(0,s.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,s.jsx)("path",{d:"M4 6h10M7 12h13M10 18h7"})}),testId:"tr-empty",title:a("No traces")}),e[55]=F,e[56]=a,e[57]=se):se=e[57],R=(0,s.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-traces-panel",children:[re,ae,se,h===null&&W&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"tr-truncated",children:a("Showing the {shown} most recent of {total} traces in the buffer.",{shown:L.length,total:E})}),h===null&&D.length>0&&(0,s.jsx)("div",{"aria-label":a("Recent traces"),className:"overflow-hidden rounded-xl border border-border shadow-xs","data-testid":"tr-list",children:D.map(j=>(0,s.jsx)(He,{expanded:$.has(j.traceId),logs:q.get(j.traceId)??[],onToggle:J,trace:j},j.traceId))})]}),e[12]=p,e[13]=h,e[14]=b,e[15]=$,e[16]=C,e[17]=S,e[18]=k?.entries,e[19]=c,e[20]=i,e[21]=o,e[22]=d,e[23]=a,e[24]=R}else R=e[24];return R},"gt");function Qe(n,e){return(0,s.jsx)("div",{className:"flex items-center border-b border-border py-1 font-mono text-xs last:border-b-0","data-testid":"tr-log-row",role:"row",children:(0,s.jsx)(we,{entry:n})},`${String(e)}:${String(n.timestamp)}`)}m(Qe,"Ge");function Ae(){return new Set}m(Ae,"He");function Ve(){ye()}m(Ve,"Je");function Xe(n){return n.traceId}m(Xe,"Qe");export{ft as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as f}from"./chunk-NXXGISFB.js";import{a as j}from"./chunk-WUW4ZHRL.js";import{a as C}from"./chunk-2EJQ7SPV.js";import{P as v}from"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import{a as U}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as q}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as w}from"./chunk-DZGOHOOE.js";import{f as L}from"./chunk-
|
|
1
|
+
import{a as f}from"./chunk-NXXGISFB.js";import{a as j}from"./chunk-WUW4ZHRL.js";import{a as C}from"./chunk-2EJQ7SPV.js";import{P as v}from"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import{a as U}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as q}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as w}from"./chunk-DZGOHOOE.js";import{f as L}from"./chunk-NIUA7EHL.js";import"./chunk-RCZTUWG3.js";import{d as P,f as y,g as c,h,o as p}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as o,d as S,e as V,g as W}from"./chunk-R5ZTCHCE.js";var a=S(V(),1);var e=S(W(),1);var B=y(w.getPitrBookmark),X=y(w.pitrRestore),ne=o(({initialShardKey:z})=>{let m=L(),r=P(),i=z??"",[A,x]=(0,a.useState)(null),[l,O]=(0,a.useState)(""),[I,R]=(0,a.useState)(null),[u,D]=(0,a.useState)(""),[b,E]=(0,a.useState)(!1),[s,K]=(0,a.useState)(null),[T,n]=(0,a.useState)(null),[k,d]=(0,a.useState)(!1),g=(0,a.useCallback)(async()=>{d(!0),n(null);try{let t=await m.query(B,{},c(i));x(t.current)}catch(t){n(h(t))}d(!1)},[m,i]);(0,a.useEffect)(()=>{p(g())},[g]),j(()=>{p((async()=>{try{let t=await m.query(B,{},c(i));x(t.current)}catch{}})())},!0);let M=o(t=>{O(t.target.value)},"A"),Z=o(t=>{D(t.target.value)},"U"),_=o(t=>{E(t.target.checked)},"q"),G=o(()=>{l.trim()!==""&&p((async()=>{d(!0),n(null);try{let t=await m.query(B,{time:l.trim()},c(i));R(t.forTime??null),x(t.current)}catch(t){R(null),n(h(t))}d(!1)})())},"K"),F=o(t=>{p((async()=>{d(!0),n(null);try{let N=await m.mutation(X,t,c(i));K(N),await g()}catch(N){n(h(N))}d(!1)})())},"C"),H=u.trim()!==""||l.trim()!=="",J=o(()=>{let t=b?{restart:!0}:{};u.trim()===""?t.time=l.trim():t.bookmark=u.trim(),F(t)},"j"),Q=o(()=>{s!==null&&F(b?{bookmark:s.undoBookmark,restart:!0}:{bookmark:s.undoBookmark})},"z");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-pitr",children:[(0,e.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:[r("Shard"),": ",(0,e.jsx)("span",{className:"font-mono",children:i===""?r("root"):i})]})}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"pitr-note",children:r("In-place recovery to any moment in the last 30 days. For older or portable recovery, use the snapshot backup tier.")}),T!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"pitr-error",role:"alert",children:T}),(0,e.jsxs)("section",{className:"rounded-xl border border-border bg-card p-3 shadow-xs",children:[(0,e.jsx)("h3",{className:"mb-2 text-sm font-semibold",children:r("Current bookmark")}),(0,e.jsx)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-current",children:A??(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]}),(0,e.jsxs)("section",{className:"flex flex-col gap-3 rounded-xl border border-border bg-card p-3 shadow-xs",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:r("Restore")}),(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsx)(f,{htmlFor:"pitr-time",children:r("Time (ISO or epoch-ms, last 30 days)")}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(v,{"data-testid":"pitr-time",id:"pitr-time",onChange:M,placeholder:"2026-06-01T00:00:00.000Z",value:l}),(0,e.jsx)(U,{"data-testid":"pitr-preview",disabled:k||l.trim()==="",onClick:G,size:"sm",type:"button",variant:"outline",children:r("Preview")})]}),I!==null&&(0,e.jsxs)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-preview-bookmark",children:[r("Bookmark for that time"),": ",I]})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsx)(f,{htmlFor:"pitr-bookmark",children:r("Or an explicit bookmark (wins over time)")}),(0,e.jsx)(v,{"data-testid":"pitr-bookmark",id:"pitr-bookmark",onChange:Z,placeholder:r("bookmark string"),value:u})]}),(0,e.jsxs)(f,{className:"flex items-center gap-2 text-xs font-normal text-muted-foreground",htmlFor:"pitr-restart",children:[(0,e.jsx)("input",{checked:b,className:"size-4 accent-primary","data-testid":"pitr-restart",id:"pitr-restart",onChange:_,type:"checkbox"}),r("Restart the shard now so recovery applies immediately")]}),(0,e.jsx)("div",{children:(0,e.jsx)(C,{confirmLabel:r("Confirm restore"),disabled:k||!H,onConfirm:J,testId:"pitr-restore",children:r("Restore")})})]}),s!==null&&(0,e.jsxs)("section",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs","data-testid":"pitr-result",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:r("Restore armed")}),(0,e.jsx)(q,{variant:s.restarted?"destructive":"secondary",children:s.restarted?r("restarted now"):r("on next restart")})]}),(0,e.jsxs)("p",{className:"font-mono text-xs break-all text-muted-foreground",children:[r("Restored to"),": ",s.restoredTo]}),(0,e.jsxs)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-undo-bookmark",children:[r("Undo bookmark"),": ",s.undoBookmark]}),(0,e.jsx)("div",{children:(0,e.jsx)(C,{confirmLabel:r("Confirm undo"),disabled:k,onConfirm:Q,testId:"pitr-undo",children:r("Undo restore")})})]})]})},"de");export{ne as PitrPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Ve}from"./chunk-CYX3OHJ3.js";import"./chunk-AFKLFS74.js";import{a as He}from"./chunk-METRMDIQ.js";import{a as Ke}from"./chunk-WUW4ZHRL.js";import"./chunk-DUDQV6XJ.js";import{a as Ge}from"./chunk-2EJQ7SPV.js";import{P as je}from"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import{a as le}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as de}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as Pe}from"./chunk-B3BKR5ZW.js";import{a as Ue}from"./chunk-PZ4QDWTI.js";import"./chunk-P4QIDUCY.js";import"./chunk-F7JOSNAT.js";import{a as F}from"./chunk-DZGOHOOE.js";import{c as Me}from"./chunk-L6ATKZKO.js";import{f as We}from"./chunk-YTYRZTG6.js";import"./chunk-RCZTUWG3.js";import{a as ie}from"./chunk-UANVABQG.js";import{a as _e,b as Be,c as ke,d as G,e as C,f as w}from"./chunk-L4EZAHCD.js";import{a as Te,e as De}from"./chunk-IYWVSMAY.js";import{d as $,f as ue,g as ce,h as me,o as he,s as ze}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as h,d as Ee,e as rt,f as nt,g as ot}from"./chunk-R5ZTCHCE.js";var W=Ee(nt(),1);var A=Ee(rt(),1);var t=Ee(ot(),1);var dt=h((n,e)=>{let a=new Set(n.map(s=>s.deadLetterQueue).filter(s=>typeof s=="string"&&s!=="")),l=n.filter(s=>(s.deadLetterQueue===void 0||s.deadLetterQueue==="")&&!a.has(s.name)),d=e.filter(s=>s.deadLettered).length;return{deadLetteredCount:d,queuesWithoutDlq:l,showReliabilityWarning:l.length>0||d>0}},"rt"),lt=200,it=ue(F.sendQueueMessage),ut=ue(F.replayQueueMessage),ct=ue(F.clearQueueMessages),Xe=96,mt=h(n=>{if(n===void 0)return"\u2014";try{return JSON.stringify(n)}catch{return"[unserializable]"}},"it"),ht=h(n=>n.length>Xe?`${n.slice(0,Xe)}\u2026`:n,"ct"),pt=h(n=>n==="error"?"destructive":n==="retry"?"outline":"secondary","ut"),gt=h((n,e)=>e(n==="messages"?"Messages":n==="send"?"Send":"Declared"),"mt"),ft=h(n=>{let e=(0,W.c)(11),{loaded:a,queues:l}=n,d=$(),s;e[0]!==d?(s=d("Queues are declared in code with defineQueue. Enqueue from a mutation or action with ctx.queues.<name>.send(...); push consumers process batches in the worker."),e[0]=d,e[1]=s):s=e[1];let o;e[2]!==s?(o=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:s}),e[2]=s,e[3]=o):o=e[3];let r;e[4]!==a||e[5]!==l||e[6]!==d?(r=a&&l.length===0?(0,t.jsx)(ie,{description:d("No defineQueue is declared in lunora/queues.ts in this deployment. Add one to offload async work to a Cloudflare Queue."),testId:"queues-empty",title:d("No queues defined")}):(0,t.jsx)(Te,{className:"overflow-hidden py-0",children:(0,t.jsx)(De,{className:"px-0",children:(0,t.jsxs)(_e,{"data-testid":"queues-table",children:[(0,t.jsx)(Be,{children:(0,t.jsxs)(G,{children:[(0,t.jsx)(C,{children:d("Export")}),(0,t.jsx)(C,{children:d("Queue")}),(0,t.jsx)(C,{children:d("Mode")}),(0,t.jsx)(C,{children:d("Binding")}),(0,t.jsx)(C,{children:d("Dead-letter")})]})}),(0,t.jsx)(ke,{children:l.map(bt)})]})})}),e[4]=a,e[5]=l,e[6]=d,e[7]=r):r=e[7];let p;return e[8]!==o||e[9]!==r?(p=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-declared",children:[o,r]}),e[8]=o,e[9]=r,e[10]=p):p=e[10],p},"ft"),xt=h(n=>{let e=(0,W.c)(67),{message:a,onReplay:l,replayingId:d}=n,s=$(),o,r,p,c,x,N,y,i,m,f;if(e[0]!==a.attempts||e[1]!==a.body||e[2]!==a.deadLettered||e[3]!==a.exportName||e[4]!==a.id||e[5]!==a.messageId||e[6]!==a.outcome||e[7]!==a.queue||e[8]!==s){let j=mt(a.body);r=G,N=`queues-message-${a.id}`;let z=a.exportName??a.queue;e[19]!==z?(y=(0,t.jsx)(w,{className:"font-mono text-xs",children:z}),e[19]=z,e[20]=y):y=e[20],e[21]!==a.messageId?(i=(0,t.jsx)(w,{className:"max-w-[16ch] truncate font-mono text-xs text-muted-foreground",title:a.messageId,children:a.messageId}),e[21]=a.messageId,e[22]=i):i=e[22],e[23]!==a.attempts?(m=(0,t.jsx)(w,{className:"font-mono text-xs tabular-nums",children:a.attempts}),e[23]=a.attempts,e[24]=m):m=e[24];let T=`queues-outcome-${a.id}`,D;e[25]!==a.outcome?(D=pt(a.outcome),e[25]=a.outcome,e[26]=D):D=e[26];let I;e[27]!==a.outcome||e[28]!==T||e[29]!==D?(I=(0,t.jsx)(de,{"data-testid":T,variant:D,children:a.outcome}),e[27]=a.outcome,e[28]=T,e[29]=D,e[30]=I):I=e[30];let M;e[31]!==a.deadLettered||e[32]!==a.id||e[33]!==s?(M=a.deadLettered&&(0,t.jsx)(de,{"data-testid":`queues-dlq-${a.id}`,variant:"destructive",children:s("DLQ")}),e[31]=a.deadLettered,e[32]=a.id,e[33]=s,e[34]=M):M=e[34],e[35]!==I||e[36]!==M?(f=(0,t.jsx)(w,{children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[I,M]})}),e[35]=I,e[36]=M,e[37]=f):f=e[37],o=w,p="max-w-[32ch] truncate font-mono text-xs text-muted-foreground",c=j,x=ht(j),e[0]=a.attempts,e[1]=a.body,e[2]=a.deadLettered,e[3]=a.exportName,e[4]=a.id,e[5]=a.messageId,e[6]=a.outcome,e[7]=a.queue,e[8]=s,e[9]=o,e[10]=r,e[11]=p,e[12]=c,e[13]=x,e[14]=N,e[15]=y,e[16]=i,e[17]=m,e[18]=f}else o=e[9],r=e[10],p=e[11],c=e[12],x=e[13],N=e[14],y=e[15],i=e[16],m=e[17],f=e[18];let g;e[38]!==o||e[39]!==p||e[40]!==c||e[41]!==x?(g=(0,t.jsx)(o,{className:p,title:c,children:x}),e[38]=o,e[39]=p,e[40]=c,e[41]=x,e[42]=g):g=e[42];let q;e[43]!==a.capturedAt?(q=ze(a.capturedAt,"\u2014"),e[43]=a.capturedAt,e[44]=q):q=e[44];let b;e[45]!==q?(b=(0,t.jsx)(w,{className:"text-xs text-muted-foreground tabular-nums",children:q}),e[45]=q,e[46]=b):b=e[46];let S=`queues-replay-${a.id}`,E=d!==null,Q;e[47]!==a.id||e[48]!==d||e[49]!==s?(Q=d===a.id?s("Replaying\u2026"):s("Replay"),e[47]=a.id,e[48]=d,e[49]=s,e[50]=Q):Q=e[50];let L;e[51]!==a.id||e[52]!==l||e[53]!==S||e[54]!==E||e[55]!==Q?(L=(0,t.jsx)(w,{children:(0,t.jsx)(le,{"data-id":a.id,"data-testid":S,disabled:E,onClick:l,size:"xs",type:"button",variant:"outline",children:Q})}),e[51]=a.id,e[52]=l,e[53]=S,e[54]=E,e[55]=Q,e[56]=L):L=e[56];let _;return e[57]!==r||e[58]!==b||e[59]!==L||e[60]!==N||e[61]!==y||e[62]!==i||e[63]!==m||e[64]!==f||e[65]!==g?(_=(0,t.jsxs)(r,{"data-testid":N,children:[y,i,m,f,g,b,L]}),e[57]=r,e[58]=b,e[59]=L,e[60]=N,e[61]=y,e[62]=i,e[63]=m,e[64]=f,e[65]=g,e[66]=_):_=e[66],_},"ht"),yt=h(n=>{let e=(0,W.c)(30),{hasError:a,messages:l,onClear:d,onReplay:s,replayingId:o}=n,r=$(),p;e[0]!==r?(p=r("Cloudflare Queues have no peek API, so this is what push consumers actually processed \u2014 not pending depth."),e[0]=r,e[1]=p):p=e[1];let c;e[2]!==p?(c=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:p}),e[2]=p,e[3]=c):c=e[3];let x;e[4]!==l.length||e[5]!==r?(x=r("Clear {count} messages?",{count:l.length}),e[4]=l.length,e[5]=r,e[6]=x):x=e[6];let N=l.length===0,y;e[7]!==r?(y=r("Clear log"),e[7]=r,e[8]=y):y=e[8];let i;e[9]!==d||e[10]!==x||e[11]!==N||e[12]!==y?(i=(0,t.jsx)("div",{className:"ml-auto",children:(0,t.jsx)(Ge,{confirmLabel:x,disabled:N,onConfirm:d,testId:"queues-clear",children:y})}),e[9]=d,e[10]=x,e[11]=N,e[12]=y,e[13]=i):i=e[13];let m;e[14]!==l.length||e[15]!==r?(m=l.length>0&&(0,t.jsx)(de,{"data-testid":"queues-count",variant:"secondary",children:r("{count} messages",{count:l.length})}),e[14]=l.length,e[15]=r,e[16]=m):m=e[16];let f;e[17]!==c||e[18]!==i||e[19]!==m?(f=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,i,m]}),e[17]=c,e[18]=i,e[19]=m,e[20]=f):f=e[20];let g;e[21]!==a||e[22]!==l||e[23]!==s||e[24]!==o||e[25]!==r?(g=!a&&l.length===0?(0,t.jsx)(ie,{description:r("Consumed messages appear here once a push consumer processes a batch in dev. Send one from the Send tab to see it captured."),testId:"queues-messages-empty",title:r("No consumed messages yet.")}):(0,t.jsx)(Te,{className:"overflow-hidden py-0",children:(0,t.jsx)(De,{className:"px-0",children:(0,t.jsx)(Ve,{className:"max-h-[32rem]","data-testid":"queues-messages-scroll",children:(0,t.jsxs)(_e,{"data-testid":"queues-messages-table",children:[(0,t.jsx)(Be,{children:(0,t.jsxs)(G,{children:[(0,t.jsx)(C,{children:r("Export")}),(0,t.jsx)(C,{children:r("Message")}),(0,t.jsx)(C,{children:r("Attempts")}),(0,t.jsx)(C,{children:r("Outcome")}),(0,t.jsx)(C,{children:r("Body")}),(0,t.jsx)(C,{children:r("Captured")}),(0,t.jsx)(C,{})]})}),(0,t.jsx)(ke,{children:l.map(b=>(0,t.jsx)(xt,{message:b,onReplay:s,replayingId:o},b.id))})]})})})}),e[21]=a,e[22]=l,e[23]=s,e[24]=o,e[25]=r,e[26]=g):g=e[26];let q;return e[27]!==f||e[28]!==g?(q=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-messages",children:[f,g]}),e[27]=f,e[28]=g,e[29]=q):q=e[29],q},"pt"),Nt=h(n=>{let e=(0,W.c)(20),{batchMode:a,bodyText:l,delayText:d,onBatchModeChange:s,onBodyChange:o,onDelayChange:r,onSelectExport:p,onSend:c,queues:x,selectedExportName:N,sending:y}=n,i=$(),m;e[0]!==i?(m=i("Enqueue a JSON message to a declared producer to exercise its consumer. Nothing is captured until the consumer processes it."),e[0]=i,e[1]=m):m=e[1];let f;e[2]!==m?(f=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[2]=m,e[3]=f):f=e[3];let g;e[4]!==a||e[5]!==l||e[6]!==d||e[7]!==s||e[8]!==o||e[9]!==r||e[10]!==p||e[11]!==c||e[12]!==x||e[13]!==N||e[14]!==y||e[15]!==i?(g=x.length===0?(0,t.jsx)(ie,{description:i("Declare a queue with defineQueue in lunora/queues.ts to enqueue a test message."),testId:"queues-send-empty",title:i("No queues to send to")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("select",{"aria-label":i("Queue"),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":"queues-send-select",onChange:p,value:N,children:x.map(qt)}),(0,t.jsx)(je,{"aria-label":i("Delay (seconds)"),className:"max-w-36","data-testid":"queues-send-delay",min:0,onChange:r,placeholder:i("Delay (s)"),type:"number",value:d}),(0,t.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"queues-send-batch",children:[(0,t.jsx)("input",{checked:a,"data-testid":"queues-send-batch",id:"queues-send-batch",onChange:s,type:"checkbox"}),i("Send as batch (JSON array)")]}),(0,t.jsx)(le,{className:"ml-auto","data-testid":"queues-send-button",disabled:y||N==="",onClick:c,type:"button",children:i(y?"Sending\u2026":"Send message")})]}),(0,t.jsx)(He,{"aria-label":i("Message body (JSON)"),className:"font-mono","data-testid":"queues-send-body",onChange:o,placeholder:a?'[ { "hello": "world" } ]':'{ "hello": "world" }',value:l})]}),e[4]=a,e[5]=l,e[6]=d,e[7]=s,e[8]=o,e[9]=r,e[10]=p,e[11]=c,e[12]=x,e[13]=N,e[14]=y,e[15]=i,e[16]=g):g=e[16];let q;return e[17]!==f||e[18]!==g?(q=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"queues-send",children:[f,g]}),e[17]=f,e[18]=g,e[19]=q):q=e[19],q},"gt"),Ft=h(n=>{let e=(0,W.c)(59),{limit:a}=n,l=a??lt,d=We(),s=$(),[o,r]=(0,A.useState)("declared"),[p,c]=(0,A.useState)(null),x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x={},e[0]=x):x=e[0];let{data:N,error:y,errorSource:i}=Me(F.listQueues,x),m;e[1]!==l?(m={limit:l},e[1]=l,e[2]=m):m=e[2];let{data:f,error:g,errorSource:q,refetch:b}=Me(F.getQueueMessages,m),S=Array.isArray(N?.queues)?[...N.queues].toSorted(vt):[],E=f?.entries??[],{deadLetteredCount:Q,queuesWithoutDlq:L,showReliabilityWarning:_}=dt(S,E),[j,z]=(0,A.useState)(""),[T,D]=(0,A.useState)(""),[I,M]=(0,A.useState)(""),[U,Ye]=(0,A.useState)(!1),[pe,Oe]=(0,A.useState)(!1),[ge,Re]=(0,A.useState)(null),H=S.some(u=>u.exportName===j)?j:S[0]?.exportName??"",Je=o==="messages"?g:y,Ze=o==="messages"?q:i,fe=Je??p,xe=Je===null?p:Ze,K;e[3]!==b?(K=h(()=>{b()},"H"),e[3]=b,e[4]=K):K=e[4],Ke(K,o==="messages");let ye=h(async()=>{c(null);let u=H;if(u==="")return;let v=null,$e=T.trim();if($e!=="")try{v=JSON.parse($e)}catch{c(s("Body must be valid JSON."));return}let Ae,Fe=I.trim();if(Fe!==""){let P=Number(Fe);if(!Number.isFinite(P)||P<0){c(s("Delay must be a non-negative number of seconds."));return}Ae=P}if(U&&!Array.isArray(v)){c(s("Batch mode needs a JSON array body \u2014 each element is enqueued as one message."));return}Oe(!0);let st=U?{batch:v,delaySeconds:Ae,exportName:u}:{body:v,delaySeconds:Ae,exportName:u};try{await d.query(it,st,ce("")),b()}catch(P){c(me(P))}Oe(!1)},"ue"),V;e[5]!==d||e[6]!==b?(V=h(async u=>{c(null),Re(u);try{await d.query(ut,{id:u},ce("")),b()}catch(v){c(me(v))}Re(null)},"V"),e[5]=d,e[6]=b,e[7]=V):V=e[7];let Ne=V,X;e[8]!==d||e[9]!==b?(X=h(async()=>{c(null);try{await d.query(ct,{},ce("")),b()}catch(u){c(me(u))}},"Y"),e[8]=d,e[9]=b,e[10]=X):X=e[10];let be=X,Y;e[11]===Symbol.for("react.memo_cache_sentinel")?(Y=h(u=>{let v=u.currentTarget.dataset.tab;(v==="declared"||v==="messages"||v==="send")&&r(v)},"X"),e[11]=Y):Y=e[11];let et=Y,Z;e[12]===Symbol.for("react.memo_cache_sentinel")?(Z=h(u=>{z(u.currentTarget.value)},"K"),e[12]=Z):Z=e[12];let qe=Z,ee;e[13]===Symbol.for("react.memo_cache_sentinel")?(ee=h(u=>{D(u.currentTarget.value)},"Z"),e[13]=ee):ee=e[13];let ve=ee,te;e[14]===Symbol.for("react.memo_cache_sentinel")?(te=h(u=>{M(u.currentTarget.value)},"ee"),e[14]=te):te=e[14];let Se=te,ae;e[15]===Symbol.for("react.memo_cache_sentinel")?(ae=h(u=>{Ye(u.currentTarget.checked)},"te"),e[15]=ae):ae=e[15];let Ce=ae,se;e[16]!==ye?(se=h(()=>{he(ye())},"se"),e[16]=ye,e[17]=se):se=e[17];let we=se,re;e[18]!==Ne?(re=h(u=>{let{id:v}=u.currentTarget.dataset;v!==void 0&&he(Ne(v))},"ae"),e[18]=Ne,e[19]=re):re=e[19];let Ie=re,ne;e[20]!==be?(ne=h(()=>{he(be())},"re"),e[20]=be,e[21]=ne):ne=e[21];let Qe=ne,tt="flex flex-col gap-6",at="lunora-queues-panel",B;e[22]!==s||e[23]!==o?(B=(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"queues-tabs",role:"tablist",children:["declared","messages","send"].map(u=>(0,t.jsx)(le,{"aria-selected":o===u,"data-tab":u,"data-testid":`queues-tab-${u}`,onClick:et,role:"tab",size:"sm",type:"button",variant:o===u?"secondary":"ghost",children:gt(u,s)},u))}),e[22]=s,e[23]=o,e[24]=B):B=e[24];let k;e[25]!==fe||e[26]!==xe?(k=fe!==null&&(0,t.jsx)(Pe,{error:xe,testId:"queues-error"}),e[25]=fe,e[26]=xe,e[27]=k):k=e[27];let Le=_&&(0,t.jsx)(Ue,{icon:(0,t.jsx)("span",{"aria-hidden":"true",className:"text-base leading-none",children:"\u26A0"}),testId:"queues-dlq-warning",variant:"warning",children:(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[L.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"font-medium",children:s("No dead-letter queue on {queues}.",{queues:L.map(St).join(", ")})}),(0,t.jsx)("p",{className:"text-muted-foreground",children:s("Exhausted messages are dropped after retries. Add a deadLetterQueue to capture them.")})]}),Q>0&&(0,t.jsx)("p",{className:L.length>0?"text-muted-foreground":"font-medium",children:Q===1?s("1 message was recently dead-lettered."):s("{count} messages were recently dead-lettered.",{count:Q})})]})}),O;e[28]!==S||e[29]!==N||e[30]!==o?(O=o==="declared"&&(0,t.jsx)(ft,{loaded:N!==void 0,queues:S}),e[28]=S,e[29]=N,e[30]=o,e[31]=O):O=e[31];let R;e[32]!==E||e[33]!==g||e[34]!==Qe||e[35]!==Ie||e[36]!==ge||e[37]!==o?(R=o==="messages"&&(0,t.jsx)(yt,{hasError:g!==null,messages:E,onClear:Qe,onReplay:Ie,replayingId:ge}),e[32]=E,e[33]=g,e[34]=Qe,e[35]=Ie,e[36]=ge,e[37]=o,e[38]=R):R=e[38];let J;e[39]!==U||e[40]!==T||e[41]!==I||e[42]!==Ce||e[43]!==ve||e[44]!==Se||e[45]!==qe||e[46]!==we||e[47]!==S||e[48]!==H||e[49]!==pe||e[50]!==o?(J=o==="send"&&(0,t.jsx)(Nt,{batchMode:U,bodyText:T,delayText:I,onBatchModeChange:Ce,onBodyChange:ve,onDelayChange:Se,onSelectExport:qe,onSend:we,queues:S,selectedExportName:H,sending:pe}),e[39]=U,e[40]=T,e[41]=I,e[42]=Ce,e[43]=ve,e[44]=Se,e[45]=qe,e[46]=we,e[47]=S,e[48]=H,e[49]=pe,e[50]=o,e[51]=J):J=e[51];let oe;return e[52]!==B||e[53]!==k||e[54]!==Le||e[55]!==O||e[56]!==R||e[57]!==J?(oe=(0,t.jsxs)("div",{className:tt,"data-testid":at,children:[B,k,Le,O,R,J]}),e[52]=B,e[53]=k,e[54]=Le,e[55]=O,e[56]=R,e[57]=J,e[58]=oe):oe=e[58],oe},"Ft");function bt(n){return(0,t.jsxs)(G,{"data-testid":`queues-row-${n.exportName}`,children:[(0,t.jsx)(w,{className:"font-mono text-xs",children:n.exportName}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.name}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.mode}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.binding}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.deadLetterQueue??"\u2014"})]},n.exportName)}h(bt,"xt");function qt(n){return(0,t.jsx)("option",{value:n.exportName,children:n.exportName},n.exportName)}h(qt,"yt");function vt(n,e){return n.exportName.localeCompare(e.exportName)}h(vt,"bt");function St(n){return n.name}h(St,"Nt");export{Ft as default};
|
|
1
|
+
import{a as Ve}from"./chunk-CYX3OHJ3.js";import"./chunk-AFKLFS74.js";import{a as He}from"./chunk-METRMDIQ.js";import{a as Ke}from"./chunk-WUW4ZHRL.js";import"./chunk-DUDQV6XJ.js";import{a as Ge}from"./chunk-2EJQ7SPV.js";import{P as je}from"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import{a as le}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as de}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as Pe}from"./chunk-JCSDJBBZ.js";import{a as Ue}from"./chunk-PZ4QDWTI.js";import"./chunk-GDC3W3DZ.js";import"./chunk-F7JOSNAT.js";import{a as F}from"./chunk-DZGOHOOE.js";import{c as Me}from"./chunk-5DEXJ766.js";import{f as We}from"./chunk-NIUA7EHL.js";import"./chunk-RCZTUWG3.js";import{a as ie}from"./chunk-UANVABQG.js";import{a as _e,b as Be,c as ke,d as G,e as C,f as w}from"./chunk-L4EZAHCD.js";import{a as Te,e as De}from"./chunk-IYWVSMAY.js";import{d as $,f as ue,g as ce,h as me,o as he,s as ze}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as h,d as Ee,e as rt,f as nt,g as ot}from"./chunk-R5ZTCHCE.js";var W=Ee(nt(),1);var A=Ee(rt(),1);var t=Ee(ot(),1);var dt=h((n,e)=>{let a=new Set(n.map(s=>s.deadLetterQueue).filter(s=>typeof s=="string"&&s!=="")),l=n.filter(s=>(s.deadLetterQueue===void 0||s.deadLetterQueue==="")&&!a.has(s.name)),d=e.filter(s=>s.deadLettered).length;return{deadLetteredCount:d,queuesWithoutDlq:l,showReliabilityWarning:l.length>0||d>0}},"rt"),lt=200,it=ue(F.sendQueueMessage),ut=ue(F.replayQueueMessage),ct=ue(F.clearQueueMessages),Xe=96,mt=h(n=>{if(n===void 0)return"\u2014";try{return JSON.stringify(n)}catch{return"[unserializable]"}},"it"),ht=h(n=>n.length>Xe?`${n.slice(0,Xe)}\u2026`:n,"ct"),pt=h(n=>n==="error"?"destructive":n==="retry"?"outline":"secondary","ut"),gt=h((n,e)=>e(n==="messages"?"Messages":n==="send"?"Send":"Declared"),"mt"),ft=h(n=>{let e=(0,W.c)(11),{loaded:a,queues:l}=n,d=$(),s;e[0]!==d?(s=d("Queues are declared in code with defineQueue. Enqueue from a mutation or action with ctx.queues.<name>.send(...); push consumers process batches in the worker."),e[0]=d,e[1]=s):s=e[1];let o;e[2]!==s?(o=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:s}),e[2]=s,e[3]=o):o=e[3];let r;e[4]!==a||e[5]!==l||e[6]!==d?(r=a&&l.length===0?(0,t.jsx)(ie,{description:d("No defineQueue is declared in lunora/queues.ts in this deployment. Add one to offload async work to a Cloudflare Queue."),testId:"queues-empty",title:d("No queues defined")}):(0,t.jsx)(Te,{className:"overflow-hidden py-0",children:(0,t.jsx)(De,{className:"px-0",children:(0,t.jsxs)(_e,{"data-testid":"queues-table",children:[(0,t.jsx)(Be,{children:(0,t.jsxs)(G,{children:[(0,t.jsx)(C,{children:d("Export")}),(0,t.jsx)(C,{children:d("Queue")}),(0,t.jsx)(C,{children:d("Mode")}),(0,t.jsx)(C,{children:d("Binding")}),(0,t.jsx)(C,{children:d("Dead-letter")})]})}),(0,t.jsx)(ke,{children:l.map(bt)})]})})}),e[4]=a,e[5]=l,e[6]=d,e[7]=r):r=e[7];let p;return e[8]!==o||e[9]!==r?(p=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-declared",children:[o,r]}),e[8]=o,e[9]=r,e[10]=p):p=e[10],p},"ft"),xt=h(n=>{let e=(0,W.c)(67),{message:a,onReplay:l,replayingId:d}=n,s=$(),o,r,p,c,x,N,y,i,m,f;if(e[0]!==a.attempts||e[1]!==a.body||e[2]!==a.deadLettered||e[3]!==a.exportName||e[4]!==a.id||e[5]!==a.messageId||e[6]!==a.outcome||e[7]!==a.queue||e[8]!==s){let j=mt(a.body);r=G,N=`queues-message-${a.id}`;let z=a.exportName??a.queue;e[19]!==z?(y=(0,t.jsx)(w,{className:"font-mono text-xs",children:z}),e[19]=z,e[20]=y):y=e[20],e[21]!==a.messageId?(i=(0,t.jsx)(w,{className:"max-w-[16ch] truncate font-mono text-xs text-muted-foreground",title:a.messageId,children:a.messageId}),e[21]=a.messageId,e[22]=i):i=e[22],e[23]!==a.attempts?(m=(0,t.jsx)(w,{className:"font-mono text-xs tabular-nums",children:a.attempts}),e[23]=a.attempts,e[24]=m):m=e[24];let T=`queues-outcome-${a.id}`,D;e[25]!==a.outcome?(D=pt(a.outcome),e[25]=a.outcome,e[26]=D):D=e[26];let I;e[27]!==a.outcome||e[28]!==T||e[29]!==D?(I=(0,t.jsx)(de,{"data-testid":T,variant:D,children:a.outcome}),e[27]=a.outcome,e[28]=T,e[29]=D,e[30]=I):I=e[30];let M;e[31]!==a.deadLettered||e[32]!==a.id||e[33]!==s?(M=a.deadLettered&&(0,t.jsx)(de,{"data-testid":`queues-dlq-${a.id}`,variant:"destructive",children:s("DLQ")}),e[31]=a.deadLettered,e[32]=a.id,e[33]=s,e[34]=M):M=e[34],e[35]!==I||e[36]!==M?(f=(0,t.jsx)(w,{children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[I,M]})}),e[35]=I,e[36]=M,e[37]=f):f=e[37],o=w,p="max-w-[32ch] truncate font-mono text-xs text-muted-foreground",c=j,x=ht(j),e[0]=a.attempts,e[1]=a.body,e[2]=a.deadLettered,e[3]=a.exportName,e[4]=a.id,e[5]=a.messageId,e[6]=a.outcome,e[7]=a.queue,e[8]=s,e[9]=o,e[10]=r,e[11]=p,e[12]=c,e[13]=x,e[14]=N,e[15]=y,e[16]=i,e[17]=m,e[18]=f}else o=e[9],r=e[10],p=e[11],c=e[12],x=e[13],N=e[14],y=e[15],i=e[16],m=e[17],f=e[18];let g;e[38]!==o||e[39]!==p||e[40]!==c||e[41]!==x?(g=(0,t.jsx)(o,{className:p,title:c,children:x}),e[38]=o,e[39]=p,e[40]=c,e[41]=x,e[42]=g):g=e[42];let q;e[43]!==a.capturedAt?(q=ze(a.capturedAt,"\u2014"),e[43]=a.capturedAt,e[44]=q):q=e[44];let b;e[45]!==q?(b=(0,t.jsx)(w,{className:"text-xs text-muted-foreground tabular-nums",children:q}),e[45]=q,e[46]=b):b=e[46];let S=`queues-replay-${a.id}`,E=d!==null,Q;e[47]!==a.id||e[48]!==d||e[49]!==s?(Q=d===a.id?s("Replaying\u2026"):s("Replay"),e[47]=a.id,e[48]=d,e[49]=s,e[50]=Q):Q=e[50];let L;e[51]!==a.id||e[52]!==l||e[53]!==S||e[54]!==E||e[55]!==Q?(L=(0,t.jsx)(w,{children:(0,t.jsx)(le,{"data-id":a.id,"data-testid":S,disabled:E,onClick:l,size:"xs",type:"button",variant:"outline",children:Q})}),e[51]=a.id,e[52]=l,e[53]=S,e[54]=E,e[55]=Q,e[56]=L):L=e[56];let _;return e[57]!==r||e[58]!==b||e[59]!==L||e[60]!==N||e[61]!==y||e[62]!==i||e[63]!==m||e[64]!==f||e[65]!==g?(_=(0,t.jsxs)(r,{"data-testid":N,children:[y,i,m,f,g,b,L]}),e[57]=r,e[58]=b,e[59]=L,e[60]=N,e[61]=y,e[62]=i,e[63]=m,e[64]=f,e[65]=g,e[66]=_):_=e[66],_},"ht"),yt=h(n=>{let e=(0,W.c)(30),{hasError:a,messages:l,onClear:d,onReplay:s,replayingId:o}=n,r=$(),p;e[0]!==r?(p=r("Cloudflare Queues have no peek API, so this is what push consumers actually processed \u2014 not pending depth."),e[0]=r,e[1]=p):p=e[1];let c;e[2]!==p?(c=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:p}),e[2]=p,e[3]=c):c=e[3];let x;e[4]!==l.length||e[5]!==r?(x=r("Clear {count} messages?",{count:l.length}),e[4]=l.length,e[5]=r,e[6]=x):x=e[6];let N=l.length===0,y;e[7]!==r?(y=r("Clear log"),e[7]=r,e[8]=y):y=e[8];let i;e[9]!==d||e[10]!==x||e[11]!==N||e[12]!==y?(i=(0,t.jsx)("div",{className:"ml-auto",children:(0,t.jsx)(Ge,{confirmLabel:x,disabled:N,onConfirm:d,testId:"queues-clear",children:y})}),e[9]=d,e[10]=x,e[11]=N,e[12]=y,e[13]=i):i=e[13];let m;e[14]!==l.length||e[15]!==r?(m=l.length>0&&(0,t.jsx)(de,{"data-testid":"queues-count",variant:"secondary",children:r("{count} messages",{count:l.length})}),e[14]=l.length,e[15]=r,e[16]=m):m=e[16];let f;e[17]!==c||e[18]!==i||e[19]!==m?(f=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,i,m]}),e[17]=c,e[18]=i,e[19]=m,e[20]=f):f=e[20];let g;e[21]!==a||e[22]!==l||e[23]!==s||e[24]!==o||e[25]!==r?(g=!a&&l.length===0?(0,t.jsx)(ie,{description:r("Consumed messages appear here once a push consumer processes a batch in dev. Send one from the Send tab to see it captured."),testId:"queues-messages-empty",title:r("No consumed messages yet.")}):(0,t.jsx)(Te,{className:"overflow-hidden py-0",children:(0,t.jsx)(De,{className:"px-0",children:(0,t.jsx)(Ve,{className:"max-h-[32rem]","data-testid":"queues-messages-scroll",children:(0,t.jsxs)(_e,{"data-testid":"queues-messages-table",children:[(0,t.jsx)(Be,{children:(0,t.jsxs)(G,{children:[(0,t.jsx)(C,{children:r("Export")}),(0,t.jsx)(C,{children:r("Message")}),(0,t.jsx)(C,{children:r("Attempts")}),(0,t.jsx)(C,{children:r("Outcome")}),(0,t.jsx)(C,{children:r("Body")}),(0,t.jsx)(C,{children:r("Captured")}),(0,t.jsx)(C,{})]})}),(0,t.jsx)(ke,{children:l.map(b=>(0,t.jsx)(xt,{message:b,onReplay:s,replayingId:o},b.id))})]})})})}),e[21]=a,e[22]=l,e[23]=s,e[24]=o,e[25]=r,e[26]=g):g=e[26];let q;return e[27]!==f||e[28]!==g?(q=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-messages",children:[f,g]}),e[27]=f,e[28]=g,e[29]=q):q=e[29],q},"pt"),Nt=h(n=>{let e=(0,W.c)(20),{batchMode:a,bodyText:l,delayText:d,onBatchModeChange:s,onBodyChange:o,onDelayChange:r,onSelectExport:p,onSend:c,queues:x,selectedExportName:N,sending:y}=n,i=$(),m;e[0]!==i?(m=i("Enqueue a JSON message to a declared producer to exercise its consumer. Nothing is captured until the consumer processes it."),e[0]=i,e[1]=m):m=e[1];let f;e[2]!==m?(f=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[2]=m,e[3]=f):f=e[3];let g;e[4]!==a||e[5]!==l||e[6]!==d||e[7]!==s||e[8]!==o||e[9]!==r||e[10]!==p||e[11]!==c||e[12]!==x||e[13]!==N||e[14]!==y||e[15]!==i?(g=x.length===0?(0,t.jsx)(ie,{description:i("Declare a queue with defineQueue in lunora/queues.ts to enqueue a test message."),testId:"queues-send-empty",title:i("No queues to send to")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("select",{"aria-label":i("Queue"),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":"queues-send-select",onChange:p,value:N,children:x.map(qt)}),(0,t.jsx)(je,{"aria-label":i("Delay (seconds)"),className:"max-w-36","data-testid":"queues-send-delay",min:0,onChange:r,placeholder:i("Delay (s)"),type:"number",value:d}),(0,t.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"queues-send-batch",children:[(0,t.jsx)("input",{checked:a,"data-testid":"queues-send-batch",id:"queues-send-batch",onChange:s,type:"checkbox"}),i("Send as batch (JSON array)")]}),(0,t.jsx)(le,{className:"ml-auto","data-testid":"queues-send-button",disabled:y||N==="",onClick:c,type:"button",children:i(y?"Sending\u2026":"Send message")})]}),(0,t.jsx)(He,{"aria-label":i("Message body (JSON)"),className:"font-mono","data-testid":"queues-send-body",onChange:o,placeholder:a?'[ { "hello": "world" } ]':'{ "hello": "world" }',value:l})]}),e[4]=a,e[5]=l,e[6]=d,e[7]=s,e[8]=o,e[9]=r,e[10]=p,e[11]=c,e[12]=x,e[13]=N,e[14]=y,e[15]=i,e[16]=g):g=e[16];let q;return e[17]!==f||e[18]!==g?(q=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"queues-send",children:[f,g]}),e[17]=f,e[18]=g,e[19]=q):q=e[19],q},"gt"),Ft=h(n=>{let e=(0,W.c)(59),{limit:a}=n,l=a??lt,d=We(),s=$(),[o,r]=(0,A.useState)("declared"),[p,c]=(0,A.useState)(null),x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x={},e[0]=x):x=e[0];let{data:N,error:y,errorSource:i}=Me(F.listQueues,x),m;e[1]!==l?(m={limit:l},e[1]=l,e[2]=m):m=e[2];let{data:f,error:g,errorSource:q,refetch:b}=Me(F.getQueueMessages,m),S=Array.isArray(N?.queues)?[...N.queues].toSorted(vt):[],E=f?.entries??[],{deadLetteredCount:Q,queuesWithoutDlq:L,showReliabilityWarning:_}=dt(S,E),[j,z]=(0,A.useState)(""),[T,D]=(0,A.useState)(""),[I,M]=(0,A.useState)(""),[U,Ye]=(0,A.useState)(!1),[pe,Oe]=(0,A.useState)(!1),[ge,Re]=(0,A.useState)(null),H=S.some(u=>u.exportName===j)?j:S[0]?.exportName??"",Je=o==="messages"?g:y,Ze=o==="messages"?q:i,fe=Je??p,xe=Je===null?p:Ze,K;e[3]!==b?(K=h(()=>{b()},"H"),e[3]=b,e[4]=K):K=e[4],Ke(K,o==="messages");let ye=h(async()=>{c(null);let u=H;if(u==="")return;let v=null,$e=T.trim();if($e!=="")try{v=JSON.parse($e)}catch{c(s("Body must be valid JSON."));return}let Ae,Fe=I.trim();if(Fe!==""){let P=Number(Fe);if(!Number.isFinite(P)||P<0){c(s("Delay must be a non-negative number of seconds."));return}Ae=P}if(U&&!Array.isArray(v)){c(s("Batch mode needs a JSON array body \u2014 each element is enqueued as one message."));return}Oe(!0);let st=U?{batch:v,delaySeconds:Ae,exportName:u}:{body:v,delaySeconds:Ae,exportName:u};try{await d.query(it,st,ce("")),b()}catch(P){c(me(P))}Oe(!1)},"ue"),V;e[5]!==d||e[6]!==b?(V=h(async u=>{c(null),Re(u);try{await d.query(ut,{id:u},ce("")),b()}catch(v){c(me(v))}Re(null)},"V"),e[5]=d,e[6]=b,e[7]=V):V=e[7];let Ne=V,X;e[8]!==d||e[9]!==b?(X=h(async()=>{c(null);try{await d.query(ct,{},ce("")),b()}catch(u){c(me(u))}},"Y"),e[8]=d,e[9]=b,e[10]=X):X=e[10];let be=X,Y;e[11]===Symbol.for("react.memo_cache_sentinel")?(Y=h(u=>{let v=u.currentTarget.dataset.tab;(v==="declared"||v==="messages"||v==="send")&&r(v)},"X"),e[11]=Y):Y=e[11];let et=Y,Z;e[12]===Symbol.for("react.memo_cache_sentinel")?(Z=h(u=>{z(u.currentTarget.value)},"K"),e[12]=Z):Z=e[12];let qe=Z,ee;e[13]===Symbol.for("react.memo_cache_sentinel")?(ee=h(u=>{D(u.currentTarget.value)},"Z"),e[13]=ee):ee=e[13];let ve=ee,te;e[14]===Symbol.for("react.memo_cache_sentinel")?(te=h(u=>{M(u.currentTarget.value)},"ee"),e[14]=te):te=e[14];let Se=te,ae;e[15]===Symbol.for("react.memo_cache_sentinel")?(ae=h(u=>{Ye(u.currentTarget.checked)},"te"),e[15]=ae):ae=e[15];let Ce=ae,se;e[16]!==ye?(se=h(()=>{he(ye())},"se"),e[16]=ye,e[17]=se):se=e[17];let we=se,re;e[18]!==Ne?(re=h(u=>{let{id:v}=u.currentTarget.dataset;v!==void 0&&he(Ne(v))},"ae"),e[18]=Ne,e[19]=re):re=e[19];let Ie=re,ne;e[20]!==be?(ne=h(()=>{he(be())},"re"),e[20]=be,e[21]=ne):ne=e[21];let Qe=ne,tt="flex flex-col gap-6",at="lunora-queues-panel",B;e[22]!==s||e[23]!==o?(B=(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"queues-tabs",role:"tablist",children:["declared","messages","send"].map(u=>(0,t.jsx)(le,{"aria-selected":o===u,"data-tab":u,"data-testid":`queues-tab-${u}`,onClick:et,role:"tab",size:"sm",type:"button",variant:o===u?"secondary":"ghost",children:gt(u,s)},u))}),e[22]=s,e[23]=o,e[24]=B):B=e[24];let k;e[25]!==fe||e[26]!==xe?(k=fe!==null&&(0,t.jsx)(Pe,{error:xe,testId:"queues-error"}),e[25]=fe,e[26]=xe,e[27]=k):k=e[27];let Le=_&&(0,t.jsx)(Ue,{icon:(0,t.jsx)("span",{"aria-hidden":"true",className:"text-base leading-none",children:"\u26A0"}),testId:"queues-dlq-warning",variant:"warning",children:(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[L.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"font-medium",children:s("No dead-letter queue on {queues}.",{queues:L.map(St).join(", ")})}),(0,t.jsx)("p",{className:"text-muted-foreground",children:s("Exhausted messages are dropped after retries. Add a deadLetterQueue to capture them.")})]}),Q>0&&(0,t.jsx)("p",{className:L.length>0?"text-muted-foreground":"font-medium",children:Q===1?s("1 message was recently dead-lettered."):s("{count} messages were recently dead-lettered.",{count:Q})})]})}),O;e[28]!==S||e[29]!==N||e[30]!==o?(O=o==="declared"&&(0,t.jsx)(ft,{loaded:N!==void 0,queues:S}),e[28]=S,e[29]=N,e[30]=o,e[31]=O):O=e[31];let R;e[32]!==E||e[33]!==g||e[34]!==Qe||e[35]!==Ie||e[36]!==ge||e[37]!==o?(R=o==="messages"&&(0,t.jsx)(yt,{hasError:g!==null,messages:E,onClear:Qe,onReplay:Ie,replayingId:ge}),e[32]=E,e[33]=g,e[34]=Qe,e[35]=Ie,e[36]=ge,e[37]=o,e[38]=R):R=e[38];let J;e[39]!==U||e[40]!==T||e[41]!==I||e[42]!==Ce||e[43]!==ve||e[44]!==Se||e[45]!==qe||e[46]!==we||e[47]!==S||e[48]!==H||e[49]!==pe||e[50]!==o?(J=o==="send"&&(0,t.jsx)(Nt,{batchMode:U,bodyText:T,delayText:I,onBatchModeChange:Ce,onBodyChange:ve,onDelayChange:Se,onSelectExport:qe,onSend:we,queues:S,selectedExportName:H,sending:pe}),e[39]=U,e[40]=T,e[41]=I,e[42]=Ce,e[43]=ve,e[44]=Se,e[45]=qe,e[46]=we,e[47]=S,e[48]=H,e[49]=pe,e[50]=o,e[51]=J):J=e[51];let oe;return e[52]!==B||e[53]!==k||e[54]!==Le||e[55]!==O||e[56]!==R||e[57]!==J?(oe=(0,t.jsxs)("div",{className:tt,"data-testid":at,children:[B,k,Le,O,R,J]}),e[52]=B,e[53]=k,e[54]=Le,e[55]=O,e[56]=R,e[57]=J,e[58]=oe):oe=e[58],oe},"Ft");function bt(n){return(0,t.jsxs)(G,{"data-testid":`queues-row-${n.exportName}`,children:[(0,t.jsx)(w,{className:"font-mono text-xs",children:n.exportName}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.name}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.mode}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.binding}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.deadLetterQueue??"\u2014"})]},n.exportName)}h(bt,"xt");function qt(n){return(0,t.jsx)("option",{value:n.exportName,children:n.exportName},n.exportName)}h(qt,"yt");function vt(n,e){return n.exportName.localeCompare(e.exportName)}h(vt,"bt");function St(n){return n.name}h(St,"Nt");export{Ft as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as fe}from"./chunk-CYX3OHJ3.js";import"./chunk-AFKLFS74.js";import{a as ie}from"./chunk-CN2AINNY.js";import{a as pe}from"./chunk-WUW4ZHRL.js";import"./chunk-DUDQV6XJ.js";import{P as de}from"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import{a as x}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as ne}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as he}from"./chunk-
|
|
1
|
+
import{a as fe}from"./chunk-CYX3OHJ3.js";import"./chunk-AFKLFS74.js";import{a as ie}from"./chunk-CN2AINNY.js";import{a as pe}from"./chunk-WUW4ZHRL.js";import"./chunk-DUDQV6XJ.js";import{P as de}from"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import{a as x}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as ne}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as he}from"./chunk-JCSDJBBZ.js";import"./chunk-PZ4QDWTI.js";import"./chunk-GDC3W3DZ.js";import"./chunk-F7JOSNAT.js";import{a as H}from"./chunk-DZGOHOOE.js";import{c as ue}from"./chunk-5DEXJ766.js";import{f as le}from"./chunk-NIUA7EHL.js";import"./chunk-RCZTUWG3.js";import{a as ce}from"./chunk-UANVABQG.js";import{d as oe,f as Z,g as ee,h as te,o as ae,q as me,s as re}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as i,d as Y,e as ge,f as ve,g as Ne,i as se}from"./chunk-R5ZTCHCE.js";var t=Y(Ne(),1);var xe=Y(ve(),1);var N=Y(ge(),1);function ye({className:a,orientation:e="horizontal",...s}){return(0,t.jsx)(ie,{"data-slot":"separator",orientation:e,className:se("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",a),...s})}i(ye,"ge");var we=/https?:\/\/[^\s"'<>)]+/i,be=i(a=>a===void 0?void 0:we.exec(a)?.[0],"re"),y=i(a=>a===void 0?"":Array.isArray(a)?a.join(", "):a,"N"),Ce=i(a=>{if(a!==void 0)return be(a.html)??be(a.text)},"Ne"),ke=i((a,e)=>{let s=e.trim().toLowerCase();return s===""?a:a.filter(o=>`${o.subject} ${y(o.to)} ${y(o.cc)}`.toLowerCase().includes(s))},"we"),Se=i((a,e)=>{if(a.length!==0)return a.find(s=>s.id===e)??a[0]},"ye"),Te=Z(H.clearCapturedMail),Le=Z(H.sendTestMail),je=i(a=>{let e=(0,xe.c)(38),{limit:s}=a,o=le(),p;e[0]!==s?(p={limit:s},e[0]=s,e[1]=p):p=e[1];let{data:q,error:w,errorSource:C,isLoading:g,refetch:n}=ue(H.getCapturedMail,p),[k,f]=(0,N.useState)(null),[D,S]=(0,N.useState)(null),[v,l]=(0,N.useState)("html"),[c,P]=(0,N.useState)(""),b=q?.entries??[],r=w??k,u=w===null?k:C,T;e[2]!==o||e[3]!==n?(T=i(async()=>{f(null);try{await o.query(Te,{},ee("")),S(null),n()}catch(m){f(te(m))}},"T"),e[2]=o,e[3]=n,e[4]=T):T=e[4];let R=T,L;e[5]!==o||e[6]!==n?(L=i(async()=>{f(null);try{await o.query(Le,{},ee("")),n()}catch(m){f(te(m))}},"k"),e[5]=o,e[6]=n,e[7]=L):L=e[7];let W=L,j;e[8]!==n?(j=i(()=>{n()},"L"),e[8]=n,e[9]=j):j=e[9],pe(j,!0);let M;e[10]!==R?(M=i(()=>{ae(R())},"A"),e[10]=R,e[11]=M):M=e[11];let U=M,_;e[12]!==W?(_=i(()=>{ae(W())},"E"),e[12]=W,e[13]=_):_=e[13];let G=_,z;e[14]===Symbol.for("react.memo_cache_sentinel")?(z=i(m=>{P(m.currentTarget.value)},"_"),e[14]=z):z=e[14];let J=z,$;e[15]===Symbol.for("react.memo_cache_sentinel")?($=i(m=>{let{id:h}=m.currentTarget.dataset;h!==void 0&&S(h)},"M"),e[15]=$):$=e[15];let K=$,A;e[16]===Symbol.for("react.memo_cache_sentinel")?(A=i(m=>{let h=m.currentTarget.dataset.tab;(h==="headers"||h==="html"||h==="text")&&l(h)},"j"),e[16]=A):A=e[16];let Q=A,F=ke(b,c),O=Se(F,D),d=Ce(O),I;e[17]!==d?(I=i(()=>{d!==void 0&&me(d)},"z"),e[17]=d,e[18]=I):I=e[18];let V=I,B;e[19]!==d?(B=i(()=>{d!==void 0&&"window"in globalThis&&globalThis.window.open(d,"_blank","noopener")},"F"),e[19]=d,e[20]=B):B=e[20];let X=B,E;return e[21]!==b||e[22]!==r||e[23]!==u||e[24]!==c||e[25]!==g||e[26]!==d||e[27]!==U||e[28]!==V||e[29]!==J||e[30]!==X||e[31]!==K||e[32]!==Q||e[33]!==G||e[34]!==O||e[35]!==v||e[36]!==F?(E={entries:b,error:r,errorSource:u,filter:c,isLoading:g,link:d,onClear:U,onCopyLink:V,onFilterChange:J,onOpenLink:X,onSelectMessage:K,onSelectTab:Q,onSendTest:G,selected:O,tab:v,visible:F},e[21]=b,e[22]=r,e[23]=u,e[24]=c,e[25]=g,e[26]=d,e[27]=U,e[28]=V,e[29]=J,e[30]=X,e[31]=K,e[32]=Q,e[33]=G,e[34]=O,e[35]=v,e[36]=F,e[37]=E):E=e[37],E},"Te"),Me=`<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src data:; style-src 'unsafe-inline'; font-src data:">`,_e=i(a=>`${Me}${a}`,"Le"),Je=i(({limit:a=100})=>{let e=oe(),{entries:s,error:o,errorSource:p,filter:q,isLoading:w,link:C,onClear:g,onCopyLink:n,onFilterChange:k,onOpenLink:f,onSelectMessage:D,onSelectTab:S,onSendTest:v,selected:l,tab:c,visible:P}=je({limit:a}),b=i(r=>e(r==="html"?"HTML":r==="text"?"Plain text":"Headers"),"b");return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"mail-panel",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(x,{"data-testid":"mail-send-test",onClick:v,size:"sm",type:"button",variant:"outline",children:e("Send test")}),(0,t.jsx)(x,{"data-testid":"mail-clear",disabled:s.length===0,onClick:g,size:"sm",type:"button",variant:"outline",children:e("Clear inbox")}),s.length>0&&(0,t.jsx)(ne,{className:"ml-auto","data-testid":"mail-count",variant:"secondary",children:e("{count} messages",{count:s.length})})]}),o!==null&&(0,t.jsx)(he,{error:p,testId:"mail-error"}),o===null&&!w&&s.length===0&&(0,t.jsx)(ce,{description:e("Email your app sends in dev is captured here \u2014 nothing is delivered."),icon:(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsx)("path",{d:"M4 5h16v14H4z"}),(0,t.jsx)("path",{d:"m4 6 8 6 8-6"})]}),testId:"mail-empty",title:e("No captured email.")}),s.length>0&&(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-[minmax(0,22rem)_1fr]","data-testid":"mail-reader",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)(de,{"aria-label":e("Search messages"),"data-testid":"mail-search",onChange:k,placeholder:e("Filter messages"),type:"search",value:q}),(0,t.jsx)(fe,{className:"max-h-[32rem] rounded-xl border border-border bg-card shadow-xs","data-testid":"mail-list",children:(0,t.jsx)("ul",{className:"divide-y",children:P.map(r=>{let u=r.id===l?.id;return(0,t.jsx)("li",{children:(0,t.jsxs)("button",{className:`flex w-full flex-col items-start gap-0.5 px-3 py-2 text-left text-sm hover:bg-muted/60 ${u?"bg-muted":""}`,"data-active":u,"data-id":r.id,"data-testid":"mail-list-item",onClick:D,type:"button",children:[(0,t.jsx)("span",{className:"w-full truncate font-medium",children:r.subject||e("(no subject)")}),(0,t.jsx)("span",{className:"w-full truncate text-xs text-muted-foreground",children:y(r.to)}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:re(r.capturedAt,"\u2014")})]})},r.id)})})})]}),l!==void 0&&(0,t.jsxs)("div",{className:"flex min-w-0 flex-col gap-3 rounded-xl border border-border bg-card p-4 shadow-xs","data-testid":"mail-detail",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("h2",{className:"truncate text-base font-semibold","data-testid":"mail-subject",children:l.subject||e("(no subject)")}),(0,t.jsxs)("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-xs text-muted-foreground",children:[(0,t.jsx)("dt",{children:e("From")}),(0,t.jsx)("dd",{className:"truncate font-mono",children:l.from??"\u2014"}),(0,t.jsx)("dt",{children:e("To")}),(0,t.jsx)("dd",{className:"truncate font-mono",children:y(l.to)}),l.cc!==void 0&&l.cc.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("dt",{children:e("Cc")}),(0,t.jsx)("dd",{className:"truncate font-mono",children:y(l.cc)})]}),(0,t.jsx)("dt",{children:e("Sent")}),(0,t.jsx)("dd",{className:"tabular-nums",children:re(l.capturedAt,"\u2014")})]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2","data-testid":"mail-actions",children:[(0,t.jsx)(x,{"data-testid":"mail-copy-link",disabled:C===void 0,onClick:n,size:"sm",type:"button",variant:"outline",children:e("Copy link")}),(0,t.jsx)(x,{"data-testid":"mail-open-link",disabled:C===void 0,onClick:f,size:"sm",type:"button",variant:"outline",children:e("Open in new tab")})]}),(0,t.jsx)(ye,{}),(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"mail-tabs",role:"tablist",children:["html","text","headers"].map(r=>(0,t.jsx)(x,{"aria-selected":c===r,"data-tab":r,"data-testid":`mail-tab-${r}`,onClick:S,role:"tab",size:"sm",type:"button",variant:c===r?"secondary":"ghost",children:b(r)},r))}),(0,t.jsxs)("div",{className:"min-h-[12rem]",children:[c==="html"&&(l.html===void 0?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("No HTML body.")}):(0,t.jsx)("iframe",{className:"h-[24rem] w-full rounded-md border bg-white","data-testid":"mail-preview-html",sandbox:"",srcDoc:_e(l.html),title:e("Email preview")})),c==="text"&&(l.text===void 0?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("No text body.")}):(0,t.jsx)("pre",{className:"overflow-auto whitespace-pre-wrap rounded-md border bg-muted/30 p-3 text-xs","data-testid":"mail-preview-text",children:l.text})),c==="headers"&&(l.headers===void 0||Object.keys(l.headers).length===0?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("No headers.")}):(0,t.jsx)("pre",{className:"overflow-auto whitespace-pre-wrap rounded-md border bg-muted/30 p-3 text-xs","data-testid":"mail-preview-headers",children:Object.entries(l.headers).map(([r,u])=>`${r}: ${u}`).join(`
|
|
2
2
|
`)}))]})]})]})]})},"We");export{Je as MailPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as F,b as O}from"./chunk-BQK2C2Z4.js";import{a as B}from"./chunk-E6P2ERQV.js";import{a as V}from"./chunk-CKTKI4IY.js";import{a as T}from"./chunk-6UN4V2HB.js";import"./chunk-KVSQKUWD.js";import"./chunk-ZHPDAJBM.js";import{P as L}from"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import"./chunk-XQS7KSHL.js";import{b as C}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as j}from"./chunk-
|
|
1
|
+
import{a as F,b as O}from"./chunk-BQK2C2Z4.js";import{a as B}from"./chunk-E6P2ERQV.js";import{a as V}from"./chunk-CKTKI4IY.js";import{a as T}from"./chunk-6UN4V2HB.js";import"./chunk-KVSQKUWD.js";import"./chunk-ZHPDAJBM.js";import{P as L}from"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import"./chunk-XQS7KSHL.js";import{b as C}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as j}from"./chunk-JCSDJBBZ.js";import"./chunk-PZ4QDWTI.js";import"./chunk-GDC3W3DZ.js";import"./chunk-F7JOSNAT.js";import{a as R}from"./chunk-DZGOHOOE.js";import{c as M}from"./chunk-5DEXJ766.js";import"./chunk-NIUA7EHL.js";import"./chunk-RCZTUWG3.js";import{a as K}from"./chunk-UANVABQG.js";import{a as z,b as A,c as q,d as p,e as n,f as d}from"./chunk-L4EZAHCD.js";import{a as I,e as E}from"./chunk-IYWVSMAY.js";import{d as b,s as k}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as i,d as y,e as ee,g as te}from"./chunk-R5ZTCHCE.js";var o=y(ee(),1);var e=y(te(),1);var D=80,re=i(s=>{if(s===void 0)return"";let t=JSON.stringify(s);return t.length>D?`${t.slice(0,D)}\u2026`:t},"te"),ae=41,J=480,H=5,ie=i((s,t)=>F(s,l=>{t(l.height>0?l:{height:J,width:l.width})}),"ae"),Ne=i(({initialShardKey:s})=>{let t=b(),{queryShardKey:l,setShardKey:P,shardKey:U}=V(s),[m,W]=(0,o.useState)(""),{data:f,error:g,errorSource:Z,isLoading:_,liveError:$}=M(R.getAuditLog,{},{live:!0,shardKey:l}),h=(0,o.useMemo)(()=>f?.entries??[],[f]),c=(0,o.useMemo)(()=>{let a=m.trim().toLowerCase();return a===""?h:h.filter(r=>r.op.toLowerCase().includes(a)||(r.table??"").toLowerCase().includes(a)||(r.id??"").toLowerCase().includes(a))},[h,m]),x=(0,o.useRef)(null),v=O({count:c.length,estimateSize:i(()=>ae,"estimateSize"),getScrollElement:i(()=>x.current,"getScrollElement"),initialRect:{height:J,width:800},observeElementRect:ie,overscan:8}),u=v.getVirtualItems(),G=v.getTotalSize(),N=u[0]?.start??0,w=G-(u.at(-1)?.end??0),Q={height:N},X={height:w},Y=i(a=>{W(a.target.value)},"_");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-audit",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(T,{onChange:P,testId:"au-shard-input",value:U}),(0,e.jsx)(B,{message:$,prefix:"au"}),(0,e.jsx)(L,{"aria-label":t("Filter audit log"),className:"h-8 w-48","data-testid":"au-search",onChange:Y,placeholder:t("filter op, table, id"),value:m})]}),g!==null&&(0,e.jsx)(j,{error:Z,testId:"au-error"}),g===null&&!_&&c.length===0&&(0,e.jsx)(K,{description:t("State-changing admin operations are recorded here."),icon:(0,e.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsx)("path",{d:"M8 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2h-2M9 3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1V3Zm-1 9h8m-8 4h5"})}),testId:"au-empty",title:t("No audit entries.")}),c.length>0&&(0,e.jsx)(I,{className:"overflow-hidden py-0",children:(0,e.jsx)(E,{className:"max-h-[30rem] overflow-auto px-0",ref:x,children:(0,e.jsxs)(z,{"data-testid":"au-table",children:[(0,e.jsx)(A,{children:(0,e.jsxs)(p,{children:[(0,e.jsx)(n,{children:t("time")}),(0,e.jsx)(n,{children:t("op")}),(0,e.jsx)(n,{children:t("table")}),(0,e.jsx)(n,{children:t("id")}),(0,e.jsx)(n,{children:t("detail")})]})}),(0,e.jsxs)(q,{children:[N>0&&(0,e.jsx)("tr",{"aria-hidden":"true",children:(0,e.jsx)("td",{colSpan:H,style:Q})}),u.map(a=>{let r=c[a.index],S=re(r.detail);return(0,e.jsxs)(p,{"data-testid":"au-row",children:[(0,e.jsx)(d,{className:"text-muted-foreground tabular-nums",children:k(r.ts,"\u2014")}),(0,e.jsx)(d,{children:(0,e.jsx)(C,{variant:"secondary",children:r.op})}),(0,e.jsx)(d,{className:"font-medium",children:r.table??(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,e.jsx)(d,{className:"max-w-[20ch] truncate font-mono text-xs",children:r.id??(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,e.jsx)(d,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:S||void 0,children:S||(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},r.seq)}),w>0&&(0,e.jsx)("tr",{"aria-hidden":"true",children:(0,e.jsx)("td",{colSpan:H,style:X})})]})]})})})]})},"Ne");export{Ne as AuditPanel};
|