@lunora/studio 1.0.0-alpha.34 → 1.0.0-alpha.35

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.
Files changed (81) hide show
  1. package/dist/index.d.ts +5 -1
  2. package/dist/index.js +6 -6
  3. package/dist/mount.js +1 -1
  4. package/dist/packem_chunks/ApiTab.js +1 -1
  5. package/dist/packem_chunks/AuditPanel.js +1 -1
  6. package/dist/packem_chunks/ExportImportPanel.js +1 -1
  7. package/dist/packem_chunks/FileBrowser.js +1 -1
  8. package/dist/packem_chunks/FunctionRunner.js +1 -1
  9. package/dist/packem_chunks/FunctionStatsPanel.js +1 -1
  10. package/dist/packem_chunks/HealthPanel.js +1 -1
  11. package/dist/packem_chunks/InsightsPanel.js +1 -1
  12. package/dist/packem_chunks/LogsPanel.js +1 -1
  13. package/dist/packem_chunks/MailPanel.js +3 -91
  14. package/dist/packem_chunks/MetricsPanel.js +1 -1
  15. package/dist/packem_chunks/MigrationsPanel.js +1 -1
  16. package/dist/packem_chunks/PitrPanel.js +1 -1
  17. package/dist/packem_chunks/SchemaViewer.js +1 -1
  18. package/dist/packem_chunks/SecurityAdvisorPanel.js +1 -1
  19. package/dist/packem_chunks/SettingsPanel.js +1 -1
  20. package/dist/packem_chunks/SqlEditorPanel.js +1 -1
  21. package/dist/packem_chunks/TableEditor.js +1 -1
  22. package/dist/packem_chunks/containers-panel.js +1 -1
  23. package/dist/packem_chunks/dashboards-panel.js +1 -1
  24. package/dist/packem_chunks/fanout-panel.js +1 -1
  25. package/dist/packem_chunks/flags-panel.js +1 -1
  26. package/dist/packem_chunks/kv-browser.js +1 -1
  27. package/dist/packem_chunks/payments-panel.js +1 -1
  28. package/dist/packem_chunks/permissions-panel.js +1 -1
  29. package/dist/packem_chunks/queues-panel.js +975 -71
  30. package/dist/packem_chunks/rls-panel.js +1 -1
  31. package/dist/packem_chunks/storage-rules-panel.js +1 -1
  32. package/dist/packem_chunks/subscriptions-panel.js +1 -1
  33. package/dist/packem_chunks/workflows-panel.js +1 -1
  34. package/dist/packem_shared/{ADMIN_FUNCTIONS-CdaxLGkE.js → ADMIN_FUNCTIONS-BHHJi3Gb.js} +4 -0
  35. package/dist/packem_shared/{ApiDocsPanel-Cu6mD4u7.js → ApiDocsPanel-D4CJf2ad.js} +1 -1
  36. package/dist/packem_shared/{DataBrowser-DSNK1tPg.js → DataBrowser-BeVNxSVm.js} +1 -1
  37. package/dist/packem_shared/{HomePanel-DQk3P8xX.js → HomePanel-D9MQk8I7.js} +2 -2
  38. package/dist/packem_shared/{Studio-Biu37c3O.js → Studio-C48P1K5W.js} +2 -2
  39. package/dist/packem_shared/{StudioApp-D6a2ZmXS.js → StudioApp-Cqh-SYm2.js} +1 -1
  40. package/dist/packem_shared/{home-panel-Bo-Mgrkn.js → home-panel-CoGxi-oj.js} +1 -1
  41. package/dist/packem_shared/scroll-area-DLhcy-ml.js +93 -0
  42. package/dist/packem_shared/{studio-C4sgu0F7.js → studio-CPHA_-3I.js} +1 -1
  43. package/dist/standalone/{chunk-YM6BBZDN.js → chunk-46K3NKPA.js} +1 -1
  44. package/dist/standalone/{chunk-DFP2DADO.js → chunk-474C2O7W.js} +1 -1
  45. package/dist/standalone/{chunk-JIDZFLTB.js → chunk-6UGM5IHN.js} +1 -1
  46. package/dist/standalone/{chunk-T5HRXUSY.js → chunk-6WRZP62V.js} +1 -1
  47. package/dist/standalone/{chunk-EVPLBWUT.js → chunk-7WNJ4Q7Z.js} +1 -1
  48. package/dist/standalone/{chunk-PA3LN4XJ.js → chunk-BI35RXKQ.js} +1 -1
  49. package/dist/standalone/chunk-BOXSWNXZ.js +1 -0
  50. package/dist/standalone/{chunk-K4ZDRTQM.js → chunk-DVC6YWVP.js} +1 -1
  51. package/dist/standalone/{chunk-G2ICR3DL.js → chunk-DWTBY343.js} +1 -1
  52. package/dist/standalone/{chunk-KTK3V4DC.js → chunk-EIQW6ACH.js} +1 -1
  53. package/dist/standalone/chunk-EUIHTPKI.js +1 -0
  54. package/dist/standalone/{chunk-E6WUCLSI.js → chunk-ILCTSAOB.js} +1 -1
  55. package/dist/standalone/{chunk-GZDWDDXN.js → chunk-IODYGARQ.js} +1 -1
  56. package/dist/standalone/{chunk-XIGIWZLO.js → chunk-JE2YOAB7.js} +1 -1
  57. package/dist/standalone/{chunk-SGDQIWAR.js → chunk-JFSZIUZT.js} +1 -1
  58. package/dist/standalone/{chunk-QHIIRFG7.js → chunk-LD2R263D.js} +1 -1
  59. package/dist/standalone/{chunk-ISJAJWYI.js → chunk-M55U7NHO.js} +1 -1
  60. package/dist/standalone/{chunk-VEZO7G5Q.js → chunk-MPTM7ZU3.js} +1 -1
  61. package/dist/standalone/{chunk-5PQMXK24.js → chunk-NJFMWO6P.js} +1 -1
  62. package/dist/standalone/{chunk-BET2625I.js → chunk-OCHNCAXJ.js} +1 -1
  63. package/dist/standalone/{chunk-7M3F6U4L.js → chunk-PACH5AHG.js} +1 -1
  64. package/dist/standalone/chunk-QLM6FYZW.js +2 -0
  65. package/dist/standalone/{chunk-X72PYOEW.js → chunk-RRAFQ5G2.js} +1 -1
  66. package/dist/standalone/{chunk-SYEIXTEU.js → chunk-SLKF2L74.js} +1 -1
  67. package/dist/standalone/{chunk-DCECRP45.js → chunk-TO4JQX7W.js} +1 -1
  68. package/dist/standalone/{chunk-TM7CMA7X.js → chunk-VTGBPW24.js} +1 -1
  69. package/dist/standalone/{chunk-MFPTVCJ6.js → chunk-X6F22DBL.js} +1 -1
  70. package/dist/standalone/{chunk-E7WLF6IU.js → chunk-XGMIDFUK.js} +1 -1
  71. package/dist/standalone/{chunk-VYMCCC6O.js → chunk-XZE2RNDA.js} +1 -1
  72. package/dist/standalone/chunk-YAECF5LW.js +1 -0
  73. package/dist/standalone/{chunk-GJ6PGSES.js → chunk-YEVCU7TB.js} +1 -1
  74. package/dist/standalone/{chunk-TY7L2V4E.js → chunk-YV43BOP7.js} +1 -1
  75. package/dist/standalone/{chunk-4MLAVZP4.js → chunk-ZU4DZ6NK.js} +1 -1
  76. package/dist/standalone/studio.js +1 -1
  77. package/dist/styles.css +1 -1
  78. package/package.json +2 -2
  79. package/dist/standalone/chunk-AQGOX5DK.js +0 -1
  80. package/dist/standalone/chunk-GVRM4U6W.js +0 -2
  81. package/dist/standalone/chunk-UDSVXA42.js +0 -1
@@ -0,0 +1 @@
1
+ import{a as He}from"./chunk-YAECF5LW.js";import"./chunk-DWDILV2E.js";import{a as Ve}from"./chunk-J6J54MBP.js";import"./chunk-5OIBXYZM.js";import{a as Ge}from"./chunk-AJIUI7DD.js";import"./chunk-XNJNSCLM.js";import{a as Re,b as $e,c as Oe,d as Y,e as q,f as T}from"./chunk-GTM65MVX.js";import{a as Pe}from"./chunk-VLXV72QE.js";import{R as Fe}from"./chunk-3CJW6NWG.js";import{c as H}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as G}from"./chunk-BOXSWNXZ.js";import{a as ue}from"./chunk-TAD43CG5.js";import{b as Le}from"./chunk-DVKPRFIJ.js";import{a as De,e as Be}from"./chunk-SEU5V7I6.js";import{b as ce}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as Je}from"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as z,e as me,f as fe,g as he,k as pe,n as ze}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as p,e as we,f as Ke,g as Ze,h as et}from"./chunk-RRCPZMC2.js";var P=we(Ze(),1);var D=we(Ke(),1);var t=we(et(),1);var tt=200,st=me(G.sendQueueMessage),at=me(G.replayQueueMessage),ot=me(G.clearQueueMessages),Ye=96,rt=p(r=>{if(r===void 0)return"\u2014";try{return JSON.stringify(r)}catch{return"[unserializable]"}},"formatBody"),lt=p(r=>r.length>Ye?`${r.slice(0,Ye)}\u2026`:r,"truncate"),nt=p(r=>r==="error"?"destructive":r==="retry"?"outline":"secondary","outcomeVariant"),dt=p((r,e)=>e(r==="messages"?"Messages":r==="send"?"Send":"Declared"),"tabLabel"),it=p(r=>{let e=(0,P.c)(11),{loaded:s,queues:m}=r,l=z(),n;e[0]!==l?(n=l("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]=l,e[1]=n):n=e[1];let o;e[2]!==n?(o=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:n},void 0,!1),e[2]=n,e[3]=o):o=e[3];let a;e[4]!==s||e[5]!==m||e[6]!==l?(a=s&&m.length===0?(0,t.jsxDEV)(ue,{description:l("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:l("No queues defined")},void 0,!1):(0,t.jsxDEV)(De,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Be,{className:"px-0",children:(0,t.jsxDEV)(Re,{"data-testid":"queues-table",children:[(0,t.jsxDEV)($e,{children:(0,t.jsxDEV)(Y,{children:[(0,t.jsxDEV)(q,{children:l("Export")},void 0,!1),(0,t.jsxDEV)(q,{children:l("Queue")},void 0,!1),(0,t.jsxDEV)(q,{children:l("Mode")},void 0,!1),(0,t.jsxDEV)(q,{children:l("Binding")},void 0,!1),(0,t.jsxDEV)(q,{children:l("Dead-letter")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Oe,{children:m.map(ft)},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[4]=s,e[5]=m,e[6]=l,e[7]=a):a=e[7];let h;return e[8]!==o||e[9]!==a?(h=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"queues-declared",children:[o,a]},void 0,!0),e[8]=o,e[9]=a,e[10]=h):h=e[10],h},"QueuesDeclaredTab"),ct=p(r=>{let e=(0,P.c)(67),{message:s,onReplay:m,replayingId:l}=r,n=z(),o,a,h,c,y,g,x,d,u,f;if(e[0]!==s.attempts||e[1]!==s.body||e[2]!==s.deadLettered||e[3]!==s.exportName||e[4]!==s.id||e[5]!==s.messageId||e[6]!==s.outcome||e[7]!==s.queue||e[8]!==n){let w=rt(s.body);a=Y,g=`queues-message-${s.id}`;let R=s.exportName??s.queue;e[19]!==R?(x=(0,t.jsxDEV)(T,{className:"font-mono text-xs",children:R},void 0,!1),e[19]=R,e[20]=x):x=e[20],e[21]!==s.messageId?(d=(0,t.jsxDEV)(T,{className:"max-w-[16ch] truncate font-mono text-xs text-muted-foreground",title:s.messageId,children:s.messageId},void 0,!1),e[21]=s.messageId,e[22]=d):d=e[22],e[23]!==s.attempts?(u=(0,t.jsxDEV)(T,{className:"font-mono text-xs tabular-nums",children:s.attempts},void 0,!1),e[23]=s.attempts,e[24]=u):u=e[24];let A=`queues-outcome-${s.id}`,Q;e[25]!==s.outcome?(Q=nt(s.outcome),e[25]=s.outcome,e[26]=Q):Q=e[26];let E;e[27]!==s.outcome||e[28]!==A||e[29]!==Q?(E=(0,t.jsxDEV)(ce,{"data-testid":A,variant:Q,children:s.outcome},void 0,!1),e[27]=s.outcome,e[28]=A,e[29]=Q,e[30]=E):E=e[30];let M;e[31]!==s.deadLettered||e[32]!==s.id||e[33]!==n?(M=s.deadLettered&&(0,t.jsxDEV)(ce,{"data-testid":`queues-dlq-${s.id}`,variant:"destructive",children:n("DLQ")},void 0,!1),e[31]=s.deadLettered,e[32]=s.id,e[33]=n,e[34]=M):M=e[34],e[35]!==E||e[36]!==M?(f=(0,t.jsxDEV)(T,{children:(0,t.jsxDEV)("span",{className:"inline-flex items-center gap-1",children:[E,M]},void 0,!0)},void 0,!1),e[35]=E,e[36]=M,e[37]=f):f=e[37],o=T,h="max-w-[32ch] truncate font-mono text-xs text-muted-foreground",c=w,y=lt(w),e[0]=s.attempts,e[1]=s.body,e[2]=s.deadLettered,e[3]=s.exportName,e[4]=s.id,e[5]=s.messageId,e[6]=s.outcome,e[7]=s.queue,e[8]=n,e[9]=o,e[10]=a,e[11]=h,e[12]=c,e[13]=y,e[14]=g,e[15]=x,e[16]=d,e[17]=u,e[18]=f}else o=e[9],a=e[10],h=e[11],c=e[12],y=e[13],g=e[14],x=e[15],d=e[16],u=e[17],f=e[18];let v;e[38]!==o||e[39]!==h||e[40]!==c||e[41]!==y?(v=(0,t.jsxDEV)(o,{className:h,title:c,children:y},void 0,!1),e[38]=o,e[39]=h,e[40]=c,e[41]=y,e[42]=v):v=e[42];let N;e[43]!==s.capturedAt?(N=ze(s.capturedAt,"\u2014"),e[43]=s.capturedAt,e[44]=N):N=e[44];let b;e[45]!==N?(b=(0,t.jsxDEV)(T,{className:"text-xs text-muted-foreground tabular-nums",children:N},void 0,!1),e[45]=N,e[46]=b):b=e[46];let C=`queues-replay-${s.id}`,B=l!==null,_;e[47]!==s.id||e[48]!==l||e[49]!==n?(_=l===s.id?n("Replaying\u2026"):n("Replay"),e[47]=s.id,e[48]=l,e[49]=n,e[50]=_):_=e[50];let I;e[51]!==s.id||e[52]!==m||e[53]!==C||e[54]!==B||e[55]!==_?(I=(0,t.jsxDEV)(T,{children:(0,t.jsxDEV)(H,{"data-id":s.id,"data-testid":C,disabled:B,onClick:m,size:"xs",type:"button",variant:"outline",children:_},void 0,!1)},void 0,!1),e[51]=s.id,e[52]=m,e[53]=C,e[54]=B,e[55]=_,e[56]=I):I=e[56];let L;return e[57]!==a||e[58]!==b||e[59]!==I||e[60]!==g||e[61]!==x||e[62]!==d||e[63]!==u||e[64]!==f||e[65]!==v?(L=(0,t.jsxDEV)(a,{"data-testid":g,children:[x,d,u,f,v,b,I]},void 0,!0),e[57]=a,e[58]=b,e[59]=I,e[60]=g,e[61]=x,e[62]=d,e[63]=u,e[64]=f,e[65]=v,e[66]=L):L=e[66],L},"QueueLogRow"),ut=p(r=>{let e=(0,P.c)(26),{hasError:s,messages:m,onClear:l,onReplay:n,replayingId:o}=r,a=z(),h;e[0]!==a?(h=a("Cloudflare Queues have no peek API, so this is what push consumers actually processed \u2014 not pending depth."),e[0]=a,e[1]=h):h=e[1];let c;e[2]!==h?(c=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:h},void 0,!1),e[2]=h,e[3]=c):c=e[3];let y=m.length===0,g;e[4]!==a?(g=a("Clear log"),e[4]=a,e[5]=g):g=e[5];let x;e[6]!==l||e[7]!==y||e[8]!==g?(x=(0,t.jsxDEV)(H,{className:"ml-auto","data-testid":"queues-clear",disabled:y,onClick:l,size:"sm",type:"button",variant:"outline",children:g},void 0,!1),e[6]=l,e[7]=y,e[8]=g,e[9]=x):x=e[9];let d;e[10]!==m.length||e[11]!==a?(d=m.length>0&&(0,t.jsxDEV)(ce,{"data-testid":"queues-count",variant:"secondary",children:a("{count} messages",{count:m.length})},void 0,!1),e[10]=m.length,e[11]=a,e[12]=d):d=e[12];let u;e[13]!==c||e[14]!==x||e[15]!==d?(u=(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[c,x,d]},void 0,!0),e[13]=c,e[14]=x,e[15]=d,e[16]=u):u=e[16];let f;e[17]!==s||e[18]!==m||e[19]!==n||e[20]!==o||e[21]!==a?(f=!s&&m.length===0?(0,t.jsxDEV)(ue,{description:a("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:a("No consumed messages yet.")},void 0,!1):(0,t.jsxDEV)(De,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Be,{className:"px-0",children:(0,t.jsxDEV)(He,{className:"max-h-[32rem]","data-testid":"queues-messages-scroll",children:(0,t.jsxDEV)(Re,{"data-testid":"queues-messages-table",children:[(0,t.jsxDEV)($e,{children:(0,t.jsxDEV)(Y,{children:[(0,t.jsxDEV)(q,{children:a("Export")},void 0,!1),(0,t.jsxDEV)(q,{children:a("Message")},void 0,!1),(0,t.jsxDEV)(q,{children:a("Attempts")},void 0,!1),(0,t.jsxDEV)(q,{children:a("Outcome")},void 0,!1),(0,t.jsxDEV)(q,{children:a("Body")},void 0,!1),(0,t.jsxDEV)(q,{children:a("Captured")},void 0,!1),(0,t.jsxDEV)(q,{},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Oe,{children:m.map(N=>(0,t.jsxDEV)(ct,{message:N,onReplay:n,replayingId:o},N.id,!1))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)},void 0,!1),e[17]=s,e[18]=m,e[19]=n,e[20]=o,e[21]=a,e[22]=f):f=e[22];let v;return e[23]!==u||e[24]!==f?(v=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"queues-messages",children:[u,f]},void 0,!0),e[23]=u,e[24]=f,e[25]=v):v=e[25],v},"QueuesMessagesTab"),mt=p(r=>{let e=(0,P.c)(20),{batchMode:s,bodyText:m,delayText:l,onBatchModeChange:n,onBodyChange:o,onDelayChange:a,onSelectExport:h,onSend:c,queues:y,selectedExportName:g,sending:x}=r,d=z(),u;e[0]!==d?(u=d("Enqueue a JSON message to a declared producer to exercise its consumer. Nothing is captured until the consumer processes it."),e[0]=d,e[1]=u):u=e[1];let f;e[2]!==u?(f=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:u},void 0,!1),e[2]=u,e[3]=f):f=e[3];let v;e[4]!==s||e[5]!==m||e[6]!==l||e[7]!==n||e[8]!==o||e[9]!==a||e[10]!==h||e[11]!==c||e[12]!==y||e[13]!==g||e[14]!==x||e[15]!==d?(v=y.length===0?(0,t.jsxDEV)(ue,{description:d("Declare a queue with defineQueue in lunora/queues.ts to enqueue a test message."),testId:"queues-send-empty",title:d("No queues to send to")},void 0,!1):(0,t.jsxDEV)(t.Fragment,{children:[(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxDEV)("select",{"aria-label":d("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:h,value:g,children:y.map(ht)},void 0,!1),(0,t.jsxDEV)(Fe,{"aria-label":d("Delay (seconds)"),className:"max-w-36","data-testid":"queues-send-delay",min:0,onChange:a,placeholder:d("Delay (s)"),type:"number",value:l},void 0,!1),(0,t.jsxDEV)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"queues-send-batch",children:[(0,t.jsxDEV)("input",{checked:s,"data-testid":"queues-send-batch",id:"queues-send-batch",onChange:n,type:"checkbox"},void 0,!1),d("Send as batch (JSON array)")]},void 0,!0),(0,t.jsxDEV)(H,{className:"ml-auto","data-testid":"queues-send-button",disabled:x||g==="",onClick:c,type:"button",children:d(x?"Sending\u2026":"Send message")},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(Pe,{"aria-label":d("Message body (JSON)"),className:"font-mono","data-testid":"queues-send-body",onChange:o,placeholder:s?'[ { "hello": "world" } ]':'{ "hello": "world" }',value:m},void 0,!1)]},void 0,!0),e[4]=s,e[5]=m,e[6]=l,e[7]=n,e[8]=o,e[9]=a,e[10]=h,e[11]=c,e[12]=y,e[13]=g,e[14]=x,e[15]=d,e[16]=v):v=e[16];let N;return e[17]!==f||e[18]!==v?(N=(0,t.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"queues-send",children:[f,v]},void 0,!0),e[17]=f,e[18]=v,e[19]=N):N=e[19],N},"QueuesSendTab"),wt=p(r=>{let e=(0,P.c)(74),{limit:s}=r,m=s??tt,l=Je(),n=z(),[o,a]=(0,D.useState)("declared"),[h,c]=(0,D.useState)(null),y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y={},e[0]=y):y=e[0];let{data:g,error:x,errorSource:d}=Le(G.listQueues,y),u;e[1]!==m?(u={limit:m},e[1]=m,e[2]=u):u=e[2];let{data:f,error:v,errorSource:N,refetch:b}=Le(G.getQueueMessages,u),C=Array.isArray(g?.queues)?[...g.queues].toSorted(pt):[],B;e[3]!==f?.entries?(B=f?.entries??[],e[3]=f?.entries,e[4]=B):B=e[4];let _=B,[I,L]=(0,D.useState)(""),[w,R]=(0,D.useState)(""),[A,Q]=(0,D.useState)(""),[E,M]=(0,D.useState)(!1),[ge,j]=(0,D.useState)(!1),[ve,W]=(0,D.useState)(null),$=C.some(i=>i.exportName===I)?I:C[0]?.exportName??"",ke=o==="messages"?v:x,je=o==="messages"?N:d,xe=ke??h,ye=ke===null?h:je,X;e[5]!==b?(X=p(()=>{b()},"t4"),e[5]=b,e[6]=X):X=e[6],Ve(X,o==="messages");let K;e[7]!==E||e[8]!==w||e[9]!==l||e[10]!==A||e[11]!==b||e[12]!==$||e[13]!==j||e[14]!==n?(K=p(async()=>{c(null);let i=$;if(i==="")return;let S=null,Me=w.trim();if(Me!=="")try{S=JSON.parse(Me)}catch{c(n("Body must be valid JSON."));return}let Ie,Ue=A.trim();if(Ue!==""){let V=Number(Ue);if(!Number.isFinite(V)||V<0){c(n("Delay must be a non-negative number of seconds."));return}Ie=V}if(E&&!Array.isArray(S)){c(n("Batch mode needs a JSON array body \u2014 each element is enqueued as one message."));return}j(!0);let Xe=E?{batch:S,delaySeconds:Ie,exportName:i}:{body:S,delaySeconds:Ie,exportName:i};try{await l.query(st,Xe,fe("")),b()}catch(V){c(he(V))}j(!1)},"t5"),e[7]=E,e[8]=w,e[9]=l,e[10]=A,e[11]=b,e[12]=$,e[13]=j,e[14]=n,e[15]=K):K=e[15];let be=K,Z;e[16]!==l||e[17]!==b||e[18]!==W?(Z=p(async i=>{c(null),W(i);try{await l.query(at,{id:i},fe("")),b()}catch(S){c(he(S))}W(null)},"t6"),e[16]=l,e[17]=b,e[18]=W,e[19]=Z):Z=e[19];let Ne=Z,ee;e[20]!==l||e[21]!==b?(ee=p(async()=>{c(null);try{await l.query(ot,{},fe("")),b()}catch(i){c(he(i))}},"t7"),e[20]=l,e[21]=b,e[22]=ee):ee=e[22];let Se=ee,te;e[23]===Symbol.for("react.memo_cache_sentinel")?(te=p(i=>{let S=i.currentTarget.dataset.tab;(S==="declared"||S==="messages"||S==="send")&&a(S)},"t8"),e[23]=te):te=e[23];let We=te,se;e[24]!==L?(se=p(i=>{L(i.currentTarget.value)},"t9"),e[24]=L,e[25]=se):se=e[25];let Ee=se,ae;e[26]!==R?(ae=p(i=>{R(i.currentTarget.value)},"t10"),e[26]=R,e[27]=ae):ae=e[27];let qe=ae,oe;e[28]!==Q?(oe=p(i=>{Q(i.currentTarget.value)},"t11"),e[28]=Q,e[29]=oe):oe=e[29];let Te=oe,re;e[30]!==M?(re=p(i=>{M(i.currentTarget.checked)},"t12"),e[30]=M,e[31]=re):re=e[31];let Ce=re,le;e[32]!==be?(le=p(()=>{pe(be())},"t13"),e[32]=be,e[33]=le):le=e[33];let _e=le,ne;e[34]!==Ne?(ne=p(i=>{let{id:S}=i.currentTarget.dataset;S!==void 0&&pe(Ne(S))},"t14"),e[34]=Ne,e[35]=ne):ne=e[35];let Ae=ne,de;e[36]!==Se?(de=p(()=>{pe(Se())},"t15"),e[36]=Se,e[37]=de):de=e[37];let Qe=de,O;e[38]!==n||e[39]!==o?(O=(0,t.jsxDEV)("div",{className:"flex items-center gap-1","data-testid":"queues-tabs",role:"tablist",children:["declared","messages","send"].map(i=>(0,t.jsxDEV)(H,{"aria-selected":o===i,"data-tab":i,"data-testid":`queues-tab-${i}`,onClick:We,role:"tab",size:"sm",type:"button",variant:o===i?"secondary":"ghost",children:dt(i,n)},i,!1))},void 0,!1),e[38]=n,e[39]=o,e[40]=O):O=e[40];let k;e[41]!==xe||e[42]!==ye?(k=xe!==null&&(0,t.jsxDEV)(Ge,{error:ye,testId:"queues-error"},void 0,!1),e[41]=xe,e[42]=ye,e[43]=k):k=e[43];let U;e[44]!==C||e[45]!==g||e[46]!==o?(U=o==="declared"&&(0,t.jsxDEV)(it,{loaded:g!==void 0,queues:C},void 0,!1),e[44]=C,e[45]=g,e[46]=o,e[47]=U):U=e[47];let J;e[48]!==_||e[49]!==v||e[50]!==Qe||e[51]!==Ae||e[52]!==ve||e[53]!==o?(J=o==="messages"&&(0,t.jsxDEV)(ut,{hasError:v!==null,messages:_,onClear:Qe,onReplay:Ae,replayingId:ve},void 0,!1),e[48]=_,e[49]=v,e[50]=Qe,e[51]=Ae,e[52]=ve,e[53]=o,e[54]=J):J=e[54];let F;e[55]!==E||e[56]!==w||e[57]!==A||e[58]!==Ce||e[59]!==qe||e[60]!==Te||e[61]!==Ee||e[62]!==_e||e[63]!==C||e[64]!==$||e[65]!==ge||e[66]!==o?(F=o==="send"&&(0,t.jsxDEV)(mt,{batchMode:E,bodyText:w,delayText:A,onBatchModeChange:Ce,onBodyChange:qe,onDelayChange:Te,onSelectExport:Ee,onSend:_e,queues:C,selectedExportName:$,sending:ge},void 0,!1),e[55]=E,e[56]=w,e[57]=A,e[58]=Ce,e[59]=qe,e[60]=Te,e[61]=Ee,e[62]=_e,e[63]=C,e[64]=$,e[65]=ge,e[66]=o,e[67]=F):F=e[67];let ie;return e[68]!==O||e[69]!==k||e[70]!==U||e[71]!==J||e[72]!==F?(ie=(0,t.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-queues-panel",children:[O,k,U,J,F]},void 0,!0),e[68]=O,e[69]=k,e[70]=U,e[71]=J,e[72]=F,e[73]=ie):ie=e[73],ie},"QueuesPanel");function ft(r){return(0,t.jsxDEV)(Y,{"data-testid":`queues-row-${r.exportName}`,children:[(0,t.jsxDEV)(T,{className:"font-mono text-xs",children:r.exportName},void 0,!1),(0,t.jsxDEV)(T,{className:"font-mono text-xs text-muted-foreground",children:r.name},void 0,!1),(0,t.jsxDEV)(T,{className:"font-mono text-xs text-muted-foreground",children:r.mode},void 0,!1),(0,t.jsxDEV)(T,{className:"font-mono text-xs text-muted-foreground",children:r.binding},void 0,!1),(0,t.jsxDEV)(T,{className:"font-mono text-xs text-muted-foreground",children:r.deadLetterQueue??"\u2014"},void 0,!1)]},r.exportName,!0)}p(ft,"_temp");function ht(r){return(0,t.jsxDEV)("option",{value:r.exportName,children:r.exportName},r.exportName,!1)}p(ht,"_temp2");function pt(r,e){return r.exportName.localeCompare(e.exportName)}p(pt,"_temp3");export{wt as default};
@@ -1 +1 @@
1
- import{b as $}from"./chunk-TQ36RWOP.js";import{a as M}from"./chunk-AJIUI7DD.js";import"./chunk-XNJNSCLM.js";import{a as P,b as Q,c as W,d as V,e as C,f as E}from"./chunk-GTM65MVX.js";import{a as j}from"./chunk-AQGOX5DK.js";import{b as H}from"./chunk-DVKPRFIJ.js";import{a as K,e as O}from"./chunk-SEU5V7I6.js";import{b as F}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as B}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as U,e as L,f as G,g as J,h as X}from"./chunk-RRCPZMC2.js";var q=L(J(),1),te=L(G(),1);var r=L(X(),1);var Y={binding:"outline",secret:"destructive",var:"secondary"},me=U(a=>{let e=(0,q.c)(68),{initialShardKey:z}=a,t=B(),N;e[0]===Symbol.for("react.memo_cache_sentinel")?(N={},e[0]=N):N=e[0];let R=z??"",T;e[1]!==R?(T={shardKey:R},e[1]=R,e[2]=T):T=e[2];let{data:k,error:d,errorSource:S,isLoading:A}=H(j.getSettings,N,T),D;e:{let s=k?.deploy;if(s===void 0){let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=[],e[3]=l):l=e[3],D=l;break e}let o;if(e[4]!==s.deploymentId||e[5]!==s.environment||e[6]!==s.versionTag||e[7]!==s.workerUrl||e[8]!==t){if(o=[],s.workerUrl!==void 0){let l;e[10]!==t?(l=t("URL"),e[10]=t,e[11]=l):l=e[11];let i;e[12]!==s.workerUrl||e[13]!==l?(i={label:l,value:s.workerUrl},e[12]=s.workerUrl,e[13]=l,e[14]=i):i=e[14],o.push(i)}if(s.environment!==void 0){let l;e[15]!==t?(l=t("Environment"),e[15]=t,e[16]=l):l=e[16];let i;e[17]!==s.environment||e[18]!==l?(i={label:l,value:s.environment},e[17]=s.environment,e[18]=l,e[19]=i):i=e[19],o.push(i)}if(s.deploymentId!==void 0){let l;e[20]!==t?(l=t("Deployment"),e[20]=t,e[21]=l):l=e[21];let i;e[22]!==s.deploymentId||e[23]!==l?(i={label:l,value:s.deploymentId},e[22]=s.deploymentId,e[23]=l,e[24]=i):i=e[24],o.push(i)}if(s.versionTag!==void 0){let l;e[25]!==t?(l=t("Version"),e[25]=t,e[26]=l):l=e[26];let i;e[27]!==s.versionTag||e[28]!==l?(i={label:l,value:s.versionTag},e[27]=s.versionTag,e[28]=l,e[29]=i):i=e[29],o.push(i)}e[4]=s.deploymentId,e[5]=s.environment,e[6]=s.versionTag,e[7]=s.workerUrl,e[8]=t,e[9]=o}else o=e[9];D=o}let w=D,_;e[30]!==k?.settings?(_=k?.settings??[],e[30]=k?.settings,e[31]=_):_=e[31];let n=_,m;e[32]!==t?(m=t("Open in Cloudflare"),e[32]=t,e[33]=m):m=e[33];let f;e[34]!==m?(f=(0,r.jsxDEV)("div",{className:"flex flex-wrap items-center gap-3",children:(0,r.jsxDEV)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"set-cf-link",href:$,rel:"noreferrer",target:"_blank",children:m},void 0,!1)},void 0,!1),e[34]=m,e[35]=f):f=e[35];let c;e[36]!==t?(c=t("View-only \u2014 values are masked. Edit vars, secrets, and bindings in wrangler or the Cloudflare dashboard."),e[36]=t,e[37]=c):c=e[37];let v;e[38]!==c?(v=(0,r.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"set-readonly-note",children:c},void 0,!1),e[38]=c,e[39]=v):v=e[39];let p;e[40]!==d||e[41]!==S?(p=d!==null&&(0,r.jsxDEV)(M,{error:S,testId:"set-error"},void 0,!1),e[40]=d,e[41]=S,e[42]=p):p=e[42];let u;e[43]!==w||e[44]!==t?(u=w.length>0&&(0,r.jsxDEV)(K,{className:"py-0","data-testid":"set-deploy",children:[(0,r.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Deployment")},void 0,!1)},void 0,!1),(0,r.jsxDEV)(O,{className:"py-3",children:(0,r.jsxDEV)("dl",{className:"grid grid-cols-[8rem_minmax(0,1fr)] gap-x-4 gap-y-1 text-sm",children:w.map(Z)},void 0,!1)},void 0,!1)]},void 0,!0),e[43]=w,e[44]=t,e[45]=u):u=e[45];let h;e[46]!==t?(h=t("Environment & bindings"),e[46]=t,e[47]=h):h=e[47];let g;e[48]!==h?(g=(0,r.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:h},void 0,!1)},void 0,!1),e[48]=h,e[49]=g):g=e[49];let x;e[50]!==d||e[51]!==A||e[52]!==n.length||e[53]!==t?(x=d===null&&!A&&n.length===0&&(0,r.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"set-empty",children:t("No environment variables or bindings.")},void 0,!1),e[50]=d,e[51]=A,e[52]=n.length,e[53]=t,e[54]=x):x=e[54];let b;e[55]!==n||e[56]!==t?(b=n.length>0&&(0,r.jsxDEV)(O,{className:"px-0 py-0",children:(0,r.jsxDEV)(P,{"data-testid":"set-table",children:[(0,r.jsxDEV)(Q,{children:(0,r.jsxDEV)(V,{children:[(0,r.jsxDEV)(C,{children:t("name")},void 0,!1),(0,r.jsxDEV)(C,{children:t("kind")},void 0,!1),(0,r.jsxDEV)(C,{children:t("value")},void 0,!1)]},void 0,!0)},void 0,!1),(0,r.jsxDEV)(W,{children:n.map(ee)},void 0,!1)]},void 0,!0)},void 0,!1),e[55]=n,e[56]=t,e[57]=b):b=e[57];let y;e[58]!==g||e[59]!==x||e[60]!==b?(y=(0,r.jsxDEV)(K,{className:"py-0",children:[g,x,b]},void 0,!0),e[58]=g,e[59]=x,e[60]=b,e[61]=y):y=e[61];let I;return e[62]!==p||e[63]!==u||e[64]!==y||e[65]!==f||e[66]!==v?(I=(0,r.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-settings",children:[f,v,p,u,y]},void 0,!0),e[62]=p,e[63]=u,e[64]=y,e[65]=f,e[66]=v,e[67]=I):I=e[67],I},"SettingsPanel");function Z(a){return(0,r.jsxDEV)("div",{className:"contents","data-testid":"set-deploy-row",children:[(0,r.jsxDEV)("dt",{className:"text-muted-foreground",children:a.label},void 0,!1),(0,r.jsxDEV)("dd",{className:"truncate font-mono text-xs",title:a.value,children:a.value},void 0,!1)]},a.label,!0)}U(Z,"_temp");function ee(a){return(0,r.jsxDEV)(V,{"data-testid":"set-row",children:[(0,r.jsxDEV)(E,{className:"font-mono text-xs font-medium",children:a.name},void 0,!1),(0,r.jsxDEV)(E,{children:(0,r.jsxDEV)(F,{variant:Y[a.kind],children:a.bindingType??a.kind},void 0,!1)},void 0,!1),(0,r.jsxDEV)(E,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",children:a.value??(0,r.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1)]},a.name,!0)}U(ee,"_temp2");export{me as SettingsPanel};
1
+ import{b as $}from"./chunk-TQ36RWOP.js";import{a as M}from"./chunk-AJIUI7DD.js";import"./chunk-XNJNSCLM.js";import{a as P,b as Q,c as W,d as V,e as C,f as E}from"./chunk-GTM65MVX.js";import{a as j}from"./chunk-BOXSWNXZ.js";import{b as H}from"./chunk-DVKPRFIJ.js";import{a as K,e as O}from"./chunk-SEU5V7I6.js";import{b as F}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as B}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as U,e as L,f as G,g as J,h as X}from"./chunk-RRCPZMC2.js";var q=L(J(),1),te=L(G(),1);var r=L(X(),1);var Y={binding:"outline",secret:"destructive",var:"secondary"},me=U(a=>{let e=(0,q.c)(68),{initialShardKey:z}=a,t=B(),N;e[0]===Symbol.for("react.memo_cache_sentinel")?(N={},e[0]=N):N=e[0];let R=z??"",T;e[1]!==R?(T={shardKey:R},e[1]=R,e[2]=T):T=e[2];let{data:k,error:d,errorSource:S,isLoading:A}=H(j.getSettings,N,T),D;e:{let s=k?.deploy;if(s===void 0){let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=[],e[3]=l):l=e[3],D=l;break e}let o;if(e[4]!==s.deploymentId||e[5]!==s.environment||e[6]!==s.versionTag||e[7]!==s.workerUrl||e[8]!==t){if(o=[],s.workerUrl!==void 0){let l;e[10]!==t?(l=t("URL"),e[10]=t,e[11]=l):l=e[11];let i;e[12]!==s.workerUrl||e[13]!==l?(i={label:l,value:s.workerUrl},e[12]=s.workerUrl,e[13]=l,e[14]=i):i=e[14],o.push(i)}if(s.environment!==void 0){let l;e[15]!==t?(l=t("Environment"),e[15]=t,e[16]=l):l=e[16];let i;e[17]!==s.environment||e[18]!==l?(i={label:l,value:s.environment},e[17]=s.environment,e[18]=l,e[19]=i):i=e[19],o.push(i)}if(s.deploymentId!==void 0){let l;e[20]!==t?(l=t("Deployment"),e[20]=t,e[21]=l):l=e[21];let i;e[22]!==s.deploymentId||e[23]!==l?(i={label:l,value:s.deploymentId},e[22]=s.deploymentId,e[23]=l,e[24]=i):i=e[24],o.push(i)}if(s.versionTag!==void 0){let l;e[25]!==t?(l=t("Version"),e[25]=t,e[26]=l):l=e[26];let i;e[27]!==s.versionTag||e[28]!==l?(i={label:l,value:s.versionTag},e[27]=s.versionTag,e[28]=l,e[29]=i):i=e[29],o.push(i)}e[4]=s.deploymentId,e[5]=s.environment,e[6]=s.versionTag,e[7]=s.workerUrl,e[8]=t,e[9]=o}else o=e[9];D=o}let w=D,_;e[30]!==k?.settings?(_=k?.settings??[],e[30]=k?.settings,e[31]=_):_=e[31];let n=_,m;e[32]!==t?(m=t("Open in Cloudflare"),e[32]=t,e[33]=m):m=e[33];let f;e[34]!==m?(f=(0,r.jsxDEV)("div",{className:"flex flex-wrap items-center gap-3",children:(0,r.jsxDEV)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"set-cf-link",href:$,rel:"noreferrer",target:"_blank",children:m},void 0,!1)},void 0,!1),e[34]=m,e[35]=f):f=e[35];let c;e[36]!==t?(c=t("View-only \u2014 values are masked. Edit vars, secrets, and bindings in wrangler or the Cloudflare dashboard."),e[36]=t,e[37]=c):c=e[37];let v;e[38]!==c?(v=(0,r.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"set-readonly-note",children:c},void 0,!1),e[38]=c,e[39]=v):v=e[39];let p;e[40]!==d||e[41]!==S?(p=d!==null&&(0,r.jsxDEV)(M,{error:S,testId:"set-error"},void 0,!1),e[40]=d,e[41]=S,e[42]=p):p=e[42];let u;e[43]!==w||e[44]!==t?(u=w.length>0&&(0,r.jsxDEV)(K,{className:"py-0","data-testid":"set-deploy",children:[(0,r.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Deployment")},void 0,!1)},void 0,!1),(0,r.jsxDEV)(O,{className:"py-3",children:(0,r.jsxDEV)("dl",{className:"grid grid-cols-[8rem_minmax(0,1fr)] gap-x-4 gap-y-1 text-sm",children:w.map(Z)},void 0,!1)},void 0,!1)]},void 0,!0),e[43]=w,e[44]=t,e[45]=u):u=e[45];let h;e[46]!==t?(h=t("Environment & bindings"),e[46]=t,e[47]=h):h=e[47];let g;e[48]!==h?(g=(0,r.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:h},void 0,!1)},void 0,!1),e[48]=h,e[49]=g):g=e[49];let x;e[50]!==d||e[51]!==A||e[52]!==n.length||e[53]!==t?(x=d===null&&!A&&n.length===0&&(0,r.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"set-empty",children:t("No environment variables or bindings.")},void 0,!1),e[50]=d,e[51]=A,e[52]=n.length,e[53]=t,e[54]=x):x=e[54];let b;e[55]!==n||e[56]!==t?(b=n.length>0&&(0,r.jsxDEV)(O,{className:"px-0 py-0",children:(0,r.jsxDEV)(P,{"data-testid":"set-table",children:[(0,r.jsxDEV)(Q,{children:(0,r.jsxDEV)(V,{children:[(0,r.jsxDEV)(C,{children:t("name")},void 0,!1),(0,r.jsxDEV)(C,{children:t("kind")},void 0,!1),(0,r.jsxDEV)(C,{children:t("value")},void 0,!1)]},void 0,!0)},void 0,!1),(0,r.jsxDEV)(W,{children:n.map(ee)},void 0,!1)]},void 0,!0)},void 0,!1),e[55]=n,e[56]=t,e[57]=b):b=e[57];let y;e[58]!==g||e[59]!==x||e[60]!==b?(y=(0,r.jsxDEV)(K,{className:"py-0",children:[g,x,b]},void 0,!0),e[58]=g,e[59]=x,e[60]=b,e[61]=y):y=e[61];let I;return e[62]!==p||e[63]!==u||e[64]!==y||e[65]!==f||e[66]!==v?(I=(0,r.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-settings",children:[f,v,p,u,y]},void 0,!0),e[62]=p,e[63]=u,e[64]=y,e[65]=f,e[66]=v,e[67]=I):I=e[67],I},"SettingsPanel");function Z(a){return(0,r.jsxDEV)("div",{className:"contents","data-testid":"set-deploy-row",children:[(0,r.jsxDEV)("dt",{className:"text-muted-foreground",children:a.label},void 0,!1),(0,r.jsxDEV)("dd",{className:"truncate font-mono text-xs",title:a.value,children:a.value},void 0,!1)]},a.label,!0)}U(Z,"_temp");function ee(a){return(0,r.jsxDEV)(V,{"data-testid":"set-row",children:[(0,r.jsxDEV)(E,{className:"font-mono text-xs font-medium",children:a.name},void 0,!1),(0,r.jsxDEV)(E,{children:(0,r.jsxDEV)(F,{variant:Y[a.kind],children:a.bindingType??a.kind},void 0,!1)},void 0,!1),(0,r.jsxDEV)(E,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",children:a.value??(0,r.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1)]},a.name,!0)}U(ee,"_temp2");export{me as SettingsPanel};
@@ -1 +1 @@
1
- import{b as de,e as j}from"./chunk-25VHPD2I.js";import{a as ce}from"./chunk-WXPWVBIY.js";import"./chunk-55YA7ZZI.js";import"./chunk-BJGBHGK3.js";import"./chunk-UII66UVF.js";import"./chunk-KEGAWN6Y.js";import{a as ie}from"./chunk-TBMYIZIO.js";import"./chunk-HV7G6DFP.js";import{a as E}from"./chunk-AQGOX5DK.js";import{b as ne}from"./chunk-DVKPRFIJ.js";import{a as S}from"./chunk-SEU5V7I6.js";import{b as A}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as ae,g as le}from"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as D,e as T,f as H,g as Q,k as F,n as oe}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as h,e as k,f as ke,g as re,h as se,j as w}from"./chunk-RRCPZMC2.js";var ve=k(re(),1);var c=k(ke(),1);var ue=k(re(),1);var W=k(se(),1);var Ae={connected:"bg-success",connecting:"bg-warning",idle:"bg-muted-foreground",offline:"bg-destructive"},fe=h(()=>{let t=(0,ue.c)(16),e=D(),a=le(),s;e:switch(a){case"connected":{let n;t[0]!==e?(n=e("Connected"),t[0]=e,t[1]=n):n=t[1],s=n;break e}case"connecting":{let n;t[2]!==e?(n=e("Connecting\u2026"),t[2]=e,t[3]=n):n=t[3],s=n;break e}case"idle":{let n;t[4]!==e?(n=e("Idle"),t[4]=e,t[5]=n):n=t[5],s=n;break e}case"offline":{let n;t[6]!==e?(n=e("Offline"),t[6]=e,t[7]=n):n=t[7],s=n;break e}default:s=a}let l=Ae[a],d;t[8]!==l?(d=w("size-2 rounded-full",l),t[8]=l,t[9]=d):d=t[9];let u;t[10]!==d?(u=(0,W.jsxDEV)("span",{"aria-hidden":"true",className:d},void 0,!1),t[10]=d,t[11]=u):u=t[11];let i;return t[12]!==a||t[13]!==u||t[14]!==s?(i=(0,W.jsxDEV)("span",{"aria-live":"polite",className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground","data-status":a,"data-testid":"dash-connection",role:"status",children:[u,s]},void 0,!0),t[12]=a,t[13]=u,t[14]=s,t[15]=i):i=t[15],i},"ConnectionBadge");var r=k(se(),1);var me={completed:0,failed:2,in_progress:1},Re=h(t=>{let e=0,a=0,s=0,l=0,d=[];for(let{metrics:u}of t){if(u===null){l+=1;continue}s+=1,e+=u.requests,a+=u.errors,d.push(...u.history??[])}return{errors:a,failed:l,history:d,reachable:s,requests:e}},"sumShardMetrics"),Me=h(t=>{let e=new Map;for(let a of t)for(let s of a){let l=e.get(s.path);if(l===void 0){e.set(s.path,{...s});continue}l.calls+=s.calls,l.errors+=s.errors,l.totalDurationMs+=s.totalDurationMs,l.scans=(l.scans??0)+(s.scans??0),l.maxDurationMs=Math.max(l.maxDurationMs,s.maxDurationMs),l.lastCalledAt=Math.max(l.lastCalledAt,s.lastCalledAt),(s.lastErrorAt??0)>(l.lastErrorAt??0)&&(l.lastErrorAt=s.lastErrorAt,l.lastErrorMessage=s.lastErrorMessage)}return[...e.values()]},"mergeFunctionStats"),_e=h(t=>{let e=new Map;for(let a of t)for(let s of a){let l=e.get(s.id);if(l===void 0){e.set(s.id,s);continue}let d=me[s.status]-me[l.status];(d>0||d===0&&(s.updatedAt??0)>(l.updatedAt??0))&&e.set(s.id,s)}return[...e.values()]},"dedupeMigrations"),Ie=T(E.getAuthMetrics),Le=T(E.getFunctionStats),Ce=T(E.getLogs),Oe=T(E.getMetrics),qe=T(E.migrationStatus),De=5,he=2e3,Fe=5,pe=.01,ge=.05,je=.1,Ue=.3,Pe=1,Ge=50,X=h((t,e,a)=>t>=a?"crit":t>=e?"warn":"ok","rateLevel"),Ve=h((t,e,a)=>t>=a?"crit":t>=e?"warn":"ok","countLevel"),Be={crit:"destructive",ok:"secondary",warn:"default"},U=h((t,e)=>e===0?"\u2014":`${(t/e*100).toFixed(1)}%`,"ratePercent"),Ke=h(t=>{let e=new Map;for(let s of t??[]){let l=e.get(s.bucketMs)??{calls:0,errors:0};l.calls+=s.calls,l.errors+=s.errors,e.set(s.bucketMs,l)}let a=[...e.entries()].toSorted((s,l)=>s[0]-l[0]);return{errors:a.map(([,s])=>s.errors),requests:a.map(([,s])=>s.calls)}},"requestErrorSeries"),$e=h(t=>{let e=0,a=0;for(let l of t)l.status==="failed"?e+=1:l.status==="in_progress"&&(a+=1);let s="ok";return e>0?s="crit":a>0&&(s="warn"),{failed:e,level:s,running:a}},"migrationSummary"),ze=h((t,e)=>t.failed>0?e("{count} failed",{count:t.failed.toString()}):t.running>0?e("{count} running",{count:t.running.toString()}):e("OK"),"migrationTileValue"),xe={crit:"bg-destructive",ok:"bg-success",warn:"bg-warning"},Ne={crit:"text-destructive",ok:"text-foreground",warn:"text-warning"},He={crit:"bg-destructive/10 text-destructive",ok:"bg-success/10 text-success",warn:"bg-warning/10 text-warning"},Qe=h(t=>t.includes("crit")?"crit":t.includes("warn")?"warn":"ok","worstLevel"),P=h(t=>{let e=(0,ve.c)(19),{chart:a,label:s,level:l,testId:d,value:u}=t,i=xe[l],n;e[0]!==i?(n=w("size-1.5 shrink-0 rounded-full",i),e[0]=i,e[1]=n):n=e[1];let p;e[2]!==n?(p=(0,r.jsxDEV)("span",{"aria-hidden":"true",className:n},void 0,!1),e[2]=n,e[3]=p):p=e[3];let g;e[4]!==s||e[5]!==p?(g=(0,r.jsxDEV)("span",{className:"flex items-center gap-1.5 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:[p,s]},void 0,!0),e[4]=s,e[5]=p,e[6]=g):g=e[6];let b=Ne[l],m;e[7]!==b?(m=w("truncate text-2xl font-semibold tabular-nums",b),e[7]=b,e[8]=m):m=e[8];let f;e[9]!==m||e[10]!==d||e[11]!==u?(f=(0,r.jsxDEV)("span",{className:m,"data-testid":d,children:u},void 0,!1),e[9]=m,e[10]=d,e[11]=u,e[12]=f):f=e[12];let v;e[13]!==a||e[14]!==f?(v=(0,r.jsxDEV)("div",{className:"flex items-center justify-between gap-3",children:[f,a]},void 0,!0),e[13]=a,e[14]=f,e[15]=v):v=e[15];let x;return e[16]!==g||e[17]!==v?(x=(0,r.jsxDEV)(S,{className:"gap-0 py-0",children:(0,r.jsxDEV)("div",{className:"flex flex-col gap-2.5 p-4",children:[g,v]},void 0,!0)},void 0,!1),e[16]=g,e[17]=v,e[18]=x):x=e[18],x},"SloCard"),We=h(async(t,e,a)=>{let s=await Promise.all(a.map(m=>{let f=H(m);return Promise.allSettled([t.query(Oe,{},f),t.query(Le,{},f),t.query(qe,{},f)])})),l=H(e),d=typeof t.schedulerStatus=="function"?t.schedulerStatus():Promise.reject(new Error("scheduler status unavailable")),[u,i,n]=await Promise.allSettled([t.query(Ce,{},l),t.query(Ie,{},l),d]),p=s.map(([m,f,v])=>({functions:f.status==="fulfilled"?f.value.functions:[],metrics:m.status==="fulfilled"?m.value:null,migrations:v.status==="fulfilled"?v.value.migrations:[]})),g=Re(p),b=s[0]?.[0];return{auth:i.status==="fulfilled"?i.value:null,entries:u.status==="fulfilled"?u.value.entries:[],functions:Me(p.map(m=>m.functions)),logsError:u.status==="rejected"?Q(u.reason):null,metricsError:g.reachable===0&&b?.status==="rejected"?Q(b.reason):null,migrations:_e(p.map(m=>m.migrations)),scheduler:n.status==="fulfilled"?n.value:null,totals:g}},"loadSloData"),ht=h(({initialShardKey:t})=>{let e=ae(),a=D(),[s,l]=(0,c.useState)([]),[d,u]=(0,c.useState)(null),[i,n]=(0,c.useState)(null),[p,g]=(0,c.useState)(null),[b,m]=(0,c.useState)([]),[f,v]=(0,c.useState)(null),[x,be]=(0,c.useState)(null),[we,Ee]=(0,c.useState)([]),[y]=(0,c.useState)(ie),R=(0,c.useRef)(!1),G=(0,c.useRef)(!0);(0,c.useEffect)(()=>(G.current=!0,()=>{G.current=!1}),[]);let M=t??"",_=(0,c.useCallback)(async()=>{if(R.current)return;R.current=!0;let o=await We(e,M,de(M,y));if(!G.current){R.current=!1;return}n(o.totals),g(o.metricsError),m(o.functions),Ee(o.migrations),l(o.entries),u(o.logsError),v(o.auth),be(o.scheduler),R.current=!1},[e,y,M]);(0,c.useEffect)(()=>{F(_())},[_]);let V=(0,c.useRef)(0),I=(0,c.useRef)(null),Se=h(()=>{let o=Date.now()-V.current;if(o>=he){V.current=Date.now(),F(_());return}I.current??=setTimeout(()=>{I.current=null,V.current=Date.now(),F(_())},he-o)},"scheduleFanOut");(0,c.useEffect)(()=>()=>{I.current!==null&&clearTimeout(I.current)},[]);let{data:J,liveError:Te}=ne(E.getMetrics,{},{live:!0,shardKey:M});(0,c.useEffect)(()=>{J!==void 0&&Se()},[J]);let B=s.filter(o=>o.level==="error"),K=B.slice(0,De),L=Ke(i?.history),Y=(0,c.useMemo)(()=>{let o=f?.history??[];return{attempts:o.map(N=>N.attempts),failures:o.map(N=>N.failures)}},[f?.history]),Z=b.filter(o=>o.calls>0).toSorted((o,N)=>N.errors/N.calls-o.errors/o.calls||N.calls-o.calls).slice(0,Fe),$=$e(we),ye=i===null||i.requests===0?0:i.errors/i.requests,z=X(ye,pe,ge),ee=f===null?"ok":X(f.failureRate,je,Ue),te=x===null?"ok":Ve(x.backlog,Pe,Ge),C=Qe([z,ee,te,$.level]),O,q;return C==="crit"?(O=a("Critical"),q=a("One or more service levels are breached.")):C==="warn"?(O=a("Degraded"),q=a("Some service levels need attention.")):(O=a("All systems healthy"),q=a("All service levels are within target.")),(0,r.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-health",children:[(0,r.jsxDEV)(S,{className:"gap-0 py-0",children:[(0,r.jsxDEV)("div",{className:"flex flex-wrap items-center justify-between gap-4 p-4",children:[(0,r.jsxDEV)("div",{className:"flex items-center gap-3",children:[(0,r.jsxDEV)("span",{"aria-hidden":"true",className:w("flex size-10 shrink-0 items-center justify-center rounded-full",He[C]),children:(0,r.jsxDEV)("span",{className:w("size-3 rounded-full",xe[C])},void 0,!1)},void 0,!1),(0,r.jsxDEV)("div",{className:"grid leading-tight",children:[(0,r.jsxDEV)("span",{className:"text-sm font-semibold text-foreground","data-testid":"hl-status",children:O},void 0,!1),(0,r.jsxDEV)("span",{className:"text-[13px] text-muted-foreground",children:q},void 0,!1)]},void 0,!0)]},void 0,!0),(0,r.jsxDEV)("div",{className:"flex flex-wrap items-center gap-4",children:[(0,r.jsxDEV)("div",{className:"text-end",children:[(0,r.jsxDEV)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:a("Requests")},void 0,!1),(0,r.jsxDEV)("div",{className:"flex items-center justify-end gap-2",children:[L.requests.length>=2&&(0,r.jsxDEV)(j,{ariaLabel:a("Requests over time"),className:"h-6 w-20 text-foreground",series:L.requests,testId:"hl-spark-requests"},void 0,!1),(0,r.jsxDEV)("span",{className:"text-lg font-semibold tabular-nums text-foreground","data-testid":"hl-requests",children:(i?.requests??0).toString()},void 0,!1)]},void 0,!0)]},void 0,!0),(0,r.jsxDEV)("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"},void 0,!1),(0,r.jsxDEV)("div",{className:"text-end",children:[(0,r.jsxDEV)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:a("Error rate")},void 0,!1),(0,r.jsxDEV)("div",{className:w("text-lg font-semibold tabular-nums",Ne[z]),"data-testid":"hl-error-rate",children:i===null?"\u2014":U(i.errors,i.requests)},void 0,!1)]},void 0,!0),(0,r.jsxDEV)("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"},void 0,!1),(0,r.jsxDEV)("div",{className:"flex items-center gap-2",children:[(0,r.jsxDEV)(fe,{},void 0,!1),(0,r.jsxDEV)(ce,{message:Te,prefix:"hl"},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0),p!==null&&(0,r.jsxDEV)("div",{className:"border-t border-border bg-destructive/5 px-4 py-2 text-sm text-destructive","data-testid":"hl-metrics-error",role:"alert",children:p},void 0,!1)]},void 0,!0),(0,r.jsxDEV)("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4","data-testid":"hl-slo",children:[(0,r.jsxDEV)(P,{chart:L.errors.length>=2?(0,r.jsxDEV)(j,{ariaLabel:a("Errors over time"),className:"h-7 w-20 text-destructive",series:L.errors,testId:"hl-spark-errors"},void 0,!1):void 0,label:a("Error rate"),level:z,testId:"hl-slo-errorrate",value:i===null?"\u2014":U(i.errors,i.requests)},void 0,!1),(0,r.jsxDEV)(P,{chart:Y.failures.length>=2?(0,r.jsxDEV)(j,{ariaLabel:a("Auth failures over time"),className:"h-7 w-20 text-destructive",series:Y.failures,testId:"hl-spark-auth"},void 0,!1):void 0,label:a("Auth failures"),level:ee,testId:"hl-slo-auth",value:f===null?"\u2014":U(f.failures,f.attempts)},void 0,!1),(0,r.jsxDEV)(P,{label:a("Scheduler backlog"),level:te,testId:"hl-slo-backlog",value:x===null?"\u2014":x.backlog.toString()},void 0,!1),(0,r.jsxDEV)(P,{label:a("Migrations"),level:$.level,testId:"hl-slo-migrations",value:ze($,a)},void 0,!1)]},void 0,!0),(0,r.jsxDEV)("div",{className:"grid gap-3 lg:grid-cols-2",children:[(0,r.jsxDEV)(S,{className:"gap-0 py-0","data-testid":"hl-functions",children:[(0,r.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Functions by error rate")},void 0,!1)},void 0,!1),Z.length===0?(0,r.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-functions-empty",children:a("No function activity yet.")},void 0,!1):(0,r.jsxDEV)("ul",{className:"divide-y divide-border",children:Z.map(o=>(0,r.jsxDEV)("li",{className:"flex flex-wrap items-center justify-between gap-2 px-4 py-2 text-xs","data-testid":"hl-fn-row",children:[(0,r.jsxDEV)("span",{className:"truncate font-mono text-foreground",children:o.path},void 0,!1),(0,r.jsxDEV)("span",{className:"flex shrink-0 items-center gap-2",children:[(0,r.jsxDEV)("span",{className:"tabular-nums text-muted-foreground",children:a("{count} calls",{count:o.calls.toString()})},void 0,!1),(0,r.jsxDEV)(A,{variant:Be[X(o.errors/o.calls,pe,ge)],children:U(o.errors,o.calls)},void 0,!1)]},void 0,!0)]},o.path,!0))},void 0,!1)]},void 0,!0),(0,r.jsxDEV)(S,{className:"gap-0 py-0",children:[(0,r.jsxDEV)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[(0,r.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Recent errors")},void 0,!1),(0,r.jsxDEV)(A,{"data-testid":"hl-error-count",variant:B.length>0?"destructive":"outline",children:B.length},void 0,!1)]},void 0,!0),d!==null&&(0,r.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"hl-logs-error",role:"alert",children:d},void 0,!1),d===null&&K.length===0&&(0,r.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-errors-empty",children:a("No recent errors.")},void 0,!1),K.length>0&&(0,r.jsxDEV)("ul",{className:"divide-y divide-border",children:K.map((o,N)=>(0,r.jsxDEV)("li",{className:"flex flex-col gap-0.5 px-4 py-2 text-xs","data-testid":"hl-error-row",children:[(0,r.jsxDEV)("span",{className:"flex items-center gap-2",children:[(0,r.jsxDEV)("time",{className:"shrink-0 text-muted-foreground",children:oe(o.timestamp)},void 0,!1),o.functionPath!==void 0&&(0,r.jsxDEV)("span",{className:"truncate font-mono text-foreground",children:o.functionPath},void 0,!1)]},void 0,!0),(0,r.jsxDEV)("span",{className:"text-destructive",children:o.message},void 0,!1)]},`${o.timestamp.toString()}-${N.toString()}`,!0))},void 0,!1)]},void 0,!0)]},void 0,!0),(0,r.jsxDEV)(S,{className:"gap-0 py-0",children:[(0,r.jsxDEV)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[(0,r.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Shards seen")},void 0,!1),(0,r.jsxDEV)(A,{"data-testid":"hl-shard-count",variant:"outline",children:y.length},void 0,!1)]},void 0,!0),y.length>0&&(0,r.jsxDEV)("ul",{className:"flex flex-wrap gap-1.5 p-4",children:y.map(o=>(0,r.jsxDEV)("li",{"data-testid":"hl-shard",children:(0,r.jsxDEV)(A,{variant:"secondary",children:o},void 0,!1)},o,!1))},void 0,!1)]},void 0,!0)]},void 0,!0)},"HealthPanel");export{ht as HealthPanel};
1
+ import{b as de,e as j}from"./chunk-25VHPD2I.js";import{a as ce}from"./chunk-WXPWVBIY.js";import"./chunk-55YA7ZZI.js";import"./chunk-BJGBHGK3.js";import"./chunk-UII66UVF.js";import"./chunk-KEGAWN6Y.js";import{a as ie}from"./chunk-TBMYIZIO.js";import"./chunk-HV7G6DFP.js";import{a as E}from"./chunk-BOXSWNXZ.js";import{b as ne}from"./chunk-DVKPRFIJ.js";import{a as S}from"./chunk-SEU5V7I6.js";import{b as A}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as ae,g as le}from"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as D,e as T,f as H,g as Q,k as F,n as oe}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as h,e as k,f as ke,g as re,h as se,j as w}from"./chunk-RRCPZMC2.js";var ve=k(re(),1);var c=k(ke(),1);var ue=k(re(),1);var W=k(se(),1);var Ae={connected:"bg-success",connecting:"bg-warning",idle:"bg-muted-foreground",offline:"bg-destructive"},fe=h(()=>{let t=(0,ue.c)(16),e=D(),a=le(),s;e:switch(a){case"connected":{let n;t[0]!==e?(n=e("Connected"),t[0]=e,t[1]=n):n=t[1],s=n;break e}case"connecting":{let n;t[2]!==e?(n=e("Connecting\u2026"),t[2]=e,t[3]=n):n=t[3],s=n;break e}case"idle":{let n;t[4]!==e?(n=e("Idle"),t[4]=e,t[5]=n):n=t[5],s=n;break e}case"offline":{let n;t[6]!==e?(n=e("Offline"),t[6]=e,t[7]=n):n=t[7],s=n;break e}default:s=a}let l=Ae[a],d;t[8]!==l?(d=w("size-2 rounded-full",l),t[8]=l,t[9]=d):d=t[9];let u;t[10]!==d?(u=(0,W.jsxDEV)("span",{"aria-hidden":"true",className:d},void 0,!1),t[10]=d,t[11]=u):u=t[11];let i;return t[12]!==a||t[13]!==u||t[14]!==s?(i=(0,W.jsxDEV)("span",{"aria-live":"polite",className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground","data-status":a,"data-testid":"dash-connection",role:"status",children:[u,s]},void 0,!0),t[12]=a,t[13]=u,t[14]=s,t[15]=i):i=t[15],i},"ConnectionBadge");var r=k(se(),1);var me={completed:0,failed:2,in_progress:1},Re=h(t=>{let e=0,a=0,s=0,l=0,d=[];for(let{metrics:u}of t){if(u===null){l+=1;continue}s+=1,e+=u.requests,a+=u.errors,d.push(...u.history??[])}return{errors:a,failed:l,history:d,reachable:s,requests:e}},"sumShardMetrics"),Me=h(t=>{let e=new Map;for(let a of t)for(let s of a){let l=e.get(s.path);if(l===void 0){e.set(s.path,{...s});continue}l.calls+=s.calls,l.errors+=s.errors,l.totalDurationMs+=s.totalDurationMs,l.scans=(l.scans??0)+(s.scans??0),l.maxDurationMs=Math.max(l.maxDurationMs,s.maxDurationMs),l.lastCalledAt=Math.max(l.lastCalledAt,s.lastCalledAt),(s.lastErrorAt??0)>(l.lastErrorAt??0)&&(l.lastErrorAt=s.lastErrorAt,l.lastErrorMessage=s.lastErrorMessage)}return[...e.values()]},"mergeFunctionStats"),_e=h(t=>{let e=new Map;for(let a of t)for(let s of a){let l=e.get(s.id);if(l===void 0){e.set(s.id,s);continue}let d=me[s.status]-me[l.status];(d>0||d===0&&(s.updatedAt??0)>(l.updatedAt??0))&&e.set(s.id,s)}return[...e.values()]},"dedupeMigrations"),Ie=T(E.getAuthMetrics),Le=T(E.getFunctionStats),Ce=T(E.getLogs),Oe=T(E.getMetrics),qe=T(E.migrationStatus),De=5,he=2e3,Fe=5,pe=.01,ge=.05,je=.1,Ue=.3,Pe=1,Ge=50,X=h((t,e,a)=>t>=a?"crit":t>=e?"warn":"ok","rateLevel"),Ve=h((t,e,a)=>t>=a?"crit":t>=e?"warn":"ok","countLevel"),Be={crit:"destructive",ok:"secondary",warn:"default"},U=h((t,e)=>e===0?"\u2014":`${(t/e*100).toFixed(1)}%`,"ratePercent"),Ke=h(t=>{let e=new Map;for(let s of t??[]){let l=e.get(s.bucketMs)??{calls:0,errors:0};l.calls+=s.calls,l.errors+=s.errors,e.set(s.bucketMs,l)}let a=[...e.entries()].toSorted((s,l)=>s[0]-l[0]);return{errors:a.map(([,s])=>s.errors),requests:a.map(([,s])=>s.calls)}},"requestErrorSeries"),$e=h(t=>{let e=0,a=0;for(let l of t)l.status==="failed"?e+=1:l.status==="in_progress"&&(a+=1);let s="ok";return e>0?s="crit":a>0&&(s="warn"),{failed:e,level:s,running:a}},"migrationSummary"),ze=h((t,e)=>t.failed>0?e("{count} failed",{count:t.failed.toString()}):t.running>0?e("{count} running",{count:t.running.toString()}):e("OK"),"migrationTileValue"),xe={crit:"bg-destructive",ok:"bg-success",warn:"bg-warning"},Ne={crit:"text-destructive",ok:"text-foreground",warn:"text-warning"},He={crit:"bg-destructive/10 text-destructive",ok:"bg-success/10 text-success",warn:"bg-warning/10 text-warning"},Qe=h(t=>t.includes("crit")?"crit":t.includes("warn")?"warn":"ok","worstLevel"),P=h(t=>{let e=(0,ve.c)(19),{chart:a,label:s,level:l,testId:d,value:u}=t,i=xe[l],n;e[0]!==i?(n=w("size-1.5 shrink-0 rounded-full",i),e[0]=i,e[1]=n):n=e[1];let p;e[2]!==n?(p=(0,r.jsxDEV)("span",{"aria-hidden":"true",className:n},void 0,!1),e[2]=n,e[3]=p):p=e[3];let g;e[4]!==s||e[5]!==p?(g=(0,r.jsxDEV)("span",{className:"flex items-center gap-1.5 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:[p,s]},void 0,!0),e[4]=s,e[5]=p,e[6]=g):g=e[6];let b=Ne[l],m;e[7]!==b?(m=w("truncate text-2xl font-semibold tabular-nums",b),e[7]=b,e[8]=m):m=e[8];let f;e[9]!==m||e[10]!==d||e[11]!==u?(f=(0,r.jsxDEV)("span",{className:m,"data-testid":d,children:u},void 0,!1),e[9]=m,e[10]=d,e[11]=u,e[12]=f):f=e[12];let v;e[13]!==a||e[14]!==f?(v=(0,r.jsxDEV)("div",{className:"flex items-center justify-between gap-3",children:[f,a]},void 0,!0),e[13]=a,e[14]=f,e[15]=v):v=e[15];let x;return e[16]!==g||e[17]!==v?(x=(0,r.jsxDEV)(S,{className:"gap-0 py-0",children:(0,r.jsxDEV)("div",{className:"flex flex-col gap-2.5 p-4",children:[g,v]},void 0,!0)},void 0,!1),e[16]=g,e[17]=v,e[18]=x):x=e[18],x},"SloCard"),We=h(async(t,e,a)=>{let s=await Promise.all(a.map(m=>{let f=H(m);return Promise.allSettled([t.query(Oe,{},f),t.query(Le,{},f),t.query(qe,{},f)])})),l=H(e),d=typeof t.schedulerStatus=="function"?t.schedulerStatus():Promise.reject(new Error("scheduler status unavailable")),[u,i,n]=await Promise.allSettled([t.query(Ce,{},l),t.query(Ie,{},l),d]),p=s.map(([m,f,v])=>({functions:f.status==="fulfilled"?f.value.functions:[],metrics:m.status==="fulfilled"?m.value:null,migrations:v.status==="fulfilled"?v.value.migrations:[]})),g=Re(p),b=s[0]?.[0];return{auth:i.status==="fulfilled"?i.value:null,entries:u.status==="fulfilled"?u.value.entries:[],functions:Me(p.map(m=>m.functions)),logsError:u.status==="rejected"?Q(u.reason):null,metricsError:g.reachable===0&&b?.status==="rejected"?Q(b.reason):null,migrations:_e(p.map(m=>m.migrations)),scheduler:n.status==="fulfilled"?n.value:null,totals:g}},"loadSloData"),ht=h(({initialShardKey:t})=>{let e=ae(),a=D(),[s,l]=(0,c.useState)([]),[d,u]=(0,c.useState)(null),[i,n]=(0,c.useState)(null),[p,g]=(0,c.useState)(null),[b,m]=(0,c.useState)([]),[f,v]=(0,c.useState)(null),[x,be]=(0,c.useState)(null),[we,Ee]=(0,c.useState)([]),[y]=(0,c.useState)(ie),R=(0,c.useRef)(!1),G=(0,c.useRef)(!0);(0,c.useEffect)(()=>(G.current=!0,()=>{G.current=!1}),[]);let M=t??"",_=(0,c.useCallback)(async()=>{if(R.current)return;R.current=!0;let o=await We(e,M,de(M,y));if(!G.current){R.current=!1;return}n(o.totals),g(o.metricsError),m(o.functions),Ee(o.migrations),l(o.entries),u(o.logsError),v(o.auth),be(o.scheduler),R.current=!1},[e,y,M]);(0,c.useEffect)(()=>{F(_())},[_]);let V=(0,c.useRef)(0),I=(0,c.useRef)(null),Se=h(()=>{let o=Date.now()-V.current;if(o>=he){V.current=Date.now(),F(_());return}I.current??=setTimeout(()=>{I.current=null,V.current=Date.now(),F(_())},he-o)},"scheduleFanOut");(0,c.useEffect)(()=>()=>{I.current!==null&&clearTimeout(I.current)},[]);let{data:J,liveError:Te}=ne(E.getMetrics,{},{live:!0,shardKey:M});(0,c.useEffect)(()=>{J!==void 0&&Se()},[J]);let B=s.filter(o=>o.level==="error"),K=B.slice(0,De),L=Ke(i?.history),Y=(0,c.useMemo)(()=>{let o=f?.history??[];return{attempts:o.map(N=>N.attempts),failures:o.map(N=>N.failures)}},[f?.history]),Z=b.filter(o=>o.calls>0).toSorted((o,N)=>N.errors/N.calls-o.errors/o.calls||N.calls-o.calls).slice(0,Fe),$=$e(we),ye=i===null||i.requests===0?0:i.errors/i.requests,z=X(ye,pe,ge),ee=f===null?"ok":X(f.failureRate,je,Ue),te=x===null?"ok":Ve(x.backlog,Pe,Ge),C=Qe([z,ee,te,$.level]),O,q;return C==="crit"?(O=a("Critical"),q=a("One or more service levels are breached.")):C==="warn"?(O=a("Degraded"),q=a("Some service levels need attention.")):(O=a("All systems healthy"),q=a("All service levels are within target.")),(0,r.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-health",children:[(0,r.jsxDEV)(S,{className:"gap-0 py-0",children:[(0,r.jsxDEV)("div",{className:"flex flex-wrap items-center justify-between gap-4 p-4",children:[(0,r.jsxDEV)("div",{className:"flex items-center gap-3",children:[(0,r.jsxDEV)("span",{"aria-hidden":"true",className:w("flex size-10 shrink-0 items-center justify-center rounded-full",He[C]),children:(0,r.jsxDEV)("span",{className:w("size-3 rounded-full",xe[C])},void 0,!1)},void 0,!1),(0,r.jsxDEV)("div",{className:"grid leading-tight",children:[(0,r.jsxDEV)("span",{className:"text-sm font-semibold text-foreground","data-testid":"hl-status",children:O},void 0,!1),(0,r.jsxDEV)("span",{className:"text-[13px] text-muted-foreground",children:q},void 0,!1)]},void 0,!0)]},void 0,!0),(0,r.jsxDEV)("div",{className:"flex flex-wrap items-center gap-4",children:[(0,r.jsxDEV)("div",{className:"text-end",children:[(0,r.jsxDEV)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:a("Requests")},void 0,!1),(0,r.jsxDEV)("div",{className:"flex items-center justify-end gap-2",children:[L.requests.length>=2&&(0,r.jsxDEV)(j,{ariaLabel:a("Requests over time"),className:"h-6 w-20 text-foreground",series:L.requests,testId:"hl-spark-requests"},void 0,!1),(0,r.jsxDEV)("span",{className:"text-lg font-semibold tabular-nums text-foreground","data-testid":"hl-requests",children:(i?.requests??0).toString()},void 0,!1)]},void 0,!0)]},void 0,!0),(0,r.jsxDEV)("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"},void 0,!1),(0,r.jsxDEV)("div",{className:"text-end",children:[(0,r.jsxDEV)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:a("Error rate")},void 0,!1),(0,r.jsxDEV)("div",{className:w("text-lg font-semibold tabular-nums",Ne[z]),"data-testid":"hl-error-rate",children:i===null?"\u2014":U(i.errors,i.requests)},void 0,!1)]},void 0,!0),(0,r.jsxDEV)("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"},void 0,!1),(0,r.jsxDEV)("div",{className:"flex items-center gap-2",children:[(0,r.jsxDEV)(fe,{},void 0,!1),(0,r.jsxDEV)(ce,{message:Te,prefix:"hl"},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0),p!==null&&(0,r.jsxDEV)("div",{className:"border-t border-border bg-destructive/5 px-4 py-2 text-sm text-destructive","data-testid":"hl-metrics-error",role:"alert",children:p},void 0,!1)]},void 0,!0),(0,r.jsxDEV)("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4","data-testid":"hl-slo",children:[(0,r.jsxDEV)(P,{chart:L.errors.length>=2?(0,r.jsxDEV)(j,{ariaLabel:a("Errors over time"),className:"h-7 w-20 text-destructive",series:L.errors,testId:"hl-spark-errors"},void 0,!1):void 0,label:a("Error rate"),level:z,testId:"hl-slo-errorrate",value:i===null?"\u2014":U(i.errors,i.requests)},void 0,!1),(0,r.jsxDEV)(P,{chart:Y.failures.length>=2?(0,r.jsxDEV)(j,{ariaLabel:a("Auth failures over time"),className:"h-7 w-20 text-destructive",series:Y.failures,testId:"hl-spark-auth"},void 0,!1):void 0,label:a("Auth failures"),level:ee,testId:"hl-slo-auth",value:f===null?"\u2014":U(f.failures,f.attempts)},void 0,!1),(0,r.jsxDEV)(P,{label:a("Scheduler backlog"),level:te,testId:"hl-slo-backlog",value:x===null?"\u2014":x.backlog.toString()},void 0,!1),(0,r.jsxDEV)(P,{label:a("Migrations"),level:$.level,testId:"hl-slo-migrations",value:ze($,a)},void 0,!1)]},void 0,!0),(0,r.jsxDEV)("div",{className:"grid gap-3 lg:grid-cols-2",children:[(0,r.jsxDEV)(S,{className:"gap-0 py-0","data-testid":"hl-functions",children:[(0,r.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Functions by error rate")},void 0,!1)},void 0,!1),Z.length===0?(0,r.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-functions-empty",children:a("No function activity yet.")},void 0,!1):(0,r.jsxDEV)("ul",{className:"divide-y divide-border",children:Z.map(o=>(0,r.jsxDEV)("li",{className:"flex flex-wrap items-center justify-between gap-2 px-4 py-2 text-xs","data-testid":"hl-fn-row",children:[(0,r.jsxDEV)("span",{className:"truncate font-mono text-foreground",children:o.path},void 0,!1),(0,r.jsxDEV)("span",{className:"flex shrink-0 items-center gap-2",children:[(0,r.jsxDEV)("span",{className:"tabular-nums text-muted-foreground",children:a("{count} calls",{count:o.calls.toString()})},void 0,!1),(0,r.jsxDEV)(A,{variant:Be[X(o.errors/o.calls,pe,ge)],children:U(o.errors,o.calls)},void 0,!1)]},void 0,!0)]},o.path,!0))},void 0,!1)]},void 0,!0),(0,r.jsxDEV)(S,{className:"gap-0 py-0",children:[(0,r.jsxDEV)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[(0,r.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Recent errors")},void 0,!1),(0,r.jsxDEV)(A,{"data-testid":"hl-error-count",variant:B.length>0?"destructive":"outline",children:B.length},void 0,!1)]},void 0,!0),d!==null&&(0,r.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"hl-logs-error",role:"alert",children:d},void 0,!1),d===null&&K.length===0&&(0,r.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-errors-empty",children:a("No recent errors.")},void 0,!1),K.length>0&&(0,r.jsxDEV)("ul",{className:"divide-y divide-border",children:K.map((o,N)=>(0,r.jsxDEV)("li",{className:"flex flex-col gap-0.5 px-4 py-2 text-xs","data-testid":"hl-error-row",children:[(0,r.jsxDEV)("span",{className:"flex items-center gap-2",children:[(0,r.jsxDEV)("time",{className:"shrink-0 text-muted-foreground",children:oe(o.timestamp)},void 0,!1),o.functionPath!==void 0&&(0,r.jsxDEV)("span",{className:"truncate font-mono text-foreground",children:o.functionPath},void 0,!1)]},void 0,!0),(0,r.jsxDEV)("span",{className:"text-destructive",children:o.message},void 0,!1)]},`${o.timestamp.toString()}-${N.toString()}`,!0))},void 0,!1)]},void 0,!0)]},void 0,!0),(0,r.jsxDEV)(S,{className:"gap-0 py-0",children:[(0,r.jsxDEV)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[(0,r.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Shards seen")},void 0,!1),(0,r.jsxDEV)(A,{"data-testid":"hl-shard-count",variant:"outline",children:y.length},void 0,!1)]},void 0,!0),y.length>0&&(0,r.jsxDEV)("ul",{className:"flex flex-wrap gap-1.5 p-4",children:y.map(o=>(0,r.jsxDEV)("li",{"data-testid":"hl-shard",children:(0,r.jsxDEV)(A,{variant:"secondary",children:o},void 0,!1)},o,!1))},void 0,!1)]},void 0,!0)]},void 0,!0)},"HealthPanel");export{ht as HealthPanel};
@@ -1,4 +1,4 @@
1
- import{b as De}from"./chunk-7VF3IAAW.js";import"./chunk-PN5NCZDX.js";import{a as pe}from"./chunk-BACPICH6.js";import"./chunk-QBAT52GB.js";import{c as Re}from"./chunk-TQ36RWOP.js";import"./chunk-QAFAJBAW.js";import"./chunk-AHILM3ZP.js";import{a as Fe}from"./chunk-J6J54MBP.js";import"./chunk-764T6X6X.js";import"./chunk-XUGSA2NG.js";import"./chunk-5OIBXYZM.js";import{a as $e}from"./chunk-TDL7NEWA.js";import"./chunk-KEGAWN6Y.js";import{a as Te,b as _e,c as Ee,d as ie,e as te,f as Q}from"./chunk-GTM65MVX.js";import"./chunk-4QHKBC77.js";import{a as Ne}from"./chunk-K3GNLVYK.js";import"./chunk-TBMYIZIO.js";import{R as Se}from"./chunk-3CJW6NWG.js";import{c as ee}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as ge}from"./chunk-AQGOX5DK.js";import{a as fe}from"./chunk-TAD43CG5.js";import{a as we,e as Ce}from"./chunk-SEU5V7I6.js";import{b as oe}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as xe}from"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as ke,e as ue,f as he,g as J,k as H,m as me}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as g,e as de,f as ft,g as ut,h as ht}from"./chunk-RRCPZMC2.js";var j=de(ut(),1),_=de(ft(),1);var l=de(ht(),1);var Be=g((a,e,s)=>{let t=(0,j.c)(21),{onCopy:r,onDelete:o,onDownload:u,onToggleSelect:c}=s,n;t[0]!==a.key||t[1]!==r?(n=g(()=>{r(a.key)},"t0"),t[0]=a.key,t[1]=r,t[2]=n):n=t[2];let d=n,h;t[3]!==a.key||t[4]!==u?(h=g(()=>{u(a.key)},"t1"),t[3]=a.key,t[4]=u,t[5]=h):h=t[5];let f=h,m;t[6]!==a.key||t[7]!==o?(m=g(()=>{o(a.key)},"t2"),t[6]=a.key,t[7]=o,t[8]=m):m=t[8];let S=m,i;t[9]!==a.key||t[10]!==c?(i=g(()=>{c(a.key)},"t3"),t[9]=a.key,t[10]=c,t[11]=i):i=t[11];let x=i,y;t[12]!==a.key||t[13]!==e.length?(y=a.key.slice(e.length),t[12]=a.key,t[13]=e.length,t[14]=y):y=t[14];let v;return t[15]!==d||t[16]!==f||t[17]!==S||t[18]!==y||t[19]!==x?(v={copy:d,download:f,name:y,remove:S,toggle:x},t[15]=d,t[16]=f,t[17]=S,t[18]=y,t[19]=x,t[20]=v):v=t[20],v},"useFileItem"),Ie=g(a=>{let e=(0,j.c)(31),{busy:s,buttonClassName:t,copied:r,objectKey:o,onCopy:u,onDelete:c,onDownload:n,t:d}=a,h=`storage-copy-${o}`,f;e[0]!==r||e[1]!==d?(f=d(r?"Copied":"Copy URL"),e[0]=r,e[1]=d,e[2]=f):f=e[2];let m;e[3]!==s||e[4]!==t||e[5]!==u||e[6]!==h||e[7]!==f?(m=(0,l.jsxDEV)(ee,{className:t,"data-testid":h,disabled:s,onClick:u,size:"sm",type:"button",variant:"ghost",children:f},void 0,!1),e[3]=s,e[4]=t,e[5]=u,e[6]=h,e[7]=f,e[8]=m):m=e[8];let S=`storage-download-${o}`,i;e[9]!==d?(i=d("Download"),e[9]=d,e[10]=i):i=e[10];let x;e[11]!==s||e[12]!==t||e[13]!==n||e[14]!==S||e[15]!==i?(x=(0,l.jsxDEV)(ee,{className:t,"data-testid":S,disabled:s,onClick:n,size:"sm",type:"button",variant:"ghost",children:i},void 0,!1),e[11]=s,e[12]=t,e[13]=n,e[14]=S,e[15]=i,e[16]=x):x=e[16];let y;e[17]!==d?(y=d("Delete object?"),e[17]=d,e[18]=y):y=e[18];let v=`storage-delete-${o}`,b;e[19]!==d?(b=d("Delete"),e[19]=d,e[20]=b):b=e[20];let k;e[21]!==s||e[22]!==c||e[23]!==y||e[24]!==v||e[25]!==b?(k=(0,l.jsxDEV)($e,{confirmLabel:y,disabled:s,onConfirm:c,testId:v,children:b},void 0,!1),e[21]=s,e[22]=c,e[23]=y,e[24]=v,e[25]=b,e[26]=k):k=e[26];let w;return e[27]!==k||e[28]!==m||e[29]!==x?(w=(0,l.jsxDEV)(l.Fragment,{children:[m,x,k]},void 0,!0),e[27]=k,e[28]=m,e[29]=x,e[30]=w):w=e[30],w},"FileActions"),Oe=g(a=>{let e=(0,j.c)(14),{objectKey:s,references:t,t:r}=a;if(t===void 0)return null;if(t.length===0){let h=`storage-orphan-${s}`,f;e[0]!==r?(f=r("Orphan"),e[0]=r,e[1]=f):f=e[1];let m;return e[2]!==h||e[3]!==f?(m=(0,l.jsxDEV)(oe,{"data-testid":h,variant:"warning",children:f},void 0,!1),e[2]=h,e[3]=f,e[4]=m):m=e[4],m}let o;e[5]!==t?(o=t.map(mt).join(`
1
+ import{b as De}from"./chunk-7VF3IAAW.js";import"./chunk-PN5NCZDX.js";import{a as pe}from"./chunk-BACPICH6.js";import"./chunk-QBAT52GB.js";import{c as Re}from"./chunk-TQ36RWOP.js";import"./chunk-QAFAJBAW.js";import"./chunk-AHILM3ZP.js";import{a as Fe}from"./chunk-J6J54MBP.js";import"./chunk-764T6X6X.js";import"./chunk-XUGSA2NG.js";import"./chunk-5OIBXYZM.js";import{a as $e}from"./chunk-TDL7NEWA.js";import"./chunk-KEGAWN6Y.js";import{a as Te,b as _e,c as Ee,d as ie,e as te,f as Q}from"./chunk-GTM65MVX.js";import"./chunk-4QHKBC77.js";import{a as Ne}from"./chunk-K3GNLVYK.js";import"./chunk-TBMYIZIO.js";import{R as Se}from"./chunk-3CJW6NWG.js";import{c as ee}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as ge}from"./chunk-BOXSWNXZ.js";import{a as fe}from"./chunk-TAD43CG5.js";import{a as we,e as Ce}from"./chunk-SEU5V7I6.js";import{b as oe}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as xe}from"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as ke,e as ue,f as he,g as J,k as H,m as me}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as g,e as de,f as ft,g as ut,h as ht}from"./chunk-RRCPZMC2.js";var j=de(ut(),1),_=de(ft(),1);var l=de(ht(),1);var Be=g((a,e,s)=>{let t=(0,j.c)(21),{onCopy:r,onDelete:o,onDownload:u,onToggleSelect:c}=s,n;t[0]!==a.key||t[1]!==r?(n=g(()=>{r(a.key)},"t0"),t[0]=a.key,t[1]=r,t[2]=n):n=t[2];let d=n,h;t[3]!==a.key||t[4]!==u?(h=g(()=>{u(a.key)},"t1"),t[3]=a.key,t[4]=u,t[5]=h):h=t[5];let f=h,m;t[6]!==a.key||t[7]!==o?(m=g(()=>{o(a.key)},"t2"),t[6]=a.key,t[7]=o,t[8]=m):m=t[8];let S=m,i;t[9]!==a.key||t[10]!==c?(i=g(()=>{c(a.key)},"t3"),t[9]=a.key,t[10]=c,t[11]=i):i=t[11];let x=i,y;t[12]!==a.key||t[13]!==e.length?(y=a.key.slice(e.length),t[12]=a.key,t[13]=e.length,t[14]=y):y=t[14];let v;return t[15]!==d||t[16]!==f||t[17]!==S||t[18]!==y||t[19]!==x?(v={copy:d,download:f,name:y,remove:S,toggle:x},t[15]=d,t[16]=f,t[17]=S,t[18]=y,t[19]=x,t[20]=v):v=t[20],v},"useFileItem"),Ie=g(a=>{let e=(0,j.c)(31),{busy:s,buttonClassName:t,copied:r,objectKey:o,onCopy:u,onDelete:c,onDownload:n,t:d}=a,h=`storage-copy-${o}`,f;e[0]!==r||e[1]!==d?(f=d(r?"Copied":"Copy URL"),e[0]=r,e[1]=d,e[2]=f):f=e[2];let m;e[3]!==s||e[4]!==t||e[5]!==u||e[6]!==h||e[7]!==f?(m=(0,l.jsxDEV)(ee,{className:t,"data-testid":h,disabled:s,onClick:u,size:"sm",type:"button",variant:"ghost",children:f},void 0,!1),e[3]=s,e[4]=t,e[5]=u,e[6]=h,e[7]=f,e[8]=m):m=e[8];let S=`storage-download-${o}`,i;e[9]!==d?(i=d("Download"),e[9]=d,e[10]=i):i=e[10];let x;e[11]!==s||e[12]!==t||e[13]!==n||e[14]!==S||e[15]!==i?(x=(0,l.jsxDEV)(ee,{className:t,"data-testid":S,disabled:s,onClick:n,size:"sm",type:"button",variant:"ghost",children:i},void 0,!1),e[11]=s,e[12]=t,e[13]=n,e[14]=S,e[15]=i,e[16]=x):x=e[16];let y;e[17]!==d?(y=d("Delete object?"),e[17]=d,e[18]=y):y=e[18];let v=`storage-delete-${o}`,b;e[19]!==d?(b=d("Delete"),e[19]=d,e[20]=b):b=e[20];let k;e[21]!==s||e[22]!==c||e[23]!==y||e[24]!==v||e[25]!==b?(k=(0,l.jsxDEV)($e,{confirmLabel:y,disabled:s,onConfirm:c,testId:v,children:b},void 0,!1),e[21]=s,e[22]=c,e[23]=y,e[24]=v,e[25]=b,e[26]=k):k=e[26];let w;return e[27]!==k||e[28]!==m||e[29]!==x?(w=(0,l.jsxDEV)(l.Fragment,{children:[m,x,k]},void 0,!0),e[27]=k,e[28]=m,e[29]=x,e[30]=w):w=e[30],w},"FileActions"),Oe=g(a=>{let e=(0,j.c)(14),{objectKey:s,references:t,t:r}=a;if(t===void 0)return null;if(t.length===0){let h=`storage-orphan-${s}`,f;e[0]!==r?(f=r("Orphan"),e[0]=r,e[1]=f):f=e[1];let m;return e[2]!==h||e[3]!==f?(m=(0,l.jsxDEV)(oe,{"data-testid":h,variant:"warning",children:f},void 0,!1),e[2]=h,e[3]=f,e[4]=m):m=e[4],m}let o;e[5]!==t?(o=t.map(mt).join(`
2
2
  `),e[5]=t,e[6]=o):o=e[6];let u=o,c=`storage-refs-${s}`,n;e[7]!==t.length||e[8]!==r?(n=t.length===1?r("1 record"):r("{count} records",{count:t.length}),e[7]=t.length,e[8]=r,e[9]=n):n=e[9];let d;return e[10]!==u||e[11]!==c||e[12]!==n?(d=(0,l.jsxDEV)(oe,{"data-testid":c,title:u,variant:"secondary",children:n},void 0,!1),e[10]=u,e[11]=c,e[12]=n,e[13]=d):d=e[13],d},"FileReferences"),je=g(a=>{let e=(0,j.c)(7),{objectKey:s,onToggle:t,selected:r,t:o}=a,u;e[0]!==o?(u=o("Select row"),e[0]=o,e[1]=u):u=e[1];let c=`storage-select-${s}`,n;return e[2]!==t||e[3]!==r||e[4]!==u||e[5]!==c?(n=(0,l.jsxDEV)(pe,{"aria-label":u,checked:r,"data-testid":c,onCheckedChange:t},void 0,!1),e[2]=t,e[3]=r,e[4]=u,e[5]=c,e[6]=n):n=e[6],n},"FileSelect");function mt(a){return`${a.table}\xB7${a.id}`}g(mt,"_temp$2");var gt=g(a=>{let e=(0,j.c)(10),{colSpan:s,name:t,onEnter:r}=a,o;e[0]!==t||e[1]!==r?(o=g(()=>{r(t)},"t1"),e[0]=t,e[1]=r,e[2]=o):o=e[2];let u=o,c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=(0,l.jsxDEV)("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,l.jsxDEV)("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z"},void 0,!1)},void 0,!1),e[3]=c):c=e[3];let n;e[4]!==u||e[5]!==t?(n=(0,l.jsxDEV)("button",{className:"inline-flex items-center gap-2 font-mono text-xs outline-none hover:text-foreground focus-visible:text-foreground","data-testid":"fb-folder",onClick:u,type:"button",children:[c,t]},void 0,!0),e[4]=u,e[5]=t,e[6]=n):n=e[6];let d;return e[7]!==s||e[8]!==n?(d=(0,l.jsxDEV)(ie,{children:(0,l.jsxDEV)(Q,{colSpan:s,children:n},void 0,!1)},void 0,!1),e[7]=s,e[8]=n,e[9]=d):d=e[9],d},"FolderRow"),pt=g(a=>{let e=(0,j.c)(33),{busy:s,copiedKey:t,handlers:r,object:o,prefix:u,references:c,selected:n,showReferences:d,t:h}=a,{copy:f,download:m,name:S,remove:i,toggle:x}=Be(o,u,r),y;e[0]!==o.key||e[1]!==n||e[2]!==h||e[3]!==x?(y=(0,l.jsxDEV)(Q,{className:"w-8",children:(0,l.jsxDEV)(je,{objectKey:o.key,onToggle:x,selected:n,t:h},void 0,!1)},void 0,!1),e[0]=o.key,e[1]=n,e[2]=h,e[3]=x,e[4]=y):y=e[4];let v;e[5]!==S?(v=(0,l.jsxDEV)(Q,{className:"font-mono text-xs",children:S},void 0,!1),e[5]=S,e[6]=v):v=e[6];let b;e[7]!==o.size?(b=me(o.size),e[7]=o.size,e[8]=b):b=e[8];let k;e[9]!==b?(k=(0,l.jsxDEV)(Q,{className:"tabular-nums text-muted-foreground",children:b},void 0,!1),e[9]=b,e[10]=k):k=e[10];let w=o.httpMetadata?.contentType??"",T;e[11]!==w?(T=(0,l.jsxDEV)(Q,{children:w},void 0,!1),e[11]=w,e[12]=T):T=e[12];let C;e[13]!==o.key||e[14]!==c||e[15]!==d||e[16]!==h?(C=d&&(0,l.jsxDEV)(Q,{children:(0,l.jsxDEV)(Oe,{objectKey:o.key,references:c,t:h},void 0,!1)},void 0,!1),e[13]=o.key,e[14]=c,e[15]=d,e[16]=h,e[17]=C):C=e[17];let N=t===o.key,E;e[18]!==s||e[19]!==f||e[20]!==m||e[21]!==o.key||e[22]!==i||e[23]!==h||e[24]!==N?(E=(0,l.jsxDEV)(Q,{className:"text-right",children:(0,l.jsxDEV)("span",{className:"inline-flex items-center gap-1",children:(0,l.jsxDEV)(Ie,{busy:s,copied:N,objectKey:o.key,onCopy:f,onDelete:i,onDownload:m,t:h},void 0,!1)},void 0,!1)},void 0,!1),e[18]=s,e[19]=f,e[20]=m,e[21]=o.key,e[22]=i,e[23]=h,e[24]=N,e[25]=E):E=e[25];let $;return e[26]!==y||e[27]!==v||e[28]!==k||e[29]!==T||e[30]!==C||e[31]!==E?($=(0,l.jsxDEV)(ie,{"data-testid":"fb-row",children:[y,v,k,T,C,E]},void 0,!0),e[26]=y,e[27]=v,e[28]=k,e[29]=T,e[30]=C,e[31]=E,e[32]=$):$=e[32],$},"FileRow"),vt=g(a=>{let e=(0,j.c)(65),{allSelected:s,busy:t,copiedKey:r,files:o,folders:u,handlers:c,onEnterFolder:n,prefix:d,references:h,selected:f,showReferences:m,someSelected:S,t:i,toggleSelectAll:x}=a,y;e[0]!==i?(y=i("Select all rows"),e[0]=i,e[1]=y):y=e[1];let v;e[2]!==s||e[3]!==S||e[4]!==y||e[5]!==x?(v=(0,l.jsxDEV)(te,{className:"w-8",children:(0,l.jsxDEV)(pe,{"aria-label":y,checked:s,"data-testid":"storage-select-all",indeterminate:S,onCheckedChange:x},void 0,!1)},void 0,!1),e[2]=s,e[3]=S,e[4]=y,e[5]=x,e[6]=v):v=e[6];let b;e[7]!==i?(b=i("key"),e[7]=i,e[8]=b):b=e[8];let k;e[9]!==b?(k=(0,l.jsxDEV)(te,{children:b},void 0,!1),e[9]=b,e[10]=k):k=e[10];let w;e[11]!==i?(w=i("size"),e[11]=i,e[12]=w):w=e[12];let T;e[13]!==w?(T=(0,l.jsxDEV)(te,{children:w},void 0,!1),e[13]=w,e[14]=T):T=e[14];let C;e[15]!==i?(C=i("content-type"),e[15]=i,e[16]=C):C=e[16];let N;e[17]!==C?(N=(0,l.jsxDEV)(te,{children:C},void 0,!1),e[17]=C,e[18]=N):N=e[18];let E;e[19]!==m||e[20]!==i?(E=m&&(0,l.jsxDEV)(te,{children:i("used by")},void 0,!1),e[19]=m,e[20]=i,e[21]=E):E=e[21];let $;e[22]!==i?($=i("Actions"),e[22]=i,e[23]=$):$=e[23];let R;e[24]!==$?(R=(0,l.jsxDEV)(te,{"aria-label":$},void 0,!1),e[24]=$,e[25]=R):R=e[25];let D;e[26]!==R||e[27]!==v||e[28]!==k||e[29]!==T||e[30]!==N||e[31]!==E?(D=(0,l.jsxDEV)(_e,{children:(0,l.jsxDEV)(ie,{children:[v,k,T,N,E,R]},void 0,!0)},void 0,!1),e[26]=R,e[27]=v,e[28]=k,e[29]=T,e[30]=N,e[31]=E,e[32]=D):D=e[32];let B;if(e[33]!==u||e[34]!==n||e[35]!==m){let z;e[37]!==n||e[38]!==m?(z=g(L=>(0,l.jsxDEV)(gt,{colSpan:m?6:5,name:L,onEnter:n},L,!1),"t142"),e[37]=n,e[38]=m,e[39]=z):z=e[39],B=u.map(z),e[33]=u,e[34]=n,e[35]=m,e[36]=B}else B=e[36];let I;if(e[40]!==t||e[41]!==r||e[42]!==o||e[43]!==c||e[44]!==d||e[45]!==h||e[46]!==f||e[47]!==m||e[48]!==i){let z;e[50]!==t||e[51]!==r||e[52]!==c||e[53]!==d||e[54]!==h||e[55]!==f||e[56]!==m||e[57]!==i?(z=g(L=>(0,l.jsxDEV)(pt,{busy:t,copiedKey:r,handlers:c,object:L,prefix:d,references:h[L.key],selected:f.has(L.key),showReferences:m,t:i},L.key,!1),"t152"),e[50]=t,e[51]=r,e[52]=c,e[53]=d,e[54]=h,e[55]=f,e[56]=m,e[57]=i,e[58]=z):z=e[58],I=o.map(z),e[40]=t,e[41]=r,e[42]=o,e[43]=c,e[44]=d,e[45]=h,e[46]=f,e[47]=m,e[48]=i,e[49]=I}else I=e[49];let K;e[59]!==B||e[60]!==I?(K=(0,l.jsxDEV)(Ee,{children:[B,I]},void 0,!0),e[59]=B,e[60]=I,e[61]=K):K=e[61];let O;return e[62]!==D||e[63]!==K?(O=(0,l.jsxDEV)(we,{className:"overflow-hidden py-0",children:(0,l.jsxDEV)(Ce,{className:"px-0",children:(0,l.jsxDEV)(Te,{"data-testid":"fb-table",children:[D,K]},void 0,!0)},void 0,!1)},void 0,!1),e[62]=D,e[63]=K,e[64]=O):O=e[64],O},"FileBrowserList"),bt=[{label:"15m",seconds:900},{label:"1h",seconds:3600},{label:"24h",seconds:86400},{label:"7d",seconds:604800}],yt=3600,ze=g((a,e)=>{if(e==="size")return a.size;if(e==="type")return a.httpMetadata?.contentType??"";if(e==="date"){if(a.uploaded===void 0)return 0;let s=new Date(a.uploaded).getTime();return Number.isNaN(s)?0:s}return e.startsWith("tag:")?a.customMetadata?.[e.slice(4)]??"":a.key},"fileSortValue"),xt=g((a,e,s)=>{let t=s==="desc"?-1:1;return a.toSorted((r,o)=>{let u=ze(r,e),c=ze(o,e);return(typeof u=="number"&&typeof c=="number"?u-c:String(u).localeCompare(String(c)))*t})},"sortFiles"),kt=g((a,e)=>{let s=new Set,t=[];for(let r of a){let o=r.key.slice(e.length),u=o.indexOf("/");u===-1?t.push(r):s.add(o.slice(0,u+1))}return{files:t,folders:[...s].toSorted((r,o)=>r.localeCompare(o))}},"deriveEntries"),St=g(a=>{let e=(0,j.c)(59),{bucket:s,buckets:t,busy:r,draftPrefix:o,expiry:u,fileInputRef:c,onBucketChange:n,onExpiryChange:d,onFileChange:h,onList:f,onPrefixChange:m,onUploadClick:S,t:i}=a,x;e[0]!==m?(x=g(G=>{m(G.target.value)},"t1"),e[0]=m,e[1]=x):x=e[1];let y=x,v;e[2]!==n?(v=g(G=>{n(G.target.value)},"t2"),e[2]=n,e[3]=v):v=e[3];let b=v,k;e[4]!==d?(k=g(G=>{d(Number.parseInt(G.target.value,10))},"t3"),e[4]=d,e[5]=k):k=e[5];let w=k,T;e[6]!==s||e[7]!==t||e[8]!==b||e[9]!==i?(T=t.length>0&&(0,l.jsxDEV)("select",{"aria-label":i("Bucket"),className:"h-8 rounded-md border border-border bg-background px-1 outline-none focus-visible:border-ring","data-testid":"fb-bucket",onChange:b,value:s,children:t.map(Ct)},void 0,!1),e[6]=s,e[7]=t,e[8]=b,e[9]=i,e[10]=T):T=e[10];let C;e[11]!==i?(C=i("Key prefix"),e[11]=i,e[12]=C):C=e[12];let N;e[13]!==i?(N=i("key prefix (optional)"),e[13]=i,e[14]=N):N=e[14];let E;e[15]!==o||e[16]!==y||e[17]!==C||e[18]!==N?(E=(0,l.jsxDEV)(Se,{"aria-label":C,className:"h-8 w-64 max-w-full","data-testid":"fb-prefix-input",onChange:y,placeholder:N,value:o},void 0,!1),e[15]=o,e[16]=y,e[17]=C,e[18]=N,e[19]=E):E=e[19];let $;e[20]!==i?($=i("List"),e[20]=i,e[21]=$):$=e[21];let R;e[22]!==r||e[23]!==f||e[24]!==$?(R=(0,l.jsxDEV)(ee,{"data-testid":"fb-list",disabled:r,onClick:f,size:"sm",type:"button",children:$},void 0,!1),e[22]=r,e[23]=f,e[24]=$,e[25]=R):R=e[25];let D;e[26]!==r||e[27]!==i?(D=i(r?"Uploading\u2026":"Upload"),e[26]=r,e[27]=i,e[28]=D):D=e[28];let B;e[29]!==r||e[30]!==S||e[31]!==D?(B=(0,l.jsxDEV)(ee,{"data-testid":"storage-upload",disabled:r,onClick:S,size:"sm",type:"button",variant:"outline",children:D},void 0,!1),e[29]=r,e[30]=S,e[31]=D,e[32]=B):B=e[32];let I;e[33]!==c||e[34]!==h?(I=(0,l.jsxDEV)("input",{className:"hidden","data-testid":"storage-file-input",onChange:h,ref:c,type:"file"},void 0,!1),e[33]=c,e[34]=h,e[35]=I):I=e[35];let K;e[36]!==i?(K=i("Link expiry"),e[36]=i,e[37]=K):K=e[37];let O;e[38]!==i?(O=bt.map(G=>(0,l.jsxDEV)("option",{value:G.seconds,children:i(G.label)},G.seconds,!1)),e[38]=i,e[39]=O):O=e[39];let z;e[40]!==u||e[41]!==w||e[42]!==O?(z=(0,l.jsxDEV)("select",{className:"h-8 rounded-md border border-border bg-background px-1 tabular-nums outline-none focus-visible:border-ring","data-testid":"storage-expiry",id:"storage-expiry",onChange:w,value:u,children:O},void 0,!1),e[40]=u,e[41]=w,e[42]=O,e[43]=z):z=e[43];let L;e[44]!==K||e[45]!==z?(L=(0,l.jsxDEV)("label",{className:"ml-auto flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"storage-expiry",children:[K,z]},void 0,!0),e[44]=K,e[45]=z,e[46]=L):L=e[46];let U;e[47]!==i?(U=i("Open in Cloudflare"),e[47]=i,e[48]=U):U=e[48];let M;e[49]!==U?(M=(0,l.jsxDEV)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"fb-cf-link",href:Re,rel:"noreferrer",target:"_blank",children:U},void 0,!1),e[49]=U,e[50]=M):M=e[50];let P;return e[51]!==B||e[52]!==I||e[53]!==L||e[54]!==M||e[55]!==T||e[56]!==E||e[57]!==R?(P=(0,l.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[T,E,R,B,I,L,M]},void 0,!0),e[51]=B,e[52]=I,e[53]=L,e[54]=M,e[55]=T,e[56]=E,e[57]=R,e[58]=P):P=e[58],P},"FileBrowserToolbar"),wt=g(a=>{let e=(0,j.c)(66),{onSortKeyChange:s,onThumbSizeChange:t,showGrid:r,showList:o,sortDirection:u,sortKey:c,t:n,tagKeys:d,thumbSize:h,toggleSortDirection:f,view:m}=a,S;e[0]!==s?(S=g(Z=>{s(Z.target.value)},"t1"),e[0]=s,e[1]=S):S=e[1];let i=S,x;e[2]!==t?(x=g(Z=>{t(Number.parseInt(Z.target.value,10))},"t2"),e[2]=t,e[3]=x):x=e[3];let y=x,v=m==="list",b;e[4]!==n?(b=n("List"),e[4]=n,e[5]=b):b=e[5];let k;e[6]!==o||e[7]!==v||e[8]!==b?(k=(0,l.jsxDEV)("button",{"aria-pressed":v,className:"px-2 py-1 outline-none transition-colors hover:bg-accent aria-pressed:bg-accent aria-pressed:text-accent-foreground","data-testid":"fb-view-list",onClick:o,type:"button",children:b},void 0,!1),e[6]=o,e[7]=v,e[8]=b,e[9]=k):k=e[9];let w=m==="grid",T;e[10]!==n?(T=n("Grid"),e[10]=n,e[11]=T):T=e[11];let C;e[12]!==r||e[13]!==w||e[14]!==T?(C=(0,l.jsxDEV)("button",{"aria-pressed":w,className:"border-s border-border px-2 py-1 outline-none transition-colors hover:bg-accent aria-pressed:bg-accent aria-pressed:text-accent-foreground","data-testid":"fb-view-grid",onClick:r,type:"button",children:T},void 0,!1),e[12]=r,e[13]=w,e[14]=T,e[15]=C):C=e[15];let N;e[16]!==k||e[17]!==C?(N=(0,l.jsxDEV)("div",{className:"inline-flex overflow-hidden rounded-md border border-border",children:[k,C]},void 0,!0),e[16]=k,e[17]=C,e[18]=N):N=e[18];let E;e[19]!==n?(E=n("Sort"),e[19]=n,e[20]=E):E=e[20];let $;e[21]!==n?($=n("Name"),e[21]=n,e[22]=$):$=e[22];let R;e[23]!==$?(R=(0,l.jsxDEV)("option",{value:"name",children:$},void 0,!1),e[23]=$,e[24]=R):R=e[24];let D;e[25]!==n?(D=n("size"),e[25]=n,e[26]=D):D=e[26];let B;e[27]!==D?(B=(0,l.jsxDEV)("option",{value:"size",children:D},void 0,!1),e[27]=D,e[28]=B):B=e[28];let I;e[29]!==n?(I=n("Type"),e[29]=n,e[30]=I):I=e[30];let K;e[31]!==I?(K=(0,l.jsxDEV)("option",{value:"type",children:I},void 0,!1),e[31]=I,e[32]=K):K=e[32];let O;e[33]!==n?(O=n("Modified"),e[33]=n,e[34]=O):O=e[34];let z;e[35]!==O?(z=(0,l.jsxDEV)("option",{value:"date",children:O},void 0,!1),e[35]=O,e[36]=z):z=e[36];let L;e[37]!==d?(L=d.map(Nt),e[37]=d,e[38]=L):L=e[38];let U;e[39]!==i||e[40]!==c||e[41]!==R||e[42]!==B||e[43]!==K||e[44]!==z||e[45]!==L?(U=(0,l.jsxDEV)("select",{className:"h-8 rounded-md border border-border bg-background px-1 outline-none focus-visible:border-ring","data-testid":"fb-sort",id:"fb-sort",onChange:i,value:c,children:[R,B,K,z,L]},void 0,!0),e[39]=i,e[40]=c,e[41]=R,e[42]=B,e[43]=K,e[44]=z,e[45]=L,e[46]=U):U=e[46];let M;e[47]!==E||e[48]!==U?(M=(0,l.jsxDEV)("label",{className:"flex items-center gap-1.5 text-muted-foreground",htmlFor:"fb-sort",children:[E,U]},void 0,!0),e[47]=E,e[48]=U,e[49]=M):M=e[49];let P;e[50]!==n?(P=n("Toggle sort direction"),e[50]=n,e[51]=P):P=e[51];let G=u==="asc"?"\u2191":"\u2193",W;e[52]!==P||e[53]!==G||e[54]!==f?(W=(0,l.jsxDEV)("button",{"aria-label":P,className:"flex size-8 items-center justify-center rounded-md border border-border tabular-nums outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"fb-sort-dir",onClick:f,type:"button",children:G},void 0,!1),e[52]=P,e[53]=G,e[54]=f,e[55]=W):W=e[55];let Y;e[56]!==y||e[57]!==n||e[58]!==h||e[59]!==m?(Y=m==="grid"&&(0,l.jsxDEV)("label",{className:"ml-auto flex items-center gap-1.5 text-muted-foreground",htmlFor:"fb-thumb-size",children:[n("Thumbnail size"),(0,l.jsxDEV)("input",{className:"accent-primary","data-testid":"fb-thumb-size",id:"fb-thumb-size",max:240,min:80,onChange:y,step:8,type:"range",value:h},void 0,!1)]},void 0,!0),e[56]=y,e[57]=n,e[58]=h,e[59]=m,e[60]=Y):Y=e[60];let se;return e[61]!==M||e[62]!==W||e[63]!==Y||e[64]!==N?(se=(0,l.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2 text-xs","data-testid":"fb-controls",children:[N,M,W,Y]},void 0,!0),e[61]=M,e[62]=W,e[63]=Y,e[64]=N,e[65]=se):se=e[65],se},"FileBrowserControls");function Ct(a){return(0,l.jsxDEV)("option",{value:a,children:a},a,!1)}g(Ct,"_temp$1");function Nt(a){return(0,l.jsxDEV)("option",{value:`tag:${a}`,children:a},a,!1)}g(Nt,"_temp2");var Tt=/\.(?:avif|bmp|gif|ico|jpe?g|png|svg|webp)$/iu,_t=g(a=>(a.httpMetadata?.contentType??"").startsWith("image/")||Tt.test(a.key),"isImage"),Et=g(()=>{let a=(0,j.c)(1),e;return a[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,l.jsxDEV)("svg",{"aria-hidden":"true",className:"size-8 text-muted-foreground/60",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.4,viewBox:"0 0 24 24",children:(0,l.jsxDEV)("path",{d:"M7 3h7l5 5v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1Zm7 0v5h5"},void 0,!1)},void 0,!1),a[0]=e):e=a[0],e},"FileGlyph"),$t=g(a=>{let e=(0,j.c)(13),{object:s,resolveUrl:t}=a,[r,o]=(0,_.useState)(null),[u,c]=(0,_.useState)(!1),n;e[0]!==s?(n=_t(s),e[0]=s,e[1]=n):n=e[1];let d=n,h,f;e[2]!==d||e[3]!==s.key||e[4]!==t?(h=g(()=>{if(!d)return;let x={cancelled:!1};return H((async()=>{try{let y=await t(s.key);x.cancelled||o(y)}catch{x.cancelled||c(!0)}})()),()=>{x.cancelled=!0}},"t2"),f=[d,s.key,t],e[2]=d,e[3]=s.key,e[4]=t,e[5]=h,e[6]=f):(h=e[5],f=e[6]),(0,_.useEffect)(h,f);let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=g(()=>{c(!0)},"t4"),e[7]=m):m=e[7];let S=m,i;return e[8]!==u||e[9]!==d||e[10]!==s.key||e[11]!==r?(i=(0,l.jsxDEV)("div",{className:"flex aspect-square w-full items-center justify-center overflow-hidden rounded-md border border-border bg-muted/30",children:d&&r!==null&&!u?(0,l.jsxDEV)("img",{alt:s.key,className:"size-full object-cover",loading:"lazy",onError:S,src:r},void 0,!1):(0,l.jsxDEV)(Et,{},void 0,!1)},void 0,!1),e[8]=u,e[9]=d,e[10]=s.key,e[11]=r,e[12]=i):i=e[12],i},"Thumbnail"),Ft=g(a=>{let e=(0,j.c)(38),{busy:s,copiedKey:t,handlers:r,object:o,prefix:u,references:c,resolveUrl:n,selected:d,showReferences:h,t:f}=a,{copy:m,download:S,name:i,remove:x,toggle:y}=Be(o,u,r),v;e[0]!==o||e[1]!==n?(v=(0,l.jsxDEV)($t,{object:o,resolveUrl:n},void 0,!1),e[0]=o,e[1]=n,e[2]=v):v=e[2];let b;e[3]!==o.key||e[4]!==d||e[5]!==f||e[6]!==y?(b=(0,l.jsxDEV)("span",{className:"absolute left-1.5 top-1.5 rounded bg-background/80 p-0.5",children:(0,l.jsxDEV)(je,{objectKey:o.key,onToggle:y,selected:d,t:f},void 0,!1)},void 0,!1),e[3]=o.key,e[4]=d,e[5]=f,e[6]=y,e[7]=b):b=e[7];let k;e[8]!==v||e[9]!==b?(k=(0,l.jsxDEV)("div",{className:"relative",children:[v,b]},void 0,!0),e[8]=v,e[9]=b,e[10]=k):k=e[10];let w;e[11]!==i?(w=(0,l.jsxDEV)("p",{className:"truncate font-mono text-xs",title:i,children:i},void 0,!1),e[11]=i,e[12]=w):w=e[12];let T;e[13]!==o.size?(T=me(o.size),e[13]=o.size,e[14]=T):T=e[14];let C;e[15]!==T?(C=(0,l.jsxDEV)("p",{className:"text-[11px] tabular-nums text-muted-foreground",children:T},void 0,!1),e[15]=T,e[16]=C):C=e[16];let N;e[17]!==o.key||e[18]!==c||e[19]!==h||e[20]!==f?(N=h&&(0,l.jsxDEV)("div",{className:"mt-1",children:(0,l.jsxDEV)(Oe,{objectKey:o.key,references:c,t:f},void 0,!1)},void 0,!1),e[17]=o.key,e[18]=c,e[19]=h,e[20]=f,e[21]=N):N=e[21];let E;e[22]!==w||e[23]!==C||e[24]!==N?(E=(0,l.jsxDEV)("div",{className:"min-w-0",children:[w,C,N]},void 0,!0),e[22]=w,e[23]=C,e[24]=N,e[25]=E):E=e[25];let $=t===o.key,R;e[26]!==s||e[27]!==m||e[28]!==S||e[29]!==o.key||e[30]!==x||e[31]!==f||e[32]!==$?(R=(0,l.jsxDEV)("div",{className:"flex items-center gap-1",children:(0,l.jsxDEV)(Ie,{busy:s,buttonClassName:"h-7 px-2 text-xs",copied:$,objectKey:o.key,onCopy:m,onDelete:x,onDownload:S,t:f},void 0,!1)},void 0,!1),e[26]=s,e[27]=m,e[28]=S,e[29]=o.key,e[30]=x,e[31]=f,e[32]=$,e[33]=R):R=e[33];let D;return e[34]!==R||e[35]!==k||e[36]!==E?(D=(0,l.jsxDEV)("div",{className:"flex flex-col gap-1.5","data-testid":"fb-tile",children:[k,E,R]},void 0,!0),e[34]=R,e[35]=k,e[36]=E,e[37]=D):D=e[37],D},"GalleryTile"),Dt=g(a=>{let e=(0,j.c)(9),{name:s,onEnter:t}=a,r;e[0]!==s||e[1]!==t?(r=g(()=>{t(s)},"t1"),e[0]=s,e[1]=t,e[2]=r):r=e[2];let o=r,u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=(0,l.jsxDEV)("span",{className:"flex aspect-square w-full items-center justify-center rounded-md border border-border bg-muted/30 transition-colors hover:bg-accent",children:(0,l.jsxDEV)("svg",{"aria-hidden":"true",className:"size-10 text-muted-foreground",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.4,viewBox:"0 0 24 24",children:(0,l.jsxDEV)("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z"},void 0,!1)},void 0,!1)},void 0,!1),e[3]=u):u=e[3];let c;e[4]!==s?(c=(0,l.jsxDEV)("span",{className:"truncate font-mono text-xs",title:s,children:s},void 0,!1),e[4]=s,e[5]=c):c=e[5];let n;return e[6]!==o||e[7]!==c?(n=(0,l.jsxDEV)("button",{className:"flex flex-col gap-1.5 text-left outline-none","data-testid":"fb-folder",onClick:o,type:"button",children:[u,c]},void 0,!0),e[6]=o,e[7]=c,e[8]=n):n=e[8],n},"FolderTile"),Rt=g(a=>{let e=(0,j.c)(34),{busy:s,copiedKey:t,files:r,folders:o,handlers:u,onEnterFolder:c,prefix:n,references:d,resolveUrl:h,selected:f,showReferences:m,size:S,t:i}=a,x;e[0]!==S?(x=S.toString(),e[0]=S,e[1]=x):x=e[1];let y=`repeat(auto-fill, minmax(${x}px, 1fr))`,v;e[2]!==y?(v={gridTemplateColumns:y},e[2]=y,e[3]=v):v=e[3];let b=v,k;if(e[4]!==o||e[5]!==c){let C;e[7]!==c?(C=g(N=>(0,l.jsxDEV)(Dt,{name:N,onEnter:c},N,!1),"t52"),e[7]=c,e[8]=C):C=e[8],k=o.map(C),e[4]=o,e[5]=c,e[6]=k}else k=e[6];let w;if(e[9]!==s||e[10]!==t||e[11]!==r||e[12]!==u||e[13]!==n||e[14]!==d||e[15]!==h||e[16]!==f||e[17]!==m||e[18]!==i){let C;e[20]!==s||e[21]!==t||e[22]!==u||e[23]!==n||e[24]!==d||e[25]!==h||e[26]!==f||e[27]!==m||e[28]!==i?(C=g(N=>(0,l.jsxDEV)(Ft,{busy:s,copiedKey:t,handlers:u,object:N,prefix:n,references:d[N.key],resolveUrl:h,selected:f.has(N.key),showReferences:m,t:i},N.key,!1),"t62"),e[20]=s,e[21]=t,e[22]=u,e[23]=n,e[24]=d,e[25]=h,e[26]=f,e[27]=m,e[28]=i,e[29]=C):C=e[29],w=r.map(C),e[9]=s,e[10]=t,e[11]=r,e[12]=u,e[13]=n,e[14]=d,e[15]=h,e[16]=f,e[17]=m,e[18]=i,e[19]=w}else w=e[19];let T;return e[30]!==b||e[31]!==k||e[32]!==w?(T=(0,l.jsxDEV)("div",{className:"grid gap-4","data-testid":"fb-gallery",style:b,children:[k,w]},void 0,!0),e[30]=b,e[31]=k,e[32]=w,e[33]=T):T=e[33],T},"FileGallery"),zt=g(a=>{let e=(0,j.c)(23),{reference:s,t}=a,r=`fb-dangling-${s.table}-${s.id}-${s.column}`,o=`${s.table}\xB7${s.id}`,u;e[0]!==o?(u=(0,l.jsxDEV)(oe,{variant:"secondary",children:o},void 0,!1),e[0]=o,e[1]=u):u=e[1];let c;e[2]!==s.column?(c=(0,l.jsxDEV)("span",{className:"text-muted-foreground",children:s.column},void 0,!1),e[2]=s.column,e[3]=c):c=e[3];let n;e[4]!==t?(n=t("\u2192"),e[4]=t,e[5]=n):n=e[5];let d;e[6]!==n?(d=(0,l.jsxDEV)("span",{className:"text-muted-foreground/60",children:n},void 0,!1),e[6]=n,e[7]=d):d=e[7];let h;e[8]!==s.key?(h=(0,l.jsxDEV)("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-foreground",children:s.key},void 0,!1),e[8]=s.key,e[9]=h):h=e[9];let f;e[10]!==u||e[11]!==c||e[12]!==d||e[13]!==h?(f=(0,l.jsxDEV)("span",{className:"flex flex-wrap items-center gap-1.5",children:[u,c,d,h]},void 0,!0),e[10]=u,e[11]=c,e[12]=d,e[13]=h,e[14]=f):f=e[14];let m;e[15]!==t?(m=t("Missing object"),e[15]=t,e[16]=m):m=e[16];let S;e[17]!==m?(S=(0,l.jsxDEV)(oe,{className:"border-destructive/40 text-destructive",variant:"outline",children:m},void 0,!1),e[17]=m,e[18]=S):S=e[18];let i;return e[19]!==r||e[20]!==S||e[21]!==f?(i=(0,l.jsxDEV)("li",{className:"flex flex-wrap items-center justify-between gap-2 rounded-md border border-border/60 px-3 py-2 text-xs","data-testid":r,children:[f,S]},void 0,!0),e[19]=r,e[20]=S,e[21]=f,e[22]=i):i=e[22],i},"DanglingRow"),Kt=g(a=>{let e=(0,j.c)(37),{busy:s,onCheck:t,references:r,t:o,truncated:u}=a,c;e[0]!==o?(c=o("Integrity"),e[0]=o,e[1]=c):c=e[1];let n;e[2]!==c?(n=(0,l.jsxDEV)("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:c},void 0,!1),e[2]=c,e[3]=n):n=e[3];let d;e[4]!==o?(d=o("Orphaned objects"),e[4]=o,e[5]=d):d=e[5];let h;e[6]!==d?(h=(0,l.jsxDEV)("span",{className:"text-sm font-medium text-foreground",children:d},void 0,!1),e[6]=d,e[7]=h):h=e[7];let f;e[8]!==o?(f=o("Find records whose file reference points at an object the bucket no longer has."),e[8]=o,e[9]=f):f=e[9];let m;e[10]!==f?(m=(0,l.jsxDEV)("span",{className:"text-xs text-muted-foreground",children:f},void 0,!1),e[10]=f,e[11]=m):m=e[11];let S;e[12]!==n||e[13]!==h||e[14]!==m?(S=(0,l.jsxDEV)("div",{className:"flex flex-col gap-1",children:[n,h,m]},void 0,!0),e[12]=n,e[13]=h,e[14]=m,e[15]=S):S=e[15];let i;e[16]!==s||e[17]!==o?(i=o(s?"Checking\u2026":"Check for orphans"),e[16]=s,e[17]=o,e[18]=i):i=e[18];let x;e[19]!==s||e[20]!==t||e[21]!==i?(x=(0,l.jsxDEV)(ee,{"data-testid":"fb-orphans-check",disabled:s,onClick:t,size:"sm",type:"button",variant:"outline",children:i},void 0,!1),e[19]=s,e[20]=t,e[21]=i,e[22]=x):x=e[22];let y;e[23]!==S||e[24]!==x?(y=(0,l.jsxDEV)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[S,x]},void 0,!0),e[23]=S,e[24]=x,e[25]=y):y=e[25];let v;e[26]!==r?.length||e[27]!==o?(v=r?.length===0&&(0,l.jsxDEV)(fe,{description:o("Every record's file reference points at an object that exists in the bucket."),testId:"fb-orphans-empty",title:o("No dangling references.")},void 0,!1),e[26]=r?.length,e[27]=o,e[28]=v):v=e[28];let b;e[29]!==r||e[30]!==o||e[31]!==u?(b=r!==void 0&&r.length>0&&(0,l.jsxDEV)(l.Fragment,{children:[u&&(0,l.jsxDEV)("p",{className:"text-xs text-warning","data-testid":"fb-orphans-truncated",children:o("Showing the first {count} dangling references \u2014 the scan was truncated.",{count:r.length})},void 0,!1),(0,l.jsxDEV)("ul",{className:"flex flex-col gap-1.5","data-testid":"fb-orphans-list",children:r.map(w=>(0,l.jsxDEV)(zt,{reference:w,t:o},`${w.table}\xB7${w.id}\xB7${w.column}`,!1))},void 0,!1)]},void 0,!0),e[29]=r,e[30]=o,e[31]=u,e[32]=b):b=e[32];let k;return e[33]!==y||e[34]!==v||e[35]!==b?(k=(0,l.jsxDEV)("section",{className:"flex flex-col gap-2 rounded-lg border border-border/60 p-3","data-testid":"fb-orphans",children:[y,v,b]},void 0,!0),e[33]=y,e[34]=v,e[35]=b,e[36]=k):k=e[36],k},"OrphanedObjectsSection"),Lt=g(function(a,e){let s=(0,j.c)(18),t;s[0]===Symbol.for("react.memo_cache_sentinel")?(t=new Set,s[0]=t):t=s[0];let[r,o]=(0,_.useState)(t),u;s[1]===Symbol.for("react.memo_cache_sentinel")?(u=g(v=>{o(b=>{let k=new Set(b);return k.has(v)?k.delete(v):k.add(v),k})},"t1"),s[1]=u):u=s[1];let c=u,n;s[2]===Symbol.for("react.memo_cache_sentinel")?(n=g(()=>{o(new Set)},"t2"),s[2]=n):n=s[2];let d=n,h,f,m;if(s[3]!==a||s[4]!==e||s[5]!==r){let v;s[9]!==e?(v=g(b=>e(b),"t42"),s[9]=e,s[10]=v):v=s[10],f=a.map(v),h=f.length>0&&f.every(b=>r.has(b)),m=!h&&f.some(b=>r.has(b)),s[3]=a,s[4]=e,s[5]=r,s[6]=h,s[7]=f,s[8]=m}else h=s[6],f=s[7],m=s[8];let S=m,i;s[11]!==f?(i=g(()=>{o(v=>f.every(b=>v.has(b))?new Set:new Set(f))},"t4"),s[11]=f,s[12]=i):i=s[12];let x=i,y;return s[13]!==h||s[14]!==r||s[15]!==S||s[16]!==x?(y={allSelected:h,clear:d,selected:r,someSelected:S,toggle:c,toggleAll:x},s[13]=h,s[14]=r,s[15]=S,s[16]=x,s[17]=y):y=s[17],y},"useKeySelection"),Bt=ue(ge.storageReferences),It=ue(ge.storageOrphans),Ke=1e4,Ot=1e3,jt=3600,At=g((a,e)=>{if(!("document"in globalThis))return;let s=globalThis.document.createElement("a");s.href=a,s.download=e,s.rel="noopener",globalThis.document.body.append(s),s.click(),s.remove()},"triggerDownload"),Ut=g(async a=>{"navigator"in globalThis&&"clipboard"in globalThis.navigator&&await globalThis.navigator.clipboard.writeText(a)},"copyToClipboard"),Mt=g(({initialPrefix:a,pageSize:e})=>{let s=xe(),[t,r]=(0,_.useState)(a??""),[o,u]=(0,_.useState)(a??""),[c,n]=(0,_.useState)(yt),[d,h]=(0,_.useState)("list"),[f,m]=(0,_.useState)(128),[S,i]=(0,_.useState)("name"),[x,y]=(0,_.useState)("asc"),[v,b]=(0,_.useState)(void 0),[k,w]=(0,_.useState)(void 0),[T,C]=(0,_.useState)(!1),[N,E]=(0,_.useState)(void 0),[$,R]=(0,_.useState)(void 0),[D,B]=(0,_.useState)(""),[I,K]=(0,_.useState)({}),[O,z]=(0,_.useState)(!1),[L,U]=(0,_.useState)(void 0),[M,P]=(0,_.useState)(!1),[G,W]=(0,_.useState)(!1),[Y,se]=(0,_.useState)([]),[Z,ve]=(0,_.useState)("");(0,_.useEffect)(()=>{let p={cancelled:!1};return H((async()=>{try{let F=await s.listStorageBuckets();if(!p.cancelled){se(F);let[A]=F;A!==void 0&&ve(V=>V===""?A:V)}}catch{}})()),()=>{p.cancelled=!0}},[s]);let q=(0,_.useMemo)(()=>({list:g(p=>s.listStorageObjects({...p,bucket:Z}),"list"),remove:g(p=>s.deleteStorageObject(p,{bucket:Z}),"remove"),signedUrl:g((p,F)=>s.signedStorageUrl(p,{...F,bucket:Z}),"signedUrl"),upload:g(p=>s.uploadStorageObject({...p,bucket:Z}),"upload")}),[Z,s]),X=(0,_.useCallback)(async(p,F,A)=>{w(void 0),C(!0);try{let V=await q.list({cursor:F,limit:e,prefix:p});b(re=>A&&re!==void 0?[...re,...V.objects]:V.objects),R(V.cursor)}catch(V){A||b(void 0),w(J(V))}finally{C(!1)}},[e,q]);(0,_.useEffect)(()=>{H(X(a??"",void 0,!1))},[X,a]);let Ae=(v?.length??0)<=e;Fe(()=>{H(X(t,void 0,!1))},Ae);let{files:ae,folders:Ue}=kt(v??[],t),Me=(0,_.useMemo)(()=>{let p=new Set;for(let F of ae)for(let A of Object.keys(F.customMetadata??{}))p.add(A);return[...p].toSorted((F,A)=>F.localeCompare(A))},[ae]),ne=xt(ae,S,x),ce=(0,_.useMemo)(()=>[...new Set(ne.map(p=>p.key))].toSorted((p,F)=>p.localeCompare(F)).join(`
3
3
  `),[ne]);(0,_.useEffect)(()=>{let p=ce===""?[]:ce.split(`
4
4
  `);if(p.length===0){K({});return}let F={current:!0};return H((async()=>{try{let A=await s.query(Bt,{keys:p},he(D));F.current&&(K(A.references??{}),z(Object.keys(A.storageColumns??{}).length>0))}catch{F.current&&(K({}),z(!1))}})()),()=>{F.current=!1}},[s,ce,D]);let Ge=g(p=>p.key,"keyOf"),{allSelected:He,clear:le,selected:be,someSelected:Pe,toggle:Ve,toggleAll:We}=Lt(ne,Ge),Ze=g(()=>{r(o),le(),H(X(o,void 0,!1))},"listFirst"),qe=g(()=>{H(X(t,$,!0))},"loadMore"),ye=g(p=>{r(p),u(p),le(),H(X(p,void 0,!1))},"navigate"),Xe=g(p=>{ye(`${t}${p}`)},"enterFolder"),Ye=g(p=>q.signedUrl(p,{expiresInSeconds:jt}),"resolveUrl"),Je=g(()=>{h("list")},"showList"),Qe=g(()=>{h("grid")},"showGrid"),et=g(p=>{i(p)},"onSortKeyChange"),tt=g(()=>{y(p=>p==="asc"?"desc":"asc")},"toggleSortDirection"),st=g(p=>{m(p)},"onThumbSizeChange"),lt=g(p=>{n(p)},"onExpiryChange"),ot=g(()=>{w(void 0),C(!0),H((async()=>{try{for(let p of be)await q.remove(p);await X(t,void 0,!1),le()}catch(p){w(J(p))}finally{C(!1)}})())},"bulkDelete"),nt=g(p=>{w(void 0),H((async()=>{try{let F=await q.signedUrl(p,{expiresInSeconds:c});await Ut(F),E(p)}catch(F){w(J(F))}})())},"onCopy"),rt=g(p=>{w(void 0),H((async()=>{try{let F=await q.signedUrl(p,{expiresInSeconds:c}),A=p.slice(p.lastIndexOf("/")+1)||p;At(F,A)}catch(F){w(J(F))}})())},"onDownload");(0,_.useEffect)(()=>{if(N===void 0)return;let p=globalThis.setTimeout(()=>{E(void 0)},2e3);return()=>{globalThis.clearTimeout(p)}},[N]);let it=g(p=>{w(void 0),C(!0),H((async()=>{try{await q.remove(p),await X(t,void 0,!1)}catch(F){w(J(F))}finally{C(!1)}})())},"onDelete"),at=g(p=>{let F=`${t}${p.name}`;w(void 0),C(!0),H((async()=>{try{let A=await p.arrayBuffer();await q.upload({body:A,contentType:p.type===""?void 0:p.type,key:F}),await X(t,void 0,!1)}catch(A){w(J(A))}finally{C(!1)}})())},"onFile");(0,_.useEffect)(()=>{U(void 0),W(!1)},[D]);let ct=g(()=>{w(void 0),P(!0),H((async()=>{try{let p=[],F;do{let V=await q.list({cursor:F,limit:Ot});for(let re of V.objects)p.push(re.key);F=p.length>=Ke?void 0:V.cursor}while(F!==void 0);if(p.length>=Ke)U([]),W(!0);else{let V=await s.query(It,{liveKeys:p},he(D));U(V.references??[]),W(V.truncated===!0)}}catch(p){U([]),W(!1),w(J(p))}finally{P(!1)}})())},"checkOrphans"),dt=g(p=>{ve(p),r(a??""),u(a??""),b(void 0),le()},"selectBucket");return{allSelected:He,bucket:Z,buckets:Y,bulkDelete:ot,busy:T,checkOrphans:ct,clearSelection:le,copiedKey:N,danglingBusy:M,danglingReferences:L,danglingTruncated:G,draftPrefix:o,enterFolder:Xe,error:k,expiry:c,files:ne,folders:Ue,hasObjects:v!==void 0&&v.length>0,hasStorageColumns:O,listFirst:Ze,loaded:v!==void 0,loadMore:qe,navigate:ye,nextCursor:$,onCopy:nt,onDelete:it,onDownload:rt,onExpiryChange:lt,onFile:at,onSortKeyChange:et,onThumbSizeChange:st,prefix:t,referenceShard:D,references:I,resolveUrl:Ye,selectBucket:dt,selected:be,setDraftPrefix:u,setReferenceShard:B,showGrid:Qe,showList:Je,someSelected:Pe,sortDirection:x,sortKey:S,tagKeys:Me,thumbSize:f,toggleSelect:Ve,toggleSelectAll:We,toggleSortDirection:tt,view:d}},"useFileBrowser"),Gt=100,Le=g(a=>{let e=(0,j.c)(6),{label:s,onNavigate:t,target:r}=a,o;e[0]!==t||e[1]!==r?(o=g(()=>{t(r)},"t1"),e[0]=t,e[1]=r,e[2]=o):o=e[2];let u=o,c;return e[3]!==u||e[4]!==s?(c=(0,l.jsxDEV)("button",{className:"rounded px-1 text-muted-foreground outline-none hover:text-foreground focus-visible:text-foreground",onClick:u,type:"button",children:s},void 0,!1),e[3]=u,e[4]=s,e[5]=c):c=e[5],c},"Crumb"),Ht=g(a=>{let e=(0,j.c)(11),{onNavigate:s,prefix:t,t:r}=a,o;if(e[0]!==s||e[1]!==t||e[2]!==r){let u=t.split("/").filter(Pt),c;e[4]!==r?(c=r("Folder path"),e[4]=r,e[5]=c):c=e[5];let n;e[6]!==r?(n=r("root"),e[6]=r,e[7]=n):n=e[7];let d;e[8]!==s||e[9]!==n?(d=(0,l.jsxDEV)(Le,{label:n,onNavigate:s,target:""},void 0,!1),e[8]=s,e[9]=n,e[10]=d):d=e[10],o=(0,l.jsxDEV)("nav",{"aria-label":c,className:"flex flex-wrap items-center gap-0.5 text-xs","data-testid":"fb-breadcrumbs",children:[d,u.map((h,f)=>(0,l.jsxDEV)("span",{className:"flex items-center gap-0.5",children:[(0,l.jsxDEV)("span",{className:"text-muted-foreground/50",children:"/"},void 0,!1),(0,l.jsxDEV)(Le,{label:h,onNavigate:s,target:`${u.slice(0,f+1).join("/")}/`},void 0,!1)]},`${h}-${f.toString()}`,!0))]},void 0,!0),e[0]=s,e[1]=t,e[2]=r,e[3]=o}else o=e[3];return o},"Breadcrumbs"),as=g(({initialPrefix:a,pageSize:e=Gt})=>{let s=ke(),t=Mt({initialPrefix:a,pageSize:e}),r=(0,_.useRef)(null),{onCopy:o,onDelete:u,onDownload:c,onFile:n,toggleSelect:d}=t,h={onCopy:o,onDelete:u,onDownload:c,onToggleSelect:d},f=g(()=>{r.current?.click()},"onUploadClick"),m=g(i=>{let x=i.target,y=x.files?.[0];x.value="",y&&n(y)},"onFileChange"),S=t.loaded&&!t.hasObjects;return(0,l.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-file-browser",children:[(0,l.jsxDEV)(St,{bucket:t.bucket,buckets:t.buckets,busy:t.busy,draftPrefix:t.draftPrefix,expiry:t.expiry,fileInputRef:r,onBucketChange:t.selectBucket,onExpiryChange:t.onExpiryChange,onFileChange:m,onList:t.listFirst,onPrefixChange:t.setDraftPrefix,onUploadClick:f,t:s},void 0,!1),t.loaded&&(0,l.jsxDEV)(Ht,{onNavigate:t.navigate,prefix:t.prefix,t:s},void 0,!1),t.hasObjects&&(0,l.jsxDEV)(wt,{onSortKeyChange:t.onSortKeyChange,onThumbSizeChange:t.onThumbSizeChange,showGrid:t.showGrid,showList:t.showList,sortDirection:t.sortDirection,sortKey:t.sortKey,t:s,tagKeys:t.tagKeys,thumbSize:t.thumbSize,toggleSortDirection:t.toggleSortDirection,view:t.view},void 0,!1),t.hasStorageColumns&&(0,l.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2","data-testid":"fb-references-shard",children:[(0,l.jsxDEV)("label",{className:"text-xs text-muted-foreground",htmlFor:"fb-reference-shard-input",children:s("References shard")},void 0,!1),(0,l.jsxDEV)(Ne,{id:"fb-reference-shard-input",onChange:t.setReferenceShard,testId:"fb-reference-shard-input",value:t.referenceShard},void 0,!1),(0,l.jsxDEV)("span",{className:"text-xs text-muted-foreground",children:s("Which shard's records are checked for references to these files. Empty = root shard.")},void 0,!1)]},void 0,!0),t.hasStorageColumns&&(0,l.jsxDEV)(Kt,{busy:t.danglingBusy,onCheck:t.checkOrphans,references:t.danglingReferences,t:s,truncated:t.danglingTruncated},void 0,!1),t.selected.size>0&&(0,l.jsxDEV)(De,{count:t.selected.size,editable:!0,onClear:t.clearSelection,onDelete:t.bulkDelete},void 0,!1),t.error!==void 0&&(0,l.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"storage-error",role:"alert",children:t.error},void 0,!1),S&&(0,l.jsxDEV)(fe,{description:s("Objects you upload to your R2 buckets will appear here."),icon:(0,l.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,l.jsxDEV)("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z"},void 0,!1),(0,l.jsxDEV)("path",{d:"M12 11v5m-2.5-2.5h5"},void 0,!1)]},void 0,!0),testId:"fb-empty",title:s("No objects.")},void 0,!1),t.hasObjects&&t.view==="list"&&(0,l.jsxDEV)(vt,{allSelected:t.allSelected,busy:t.busy,copiedKey:t.copiedKey,files:t.files,folders:t.folders,handlers:h,onEnterFolder:t.enterFolder,prefix:t.prefix,references:t.references,selected:t.selected,showReferences:t.hasStorageColumns,someSelected:t.someSelected,t:s,toggleSelectAll:t.toggleSelectAll},void 0,!1),t.hasObjects&&t.view==="grid"&&(0,l.jsxDEV)(Rt,{busy:t.busy,copiedKey:t.copiedKey,files:t.files,folders:t.folders,handlers:h,onEnterFolder:t.enterFolder,prefix:t.prefix,references:t.references,resolveUrl:t.resolveUrl,selected:t.selected,showReferences:t.hasStorageColumns,size:t.thumbSize,t:s},void 0,!1),t.nextCursor!==void 0&&(0,l.jsxDEV)("div",{children:(0,l.jsxDEV)(ee,{"data-testid":"fb-next",disabled:t.busy,onClick:t.loadMore,size:"sm",type:"button",variant:"outline",children:s("Load more")},void 0,!1)},void 0,!1)]},void 0,!0)},"FileBrowser");function Pt(a){return a!==""}g(Pt,"_temp");export{as as FileBrowser};
@@ -1,4 +1,4 @@
1
- import{a as De,b as X,c as ve}from"./chunk-4H2OJBXO.js";import{a as Oe}from"./chunk-6GFEVKJP.js";import{a as Me}from"./chunk-7VF3IAAW.js";import"./chunk-PN5NCZDX.js";import"./chunk-QBAT52GB.js";import"./chunk-QAFAJBAW.js";import"./chunk-AHILM3ZP.js";import"./chunk-764T6X6X.js";import"./chunk-XUGSA2NG.js";import"./chunk-5OIBXYZM.js";import"./chunk-55YA7ZZI.js";import"./chunk-BJGBHGK3.js";import"./chunk-UII66UVF.js";import"./chunk-TDL7NEWA.js";import"./chunk-KEGAWN6Y.js";import{a as Ee}from"./chunk-XNJNSCLM.js";import{a as qe,b as Ie,c as Re,d as he,e as Le,f as Ae}from"./chunk-GTM65MVX.js";import"./chunk-4QHKBC77.js";import{a as we}from"./chunk-K3GNLVYK.js";import{b as ke}from"./chunk-TBMYIZIO.js";import"./chunk-3CJW6NWG.js";import"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as re}from"./chunk-AQGOX5DK.js";import"./chunk-CKSHCYGC.js";import{f as be}from"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as G,e as se,f as le,g as Te,k as V}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as r,e as pe,f as Ct,g as Tt,h as kt,j as ne}from"./chunk-RRCPZMC2.js";var Y=pe(Tt(),1);var q=pe(Ct(),1);var s=pe(kt(),1);var wt=["ORDER BY","GROUP BY","LEFT JOIN","RIGHT JOIN","INNER JOIN","OUTER JOIN","CROSS JOIN","EXPLAIN QUERY PLAN","SELECT","DISTINCT","FROM","WHERE","HAVING","LIMIT","OFFSET","JOIN","ON","AND","OR","AS","ASC","DESC","WITH","UNION","EXPLAIN"],Et=["FROM","WHERE","ORDER BY","GROUP BY","HAVING","LIMIT","OFFSET","UNION","JOIN","LEFT JOIN","RIGHT JOIN","INNER JOIN","OUTER JOIN","CROSS JOIN"],ae=String.fromCodePoint(0),qt=new RegExp(`${ae}${String.raw`(\d+)`}${ae}`,"gu"),It=wt.map(n=>({pattern:new RegExp(String.raw`\b${n.replaceAll(" ",String.raw`\s+`)}\b`,"giu"),replacement:n})),Rt=Et.map(n=>({pattern:new RegExp(String.raw`\s+${n.replaceAll(" ",String.raw`\s+`)}\b`,"gu"),replacement:`
1
+ import{a as De,b as X,c as ve}from"./chunk-4H2OJBXO.js";import{a as Oe}from"./chunk-6GFEVKJP.js";import{a as Me}from"./chunk-7VF3IAAW.js";import"./chunk-PN5NCZDX.js";import"./chunk-QBAT52GB.js";import"./chunk-QAFAJBAW.js";import"./chunk-AHILM3ZP.js";import"./chunk-764T6X6X.js";import"./chunk-XUGSA2NG.js";import"./chunk-5OIBXYZM.js";import"./chunk-55YA7ZZI.js";import"./chunk-BJGBHGK3.js";import"./chunk-UII66UVF.js";import"./chunk-TDL7NEWA.js";import"./chunk-KEGAWN6Y.js";import{a as Ee}from"./chunk-XNJNSCLM.js";import{a as qe,b as Ie,c as Re,d as he,e as Le,f as Ae}from"./chunk-GTM65MVX.js";import"./chunk-4QHKBC77.js";import{a as we}from"./chunk-K3GNLVYK.js";import{b as ke}from"./chunk-TBMYIZIO.js";import"./chunk-3CJW6NWG.js";import"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as re}from"./chunk-BOXSWNXZ.js";import"./chunk-CKSHCYGC.js";import{f as be}from"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as G,e as se,f as le,g as Te,k as V}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as r,e as pe,f as Ct,g as Tt,h as kt,j as ne}from"./chunk-RRCPZMC2.js";var Y=pe(Tt(),1);var q=pe(Ct(),1);var s=pe(kt(),1);var wt=["ORDER BY","GROUP BY","LEFT JOIN","RIGHT JOIN","INNER JOIN","OUTER JOIN","CROSS JOIN","EXPLAIN QUERY PLAN","SELECT","DISTINCT","FROM","WHERE","HAVING","LIMIT","OFFSET","JOIN","ON","AND","OR","AS","ASC","DESC","WITH","UNION","EXPLAIN"],Et=["FROM","WHERE","ORDER BY","GROUP BY","HAVING","LIMIT","OFFSET","UNION","JOIN","LEFT JOIN","RIGHT JOIN","INNER JOIN","OUTER JOIN","CROSS JOIN"],ae=String.fromCodePoint(0),qt=new RegExp(`${ae}${String.raw`(\d+)`}${ae}`,"gu"),It=wt.map(n=>({pattern:new RegExp(String.raw`\b${n.replaceAll(" ",String.raw`\s+`)}\b`,"giu"),replacement:n})),Rt=Et.map(n=>({pattern:new RegExp(String.raw`\s+${n.replaceAll(" ",String.raw`\s+`)}\b`,"gu"),replacement:`
2
2
  ${n}`})),Lt=r(n=>{let e=[],t=n.replaceAll(/'(?:[^']|'')*'/gu,l=>(e.push(l),`${ae}${(e.length-1).toString()}${ae}`)).replaceAll(/\s+/gu," ").trim();for(let{pattern:l,replacement:a}of It)t=t.replaceAll(l,a);for(let{pattern:l,replacement:a}of Rt)t=t.replaceAll(l,a);return t=t.replaceAll(qt,(l,a)=>e[Number(a)]??""),t},"formatSql"),ie=8,At=["AND","ASC","AS","BY","COUNT","DESC","DISTINCT","EXPLAIN","FROM","GROUP","HAVING","INNER","JOIN","LEFT","LIKE","LIMIT","NOT","NULL","OFFSET","ON","ORDER","OR","QUERY","SELECT","WHERE","WITH"],Ot=new Set(["AND","BY","HAVING","ON","OR","SELECT","WHERE"]),Mt=/[\w$]/,Pe=r(n=>n!==void 0&&Mt.test(n),"isWordChar"),_e=r(n=>{let e=n.length;for(;e>0&&Pe(n[e-1]);)e-=1;return n.slice(e)},"trailingWord"),He=r((n,e)=>{let o=e;for(;o>0&&Pe(n[o-1]);)o-=1;return{end:e,start:o,text:n.slice(o,e)}},"tokenAt"),$e=r((n,e)=>{let o=n.slice(0,e).trimEnd();return o.endsWith(".")||Ot.has(_e(o).toUpperCase())},"prefersColumns"),Dt=r((n,e)=>{let o=n.slice(0,e);if(!o.endsWith("."))return;let t=_e(o.slice(0,-1));return t===""?void 0:t},"qualifierTable"),Ne=r((n,e)=>n.toLowerCase().startsWith(e.toLowerCase()),"matches"),Be=r((n,e,o,t)=>{let l=[];for(let a of n)if(Ne(a,e)&&(l.push(t(a)),l.length>=o))break;return l},"takeMatches"),$t=r((n,e,o)=>{let t=new Map;for(let[l,a]of Object.entries(n.columns))for(let d of a)if(Ne(d,e)&&!t.has(d)&&(t.set(d,l),t.size>=o))return[...t].map(([m,c])=>({detail:c,kind:"column",label:m}));return[...t].map(([l,a])=>({detail:a,kind:"column",label:l}))},"takeColumnMatches"),Bt=r((n,e,o)=>{let t=He(n,e),l=Dt(n,t.start);if(l!==void 0){let u=o.columns[l]??o.columns[l.toLowerCase()]??[];return Be(u,t.text,ie,y=>({detail:l,kind:"column",label:y}))}if(t.text===""&&!$e(n,t.start))return[];let a=Be(o.tables,t.text,ie,u=>({kind:"table",label:u})),d=$t(o,t.text,ie),m=At.filter(u=>t.text!==""&&Ne(u,t.text)&&u.toLowerCase()!==t.text.toLowerCase()).map(u=>({kind:"keyword",label:u}));return($e(n,t.start)?[...d,...a,...m]:[...a,...d,...m]).slice(0,ie)},"suggestionsFor"),Pt=r((n,e,o)=>{let t=He(n,e),l=n.slice(0,t.start)+o.label+n.slice(t.end);return{caret:t.start+o.label.length,value:l}},"acceptSuggestion"),_t=["boxSizing","borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textTransform","width","wordSpacing"],Ht=r((n,e)=>{let o=globalThis.getComputedStyle(n),t=globalThis.document.createElement("div"),{style:l}=t;l.position="absolute",l.visibility="hidden",l.whiteSpace="pre-wrap",l.overflowWrap="break-word";for(let c of _t)l[c]=o[c];t.textContent=n.value.slice(0,Math.max(0,e));let a=globalThis.document.createElement("span");a.textContent=n.value.slice(Math.max(0,e))||".",t.append(a),globalThis.document.body.append(t);let d=a.offsetLeft-n.scrollLeft,m=a.offsetTop-n.scrollTop;return t.remove(),{left:d,top:m}},"caretOffset"),Wt=r((n,e,o)=>{let t=(0,Y.c)(13),[l,a]=(0,q.useState)(null),d;t[0]!==n||t[1]!==e?(d=r((N,x)=>{let S=Bt(N,x,n);if(S.length===0){a(null);return}let h=e.current,{left:w,top:T}=h===null?{left:0,top:0}:Ht(h,x);a({active:0,left:w,suggestions:S,top:T})},"t0"),t[0]=n,t[1]=e,t[2]=d):d=t[2];let m=d,c;t[3]===Symbol.for("react.memo_cache_sentinel")?(c=r(()=>{a(null)},"t1"),t[3]=c):c=t[3];let u=c,y;t[4]===Symbol.for("react.memo_cache_sentinel")?(y=r(N=>{a(x=>{if(x===null)return x;let S=x.suggestions.length,h=(x.active+N+S)%S;return{...x,active:h}})},"t2"),t[4]=y):y=t[4];let g=y,v;t[5]!==o||t[6]!==l||t[7]!==e?(v=r(()=>{let N=e.current;if(l===null||N===null)return!1;let x=l.suggestions[l.active];if(x===void 0)return!1;let S=Pt(N.value,N.selectionStart,x);return o(S.value),a(null),requestAnimationFrame(()=>{let h=e.current;h!==null&&(h.focus(),h.setSelectionRange(S.caret,S.caret))}),!0},"t3"),t[5]=o,t[6]=l,t[7]=e,t[8]=v):v=t[8];let p=v,f;return t[9]!==p||t[10]!==m||t[11]!==l?(f={close:u,commit:p,move:g,refresh:m,state:l},t[9]=p,t[10]=m,t[11]=l,t[12]=f):f=t[12],f},"useSqlAutocomplete"),Ft={column:"column",keyword:"keyword",table:"table"},zt=20,Ut=r(n=>{let e=(0,Y.c)(17),{listboxId:o,onPick:t,state:l}=n,a=G(),d;e[0]!==l?(d=l===null?void 0:{left:l.left,top:l.top+zt},e[0]=l,e[1]=d):d=e[1];let m=d;if(l===null)return null;let c;if(e[2]!==o||e[3]!==t||e[4]!==l.active||e[5]!==l.suggestions||e[6]!==a){let y;e[8]!==o||e[9]!==t||e[10]!==l.active||e[11]!==a?(y=r((g,v)=>(0,s.jsxDEV)("li",{"aria-selected":v===l.active,className:ne("flex cursor-pointer items-center gap-2 px-2 py-1 text-[13px]",v===l.active?"bg-accent text-accent-foreground":"text-foreground"),"data-testid":"sql-autocomplete-item",id:`${o}-opt-${v.toString()}`,onMouseDown:r(p=>{p.preventDefault(),t(v)},"onMouseDown"),role:"option",children:[(0,s.jsxDEV)("span",{className:"truncate font-mono",children:g.label},void 0,!1),g.detail!==void 0&&(0,s.jsxDEV)("span",{className:"ms-auto truncate text-xs text-muted-foreground",children:g.detail},void 0,!1),(0,s.jsxDEV)("span",{className:"shrink-0 font-mono text-[10px] tracking-wide text-muted-foreground/70 uppercase",children:a(Ft[g.kind])},void 0,!1)]},`${g.kind}:${g.label}`,!0),"t32"),e[8]=o,e[9]=t,e[10]=l.active,e[11]=a,e[12]=y):y=e[12],c=l.suggestions.map(y),e[2]=o,e[3]=t,e[4]=l.active,e[5]=l.suggestions,e[6]=a,e[7]=c}else c=e[7];let u;return e[13]!==o||e[14]!==m||e[15]!==c?(u=(0,s.jsxDEV)("ul",{className:"absolute z-30 max-h-56 w-72 overflow-auto rounded-md border border-border bg-popover py-1 text-popover-foreground shadow-md","data-testid":"sql-autocomplete",id:o,role:"listbox",style:m,children:c},void 0,!1),e[13]=o,e[14]=m,e[15]=c,e[16]=u):u=e[16],u},"AutocompletePopover"),We=[{label:"List tables",sql:"SELECT name FROM sqlite_master WHERE type = 'table' ORDER BY name;"},{label:"Table row count",sql:"SELECT COUNT(*) AS rows FROM messages;"},{label:"Recent rows",sql:"SELECT id, _creationTime, __doc__ FROM messages ORDER BY _creationTime DESC LIMIT 50;"},{label:"Index list",sql:"SELECT name, tbl_name FROM sqlite_master WHERE type = 'index' ORDER BY tbl_name;"}],Yt=r(n=>{let e=(0,Y.c)(29),{active:o,onDelete:t,onSelect:l,query:a}=n,d=G(),m;e[0]!==l||e[1]!==a.id?(m=r(()=>{l(a.id)},"t1"),e[0]=l,e[1]=a.id,e[2]=m):m=e[2];let c=m,u;e[3]!==t||e[4]!==a.id?(u=r(O=>{O.stopPropagation(),t(a.id)},"t2"),e[3]=t,e[4]=a.id,e[5]=u):u=e[5];let y=u,g=o?"bg-sidebar-accent font-medium text-foreground":"text-muted-foreground",v;e[6]!==g?(v=ne("flex min-w-0 flex-1 items-center gap-2 rounded-md px-2 py-1.5 text-start text-[13px] outline-none transition-colors hover:bg-sidebar-accent focus-visible:bg-sidebar-accent",g),e[6]=g,e[7]=v):v=e[7];let p=`sql-query-${a.id}`,f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=(0,s.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3.5 shrink-0 opacity-70",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,s.jsxDEV)("path",{d:"M4 6h16M4 12h10M4 18h7"},void 0,!1)},void 0,!1),e[8]=f):f=e[8];let N;e[9]!==a.name?(N=(0,s.jsxDEV)("span",{className:"truncate",children:a.name},void 0,!1),e[9]=a.name,e[10]=N):N=e[10];let x;e[11]!==o||e[12]!==c||e[13]!==v||e[14]!==p||e[15]!==N?(x=(0,s.jsxDEV)("button",{"aria-pressed":o,className:v,"data-testid":p,onClick:c,type:"button",children:[f,N]},void 0,!0),e[11]=o,e[12]=c,e[13]=v,e[14]=p,e[15]=N,e[16]=x):x=e[16];let S;e[17]!==d?(S=d("Delete query"),e[17]=d,e[18]=S):S=e[18];let h;e[19]!==d?(h=d("Delete query"),e[19]=d,e[20]=h):h=e[20];let w;e[21]===Symbol.for("react.memo_cache_sentinel")?(w=(0,s.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,s.jsxDEV)("path",{d:"M5 7h14M9 7V5h6v2m-1 0v12H10V7M7 7v13h10V7"},void 0,!1)},void 0,!1),e[21]=w):w=e[21];let T;e[22]!==y||e[23]!==h||e[24]!==S?(T=(0,s.jsxDEV)("button",{"aria-label":S,className:"me-1 hidden size-6 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-destructive/10 hover:text-destructive group-hover/q:flex",onClick:y,title:h,type:"button",children:w},void 0,!1),e[22]=y,e[23]=h,e[24]=S,e[25]=T):T=e[25];let R;return e[26]!==T||e[27]!==x?(R=(0,s.jsxDEV)("li",{className:"group/q flex items-center",children:[x,T]},void 0,!0),e[26]=T,e[27]=x,e[28]=R):R=e[28],R},"QueryRow"),jt=r(n=>{let e=(0,Y.c)(58),{activeId:o,history:t,listRef:l,onClearHistory:a,onDelete:d,onLoadHistory:m,onLoadTemplate:c,onNew:u,onSearchChange:y,onSelect:g,queries:v,search:p}=n,f=G(),N;if(e[0]!==v||e[1]!==p){let k=p.trim().toLowerCase();N=k===""?[...v]:v.filter(j=>j.name.toLowerCase().includes(k)),e[0]=v,e[1]=p,e[2]=N}else N=e[2];let x=N,S;e[3]!==f?(S=f("Search queries\u2026"),e[3]=f,e[4]=S):S=e[4];let h;e[5]!==y||e[6]!==p||e[7]!==S?(h=(0,s.jsxDEV)("input",{className:"h-8 min-w-0 flex-1 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"sql-search",onChange:y,placeholder:S,type:"text",value:p},void 0,!1),e[5]=y,e[6]=p,e[7]=S,e[8]=h):h=e[8];let w;e[9]!==f?(w=f("New query"),e[9]=f,e[10]=w):w=e[10];let T;e[11]!==f?(T=f("New query"),e[11]=f,e[12]=T):T=e[12];let R;e[13]===Symbol.for("react.memo_cache_sentinel")?(R=(0,s.jsxDEV)("svg",{"aria-hidden":"true",className:"size-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.7,viewBox:"0 0 24 24",children:(0,s.jsxDEV)("path",{d:"M12 5v14M5 12h14"},void 0,!1)},void 0,!1),e[13]=R):R=e[13];let O;e[14]!==u||e[15]!==w||e[16]!==T?(O=(0,s.jsxDEV)("button",{"aria-label":w,className:"flex size-8 shrink-0 items-center justify-center rounded-md border border-border text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"sql-new",onClick:u,title:T,type:"button",children:R},void 0,!1),e[14]=u,e[15]=w,e[16]=T,e[17]=O):O=e[17];let A;e[18]!==h||e[19]!==O?(A=(0,s.jsxDEV)("div",{className:"flex shrink-0 items-center gap-2 border-b border-border p-2",children:[h,O]},void 0,!0),e[18]=h,e[19]=O,e[20]=A):A=e[20];let M;e[21]!==f?(M=f("Private"),e[21]=f,e[22]=M):M=e[22];let z;e[23]!==M?(z=(0,s.jsxDEV)("p",{className:"px-1 pb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:M},void 0,!1),e[23]=M,e[24]=z):z=e[24];let B;e[25]!==o||e[26]!==x||e[27]!==l||e[28]!==d||e[29]!==g||e[30]!==f?(B=x.length===0?(0,s.jsxDEV)("p",{className:"px-1 py-2 text-xs text-muted-foreground","data-testid":"sql-private-empty",children:f("No saved queries yet \u2014 they save to this browser as you type.")},void 0,!1):(0,s.jsxDEV)("ul",{className:"flex flex-col gap-px","data-testid":"sql-private",ref:l,children:x.map(k=>(0,s.jsxDEV)(Yt,{active:o===k.id,onDelete:d,onSelect:g,query:k},k.id,!1))},void 0,!1),e[25]=o,e[26]=x,e[27]=l,e[28]=d,e[29]=g,e[30]=f,e[31]=B):B=e[31];let P;e[32]!==z||e[33]!==B?(P=(0,s.jsxDEV)("div",{children:[z,B]},void 0,!0),e[32]=z,e[33]=B,e[34]=P):P=e[34];let H;e[35]!==f?(H=f("Reference"),e[35]=f,e[36]=H):H=e[36];let U;e[37]!==H?(U=(0,s.jsxDEV)("p",{className:"px-1 pb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:H},void 0,!1),e[37]=H,e[38]=U):U=e[38];let I;e[39]!==c?(I=We.map(k=>(0,s.jsxDEV)("li",{children:(0,s.jsxDEV)("button",{className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-start text-[13px] text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-foreground focus-visible:bg-sidebar-accent","data-sql":k.sql,onClick:c,type:"button",children:[(0,s.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3.5 shrink-0 opacity-70",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,s.jsxDEV)("path",{d:"M7 4h7l4 4v12H7zM14 4v4h4"},void 0,!1)},void 0,!1),k.label]},void 0,!0)},k.label,!1)),e[39]=c,e[40]=I):I=e[40];let L;e[41]!==I?(L=(0,s.jsxDEV)("ul",{className:"flex flex-col gap-px",children:I},void 0,!1),e[41]=I,e[42]=L):L=e[42];let D;e[43]!==U||e[44]!==L?(D=(0,s.jsxDEV)("div",{children:[U,L]},void 0,!0),e[43]=U,e[44]=L,e[45]=D):D=e[45];let _;e[46]!==t||e[47]!==a||e[48]!==m||e[49]!==f?(_=t.length>0&&(0,s.jsxDEV)("div",{children:[(0,s.jsxDEV)("div",{className:"flex items-center justify-between px-1 pb-1",children:[(0,s.jsxDEV)("p",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:f("History")},void 0,!1),(0,s.jsxDEV)("button",{className:"rounded px-1 text-[11px] text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:text-foreground","data-testid":"sql-history-clear",onClick:a,type:"button",children:f("Clear history")},void 0,!1)]},void 0,!0),(0,s.jsxDEV)("ul",{className:"flex flex-col gap-px","data-testid":"sql-history",children:t.map(k=>(0,s.jsxDEV)("li",{children:(0,s.jsxDEV)("button",{className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-start text-[13px] text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-foreground focus-visible:bg-sidebar-accent","data-sql":k.sql,"data-testid":"sql-history-item",onClick:m,title:k.sql,type:"button",children:[(0,s.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3.5 shrink-0 opacity-70",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,s.jsxDEV)("path",{d:"M12 8v4l3 2M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18Z"},void 0,!1)},void 0,!1),(0,s.jsxDEV)("span",{className:"truncate font-mono",children:k.sql},void 0,!1)]},void 0,!0)},`${k.at.toString()}:${k.sql}`,!1))},void 0,!1)]},void 0,!0),e[46]=t,e[47]=a,e[48]=m,e[49]=f,e[50]=_):_=e[50];let $;e[51]!==P||e[52]!==D||e[53]!==_?($=(0,s.jsxDEV)("div",{className:"flex flex-1 flex-col gap-4 overflow-y-auto p-2",children:[P,D,_]},void 0,!0),e[51]=P,e[52]=D,e[53]=_,e[54]=$):$=e[54];let E;return e[55]!==$||e[56]!==A?(E=(0,s.jsxDEV)("aside",{className:"flex h-full w-64 shrink-0 flex-col border-e border-border bg-sidebar",children:[A,$]},void 0,!0),e[55]=$,e[56]=A,e[57]=E):E=e[57],E},"SqlQuerySidebar"),Kt=se(re.listTables),Gt=se(re.readTablePage),Jt=r(n=>{let e=(0,Y.c)(16),o=be(),t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=[],e[0]=t):t=e[0];let[l,a]=(0,q.useState)(t),d;e[1]===Symbol.for("react.memo_cache_sentinel")?(d={},e[1]=d):d=e[1];let[m,c]=(0,q.useState)(d),u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=new Set,e[2]=u):u=e[2];let y=(0,q.useRef)(u),g,v;e[3]!==o||e[4]!==n?(g=r(()=>{let h={cancelled:!1};return V(r(async()=>{try{let T=await o.query(Kt,{},le(n));h.cancelled||(a(T.map(Vt)),c({}),y.current=new Set)}catch{h.cancelled||(a([]),c({}),y.current=new Set)}},"load")()),()=>{h.cancelled=!0}},"t3"),v=[o,n],e[3]=o,e[4]=n,e[5]=g,e[6]=v):(g=e[5],v=e[6]),(0,q.useEffect)(g,v);let p;e[7]!==o||e[8]!==n?(p=r(h=>{if(y.current.has(h))return;y.current.add(h),V(r(async()=>{try{let T=await o.query(Gt,{limit:1,offset:0,table:h},le(n));c(R=>({...R,[h]:T.columns}))}catch{y.current.delete(h)}},"fetchColumns")())},"t5"),e[7]=o,e[8]=n,e[9]=p):p=e[9];let f=p,N;e[10]!==m||e[11]!==l?(N={columns:m,tables:l},e[10]=m,e[11]=l,e[12]=N):N=e[12];let x=N,S;return e[13]!==f||e[14]!==x?(S={probe:f,schema:x},e[13]=f,e[14]=x,e[15]=S):S=e[15],S},"useSqlSchema"),ge=/\b(?:from|join|update|into)\s+([a-z_][\w$]*)|\b([a-z_][\w$]*)\s*\./gi,Qt=r(n=>{let e=new Set;ge.lastIndex=0;let o=ge.exec(n);for(;o!==null;)e.add(o[1]??o[2]),o=ge.exec(n);return[...e]},"referencedTables");function Vt(n){return n.name}r(Vt,"_temp$2");var Xt="lunora-studio-sql-tabs",Zt="lunora-studio-sql-active-tab",ye=12,Z=r((n="",e="")=>({activeId:null,id:ve("tab"),name:e,sql:n}),"makeTab"),eo=r(()=>{let n=(0,Y.c)(5),[e,o]=X(Zt),t;n[0]!==o?(t=r(m=>{o(c=>{let u=c[0]??"";return[typeof m=="function"?m(u):m]})},"t0"),n[0]=o,n[1]=t):t=n[1];let l=t,a=e[0]??"",d;return n[2]!==l||n[3]!==a?(d=[a,l],n[2]=l,n[3]=a,n[4]=d):d=n[4],d},"usePersistedActive"),to=r(n=>{let[e,o]=X(Xt),[t,l]=eo(),a=(0,q.useRef)(null);e.length===0&&a.current===null&&(a.current=n()),(0,q.useEffect)(()=>{if(e.length===0&&a.current!==null){let c=a.current;o([c])}},[o,e.length]);let d=e.length===0&&a.current!==null?[a.current]:e;return{activeId:d.some(c=>c.id===t)?t:d[0]?.id??"",setActiveId:l,setTabs:o,tabs:d}},"usePersistedTabs"),Fe=r(n=>n.activeId===null&&n.sql.trim()!=="","isDirty"),oo=r((n,e)=>[...n,e].slice(-ye),"addTab"),no=r((n,e,o)=>{let t=n.findIndex(d=>d.id===e);if(t===-1)return{activeId:n[0]?.id??"",tabs:[...n]};let l=n.filter(d=>d.id!==e);if(l.length===0){let d=o();return{activeId:d.id,tabs:[d]}}return{activeId:l[Math.min(t,l.length-1)].id,tabs:l}},"closeTab"),so=r((n,e)=>{let o=n.filter(t=>t.id===e);return o.length===0?{activeId:n[0]?.id??"",tabs:[...n]}:{activeId:e,tabs:o}},"closeOtherTabs"),lo=r((n,e,o)=>{let t=n.findIndex(a=>a.id===e);if(t===-1)return{activeId:o,tabs:[...n]};let l=n.slice(0,t+1);return{activeId:l.some(a=>a.id===o)?o:e,tabs:l}},"closeTabsToRight"),ro=r(n=>{let e=n();return{activeId:e.id,tabs:[e]}},"closeAllTabs"),io=r((n,e,o)=>{if(n==="others")return e.filter(t=>t.id!==o);if(n==="right"){let t=e.findIndex(l=>l.id===o);return t===-1?[]:e.slice(t+1)}return[...e]},"tabsClosedBy"),ao=r((n,e)=>n.trim()===""?e:(n.split(`
3
3
  `)[0]??n).slice(0,24),"derivedTabLabel"),co=r(n=>{let e=(0,Y.c)(14),{initial:o,onCancel:t,onCommit:l,placeholder:a,testId:d}=n,m=G(),c=mo,u;e[0]!==l?(u=r(N=>{l(N.currentTarget.value.trim())},"t1"),e[0]=l,e[1]=u):u=e[1];let y=u,g;e[2]!==t||e[3]!==l?(g=r(N=>{N.key==="Enter"?l(N.currentTarget.value.trim()):N.key==="Escape"&&t()},"t2"),e[2]=t,e[3]=l,e[4]=g):g=e[4];let v=g,p;e[5]!==m?(p=m("Tab title"),e[5]=m,e[6]=p):p=e[6];let f;return e[7]!==o||e[8]!==y||e[9]!==v||e[10]!==a||e[11]!==p||e[12]!==d?(f=(0,s.jsxDEV)("input",{"aria-label":p,className:"w-40 rounded border border-ring bg-background px-1 py-0.5 text-xs outline-none","data-testid":d,defaultValue:o,onBlur:y,onKeyDown:v,placeholder:a,ref:c,type:"text"},void 0,!1),e[7]=o,e[8]=y,e[9]=v,e[10]=a,e[11]=p,e[12]=d,e[13]=f):f=e[13],f},"TabRenameInput"),uo=r(n=>{let e=(0,Y.c)(29),{idBase:o,onDiscard:t,onKeep:l}=n,a=G(),d=`sql-tab-close-prompt-${o}`,m;e[0]!==a?(m=a("Discard?"),e[0]=a,e[1]=m):m=e[1];let c;e[2]!==m?(c=(0,s.jsxDEV)("span",{className:"text-[11px] text-muted-foreground",children:m},void 0,!1),e[2]=m,e[3]=c):c=e[3];let u;e[4]!==a?(u=a("Discard changes"),e[4]=a,e[5]=u):u=e[5];let y=`sql-tab-close-confirm-${o}`,g;e[6]!==a?(g=a("Discard changes"),e[6]=a,e[7]=g):g=e[7];let v;e[8]===Symbol.for("react.memo_cache_sentinel")?(v=(0,s.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.4,viewBox:"0 0 24 24",children:(0,s.jsxDEV)("path",{d:"M5 13l4 4L19 7"},void 0,!1)},void 0,!1),e[8]=v):v=e[8];let p;e[9]!==t||e[10]!==u||e[11]!==y||e[12]!==g?(p=(0,s.jsxDEV)("button",{"aria-label":u,className:"flex size-5 items-center justify-center rounded text-destructive hover:bg-destructive/10","data-testid":y,onClick:t,title:g,type:"button",children:v},void 0,!1),e[9]=t,e[10]=u,e[11]=y,e[12]=g,e[13]=p):p=e[13];let f;e[14]!==a?(f=a("Keep editing"),e[14]=a,e[15]=f):f=e[15];let N=`sql-tab-close-cancel-${o}`,x;e[16]!==a?(x=a("Keep editing"),e[16]=a,e[17]=x):x=e[17];let S;e[18]===Symbol.for("react.memo_cache_sentinel")?(S=(0,s.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.4,viewBox:"0 0 24 24",children:(0,s.jsxDEV)("path",{d:"M6 6l12 12M18 6 6 18"},void 0,!1)},void 0,!1),e[18]=S):S=e[18];let h;e[19]!==l||e[20]!==N||e[21]!==x||e[22]!==f?(h=(0,s.jsxDEV)("button",{"aria-label":f,className:"flex size-5 items-center justify-center rounded text-muted-foreground hover:bg-accent","data-testid":N,onClick:l,title:x,type:"button",children:S},void 0,!1),e[19]=l,e[20]=N,e[21]=x,e[22]=f,e[23]=h):h=e[23];let w;return e[24]!==d||e[25]!==h||e[26]!==c||e[27]!==p?(w=(0,s.jsxDEV)("span",{className:"flex shrink-0 items-center gap-1","data-testid":d,role:"group",children:[c,p,h]},void 0,!0),e[24]=d,e[25]=h,e[26]=c,e[27]=p,e[28]=w):w=e[28],w},"TabCloseConfirm"),fo=r(n=>{let e=(0,Y.c)(47),{active:o,canClose:t,onClose:l,onMenu:a,onRename:d,onSelect:m,tab:c}=n,u=G(),[y,g]=(0,q.useState)(!1),[v,p]=(0,q.useState)(!1),f;e[0]!==a||e[1]!==c.id?(f=r(W=>{a(c.id,W)},"t1"),e[0]=a,e[1]=c.id,e[2]=f):f=e[2];let N=f,x;e[3]!==m||e[4]!==c.id?(x=r(()=>{m(c.id)},"t2"),e[3]=m,e[4]=c.id,e[5]=x):x=e[5];let S=x,h;e[6]===Symbol.for("react.memo_cache_sentinel")?(h=r(()=>{g(!0)},"t3"),e[6]=h):h=e[6];let w=h,T;e[7]!==l||e[8]!==c?(T=r(W=>{W.stopPropagation(),Fe(c)?p(!0):l(c.id)},"t4"),e[7]=l,e[8]=c,e[9]=T):T=e[9];let R=T,O;e[10]!==l||e[11]!==c.id?(O=r(W=>{W.stopPropagation(),p(!1),l(c.id)},"t5"),e[10]=l,e[11]=c.id,e[12]=O):O=e[12];let A=O,M;e[13]===Symbol.for("react.memo_cache_sentinel")?(M=r(W=>{W.stopPropagation(),p(!1)},"t6"),e[13]=M):M=e[13];let z=M,B;e[14]!==d||e[15]!==c.id?(B=r(W=>{d(c.id,W),g(!1)},"t7"),e[14]=d,e[15]=c.id,e[16]=B):B=e[16];let P=B,H;e[17]===Symbol.for("react.memo_cache_sentinel")?(H=r(()=>{g(!1)},"t8"),e[17]=H):H=e[17];let U=H,I;e[18]!==c.name?(I=c.name.trim(),e[18]=c.name,e[19]=I):I=e[19];let L=I,D;e[20]!==u||e[21]!==c.sql?(D=ao(c.sql,u("Untitled")),e[20]=u,e[21]=c.sql,e[22]=D):D=e[22];let _=D,$=o?"bg-background text-foreground":"bg-muted/40 text-muted-foreground hover:text-foreground",E;e[23]!==$?(E=ne("group/tab flex shrink-0 items-center gap-1 border-e border-border ps-3 pe-1.5 text-xs",$),e[23]=$,e[24]=E):E=e[24];let k=`sql-tab-${c.id}`,j;e[25]!==o||e[26]!==P||e[27]!==L||e[28]!==_||e[29]!==y||e[30]!==S||e[31]!==u||e[32]!==c.id?(j=y?(0,s.jsxDEV)(co,{initial:L,onCancel:U,onCommit:P,placeholder:_,testId:`sql-tab-rename-${c.id}`},void 0,!1):(0,s.jsxDEV)("button",{"aria-pressed":o,className:"max-w-40 truncate py-1.5 outline-none","data-testid":`sql-tab-select-${c.id}`,onClick:S,onDoubleClick:w,title:u("Double-click to rename"),type:"button",children:L===""?_:L},void 0,!1),e[25]=o,e[26]=P,e[27]=L,e[28]=_,e[29]=y,e[30]=S,e[31]=u,e[32]=c.id,e[33]=j):j=e[33];let K;e[34]!==t||e[35]!==A||e[36]!==v||e[37]!==R||e[38]!==u||e[39]!==c.id?(K=t&&(v?(0,s.jsxDEV)(uo,{idBase:c.id,onDiscard:A,onKeep:z},void 0,!1):(0,s.jsxDEV)("button",{"aria-label":u("Close tab"),className:"flex size-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-destructive/10 hover:text-destructive","data-testid":`sql-tab-close-${c.id}`,onClick:R,title:u("Close tab"),type:"button",children:(0,s.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",children:(0,s.jsxDEV)("path",{d:"M6 6l12 12M18 6 6 18"},void 0,!1)},void 0,!1)},void 0,!1)),e[34]=t,e[35]=A,e[36]=v,e[37]=R,e[38]=u,e[39]=c.id,e[40]=K):K=e[40];let J;return e[41]!==N||e[42]!==E||e[43]!==k||e[44]!==j||e[45]!==K?(J=(0,s.jsxDEV)("div",{className:E,"data-testid":k,onContextMenu:N,children:[j,K]},void 0,!0),e[41]=N,e[42]=E,e[43]=k,e[44]=j,e[45]=K,e[46]=J):J=e[46],J},"TabButton");function mo(n){n?.focus(),n?.select()}r(mo,"_temp$1");var po=se(re.runSql),bo="lunora-studio-sql-queries",ho="lunora-studio-sql-history",vo=25,go={minWidth:"2.75rem",paddingInline:"0.5rem"},xe={error:null,pane:"results",result:null},xo=r(n=>{let e=(0,Y.c)(16),{result:o}=n;if(o.columns.length===0){let c=o.rowCount===0?"0 rows":"",u;return e[0]!==c?(u=(0,s.jsxDEV)("p",{className:"p-4 text-sm text-muted-foreground",children:c},void 0,!1),e[0]=c,e[1]=u):u=e[1],u}let t;e[2]!==o.columns?(t=o.columns.map(yo),e[2]=o.columns,e[3]=t):t=e[3];let l;e[4]!==t?(l=(0,s.jsxDEV)(Ie,{className:"sticky top-0 z-10 bg-muted",children:(0,s.jsxDEV)(he,{children:t},void 0,!1)},void 0,!1),e[4]=t,e[5]=l):l=e[5];let a;if(e[6]!==o.columns||e[7]!==o.rows){let c;e[9]!==o.columns?(c=r((u,y)=>(0,s.jsxDEV)(he,{"data-testid":"sql-row",children:o.columns.map(g=>(0,s.jsxDEV)(Ae,{className:"max-w-md truncate font-mono text-xs",children:(0,s.jsxDEV)(Oe,{value:u[g]},void 0,!1)},g,!1))},y,!1),"t42"),e[9]=o.columns,e[10]=c):c=e[10],a=o.rows.map(c),e[6]=o.columns,e[7]=o.rows,e[8]=a}else a=e[8];let d;e[11]!==a?(d=(0,s.jsxDEV)(Re,{children:a},void 0,!1),e[11]=a,e[12]=d):d=e[12];let m;return e[13]!==l||e[14]!==d?(m=(0,s.jsxDEV)(qe,{"data-testid":"sql-rows",children:[l,d]},void 0,!0),e[13]=l,e[14]=d,e[15]=m):m=e[15],m},"SqlResultTable"),Oo=r(({initialShardKey:n})=>{let e=be(),o=G(),[t,l]=X(bo),[a,d]=X(ho),[m,c]=(0,q.useState)(""),u=r(()=>Z(We[0]?.sql??""),"seedTab"),{activeId:y,setActiveId:g,setTabs:v,tabs:p}=to(u),[f,N]=(0,q.useState)({}),[x,S]=(0,q.useState)(n??""),[h,w]=(0,q.useState)(!1),[T,R]=(0,q.useState)(null),[O,A]=(0,q.useState)(null),M=(0,q.useRef)(null),z=(0,q.useRef)(null),B=(0,q.useRef)(null),P=(0,q.useId)(),{probe:H,schema:U}=Jt(x),I=p.find(i=>i.id===y)??p[0]??Z(),L=I.sql,{activeId:D}=I,_=f[I.id]??xe,{error:$,result:E}=_,k=_.pane,j=r(i=>{v(b=>b.map(C=>C.id===I.id?{...C,...i}:C))},"patchActiveTab"),K=r(i=>{N(b=>{let C=b[I.id]??xe;return{...b,[I.id]:{error:i.error,pane:i.pane??C.pane,result:i.result}}})},"setActiveOutput"),J=r(i=>{N(b=>{let C=b[I.id]??xe;return{...b,[I.id]:{...C,pane:i}}})},"setActivePane"),W=r(i=>{j({sql:i}),D!==null&&l(b=>b.map(C=>C.id===D?{...C,sql:i}:C))},"setDraft"),ze=Wt(U,z,W),{close:ce,commit:Se,move:de,refresh:ee,state:Q}=ze,Ue=r(i=>{de(i-(Q?.active??0)),Se()},"onPickSuggestion");(0,q.useEffect)(()=>{let i=z.current;i!==null&&i===document.activeElement&&ee(i.value,i.selectionStart)},[ee,U]);let Ye=r(i=>{d(b=>b[0]?.sql===i?b:[{at:Date.now(),sql:i},...b.filter(F=>F.sql!==i)].slice(0,vo))},"recordHistory"),ue=r(async i=>{if(L.trim()==="")return;w(!0);let b=i==="explain"?`EXPLAIN QUERY PLAN ${L}`:L;try{let C=await e.query(po,{sql:b},le(x));K({error:null,pane:i,result:C}),ke(x),Ye(b)}catch(C){K({error:Te(C),pane:i,result:null})}finally{w(!1)}},"run"),je=r(()=>{V(ue("results"))},"onRun"),Ke=r(i=>{let{selectionStart:b,value:C}=i.target;W(C);for(let F of Qt(C))H(F);ee(C,b)},"onDraftChange"),Ge=r(i=>{let b=i.currentTarget;ee(b.value,b.selectionStart)},"onEditorSelect"),Je=r(i=>{if(Q!==null){if(i.key==="ArrowDown"){i.preventDefault(),de(1);return}if(i.key==="ArrowUp"){i.preventDefault(),de(-1);return}if(i.key==="Escape"){i.preventDefault(),ce();return}if((i.key==="Enter"||i.key==="Tab")&&!i.metaKey&&!i.ctrlKey&&Se()){i.preventDefault();return}}(i.metaKey||i.ctrlKey)&&i.key==="Enter"&&(i.preventDefault(),V(ue(k)))},"onEditorKeyDown"),Qe=r(()=>{requestAnimationFrame(()=>{ce()})},"onEditorBlur"),Ve=r(i=>{M.current!==null&&(M.current.scrollTop=i.currentTarget.scrollTop)},"onEditorScroll"),te=r((i,b)=>{v(C=>C.map(F=>F.id===I.id?{...F,activeId:b,sql:i}:F)),K({error:null,result:null})},"loadIntoActiveTab"),Xe=r(()=>{let i={id:ve("q"),name:o("Untitled query"),sql:""};l(b=>[i,...b]),te("",i.id)},"newQuery"),Ze=r(i=>{let b=t.find(C=>C.id===i);b!==void 0&&(te(b.sql,i),B.current?.querySelector(`[data-testid="sql-query-${i}"]`)?.scrollIntoView({block:"nearest"}))},"selectQuery"),et=r(i=>{l(b=>b.filter(C=>C.id!==i)),v(b=>b.map(C=>C.activeId===i?{...C,activeId:null}:C))},"deleteQuery"),tt=r(i=>{te(i.currentTarget.dataset.sql??"",null)},"loadTemplate"),ot=r(i=>{te(i.currentTarget.dataset.sql??"",null)},"loadFromHistory"),nt=r(()=>{d([])},"clearHistory"),st=r(()=>{W(Lt(L))},"formatDraft"),lt=r(()=>{if(p.length>=ye)return;let i=Z();v(b=>oo(b,i)),g(i.id)},"addEditorTab"),oe=r(i=>{R(null),A(null),v(i.tabs),g(i.activeId);let b=new Set(i.tabs.map(C=>C.id));N(C=>Object.fromEntries(Object.entries(C).filter(([F])=>b.has(F))))},"commitTabs"),rt=r(i=>{oe(no(p,i,Z))},"closeEditorTab"),Ce=r((i,b)=>{oe(i==="others"?so(p,b):i==="right"?lo(p,b,y):ro(Z))},"applyBulk"),fe=r(i=>{T!==null&&(io(i,p,T.id).some(b=>Fe(b))?A(i):Ce(i,T.id))},"requestBulk"),it=r((i,b)=>{b.preventDefault(),A(null),R({id:i,x:b.clientX,y:b.clientY})},"openTabMenu"),at=r(()=>{R(null),A(null)},"closeTabMenu"),ct=r(i=>{i.preventDefault(),R(null),A(null)},"onBackdropContextMenu"),dt=r(()=>{fe("others")},"onCloseOthers"),ut=r(()=>{fe("right")},"onCloseToRight"),ft=r(()=>{fe("all")},"onCloseAll"),mt=r(()=>{T!==null&&O!==null&&Ce(O,T.id),A(null)},"confirmBulk"),pt=r(()=>{A(null)},"cancelBulk"),bt=T===null?void 0:{left:T.x,top:T.y},ht=r(i=>{ce(),g(i)},"selectTab"),vt=r((i,b)=>{v(C=>C.map(F=>F.id===i?{...F,name:b}:F))},"renameTab"),gt=r(()=>{J("results")},"showResults"),xt=r(()=>{V(ue("explain"))},"showExplain"),yt=r(()=>{J("chart")},"showChart"),Nt=L.split(`
4
4
  `).length,St=r(i=>{c(i.target.value)},"onSearchChange"),me=r(i=>`border-b-2 px-3 py-2 text-sm outline-none transition-colors ${i?"border-foreground font-medium text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,"tabClass");return(0,s.jsxDEV)("div",{className:"flex h-full min-w-0","data-testid":"lunora-sql-editor",children:[(0,s.jsxDEV)(jt,{activeId:D,history:a,listRef:B,onClearHistory:nt,onDelete:et,onLoadHistory:ot,onLoadTemplate:tt,onNew:Xe,onSearchChange:St,onSelect:Ze,queries:t,search:m},void 0,!1),(0,s.jsxDEV)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,s.jsxDEV)("div",{className:"flex shrink-0 items-stretch overflow-x-auto border-b border-border bg-muted/30","data-testid":"sql-tab-strip",role:"tablist",children:[p.map(i=>(0,s.jsxDEV)(fo,{active:i.id===I.id,canClose:p.length>1,onClose:rt,onMenu:it,onRename:vt,onSelect:ht,tab:i},i.id,!1)),(0,s.jsxDEV)("button",{"aria-label":o("New tab"),className:"flex size-8 shrink-0 items-center justify-center text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-40","data-testid":"sql-tab-add",disabled:p.length>=ye,onClick:lt,title:o("New tab"),type:"button",children:(0,s.jsxDEV)("svg",{"aria-hidden":"true",className:"size-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.7,viewBox:"0 0 24 24",children:(0,s.jsxDEV)("path",{d:"M12 5v14M5 12h14"},void 0,!1)},void 0,!1)},void 0,!1)]},void 0,!0),T!==null&&(0,s.jsxDEV)(s.Fragment,{children:[(0,s.jsxDEV)("div",{className:"fixed inset-0 z-40","data-testid":"sql-tab-menu-backdrop",onClick:at,onContextMenu:ct,role:"presentation"},void 0,!1),(0,s.jsxDEV)("div",{className:"fixed z-50 min-w-44 rounded-md border border-border bg-popover py-1 text-popover-foreground shadow-md","data-testid":"sql-tab-menu",role:"menu",style:bt,children:O===null?(0,s.jsxDEV)(s.Fragment,{children:[(0,s.jsxDEV)("button",{className:"flex w-full items-center px-3 py-1.5 text-start text-xs outline-none hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-40","data-testid":"sql-tab-menu-close-others",disabled:p.length<=1,onClick:dt,role:"menuitem",type:"button",children:o("Close other tabs")},void 0,!1),(0,s.jsxDEV)("button",{className:"flex w-full items-center px-3 py-1.5 text-start text-xs outline-none hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-40","data-testid":"sql-tab-menu-close-right",disabled:p.findIndex(i=>i.id===T.id)>=p.length-1,onClick:ut,role:"menuitem",type:"button",children:o("Close tabs to the right")},void 0,!1),(0,s.jsxDEV)("button",{className:"flex w-full items-center px-3 py-1.5 text-start text-xs outline-none hover:bg-accent focus-visible:bg-accent","data-testid":"sql-tab-menu-close-all",onClick:ft,role:"menuitem",type:"button",children:o("Close all tabs")},void 0,!1)]},void 0,!0):(0,s.jsxDEV)("div",{className:"px-3 py-1.5","data-testid":"sql-tab-menu-confirm",children:[(0,s.jsxDEV)("p",{className:"pb-1.5 text-xs text-muted-foreground",children:o("Discard unsaved tabs?")},void 0,!1),(0,s.jsxDEV)("div",{className:"flex items-center gap-1.5",children:[(0,s.jsxDEV)("button",{className:"rounded px-2 py-1 text-xs font-medium text-destructive outline-none hover:bg-destructive/10 focus-visible:bg-destructive/10","data-testid":"sql-tab-menu-confirm-discard",onClick:mt,type:"button",children:o("Discard")},void 0,!1),(0,s.jsxDEV)("button",{className:"rounded px-2 py-1 text-xs text-muted-foreground outline-none hover:bg-accent focus-visible:bg-accent","data-testid":"sql-tab-menu-confirm-cancel",onClick:pt,type:"button",children:o("Cancel")},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1)]},void 0,!0),(0,s.jsxDEV)("div",{className:"flex min-h-0 flex-1",children:[(0,s.jsxDEV)("div",{"aria-hidden":"true",className:"shrink-0 select-none overflow-hidden border-e border-border bg-muted/30 py-3 text-end font-mono text-xs leading-5 text-muted-foreground/60",ref:M,style:go,children:Array.from({length:Nt},(i,b)=>(0,s.jsxDEV)("div",{children:b+1},b,!1))},void 0,!1),(0,s.jsxDEV)("div",{className:"relative min-w-0 flex-1",children:[(0,s.jsxDEV)("textarea",{"aria-activedescendant":Q===null?void 0:`${P}-opt-${Q.active.toString()}`,"aria-autocomplete":"list","aria-controls":Q===null?void 0:P,"aria-expanded":Q!==null,"aria-label":o("SQL query"),className:"size-full resize-none bg-background p-3 font-mono text-xs leading-5 outline-none","data-testid":"sql-input",onBlur:Qe,onChange:Ke,onKeyDown:Je,onScroll:Ve,onSelect:Ge,placeholder:"SELECT * FROM \u2026",ref:z,role:"combobox",spellCheck:!1,value:L},void 0,!1),(0,s.jsxDEV)(Ut,{listboxId:P,onPick:Ue,state:Q},void 0,!1)]},void 0,!0)]},void 0,!0),(0,s.jsxDEV)("div",{className:"flex h-2/5 min-h-0 shrink-0 flex-col border-t border-border",children:[(0,s.jsxDEV)("div",{className:"flex shrink-0 items-center gap-2 border-b border-border pe-2",children:[(0,s.jsxDEV)("button",{className:me(k==="results"),"data-testid":"sql-tab-results",onClick:gt,type:"button",children:o("Results")},void 0,!1),(0,s.jsxDEV)("button",{className:me(k==="chart"),"data-testid":"sql-tab-chart",onClick:yt,type:"button",children:o("Chart")},void 0,!1),(0,s.jsxDEV)("button",{className:me(k==="explain"),"data-testid":"sql-tab-explain",onClick:xt,type:"button",children:o("Explain")},void 0,!1),(0,s.jsxDEV)("div",{className:"ms-auto flex items-center gap-2",children:[E!==null&&E.columns.length>0&&(0,s.jsxDEV)(Me,{columns:E.columns,name:"query-result",rows:E.rows},void 0,!1),(0,s.jsxDEV)("button",{className:"inline-flex items-center rounded-md border border-border px-3 py-1.5 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50","data-testid":"sql-format",disabled:h,onClick:st,type:"button",children:o("Format")},void 0,!1),(0,s.jsxDEV)(we,{onChange:S,testId:"sql-shard-input",value:x},void 0,!1),(0,s.jsxDEV)("button",{className:"inline-flex items-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground outline-none transition-colors hover:bg-primary/90 focus-visible:bg-primary/90 disabled:pointer-events-none disabled:opacity-50","data-testid":"sql-run",disabled:h,onClick:je,type:"button",children:[o(h?"Running\u2026":"Run"),(0,s.jsxDEV)("kbd",{className:"rounded border border-primary-foreground/30 px-1 font-sans text-[10px]",children:"\u2318\u21B5"},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0),(0,s.jsxDEV)("div",{className:"min-h-0 flex-1 overflow-auto",children:[$!==null&&(0,s.jsxDEV)(Ee,{className:"m-3 font-mono text-xs",testId:"sql-error",variant:"destructive",children:$},void 0,!1),$===null&&E===null&&(0,s.jsxDEV)("p",{className:"p-4 text-sm text-muted-foreground","data-testid":"sql-empty",children:o("Click Run to execute your query.")},void 0,!1),$===null&&E!==null&&(0,s.jsxDEV)("div",{"data-testid":"sql-result",children:[k==="chart"?(0,s.jsxDEV)(De,{result:E},void 0,!1):(0,s.jsxDEV)(xo,{result:E},void 0,!1),(0,s.jsxDEV)("p",{className:"border-t border-border px-3 py-1.5 text-xs text-muted-foreground","data-testid":"sql-count",children:E.truncated?o("Showing the first {max} of {count} rows.",{count:E.rowCount,max:E.rows.length}):o("{count} rows",{count:E.rowCount})},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0)]},void 0,!0)]},void 0,!0)},"SqlEditorPanel");function yo(n){return(0,s.jsxDEV)(Le,{children:n},n,!1)}r(yo,"_temp");export{Oo as SqlEditorPanel};
@@ -1 +1 @@
1
- import{a as $,b as F,c as D,d as p,e as l,f as i}from"./chunk-GTM65MVX.js";import{a as se}from"./chunk-VLXV72QE.js";import{R as te}from"./chunk-3CJW6NWG.js";import{c as T}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as K}from"./chunk-AQGOX5DK.js";import{a as B}from"./chunk-TAD43CG5.js";import{b as ae}from"./chunk-DVKPRFIJ.js";import{a as R,e as _}from"./chunk-SEU5V7I6.js";import"./chunk-CKSHCYGC.js";import{f as Q}from"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as V,e as X,f as Y,g as E,k as W}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as r,e as ee,f as re,h as le}from"./chunk-RRCPZMC2.js";var n=ee(re(),1);var e=ee(le(),1);var ie=["queued","running","paused","waiting","complete","errored","terminated"],ne=["pause","resume","terminate"],de="WORKFLOWS_NOT_CONFIGURED",ce=r(c=>typeof c=="object"&&c!==null&&c.code===de,"isNotConfigured"),fe=r(c=>{let s=c.error??c.output;if(s===void 0)return"\u2014";try{return JSON.stringify(s)}catch{return"(unserializable)"}},"formatStepPayload"),ue=r(({loadDetail:c,loadInstances:s,readOnly:y,runAction:L,workflowName:v})=>{let A=Q(),o=V(),[x,N]=(0,n.useState)(null),[k,I]=(0,n.useState)(null),[w,P]=(0,n.useState)(""),[g,h]=(0,n.useState)(null),[U,S]=(0,n.useState)(!1),[z,J]=(0,n.useState)(null),m=c??(a=>A.getWorkflowInstance(a)),O=y?void 0:L??(s===void 0?a=>A.setWorkflowInstanceStatus(a):void 0),j=r(async()=>{h(null),S(!1);let a=w===""?void 0:w;try{if(s===void 0){let d=await A.listWorkflowInstances({name:v,status:a});if(d.configured===!1){N(null),S(!0);return}N(d.instances);return}N(await s({name:v,status:a}))}catch(d){N(null),ce(d)?S(!0):h(E(d))}},"load");(0,n.useEffect)(()=>{I(null),W(j())},[v,w]);let G=r(async a=>{h(null);try{I(await m({id:a,name:v}))}catch(d){h(E(d))}},"openDetail"),H=r(async(a,d)=>{if(O!==void 0){J(a),h(null);try{await O({action:d,id:a,name:v}),await j()}catch(M){h(E(M))}finally{J(null)}}},"act");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,e.jsxDEV)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-medium",children:o("Instance history")},void 0,!1),(0,e.jsxDEV)("select",{"aria-label":o("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:r(a=>{P(a.target.value)},"onChange"),value:w,children:[(0,e.jsxDEV)("option",{value:"",children:o("All statuses")},void 0,!1),ie.map(a=>(0,e.jsxDEV)("option",{value:a,children:a},a,!1))]},void 0,!0)]},void 0,!0),g!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:g},void 0,!1),U&&(0,e.jsxDEV)(B,{description:o("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:o("Workflow inspection not configured")},void 0,!1),!U&&x!==null&&x.length===0&&(0,e.jsxDEV)(B,{description:o("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:o("No instances")},void 0,!1),x!==null&&x.length>0&&(0,e.jsxDEV)(R,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(_,{className:"px-0",children:(0,e.jsxDEV)($,{"data-testid":"workflow-instances-table",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:o("Instance id")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Status")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Created")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Ended")},void 0,!1),(0,e.jsxDEV)(l,{"aria-label":o("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:x.map(a=>(0,e.jsxDEV)(p,{"data-testid":`workflow-instance-${a.id}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:a.id},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:a.status},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground tabular-nums",children:a.createdOn??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground tabular-nums",children:a.endedOn??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"text-right",children:(0,e.jsxDEV)("div",{className:"flex justify-end gap-1.5",children:[(0,e.jsxDEV)(T,{"data-testid":`workflow-instance-steps-${a.id}`,onClick:r(()=>{W(G(a.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:o("Steps")},void 0,!1),O!==void 0&&ne.map(d=>(0,e.jsxDEV)(T,{"data-testid":`workflow-instance-${d}-${a.id}`,disabled:z===a.id,onClick:r(()=>{W(H(a.id,d))},"onClick"),size:"sm",type:"button",variant:"ghost",children:o(d)},d,!1))]},void 0,!0)},void 0,!1)]},a.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),k!==null&&(0,e.jsxDEV)(R,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,e.jsxDEV)(_,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,e.jsxDEV)("div",{className:"flex items-center justify-between",children:[(0,e.jsxDEV)("span",{className:"font-mono text-xs",children:[o("Steps")," \xB7 ",k.id]},void 0,!0),(0,e.jsxDEV)(T,{"data-testid":"workflow-instance-detail-close",onClick:r(()=>{I(null)},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Close")},void 0,!1)]},void 0,!0),k.steps.length===0?(0,e.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:o("This instance has no recorded steps yet.")},void 0,!1):(0,e.jsxDEV)($,{"data-testid":"workflow-instance-steps",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:o("Step")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Type")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Attempts")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Started")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Output")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:k.steps.map((a,d)=>(0,e.jsxDEV)(p,{"data-testid":`workflow-step-${String(d)}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:a.name},void 0,!1),(0,e.jsxDEV)(i,{className:"text-xs text-muted-foreground",children:a.type??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"tabular-nums",children:a.attempts??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground tabular-nums",children:a.start??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:fe(a)},void 0,!1)]},`${a.name}:${String(d)}`,!0))},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1)]},void 0,!0)},"WorkflowInstanceHistory"),me=X(K.createWorkflowInstance),ve=X(K.getWorkflowInstanceStatus),he=r(c=>{if(c.error)return`${c.error.name}: ${c.error.message}`;if(c.output===void 0)return"\u2014";try{return JSON.stringify(c.output)}catch{return"(unserializable)"}},"formatPayload"),Oe=r(()=>{let c=Q(),s=V(),{data:y,error:L}=ae(K.listWorkflows,{}),[v,A]=(0,n.useState)(""),[o,x]=(0,n.useState)(""),[N,k]=(0,n.useState)(""),[I,w]=(0,n.useState)(!1),[P,g]=(0,n.useState)(null),[h,U]=(0,n.useState)([]),[S,z]=(0,n.useState)(null),J=y!==void 0,m=(0,n.useMemo)(()=>Array.isArray(y?.workflows)?[...y.workflows].toSorted((t,u)=>t.exportName.localeCompare(u.exportName)):[],[y]),C=(0,n.useMemo)(()=>m.some(t=>t.exportName===v)?v:m[0]?.exportName??"",[m,v]),q=(0,n.useMemo)(()=>m.find(t=>t.exportName===C),[m,C]),O=r(t=>{U(u=>{let f=u.filter(b=>!(b.exportName===t.exportName&&b.id===t.id));return[t,...f]})},"upsertInstance"),j=r(async()=>{let t=C;if(t==="")return;let u,f=N.trim();if(f!=="")try{u=JSON.parse(f)}catch{g(s("Params must be valid JSON"));return}w(!0),g(null);try{let b=o.trim(),Z=await c.query(me,{exportName:t,id:b===""?void 0:b,params:u},Y(""));O({exportName:t,id:Z.id,status:Z.status}),x("")}catch(b){g(E(b))}finally{w(!1)}},"start"),G=r(()=>{W(j())},"startInstance"),H=r(async(t,u)=>{z(u);try{let f=await c.query(ve,{exportName:t,id:u},Y(""));O({error:f.error,exportName:t,id:f.id,output:f.output,status:f.status})}catch(f){g(E(f))}finally{z(null)}},"refreshInstance"),a=r(t=>{A(t.target.value)},"onSelectedExportChange"),d=r(t=>{x(t.target.value)},"onInstanceIdChange"),M=r(t=>{k(t.target.value)},"onParamsChange"),oe=r(t=>{let{export:u,id:f}=t.currentTarget.dataset;u!==void 0&&f!==void 0&&W(H(u,f))},"onRefreshClick");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[L!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:L},void 0,!1),(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:s("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")},void 0,!1),J&&m.length===0?(0,e.jsxDEV)(B,{description:s("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:s("No workflows defined")},void 0,!1):(0,e.jsxDEV)(R,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(_,{className:"px-0",children:(0,e.jsxDEV)($,{"data-testid":"workflows-table",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:s("Export")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Name")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Class")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Binding")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:m.map(t=>(0,e.jsxDEV)(p,{"data-testid":`workflows-row-${t.exportName}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:t.exportName},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.name},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.className},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.binding},void 0,!1)]},t.exportName,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),m.length>0&&(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-medium",children:s("Start instance")},void 0,!1),P!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:P},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)("select",{"aria-label":s("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:a,value:C,children:m.map(t=>(0,e.jsxDEV)("option",{value:t.exportName,children:t.exportName},t.exportName,!1))},void 0,!1),(0,e.jsxDEV)(te,{"aria-label":s("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:d,placeholder:s("Instance id (optional)"),value:o},void 0,!1),(0,e.jsxDEV)(T,{"data-testid":"workflows-start-button",disabled:I||C==="",onClick:G,children:s(I?"Starting\u2026":"Start instance")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)(se,{"aria-label":s("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:M,placeholder:s("Params (JSON, optional)"),value:N},void 0,!1)]},void 0,!0),h.length>0&&(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-medium",children:s("Instances")},void 0,!1),(0,e.jsxDEV)(R,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(_,{className:"px-0",children:(0,e.jsxDEV)($,{"data-testid":"workflows-instances-table",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:s("Workflow")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Instance id")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Status")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Output")},void 0,!1),(0,e.jsxDEV)(l,{},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:h.map(t=>(0,e.jsxDEV)(p,{"data-testid":`workflows-instance-${t.id}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:t.exportName},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.id},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:t.status},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:he(t)},void 0,!1),(0,e.jsxDEV)(i,{children:(0,e.jsxDEV)(T,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:S===t.id,onClick:oe,size:"xs",variant:"outline",children:S===t.id?s("Refreshing\u2026"):s("Refresh")},void 0,!1)},void 0,!1)]},`${t.exportName}:${t.id}`,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),q!==void 0&&(0,e.jsxDEV)(ue,{workflowName:q.name},void 0,!1)]},void 0,!0)},"WorkflowsPanel");export{Oe as default};
1
+ import{a as $,b as F,c as D,d as p,e as l,f as i}from"./chunk-GTM65MVX.js";import{a as se}from"./chunk-VLXV72QE.js";import{R as te}from"./chunk-3CJW6NWG.js";import{c as T}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as K}from"./chunk-BOXSWNXZ.js";import{a as B}from"./chunk-TAD43CG5.js";import{b as ae}from"./chunk-DVKPRFIJ.js";import{a as R,e as _}from"./chunk-SEU5V7I6.js";import"./chunk-CKSHCYGC.js";import{f as Q}from"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as V,e as X,f as Y,g as E,k as W}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as r,e as ee,f as re,h as le}from"./chunk-RRCPZMC2.js";var n=ee(re(),1);var e=ee(le(),1);var ie=["queued","running","paused","waiting","complete","errored","terminated"],ne=["pause","resume","terminate"],de="WORKFLOWS_NOT_CONFIGURED",ce=r(c=>typeof c=="object"&&c!==null&&c.code===de,"isNotConfigured"),fe=r(c=>{let s=c.error??c.output;if(s===void 0)return"\u2014";try{return JSON.stringify(s)}catch{return"(unserializable)"}},"formatStepPayload"),ue=r(({loadDetail:c,loadInstances:s,readOnly:y,runAction:L,workflowName:v})=>{let A=Q(),o=V(),[x,N]=(0,n.useState)(null),[k,I]=(0,n.useState)(null),[w,P]=(0,n.useState)(""),[g,h]=(0,n.useState)(null),[U,S]=(0,n.useState)(!1),[z,J]=(0,n.useState)(null),m=c??(a=>A.getWorkflowInstance(a)),O=y?void 0:L??(s===void 0?a=>A.setWorkflowInstanceStatus(a):void 0),j=r(async()=>{h(null),S(!1);let a=w===""?void 0:w;try{if(s===void 0){let d=await A.listWorkflowInstances({name:v,status:a});if(d.configured===!1){N(null),S(!0);return}N(d.instances);return}N(await s({name:v,status:a}))}catch(d){N(null),ce(d)?S(!0):h(E(d))}},"load");(0,n.useEffect)(()=>{I(null),W(j())},[v,w]);let G=r(async a=>{h(null);try{I(await m({id:a,name:v}))}catch(d){h(E(d))}},"openDetail"),H=r(async(a,d)=>{if(O!==void 0){J(a),h(null);try{await O({action:d,id:a,name:v}),await j()}catch(M){h(E(M))}finally{J(null)}}},"act");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,e.jsxDEV)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-medium",children:o("Instance history")},void 0,!1),(0,e.jsxDEV)("select",{"aria-label":o("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:r(a=>{P(a.target.value)},"onChange"),value:w,children:[(0,e.jsxDEV)("option",{value:"",children:o("All statuses")},void 0,!1),ie.map(a=>(0,e.jsxDEV)("option",{value:a,children:a},a,!1))]},void 0,!0)]},void 0,!0),g!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:g},void 0,!1),U&&(0,e.jsxDEV)(B,{description:o("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:o("Workflow inspection not configured")},void 0,!1),!U&&x!==null&&x.length===0&&(0,e.jsxDEV)(B,{description:o("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:o("No instances")},void 0,!1),x!==null&&x.length>0&&(0,e.jsxDEV)(R,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(_,{className:"px-0",children:(0,e.jsxDEV)($,{"data-testid":"workflow-instances-table",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:o("Instance id")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Status")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Created")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Ended")},void 0,!1),(0,e.jsxDEV)(l,{"aria-label":o("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:x.map(a=>(0,e.jsxDEV)(p,{"data-testid":`workflow-instance-${a.id}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:a.id},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:a.status},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground tabular-nums",children:a.createdOn??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground tabular-nums",children:a.endedOn??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"text-right",children:(0,e.jsxDEV)("div",{className:"flex justify-end gap-1.5",children:[(0,e.jsxDEV)(T,{"data-testid":`workflow-instance-steps-${a.id}`,onClick:r(()=>{W(G(a.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:o("Steps")},void 0,!1),O!==void 0&&ne.map(d=>(0,e.jsxDEV)(T,{"data-testid":`workflow-instance-${d}-${a.id}`,disabled:z===a.id,onClick:r(()=>{W(H(a.id,d))},"onClick"),size:"sm",type:"button",variant:"ghost",children:o(d)},d,!1))]},void 0,!0)},void 0,!1)]},a.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),k!==null&&(0,e.jsxDEV)(R,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,e.jsxDEV)(_,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,e.jsxDEV)("div",{className:"flex items-center justify-between",children:[(0,e.jsxDEV)("span",{className:"font-mono text-xs",children:[o("Steps")," \xB7 ",k.id]},void 0,!0),(0,e.jsxDEV)(T,{"data-testid":"workflow-instance-detail-close",onClick:r(()=>{I(null)},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Close")},void 0,!1)]},void 0,!0),k.steps.length===0?(0,e.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:o("This instance has no recorded steps yet.")},void 0,!1):(0,e.jsxDEV)($,{"data-testid":"workflow-instance-steps",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:o("Step")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Type")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Attempts")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Started")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Output")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:k.steps.map((a,d)=>(0,e.jsxDEV)(p,{"data-testid":`workflow-step-${String(d)}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:a.name},void 0,!1),(0,e.jsxDEV)(i,{className:"text-xs text-muted-foreground",children:a.type??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"tabular-nums",children:a.attempts??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground tabular-nums",children:a.start??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:fe(a)},void 0,!1)]},`${a.name}:${String(d)}`,!0))},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1)]},void 0,!0)},"WorkflowInstanceHistory"),me=X(K.createWorkflowInstance),ve=X(K.getWorkflowInstanceStatus),he=r(c=>{if(c.error)return`${c.error.name}: ${c.error.message}`;if(c.output===void 0)return"\u2014";try{return JSON.stringify(c.output)}catch{return"(unserializable)"}},"formatPayload"),Oe=r(()=>{let c=Q(),s=V(),{data:y,error:L}=ae(K.listWorkflows,{}),[v,A]=(0,n.useState)(""),[o,x]=(0,n.useState)(""),[N,k]=(0,n.useState)(""),[I,w]=(0,n.useState)(!1),[P,g]=(0,n.useState)(null),[h,U]=(0,n.useState)([]),[S,z]=(0,n.useState)(null),J=y!==void 0,m=(0,n.useMemo)(()=>Array.isArray(y?.workflows)?[...y.workflows].toSorted((t,u)=>t.exportName.localeCompare(u.exportName)):[],[y]),C=(0,n.useMemo)(()=>m.some(t=>t.exportName===v)?v:m[0]?.exportName??"",[m,v]),q=(0,n.useMemo)(()=>m.find(t=>t.exportName===C),[m,C]),O=r(t=>{U(u=>{let f=u.filter(b=>!(b.exportName===t.exportName&&b.id===t.id));return[t,...f]})},"upsertInstance"),j=r(async()=>{let t=C;if(t==="")return;let u,f=N.trim();if(f!=="")try{u=JSON.parse(f)}catch{g(s("Params must be valid JSON"));return}w(!0),g(null);try{let b=o.trim(),Z=await c.query(me,{exportName:t,id:b===""?void 0:b,params:u},Y(""));O({exportName:t,id:Z.id,status:Z.status}),x("")}catch(b){g(E(b))}finally{w(!1)}},"start"),G=r(()=>{W(j())},"startInstance"),H=r(async(t,u)=>{z(u);try{let f=await c.query(ve,{exportName:t,id:u},Y(""));O({error:f.error,exportName:t,id:f.id,output:f.output,status:f.status})}catch(f){g(E(f))}finally{z(null)}},"refreshInstance"),a=r(t=>{A(t.target.value)},"onSelectedExportChange"),d=r(t=>{x(t.target.value)},"onInstanceIdChange"),M=r(t=>{k(t.target.value)},"onParamsChange"),oe=r(t=>{let{export:u,id:f}=t.currentTarget.dataset;u!==void 0&&f!==void 0&&W(H(u,f))},"onRefreshClick");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[L!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:L},void 0,!1),(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:s("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")},void 0,!1),J&&m.length===0?(0,e.jsxDEV)(B,{description:s("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:s("No workflows defined")},void 0,!1):(0,e.jsxDEV)(R,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(_,{className:"px-0",children:(0,e.jsxDEV)($,{"data-testid":"workflows-table",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:s("Export")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Name")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Class")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Binding")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:m.map(t=>(0,e.jsxDEV)(p,{"data-testid":`workflows-row-${t.exportName}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:t.exportName},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.name},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.className},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.binding},void 0,!1)]},t.exportName,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),m.length>0&&(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-medium",children:s("Start instance")},void 0,!1),P!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:P},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)("select",{"aria-label":s("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:a,value:C,children:m.map(t=>(0,e.jsxDEV)("option",{value:t.exportName,children:t.exportName},t.exportName,!1))},void 0,!1),(0,e.jsxDEV)(te,{"aria-label":s("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:d,placeholder:s("Instance id (optional)"),value:o},void 0,!1),(0,e.jsxDEV)(T,{"data-testid":"workflows-start-button",disabled:I||C==="",onClick:G,children:s(I?"Starting\u2026":"Start instance")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)(se,{"aria-label":s("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:M,placeholder:s("Params (JSON, optional)"),value:N},void 0,!1)]},void 0,!0),h.length>0&&(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-medium",children:s("Instances")},void 0,!1),(0,e.jsxDEV)(R,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(_,{className:"px-0",children:(0,e.jsxDEV)($,{"data-testid":"workflows-instances-table",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:s("Workflow")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Instance id")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Status")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Output")},void 0,!1),(0,e.jsxDEV)(l,{},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:h.map(t=>(0,e.jsxDEV)(p,{"data-testid":`workflows-instance-${t.id}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:t.exportName},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.id},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:t.status},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:he(t)},void 0,!1),(0,e.jsxDEV)(i,{children:(0,e.jsxDEV)(T,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:S===t.id,onClick:oe,size:"xs",variant:"outline",children:S===t.id?s("Refreshing\u2026"):s("Refresh")},void 0,!1)},void 0,!1)]},`${t.exportName}:${t.id}`,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),q!==void 0&&(0,e.jsxDEV)(ue,{workflowName:q.name},void 0,!1)]},void 0,!0)},"WorkflowsPanel");export{Oe as default};
@@ -1 +1 @@
1
- import{a as $}from"./chunk-WXPWVBIY.js";import{a as W}from"./chunk-TDL7NEWA.js";import{a as _}from"./chunk-2K47A3P6.js";import{a as q}from"./chunk-AJIUI7DD.js";import"./chunk-XNJNSCLM.js";import{a as G,b as P,c as V,d as b,e as i,f as o}from"./chunk-GTM65MVX.js";import{a as y}from"./chunk-JSEXCW5Q.js";import{a as U}from"./chunk-K3GNLVYK.js";import{b as Q}from"./chunk-TBMYIZIO.js";import{R as w}from"./chunk-3CJW6NWG.js";import{c as L}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as g}from"./chunk-AQGOX5DK.js";import{a as A}from"./chunk-TAD43CG5.js";import{b as H}from"./chunk-DVKPRFIJ.js";import{a as k,e as B}from"./chunk-SEU5V7I6.js";import{b as T}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as M}from"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as S,e as F,f as K,g as O,k as j,n as z}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as n,e as D,f as le,h as ce}from"./chunk-RRCPZMC2.js";var a=D(le(),1);var e=D(ce(),1);var ue=F(g.runMigration),we=n(({initialShardKey:J})=>{let X=M(),r=S(),[c,Y]=(0,a.useState)(J??""),[x,Z]=(0,a.useState)(""),[R,ee]=(0,a.useState)("up"),[f,re]=(0,a.useState)(!0),[u,N]=(0,a.useState)(!1),[d,h]=(0,a.useState)(null),[C,p]=(0,a.useState)(null),m=_(c.trim(),400),I=c.trim()===m,s=H(g.migrationStatus,{},{live:!0,shardKey:m}),l=s.data?.migrations??null,te=s.error,{errorSource:ae,liveError:ie}=s;(0,a.useEffect)(()=>{s.data!==void 0&&Q(m)},[s.data,m]);let oe=n(async()=>{let t=x.trim();if(t===""){p(r("Enter a migration id")),h(null);return}N(!0),p(null);try{let v=await X.query(ue,{direction:R,dryRun:f,id:t},K(c));h(v),s.refetch()}catch(v){h(null),p(O(v))}finally{N(!1)}},"run"),E=n(()=>{j(oe())},"runMigration"),ne=n(t=>{Z(t.target.value)},"onIdChange"),se=n(t=>{ee(t.target.value==="down"?"down":"up")},"onDirectionChange"),de=n(t=>{re(t.target.checked)},"onDryRunChange");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-migrations",children:[(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)(U,{onChange:Y,testId:"mg-shard-input",value:c},void 0,!1),(0,e.jsxDEV)($,{message:ie,prefix:"mg"},void 0,!1)]},void 0,!0),te!==null&&(0,e.jsxDEV)(q,{error:ae,testId:"mg-status-error"},void 0,!1),l!==null&&l.length===0&&(0,e.jsxDEV)(A,{description:r("Data migrations you run against this shard will be tracked here."),icon:(0,e.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsxDEV)("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"},void 0,!1)},void 0,!1),testId:"mg-empty",title:r("No migrations have run on this shard.")},void 0,!1),l!==null&&l.length>0&&(0,e.jsxDEV)(k,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(B,{className:"px-0",children:(0,e.jsxDEV)(G,{"data-testid":"mg-table",children:[(0,e.jsxDEV)(P,{children:(0,e.jsxDEV)(b,{children:[(0,e.jsxDEV)(i,{children:r("id")},void 0,!1),(0,e.jsxDEV)(i,{children:r("direction")},void 0,!1),(0,e.jsxDEV)(i,{children:r("status")},void 0,!1),(0,e.jsxDEV)(i,{children:r("processed")},void 0,!1),(0,e.jsxDEV)(i,{children:r("changed")},void 0,!1),(0,e.jsxDEV)(i,{children:r("updated")},void 0,!1),(0,e.jsxDEV)(i,{children:r("error")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(V,{children:l.map(t=>(0,e.jsxDEV)(b,{"data-testid":`mg-row-${t.id}`,children:[(0,e.jsxDEV)(o,{children:t.id},void 0,!1),(0,e.jsxDEV)(o,{children:t.direction},void 0,!1),(0,e.jsxDEV)(o,{children:(0,e.jsxDEV)(T,{variant:"secondary",children:t.status},void 0,!1)},void 0,!1),(0,e.jsxDEV)(o,{children:t.processed},void 0,!1),(0,e.jsxDEV)(o,{children:t.changed},void 0,!1),(0,e.jsxDEV)(o,{children:z(t.updatedAt)},void 0,!1),(0,e.jsxDEV)(o,{children:t.error??""},void 0,!1)]},t.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs",children:[(0,e.jsxDEV)(y,{children:r("Run migration")},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)(w,{"aria-label":r("Migration id"),className:"w-auto","data-testid":"mg-id-input",onChange:ne,placeholder:r("migration id"),value:x},void 0,!1),(0,e.jsxDEV)("select",{"aria-label":r("Direction"),className:"flex h-9 rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"mg-direction",onChange:se,value:R,children:[(0,e.jsxDEV)("option",{value:"up",children:r("up")},void 0,!1),(0,e.jsxDEV)("option",{value:"down",children:r("down")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)(y,{className:"flex items-center gap-1.5",htmlFor:"mg-dry-run",children:[(0,e.jsxDEV)("input",{checked:f,className:"size-4 accent-primary","data-testid":"mg-dry-run",id:"mg-dry-run",onChange:de,type:"checkbox"},void 0,!1),r("Dry run")]},void 0,!0),f?(0,e.jsxDEV)(L,{"data-testid":"mg-run",disabled:u||!I,onClick:E,size:"sm",type:"button",children:r(u?"Running\u2026":"Run")},void 0,!1):(0,e.jsxDEV)(W,{confirmLabel:r(u?"Running\u2026":"Run migration?"),disabled:u||!I,onConfirm:E,testId:"mg-run",children:r("Run")},void 0,!1)]},void 0,!0)]},void 0,!0),C!==null&&(0,e.jsxDEV)("pre",{className:"text-sm text-destructive whitespace-pre-wrap","data-testid":"mg-run-error",role:"alert",children:C},void 0,!1),d!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"mg-run-result",children:[d.dryRun?r("Dry run: "):"",r("{status} \u2014 processed",{status:d.status}),d.processed,r(", changed"),d.changed]},void 0,!0)]},void 0,!0)},"MigrationsPanel");export{we as MigrationsPanel};
1
+ import{a as $}from"./chunk-WXPWVBIY.js";import{a as W}from"./chunk-TDL7NEWA.js";import{a as _}from"./chunk-2K47A3P6.js";import{a as q}from"./chunk-AJIUI7DD.js";import"./chunk-XNJNSCLM.js";import{a as G,b as P,c as V,d as b,e as i,f as o}from"./chunk-GTM65MVX.js";import{a as y}from"./chunk-JSEXCW5Q.js";import{a as U}from"./chunk-K3GNLVYK.js";import{b as Q}from"./chunk-TBMYIZIO.js";import{R as w}from"./chunk-3CJW6NWG.js";import{c as L}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as g}from"./chunk-BOXSWNXZ.js";import{a as A}from"./chunk-TAD43CG5.js";import{b as H}from"./chunk-DVKPRFIJ.js";import{a as k,e as B}from"./chunk-SEU5V7I6.js";import{b as T}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as M}from"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as S,e as F,f as K,g as O,k as j,n as z}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as n,e as D,f as le,h as ce}from"./chunk-RRCPZMC2.js";var a=D(le(),1);var e=D(ce(),1);var ue=F(g.runMigration),we=n(({initialShardKey:J})=>{let X=M(),r=S(),[c,Y]=(0,a.useState)(J??""),[x,Z]=(0,a.useState)(""),[R,ee]=(0,a.useState)("up"),[f,re]=(0,a.useState)(!0),[u,N]=(0,a.useState)(!1),[d,h]=(0,a.useState)(null),[C,p]=(0,a.useState)(null),m=_(c.trim(),400),I=c.trim()===m,s=H(g.migrationStatus,{},{live:!0,shardKey:m}),l=s.data?.migrations??null,te=s.error,{errorSource:ae,liveError:ie}=s;(0,a.useEffect)(()=>{s.data!==void 0&&Q(m)},[s.data,m]);let oe=n(async()=>{let t=x.trim();if(t===""){p(r("Enter a migration id")),h(null);return}N(!0),p(null);try{let v=await X.query(ue,{direction:R,dryRun:f,id:t},K(c));h(v),s.refetch()}catch(v){h(null),p(O(v))}finally{N(!1)}},"run"),E=n(()=>{j(oe())},"runMigration"),ne=n(t=>{Z(t.target.value)},"onIdChange"),se=n(t=>{ee(t.target.value==="down"?"down":"up")},"onDirectionChange"),de=n(t=>{re(t.target.checked)},"onDryRunChange");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-migrations",children:[(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)(U,{onChange:Y,testId:"mg-shard-input",value:c},void 0,!1),(0,e.jsxDEV)($,{message:ie,prefix:"mg"},void 0,!1)]},void 0,!0),te!==null&&(0,e.jsxDEV)(q,{error:ae,testId:"mg-status-error"},void 0,!1),l!==null&&l.length===0&&(0,e.jsxDEV)(A,{description:r("Data migrations you run against this shard will be tracked here."),icon:(0,e.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsxDEV)("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"},void 0,!1)},void 0,!1),testId:"mg-empty",title:r("No migrations have run on this shard.")},void 0,!1),l!==null&&l.length>0&&(0,e.jsxDEV)(k,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(B,{className:"px-0",children:(0,e.jsxDEV)(G,{"data-testid":"mg-table",children:[(0,e.jsxDEV)(P,{children:(0,e.jsxDEV)(b,{children:[(0,e.jsxDEV)(i,{children:r("id")},void 0,!1),(0,e.jsxDEV)(i,{children:r("direction")},void 0,!1),(0,e.jsxDEV)(i,{children:r("status")},void 0,!1),(0,e.jsxDEV)(i,{children:r("processed")},void 0,!1),(0,e.jsxDEV)(i,{children:r("changed")},void 0,!1),(0,e.jsxDEV)(i,{children:r("updated")},void 0,!1),(0,e.jsxDEV)(i,{children:r("error")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(V,{children:l.map(t=>(0,e.jsxDEV)(b,{"data-testid":`mg-row-${t.id}`,children:[(0,e.jsxDEV)(o,{children:t.id},void 0,!1),(0,e.jsxDEV)(o,{children:t.direction},void 0,!1),(0,e.jsxDEV)(o,{children:(0,e.jsxDEV)(T,{variant:"secondary",children:t.status},void 0,!1)},void 0,!1),(0,e.jsxDEV)(o,{children:t.processed},void 0,!1),(0,e.jsxDEV)(o,{children:t.changed},void 0,!1),(0,e.jsxDEV)(o,{children:z(t.updatedAt)},void 0,!1),(0,e.jsxDEV)(o,{children:t.error??""},void 0,!1)]},t.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs",children:[(0,e.jsxDEV)(y,{children:r("Run migration")},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)(w,{"aria-label":r("Migration id"),className:"w-auto","data-testid":"mg-id-input",onChange:ne,placeholder:r("migration id"),value:x},void 0,!1),(0,e.jsxDEV)("select",{"aria-label":r("Direction"),className:"flex h-9 rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"mg-direction",onChange:se,value:R,children:[(0,e.jsxDEV)("option",{value:"up",children:r("up")},void 0,!1),(0,e.jsxDEV)("option",{value:"down",children:r("down")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)(y,{className:"flex items-center gap-1.5",htmlFor:"mg-dry-run",children:[(0,e.jsxDEV)("input",{checked:f,className:"size-4 accent-primary","data-testid":"mg-dry-run",id:"mg-dry-run",onChange:de,type:"checkbox"},void 0,!1),r("Dry run")]},void 0,!0),f?(0,e.jsxDEV)(L,{"data-testid":"mg-run",disabled:u||!I,onClick:E,size:"sm",type:"button",children:r(u?"Running\u2026":"Run")},void 0,!1):(0,e.jsxDEV)(W,{confirmLabel:r(u?"Running\u2026":"Run migration?"),disabled:u||!I,onConfirm:E,testId:"mg-run",children:r("Run")},void 0,!1)]},void 0,!0)]},void 0,!0),C!==null&&(0,e.jsxDEV)("pre",{className:"text-sm text-destructive whitespace-pre-wrap","data-testid":"mg-run-error",role:"alert",children:C},void 0,!1),d!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"mg-run-result",children:[d.dryRun?r("Dry run: "):"",r("{status} \u2014 processed",{status:d.status}),d.processed,r(", changed"),d.changed]},void 0,!0)]},void 0,!0)},"MigrationsPanel");export{we as MigrationsPanel};
@@ -1,3 +1,3 @@
1
- import{a as J}from"./chunk-TDL7NEWA.js";import{a as P}from"./chunk-VLXV72QE.js";import{a as B}from"./chunk-K3GNLVYK.js";import{b as j}from"./chunk-TBMYIZIO.js";import"./chunk-3CJW6NWG.js";import{c as D}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as f}from"./chunk-AQGOX5DK.js";import{c as L}from"./chunk-DVKPRFIJ.js";import{a as v,e as y}from"./chunk-SEU5V7I6.js";import"./chunk-CKSHCYGC.js";import{f as _}from"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as E,e as S,f as w,g as b,k as I}from"./chunk-PVZI3CXP.js";import{b as N}from"./chunk-GMSGZDDH.js";import{a as o,e as R,f as K,h as U}from"./chunk-RRCPZMC2.js";var c=R(K(),1);var e=R(U(),1);var V=S(f.exportShard),X=S(f.importShard),z=o(m=>m.map(a=>JSON.stringify(a)).join(`
1
+ import{a as J}from"./chunk-TDL7NEWA.js";import{a as P}from"./chunk-VLXV72QE.js";import{a as B}from"./chunk-K3GNLVYK.js";import{b as j}from"./chunk-TBMYIZIO.js";import"./chunk-3CJW6NWG.js";import{c as D}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as f}from"./chunk-BOXSWNXZ.js";import{c as L}from"./chunk-DVKPRFIJ.js";import{a as v,e as y}from"./chunk-SEU5V7I6.js";import"./chunk-CKSHCYGC.js";import{f as _}from"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as E,e as S,f as w,g as b,k as I}from"./chunk-PVZI3CXP.js";import{b as N}from"./chunk-GMSGZDDH.js";import{a as o,e as R,f as K,h as U}from"./chunk-RRCPZMC2.js";var c=R(K(),1);var e=R(U(),1);var V=S(f.exportShard),X=S(f.importShard),z=o(m=>m.map(a=>JSON.stringify(a)).join(`
2
2
  `),"toNdjson"),G=o(m=>{let a=[],x=m.split(`
3
3
  `);for(let[r,n]of x.entries()){let h=n.trim();if(h==="")continue;let l=JSON.parse(h);if(typeof l!="object"||l===null)throw new N("INTERNAL",`line ${(r+1).toString()}: expected a { table, doc } object`);let s=l;if(typeof s.table!="string"||typeof s.doc!="object"||s.doc===null||Array.isArray(s.doc))throw new N("INTERNAL",`line ${(r+1).toString()}: expected a { table, doc } object`);a.push(s)}return a},"parseNdjson"),ie=o(({initialShardKey:m})=>{let a=_(),x=L(),r=E(),[n,h]=(0,c.useState)(m??""),[l,s]=(0,c.useState)(""),[C,p]=(0,c.useState)(!1),[T,u]=(0,c.useState)(null),[i,g]=(0,c.useState)(null),[A,O]=(0,c.useState)(null),$=o(async()=>{p(!0),u(null),g(null);try{let t=await a.query(V,{},w(n));j(n),s(z(t.rows)),O(t.rows.length)}catch(t){u(b(t))}finally{p(!1)}},"exportShard"),k=o(async()=>{p(!0),u(null),g(null),O(null);let t;try{t=G(l)}catch(d){u(r("Invalid NDJSON: {message}",{message:b(d)})),p(!1);return}try{let d=await a.query(X,{rows:t},w(n));j(n),g(d),x(f.readTablePage),x(f.listTables)}catch(d){u(b(d))}finally{p(!1)}},"importShard"),M=i===null?0:Object.values(i.inserted).reduce((t,d)=>t+d,0),q=o(()=>{I($())},"runExport"),F=o(()=>{I(k())},"runImport"),H=o(t=>{s(t.target.value)},"onNdjsonChange");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-export-import",children:[(0,e.jsxDEV)(v,{className:"rounded-xl border border-border bg-card shadow-xs",children:[(0,e.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,e.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r("Export")},void 0,!1)},void 0,!1),(0,e.jsxDEV)(y,{className:"flex flex-col gap-3 p-4",children:[(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)(B,{onChange:h,testId:"ei-shard-input",value:n},void 0,!1),(0,e.jsxDEV)(D,{"data-testid":"ei-export",disabled:C,onClick:q,type:"button",children:r("Export")},void 0,!1)]},void 0,!0),A!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"ei-export-result",children:r("Exported {count} rows.",{count:A})},void 0,!1)]},void 0,!0)]},void 0,!0),(0,e.jsxDEV)(v,{className:"rounded-xl border border-border bg-card shadow-xs",children:[(0,e.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,e.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r("Import")},void 0,!1)},void 0,!1),(0,e.jsxDEV)(y,{className:"flex flex-col gap-3 p-4",children:[(0,e.jsxDEV)(P,{"aria-label":"NDJSON",className:"font-mono text-xs min-h-40 rounded-md","data-testid":"ei-ndjson",onChange:H,placeholder:'{"table":"messages","doc":{\u2026}}',value:l},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:(0,e.jsxDEV)(J,{confirmLabel:r("Import (writes rows)?"),disabled:C||l.trim()==="",onConfirm:F,testId:"ei-import",children:r("Import")},void 0,!1)},void 0,!1),i!==null&&(0,e.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"ei-import-result",children:[(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:r("Inserted {inserted}, {conflicts} conflicts, {errors} errors.",{conflicts:i.conflicts,errors:i.errors.length,inserted:M})},void 0,!1),i.errors.length>0&&(0,e.jsxDEV)("ul",{className:"flex flex-col gap-1","data-testid":"ei-import-errors",children:i.errors.map(t=>(0,e.jsxDEV)("li",{className:"text-xs text-destructive",children:r("line {line} ({table}): {message}",{line:t.line,message:t.message,table:t.table})},`${t.table}-${t.line.toString()}`,!1))},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0),T!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"ei-error",role:"alert",children:T},void 0,!1)]},void 0,!0)},"ExportImportPanel");export{ie as ExportImportPanel};