@lunora/studio 1.0.0-alpha.61 → 1.0.0-alpha.63

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 (111) hide show
  1. package/dist/standalone/{chunk-JC6WYIHM.js → chunk-26TQSVUV.js} +1 -1
  2. package/dist/standalone/{chunk-ZFWEPGWG.js → chunk-2OUPA2WJ.js} +1 -1
  3. package/dist/standalone/{chunk-HA34GYEX.js → chunk-2PJNAWB3.js} +1 -1
  4. package/dist/standalone/{chunk-CVMRZUF5.js → chunk-2Y36BVVM.js} +1 -1
  5. package/dist/standalone/{chunk-KNN3ZEQ7.js → chunk-37RIZFJ4.js} +1 -1
  6. package/dist/standalone/{chunk-UNN4CESU.js → chunk-3NHORZCK.js} +1 -1
  7. package/dist/standalone/{chunk-UNDFOYRI.js → chunk-3RTTXLMU.js} +1 -1
  8. package/dist/standalone/{chunk-UHHTEBC3.js → chunk-3XIESWL4.js} +1 -1
  9. package/dist/standalone/{chunk-KLLYGWNF.js → chunk-4CGALXS3.js} +1 -1
  10. package/dist/standalone/{chunk-O62HJZV3.js → chunk-4MSKCWUL.js} +1 -1
  11. package/dist/standalone/{chunk-SEDZDNQF.js → chunk-4UOFSGUS.js} +1 -1
  12. package/dist/standalone/{chunk-SA6MBPBL.js → chunk-54MMVNPT.js} +1 -1
  13. package/dist/standalone/{chunk-RE6UWCMG.js → chunk-5L2MD6F6.js} +1 -1
  14. package/dist/standalone/{chunk-HY46NTNW.js → chunk-5RF4QDDA.js} +1 -1
  15. package/dist/standalone/{chunk-YT7VXQVX.js → chunk-5Y3QLNWX.js} +1 -1
  16. package/dist/standalone/{chunk-LPOKAJT4.js → chunk-66TS6K5F.js} +1 -1
  17. package/dist/standalone/{chunk-4FNHHFWR.js → chunk-6ST5ECQA.js} +1 -1
  18. package/dist/standalone/{chunk-C4VURT57.js → chunk-7LQWFOEU.js} +1 -1
  19. package/dist/standalone/{chunk-46IB4C4Q.js → chunk-7QIFDWQV.js} +1 -1
  20. package/dist/standalone/{chunk-AKTGRZXN.js → chunk-7RXOPYR5.js} +1 -1
  21. package/dist/standalone/{chunk-PTTDIYGP.js → chunk-7T7UOTYK.js} +1 -1
  22. package/dist/standalone/{chunk-XRKCGQM2.js → chunk-7YAUSG6S.js} +1 -1
  23. package/dist/standalone/{chunk-PWDMXMRD.js → chunk-7YEFOSPH.js} +1 -1
  24. package/dist/standalone/chunk-AVAC26HJ.js +1 -0
  25. package/dist/standalone/{chunk-VUJGR4PB.js → chunk-AX4PAEGP.js} +1 -1
  26. package/dist/standalone/{chunk-JRWBGR5B.js → chunk-B5E7GQHG.js} +1 -1
  27. package/dist/standalone/{chunk-3DTM4GI5.js → chunk-BEH5N5ZA.js} +1 -1
  28. package/dist/standalone/{chunk-YNBJ6ICE.js → chunk-BGBLQ563.js} +1 -1
  29. package/dist/standalone/{chunk-SZUHZ2OG.js → chunk-BY4QROKU.js} +1 -1
  30. package/dist/standalone/{chunk-7Z5QEFR4.js → chunk-CFPZYHPY.js} +1 -1
  31. package/dist/standalone/{chunk-BAIN7UJ4.js → chunk-DCJKCERP.js} +1 -1
  32. package/dist/standalone/{chunk-P4J6XNG3.js → chunk-DY7CLL2H.js} +1 -1
  33. package/dist/standalone/{chunk-VEFNSN7P.js → chunk-ESVP44Y3.js} +1 -1
  34. package/dist/standalone/{chunk-IE4ROTQD.js → chunk-F6LUZVVI.js} +1 -1
  35. package/dist/standalone/{chunk-UY2Y5CXB.js → chunk-FXCBF4XT.js} +1 -1
  36. package/dist/standalone/{chunk-BHWSIIDT.js → chunk-GBQHGYGH.js} +1 -1
  37. package/dist/standalone/{chunk-HMIOF5GV.js → chunk-GHUPW2Y5.js} +1 -1
  38. package/dist/standalone/{chunk-FXFK4M4E.js → chunk-GMR677FL.js} +1 -1
  39. package/dist/standalone/{chunk-UWF5DOGV.js → chunk-GRL5MG3Z.js} +1 -1
  40. package/dist/standalone/{chunk-GTXVH7I5.js → chunk-H3V2QQ4K.js} +1 -1
  41. package/dist/standalone/{chunk-KZ2YUNMR.js → chunk-H7NIIBHH.js} +1 -1
  42. package/dist/standalone/{chunk-H6SIM4BT.js → chunk-HPFLBYRI.js} +1 -1
  43. package/dist/standalone/{chunk-CZEUVNCQ.js → chunk-IC4L6G56.js} +1 -1
  44. package/dist/standalone/{chunk-PGDWFWH5.js → chunk-IGBEXNXY.js} +1 -1
  45. package/dist/standalone/{chunk-TEIBKU46.js → chunk-IJFCOWEQ.js} +1 -1
  46. package/dist/standalone/{chunk-TYTJDFX2.js → chunk-ILNELDFC.js} +1 -1
  47. package/dist/standalone/{chunk-AGVJJQFL.js → chunk-IPHXIGYP.js} +1 -1
  48. package/dist/standalone/{chunk-TAE2H7PU.js → chunk-IUW24D4X.js} +1 -1
  49. package/dist/standalone/{chunk-C4O5UR4Y.js → chunk-IVFHIQOT.js} +1 -1
  50. package/dist/standalone/{chunk-MZEK4SGD.js → chunk-JGY4NGFW.js} +1 -1
  51. package/dist/standalone/{chunk-JLFCXBNQ.js → chunk-JN2Y24PY.js} +1 -1
  52. package/dist/standalone/{chunk-CYET4BRZ.js → chunk-K7M4SMQ7.js} +1 -1
  53. package/dist/standalone/{chunk-6CLVIOCB.js → chunk-KUVMORDQ.js} +1 -1
  54. package/dist/standalone/{chunk-NCCUM26H.js → chunk-KYF2E5CJ.js} +1 -1
  55. package/dist/standalone/{chunk-QC5HCNJZ.js → chunk-LA3HEESS.js} +1 -1
  56. package/dist/standalone/{chunk-UDZY7MKE.js → chunk-LE56LPNH.js} +1 -1
  57. package/dist/standalone/{chunk-SNDYNCAA.js → chunk-LEDWUPXM.js} +1 -1
  58. package/dist/standalone/{chunk-YQ5PILIJ.js → chunk-LFKCLLPT.js} +1 -1
  59. package/dist/standalone/{chunk-V66TSUKV.js → chunk-LFXFP4IF.js} +1 -1
  60. package/dist/standalone/{chunk-VUXJER3D.js → chunk-LLXFYRGQ.js} +1 -1
  61. package/dist/standalone/{chunk-KJTLW5W2.js → chunk-LWECXQWP.js} +3 -3
  62. package/dist/standalone/{chunk-2A4RKII2.js → chunk-M2B3MDFJ.js} +1 -1
  63. package/dist/standalone/{chunk-ICKBVXPP.js → chunk-M536Y2KX.js} +1 -1
  64. package/dist/standalone/{chunk-LKHUVEHX.js → chunk-M7QCL3ZP.js} +1 -1
  65. package/dist/standalone/{chunk-Q5WXTZWX.js → chunk-MIQTKZAR.js} +1 -1
  66. package/dist/standalone/{chunk-IYYTWZ2E.js → chunk-NPIULIRO.js} +1 -1
  67. package/dist/standalone/{chunk-SKJZDOHG.js → chunk-OWADN6BI.js} +1 -1
  68. package/dist/standalone/{chunk-IBCKC2BO.js → chunk-OZGWNJXD.js} +1 -1
  69. package/dist/standalone/{chunk-CKO3F55C.js → chunk-P4DHFWH7.js} +1 -1
  70. package/dist/standalone/{chunk-3MHKT76P.js → chunk-P4J3Z3SA.js} +1 -1
  71. package/dist/standalone/chunk-PF7V3G2Z.js +62 -0
  72. package/dist/standalone/{chunk-W572365D.js → chunk-PYXZLNG2.js} +1 -1
  73. package/dist/standalone/{chunk-R43KHQDA.js → chunk-PZPFWABF.js} +1 -1
  74. package/dist/standalone/chunk-QBWRC5YX.js +1 -0
  75. package/dist/standalone/{chunk-GS7OBQO5.js → chunk-QLJJ5YYZ.js} +1 -1
  76. package/dist/standalone/{chunk-ZMFZRGAN.js → chunk-QWGT25SE.js} +1 -1
  77. package/dist/standalone/{chunk-RC2K5RBE.js → chunk-RLEENOIX.js} +1 -1
  78. package/dist/standalone/{chunk-Z7MUQMLE.js → chunk-RWZKO2P6.js} +1 -1
  79. package/dist/standalone/{chunk-PR2SE2MD.js → chunk-SD4BERSA.js} +1 -1
  80. package/dist/standalone/{chunk-KYCAYNXM.js → chunk-SFDOII3B.js} +1 -1
  81. package/dist/standalone/{chunk-UNXX5GQH.js → chunk-SM67QXQI.js} +1 -1
  82. package/dist/standalone/{chunk-6UYILUSX.js → chunk-SMIESS7P.js} +1 -1
  83. package/dist/standalone/{chunk-KSRXMTBV.js → chunk-T6VMSOBB.js} +1 -1
  84. package/dist/standalone/{chunk-WYFLGXZ3.js → chunk-TCQEDMAQ.js} +1 -1
  85. package/dist/standalone/{chunk-23HKRH5H.js → chunk-TDE4AR5O.js} +1 -1
  86. package/dist/standalone/{chunk-K5PFWU5J.js → chunk-THIXMMZD.js} +1 -1
  87. package/dist/standalone/{chunk-RUP3M2GF.js → chunk-TRHTFGFW.js} +2 -2
  88. package/dist/standalone/{chunk-Q34MSC2F.js → chunk-UNUU7CJJ.js} +1 -1
  89. package/dist/standalone/{chunk-FYAJPWE7.js → chunk-UVDPQU7J.js} +1 -1
  90. package/dist/standalone/{chunk-JKPK25JO.js → chunk-UZERI5YC.js} +1 -1
  91. package/dist/standalone/{chunk-P2NBOUGZ.js → chunk-V4RWA7QI.js} +1 -1
  92. package/dist/standalone/{chunk-UZYGEOWY.js → chunk-V53KNYRN.js} +1 -1
  93. package/dist/standalone/{chunk-7AZZ7OJO.js → chunk-VSS7NFZJ.js} +1 -1
  94. package/dist/standalone/{chunk-7CRLAMGB.js → chunk-WQTUQZUM.js} +1 -1
  95. package/dist/standalone/{chunk-6I62RSI5.js → chunk-X2FQ6B5V.js} +1 -1
  96. package/dist/standalone/{chunk-UREY4GLG.js → chunk-XBDKZZ67.js} +1 -1
  97. package/dist/standalone/{chunk-TO6NLVFD.js → chunk-XBGJVK32.js} +1 -1
  98. package/dist/standalone/{chunk-QJKRHZYV.js → chunk-XITDHIVL.js} +1 -1
  99. package/dist/standalone/{chunk-6OKDCV7J.js → chunk-XQCVZAGU.js} +1 -1
  100. package/dist/standalone/{chunk-6P7HIPUE.js → chunk-XQGANNLS.js} +1 -1
  101. package/dist/standalone/{chunk-4AYEV5UN.js → chunk-XXQUMVWH.js} +1 -1
  102. package/dist/standalone/{chunk-H6WOFY6A.js → chunk-YQP2EYOC.js} +1 -1
  103. package/dist/standalone/chunk-ZJGP6EKR.js +1 -0
  104. package/dist/standalone/{chunk-J2LMP2A7.js → chunk-ZKEVSU66.js} +1 -1
  105. package/dist/standalone/{chunk-CWWGDW4V.js → chunk-ZSWWTXVW.js} +1 -1
  106. package/dist/standalone/studio.js +2 -2
  107. package/package.json +10 -10
  108. package/dist/standalone/chunk-725RLB7D.js +0 -1
  109. package/dist/standalone/chunk-KOC5KV3E.js +0 -1
  110. package/dist/standalone/chunk-OTJOI23O.js +0 -62
  111. package/dist/standalone/chunk-XDKFPBIL.js +0 -1
@@ -1 +1 @@
1
- import{a as q,b as L,c as B,d as f,e as c,f as d}from"./chunk-Q5WXTZWX.js";import{a as I,e as j}from"./chunk-JKPK25JO.js";import{R as Q}from"./chunk-7Z5QEFR4.js";import"./chunk-46IB4C4Q.js";import{c as W}from"./chunk-UY2Y5CXB.js";import"./chunk-ZFWEPGWG.js";import"./chunk-4FNHHFWR.js";import{f as F}from"./chunk-KJTLW5W2.js";import"./chunk-UREY4GLG.js";import{a as Z}from"./chunk-6OKDCV7J.js";import{d as K,h as S,l as $,m as V}from"./chunk-KLLYGWNF.js";import"./chunk-UDZY7MKE.js";import{a as h,e as C,f as R,g as P,h as U}from"./chunk-UHHTEBC3.js";var A=C(P(),1);var n=C(R(),1);var e=C(U(),1);var X=10,g=h(v=>{let l=(0,A.c)(7),{label:m,value:t}=v,r;l[0]!==m?(r=(0,e.jsx)("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:m}),l[0]=m,l[1]=r):r=l[1];let p=t??"\u2014",s;l[2]!==p?(s=(0,e.jsx)("span",{className:"font-mono text-sm",children:p}),l[2]=p,l[3]=s):s=l[3];let u;return l[4]!==r||l[5]!==s?(u=(0,e.jsxs)("div",{className:"flex flex-col gap-0.5",children:[r,s]}),l[4]=r,l[5]=s,l[6]=u):u=l[6],u},"g"),se=h(({loadIndexes:v,runQuery:l}={})=>{let m=F(),t=K(),[r,p]=(0,n.useState)(null),[s,u]=(0,n.useState)(null),[N,E]=(0,n.useState)(null),[b,D]=(0,n.useState)(""),[x,y]=(0,n.useState)(null),[M,w]=(0,n.useState)(null),[T,z]=(0,n.useState)(!1);(0,n.useEffect)(()=>{let a={cancelled:!1};return V((async()=>{try{let i=await(v??(()=>m.listVectorIndexes()))();a.cancelled||(p(i),u(null),E(k=>k??i[0]?.name??null))}catch(i){a.cancelled||(p(null),u(S(i)))}})()),()=>{a.cancelled=!0}},[m,v]);let o=r?.find(a=>a.name===N)??null,G=h(a=>{E(a.currentTarget.dataset.index??null),y(null),w(null)},"K"),H=h(a=>{D(a.target.value)},"T"),J=h(async()=>{let a=b.trim();if(!(N===null||a==="")){z(!0),w(null);try{let i=await(l??(k=>m.queryVectorIndex(k)))({name:N,text:a,topK:X});y(i)}catch(i){y(null),w(S(i))}finally{z(!1)}}},"Z"),O=h(()=>{V(J())},"z");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-vector-browser",children:[s!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"vector-error",role:"alert",children:s}),r!==null&&r.length===0&&(0,e.jsx)(Z,{description:t("Indexes declared with .vectorize() or defineVectorIndex() appear here."),icon:(0,e.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsx)("path",{d:"M4 7l8-4 8 4-8 4-8-4Zm0 5 8 4 8-4M4 17l8 4 8-4"})}),testId:"vector-empty",title:t("No vector indexes.")}),r!==null&&r.length>0&&(0,e.jsx)(I,{className:"overflow-hidden py-0",children:(0,e.jsx)(j,{className:"px-0",children:(0,e.jsxs)(q,{"data-testid":"vector-table",children:[(0,e.jsx)(L,{children:(0,e.jsxs)(f,{children:[(0,e.jsx)(c,{children:t("name")}),(0,e.jsx)(c,{children:t("table")}),(0,e.jsx)(c,{children:t("dimensions")}),(0,e.jsx)(c,{children:t("metric")}),(0,e.jsx)(c,{children:t("vectors")})]})}),(0,e.jsx)(B,{children:r.map(a=>(0,e.jsxs)(f,{className:a.name===N?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-index":a.name,"data-testid":`vector-row-${a.name}`,onClick:G,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:a.name}),(0,e.jsx)(d,{className:"font-mono text-xs",children:a.table}),(0,e.jsx)(d,{className:"tabular-nums",children:a.dimensions??"\u2014"}),(0,e.jsx)(d,{children:a.metric??"\u2014"}),(0,e.jsx)(d,{className:"tabular-nums",children:a.vectorsCount??"\u2014"})]},a.name))})]})})}),o!==null&&(0,e.jsxs)("section",{className:"border border-border bg-card p-3","data-testid":"vector-detail",children:[(0,e.jsxs)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,e.jsx)(g,{label:t("field"),value:o.field}),(0,e.jsx)(g,{label:t("dimensions"),value:o.dimensions}),(0,e.jsx)(g,{label:t("metric"),value:o.metric}),(0,e.jsx)(g,{label:t("vectors"),value:o.vectorsCount})]}),o.metadata!==void 0&&o.metadata.length>0&&(0,e.jsxs)("p",{className:"mt-3 text-xs text-muted-foreground","data-testid":"vector-metadata",children:[t("metadata"),": ",(0,e.jsx)("span",{className:"font-mono",children:o.metadata.join(", ")})]}),(0,e.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,e.jsx)(Q,{className:"min-w-[18rem] flex-1","data-testid":"vector-query-input",onChange:H,placeholder:t("Search by similarity\u2026"),value:b}),(0,e.jsx)(W,{"data-testid":"vector-search",disabled:T||b.trim()==="",onClick:O,children:t(T?"Searching\u2026":"Search")})]}),M!==null&&(0,e.jsx)("p",{className:"mt-2 text-sm text-destructive","data-testid":"vector-query-error",role:"alert",children:M}),x!==null&&x.length===0&&(0,e.jsx)("p",{className:"mt-2 text-sm text-muted-foreground","data-testid":"vector-no-matches",children:t("No matches.")}),x!==null&&x.length>0&&(0,e.jsx)(I,{className:"mt-3 overflow-hidden py-0",children:(0,e.jsx)(j,{className:"px-0",children:(0,e.jsxs)(q,{"data-testid":"vector-matches",children:[(0,e.jsx)(L,{children:(0,e.jsxs)(f,{children:[(0,e.jsx)(c,{children:t("id")}),(0,e.jsx)(c,{children:t("score")}),(0,e.jsx)(c,{children:t("metadata")})]})}),(0,e.jsx)(B,{children:x.map(a=>(0,e.jsxs)(f,{"data-testid":`vector-match-${a.id}`,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:a.id}),(0,e.jsx)(d,{className:"tabular-nums",children:a.score.toFixed(4)}),(0,e.jsx)(d,{className:"max-w-md truncate font-mono text-xs",children:a.metadata===void 0?"\u2014":$(a.metadata)})]},a.id))})]})})})]})]})},"ce");export{se as VectorBrowser};
1
+ import{a as q,b as L,c as B,d as f,e as c,f as d}from"./chunk-MIQTKZAR.js";import{a as I,e as j}from"./chunk-UZERI5YC.js";import{R as Q}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as W}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import"./chunk-6ST5ECQA.js";import{f as F}from"./chunk-LWECXQWP.js";import"./chunk-XBDKZZ67.js";import{a as Z}from"./chunk-XQCVZAGU.js";import{d as K,h as S,l as $,m as V}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a as h,e as C,f as R,g as P,h as U}from"./chunk-3XIESWL4.js";var A=C(P(),1);var n=C(R(),1);var e=C(U(),1);var X=10,g=h(v=>{let l=(0,A.c)(7),{label:m,value:t}=v,r;l[0]!==m?(r=(0,e.jsx)("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:m}),l[0]=m,l[1]=r):r=l[1];let p=t??"\u2014",s;l[2]!==p?(s=(0,e.jsx)("span",{className:"font-mono text-sm",children:p}),l[2]=p,l[3]=s):s=l[3];let u;return l[4]!==r||l[5]!==s?(u=(0,e.jsxs)("div",{className:"flex flex-col gap-0.5",children:[r,s]}),l[4]=r,l[5]=s,l[6]=u):u=l[6],u},"g"),se=h(({loadIndexes:v,runQuery:l}={})=>{let m=F(),t=K(),[r,p]=(0,n.useState)(null),[s,u]=(0,n.useState)(null),[N,E]=(0,n.useState)(null),[b,D]=(0,n.useState)(""),[x,y]=(0,n.useState)(null),[M,w]=(0,n.useState)(null),[T,z]=(0,n.useState)(!1);(0,n.useEffect)(()=>{let a={cancelled:!1};return V((async()=>{try{let i=await(v??(()=>m.listVectorIndexes()))();a.cancelled||(p(i),u(null),E(k=>k??i[0]?.name??null))}catch(i){a.cancelled||(p(null),u(S(i)))}})()),()=>{a.cancelled=!0}},[m,v]);let o=r?.find(a=>a.name===N)??null,G=h(a=>{E(a.currentTarget.dataset.index??null),y(null),w(null)},"K"),H=h(a=>{D(a.target.value)},"T"),J=h(async()=>{let a=b.trim();if(!(N===null||a==="")){z(!0),w(null);try{let i=await(l??(k=>m.queryVectorIndex(k)))({name:N,text:a,topK:X});y(i)}catch(i){y(null),w(S(i))}finally{z(!1)}}},"Z"),O=h(()=>{V(J())},"z");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-vector-browser",children:[s!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"vector-error",role:"alert",children:s}),r!==null&&r.length===0&&(0,e.jsx)(Z,{description:t("Indexes declared with .vectorize() or defineVectorIndex() appear here."),icon:(0,e.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsx)("path",{d:"M4 7l8-4 8 4-8 4-8-4Zm0 5 8 4 8-4M4 17l8 4 8-4"})}),testId:"vector-empty",title:t("No vector indexes.")}),r!==null&&r.length>0&&(0,e.jsx)(I,{className:"overflow-hidden py-0",children:(0,e.jsx)(j,{className:"px-0",children:(0,e.jsxs)(q,{"data-testid":"vector-table",children:[(0,e.jsx)(L,{children:(0,e.jsxs)(f,{children:[(0,e.jsx)(c,{children:t("name")}),(0,e.jsx)(c,{children:t("table")}),(0,e.jsx)(c,{children:t("dimensions")}),(0,e.jsx)(c,{children:t("metric")}),(0,e.jsx)(c,{children:t("vectors")})]})}),(0,e.jsx)(B,{children:r.map(a=>(0,e.jsxs)(f,{className:a.name===N?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-index":a.name,"data-testid":`vector-row-${a.name}`,onClick:G,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:a.name}),(0,e.jsx)(d,{className:"font-mono text-xs",children:a.table}),(0,e.jsx)(d,{className:"tabular-nums",children:a.dimensions??"\u2014"}),(0,e.jsx)(d,{children:a.metric??"\u2014"}),(0,e.jsx)(d,{className:"tabular-nums",children:a.vectorsCount??"\u2014"})]},a.name))})]})})}),o!==null&&(0,e.jsxs)("section",{className:"border border-border bg-card p-3","data-testid":"vector-detail",children:[(0,e.jsxs)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,e.jsx)(g,{label:t("field"),value:o.field}),(0,e.jsx)(g,{label:t("dimensions"),value:o.dimensions}),(0,e.jsx)(g,{label:t("metric"),value:o.metric}),(0,e.jsx)(g,{label:t("vectors"),value:o.vectorsCount})]}),o.metadata!==void 0&&o.metadata.length>0&&(0,e.jsxs)("p",{className:"mt-3 text-xs text-muted-foreground","data-testid":"vector-metadata",children:[t("metadata"),": ",(0,e.jsx)("span",{className:"font-mono",children:o.metadata.join(", ")})]}),(0,e.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,e.jsx)(Q,{className:"min-w-[18rem] flex-1","data-testid":"vector-query-input",onChange:H,placeholder:t("Search by similarity\u2026"),value:b}),(0,e.jsx)(W,{"data-testid":"vector-search",disabled:T||b.trim()==="",onClick:O,children:t(T?"Searching\u2026":"Search")})]}),M!==null&&(0,e.jsx)("p",{className:"mt-2 text-sm text-destructive","data-testid":"vector-query-error",role:"alert",children:M}),x!==null&&x.length===0&&(0,e.jsx)("p",{className:"mt-2 text-sm text-muted-foreground","data-testid":"vector-no-matches",children:t("No matches.")}),x!==null&&x.length>0&&(0,e.jsx)(I,{className:"mt-3 overflow-hidden py-0",children:(0,e.jsx)(j,{className:"px-0",children:(0,e.jsxs)(q,{"data-testid":"vector-matches",children:[(0,e.jsx)(L,{children:(0,e.jsxs)(f,{children:[(0,e.jsx)(c,{children:t("id")}),(0,e.jsx)(c,{children:t("score")}),(0,e.jsx)(c,{children:t("metadata")})]})}),(0,e.jsx)(B,{children:x.map(a=>(0,e.jsxs)(f,{"data-testid":`vector-match-${a.id}`,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:a.id}),(0,e.jsx)(d,{className:"tabular-nums",children:a.score.toFixed(4)}),(0,e.jsx)(d,{className:"max-w-md truncate font-mono text-xs",children:a.metadata===void 0?"\u2014":$(a.metadata)})]},a.id))})]})})})]})]})},"ce");export{se as VectorBrowser};
@@ -1 +1 @@
1
- import{b as H}from"./chunk-SKHEGARW.js";import{a as q}from"./chunk-Q34MSC2F.js";import"./chunk-4AYEV5UN.js";import{b as P}from"./chunk-SKJZDOHG.js";import{a as z,b as B,c as G,d as A,e as _,f as E}from"./chunk-Q5WXTZWX.js";import{a as O,e as V}from"./chunk-JKPK25JO.js";import{b as M}from"./chunk-K5PFWU5J.js";import"./chunk-4FNHHFWR.js";import{a as R}from"./chunk-GXZAXNZI.js";import"./chunk-KJTLW5W2.js";import"./chunk-UREY4GLG.js";import{d as F}from"./chunk-KLLYGWNF.js";import"./chunk-UDZY7MKE.js";import{a as S,e as L,f as W,g as $,h as X}from"./chunk-UHHTEBC3.js";var J=L($(),1),te=L(W(),1);var r=L(X(),1);var Y={binding:"outline",secret:"destructive",var:"secondary"},me=S(s=>{let e=(0,J.c)(68),{initialShardKey:Q}=s,t=F(),N;e[0]===Symbol.for("react.memo_cache_sentinel")?(N={},e[0]=N):N=e[0];let C=Q??"",k;e[1]!==C?(k={shardKey:C},e[1]=C,e[2]=k):k=e[2];let{data:w,error:d,errorSource:D,isLoading:K}=P(R.getSettings,N,k),j;e:{let a=w?.deploy;if(a===void 0){let n;e[3]===Symbol.for("react.memo_cache_sentinel")?(n=[],e[3]=n):n=e[3],j=n;break e}let i;if(e[4]!==a.deploymentId||e[5]!==a.environment||e[6]!==a.versionTag||e[7]!==a.workerUrl||e[8]!==t){if(i=[],a.workerUrl!==void 0){let n;e[10]!==t?(n=t("URL"),e[10]=t,e[11]=n):n=e[11];let l;e[12]!==a.workerUrl||e[13]!==n?(l={label:n,value:a.workerUrl},e[12]=a.workerUrl,e[13]=n,e[14]=l):l=e[14],i.push(l)}if(a.environment!==void 0){let n;e[15]!==t?(n=t("Environment"),e[15]=t,e[16]=n):n=e[16];let l;e[17]!==a.environment||e[18]!==n?(l={label:n,value:a.environment},e[17]=a.environment,e[18]=n,e[19]=l):l=e[19],i.push(l)}if(a.deploymentId!==void 0){let n;e[20]!==t?(n=t("Deployment"),e[20]=t,e[21]=n):n=e[21];let l;e[22]!==a.deploymentId||e[23]!==n?(l={label:n,value:a.deploymentId},e[22]=a.deploymentId,e[23]=n,e[24]=l):l=e[24],i.push(l)}if(a.versionTag!==void 0){let n;e[25]!==t?(n=t("Version"),e[25]=t,e[26]=n):n=e[26];let l;e[27]!==a.versionTag||e[28]!==n?(l={label:n,value:a.versionTag},e[27]=a.versionTag,e[28]=n,e[29]=l):l=e[29],i.push(l)}e[4]=a.deploymentId,e[5]=a.environment,e[6]=a.versionTag,e[7]=a.workerUrl,e[8]=t,e[9]=i}else i=e[9];j=i}let I=j,T;e[30]!==w?.settings?(T=w?.settings??[],e[30]=w?.settings,e[31]=T):T=e[31];let o=T,m;e[32]!==t?(m=t("Open in Cloudflare"),e[32]=t,e[33]=m):m=e[33];let c;e[34]!==m?(c=(0,r.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,r.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"set-cf-link",href:H,rel:"noreferrer",target:"_blank",children:m})}),e[34]=m,e[35]=c):c=e[35];let p;e[36]!==t?(p=t("View-only \u2014 values are masked. Edit vars, secrets, and bindings in wrangler or the Cloudflare dashboard."),e[36]=t,e[37]=p):p=e[37];let h;e[38]!==p?(h=(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"set-readonly-note",children:p}),e[38]=p,e[39]=h):h=e[39];let u;e[40]!==d||e[41]!==D?(u=d!==null&&(0,r.jsx)(q,{error:D,testId:"set-error"}),e[40]=d,e[41]=D,e[42]=u):u=e[42];let f;e[43]!==I||e[44]!==t?(f=I.length>0&&(0,r.jsxs)(O,{className:"py-0","data-testid":"set-deploy",children:[(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Deployment")})}),(0,r.jsx)(V,{className:"py-3",children:(0,r.jsx)("dl",{className:"grid grid-cols-[8rem_minmax(0,1fr)] gap-x-4 gap-y-1 text-sm",children:I.map(Z)})})]}),e[43]=I,e[44]=t,e[45]=f):f=e[45];let g;e[46]!==t?(g=t("Environment & bindings"),e[46]=t,e[47]=g):g=e[47];let v;e[48]!==g?(v=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:g})}),e[48]=g,e[49]=v):v=e[49];let x;e[50]!==d||e[51]!==K||e[52]!==o.length||e[53]!==t?(x=d===null&&!K&&o.length===0&&(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"set-empty",children:t("No environment variables or bindings.")}),e[50]=d,e[51]=K,e[52]=o.length,e[53]=t,e[54]=x):x=e[54];let y;e[55]!==o||e[56]!==t?(y=o.length>0&&(0,r.jsx)(V,{className:"px-0 py-0",children:(0,r.jsxs)(z,{"data-testid":"set-table",children:[(0,r.jsx)(B,{children:(0,r.jsxs)(A,{children:[(0,r.jsx)(_,{children:t("name")}),(0,r.jsx)(_,{children:t("kind")}),(0,r.jsx)(_,{children:t("value")})]})}),(0,r.jsx)(G,{children:o.map(ee)})]})}),e[55]=o,e[56]=t,e[57]=y):y=e[57];let b;e[58]!==v||e[59]!==x||e[60]!==y?(b=(0,r.jsxs)(O,{className:"py-0",children:[v,x,y]}),e[58]=v,e[59]=x,e[60]=y,e[61]=b):b=e[61];let U;return e[62]!==u||e[63]!==f||e[64]!==b||e[65]!==c||e[66]!==h?(U=(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-settings",children:[c,h,u,f,b]}),e[62]=u,e[63]=f,e[64]=b,e[65]=c,e[66]=h,e[67]=U):U=e[67],U},"de");function Z(s){return(0,r.jsxs)("div",{className:"contents","data-testid":"set-deploy-row",children:[(0,r.jsx)("dt",{className:"text-muted-foreground",children:s.label}),(0,r.jsx)("dd",{className:"truncate font-mono text-xs",title:s.value,children:s.value})]},s.label)}S(Z,"H");function ee(s){return(0,r.jsxs)(A,{"data-testid":"set-row",children:[(0,r.jsx)(E,{className:"font-mono text-xs font-medium",children:s.name}),(0,r.jsx)(E,{children:(0,r.jsx)(M,{variant:Y[s.kind],children:s.bindingType??s.kind})}),(0,r.jsx)(E,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",children:s.value??(0,r.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},s.name)}S(ee,"Q");export{me as SettingsPanel};
1
+ import{b as H}from"./chunk-SKHEGARW.js";import{a as q}from"./chunk-UNUU7CJJ.js";import"./chunk-XXQUMVWH.js";import{b as P}from"./chunk-OWADN6BI.js";import{a as z,b as B,c as G,d as A,e as _,f as E}from"./chunk-MIQTKZAR.js";import{a as O,e as V}from"./chunk-UZERI5YC.js";import{b as M}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as R}from"./chunk-GXZAXNZI.js";import"./chunk-LWECXQWP.js";import"./chunk-XBDKZZ67.js";import{d as F}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a as S,e as L,f as W,g as $,h as X}from"./chunk-3XIESWL4.js";var J=L($(),1),te=L(W(),1);var r=L(X(),1);var Y={binding:"outline",secret:"destructive",var:"secondary"},me=S(s=>{let e=(0,J.c)(68),{initialShardKey:Q}=s,t=F(),N;e[0]===Symbol.for("react.memo_cache_sentinel")?(N={},e[0]=N):N=e[0];let C=Q??"",k;e[1]!==C?(k={shardKey:C},e[1]=C,e[2]=k):k=e[2];let{data:w,error:d,errorSource:D,isLoading:K}=P(R.getSettings,N,k),j;e:{let a=w?.deploy;if(a===void 0){let n;e[3]===Symbol.for("react.memo_cache_sentinel")?(n=[],e[3]=n):n=e[3],j=n;break e}let i;if(e[4]!==a.deploymentId||e[5]!==a.environment||e[6]!==a.versionTag||e[7]!==a.workerUrl||e[8]!==t){if(i=[],a.workerUrl!==void 0){let n;e[10]!==t?(n=t("URL"),e[10]=t,e[11]=n):n=e[11];let l;e[12]!==a.workerUrl||e[13]!==n?(l={label:n,value:a.workerUrl},e[12]=a.workerUrl,e[13]=n,e[14]=l):l=e[14],i.push(l)}if(a.environment!==void 0){let n;e[15]!==t?(n=t("Environment"),e[15]=t,e[16]=n):n=e[16];let l;e[17]!==a.environment||e[18]!==n?(l={label:n,value:a.environment},e[17]=a.environment,e[18]=n,e[19]=l):l=e[19],i.push(l)}if(a.deploymentId!==void 0){let n;e[20]!==t?(n=t("Deployment"),e[20]=t,e[21]=n):n=e[21];let l;e[22]!==a.deploymentId||e[23]!==n?(l={label:n,value:a.deploymentId},e[22]=a.deploymentId,e[23]=n,e[24]=l):l=e[24],i.push(l)}if(a.versionTag!==void 0){let n;e[25]!==t?(n=t("Version"),e[25]=t,e[26]=n):n=e[26];let l;e[27]!==a.versionTag||e[28]!==n?(l={label:n,value:a.versionTag},e[27]=a.versionTag,e[28]=n,e[29]=l):l=e[29],i.push(l)}e[4]=a.deploymentId,e[5]=a.environment,e[6]=a.versionTag,e[7]=a.workerUrl,e[8]=t,e[9]=i}else i=e[9];j=i}let I=j,T;e[30]!==w?.settings?(T=w?.settings??[],e[30]=w?.settings,e[31]=T):T=e[31];let o=T,m;e[32]!==t?(m=t("Open in Cloudflare"),e[32]=t,e[33]=m):m=e[33];let c;e[34]!==m?(c=(0,r.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,r.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"set-cf-link",href:H,rel:"noreferrer",target:"_blank",children:m})}),e[34]=m,e[35]=c):c=e[35];let p;e[36]!==t?(p=t("View-only \u2014 values are masked. Edit vars, secrets, and bindings in wrangler or the Cloudflare dashboard."),e[36]=t,e[37]=p):p=e[37];let h;e[38]!==p?(h=(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"set-readonly-note",children:p}),e[38]=p,e[39]=h):h=e[39];let u;e[40]!==d||e[41]!==D?(u=d!==null&&(0,r.jsx)(q,{error:D,testId:"set-error"}),e[40]=d,e[41]=D,e[42]=u):u=e[42];let f;e[43]!==I||e[44]!==t?(f=I.length>0&&(0,r.jsxs)(O,{className:"py-0","data-testid":"set-deploy",children:[(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Deployment")})}),(0,r.jsx)(V,{className:"py-3",children:(0,r.jsx)("dl",{className:"grid grid-cols-[8rem_minmax(0,1fr)] gap-x-4 gap-y-1 text-sm",children:I.map(Z)})})]}),e[43]=I,e[44]=t,e[45]=f):f=e[45];let g;e[46]!==t?(g=t("Environment & bindings"),e[46]=t,e[47]=g):g=e[47];let v;e[48]!==g?(v=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:g})}),e[48]=g,e[49]=v):v=e[49];let x;e[50]!==d||e[51]!==K||e[52]!==o.length||e[53]!==t?(x=d===null&&!K&&o.length===0&&(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"set-empty",children:t("No environment variables or bindings.")}),e[50]=d,e[51]=K,e[52]=o.length,e[53]=t,e[54]=x):x=e[54];let y;e[55]!==o||e[56]!==t?(y=o.length>0&&(0,r.jsx)(V,{className:"px-0 py-0",children:(0,r.jsxs)(z,{"data-testid":"set-table",children:[(0,r.jsx)(B,{children:(0,r.jsxs)(A,{children:[(0,r.jsx)(_,{children:t("name")}),(0,r.jsx)(_,{children:t("kind")}),(0,r.jsx)(_,{children:t("value")})]})}),(0,r.jsx)(G,{children:o.map(ee)})]})}),e[55]=o,e[56]=t,e[57]=y):y=e[57];let b;e[58]!==v||e[59]!==x||e[60]!==y?(b=(0,r.jsxs)(O,{className:"py-0",children:[v,x,y]}),e[58]=v,e[59]=x,e[60]=y,e[61]=b):b=e[61];let U;return e[62]!==u||e[63]!==f||e[64]!==b||e[65]!==c||e[66]!==h?(U=(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-settings",children:[c,h,u,f,b]}),e[62]=u,e[63]=f,e[64]=b,e[65]=c,e[66]=h,e[67]=U):U=e[67],U},"de");function Z(s){return(0,r.jsxs)("div",{className:"contents","data-testid":"set-deploy-row",children:[(0,r.jsx)("dt",{className:"text-muted-foreground",children:s.label}),(0,r.jsx)("dd",{className:"truncate font-mono text-xs",title:s.value,children:s.value})]},s.label)}S(Z,"H");function ee(s){return(0,r.jsxs)(A,{"data-testid":"set-row",children:[(0,r.jsx)(E,{className:"font-mono text-xs font-medium",children:s.name}),(0,r.jsx)(E,{children:(0,r.jsx)(M,{variant:Y[s.kind],children:s.bindingType??s.kind})}),(0,r.jsx)(E,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",children:s.value??(0,r.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},s.name)}S(ee,"Q");export{me as SettingsPanel};
@@ -1 +1 @@
1
- import{a as o,c as r}from"./chunk-ZFWEPGWG.js";import{a as i,e as d,f as l}from"./chunk-UHHTEBC3.js";var s={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},p={...s,position:"fixed",top:0,left:0},u={...s,position:"absolute"};var a=d(l(),1);function b(e,c){let t=a.useRef(e),n=r(c);o(()=>{t.current!==e&&n(t.current)},[e,n]),o(()=>{t.current=e},[e])}i(b,"useValueChanged");export{p as a,u as b,b as c};
1
+ import{a as o,c as r}from"./chunk-2OUPA2WJ.js";import{a as i,e as d,f as l}from"./chunk-3XIESWL4.js";var s={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},p={...s,position:"fixed",top:0,left:0},u={...s,position:"absolute"};var a=d(l(),1);function b(e,c){let t=a.useRef(e),n=r(c);o(()=>{t.current!==e&&n(t.current)},[e,n]),o(()=>{t.current=e},[e])}i(b,"useValueChanged");export{p as a,u as b,b as c};
@@ -1 +1 @@
1
- import{b as ee}from"./chunk-SKJZDOHG.js";import{a as z,b as D,c as F,d as w,e as l,f as o}from"./chunk-Q5WXTZWX.js";import{a as E,e as j}from"./chunk-JKPK25JO.js";import{a as te}from"./chunk-UZYGEOWY.js";import{R as Z}from"./chunk-7Z5QEFR4.js";import"./chunk-46IB4C4Q.js";import{c as I}from"./chunk-UY2Y5CXB.js";import"./chunk-ZFWEPGWG.js";import"./chunk-4FNHHFWR.js";import{a as K}from"./chunk-GXZAXNZI.js";import{f as G}from"./chunk-KJTLW5W2.js";import"./chunk-UREY4GLG.js";import{a as P}from"./chunk-6OKDCV7J.js";import{d as H,f as Q,g as V,h as W,m as $}from"./chunk-KLLYGWNF.js";import"./chunk-UDZY7MKE.js";import{a as n,e as Y,f as ne,h as le}from"./chunk-UHHTEBC3.js";var i=Y(ne(),1);var e=Y(le(),1);var oe=["queued","running","paused","waiting","complete","errored","terminated"],ie=["pause","resume","terminate"],de="WORKFLOWS_NOT_CONFIGURED",ce=n(c=>typeof c=="object"&&c!==null&&c.code===de,"de"),me=n(c=>{let r=c.error??c.output;if(r===void 0)return"\u2014";try{return JSON.stringify(r)}catch{return"(unserializable)"}},"ce"),ue=n(({loadDetail:c,loadInstances:r,readOnly:b,runAction:_,workflowName:h})=>{let A=G(),s=H(),[N,g]=(0,i.useState)(null),[S,O]=(0,i.useState)(null),[k,J]=(0,i.useState)(""),[v,p]=(0,i.useState)(null),[L,C]=(0,i.useState)(!1),[R,U]=(0,i.useState)(null),f=c??(a=>A.getWorkflowInstance(a)),x=b?void 0:_??(r===void 0?a=>A.setWorkflowInstanceStatus(a):void 0),T=n(async()=>{p(null),C(!1);let a=k===""?void 0:k;try{if(r===void 0){let d=await A.listWorkflowInstances({name:h,status:a});if(d.configured===!1){g(null),C(!0);return}g(d.instances);return}g(await r({name:h,status:a}))}catch(d){g(null),ce(d)?C(!0):p(W(d))}},"O");(0,i.useEffect)(()=>{O(null),$(T())},[h,k]);let q=n(async a=>{p(null);try{O(await f({id:a,name:h}))}catch(d){p(W(d))}},"D"),M=n(async(a,d)=>{if(x!==void 0){U(a),p(null);try{await x({action:d,id:a,name:h}),await T()}catch(B){p(W(B))}finally{U(null)}}},"q");return(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:s("Instance history")}),(0,e.jsxs)("select",{"aria-label":s("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:n(a=>{J(a.target.value)},"onChange"),value:k,children:[(0,e.jsx)("option",{value:"",children:s("All statuses")}),oe.map(a=>(0,e.jsx)("option",{value:a,children:a},a))]})]}),v!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:v}),L&&(0,e.jsx)(P,{description:s("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:s("Workflow inspection not configured")}),!L&&N!==null&&N.length===0&&(0,e.jsx)(P,{description:s("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:s("No instances")}),N!==null&&N.length>0&&(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(j,{className:"px-0",children:(0,e.jsxs)(z,{"data-testid":"workflow-instances-table",children:[(0,e.jsx)(D,{children:(0,e.jsxs)(w,{children:[(0,e.jsx)(l,{children:s("Instance id")}),(0,e.jsx)(l,{children:s("Status")}),(0,e.jsx)(l,{children:s("Created")}),(0,e.jsx)(l,{children:s("Ended")}),(0,e.jsx)(l,{"aria-label":s("Actions")})]})}),(0,e.jsx)(F,{children:N.map(a=>(0,e.jsxs)(w,{"data-testid":`workflow-instance-${a.id}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs",children:a.id}),(0,e.jsx)(o,{className:"font-mono text-xs",children:a.status}),(0,e.jsx)(o,{className:"text-muted-foreground tabular-nums",children:a.createdOn??"\u2014"}),(0,e.jsx)(o,{className:"text-muted-foreground tabular-nums",children:a.endedOn??"\u2014"}),(0,e.jsx)(o,{className:"text-right",children:(0,e.jsxs)("div",{className:"flex justify-end gap-1.5",children:[(0,e.jsx)(I,{"data-testid":`workflow-instance-steps-${a.id}`,onClick:n(()=>{$(q(a.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:s("Steps")}),x!==void 0&&ie.map(d=>(0,e.jsx)(I,{"data-testid":`workflow-instance-${d}-${a.id}`,disabled:R===a.id,onClick:n(()=>{$(M(a.id,d))},"onClick"),size:"sm",type:"button",variant:"ghost",children:s(d)},d))]})})]},a.id))})]})})}),S!==null&&(0,e.jsx)(E,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,e.jsxs)(j,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("span",{className:"font-mono text-xs",children:[s("Steps")," \xB7 ",S.id]}),(0,e.jsx)(I,{"data-testid":"workflow-instance-detail-close",onClick:n(()=>{O(null)},"onClick"),size:"xs",type:"button",variant:"ghost",children:s("Close")})]}),S.steps.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:s("This instance has no recorded steps yet.")}):(0,e.jsxs)(z,{"data-testid":"workflow-instance-steps",children:[(0,e.jsx)(D,{children:(0,e.jsxs)(w,{children:[(0,e.jsx)(l,{children:s("Step")}),(0,e.jsx)(l,{children:s("Type")}),(0,e.jsx)(l,{children:s("Attempts")}),(0,e.jsx)(l,{children:s("Started")}),(0,e.jsx)(l,{children:s("Output")})]})}),(0,e.jsx)(F,{children:S.steps.map((a,d)=>(0,e.jsxs)(w,{"data-testid":`workflow-step-${String(d)}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs",children:a.name}),(0,e.jsx)(o,{className:"text-xs text-muted-foreground",children:a.type??"\u2014"}),(0,e.jsx)(o,{className:"tabular-nums",children:a.attempts??"\u2014"}),(0,e.jsx)(o,{className:"text-muted-foreground tabular-nums",children:a.start??"\u2014"}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:me(a)})]},`${a.name}:${String(d)}`))})]})]})})]})},"me"),fe=Q(K.createWorkflowInstance),he=Q(K.getWorkflowInstanceStatus),pe=n(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)"}},"he"),Ie=n(()=>{let c=G(),r=H(),{data:b,error:_}=ee(K.listWorkflows,{}),[h,A]=(0,i.useState)(""),[s,N]=(0,i.useState)(""),[g,S]=(0,i.useState)(""),[O,k]=(0,i.useState)(!1),[J,v]=(0,i.useState)(null),[p,L]=(0,i.useState)([]),[C,R]=(0,i.useState)(null),U=b!==void 0,f=(0,i.useMemo)(()=>Array.isArray(b?.workflows)?[...b.workflows].toSorted((t,u)=>t.exportName.localeCompare(u.exportName)):[],[b]),x=(0,i.useMemo)(()=>f.some(t=>t.exportName===h)?h:f[0]?.exportName??"",[f,h]),T=(0,i.useMemo)(()=>f.find(t=>t.exportName===x),[f,x]),q=n(t=>{L(u=>{let m=u.filter(y=>!(y.exportName===t.exportName&&y.id===t.id));return[t,...m]})},"D"),M=n(async()=>{let t=x;if(t==="")return;let u,m=g.trim();if(m!=="")try{u=JSON.parse(m)}catch{v(r("Params must be valid JSON"));return}k(!0),v(null);try{let y=s.trim(),X=await c.query(fe,{exportName:t,id:y===""?void 0:y,params:u},V(""));q({exportName:t,id:X.id,status:X.status}),N("")}catch(y){v(W(y))}finally{k(!1)}},"q"),a=n(()=>{$(M())},"a"),d=n(async(t,u)=>{R(u);try{let m=await c.query(he,{exportName:t,id:u},V(""));q({error:m.error,exportName:t,id:m.id,output:m.output,status:m.status})}catch(m){v(W(m))}finally{R(null)}},"l"),B=n(t=>{A(t.target.value)},"M"),ae=n(t=>{N(t.target.value)},"Z"),re=n(t=>{S(t.target.value)},"ee"),se=n(t=>{let{export:u,id:m}=t.currentTarget.dataset;u!==void 0&&m!==void 0&&$(d(u,m))},"te");return(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[_!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:_}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:r("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")}),U&&f.length===0?(0,e.jsx)(P,{description:r("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:r("No workflows defined")}):(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(j,{className:"px-0",children:(0,e.jsxs)(z,{"data-testid":"workflows-table",children:[(0,e.jsx)(D,{children:(0,e.jsxs)(w,{children:[(0,e.jsx)(l,{children:r("Export")}),(0,e.jsx)(l,{children:r("Name")}),(0,e.jsx)(l,{children:r("Class")}),(0,e.jsx)(l,{children:r("Binding")})]})}),(0,e.jsx)(F,{children:f.map(t=>(0,e.jsxs)(w,{"data-testid":`workflows-row-${t.exportName}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs",children:t.exportName}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:t.name}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:t.className}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:t.binding})]},t.exportName))})]})})}),f.length>0&&(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:r("Start instance")}),J!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:J}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)("select",{"aria-label":r("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:B,value:x,children:f.map(t=>(0,e.jsx)("option",{value:t.exportName,children:t.exportName},t.exportName))}),(0,e.jsx)(Z,{"aria-label":r("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:ae,placeholder:r("Instance id (optional)"),value:s}),(0,e.jsx)(I,{"data-testid":"workflows-start-button",disabled:O||x==="",onClick:a,children:r(O?"Starting\u2026":"Start instance")})]}),(0,e.jsx)(te,{"aria-label":r("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:re,placeholder:r("Params (JSON, optional)"),value:g})]}),p.length>0&&(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:r("Instances")}),(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(j,{className:"px-0",children:(0,e.jsxs)(z,{"data-testid":"workflows-instances-table",children:[(0,e.jsx)(D,{children:(0,e.jsxs)(w,{children:[(0,e.jsx)(l,{children:r("Workflow")}),(0,e.jsx)(l,{children:r("Instance id")}),(0,e.jsx)(l,{children:r("Status")}),(0,e.jsx)(l,{children:r("Output")}),(0,e.jsx)(l,{})]})}),(0,e.jsx)(F,{children:p.map(t=>(0,e.jsxs)(w,{"data-testid":`workflows-instance-${t.id}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs",children:t.exportName}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:t.id}),(0,e.jsx)(o,{className:"font-mono text-xs",children:t.status}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:pe(t)}),(0,e.jsx)(o,{children:(0,e.jsx)(I,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:C===t.id,onClick:se,size:"xs",variant:"outline",children:C===t.id?r("Refreshing\u2026"):r("Refresh")})})]},`${t.exportName}:${t.id}`))})]})})})]}),T!==void 0&&(0,e.jsx)(ue,{workflowName:T.name})]})},"Oe");export{Ie as default};
1
+ import{b as ee}from"./chunk-OWADN6BI.js";import{a as z,b as D,c as F,d as w,e as l,f as o}from"./chunk-MIQTKZAR.js";import{a as E,e as j}from"./chunk-UZERI5YC.js";import{a as te}from"./chunk-V53KNYRN.js";import{R as Z}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as I}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import"./chunk-6ST5ECQA.js";import{a as K}from"./chunk-GXZAXNZI.js";import{f as G}from"./chunk-LWECXQWP.js";import"./chunk-XBDKZZ67.js";import{a as P}from"./chunk-XQCVZAGU.js";import{d as H,f as Q,g as V,h as W,m as $}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a as n,e as Y,f as ne,h as le}from"./chunk-3XIESWL4.js";var i=Y(ne(),1);var e=Y(le(),1);var oe=["queued","running","paused","waiting","complete","errored","terminated"],ie=["pause","resume","terminate"],de="WORKFLOWS_NOT_CONFIGURED",ce=n(c=>typeof c=="object"&&c!==null&&c.code===de,"de"),me=n(c=>{let r=c.error??c.output;if(r===void 0)return"\u2014";try{return JSON.stringify(r)}catch{return"(unserializable)"}},"ce"),ue=n(({loadDetail:c,loadInstances:r,readOnly:b,runAction:_,workflowName:h})=>{let A=G(),s=H(),[N,g]=(0,i.useState)(null),[S,O]=(0,i.useState)(null),[k,J]=(0,i.useState)(""),[v,p]=(0,i.useState)(null),[L,C]=(0,i.useState)(!1),[R,U]=(0,i.useState)(null),f=c??(a=>A.getWorkflowInstance(a)),x=b?void 0:_??(r===void 0?a=>A.setWorkflowInstanceStatus(a):void 0),T=n(async()=>{p(null),C(!1);let a=k===""?void 0:k;try{if(r===void 0){let d=await A.listWorkflowInstances({name:h,status:a});if(d.configured===!1){g(null),C(!0);return}g(d.instances);return}g(await r({name:h,status:a}))}catch(d){g(null),ce(d)?C(!0):p(W(d))}},"O");(0,i.useEffect)(()=>{O(null),$(T())},[h,k]);let q=n(async a=>{p(null);try{O(await f({id:a,name:h}))}catch(d){p(W(d))}},"D"),M=n(async(a,d)=>{if(x!==void 0){U(a),p(null);try{await x({action:d,id:a,name:h}),await T()}catch(B){p(W(B))}finally{U(null)}}},"q");return(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:s("Instance history")}),(0,e.jsxs)("select",{"aria-label":s("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:n(a=>{J(a.target.value)},"onChange"),value:k,children:[(0,e.jsx)("option",{value:"",children:s("All statuses")}),oe.map(a=>(0,e.jsx)("option",{value:a,children:a},a))]})]}),v!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:v}),L&&(0,e.jsx)(P,{description:s("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:s("Workflow inspection not configured")}),!L&&N!==null&&N.length===0&&(0,e.jsx)(P,{description:s("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:s("No instances")}),N!==null&&N.length>0&&(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(j,{className:"px-0",children:(0,e.jsxs)(z,{"data-testid":"workflow-instances-table",children:[(0,e.jsx)(D,{children:(0,e.jsxs)(w,{children:[(0,e.jsx)(l,{children:s("Instance id")}),(0,e.jsx)(l,{children:s("Status")}),(0,e.jsx)(l,{children:s("Created")}),(0,e.jsx)(l,{children:s("Ended")}),(0,e.jsx)(l,{"aria-label":s("Actions")})]})}),(0,e.jsx)(F,{children:N.map(a=>(0,e.jsxs)(w,{"data-testid":`workflow-instance-${a.id}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs",children:a.id}),(0,e.jsx)(o,{className:"font-mono text-xs",children:a.status}),(0,e.jsx)(o,{className:"text-muted-foreground tabular-nums",children:a.createdOn??"\u2014"}),(0,e.jsx)(o,{className:"text-muted-foreground tabular-nums",children:a.endedOn??"\u2014"}),(0,e.jsx)(o,{className:"text-right",children:(0,e.jsxs)("div",{className:"flex justify-end gap-1.5",children:[(0,e.jsx)(I,{"data-testid":`workflow-instance-steps-${a.id}`,onClick:n(()=>{$(q(a.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:s("Steps")}),x!==void 0&&ie.map(d=>(0,e.jsx)(I,{"data-testid":`workflow-instance-${d}-${a.id}`,disabled:R===a.id,onClick:n(()=>{$(M(a.id,d))},"onClick"),size:"sm",type:"button",variant:"ghost",children:s(d)},d))]})})]},a.id))})]})})}),S!==null&&(0,e.jsx)(E,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,e.jsxs)(j,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("span",{className:"font-mono text-xs",children:[s("Steps")," \xB7 ",S.id]}),(0,e.jsx)(I,{"data-testid":"workflow-instance-detail-close",onClick:n(()=>{O(null)},"onClick"),size:"xs",type:"button",variant:"ghost",children:s("Close")})]}),S.steps.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:s("This instance has no recorded steps yet.")}):(0,e.jsxs)(z,{"data-testid":"workflow-instance-steps",children:[(0,e.jsx)(D,{children:(0,e.jsxs)(w,{children:[(0,e.jsx)(l,{children:s("Step")}),(0,e.jsx)(l,{children:s("Type")}),(0,e.jsx)(l,{children:s("Attempts")}),(0,e.jsx)(l,{children:s("Started")}),(0,e.jsx)(l,{children:s("Output")})]})}),(0,e.jsx)(F,{children:S.steps.map((a,d)=>(0,e.jsxs)(w,{"data-testid":`workflow-step-${String(d)}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs",children:a.name}),(0,e.jsx)(o,{className:"text-xs text-muted-foreground",children:a.type??"\u2014"}),(0,e.jsx)(o,{className:"tabular-nums",children:a.attempts??"\u2014"}),(0,e.jsx)(o,{className:"text-muted-foreground tabular-nums",children:a.start??"\u2014"}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:me(a)})]},`${a.name}:${String(d)}`))})]})]})})]})},"me"),fe=Q(K.createWorkflowInstance),he=Q(K.getWorkflowInstanceStatus),pe=n(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)"}},"he"),Ie=n(()=>{let c=G(),r=H(),{data:b,error:_}=ee(K.listWorkflows,{}),[h,A]=(0,i.useState)(""),[s,N]=(0,i.useState)(""),[g,S]=(0,i.useState)(""),[O,k]=(0,i.useState)(!1),[J,v]=(0,i.useState)(null),[p,L]=(0,i.useState)([]),[C,R]=(0,i.useState)(null),U=b!==void 0,f=(0,i.useMemo)(()=>Array.isArray(b?.workflows)?[...b.workflows].toSorted((t,u)=>t.exportName.localeCompare(u.exportName)):[],[b]),x=(0,i.useMemo)(()=>f.some(t=>t.exportName===h)?h:f[0]?.exportName??"",[f,h]),T=(0,i.useMemo)(()=>f.find(t=>t.exportName===x),[f,x]),q=n(t=>{L(u=>{let m=u.filter(y=>!(y.exportName===t.exportName&&y.id===t.id));return[t,...m]})},"D"),M=n(async()=>{let t=x;if(t==="")return;let u,m=g.trim();if(m!=="")try{u=JSON.parse(m)}catch{v(r("Params must be valid JSON"));return}k(!0),v(null);try{let y=s.trim(),X=await c.query(fe,{exportName:t,id:y===""?void 0:y,params:u},V(""));q({exportName:t,id:X.id,status:X.status}),N("")}catch(y){v(W(y))}finally{k(!1)}},"q"),a=n(()=>{$(M())},"a"),d=n(async(t,u)=>{R(u);try{let m=await c.query(he,{exportName:t,id:u},V(""));q({error:m.error,exportName:t,id:m.id,output:m.output,status:m.status})}catch(m){v(W(m))}finally{R(null)}},"l"),B=n(t=>{A(t.target.value)},"M"),ae=n(t=>{N(t.target.value)},"Z"),re=n(t=>{S(t.target.value)},"ee"),se=n(t=>{let{export:u,id:m}=t.currentTarget.dataset;u!==void 0&&m!==void 0&&$(d(u,m))},"te");return(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[_!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:_}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:r("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")}),U&&f.length===0?(0,e.jsx)(P,{description:r("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:r("No workflows defined")}):(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(j,{className:"px-0",children:(0,e.jsxs)(z,{"data-testid":"workflows-table",children:[(0,e.jsx)(D,{children:(0,e.jsxs)(w,{children:[(0,e.jsx)(l,{children:r("Export")}),(0,e.jsx)(l,{children:r("Name")}),(0,e.jsx)(l,{children:r("Class")}),(0,e.jsx)(l,{children:r("Binding")})]})}),(0,e.jsx)(F,{children:f.map(t=>(0,e.jsxs)(w,{"data-testid":`workflows-row-${t.exportName}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs",children:t.exportName}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:t.name}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:t.className}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:t.binding})]},t.exportName))})]})})}),f.length>0&&(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:r("Start instance")}),J!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:J}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)("select",{"aria-label":r("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:B,value:x,children:f.map(t=>(0,e.jsx)("option",{value:t.exportName,children:t.exportName},t.exportName))}),(0,e.jsx)(Z,{"aria-label":r("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:ae,placeholder:r("Instance id (optional)"),value:s}),(0,e.jsx)(I,{"data-testid":"workflows-start-button",disabled:O||x==="",onClick:a,children:r(O?"Starting\u2026":"Start instance")})]}),(0,e.jsx)(te,{"aria-label":r("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:re,placeholder:r("Params (JSON, optional)"),value:g})]}),p.length>0&&(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:r("Instances")}),(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(j,{className:"px-0",children:(0,e.jsxs)(z,{"data-testid":"workflows-instances-table",children:[(0,e.jsx)(D,{children:(0,e.jsxs)(w,{children:[(0,e.jsx)(l,{children:r("Workflow")}),(0,e.jsx)(l,{children:r("Instance id")}),(0,e.jsx)(l,{children:r("Status")}),(0,e.jsx)(l,{children:r("Output")}),(0,e.jsx)(l,{})]})}),(0,e.jsx)(F,{children:p.map(t=>(0,e.jsxs)(w,{"data-testid":`workflows-instance-${t.id}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs",children:t.exportName}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:t.id}),(0,e.jsx)(o,{className:"font-mono text-xs",children:t.status}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:pe(t)}),(0,e.jsx)(o,{children:(0,e.jsx)(I,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:C===t.id,onClick:se,size:"xs",variant:"outline",children:C===t.id?r("Refreshing\u2026"):r("Refresh")})})]},`${t.exportName}:${t.id}`))})]})})})]}),T!==void 0&&(0,e.jsx)(ue,{workflowName:T.name})]})},"Oe");export{Ie as default};
@@ -1 +1 @@
1
- import{a as we,b as Ke,c as je}from"./chunk-C4O5UR4Y.js";import{i as Ge,k as He}from"./chunk-KOC5KV3E.js";import{D as Se,I as Me,K as Ve,L as Le,M as De,N as Oe,O as Te,P as Fe,Q as _e,a as $,b as Ie,c as Ne,e as F,f as Be}from"./chunk-7Z5QEFR4.js";import{b as Ae}from"./chunk-UY2Y5CXB.js";import{a as T,e as de}from"./chunk-ZFWEPGWG.js";import{a as ye,c as ve,d as Re,e as Ee,g as se,i as Pe,j as W}from"./chunk-4FNHHFWR.js";import{a as i,d as vt,e as x,f as O,g as Rt,h as ke,j as Ce}from"./chunk-UHHTEBC3.js";var Ye=x(Rt(),1);var w={};vt(w,{Indicator:()=>Xe,Root:()=>Je});var l=x(O(),1);function Ue(t){if(!t)return null;for(let e of t.elements){let n=e.tagName;if(n==="BUTTON"||n==="INPUT"){let o=e;if(o.type==="submit")return o}}return null}i(Ue,"getDefaultFormSubmitter");var qe=x(O(),1);var ce=(function(t){return t.checked="data-checked",t.unchecked="data-unchecked",t.indeterminate="data-indeterminate",t.disabled="data-disabled",t.readonly="data-readonly",t.required="data-required",t.valid="data-valid",t.invalid="data-invalid",t.touched="data-touched",t.dirty="data-dirty",t.filled="data-filled",t.focused="data-focused",t})({});function z(t){return qe.useMemo(()=>({checked(e){return t.indeterminate?{}:e?{[ce.checked]:""}:{[ce.unchecked]:""}},...$}),[t.indeterminate])}i(z,"useStateAttributesMapping");var We=x(O(),1);function $e(t,e,n,o=!0,a){let[f,p]=We.useState(),S=F(a?`${a}-label`:void 0),b=t??e??f;return T(()=>{let g=t||e||!o?void 0:Et(n.current,S);f!==g&&p(g)}),b}i($e,"useAriaLabelledBy");function Et(t,e){let n=Pt(t);if(n)return!n.id&&e&&(n.id=e),n.id||void 0}i(Et,"getAriaLabelledBy");function Pt(t){if(!t)return;let e=t.parentElement;if(e&&e.tagName==="LABEL")return e;let n=t.id;if(n){let a=t.nextElementSibling;if(a&&a.htmlFor===n)return a}let o=t.labels;return o&&o[0]}i(Pt,"findAssociatedLabel");var J=x(O(),1);var ue=J.createContext(void 0);function ze(){let t=J.useContext(ue);if(t===void 0)throw new Error(ve(14));return t}i(ze,"useCheckboxRootContext");var _=x(ke(),1);var It="data-parent",Je=l.forwardRef(i(function(e,n){let{checked:o,className:a,defaultChecked:f=!1,"aria-labelledby":p,disabled:S=!1,form:b,id:g,indeterminate:M=!1,inputRef:Q,name:K,onCheckedChange:A,parent:m=!1,readOnly:R=!1,render:le,required:E=!1,uncheckedValue:j,value:G,nativeButton:H=!1,style:Nt,...Qe}=e,{clearErrors:Ze}=Ne(),{disabled:et,name:tt,setDirty:rt,setFilled:Z,setFocused:fe,setTouched:nt,state:pe,validationMode:ot,validityData:it,validation:at}=Ie(),st=Se(),{labelId:dt,controlId:ct,registerControlId:P,getDescriptionProps:me}=Be(),s=_e(),V=s?.parent,L=V&&s.allValues,c=et||st.disabled||s?.disabled||S,I=tt??K,d=G??I,he=F(),ut=F(),k=ct;L?k=m?ut:`${V.id}-${d}`:g&&(k=g);let ee={};L&&(m?ee=s.parent.getParentProps():d&&(ee=s.parent.getChildProps(d)));let{checked:be=o,indeterminate:lt=M,onCheckedChange:ft,...pt}=ee,N=s?.value,ge=s?.setValue,xe=s?.defaultValue,te=l.useRef(null),U=Re(()=>Symbol("checkbox-control")),re=l.useRef(!1),{getButtonProps:mt,buttonRef:ht}=Ae({disabled:c,native:H}),B=s?.validation??at,[u,bt]=De({controlled:d&&N&&!m?N.includes(d):be,default:d&&xe&&!m?xe.includes(d):f,name:"Checkbox",state:"checked"}),ne=L?!!be:u,D=L&&lt||M;T(()=>{P!==se&&(re.current=!0,P(U.current,k))},[k,P,U]),l.useEffect(()=>{let r=U.current;return()=>{!re.current||P===se||(re.current=!1,P(r,void 0))}},[P,U]),Oe(te,he,u,void 0,!s&&!c,K);let C=l.useRef(null),gt=Ee(Q,C,B.inputRef,B.registerInput),xt=$e(p,dt,C,!H,k??void 0);T(()=>{C.current&&(C.current.indeterminate=D,u&&Z(!0))},[u,D,Z]),je(u,()=>{s||(Ze(I),Z(u),rt(u!==it.initialValue),B.change(u))});let kt=ye({checked:u,disabled:c,form:b,name:m?void 0:I,id:H?void 0:k??void 0,required:E,ref:gt,style:I?Ke:we,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(r){if(r.nativeEvent.defaultPrevented)return;if(R){r.preventDefault();return}let h=r.currentTarget.checked,y=Fe(Te.none,r.nativeEvent);if(A?.(h,y),!y.isCanceled&&(ft?.(h,y),!y.isCanceled&&(bt(h),d&&N&&ge&&!m&&!L))){let v=h?[...N,d]:N.filter(q=>q!==d);ge(v,y)}},onFocus(){te.current?.focus()}},G!==void 0?{value:(s?u&&G:G)||""}:Pe,me,r=>B.getValidationProps(c,r));l.useEffect(()=>{if(!V||!d)return;let r=V.disabledStatesRef.current;return r.set(d,c),()=>{r.delete(d)}},[V,c,d]);let oe=l.useMemo(()=>({...pe,checked:ne,disabled:c,readOnly:R,required:E,indeterminate:D}),[pe,ne,c,R,E,D]),Ct=z(oe),yt=W("span",e,{state:oe,ref:[ht,te,n,s?.registerControlRef],props:[{id:H?k??void 0:he,role:"checkbox","aria-checked":D?"mixed":ne,"aria-readonly":R||void 0,"aria-required":E||void 0,"aria-labelledby":xt,[It]:m?"":void 0,onFocus(){c||fe(!0)},onBlur(){let r=C.current;r&&(nt(!0),fe(!1),ot==="onBlur"&&B.commit(s?N:r.checked))},onKeyDown(r){if(r.key!=="Enter"||(r.preventBaseUIHandler(),r.defaultPrevented))return;let h=C.current?.form??null,y=r.currentTarget,v=r.nativeEvent,q=r.preventDefault,ie=v.preventDefault,ae=!1;r.preventDefault=()=>{ae=!0,q.call(r)},v.preventDefault=()=>{ae=!0,ie.call(v)},ie.call(v),de(y).queueMicrotask(()=>{r.preventDefault=q,v.preventDefault=ie,ae||Ue(h)?.click()})},onClick(r){if(R||c)return;r.preventDefault();let h=C.current;h&&h.dispatchEvent(new(de(h)).PointerEvent("click",{bubbles:!0,shiftKey:r.shiftKey,ctrlKey:r.ctrlKey,altKey:r.altKey,metaKey:r.metaKey}))}},Qe,pt,mt,me,r=>B.getValidationProps(c,r)],stateAttributesMapping:Ct});return(0,_.jsxs)(ue.Provider,{value:oe,children:[yt,!u&&!s&&I&&!m&&j!==void 0&&(0,_.jsx)("input",{type:"hidden",form:b,name:I,value:j,disabled:c}),(0,_.jsx)("input",{...kt,suppressHydrationWarning:!0})]})},"CheckboxRoot"));var X=x(O(),1);var Xe=X.forwardRef(i(function(e,n){let{render:o,className:a,style:f,keepMounted:p=!1,...S}=e,b=ze(),g=b.checked||b.indeterminate,{mounted:M,transitionStatus:Q,setMounted:K}=Le(g),A=X.useRef(null),m={...b,transitionStatus:Q};Ve({open:g,ref:A,onComplete(){g||K(!1)}});let le={...z(b),...Me,...$},E=p||M,j=W("span",e,{ref:[n,A],state:m,stateAttributesMapping:le,props:S});return E?j:null},"CheckboxIndicator"));var Y=x(ke(),1);function Vr(t){let e=(0,Ye.c)(9),n,o;e[0]!==t?({className:n,...o}=t,e[0]=t,e[1]=n,e[2]=o):(n=e[1],o=e[2]);let a;e[3]!==n?(a=Ce("peer relative flex size-4 shrink-0 items-center justify-center rounded-md border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary",n),e[3]=n,e[4]=a):a=e[4];let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=(0,Y.jsx)(w.Indicator,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:(0,Y.jsx)(He,{icon:Ge,strokeWidth:2})}),e[5]=f):f=e[5];let p;return e[6]!==o||e[7]!==a?(p=(0,Y.jsx)(w.Root,{"data-slot":"checkbox",className:a,...o,children:f}),e[6]=o,e[7]=a,e[8]=p):p=e[8],p}i(Vr,"h");export{Vr as a};
1
+ import{a as we,b as Ke,c as je}from"./chunk-IVFHIQOT.js";import{i as Ge,k as He}from"./chunk-QBWRC5YX.js";import{D as Se,I as Me,K as Ve,L as Le,M as De,N as Oe,O as Te,P as Fe,Q as _e,a as $,b as Ie,c as Ne,e as F,f as Be}from"./chunk-CFPZYHPY.js";import{b as Ae}from"./chunk-FXCBF4XT.js";import{a as T,e as de}from"./chunk-2OUPA2WJ.js";import{a as ye,c as ve,d as Re,e as Ee,g as se,i as Pe,j as W}from"./chunk-6ST5ECQA.js";import{a as i,d as vt,e as x,f as O,g as Rt,h as ke,j as Ce}from"./chunk-3XIESWL4.js";var Ye=x(Rt(),1);var w={};vt(w,{Indicator:()=>Xe,Root:()=>Je});var l=x(O(),1);function Ue(t){if(!t)return null;for(let e of t.elements){let n=e.tagName;if(n==="BUTTON"||n==="INPUT"){let o=e;if(o.type==="submit")return o}}return null}i(Ue,"getDefaultFormSubmitter");var qe=x(O(),1);var ce=(function(t){return t.checked="data-checked",t.unchecked="data-unchecked",t.indeterminate="data-indeterminate",t.disabled="data-disabled",t.readonly="data-readonly",t.required="data-required",t.valid="data-valid",t.invalid="data-invalid",t.touched="data-touched",t.dirty="data-dirty",t.filled="data-filled",t.focused="data-focused",t})({});function z(t){return qe.useMemo(()=>({checked(e){return t.indeterminate?{}:e?{[ce.checked]:""}:{[ce.unchecked]:""}},...$}),[t.indeterminate])}i(z,"useStateAttributesMapping");var We=x(O(),1);function $e(t,e,n,o=!0,a){let[f,p]=We.useState(),S=F(a?`${a}-label`:void 0),b=t??e??f;return T(()=>{let g=t||e||!o?void 0:Et(n.current,S);f!==g&&p(g)}),b}i($e,"useAriaLabelledBy");function Et(t,e){let n=Pt(t);if(n)return!n.id&&e&&(n.id=e),n.id||void 0}i(Et,"getAriaLabelledBy");function Pt(t){if(!t)return;let e=t.parentElement;if(e&&e.tagName==="LABEL")return e;let n=t.id;if(n){let a=t.nextElementSibling;if(a&&a.htmlFor===n)return a}let o=t.labels;return o&&o[0]}i(Pt,"findAssociatedLabel");var J=x(O(),1);var ue=J.createContext(void 0);function ze(){let t=J.useContext(ue);if(t===void 0)throw new Error(ve(14));return t}i(ze,"useCheckboxRootContext");var _=x(ke(),1);var It="data-parent",Je=l.forwardRef(i(function(e,n){let{checked:o,className:a,defaultChecked:f=!1,"aria-labelledby":p,disabled:S=!1,form:b,id:g,indeterminate:M=!1,inputRef:Q,name:K,onCheckedChange:A,parent:m=!1,readOnly:R=!1,render:le,required:E=!1,uncheckedValue:j,value:G,nativeButton:H=!1,style:Nt,...Qe}=e,{clearErrors:Ze}=Ne(),{disabled:et,name:tt,setDirty:rt,setFilled:Z,setFocused:fe,setTouched:nt,state:pe,validationMode:ot,validityData:it,validation:at}=Ie(),st=Se(),{labelId:dt,controlId:ct,registerControlId:P,getDescriptionProps:me}=Be(),s=_e(),V=s?.parent,L=V&&s.allValues,c=et||st.disabled||s?.disabled||S,I=tt??K,d=G??I,he=F(),ut=F(),k=ct;L?k=m?ut:`${V.id}-${d}`:g&&(k=g);let ee={};L&&(m?ee=s.parent.getParentProps():d&&(ee=s.parent.getChildProps(d)));let{checked:be=o,indeterminate:lt=M,onCheckedChange:ft,...pt}=ee,N=s?.value,ge=s?.setValue,xe=s?.defaultValue,te=l.useRef(null),U=Re(()=>Symbol("checkbox-control")),re=l.useRef(!1),{getButtonProps:mt,buttonRef:ht}=Ae({disabled:c,native:H}),B=s?.validation??at,[u,bt]=De({controlled:d&&N&&!m?N.includes(d):be,default:d&&xe&&!m?xe.includes(d):f,name:"Checkbox",state:"checked"}),ne=L?!!be:u,D=L&&lt||M;T(()=>{P!==se&&(re.current=!0,P(U.current,k))},[k,P,U]),l.useEffect(()=>{let r=U.current;return()=>{!re.current||P===se||(re.current=!1,P(r,void 0))}},[P,U]),Oe(te,he,u,void 0,!s&&!c,K);let C=l.useRef(null),gt=Ee(Q,C,B.inputRef,B.registerInput),xt=$e(p,dt,C,!H,k??void 0);T(()=>{C.current&&(C.current.indeterminate=D,u&&Z(!0))},[u,D,Z]),je(u,()=>{s||(Ze(I),Z(u),rt(u!==it.initialValue),B.change(u))});let kt=ye({checked:u,disabled:c,form:b,name:m?void 0:I,id:H?void 0:k??void 0,required:E,ref:gt,style:I?Ke:we,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(r){if(r.nativeEvent.defaultPrevented)return;if(R){r.preventDefault();return}let h=r.currentTarget.checked,y=Fe(Te.none,r.nativeEvent);if(A?.(h,y),!y.isCanceled&&(ft?.(h,y),!y.isCanceled&&(bt(h),d&&N&&ge&&!m&&!L))){let v=h?[...N,d]:N.filter(q=>q!==d);ge(v,y)}},onFocus(){te.current?.focus()}},G!==void 0?{value:(s?u&&G:G)||""}:Pe,me,r=>B.getValidationProps(c,r));l.useEffect(()=>{if(!V||!d)return;let r=V.disabledStatesRef.current;return r.set(d,c),()=>{r.delete(d)}},[V,c,d]);let oe=l.useMemo(()=>({...pe,checked:ne,disabled:c,readOnly:R,required:E,indeterminate:D}),[pe,ne,c,R,E,D]),Ct=z(oe),yt=W("span",e,{state:oe,ref:[ht,te,n,s?.registerControlRef],props:[{id:H?k??void 0:he,role:"checkbox","aria-checked":D?"mixed":ne,"aria-readonly":R||void 0,"aria-required":E||void 0,"aria-labelledby":xt,[It]:m?"":void 0,onFocus(){c||fe(!0)},onBlur(){let r=C.current;r&&(nt(!0),fe(!1),ot==="onBlur"&&B.commit(s?N:r.checked))},onKeyDown(r){if(r.key!=="Enter"||(r.preventBaseUIHandler(),r.defaultPrevented))return;let h=C.current?.form??null,y=r.currentTarget,v=r.nativeEvent,q=r.preventDefault,ie=v.preventDefault,ae=!1;r.preventDefault=()=>{ae=!0,q.call(r)},v.preventDefault=()=>{ae=!0,ie.call(v)},ie.call(v),de(y).queueMicrotask(()=>{r.preventDefault=q,v.preventDefault=ie,ae||Ue(h)?.click()})},onClick(r){if(R||c)return;r.preventDefault();let h=C.current;h&&h.dispatchEvent(new(de(h)).PointerEvent("click",{bubbles:!0,shiftKey:r.shiftKey,ctrlKey:r.ctrlKey,altKey:r.altKey,metaKey:r.metaKey}))}},Qe,pt,mt,me,r=>B.getValidationProps(c,r)],stateAttributesMapping:Ct});return(0,_.jsxs)(ue.Provider,{value:oe,children:[yt,!u&&!s&&I&&!m&&j!==void 0&&(0,_.jsx)("input",{type:"hidden",form:b,name:I,value:j,disabled:c}),(0,_.jsx)("input",{...kt,suppressHydrationWarning:!0})]})},"CheckboxRoot"));var X=x(O(),1);var Xe=X.forwardRef(i(function(e,n){let{render:o,className:a,style:f,keepMounted:p=!1,...S}=e,b=ze(),g=b.checked||b.indeterminate,{mounted:M,transitionStatus:Q,setMounted:K}=Le(g),A=X.useRef(null),m={...b,transitionStatus:Q};Ve({open:g,ref:A,onComplete(){g||K(!1)}});let le={...z(b),...Me,...$},E=p||M,j=W("span",e,{ref:[n,A],state:m,stateAttributesMapping:le,props:S});return E?j:null},"CheckboxIndicator"));var Y=x(ke(),1);function Vr(t){let e=(0,Ye.c)(9),n,o;e[0]!==t?({className:n,...o}=t,e[0]=t,e[1]=n,e[2]=o):(n=e[1],o=e[2]);let a;e[3]!==n?(a=Ce("peer relative flex size-4 shrink-0 items-center justify-center rounded-md border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary",n),e[3]=n,e[4]=a):a=e[4];let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=(0,Y.jsx)(w.Indicator,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:(0,Y.jsx)(He,{icon:Ge,strokeWidth:2})}),e[5]=f):f=e[5];let p;return e[6]!==o||e[7]!==a?(p=(0,Y.jsx)(w.Root,{"data-slot":"checkbox",className:a,...o,children:f}),e[6]=o,e[7]=a,e[8]=p):p=e[8],p}i(Vr,"h");export{Vr as a};
@@ -1 +1 @@
1
- import{b as de,e as F}from"./chunk-RE6UWCMG.js";import{a as ce}from"./chunk-6I62RSI5.js";import"./chunk-OTJOI23O.js";import"./chunk-SEDZDNQF.js";import"./chunk-TYTJDFX2.js";import"./chunk-KSRXMTBV.js";import{b as ie}from"./chunk-SKJZDOHG.js";import{a as k}from"./chunk-JKPK25JO.js";import{a as oe}from"./chunk-UWF5DOGV.js";import"./chunk-PTTDIYGP.js";import"./chunk-46IB4C4Q.js";import{b as A}from"./chunk-K5PFWU5J.js";import"./chunk-4FNHHFWR.js";import{a as y}from"./chunk-GXZAXNZI.js";import{f as ae,g as le}from"./chunk-KJTLW5W2.js";import"./chunk-UREY4GLG.js";import{d as R,f as S,g as Q,h as V,m as z,q as ne}from"./chunk-KLLYGWNF.js";import"./chunk-UDZY7MKE.js";import{a as p,e as q,f as qe,g as re,h as se,j as w}from"./chunk-UHHTEBC3.js";var xe=q(re(),1);var c=q(qe(),1);var ue=q(re(),1);var K=q(se(),1);var Ae={connected:"bg-success",connecting:"bg-warning",idle:"bg-muted-foreground",offline:"bg-destructive"},me=p(()=>{let t=(0,ue.c)(16),e=R(),a=le(),s;e:switch(a){case"connected":{let i;t[0]!==e?(i=e("Connected"),t[0]=e,t[1]=i):i=t[1],s=i;break e}case"connecting":{let i;t[2]!==e?(i=e("Connecting\u2026"),t[2]=e,t[3]=i):i=t[3],s=i;break e}case"idle":{let i;t[4]!==e?(i=e("Idle"),t[4]=e,t[5]=i):i=t[5],s=i;break e}case"offline":{let i;t[6]!==e?(i=e("Offline"),t[6]=e,t[7]=i):i=t[7],s=i;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,K.jsx)("span",{"aria-hidden":"true",className:d}),t[10]=d,t[11]=u):u=t[11];let o;return t[12]!==a||t[13]!==u||t[14]!==s?(o=(0,K.jsxs)("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]}),t[12]=a,t[13]=u,t[14]=s,t[15]=o):o=t[15],o},"j");var r=q(se(),1);var fe={completed:0,failed:2,in_progress:1},Ee=p(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}},"Se"),je=p(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()]},"Me"),Ie=p(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=fe[s.status]-fe[l.status];(d>0||d===0&&(s.updatedAt??0)>(l.updatedAt??0))&&e.set(s.id,s)}return[...e.values()]},"qe"),De=S(y.getAuthMetrics),Ce=S(y.getFunctionStats),Pe=S(y.getLogs),Le=S(y.getMetrics),Te=S(y.migrationStatus),Re=5,pe=2e3,ze=5,he=.01,ge=.05,Fe=.1,Ke=.3,Oe=1,_e=50,W=p((t,e,a)=>t>=a?"crit":t>=e?"warn":"ok","V"),$e=p((t,e,a)=>t>=a?"crit":t>=e?"warn":"ok","Re"),He={crit:"destructive",ok:"secondary",warn:"default"},O=p((t,e)=>e===0?"\u2014":`${(t/e*100).toFixed(1)}%`,"F"),Ue=p(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)}},"_e"),Be=p(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}},"ze"),Ge=p((t,e)=>t.failed>0?e("{count} failed",{count:t.failed.toString()}):t.running>0?e("{count} running",{count:t.running.toString()}):e("OK"),"Ke"),ve={crit:"bg-destructive",ok:"bg-success",warn:"bg-warning"},be={crit:"text-destructive",ok:"text-foreground",warn:"text-warning"},Je={crit:"bg-destructive/10 text-destructive",ok:"bg-success/10 text-success",warn:"bg-warning/10 text-warning"},Qe=p(t=>t.includes("crit")?"crit":t.includes("warn")?"warn":"ok","Ue"),_=p(t=>{let e=(0,xe.c)(19),{chart:a,label:s,level:l,testId:d,value:u}=t,o=ve[l],i;e[0]!==o?(i=w("size-1.5 shrink-0 rounded-full",o),e[0]=o,e[1]=i):i=e[1];let h;e[2]!==i?(h=(0,r.jsx)("span",{"aria-hidden":"true",className:i}),e[2]=i,e[3]=h):h=e[3];let g;e[4]!==s||e[5]!==h?(g=(0,r.jsxs)("span",{className:"flex items-center gap-1.5 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:[h,s]}),e[4]=s,e[5]=h,e[6]=g):g=e[6];let N=be[l],f;e[7]!==N?(f=w("truncate text-2xl font-semibold tabular-nums",N),e[7]=N,e[8]=f):f=e[8];let m;e[9]!==f||e[10]!==d||e[11]!==u?(m=(0,r.jsx)("span",{className:f,"data-testid":d,children:u}),e[9]=f,e[10]=d,e[11]=u,e[12]=m):m=e[12];let x;e[13]!==a||e[14]!==m?(x=(0,r.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[m,a]}),e[13]=a,e[14]=m,e[15]=x):x=e[15];let v;return e[16]!==g||e[17]!==x?(v=(0,r.jsx)(k,{className:"gap-0 py-0",children:(0,r.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[g,x]})}),e[16]=g,e[17]=x,e[18]=v):v=e[18],v},"R"),Ve=p(async(t,e,a)=>{let s=await Promise.all(a.map(f=>{let m=Q(f);return Promise.allSettled([t.query(Le,{},m),t.query(Ce,{},m),t.query(Te,{},m)])})),l=Q(e),d=typeof t.schedulerStatus=="function"?t.schedulerStatus():Promise.reject(new Error("scheduler status unavailable")),[u,o,i]=await Promise.allSettled([t.query(Pe,{},l),t.query(De,{},l),d]),h=s.map(([f,m,x])=>({functions:m.status==="fulfilled"?m.value.functions:[],metrics:f.status==="fulfilled"?f.value:null,migrations:x.status==="fulfilled"?x.value.migrations:[]})),g=Ee(h),N=s[0]?.[0];return{auth:o.status==="fulfilled"?o.value:null,entries:u.status==="fulfilled"?u.value.entries:[],functions:je(h.map(f=>f.functions)),logsError:u.status==="rejected"?V(u.reason):null,metricsError:g.reachable===0&&N?.status==="rejected"?V(N.reason):null,migrations:Ie(h.map(f=>f.migrations)),scheduler:i.status==="fulfilled"?i.value:null,totals:g}},"Be"),pt=p(({initialShardKey:t})=>{let e=ae(),a=R(),[s,l]=(0,c.useState)([]),[d,u]=(0,c.useState)(null),[o,i]=(0,c.useState)(null),[h,g]=(0,c.useState)(null),[N,f]=(0,c.useState)([]),[m,x]=(0,c.useState)(null),[v,Ne]=(0,c.useState)(null),[we,ye]=(0,c.useState)([]),[M]=(0,c.useState)(oe),E=(0,c.useRef)(!1),$=(0,c.useRef)(!0);(0,c.useEffect)(()=>($.current=!0,()=>{$.current=!1}),[]);let j=t??"",I=(0,c.useCallback)(async()=>{if(E.current)return;E.current=!0;let n=await Ve(e,j,de(j,M));if(!$.current){E.current=!1;return}i(n.totals),g(n.metricsError),f(n.functions),ye(n.migrations),l(n.entries),u(n.logsError),x(n.auth),Ne(n.scheduler),E.current=!1},[e,M,j]);(0,c.useEffect)(()=>{z(I())},[I]);let H=(0,c.useRef)(0),D=(0,c.useRef)(null),ke=p(()=>{let n=Date.now()-H.current;if(n>=pe){H.current=Date.now(),z(I());return}D.current??=setTimeout(()=>{D.current=null,H.current=Date.now(),z(I())},pe-n)},"de");(0,c.useEffect)(()=>()=>{D.current!==null&&clearTimeout(D.current)},[]);let{data:X,liveError:Se}=ie(y.getMetrics,{},{live:!0,shardKey:j});(0,c.useEffect)(()=>{X!==void 0&&ke()},[X]);let U=s.filter(n=>n.level==="error"),B=U.slice(0,Re),C=Ue(o?.history),Y=(0,c.useMemo)(()=>{let n=m?.history??[];return{attempts:n.map(b=>b.attempts),failures:n.map(b=>b.failures)}},[m?.history]),Z=N.filter(n=>n.calls>0).toSorted((n,b)=>b.errors/b.calls-n.errors/n.calls||b.calls-n.calls).slice(0,ze),G=Be(we),Me=o===null||o.requests===0?0:o.errors/o.requests,J=W(Me,he,ge),ee=m===null?"ok":W(m.failureRate,Fe,Ke),te=v===null?"ok":$e(v.backlog,Oe,_e),P=Qe([J,ee,te,G.level]),L,T;return P==="crit"?(L=a("Critical"),T=a("One or more service levels are breached.")):P==="warn"?(L=a("Degraded"),T=a("Some service levels need attention.")):(L=a("All systems healthy"),T=a("All service levels are within target.")),(0,r.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-health",children:[(0,r.jsxs)(k,{className:"gap-0 py-0",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4 p-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:w("flex size-10 shrink-0 items-center justify-center rounded-full",Je[P]),children:(0,r.jsx)("span",{className:w("size-3 rounded-full",ve[P])})}),(0,r.jsxs)("div",{className:"grid leading-tight",children:[(0,r.jsx)("span",{className:"text-sm font-semibold text-foreground","data-testid":"hl-status",children:L}),(0,r.jsx)("span",{className:"text-[13px] text-muted-foreground",children:T})]})]}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-4",children:[(0,r.jsxs)("div",{className:"text-end",children:[(0,r.jsx)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:a("Requests")}),(0,r.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[C.requests.length>=2&&(0,r.jsx)(F,{ariaLabel:a("Requests over time"),className:"h-6 w-20 text-foreground",series:C.requests,testId:"hl-spark-requests"}),(0,r.jsx)("span",{className:"text-lg font-semibold tabular-nums text-foreground","data-testid":"hl-requests",children:(o?.requests??0).toString()})]})]}),(0,r.jsx)("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"}),(0,r.jsxs)("div",{className:"text-end",children:[(0,r.jsx)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:a("Error rate")}),(0,r.jsx)("div",{className:w("text-lg font-semibold tabular-nums",be[J]),"data-testid":"hl-error-rate",children:o===null?"\u2014":O(o.errors,o.requests)})]}),(0,r.jsx)("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(me,{}),(0,r.jsx)(ce,{message:Se,prefix:"hl"})]})]})]}),h!==null&&(0,r.jsx)("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:h})]}),(0,r.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4","data-testid":"hl-slo",children:[(0,r.jsx)(_,{chart:C.errors.length>=2?(0,r.jsx)(F,{ariaLabel:a("Errors over time"),className:"h-7 w-20 text-destructive",series:C.errors,testId:"hl-spark-errors"}):void 0,label:a("Error rate"),level:J,testId:"hl-slo-errorrate",value:o===null?"\u2014":O(o.errors,o.requests)}),(0,r.jsx)(_,{chart:Y.failures.length>=2?(0,r.jsx)(F,{ariaLabel:a("Auth failures over time"),className:"h-7 w-20 text-destructive",series:Y.failures,testId:"hl-spark-auth"}):void 0,label:a("Auth failures"),level:ee,testId:"hl-slo-auth",value:m===null?"\u2014":O(m.failures,m.attempts)}),(0,r.jsx)(_,{label:a("Scheduler backlog"),level:te,testId:"hl-slo-backlog",value:v===null?"\u2014":v.backlog.toString()}),(0,r.jsx)(_,{label:a("Migrations"),level:G.level,testId:"hl-slo-migrations",value:Ge(G,a)})]}),(0,r.jsxs)("div",{className:"grid gap-3 lg:grid-cols-2",children:[(0,r.jsxs)(k,{className:"gap-0 py-0","data-testid":"hl-functions",children:[(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Functions by error rate")})}),Z.length===0?(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-functions-empty",children:a("No function activity yet.")}):(0,r.jsx)("ul",{className:"divide-y divide-border",children:Z.map(n=>(0,r.jsxs)("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.jsx)("span",{className:"truncate font-mono text-foreground",children:n.path}),(0,r.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[(0,r.jsx)("span",{className:"tabular-nums text-muted-foreground",children:a("{count} calls",{count:n.calls.toString()})}),(0,r.jsx)(A,{variant:He[W(n.errors/n.calls,he,ge)],children:O(n.errors,n.calls)})]})]},n.path))})]}),(0,r.jsxs)(k,{className:"gap-0 py-0",children:[(0,r.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Recent errors")}),(0,r.jsx)(A,{"data-testid":"hl-error-count",variant:U.length>0?"destructive":"outline",children:U.length})]}),d!==null&&(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"hl-logs-error",role:"alert",children:d}),d===null&&B.length===0&&(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-errors-empty",children:a("No recent errors.")}),B.length>0&&(0,r.jsx)("ul",{className:"divide-y divide-border",children:B.map((n,b)=>(0,r.jsxs)("li",{className:"flex flex-col gap-0.5 px-4 py-2 text-xs","data-testid":"hl-error-row",children:[(0,r.jsxs)("span",{className:"flex items-center gap-2",children:[(0,r.jsx)("time",{className:"shrink-0 text-muted-foreground",children:ne(n.timestamp)}),n.functionPath!==void 0&&(0,r.jsx)("span",{className:"truncate font-mono text-foreground",children:n.functionPath})]}),(0,r.jsx)("span",{className:"text-destructive",children:n.message})]},`${n.timestamp.toString()}-${b.toString()}`))})]})]}),(0,r.jsxs)(k,{className:"gap-0 py-0",children:[(0,r.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Shards seen")}),(0,r.jsx)(A,{"data-testid":"hl-shard-count",variant:"outline",children:M.length})]}),M.length>0&&(0,r.jsx)("ul",{className:"flex flex-wrap gap-1.5 p-4",children:M.map(n=>(0,r.jsx)("li",{"data-testid":"hl-shard",children:(0,r.jsx)(A,{variant:"secondary",children:n})},n))})]})]})},"ot");export{pt as HealthPanel};
1
+ import{b as de,e as F}from"./chunk-5L2MD6F6.js";import{a as ce}from"./chunk-X2FQ6B5V.js";import"./chunk-PF7V3G2Z.js";import"./chunk-4UOFSGUS.js";import"./chunk-ILNELDFC.js";import"./chunk-T6VMSOBB.js";import{b as ie}from"./chunk-OWADN6BI.js";import{a as k}from"./chunk-UZERI5YC.js";import{a as oe}from"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import"./chunk-7QIFDWQV.js";import{b as A}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as y}from"./chunk-GXZAXNZI.js";import{f as ae,g as le}from"./chunk-LWECXQWP.js";import"./chunk-XBDKZZ67.js";import{d as R,f as S,g as Q,h as V,m as z,q as ne}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a as p,e as q,f as qe,g as re,h as se,j as w}from"./chunk-3XIESWL4.js";var xe=q(re(),1);var c=q(qe(),1);var ue=q(re(),1);var K=q(se(),1);var Ae={connected:"bg-success",connecting:"bg-warning",idle:"bg-muted-foreground",offline:"bg-destructive"},me=p(()=>{let t=(0,ue.c)(16),e=R(),a=le(),s;e:switch(a){case"connected":{let i;t[0]!==e?(i=e("Connected"),t[0]=e,t[1]=i):i=t[1],s=i;break e}case"connecting":{let i;t[2]!==e?(i=e("Connecting\u2026"),t[2]=e,t[3]=i):i=t[3],s=i;break e}case"idle":{let i;t[4]!==e?(i=e("Idle"),t[4]=e,t[5]=i):i=t[5],s=i;break e}case"offline":{let i;t[6]!==e?(i=e("Offline"),t[6]=e,t[7]=i):i=t[7],s=i;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,K.jsx)("span",{"aria-hidden":"true",className:d}),t[10]=d,t[11]=u):u=t[11];let o;return t[12]!==a||t[13]!==u||t[14]!==s?(o=(0,K.jsxs)("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]}),t[12]=a,t[13]=u,t[14]=s,t[15]=o):o=t[15],o},"j");var r=q(se(),1);var fe={completed:0,failed:2,in_progress:1},Ee=p(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}},"Se"),je=p(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()]},"Me"),Ie=p(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=fe[s.status]-fe[l.status];(d>0||d===0&&(s.updatedAt??0)>(l.updatedAt??0))&&e.set(s.id,s)}return[...e.values()]},"qe"),De=S(y.getAuthMetrics),Ce=S(y.getFunctionStats),Pe=S(y.getLogs),Le=S(y.getMetrics),Te=S(y.migrationStatus),Re=5,pe=2e3,ze=5,he=.01,ge=.05,Fe=.1,Ke=.3,Oe=1,_e=50,W=p((t,e,a)=>t>=a?"crit":t>=e?"warn":"ok","V"),$e=p((t,e,a)=>t>=a?"crit":t>=e?"warn":"ok","Re"),He={crit:"destructive",ok:"secondary",warn:"default"},O=p((t,e)=>e===0?"\u2014":`${(t/e*100).toFixed(1)}%`,"F"),Ue=p(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)}},"_e"),Be=p(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}},"ze"),Ge=p((t,e)=>t.failed>0?e("{count} failed",{count:t.failed.toString()}):t.running>0?e("{count} running",{count:t.running.toString()}):e("OK"),"Ke"),ve={crit:"bg-destructive",ok:"bg-success",warn:"bg-warning"},be={crit:"text-destructive",ok:"text-foreground",warn:"text-warning"},Je={crit:"bg-destructive/10 text-destructive",ok:"bg-success/10 text-success",warn:"bg-warning/10 text-warning"},Qe=p(t=>t.includes("crit")?"crit":t.includes("warn")?"warn":"ok","Ue"),_=p(t=>{let e=(0,xe.c)(19),{chart:a,label:s,level:l,testId:d,value:u}=t,o=ve[l],i;e[0]!==o?(i=w("size-1.5 shrink-0 rounded-full",o),e[0]=o,e[1]=i):i=e[1];let h;e[2]!==i?(h=(0,r.jsx)("span",{"aria-hidden":"true",className:i}),e[2]=i,e[3]=h):h=e[3];let g;e[4]!==s||e[5]!==h?(g=(0,r.jsxs)("span",{className:"flex items-center gap-1.5 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:[h,s]}),e[4]=s,e[5]=h,e[6]=g):g=e[6];let N=be[l],f;e[7]!==N?(f=w("truncate text-2xl font-semibold tabular-nums",N),e[7]=N,e[8]=f):f=e[8];let m;e[9]!==f||e[10]!==d||e[11]!==u?(m=(0,r.jsx)("span",{className:f,"data-testid":d,children:u}),e[9]=f,e[10]=d,e[11]=u,e[12]=m):m=e[12];let x;e[13]!==a||e[14]!==m?(x=(0,r.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[m,a]}),e[13]=a,e[14]=m,e[15]=x):x=e[15];let v;return e[16]!==g||e[17]!==x?(v=(0,r.jsx)(k,{className:"gap-0 py-0",children:(0,r.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[g,x]})}),e[16]=g,e[17]=x,e[18]=v):v=e[18],v},"R"),Ve=p(async(t,e,a)=>{let s=await Promise.all(a.map(f=>{let m=Q(f);return Promise.allSettled([t.query(Le,{},m),t.query(Ce,{},m),t.query(Te,{},m)])})),l=Q(e),d=typeof t.schedulerStatus=="function"?t.schedulerStatus():Promise.reject(new Error("scheduler status unavailable")),[u,o,i]=await Promise.allSettled([t.query(Pe,{},l),t.query(De,{},l),d]),h=s.map(([f,m,x])=>({functions:m.status==="fulfilled"?m.value.functions:[],metrics:f.status==="fulfilled"?f.value:null,migrations:x.status==="fulfilled"?x.value.migrations:[]})),g=Ee(h),N=s[0]?.[0];return{auth:o.status==="fulfilled"?o.value:null,entries:u.status==="fulfilled"?u.value.entries:[],functions:je(h.map(f=>f.functions)),logsError:u.status==="rejected"?V(u.reason):null,metricsError:g.reachable===0&&N?.status==="rejected"?V(N.reason):null,migrations:Ie(h.map(f=>f.migrations)),scheduler:i.status==="fulfilled"?i.value:null,totals:g}},"Be"),pt=p(({initialShardKey:t})=>{let e=ae(),a=R(),[s,l]=(0,c.useState)([]),[d,u]=(0,c.useState)(null),[o,i]=(0,c.useState)(null),[h,g]=(0,c.useState)(null),[N,f]=(0,c.useState)([]),[m,x]=(0,c.useState)(null),[v,Ne]=(0,c.useState)(null),[we,ye]=(0,c.useState)([]),[M]=(0,c.useState)(oe),E=(0,c.useRef)(!1),$=(0,c.useRef)(!0);(0,c.useEffect)(()=>($.current=!0,()=>{$.current=!1}),[]);let j=t??"",I=(0,c.useCallback)(async()=>{if(E.current)return;E.current=!0;let n=await Ve(e,j,de(j,M));if(!$.current){E.current=!1;return}i(n.totals),g(n.metricsError),f(n.functions),ye(n.migrations),l(n.entries),u(n.logsError),x(n.auth),Ne(n.scheduler),E.current=!1},[e,M,j]);(0,c.useEffect)(()=>{z(I())},[I]);let H=(0,c.useRef)(0),D=(0,c.useRef)(null),ke=p(()=>{let n=Date.now()-H.current;if(n>=pe){H.current=Date.now(),z(I());return}D.current??=setTimeout(()=>{D.current=null,H.current=Date.now(),z(I())},pe-n)},"de");(0,c.useEffect)(()=>()=>{D.current!==null&&clearTimeout(D.current)},[]);let{data:X,liveError:Se}=ie(y.getMetrics,{},{live:!0,shardKey:j});(0,c.useEffect)(()=>{X!==void 0&&ke()},[X]);let U=s.filter(n=>n.level==="error"),B=U.slice(0,Re),C=Ue(o?.history),Y=(0,c.useMemo)(()=>{let n=m?.history??[];return{attempts:n.map(b=>b.attempts),failures:n.map(b=>b.failures)}},[m?.history]),Z=N.filter(n=>n.calls>0).toSorted((n,b)=>b.errors/b.calls-n.errors/n.calls||b.calls-n.calls).slice(0,ze),G=Be(we),Me=o===null||o.requests===0?0:o.errors/o.requests,J=W(Me,he,ge),ee=m===null?"ok":W(m.failureRate,Fe,Ke),te=v===null?"ok":$e(v.backlog,Oe,_e),P=Qe([J,ee,te,G.level]),L,T;return P==="crit"?(L=a("Critical"),T=a("One or more service levels are breached.")):P==="warn"?(L=a("Degraded"),T=a("Some service levels need attention.")):(L=a("All systems healthy"),T=a("All service levels are within target.")),(0,r.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-health",children:[(0,r.jsxs)(k,{className:"gap-0 py-0",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4 p-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:w("flex size-10 shrink-0 items-center justify-center rounded-full",Je[P]),children:(0,r.jsx)("span",{className:w("size-3 rounded-full",ve[P])})}),(0,r.jsxs)("div",{className:"grid leading-tight",children:[(0,r.jsx)("span",{className:"text-sm font-semibold text-foreground","data-testid":"hl-status",children:L}),(0,r.jsx)("span",{className:"text-[13px] text-muted-foreground",children:T})]})]}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-4",children:[(0,r.jsxs)("div",{className:"text-end",children:[(0,r.jsx)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:a("Requests")}),(0,r.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[C.requests.length>=2&&(0,r.jsx)(F,{ariaLabel:a("Requests over time"),className:"h-6 w-20 text-foreground",series:C.requests,testId:"hl-spark-requests"}),(0,r.jsx)("span",{className:"text-lg font-semibold tabular-nums text-foreground","data-testid":"hl-requests",children:(o?.requests??0).toString()})]})]}),(0,r.jsx)("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"}),(0,r.jsxs)("div",{className:"text-end",children:[(0,r.jsx)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:a("Error rate")}),(0,r.jsx)("div",{className:w("text-lg font-semibold tabular-nums",be[J]),"data-testid":"hl-error-rate",children:o===null?"\u2014":O(o.errors,o.requests)})]}),(0,r.jsx)("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(me,{}),(0,r.jsx)(ce,{message:Se,prefix:"hl"})]})]})]}),h!==null&&(0,r.jsx)("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:h})]}),(0,r.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4","data-testid":"hl-slo",children:[(0,r.jsx)(_,{chart:C.errors.length>=2?(0,r.jsx)(F,{ariaLabel:a("Errors over time"),className:"h-7 w-20 text-destructive",series:C.errors,testId:"hl-spark-errors"}):void 0,label:a("Error rate"),level:J,testId:"hl-slo-errorrate",value:o===null?"\u2014":O(o.errors,o.requests)}),(0,r.jsx)(_,{chart:Y.failures.length>=2?(0,r.jsx)(F,{ariaLabel:a("Auth failures over time"),className:"h-7 w-20 text-destructive",series:Y.failures,testId:"hl-spark-auth"}):void 0,label:a("Auth failures"),level:ee,testId:"hl-slo-auth",value:m===null?"\u2014":O(m.failures,m.attempts)}),(0,r.jsx)(_,{label:a("Scheduler backlog"),level:te,testId:"hl-slo-backlog",value:v===null?"\u2014":v.backlog.toString()}),(0,r.jsx)(_,{label:a("Migrations"),level:G.level,testId:"hl-slo-migrations",value:Ge(G,a)})]}),(0,r.jsxs)("div",{className:"grid gap-3 lg:grid-cols-2",children:[(0,r.jsxs)(k,{className:"gap-0 py-0","data-testid":"hl-functions",children:[(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Functions by error rate")})}),Z.length===0?(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-functions-empty",children:a("No function activity yet.")}):(0,r.jsx)("ul",{className:"divide-y divide-border",children:Z.map(n=>(0,r.jsxs)("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.jsx)("span",{className:"truncate font-mono text-foreground",children:n.path}),(0,r.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[(0,r.jsx)("span",{className:"tabular-nums text-muted-foreground",children:a("{count} calls",{count:n.calls.toString()})}),(0,r.jsx)(A,{variant:He[W(n.errors/n.calls,he,ge)],children:O(n.errors,n.calls)})]})]},n.path))})]}),(0,r.jsxs)(k,{className:"gap-0 py-0",children:[(0,r.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Recent errors")}),(0,r.jsx)(A,{"data-testid":"hl-error-count",variant:U.length>0?"destructive":"outline",children:U.length})]}),d!==null&&(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"hl-logs-error",role:"alert",children:d}),d===null&&B.length===0&&(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-errors-empty",children:a("No recent errors.")}),B.length>0&&(0,r.jsx)("ul",{className:"divide-y divide-border",children:B.map((n,b)=>(0,r.jsxs)("li",{className:"flex flex-col gap-0.5 px-4 py-2 text-xs","data-testid":"hl-error-row",children:[(0,r.jsxs)("span",{className:"flex items-center gap-2",children:[(0,r.jsx)("time",{className:"shrink-0 text-muted-foreground",children:ne(n.timestamp)}),n.functionPath!==void 0&&(0,r.jsx)("span",{className:"truncate font-mono text-foreground",children:n.functionPath})]}),(0,r.jsx)("span",{className:"text-destructive",children:n.message})]},`${n.timestamp.toString()}-${b.toString()}`))})]})]}),(0,r.jsxs)(k,{className:"gap-0 py-0",children:[(0,r.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Shards seen")}),(0,r.jsx)(A,{"data-testid":"hl-shard-count",variant:"outline",children:M.length})]}),M.length>0&&(0,r.jsx)("ul",{className:"flex flex-wrap gap-1.5 p-4",children:M.map(n=>(0,r.jsx)("li",{"data-testid":"hl-shard",children:(0,r.jsx)(A,{variant:"secondary",children:n})},n))})]})]})},"ot");export{pt as HealthPanel};
@@ -1 +1 @@
1
- import{a as r,c as o}from"./chunk-PTTDIYGP.js";import{a as e}from"./chunk-UHHTEBC3.js";var a="lunora:traces:pending-filter",i=e(s=>{o(a,s,"session")},"o"),d=e(()=>{let s=r("session");if(s!==void 0)try{let n=s.getItem(a);if(n===null)return;let t=JSON.parse(n);return typeof t.traceId!="string"?void 0:{traceId:t.traceId,...typeof t.shardKey=="string"?{shardKey:t.shardKey}:{}}}catch{return}},"c"),p=e(()=>{try{r("session")?.removeItem(a)}catch{}},"d");export{i as a,d as b,p as c};
1
+ import{a as r,c as o}from"./chunk-7T7UOTYK.js";import{a as e}from"./chunk-3XIESWL4.js";var a="lunora:traces:pending-filter",i=e(s=>{o(a,s,"session")},"o"),d=e(()=>{let s=r("session");if(s!==void 0)try{let n=s.getItem(a);if(n===null)return;let t=JSON.parse(n);return typeof t.traceId!="string"?void 0:{traceId:t.traceId,...typeof t.shardKey=="string"?{shardKey:t.shardKey}:{}}}catch{return}},"c"),p=e(()=>{try{r("session")?.removeItem(a)}catch{}},"d");export{i as a,d as b,p as c};
@@ -1 +1 @@
1
- import{D as a,J as j,Y as de,c as J,e as ce,f as le,g as pe,h as fe,ma as me,wa as ge}from"./chunk-PWDMXMRD.js";import{b as H}from"./chunk-YNBJ6ICE.js";import{F as B,J as k,O as Y,P as z,h as ue,p as ae}from"./chunk-7Z5QEFR4.js";import{a as re}from"./chunk-46IB4C4Q.js";import{a as P,c as F,i as ie,r as se}from"./chunk-ZFWEPGWG.js";import{g as O,i as w}from"./chunk-4FNHHFWR.js";import{a as r,e as b,f as q,h as we}from"./chunk-UHHTEBC3.js";var he=b(q(),1),Q=b(re(),1);function $e(e,t){let n=he.useRef(null);function o(u){Q.flushSync(()=>{e.setOpen(!1,z(Y.focusOut,u.nativeEvent,u.currentTarget))}),pe(n.current)?.focus()}r(o,"handlePreFocusGuardFocus");function c(u){let i=e.select("positionerElement");if(i&&fe(u,i))e.context.beforeContentFocusGuardRef.current?.focus();else{Q.flushSync(()=>{e.setOpen(!1,z(Y.focusOut,u.nativeEvent,u.currentTarget))});let s=le(e.context.triggerFocusTargetRef.current||t.current);for(;s!==null&&ae(i,s);){let m=s;if(s=ce(s),s===m)break}s?.focus()}}return r(c,"handleFocusTargetFocus"),{preFocusGuardRef:n,handlePreFocusGuardFocus:o,handleFocusTargetFocus:c}}r($e,"useTriggerFocusGuards");var l=b(q(),1),ve=b(re(),1);var M=b(q(),1);function X(e){let t=se(e),n=parseFloat(t.width)||0,o=parseFloat(t.height)||0,c=ie(e),u=c?e.offsetWidth:n,i=c?e.offsetHeight:o;return(J(n)!==u||J(o)!==i)&&(n=u,o=i),{width:n,height:o}}r(X,"getCssDimensions");function Re(e){let{popupElement:t,positionerElement:n,content:o,mounted:c,onMeasureLayout:u,onMeasureLayoutComplete:i,side:s,direction:m}=e,x=k(t,!0,!1),g=B(),p=M.useRef(null),D=M.useRef(!0),f=M.useRef(O),I=F(u),v=F(i),C=M.useMemo(()=>{let h=s==="top",R=s==="left";return m==="rtl"?(h=h||s==="inline-end",R=R||s==="inline-end"):(h=h||s==="inline-start",R=R||s==="inline-start"),h?{position:"absolute",[s==="top"?"bottom":"top"]:"0",[R?"right":"left"]:"0"}:w},[s,m]);P(()=>{if(!c){f.current=O,D.current=!0,p.current=null;return}if(!t||!n)return;f.current=ye(t,C),Z(t,"auto");let h=K(t,"position","static"),R=K(t,"transform","none"),U=K(t,"scale","1"),y=ye(n,{"--available-width":"max-content","--available-height":"max-content"});function T(){h(),R(),y()}r(T,"restoreMeasurementOverrides");function L(){T(),U()}if(r(L,"restoreMeasurementOverridesIncludingScale"),I?.(),D.current||p.current===null){G(n,"max-content");let E=X(t);return p.current=E,G(n,E),L(),v?.(null,E),D.current=!1,()=>{f.current(),f.current=O}}G(n,"max-content");let N=p.current,S=X(t);p.current=S,Z(t,N),L(),v?.(N,S),G(n,S);let $=new AbortController;return g.request(()=>{Z(t,S),x(()=>{t.style.setProperty("--popup-width","auto"),t.style.setProperty("--popup-height","auto")},$.signal)}),()=>{$.abort(),g.cancel(),f.current(),f.current=O}},[o,t,n,x,g,c,I,v,C])}r(Re,"usePopupAutoResize");function K(e,t,n){let o=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,o)}}r(K,"overrideElementStyle");function ye(e,t){let n=[];for(let[o,c]of Object.entries(t))n.push(K(e,o,c));return n.length?()=>{n.forEach(o=>o())}:O}r(ye,"applyElementStyles");function Z(e,t){let n=t==="auto"?"auto":`${t.width}px`,o=t==="auto"?"auto":`${t.height}px`;e.style.setProperty("--popup-width",n),e.style.setProperty("--popup-height",o)}r(Z,"setPopupCssSize");function G(e,t){let n=t==="max-content"?"max-content":`${t.width}px`,o=t==="max-content"?"max-content":`${t.height}px`;e.style.setProperty("--positioner-width",n),e.style.setProperty("--positioner-height",o)}r(G,"setPositionerCssSize");var A=b(we(),1);function pt(e){let{store:t,side:n,cssVars:o,children:c}=e,u=H(),i=t.useState("activeTriggerElement"),s=t.useState("activeTriggerId"),m=t.useState("open"),x=t.useState("payload"),g=t.useState("mounted"),p=t.useState("popupElement"),D=t.useState("positionerElement"),f=ge(m?i:null),I=Ae(s,x),v=l.useRef(null),[C,h]=l.useState(null),[R,U]=l.useState(null),y=l.useRef(null),T=l.useRef(null),L=k(y,!0,!1),N=B(),[S,$]=l.useState(null),[E,te]=l.useState(!1);P(()=>(t.set("hasViewport",!0),()=>{t.set("hasViewport",!1)}),[t]);let Te=F(()=>{y.current?.style.setProperty("animation","none"),y.current?.style.setProperty("transition","none"),T.current?.style.setProperty("display","none")}),Ee=F(d=>{y.current?.style.removeProperty("animation"),y.current?.style.removeProperty("transition"),T.current?.style.removeProperty("display"),d&&$(d)}),W=l.useRef(null);P(()=>{(!m||!g)&&(W.current=null)},[m,g]),P(()=>{if(i&&f&&i!==f&&W.current!==i&&v.current){h(v.current),te(!0);let d=Me(f,i);U(d),N.request(()=>{ve.flushSync(()=>{te(!1)}),L(()=>{h(null),$(null),v.current=null})}),W.current=i}},[i,f,C,L,N]),P(()=>{let d=y.current;if(!d)return;let oe=ue(d).createElement("div");for(let Oe of Array.from(d.childNodes))oe.appendChild(Oe.cloneNode(!0));v.current=oe});let ne=C!=null,_;ne?_=(0,A.jsxs)(l.Fragment,{children:[(0,A.jsx)("div",{"data-previous":!0,inert:me(!0),ref:T,style:{...S?{[o.popupWidth]:`${S.width}px`,[o.popupHeight]:`${S.height}px`}:null,position:"absolute"},"data-ending-style":E?void 0:""},"previous"),(0,A.jsx)("div",{"data-current":!0,ref:y,"data-starting-style":E?"":void 0,children:c},I)]}):_=(0,A.jsx)("div",{"data-current":!0,ref:y,children:c},I),P(()=>{let d=T.current;!d||!C||d.replaceChildren(...Array.from(C.childNodes))},[C]),Re({popupElement:p,positionerElement:D,mounted:g,content:x,onMeasureLayout:Te,onMeasureLayoutComplete:Ee,side:n,direction:u});let be={activationDirection:Fe(R),transitioning:ne};return{children:_,state:be}}r(pt,"usePopupViewport");function Fe(e){if(e)return`${Pe(e.horizontal,5,"right","left")} ${Pe(e.vertical,5,"down","up")}`}r(Fe,"getActivationDirection");function Pe(e,t,n,o){return e>t?n:e<-t?o:""}r(Pe,"getValueWithTolerance");function Me(e,t){let n=e.getBoundingClientRect(),o=t.getBoundingClientRect(),c={x:n.left+n.width/2,y:n.top+n.height/2},u={x:o.left+o.width/2,y:o.top+o.height/2};return{horizontal:u.x-c.x,vertical:u.y-c.y}}r(Me,"calculateRelativePosition");function Ae(e,t){let[n,o]=l.useState(0),c=l.useRef(e),u=l.useRef(t),i=l.useRef(!1);return P(()=>{let s=c.current,m=u.current,x=e!==s,g=t!==m;x?(o(p=>p+1),i.current=!g):i.current&&g&&(o(p=>p+1),i.current=!1),c.current=e,u.current=t},[e,t]),`${e??"current"}-${n}`}r(Ae,"usePopupContentKey");function Ce(){return new j({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new de,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}r(Ce,"getEmptyRootContext");function St(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:Ce(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:w,inactiveTriggerProps:w,popupProps:w}}r(St,"createInitialPopupStoreState");function xt(e,t,n=!1){return new j({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0})}r(xt,"createPopupFloatingRootContext");var V=a(e=>e.triggerIdProp??e.activeTriggerId),ee=a(e=>e.openProp??e.open),Se=a(e=>(e.popupElement?.id??e.floatingId)||void 0);function xe(e,t){return t!==void 0&&ee(e)&&V(e)===t}r(xe,"triggerOwnsOpenPopup");function De(e,t){return xe(e,t)?!0:t!==void 0&&ee(e)&&V(e)==null&&e.triggerCount===1}r(De,"triggerOwnsOpenPopupOrIsOnlyTrigger");var Tt={open:ee,mounted:a(e=>e.mounted),transitionStatus:a(e=>e.transitionStatus),floatingRootContext:a(e=>e.floatingRootContext),triggerCount:a(e=>e.triggerCount),preventUnmountingOnClose:a(e=>e.preventUnmountingOnClose),payload:a(e=>e.payload),activeTriggerId:V,activeTriggerElement:a(e=>e.mounted?e.activeTriggerElement:null),popupId:Se,isTriggerActive:a((e,t)=>t!==void 0&&V(e)===t),isOpenedByTrigger:a((e,t)=>xe(e,t)),isMountedByTrigger:a((e,t)=>t!==void 0&&V(e)===t&&e.mounted),triggerProps:a((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),triggerPopupId:a((e,t)=>De(e,t)?Se(e):void 0),popupProps:a(e=>e.popupProps),popupElement:a(e=>e.popupElement),positionerElement:a(e=>e.positionerElement)};export{St as a,xt as b,Tt as c,$e as d,pt as e};
1
+ import{D as a,J as j,Y as de,c as J,e as ce,f as le,g as pe,h as fe,ma as me,wa as ge}from"./chunk-7YEFOSPH.js";import{b as H}from"./chunk-BGBLQ563.js";import{F as B,J as k,O as Y,P as z,h as ue,p as ae}from"./chunk-CFPZYHPY.js";import{a as re}from"./chunk-7QIFDWQV.js";import{a as P,c as F,i as ie,r as se}from"./chunk-2OUPA2WJ.js";import{g as O,i as w}from"./chunk-6ST5ECQA.js";import{a as r,e as b,f as q,h as we}from"./chunk-3XIESWL4.js";var he=b(q(),1),Q=b(re(),1);function $e(e,t){let n=he.useRef(null);function o(u){Q.flushSync(()=>{e.setOpen(!1,z(Y.focusOut,u.nativeEvent,u.currentTarget))}),pe(n.current)?.focus()}r(o,"handlePreFocusGuardFocus");function c(u){let i=e.select("positionerElement");if(i&&fe(u,i))e.context.beforeContentFocusGuardRef.current?.focus();else{Q.flushSync(()=>{e.setOpen(!1,z(Y.focusOut,u.nativeEvent,u.currentTarget))});let s=le(e.context.triggerFocusTargetRef.current||t.current);for(;s!==null&&ae(i,s);){let m=s;if(s=ce(s),s===m)break}s?.focus()}}return r(c,"handleFocusTargetFocus"),{preFocusGuardRef:n,handlePreFocusGuardFocus:o,handleFocusTargetFocus:c}}r($e,"useTriggerFocusGuards");var l=b(q(),1),ve=b(re(),1);var M=b(q(),1);function X(e){let t=se(e),n=parseFloat(t.width)||0,o=parseFloat(t.height)||0,c=ie(e),u=c?e.offsetWidth:n,i=c?e.offsetHeight:o;return(J(n)!==u||J(o)!==i)&&(n=u,o=i),{width:n,height:o}}r(X,"getCssDimensions");function Re(e){let{popupElement:t,positionerElement:n,content:o,mounted:c,onMeasureLayout:u,onMeasureLayoutComplete:i,side:s,direction:m}=e,x=k(t,!0,!1),g=B(),p=M.useRef(null),D=M.useRef(!0),f=M.useRef(O),I=F(u),v=F(i),C=M.useMemo(()=>{let h=s==="top",R=s==="left";return m==="rtl"?(h=h||s==="inline-end",R=R||s==="inline-end"):(h=h||s==="inline-start",R=R||s==="inline-start"),h?{position:"absolute",[s==="top"?"bottom":"top"]:"0",[R?"right":"left"]:"0"}:w},[s,m]);P(()=>{if(!c){f.current=O,D.current=!0,p.current=null;return}if(!t||!n)return;f.current=ye(t,C),Z(t,"auto");let h=K(t,"position","static"),R=K(t,"transform","none"),U=K(t,"scale","1"),y=ye(n,{"--available-width":"max-content","--available-height":"max-content"});function T(){h(),R(),y()}r(T,"restoreMeasurementOverrides");function L(){T(),U()}if(r(L,"restoreMeasurementOverridesIncludingScale"),I?.(),D.current||p.current===null){G(n,"max-content");let E=X(t);return p.current=E,G(n,E),L(),v?.(null,E),D.current=!1,()=>{f.current(),f.current=O}}G(n,"max-content");let N=p.current,S=X(t);p.current=S,Z(t,N),L(),v?.(N,S),G(n,S);let $=new AbortController;return g.request(()=>{Z(t,S),x(()=>{t.style.setProperty("--popup-width","auto"),t.style.setProperty("--popup-height","auto")},$.signal)}),()=>{$.abort(),g.cancel(),f.current(),f.current=O}},[o,t,n,x,g,c,I,v,C])}r(Re,"usePopupAutoResize");function K(e,t,n){let o=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,o)}}r(K,"overrideElementStyle");function ye(e,t){let n=[];for(let[o,c]of Object.entries(t))n.push(K(e,o,c));return n.length?()=>{n.forEach(o=>o())}:O}r(ye,"applyElementStyles");function Z(e,t){let n=t==="auto"?"auto":`${t.width}px`,o=t==="auto"?"auto":`${t.height}px`;e.style.setProperty("--popup-width",n),e.style.setProperty("--popup-height",o)}r(Z,"setPopupCssSize");function G(e,t){let n=t==="max-content"?"max-content":`${t.width}px`,o=t==="max-content"?"max-content":`${t.height}px`;e.style.setProperty("--positioner-width",n),e.style.setProperty("--positioner-height",o)}r(G,"setPositionerCssSize");var A=b(we(),1);function pt(e){let{store:t,side:n,cssVars:o,children:c}=e,u=H(),i=t.useState("activeTriggerElement"),s=t.useState("activeTriggerId"),m=t.useState("open"),x=t.useState("payload"),g=t.useState("mounted"),p=t.useState("popupElement"),D=t.useState("positionerElement"),f=ge(m?i:null),I=Ae(s,x),v=l.useRef(null),[C,h]=l.useState(null),[R,U]=l.useState(null),y=l.useRef(null),T=l.useRef(null),L=k(y,!0,!1),N=B(),[S,$]=l.useState(null),[E,te]=l.useState(!1);P(()=>(t.set("hasViewport",!0),()=>{t.set("hasViewport",!1)}),[t]);let Te=F(()=>{y.current?.style.setProperty("animation","none"),y.current?.style.setProperty("transition","none"),T.current?.style.setProperty("display","none")}),Ee=F(d=>{y.current?.style.removeProperty("animation"),y.current?.style.removeProperty("transition"),T.current?.style.removeProperty("display"),d&&$(d)}),W=l.useRef(null);P(()=>{(!m||!g)&&(W.current=null)},[m,g]),P(()=>{if(i&&f&&i!==f&&W.current!==i&&v.current){h(v.current),te(!0);let d=Me(f,i);U(d),N.request(()=>{ve.flushSync(()=>{te(!1)}),L(()=>{h(null),$(null),v.current=null})}),W.current=i}},[i,f,C,L,N]),P(()=>{let d=y.current;if(!d)return;let oe=ue(d).createElement("div");for(let Oe of Array.from(d.childNodes))oe.appendChild(Oe.cloneNode(!0));v.current=oe});let ne=C!=null,_;ne?_=(0,A.jsxs)(l.Fragment,{children:[(0,A.jsx)("div",{"data-previous":!0,inert:me(!0),ref:T,style:{...S?{[o.popupWidth]:`${S.width}px`,[o.popupHeight]:`${S.height}px`}:null,position:"absolute"},"data-ending-style":E?void 0:""},"previous"),(0,A.jsx)("div",{"data-current":!0,ref:y,"data-starting-style":E?"":void 0,children:c},I)]}):_=(0,A.jsx)("div",{"data-current":!0,ref:y,children:c},I),P(()=>{let d=T.current;!d||!C||d.replaceChildren(...Array.from(C.childNodes))},[C]),Re({popupElement:p,positionerElement:D,mounted:g,content:x,onMeasureLayout:Te,onMeasureLayoutComplete:Ee,side:n,direction:u});let be={activationDirection:Fe(R),transitioning:ne};return{children:_,state:be}}r(pt,"usePopupViewport");function Fe(e){if(e)return`${Pe(e.horizontal,5,"right","left")} ${Pe(e.vertical,5,"down","up")}`}r(Fe,"getActivationDirection");function Pe(e,t,n,o){return e>t?n:e<-t?o:""}r(Pe,"getValueWithTolerance");function Me(e,t){let n=e.getBoundingClientRect(),o=t.getBoundingClientRect(),c={x:n.left+n.width/2,y:n.top+n.height/2},u={x:o.left+o.width/2,y:o.top+o.height/2};return{horizontal:u.x-c.x,vertical:u.y-c.y}}r(Me,"calculateRelativePosition");function Ae(e,t){let[n,o]=l.useState(0),c=l.useRef(e),u=l.useRef(t),i=l.useRef(!1);return P(()=>{let s=c.current,m=u.current,x=e!==s,g=t!==m;x?(o(p=>p+1),i.current=!g):i.current&&g&&(o(p=>p+1),i.current=!1),c.current=e,u.current=t},[e,t]),`${e??"current"}-${n}`}r(Ae,"usePopupContentKey");function Ce(){return new j({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new de,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}r(Ce,"getEmptyRootContext");function St(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:Ce(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:w,inactiveTriggerProps:w,popupProps:w}}r(St,"createInitialPopupStoreState");function xt(e,t,n=!1){return new j({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0})}r(xt,"createPopupFloatingRootContext");var V=a(e=>e.triggerIdProp??e.activeTriggerId),ee=a(e=>e.openProp??e.open),Se=a(e=>(e.popupElement?.id??e.floatingId)||void 0);function xe(e,t){return t!==void 0&&ee(e)&&V(e)===t}r(xe,"triggerOwnsOpenPopup");function De(e,t){return xe(e,t)?!0:t!==void 0&&ee(e)&&V(e)==null&&e.triggerCount===1}r(De,"triggerOwnsOpenPopupOrIsOnlyTrigger");var Tt={open:ee,mounted:a(e=>e.mounted),transitionStatus:a(e=>e.transitionStatus),floatingRootContext:a(e=>e.floatingRootContext),triggerCount:a(e=>e.triggerCount),preventUnmountingOnClose:a(e=>e.preventUnmountingOnClose),payload:a(e=>e.payload),activeTriggerId:V,activeTriggerElement:a(e=>e.mounted?e.activeTriggerElement:null),popupId:Se,isTriggerActive:a((e,t)=>t!==void 0&&V(e)===t),isOpenedByTrigger:a((e,t)=>xe(e,t)),isMountedByTrigger:a((e,t)=>t!==void 0&&V(e)===t&&e.mounted),triggerProps:a((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),triggerPopupId:a((e,t)=>De(e,t)?Se(e):void 0),popupProps:a(e=>e.popupProps),popupElement:a(e=>e.popupElement),positionerElement:a(e=>e.positionerElement)};export{St as a,xt as b,Tt as c,$e as d,pt as e};
@@ -1,4 +1,4 @@
1
- import{b as Ee}from"./chunk-HY46NTNW.js";import"./chunk-6P7HIPUE.js";import{c as _e}from"./chunk-SKHEGARW.js";import"./chunk-PR2SE2MD.js";import"./chunk-CZEUVNCQ.js";import{a as ye}from"./chunk-JLFCXBNQ.js";import"./chunk-VEFNSN7P.js";import{a as Ue}from"./chunk-SA6MBPBL.js";import"./chunk-NCCUM26H.js";import"./chunk-PWDMXMRD.js";import"./chunk-YNBJ6ICE.js";import"./chunk-C4O5UR4Y.js";import{a as Re}from"./chunk-C4VURT57.js";import"./chunk-KSRXMTBV.js";import{a as $e,b as Te,c as Fe,d as ce,e as ne,f as ee}from"./chunk-Q5WXTZWX.js";import{a as je,e as ze}from"./chunk-JKPK25JO.js";import"./chunk-KOC5KV3E.js";import{a as De}from"./chunk-V66TSUKV.js";import"./chunk-UWF5DOGV.js";import"./chunk-PTTDIYGP.js";import{R as Ne}from"./chunk-7Z5QEFR4.js";import"./chunk-46IB4C4Q.js";import{c as re}from"./chunk-UY2Y5CXB.js";import"./chunk-ZFWEPGWG.js";import{b as ae}from"./chunk-K5PFWU5J.js";import"./chunk-4FNHHFWR.js";import{a as be}from"./chunk-GXZAXNZI.js";import{f as Se}from"./chunk-KJTLW5W2.js";import"./chunk-UREY4GLG.js";import{a as he}from"./chunk-6OKDCV7J.js";import{d as Ce,f as me,g as ge,h as Y,m as W,o as Ke,p as pe}from"./chunk-KLLYGWNF.js";import"./chunk-UDZY7MKE.js";import{a as g,e as fe,f as gt,g as pt,h as bt}from"./chunk-UHHTEBC3.js";var M=fe(pt(),1),z=fe(gt(),1);var n=fe(bt(),1);var Me=g((c,e,r)=>{let t=(0,M.c)(21),{onCopy:s,onDelete:o,onDownload:u,onToggleSelect:i}=r,l;t[0]!==c.key||t[1]!==s?(l=g(()=>{s(c.key)},"l"),t[0]=c.key,t[1]=s,t[2]=l):l=t[2];let f=l,h;t[3]!==c.key||t[4]!==u?(h=g(()=>{u(c.key)},"h"),t[3]=c.key,t[4]=u,t[5]=h):h=t[5];let d=h,m;t[6]!==c.key||t[7]!==o?(m=g(()=>{o(c.key)},"m"),t[6]=c.key,t[7]=o,t[8]=m):m=t[8];let w=m,a;t[9]!==c.key||t[10]!==i?(a=g(()=>{i(c.key)},"s"),t[9]=c.key,t[10]=i,t[11]=a):a=t[11];let v=a,x;t[12]!==c.key||t[13]!==e.length?(x=c.key.slice(e.length),t[12]=c.key,t[13]=e.length,t[14]=x):x=t[14];let b;return t[15]!==f||t[16]!==d||t[17]!==w||t[18]!==x||t[19]!==v?(b={copy:f,download:d,name:x,remove:w,toggle:v},t[15]=f,t[16]=d,t[17]=w,t[18]=x,t[19]=v,t[20]=b):b=t[20],b},"Ke"),Be=g(c=>{let e=(0,M.c)(31),{busy:r,buttonClassName:t,copied:s,objectKey:o,onCopy:u,onDelete:i,onDownload:l,t:f}=c,h=`storage-copy-${o}`,d;e[0]!==s||e[1]!==f?(d=f(s?"Copied":"Copy URL"),e[0]=s,e[1]=f,e[2]=d):d=e[2];let m;e[3]!==r||e[4]!==t||e[5]!==u||e[6]!==h||e[7]!==d?(m=(0,n.jsx)(re,{className:t,"data-testid":h,disabled:r,onClick:u,size:"sm",type:"button",variant:"ghost",children:d}),e[3]=r,e[4]=t,e[5]=u,e[6]=h,e[7]=d,e[8]=m):m=e[8];let w=`storage-download-${o}`,a;e[9]!==f?(a=f("Download"),e[9]=f,e[10]=a):a=e[10];let v;e[11]!==r||e[12]!==t||e[13]!==l||e[14]!==w||e[15]!==a?(v=(0,n.jsx)(re,{className:t,"data-testid":w,disabled:r,onClick:l,size:"sm",type:"button",variant:"ghost",children:a}),e[11]=r,e[12]=t,e[13]=l,e[14]=w,e[15]=a,e[16]=v):v=e[16];let x;e[17]!==f?(x=f("Delete object?"),e[17]=f,e[18]=x):x=e[18];let b=`storage-delete-${o}`,y;e[19]!==f?(y=f("Delete"),e[19]=f,e[20]=y):y=e[20];let k;e[21]!==r||e[22]!==i||e[23]!==x||e[24]!==b||e[25]!==y?(k=(0,n.jsx)(Re,{confirmLabel:x,disabled:r,onConfirm:i,testId:b,children:y}),e[21]=r,e[22]=i,e[23]=x,e[24]=b,e[25]=y,e[26]=k):k=e[26];let S;return e[27]!==k||e[28]!==m||e[29]!==v?(S=(0,n.jsxs)(n.Fragment,{children:[m,v,k]}),e[27]=k,e[28]=m,e[29]=v,e[30]=S):S=e[30],S},"De"),Ae=g(c=>{let e=(0,M.c)(14),{objectKey:r,references:t,t:s}=c;if(t===void 0)return null;if(t.length===0){let h=`storage-orphan-${r}`,d;e[0]!==s?(d=s("Orphan"),e[0]=s,e[1]=d):d=e[1];let m;return e[2]!==h||e[3]!==d?(m=(0,n.jsx)(ae,{"data-testid":h,variant:"warning",children:d}),e[2]=h,e[3]=d,e[4]=m):m=e[4],m}let o;e[5]!==t?(o=t.map(yt).join(`
1
+ import{b as Ee}from"./chunk-5RF4QDDA.js";import"./chunk-XQGANNLS.js";import{c as _e}from"./chunk-SKHEGARW.js";import"./chunk-SD4BERSA.js";import"./chunk-IC4L6G56.js";import{a as ye}from"./chunk-JN2Y24PY.js";import"./chunk-ESVP44Y3.js";import{a as Ue}from"./chunk-54MMVNPT.js";import"./chunk-KYF2E5CJ.js";import"./chunk-7YEFOSPH.js";import"./chunk-BGBLQ563.js";import"./chunk-IVFHIQOT.js";import{a as Re}from"./chunk-7LQWFOEU.js";import"./chunk-T6VMSOBB.js";import{a as $e,b as Te,c as Fe,d as ce,e as ne,f as ee}from"./chunk-MIQTKZAR.js";import{a as je,e as ze}from"./chunk-UZERI5YC.js";import"./chunk-QBWRC5YX.js";import{a as De}from"./chunk-LFXFP4IF.js";import"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import{R as Ne}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as re}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as ae}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as be}from"./chunk-GXZAXNZI.js";import{f as Se}from"./chunk-LWECXQWP.js";import"./chunk-XBDKZZ67.js";import{a as he}from"./chunk-XQCVZAGU.js";import{d as Ce,f as me,g as ge,h as Y,m as W,o as Ke,p as pe}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a as g,e as fe,f as gt,g as pt,h as bt}from"./chunk-3XIESWL4.js";var M=fe(pt(),1),z=fe(gt(),1);var n=fe(bt(),1);var Me=g((c,e,r)=>{let t=(0,M.c)(21),{onCopy:s,onDelete:o,onDownload:u,onToggleSelect:i}=r,l;t[0]!==c.key||t[1]!==s?(l=g(()=>{s(c.key)},"l"),t[0]=c.key,t[1]=s,t[2]=l):l=t[2];let f=l,h;t[3]!==c.key||t[4]!==u?(h=g(()=>{u(c.key)},"h"),t[3]=c.key,t[4]=u,t[5]=h):h=t[5];let d=h,m;t[6]!==c.key||t[7]!==o?(m=g(()=>{o(c.key)},"m"),t[6]=c.key,t[7]=o,t[8]=m):m=t[8];let w=m,a;t[9]!==c.key||t[10]!==i?(a=g(()=>{i(c.key)},"s"),t[9]=c.key,t[10]=i,t[11]=a):a=t[11];let v=a,x;t[12]!==c.key||t[13]!==e.length?(x=c.key.slice(e.length),t[12]=c.key,t[13]=e.length,t[14]=x):x=t[14];let b;return t[15]!==f||t[16]!==d||t[17]!==w||t[18]!==x||t[19]!==v?(b={copy:f,download:d,name:x,remove:w,toggle:v},t[15]=f,t[16]=d,t[17]=w,t[18]=x,t[19]=v,t[20]=b):b=t[20],b},"Ke"),Be=g(c=>{let e=(0,M.c)(31),{busy:r,buttonClassName:t,copied:s,objectKey:o,onCopy:u,onDelete:i,onDownload:l,t:f}=c,h=`storage-copy-${o}`,d;e[0]!==s||e[1]!==f?(d=f(s?"Copied":"Copy URL"),e[0]=s,e[1]=f,e[2]=d):d=e[2];let m;e[3]!==r||e[4]!==t||e[5]!==u||e[6]!==h||e[7]!==d?(m=(0,n.jsx)(re,{className:t,"data-testid":h,disabled:r,onClick:u,size:"sm",type:"button",variant:"ghost",children:d}),e[3]=r,e[4]=t,e[5]=u,e[6]=h,e[7]=d,e[8]=m):m=e[8];let w=`storage-download-${o}`,a;e[9]!==f?(a=f("Download"),e[9]=f,e[10]=a):a=e[10];let v;e[11]!==r||e[12]!==t||e[13]!==l||e[14]!==w||e[15]!==a?(v=(0,n.jsx)(re,{className:t,"data-testid":w,disabled:r,onClick:l,size:"sm",type:"button",variant:"ghost",children:a}),e[11]=r,e[12]=t,e[13]=l,e[14]=w,e[15]=a,e[16]=v):v=e[16];let x;e[17]!==f?(x=f("Delete object?"),e[17]=f,e[18]=x):x=e[18];let b=`storage-delete-${o}`,y;e[19]!==f?(y=f("Delete"),e[19]=f,e[20]=y):y=e[20];let k;e[21]!==r||e[22]!==i||e[23]!==x||e[24]!==b||e[25]!==y?(k=(0,n.jsx)(Re,{confirmLabel:x,disabled:r,onConfirm:i,testId:b,children:y}),e[21]=r,e[22]=i,e[23]=x,e[24]=b,e[25]=y,e[26]=k):k=e[26];let S;return e[27]!==k||e[28]!==m||e[29]!==v?(S=(0,n.jsxs)(n.Fragment,{children:[m,v,k]}),e[27]=k,e[28]=m,e[29]=v,e[30]=S):S=e[30],S},"De"),Ae=g(c=>{let e=(0,M.c)(14),{objectKey:r,references:t,t:s}=c;if(t===void 0)return null;if(t.length===0){let h=`storage-orphan-${r}`,d;e[0]!==s?(d=s("Orphan"),e[0]=s,e[1]=d):d=e[1];let m;return e[2]!==h||e[3]!==d?(m=(0,n.jsx)(ae,{"data-testid":h,variant:"warning",children:d}),e[2]=h,e[3]=d,e[4]=m):m=e[4],m}let o;e[5]!==t?(o=t.map(yt).join(`
2
2
  `),e[5]=t,e[6]=o):o=e[6];let u=o,i=`storage-refs-${r}`,l;e[7]!==t.length||e[8]!==s?(l=t.length===1?s("1 record"):s("{count} records",{count:t.length}),e[7]=t.length,e[8]=s,e[9]=l):l=e[9];let f;return e[10]!==u||e[11]!==i||e[12]!==l?(f=(0,n.jsx)(ae,{"data-testid":i,title:u,variant:"secondary",children:l}),e[10]=u,e[11]=i,e[12]=l,e[13]=f):f=e[13],f},"Te"),Pe=g(c=>{let e=(0,M.c)(7),{objectKey:r,onToggle:t,selected:s,t:o}=c,u;e[0]!==o?(u=o("Select row"),e[0]=o,e[1]=u):u=e[1];let i=`storage-select-${r}`,l;return e[2]!==t||e[3]!==s||e[4]!==u||e[5]!==i?(l=(0,n.jsx)(ye,{"aria-label":u,checked:s,"data-testid":i,onCheckedChange:t}),e[2]=t,e[3]=s,e[4]=u,e[5]=i,e[6]=l):l=e[6],l},"Fe");function yt(c){return`${c.table}\xB7${c.id}`}g(yt,"xt");var xt=g(c=>{let e=(0,M.c)(10),{colSpan:r,name:t,onEnter:s}=c,o;e[0]!==t||e[1]!==s?(o=g(()=>{s(t)},"n"),e[0]=t,e[1]=s,e[2]=o):o=e[2];let u=o,i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=(0,n.jsx)("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,n.jsx)("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"})}),e[3]=i):i=e[3];let l;e[4]!==u||e[5]!==t?(l=(0,n.jsxs)("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:[i,t]}),e[4]=u,e[5]=t,e[6]=l):l=e[6];let f;return e[7]!==r||e[8]!==l?(f=(0,n.jsx)(ce,{children:(0,n.jsx)(ee,{colSpan:r,children:l})}),e[7]=r,e[8]=l,e[9]=f):f=e[9],f},"kt"),vt=g(c=>{let e=(0,M.c)(33),{busy:r,copiedKey:t,handlers:s,object:o,prefix:u,references:i,selected:l,showReferences:f,t:h}=c,{copy:d,download:m,name:w,remove:a,toggle:v}=Me(o,u,s),x;e[0]!==o.key||e[1]!==l||e[2]!==h||e[3]!==v?(x=(0,n.jsx)(ee,{className:"w-8",children:(0,n.jsx)(Pe,{objectKey:o.key,onToggle:v,selected:l,t:h})}),e[0]=o.key,e[1]=l,e[2]=h,e[3]=v,e[4]=x):x=e[4];let b;e[5]!==w?(b=(0,n.jsx)(ee,{className:"font-mono text-xs",children:w}),e[5]=w,e[6]=b):b=e[6];let y;e[7]!==o.size?(y=pe(o.size),e[7]=o.size,e[8]=y):y=e[8];let k;e[9]!==y?(k=(0,n.jsx)(ee,{className:"tabular-nums text-muted-foreground",children:y}),e[9]=y,e[10]=k):k=e[10];let S=o.httpMetadata?.contentType??"",j;e[11]!==S?(j=(0,n.jsx)(ee,{children:S}),e[11]=S,e[12]=j):j=e[12];let C;e[13]!==o.key||e[14]!==i||e[15]!==f||e[16]!==h?(C=f&&(0,n.jsx)(ee,{children:(0,n.jsx)(Ae,{objectKey:o.key,references:i,t:h})}),e[13]=o.key,e[14]=i,e[15]=f,e[16]=h,e[17]=C):C=e[17];let N=t===o.key,K;e[18]!==r||e[19]!==d||e[20]!==m||e[21]!==o.key||e[22]!==a||e[23]!==h||e[24]!==N?(K=(0,n.jsx)(ee,{className:"text-right",children:(0,n.jsx)("span",{className:"inline-flex items-center gap-1",children:(0,n.jsx)(Be,{busy:r,copied:N,objectKey:o.key,onCopy:d,onDelete:a,onDownload:m,t:h})})}),e[18]=r,e[19]=d,e[20]=m,e[21]=o.key,e[22]=a,e[23]=h,e[24]=N,e[25]=K):K=e[25];let $;return e[26]!==x||e[27]!==b||e[28]!==k||e[29]!==j||e[30]!==C||e[31]!==K?($=(0,n.jsxs)(ce,{"data-testid":"fb-row",children:[x,b,k,j,C,K]}),e[26]=x,e[27]=b,e[28]=k,e[29]=j,e[30]=C,e[31]=K,e[32]=$):$=e[32],$},"vt"),kt=g(c=>{let e=(0,M.c)(65),{allSelected:r,busy:t,copiedKey:s,files:o,folders:u,handlers:i,onEnterFolder:l,prefix:f,references:h,selected:d,showReferences:m,someSelected:w,t:a,toggleSelectAll:v}=c,x;e[0]!==a?(x=a("Select all rows"),e[0]=a,e[1]=x):x=e[1];let b;e[2]!==r||e[3]!==w||e[4]!==x||e[5]!==v?(b=(0,n.jsx)(ne,{className:"w-8",children:(0,n.jsx)(ye,{"aria-label":x,checked:r,"data-testid":"storage-select-all",indeterminate:w,onCheckedChange:v})}),e[2]=r,e[3]=w,e[4]=x,e[5]=v,e[6]=b):b=e[6];let y;e[7]!==a?(y=a("key"),e[7]=a,e[8]=y):y=e[8];let k;e[9]!==y?(k=(0,n.jsx)(ne,{children:y}),e[9]=y,e[10]=k):k=e[10];let S;e[11]!==a?(S=a("size"),e[11]=a,e[12]=S):S=e[12];let j;e[13]!==S?(j=(0,n.jsx)(ne,{children:S}),e[13]=S,e[14]=j):j=e[14];let C;e[15]!==a?(C=a("content-type"),e[15]=a,e[16]=C):C=e[16];let N;e[17]!==C?(N=(0,n.jsx)(ne,{children:C}),e[17]=C,e[18]=N):N=e[18];let K;e[19]!==m||e[20]!==a?(K=m&&(0,n.jsx)(ne,{children:a("used by")}),e[19]=m,e[20]=a,e[21]=K):K=e[21];let $;e[22]!==a?($=a("Actions"),e[22]=a,e[23]=$):$=e[23];let F;e[24]!==$?(F=(0,n.jsx)(ne,{"aria-label":$}),e[24]=$,e[25]=F):F=e[25];let T;e[26]!==F||e[27]!==b||e[28]!==k||e[29]!==j||e[30]!==N||e[31]!==K?(T=(0,n.jsx)(Te,{children:(0,n.jsxs)(ce,{children:[b,k,j,N,K,F]})}),e[26]=F,e[27]=b,e[28]=k,e[29]=j,e[30]=N,e[31]=K,e[32]=T):T=e[32];let _;if(e[33]!==u||e[34]!==l||e[35]!==m){let R;e[37]!==l||e[38]!==m?(R=g(E=>(0,n.jsx)(xt,{colSpan:m?6:5,name:E,onEnter:l},E),"F"),e[37]=l,e[38]=m,e[39]=R):R=e[39],_=u.map(R),e[33]=u,e[34]=l,e[35]=m,e[36]=_}else _=e[36];let O;if(e[40]!==t||e[41]!==s||e[42]!==o||e[43]!==i||e[44]!==f||e[45]!==h||e[46]!==d||e[47]!==m||e[48]!==a){let R;e[50]!==t||e[51]!==s||e[52]!==i||e[53]!==f||e[54]!==h||e[55]!==d||e[56]!==m||e[57]!==a?(R=g(E=>(0,n.jsx)(vt,{busy:t,copiedKey:s,handlers:i,object:E,prefix:f,references:h[E.key],selected:d.has(E.key),showReferences:m,t:a},E.key),"F"),e[50]=t,e[51]=s,e[52]=i,e[53]=f,e[54]=h,e[55]=d,e[56]=m,e[57]=a,e[58]=R):R=e[58],O=o.map(R),e[40]=t,e[41]=s,e[42]=o,e[43]=i,e[44]=f,e[45]=h,e[46]=d,e[47]=m,e[48]=a,e[49]=O}else O=e[49];let U;e[59]!==_||e[60]!==O?(U=(0,n.jsxs)(Fe,{children:[_,O]}),e[59]=_,e[60]=O,e[61]=U):U=e[61];let L;return e[62]!==T||e[63]!==U?(L=(0,n.jsx)(je,{className:"overflow-hidden py-0",children:(0,n.jsx)(ze,{className:"px-0",children:(0,n.jsxs)($e,{"data-testid":"fb-table",children:[T,U]})})}),e[62]=T,e[63]=U,e[64]=L):L=e[64],L},"wt"),wt=[{label:"15m",seconds:900},{label:"1h",seconds:3600},{label:"24h",seconds:86400},{label:"7d",seconds:604800}],St=3600,Oe=g((c,e)=>{if(e==="size")return c.size;if(e==="type")return c.httpMetadata?.contentType??"";if(e==="date"){if(c.uploaded===void 0)return 0;let r=new Date(c.uploaded).getTime();return Number.isNaN(r)?0:r}return e.startsWith("tag:")?c.customMetadata?.[e.slice(4)]??"":c.key},"ke"),Ct=g((c,e,r)=>{let t=r==="desc"?-1:1;return c.toSorted((s,o)=>{let u=Oe(s,e),i=Oe(o,e);return(typeof u=="number"&&typeof i=="number"?u-i:String(u).localeCompare(String(i)))*t})},"Ct"),Nt=g((c,e)=>{let r=new Set,t=[];for(let s of c){let o=s.key.slice(e.length),u=o.indexOf("/");u===-1?t.push(s):r.add(o.slice(0,u+1))}return{files:t,folders:[...r].toSorted((s,o)=>s.localeCompare(o))}},"$t"),jt=g(c=>{let e=(0,M.c)(59),{bucket:r,buckets:t,busy:s,draftPrefix:o,expiry:u,fileInputRef:i,onBucketChange:l,onExpiryChange:f,onFileChange:h,onList:d,onPrefixChange:m,onUploadClick:w,t:a}=c,v;e[0]!==m?(v=g(P=>{m(P.target.value)},"x"),e[0]=m,e[1]=v):v=e[1];let x=v,b;e[2]!==l?(b=g(P=>{l(P.target.value)},"g"),e[2]=l,e[3]=b):b=e[3];let y=b,k;e[4]!==f?(k=g(P=>{f(Number.parseInt(P.target.value,10))},"k"),e[4]=f,e[5]=k):k=e[5];let S=k,j;e[6]!==r||e[7]!==t||e[8]!==y||e[9]!==a?(j=t.length>0&&(0,n.jsx)("select",{"aria-label":a("Bucket"),className:"h-8 rounded-md border border-border bg-background px-1 outline-none focus-visible:border-ring","data-testid":"fb-bucket",onChange:y,value:r,children:t.map(Kt)}),e[6]=r,e[7]=t,e[8]=y,e[9]=a,e[10]=j):j=e[10];let C;e[11]!==a?(C=a("Key prefix"),e[11]=a,e[12]=C):C=e[12];let N;e[13]!==a?(N=a("key prefix (optional)"),e[13]=a,e[14]=N):N=e[14];let K;e[15]!==o||e[16]!==x||e[17]!==C||e[18]!==N?(K=(0,n.jsx)(Ne,{"aria-label":C,className:"h-8 w-64 max-w-full","data-testid":"fb-prefix-input",onChange:x,placeholder:N,value:o}),e[15]=o,e[16]=x,e[17]=C,e[18]=N,e[19]=K):K=e[19];let $;e[20]!==a?($=a("List"),e[20]=a,e[21]=$):$=e[21];let F;e[22]!==s||e[23]!==d||e[24]!==$?(F=(0,n.jsx)(re,{"data-testid":"fb-list",disabled:s,onClick:d,size:"sm",type:"button",children:$}),e[22]=s,e[23]=d,e[24]=$,e[25]=F):F=e[25];let T;e[26]!==s||e[27]!==a?(T=a(s?"Uploading\u2026":"Upload"),e[26]=s,e[27]=a,e[28]=T):T=e[28];let _;e[29]!==s||e[30]!==w||e[31]!==T?(_=(0,n.jsx)(re,{"data-testid":"storage-upload",disabled:s,onClick:w,size:"sm",type:"button",variant:"outline",children:T}),e[29]=s,e[30]=w,e[31]=T,e[32]=_):_=e[32];let O;e[33]!==i||e[34]!==h?(O=(0,n.jsx)("input",{className:"hidden","data-testid":"storage-file-input",onChange:h,ref:i,type:"file"}),e[33]=i,e[34]=h,e[35]=O):O=e[35];let U;e[36]!==a?(U=a("Link expiry"),e[36]=a,e[37]=U):U=e[37];let L;e[38]!==a?(L=wt.map(P=>(0,n.jsx)("option",{value:P.seconds,children:a(P.label)},P.seconds)),e[38]=a,e[39]=L):L=e[39];let R;e[40]!==u||e[41]!==S||e[42]!==L?(R=(0,n.jsx)("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:S,value:u,children:L}),e[40]=u,e[41]=S,e[42]=L,e[43]=R):R=e[43];let E;e[44]!==U||e[45]!==R?(E=(0,n.jsxs)("label",{className:"ml-auto flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"storage-expiry",children:[U,R]}),e[44]=U,e[45]=R,e[46]=E):E=e[46];let B;e[47]!==a?(B=a("Open in Cloudflare"),e[47]=a,e[48]=B):B=e[48];let A;e[49]!==B?(A=(0,n.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"fb-cf-link",href:_e,rel:"noreferrer",target:"_blank",children:B}),e[49]=B,e[50]=A):A=e[50];let G;return e[51]!==_||e[52]!==O||e[53]!==E||e[54]!==A||e[55]!==j||e[56]!==K||e[57]!==F?(G=(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[j,K,F,_,O,E,A]}),e[51]=_,e[52]=O,e[53]=E,e[54]=A,e[55]=j,e[56]=K,e[57]=F,e[58]=G):G=e[58],G},"jt"),zt=g(c=>{let e=(0,M.c)(66),{onSortKeyChange:r,onThumbSizeChange:t,showGrid:s,showList:o,sortDirection:u,sortKey:i,t:l,tagKeys:f,thumbSize:h,toggleSortDirection:d,view:m}=c,w;e[0]!==r?(w=g(q=>{r(q.target.value)},"v"),e[0]=r,e[1]=w):w=e[1];let a=w,v;e[2]!==t?(v=g(q=>{t(Number.parseInt(q.target.value,10))},"x"),e[2]=t,e[3]=v):v=e[3];let x=v,b=m==="list",y;e[4]!==l?(y=l("List"),e[4]=l,e[5]=y):y=e[5];let k;e[6]!==o||e[7]!==b||e[8]!==y?(k=(0,n.jsx)("button",{"aria-pressed":b,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:y}),e[6]=o,e[7]=b,e[8]=y,e[9]=k):k=e[9];let S=m==="grid",j;e[10]!==l?(j=l("Grid"),e[10]=l,e[11]=j):j=e[11];let C;e[12]!==s||e[13]!==S||e[14]!==j?(C=(0,n.jsx)("button",{"aria-pressed":S,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:s,type:"button",children:j}),e[12]=s,e[13]=S,e[14]=j,e[15]=C):C=e[15];let N;e[16]!==k||e[17]!==C?(N=(0,n.jsxs)("div",{className:"inline-flex overflow-hidden rounded-md border border-border",children:[k,C]}),e[16]=k,e[17]=C,e[18]=N):N=e[18];let K;e[19]!==l?(K=l("Sort"),e[19]=l,e[20]=K):K=e[20];let $;e[21]!==l?($=l("Name"),e[21]=l,e[22]=$):$=e[22];let F;e[23]!==$?(F=(0,n.jsx)("option",{value:"name",children:$}),e[23]=$,e[24]=F):F=e[24];let T;e[25]!==l?(T=l("size"),e[25]=l,e[26]=T):T=e[26];let _;e[27]!==T?(_=(0,n.jsx)("option",{value:"size",children:T}),e[27]=T,e[28]=_):_=e[28];let O;e[29]!==l?(O=l("Type"),e[29]=l,e[30]=O):O=e[30];let U;e[31]!==O?(U=(0,n.jsx)("option",{value:"type",children:O}),e[31]=O,e[32]=U):U=e[32];let L;e[33]!==l?(L=l("Modified"),e[33]=l,e[34]=L):L=e[34];let R;e[35]!==L?(R=(0,n.jsx)("option",{value:"date",children:L}),e[35]=L,e[36]=R):R=e[36];let E;e[37]!==f?(E=f.map(Dt),e[37]=f,e[38]=E):E=e[38];let B;e[39]!==a||e[40]!==i||e[41]!==F||e[42]!==_||e[43]!==U||e[44]!==R||e[45]!==E?(B=(0,n.jsxs)("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:a,value:i,children:[F,_,U,R,E]}),e[39]=a,e[40]=i,e[41]=F,e[42]=_,e[43]=U,e[44]=R,e[45]=E,e[46]=B):B=e[46];let A;e[47]!==K||e[48]!==B?(A=(0,n.jsxs)("label",{className:"flex items-center gap-1.5 text-muted-foreground",htmlFor:"fb-sort",children:[K,B]}),e[47]=K,e[48]=B,e[49]=A):A=e[49];let G;e[50]!==l?(G=l("Toggle sort direction"),e[50]=l,e[51]=G):G=e[51];let P=u==="asc"?"\u2191":"\u2193",H;e[52]!==G||e[53]!==P||e[54]!==d?(H=(0,n.jsx)("button",{"aria-label":G,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:d,type:"button",children:P}),e[52]=G,e[53]=P,e[54]=d,e[55]=H):H=e[55];let Q;e[56]!==x||e[57]!==l||e[58]!==h||e[59]!==m?(Q=m==="grid"&&(0,n.jsxs)("label",{className:"ml-auto flex items-center gap-1.5 text-muted-foreground",htmlFor:"fb-thumb-size",children:[l("Thumbnail size"),(0,n.jsx)("input",{className:"accent-primary","data-testid":"fb-thumb-size",id:"fb-thumb-size",max:240,min:80,onChange:x,step:8,type:"range",value:h})]}),e[56]=x,e[57]=l,e[58]=h,e[59]=m,e[60]=Q):Q=e[60];let oe;return e[61]!==A||e[62]!==H||e[63]!==Q||e[64]!==N?(oe=(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs","data-testid":"fb-controls",children:[N,A,H,Q]}),e[61]=A,e[62]=H,e[63]=Q,e[64]=N,e[65]=oe):oe=e[65],oe},"zt");function Kt(c){return(0,n.jsx)("option",{value:c,children:c},c)}g(Kt,"Kt");function Dt(c){return(0,n.jsx)("option",{value:`tag:${c}`,children:c},c)}g(Dt,"Dt");var $t=/\.(?:avif|bmp|gif|ico|jpe?g|png|svg|webp)$/iu,Tt=g(c=>(c.httpMetadata?.contentType??"").startsWith("image/")||$t.test(c.key),"Ft"),Ft=g(()=>{let c=(0,M.c)(1),e;return c[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,n.jsx)("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,n.jsx)("path",{d:"M7 3h7l5 5v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1Zm7 0v5h5"})}),c[0]=e):e=c[0],e},"Rt"),Rt=g(c=>{let e=(0,M.c)(13),{object:r,resolveUrl:t}=c,[s,o]=(0,z.useState)(null),[u,i]=(0,z.useState)(!1),l;e[0]!==r?(l=Tt(r),e[0]=r,e[1]=l):l=e[1];let f=l,h,d;e[2]!==f||e[3]!==r.key||e[4]!==t?(h=g(()=>{if(!f)return;let v={cancelled:!1};return W((async()=>{try{let x=await t(r.key);v.cancelled||o(x)}catch{v.cancelled||i(!0)}})()),()=>{v.cancelled=!0}},"h"),d=[f,r.key,t],e[2]=f,e[3]=r.key,e[4]=t,e[5]=h,e[6]=d):(h=e[5],d=e[6]),(0,z.useEffect)(h,d);let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=g(()=>{i(!0)},"m"),e[7]=m):m=e[7];let w=m,a;return e[8]!==u||e[9]!==f||e[10]!==r.key||e[11]!==s?(a=(0,n.jsx)("div",{className:"flex aspect-square w-full items-center justify-center overflow-hidden rounded-md border border-border bg-muted/30",children:f&&s!==null&&!u?(0,n.jsx)("img",{alt:r.key,className:"size-full object-cover",loading:"lazy",onError:w,src:s}):(0,n.jsx)(Ft,{})}),e[8]=u,e[9]=f,e[10]=r.key,e[11]=s,e[12]=a):a=e[12],a},"Lt"),Ut=g(c=>{let e=(0,M.c)(38),{busy:r,copiedKey:t,handlers:s,object:o,prefix:u,references:i,resolveUrl:l,selected:f,showReferences:h,t:d}=c,{copy:m,download:w,name:a,remove:v,toggle:x}=Me(o,u,s),b;e[0]!==o||e[1]!==l?(b=(0,n.jsx)(Rt,{object:o,resolveUrl:l}),e[0]=o,e[1]=l,e[2]=b):b=e[2];let y;e[3]!==o.key||e[4]!==f||e[5]!==d||e[6]!==x?(y=(0,n.jsx)("span",{className:"absolute left-1.5 top-1.5 rounded bg-background/80 p-0.5",children:(0,n.jsx)(Pe,{objectKey:o.key,onToggle:x,selected:f,t:d})}),e[3]=o.key,e[4]=f,e[5]=d,e[6]=x,e[7]=y):y=e[7];let k;e[8]!==b||e[9]!==y?(k=(0,n.jsxs)("div",{className:"relative",children:[b,y]}),e[8]=b,e[9]=y,e[10]=k):k=e[10];let S;e[11]!==a?(S=(0,n.jsx)("p",{className:"truncate font-mono text-xs",title:a,children:a}),e[11]=a,e[12]=S):S=e[12];let j;e[13]!==o.size?(j=pe(o.size),e[13]=o.size,e[14]=j):j=e[14];let C;e[15]!==j?(C=(0,n.jsx)("p",{className:"text-[11px] tabular-nums text-muted-foreground",children:j}),e[15]=j,e[16]=C):C=e[16];let N;e[17]!==o.key||e[18]!==i||e[19]!==h||e[20]!==d?(N=h&&(0,n.jsx)("div",{className:"mt-1",children:(0,n.jsx)(Ae,{objectKey:o.key,references:i,t:d})}),e[17]=o.key,e[18]=i,e[19]=h,e[20]=d,e[21]=N):N=e[21];let K;e[22]!==S||e[23]!==C||e[24]!==N?(K=(0,n.jsxs)("div",{className:"min-w-0",children:[S,C,N]}),e[22]=S,e[23]=C,e[24]=N,e[25]=K):K=e[25];let $=t===o.key,F;e[26]!==r||e[27]!==m||e[28]!==w||e[29]!==o.key||e[30]!==v||e[31]!==d||e[32]!==$?(F=(0,n.jsx)("div",{className:"flex items-center gap-1",children:(0,n.jsx)(Be,{busy:r,buttonClassName:"h-7 px-2 text-xs",copied:$,objectKey:o.key,onCopy:m,onDelete:v,onDownload:w,t:d})}),e[26]=r,e[27]=m,e[28]=w,e[29]=o.key,e[30]=v,e[31]=d,e[32]=$,e[33]=F):F=e[33];let T;return e[34]!==F||e[35]!==k||e[36]!==K?(T=(0,n.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"fb-tile",children:[k,K,F]}),e[34]=F,e[35]=k,e[36]=K,e[37]=T):T=e[37],T},"Ot"),Et=g(c=>{let e=(0,M.c)(9),{name:r,onEnter:t}=c,s;e[0]!==r||e[1]!==t?(s=g(()=>{t(r)},"o"),e[0]=r,e[1]=t,e[2]=s):s=e[2];let o=s,u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=(0,n.jsx)("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,n.jsx)("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,n.jsx)("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"})})}),e[3]=u):u=e[3];let i;e[4]!==r?(i=(0,n.jsx)("span",{className:"truncate font-mono text-xs",title:r,children:r}),e[4]=r,e[5]=i):i=e[5];let l;return e[6]!==o||e[7]!==i?(l=(0,n.jsxs)("button",{className:"flex flex-col gap-1.5 text-left outline-none","data-testid":"fb-folder",onClick:o,type:"button",children:[u,i]}),e[6]=o,e[7]=i,e[8]=l):l=e[8],l},"Et"),_t=g(c=>{let e=(0,M.c)(34),{busy:r,copiedKey:t,files:s,folders:o,handlers:u,onEnterFolder:i,prefix:l,references:f,resolveUrl:h,selected:d,showReferences:m,size:w,t:a}=c,v;e[0]!==w?(v=w.toString(),e[0]=w,e[1]=v):v=e[1];let x=`repeat(auto-fill, minmax(${v}px, 1fr))`,b;e[2]!==x?(b={gridTemplateColumns:x},e[2]=x,e[3]=b):b=e[3];let y=b,k;if(e[4]!==o||e[5]!==i){let C;e[7]!==i?(C=g(N=>(0,n.jsx)(Et,{name:N,onEnter:i},N),"S"),e[7]=i,e[8]=C):C=e[8],k=o.map(C),e[4]=o,e[5]=i,e[6]=k}else k=e[6];let S;if(e[9]!==r||e[10]!==t||e[11]!==s||e[12]!==u||e[13]!==l||e[14]!==f||e[15]!==h||e[16]!==d||e[17]!==m||e[18]!==a){let C;e[20]!==r||e[21]!==t||e[22]!==u||e[23]!==l||e[24]!==f||e[25]!==h||e[26]!==d||e[27]!==m||e[28]!==a?(C=g(N=>(0,n.jsx)(Ut,{busy:r,copiedKey:t,handlers:u,object:N,prefix:l,references:f[N.key],resolveUrl:h,selected:d.has(N.key),showReferences:m,t:a},N.key),"S"),e[20]=r,e[21]=t,e[22]=u,e[23]=l,e[24]=f,e[25]=h,e[26]=d,e[27]=m,e[28]=a,e[29]=C):C=e[29],S=s.map(C),e[9]=r,e[10]=t,e[11]=s,e[12]=u,e[13]=l,e[14]=f,e[15]=h,e[16]=d,e[17]=m,e[18]=a,e[19]=S}else S=e[19];let j;return e[30]!==y||e[31]!==k||e[32]!==S?(j=(0,n.jsxs)("div",{className:"grid gap-4","data-testid":"fb-gallery",style:y,children:[k,S]}),e[30]=y,e[31]=k,e[32]=S,e[33]=j):j=e[33],j},"Ut"),Ot=g(c=>{let e=(0,M.c)(23),{reference:r,t}=c,s=`fb-dangling-${r.table}-${r.id}-${r.column}`,o=`${r.table}\xB7${r.id}`,u;e[0]!==o?(u=(0,n.jsx)(ae,{variant:"secondary",children:o}),e[0]=o,e[1]=u):u=e[1];let i;e[2]!==r.column?(i=(0,n.jsx)("span",{className:"text-muted-foreground",children:r.column}),e[2]=r.column,e[3]=i):i=e[3];let l;e[4]!==t?(l=t("\u2192"),e[4]=t,e[5]=l):l=e[5];let f;e[6]!==l?(f=(0,n.jsx)("span",{className:"text-muted-foreground/60",children:l}),e[6]=l,e[7]=f):f=e[7];let h;e[8]!==r.key?(h=(0,n.jsx)("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-foreground",children:r.key}),e[8]=r.key,e[9]=h):h=e[9];let d;e[10]!==u||e[11]!==i||e[12]!==f||e[13]!==h?(d=(0,n.jsxs)("span",{className:"flex flex-wrap items-center gap-1.5",children:[u,i,f,h]}),e[10]=u,e[11]=i,e[12]=f,e[13]=h,e[14]=d):d=e[14];let m;e[15]!==t?(m=t("Missing object"),e[15]=t,e[16]=m):m=e[16];let w;e[17]!==m?(w=(0,n.jsx)(ae,{className:"border-destructive/40 text-destructive",variant:"outline",children:m}),e[17]=m,e[18]=w):w=e[18];let a;return e[19]!==s||e[20]!==w||e[21]!==d?(a=(0,n.jsxs)("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":s,children:[d,w]}),e[19]=s,e[20]=w,e[21]=d,e[22]=a):a=e[22],a},"_t"),It=g(c=>{let e=(0,M.c)(37),{busy:r,onCheck:t,references:s,t:o,truncated:u}=c,i;e[0]!==o?(i=o("Integrity"),e[0]=o,e[1]=i):i=e[1];let l;e[2]!==i?(l=(0,n.jsx)("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:i}),e[2]=i,e[3]=l):l=e[3];let f;e[4]!==o?(f=o("Orphaned objects"),e[4]=o,e[5]=f):f=e[5];let h;e[6]!==f?(h=(0,n.jsx)("span",{className:"text-sm font-medium text-foreground",children:f}),e[6]=f,e[7]=h):h=e[7];let d;e[8]!==o?(d=o("Find records whose file reference points at an object the bucket no longer has."),e[8]=o,e[9]=d):d=e[9];let m;e[10]!==d?(m=(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:d}),e[10]=d,e[11]=m):m=e[11];let w;e[12]!==l||e[13]!==h||e[14]!==m?(w=(0,n.jsxs)("div",{className:"flex flex-col gap-1",children:[l,h,m]}),e[12]=l,e[13]=h,e[14]=m,e[15]=w):w=e[15];let a;e[16]!==r||e[17]!==o?(a=o(r?"Checking\u2026":"Check for orphans"),e[16]=r,e[17]=o,e[18]=a):a=e[18];let v;e[19]!==r||e[20]!==t||e[21]!==a?(v=(0,n.jsx)(re,{"data-testid":"fb-orphans-check",disabled:r,onClick:t,size:"sm",type:"button",variant:"outline",children:a}),e[19]=r,e[20]=t,e[21]=a,e[22]=v):v=e[22];let x;e[23]!==w||e[24]!==v?(x=(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[w,v]}),e[23]=w,e[24]=v,e[25]=x):x=e[25];let b;e[26]!==s?.length||e[27]!==o?(b=s?.length===0&&(0,n.jsx)(he,{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.")}),e[26]=s?.length,e[27]=o,e[28]=b):b=e[28];let y;e[29]!==s||e[30]!==o||e[31]!==u?(y=s!==void 0&&s.length>0&&(0,n.jsxs)(n.Fragment,{children:[u&&(0,n.jsx)("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:s.length})}),(0,n.jsx)("ul",{className:"flex flex-col gap-1.5","data-testid":"fb-orphans-list",children:s.map(S=>(0,n.jsx)(Ot,{reference:S,t:o},`${S.table}\xB7${S.id}\xB7${S.column}`))})]}),e[29]=s,e[30]=o,e[31]=u,e[32]=y):y=e[32];let k;return e[33]!==x||e[34]!==b||e[35]!==y?(k=(0,n.jsxs)("section",{className:"flex flex-col gap-2 rounded-lg border border-border/60 p-3","data-testid":"fb-orphans",children:[x,b,y]}),e[33]=x,e[34]=b,e[35]=y,e[36]=k):k=e[36],k},"It"),Lt=g(function(c,e){let r=(0,M.c)(18),t;r[0]===Symbol.for("react.memo_cache_sentinel")?(t=new Set,r[0]=t):t=r[0];let[s,o]=(0,z.useState)(t),u;r[1]===Symbol.for("react.memo_cache_sentinel")?(u=g(b=>{o(y=>{let k=new Set(y);return k.has(b)?k.delete(b):k.add(b),k})},"u"),r[1]=u):u=r[1];let i=u,l;r[2]===Symbol.for("react.memo_cache_sentinel")?(l=g(()=>{o(new Set)},"l"),r[2]=l):l=r[2];let f=l,h,d,m;if(r[3]!==c||r[4]!==e||r[5]!==s){let b;r[9]!==e?(b=g(y=>e(y),"g"),r[9]=e,r[10]=b):b=r[10],d=c.map(b),h=d.length>0&&d.every(y=>s.has(y)),m=!h&&d.some(y=>s.has(y)),r[3]=c,r[4]=e,r[5]=s,r[6]=h,r[7]=d,r[8]=m}else h=r[6],d=r[7],m=r[8];let w=m,a;r[11]!==d?(a=g(()=>{o(b=>d.every(y=>b.has(y))?new Set:new Set(d))},"s"),r[11]=d,r[12]=a):a=r[12];let v=a,x;return r[13]!==h||r[14]!==s||r[15]!==w||r[16]!==v?(x={allSelected:h,clear:f,selected:s,someSelected:w,toggle:i,toggleAll:v},r[13]=h,r[14]=s,r[15]=w,r[16]=v,r[17]=x):x=r[17],x},"Mt"),Mt=me(be.storageReferences),Bt=me(be.storageOrphans),Ie=1e4,At=1e3,Pt=3600,Wt=g((c,e)=>{if(!("document"in globalThis))return;let r=globalThis.document.createElement("a");r.href=c,r.download=e,r.rel="noopener",globalThis.document.body.append(r),r.click(),r.remove()},"Gt"),Gt=g(({initialPrefix:c,pageSize:e})=>{let r=Se(),[t,s]=(0,z.useState)(c??""),[o,u]=(0,z.useState)(c??""),[i,l]=(0,z.useState)(St),[f,h]=(0,z.useState)("list"),[d,m]=(0,z.useState)(128),[w,a]=(0,z.useState)("name"),[v,x]=(0,z.useState)("asc"),[b,y]=(0,z.useState)(void 0),[k,S]=(0,z.useState)(void 0),[j,C]=(0,z.useState)(!1),[N,K]=(0,z.useState)(void 0),[$,F]=(0,z.useState)(void 0),[T,_]=(0,z.useState)(""),[O,U]=(0,z.useState)({}),[L,R]=(0,z.useState)(!1),[E,B]=(0,z.useState)(void 0),[A,G]=(0,z.useState)(!1),[P,H]=(0,z.useState)(!1),[Q,oe]=(0,z.useState)([]),[q,xe]=(0,z.useState)(""),le=(0,z.useRef)(0),X=(0,z.useRef)(0);(0,z.useEffect)(()=>{let p={cancelled:!1};return W((async()=>{try{let D=await r.listStorageBuckets();if(!p.cancelled){oe(D);let[I]=D;I!==void 0&&xe(Z=>Z===""?I:Z)}}catch{}})()),()=>{p.cancelled=!0}},[r]);let V=(0,z.useMemo)(()=>({list:g(p=>r.listStorageObjects({...p,bucket:q}),"list"),remove:g(p=>r.deleteStorageObject(p,{bucket:q}),"remove"),signedUrl:g((p,D)=>r.signedStorageUrl(p,{...D,bucket:q}),"signedUrl"),upload:g(p=>r.uploadStorageObject({...p,bucket:q}),"upload")}),[q,r]),J=(0,z.useCallback)(async(p,D,I)=>{le.current+=1;let Z=le.current;S(void 0),C(!0);try{let te=await V.list({cursor:D,limit:e,prefix:p});if(Z!==le.current)return;y(we=>I&&we!==void 0?[...we,...te.objects]:te.objects),F(te.cursor)}catch(te){if(Z!==le.current)return;I||y(void 0),S(Y(te))}finally{Z===le.current&&C(!1)}},[e,V]);(0,z.useEffect)(()=>{W(J(c??"",void 0,!1))},[J,c]);let We=(b?.length??0)<=e;Ue(()=>{W(J(t,void 0,!1))},We);let{files:de,folders:Ge}=Nt(b??[],t),He=(0,z.useMemo)(()=>{let p=new Set;for(let D of de)for(let I of Object.keys(D.customMetadata??{}))p.add(I);return[...p].toSorted((D,I)=>D.localeCompare(I))},[de]),ie=Ct(de,w,v),ue=(0,z.useMemo)(()=>[...new Set(ie.map(p=>p.key))].toSorted((p,D)=>p.localeCompare(D)).join(`
3
3
  `),[ie]);(0,z.useEffect)(()=>{let p=ue===""?[]:ue.split(`
4
4
  `);if(p.length===0){U({});return}let D={current:!0};return W((async()=>{try{let I=await r.query(Mt,{keys:p},ge(T));D.current&&(U(I.references??{}),R(Object.keys(I.storageColumns??{}).length>0))}catch{D.current&&(U({}),R(!1))}})()),()=>{D.current=!1}},[r,ue,T]);let Ze=g(p=>p.key,"Ee"),{allSelected:qe,clear:se,selected:ve,someSelected:Ve,toggle:Je,toggleAll:Qe}=Lt(ie,Ze),Xe=g(()=>{s(o),se(),W(J(o,void 0,!1))},"Be"),Ye=g(()=>{W(J(t,$,!0))},"Ae"),ke=g(p=>{s(p),u(p),se(),W(J(p,void 0,!1))},"be"),et=g(p=>{ke(`${t}${p}`)},"Pe"),tt=g(p=>V.signedUrl(p,{expiresInSeconds:Pt}),"We"),rt=g(()=>{h("list")},"Ge"),nt=g(()=>{h("grid")},"He"),ot=g(p=>{a(p)},"Ze"),lt=g(()=>{x(p=>p==="asc"?"desc":"asc")},"qe"),st=g(p=>{m(p)},"Ve"),at=g(p=>{l(p)},"Xe"),it=g(()=>{S(void 0),C(!0),W((async()=>{try{for(let p of ve)await V.remove(p);await J(t,void 0,!1),se()}catch(p){S(Y(p))}finally{C(!1)}})())},"Qe"),ct=g(p=>{S(void 0),W((async()=>{try{let D=await V.signedUrl(p,{expiresInSeconds:i});Ke(D)&&K(p)}catch(D){S(Y(D))}})())},"Ye"),dt=g(p=>{S(void 0),W((async()=>{try{let D=await V.signedUrl(p,{expiresInSeconds:i}),I=p.slice(p.lastIndexOf("/")+1)||p;Wt(D,I)}catch(D){S(Y(D))}})())},"Je");(0,z.useEffect)(()=>{if(N===void 0)return;let p=globalThis.setTimeout(()=>{K(void 0)},2e3);return()=>{globalThis.clearTimeout(p)}},[N]);let ut=g(p=>{S(void 0),C(!0),W((async()=>{try{await V.remove(p),await J(t,void 0,!1)}catch(D){S(Y(D))}finally{C(!1)}})())},"et"),ft=g(p=>{let D=`${t}${p.name}`;S(void 0),C(!0),W((async()=>{try{let I=await p.arrayBuffer();await V.upload({body:I,contentType:p.type===""?void 0:p.type,key:D}),await J(t,void 0,!1)}catch(I){S(Y(I))}finally{C(!1)}})())},"tt");(0,z.useEffect)(()=>{X.current+=1,B(void 0),H(!1)},[T]);let ht=g(()=>{X.current+=1;let p=X.current;S(void 0),G(!0),W((async()=>{try{let D=[],I;do{let Z=await V.list({cursor:I,limit:At});for(let te of Z.objects)D.push(te.key);I=D.length>=Ie?void 0:Z.cursor}while(I!==void 0);if(D.length>=Ie)p===X.current&&(B([]),H(!0));else{let Z=await r.query(Bt,{liveKeys:D},ge(T));p===X.current&&(B(Z.references??[]),H(Z.truncated===!0))}}catch(D){p===X.current&&(B([]),H(!1),S(Y(D)))}finally{p===X.current&&G(!1)}})())},"rt"),mt=g(p=>{le.current+=1,X.current+=1,xe(p),s(c??""),u(c??""),y(void 0),B(void 0),H(!1),se()},"nt");return{allSelected:qe,bucket:q,buckets:Q,bulkDelete:it,busy:j,checkOrphans:ht,clearSelection:se,copiedKey:N,danglingBusy:A,danglingReferences:E,danglingTruncated:P,draftPrefix:o,enterFolder:et,error:k,expiry:i,files:ie,folders:Ge,hasObjects:b!==void 0&&b.length>0,hasStorageColumns:L,listFirst:Xe,loaded:b!==void 0,loadMore:Ye,navigate:ke,nextCursor:$,onCopy:ct,onDelete:ut,onDownload:dt,onExpiryChange:at,onFile:ft,onSortKeyChange:ot,onThumbSizeChange:st,prefix:t,referenceShard:T,references:O,resolveUrl:tt,selectBucket:mt,selected:ve,setDraftPrefix:u,setReferenceShard:_,showGrid:nt,showList:rt,someSelected:Ve,sortDirection:v,sortKey:w,tagKeys:He,thumbSize:d,toggleSelect:Je,toggleSelectAll:Qe,toggleSortDirection:lt,view:f}},"Ht"),Ht=100,Le=g(c=>{let e=(0,M.c)(6),{label:r,onNavigate:t,target:s}=c,o;e[0]!==t||e[1]!==s?(o=g(()=>{t(s)},"n"),e[0]=t,e[1]=s,e[2]=o):o=e[2];let u=o,i;return e[3]!==u||e[4]!==r?(i=(0,n.jsx)("button",{className:"rounded px-1 text-muted-foreground outline-none hover:text-foreground focus-visible:text-foreground",onClick:u,type:"button",children:r}),e[3]=u,e[4]=r,e[5]=i):i=e[5],i},"we"),Zt=g(c=>{let e=(0,M.c)(11),{onNavigate:r,prefix:t,t:s}=c,o;if(e[0]!==r||e[1]!==t||e[2]!==s){let u=t.split("/").filter(qt),i;e[4]!==s?(i=s("Folder path"),e[4]=s,e[5]=i):i=e[5];let l;e[6]!==s?(l=s("root"),e[6]=s,e[7]=l):l=e[7];let f;e[8]!==r||e[9]!==l?(f=(0,n.jsx)(Le,{label:l,onNavigate:r,target:""}),e[8]=r,e[9]=l,e[10]=f):f=e[10],o=(0,n.jsxs)("nav",{"aria-label":i,className:"flex flex-wrap items-center gap-0.5 text-xs","data-testid":"fb-breadcrumbs",children:[f,u.map((h,d)=>(0,n.jsxs)("span",{className:"flex items-center gap-0.5",children:[(0,n.jsx)("span",{className:"text-muted-foreground/50",children:"/"}),(0,n.jsx)(Le,{label:h,onNavigate:r,target:`${u.slice(0,d+1).join("/")}/`})]},`${h}-${d.toString()}`))]}),e[0]=r,e[1]=t,e[2]=s,e[3]=o}else o=e[3];return o},"qt"),ur=g(({initialPrefix:c,pageSize:e=Ht})=>{let r=Ce(),t=Gt({initialPrefix:c,pageSize:e}),s=(0,z.useRef)(null),{onCopy:o,onDelete:u,onDownload:i,onFile:l,toggleSelect:f}=t,h={onCopy:o,onDelete:u,onDownload:i,onToggleSelect:f},d=g(()=>{s.current?.click()},"d"),m=g(a=>{let v=a.target,x=v.files?.[0];v.value="",x&&l(x)},"m"),w=t.loaded&&!t.hasObjects;return(0,n.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-file-browser",children:[(0,n.jsx)(jt,{bucket:t.bucket,buckets:t.buckets,busy:t.busy,draftPrefix:t.draftPrefix,expiry:t.expiry,fileInputRef:s,onBucketChange:t.selectBucket,onExpiryChange:t.onExpiryChange,onFileChange:m,onList:t.listFirst,onPrefixChange:t.setDraftPrefix,onUploadClick:d,t:r}),t.loaded&&(0,n.jsx)(Zt,{onNavigate:t.navigate,prefix:t.prefix,t:r}),t.hasObjects&&(0,n.jsx)(zt,{onSortKeyChange:t.onSortKeyChange,onThumbSizeChange:t.onThumbSizeChange,showGrid:t.showGrid,showList:t.showList,sortDirection:t.sortDirection,sortKey:t.sortKey,t:r,tagKeys:t.tagKeys,thumbSize:t.thumbSize,toggleSortDirection:t.toggleSortDirection,view:t.view}),t.hasStorageColumns&&(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2","data-testid":"fb-references-shard",children:[(0,n.jsx)("label",{className:"text-xs text-muted-foreground",htmlFor:"fb-reference-shard-input",children:r("References shard")}),(0,n.jsx)(De,{id:"fb-reference-shard-input",onChange:t.setReferenceShard,testId:"fb-reference-shard-input",value:t.referenceShard}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:r("Which shard's records are checked for references to these files. Empty = root shard.")})]}),t.hasStorageColumns&&(0,n.jsx)(It,{busy:t.danglingBusy,onCheck:t.checkOrphans,references:t.danglingReferences,t:r,truncated:t.danglingTruncated}),t.selected.size>0&&(0,n.jsx)(Ee,{count:t.selected.size,editable:!0,onClear:t.clearSelection,onDelete:t.bulkDelete}),t.error!==void 0&&(0,n.jsx)("p",{className:"text-sm text-destructive","data-testid":"storage-error",role:"alert",children:t.error}),w&&(0,n.jsx)(he,{description:r("Objects you upload to your R2 buckets will appear here."),icon:(0,n.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,n.jsx)("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"}),(0,n.jsx)("path",{d:"M12 11v5m-2.5-2.5h5"})]}),testId:"fb-empty",title:r("No objects.")}),t.hasObjects&&t.view==="list"&&(0,n.jsx)(kt,{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:r,toggleSelectAll:t.toggleSelectAll}),t.hasObjects&&t.view==="grid"&&(0,n.jsx)(_t,{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:r}),t.nextCursor!==void 0&&(0,n.jsx)("div",{children:(0,n.jsx)(re,{"data-testid":"fb-next",disabled:t.busy,onClick:t.loadMore,size:"sm",type:"button",variant:"outline",children:r("Load more")})})]})},"pr");function qt(c){return c!==""}g(qt,"Vt");export{ur as FileBrowser};
@@ -1,4 +1,4 @@
1
- import{a as t}from"./chunk-UHHTEBC3.js";var s={BAD_REQUEST:{status:400,title:"Bad request"},UNAUTHORIZED:{status:401,title:"Unauthorized"},FORBIDDEN:{status:403,title:"Forbidden"},NOT_FOUND:{status:404,title:"Not found"},CONFLICT:{hint:["Another write changed this row while your mutation was running (optimistic concurrency conflict).","","Re-read the row and retry the mutation with the fresh value. Lunora serializes a DO's mutations, so a persistent conflict usually means the handler conflicts **with itself** (e.g. a trigger or cascade touching the same row) \u2014 split that work rather than adding a retry loop."],status:409,title:"Conflict"},NOT_UNIQUE:{hint:["`.unique()` matched more than one document \u2014 it expects the query to identify at most one row.","","- If several matches are legitimate, use `.first()` (take one) or `.collect()` (take all) instead.","- Otherwise tighten the query (e.g. filter on a unique/indexed field) so it can only match one row."],status:400,title:"Query matched more than one document"},VALIDATION_ERROR:{status:400,title:"Validation failed"},TOO_MANY_REQUESTS:{status:429,title:"Too many requests"},UNPROCESSABLE:{status:422,title:"Unprocessable"},NOT_IMPLEMENTED:{status:501,title:"Not implemented"},FUNCTION_NOT_FOUND:{status:404,title:"Function not found"},METHOD_NOT_ALLOWED:{status:405,title:"Method not allowed"},PAYLOAD_TOO_LARGE:{status:413,title:"Payload too large"},INTERNAL:{internal:!0,status:500,title:"Internal error"},INTERNAL_SERVER_ERROR:{internal:!0,status:500,title:"Internal error"},RPC_FAILED:{internal:!0,status:500,title:"Internal error"},COUNT_RLS_UNSUPPORTED:{status:422,title:"count() is unsupported under an RLS policy"},MASK_UNSUPPORTED:{status:422,title:"Aggregation over a masked column is unsupported"},RELATION_PREDICATE_UNSUPPORTED:{status:422,title:"Relation predicate is unsupported in a write policy"},RLS_REQUIRED:{hint:["This table is secure-by-default: it has no `.public()` marker and no RLS policy resolved for the caller, so the read fails closed.","","Add a read policy with `.rls(...)`, or mark the table `.public()` if it is intentionally world-readable."],status:403,title:"RLS policy required"},RUN_DEPTH_EXCEEDED:{internal:!0,status:500,title:"Run depth exceeded"},MIGRATION_NOT_FOUND:{status:404,title:"Data migration not found"},UNKNOWN_TABLE:{status:404,title:"Unknown table"},GLOBAL_TABLE_NOT_EDITABLE:{status:400,title:"Global table is not editable"},SHARD_ERROR:{status:503,title:"Shard error"},SHARD_UNAVAILABLE:{status:503,title:"Shard unavailable"},OFFLINE_IDENTITY_CHANGED:{status:409,title:"Offline identity changed"},CODEGEN_DIAGNOSTIC:{status:500,title:"Codegen diagnostic"},SCHEMA_SNAPSHOT_PARSE:{status:500,title:"Schema snapshot parse error"},ENV_INVALID:{internal:!0,status:500,title:"Invalid environment"},AUTH_HEADERS_MISSING:{internal:!0,status:500,title:"Auth headers missing"},EMAIL_DOMAIN_BLOCKED:{hint:["This address's domain is on the disposable/throwaway blocklist (or your configured deny-list).","","Sign up with a permanent mailbox. To tune the policy, pass `blockDisposable` / `allowDomains` / `denyDomains` to `emailGate(...)` (`@lunora/auth/email-guard`)."],status:400,title:"Email domain not allowed"},EMAIL_UNDELIVERABLE:{hint:["The address's domain publishes no MX (or fallback A/AAAA) records, so it can't receive mail.","","Check for a typo in the domain. MX verification is opt-in (`mx: true`) and needs DNS \u2014 leave it off on the edge path if DNS is unavailable."],status:400,title:"Email domain cannot receive mail"},ANALYTICS_SQL_ERROR:{status:502,title:"Analytics Engine SQL API error"},R2_SQL_ERROR:{status:502,title:"R2 SQL API error"},WORKFLOWS_REST_ERROR:{status:502,title:"Cloudflare Workflows REST API error"}},r=t(e=>Object.hasOwn(s,e)?s[e]:void 0,"n");var d=[{body:["Lunora codegen couldn't find a schema to generate from.","","Create `lunora/schema.ts` exporting a `defineSchema(...)` call:","","```ts",'import { defineSchema, defineTable, v } from "@lunora/server";',"","export default defineSchema({"," messages: defineTable({ body: v.string() }),","});","```","","Or run `lunora init` to scaffold Lunora (a sample `lunora/schema.ts` included) into your app."].join(`
1
+ import{a as t}from"./chunk-3XIESWL4.js";var s={BAD_REQUEST:{status:400,title:"Bad request"},UNAUTHORIZED:{status:401,title:"Unauthorized"},FORBIDDEN:{status:403,title:"Forbidden"},NOT_FOUND:{status:404,title:"Not found"},CONFLICT:{hint:["Another write changed this row while your mutation was running (optimistic concurrency conflict).","","Re-read the row and retry the mutation with the fresh value. Lunora serializes a DO's mutations, so a persistent conflict usually means the handler conflicts **with itself** (e.g. a trigger or cascade touching the same row) \u2014 split that work rather than adding a retry loop."],status:409,title:"Conflict"},NOT_UNIQUE:{hint:["`.unique()` matched more than one document \u2014 it expects the query to identify at most one row.","","- If several matches are legitimate, use `.first()` (take one) or `.collect()` (take all) instead.","- Otherwise tighten the query (e.g. filter on a unique/indexed field) so it can only match one row."],status:400,title:"Query matched more than one document"},VALIDATION_ERROR:{status:400,title:"Validation failed"},TOO_MANY_REQUESTS:{status:429,title:"Too many requests"},UNPROCESSABLE:{status:422,title:"Unprocessable"},NOT_IMPLEMENTED:{status:501,title:"Not implemented"},FUNCTION_NOT_FOUND:{status:404,title:"Function not found"},METHOD_NOT_ALLOWED:{status:405,title:"Method not allowed"},PAYLOAD_TOO_LARGE:{status:413,title:"Payload too large"},INTERNAL:{internal:!0,status:500,title:"Internal error"},INTERNAL_SERVER_ERROR:{internal:!0,status:500,title:"Internal error"},RPC_FAILED:{internal:!0,status:500,title:"Internal error"},COUNT_RLS_UNSUPPORTED:{status:422,title:"count() is unsupported under an RLS policy"},MASK_UNSUPPORTED:{status:422,title:"Aggregation over a masked column is unsupported"},RELATION_PREDICATE_UNSUPPORTED:{status:422,title:"Relation predicate is unsupported in a write policy"},RLS_REQUIRED:{hint:["This table is secure-by-default: it has no `.public()` marker and no RLS policy resolved for the caller, so the read fails closed.","","Add a read policy with `.rls(...)`, or mark the table `.public()` if it is intentionally world-readable."],status:403,title:"RLS policy required"},RUN_DEPTH_EXCEEDED:{internal:!0,status:500,title:"Run depth exceeded"},MIGRATION_NOT_FOUND:{status:404,title:"Data migration not found"},UNKNOWN_TABLE:{status:404,title:"Unknown table"},GLOBAL_TABLE_NOT_EDITABLE:{status:400,title:"Global table is not editable"},SHARD_ERROR:{status:503,title:"Shard error"},SHARD_UNAVAILABLE:{status:503,title:"Shard unavailable"},OFFLINE_IDENTITY_CHANGED:{status:409,title:"Offline identity changed"},CODEGEN_DIAGNOSTIC:{status:500,title:"Codegen diagnostic"},SCHEMA_SNAPSHOT_PARSE:{status:500,title:"Schema snapshot parse error"},ENV_INVALID:{internal:!0,status:500,title:"Invalid environment"},AUTH_HEADERS_MISSING:{internal:!0,status:500,title:"Auth headers missing"},EMAIL_DOMAIN_BLOCKED:{hint:["This address's domain is on the disposable/throwaway blocklist (or your configured deny-list).","","Sign up with a permanent mailbox. To tune the policy, pass `blockDisposable` / `allowDomains` / `denyDomains` to `emailGate(...)` (`@lunora/auth/email-guard`)."],status:400,title:"Email domain not allowed"},EMAIL_UNDELIVERABLE:{hint:["The address's domain publishes no MX (or fallback A/AAAA) records, so it can't receive mail.","","Check for a typo in the domain. MX verification is opt-in (`mx: true`) and needs DNS \u2014 leave it off on the edge path if DNS is unavailable."],status:400,title:"Email domain cannot receive mail"},ANALYTICS_SQL_ERROR:{status:502,title:"Analytics Engine SQL API error"},R2_SQL_ERROR:{status:502,title:"R2 SQL API error"},WORKFLOWS_REST_ERROR:{status:502,title:"Cloudflare Workflows REST API error"}},r=t(e=>Object.hasOwn(s,e)?s[e]:void 0,"n");var d=[{body:["Lunora codegen couldn't find a schema to generate from.","","Create `lunora/schema.ts` exporting a `defineSchema(...)` call:","","```ts",'import { defineSchema, defineTable, v } from "@lunora/server";',"","export default defineSchema({"," messages: defineTable({ body: v.string() }),","});","```","","Or run `lunora init` to scaffold Lunora (a sample `lunora/schema.ts` included) into your app."].join(`
2
2
  `),header:"No Lunora schema found",id:"lunora-schema-missing",test:t(e=>e.includes("defineSchema() not found")||e.includes("schema.ts not found at"),"test")},{body:["`defineSchema(...)` must be called with an **inline object literal** mapping table names to `defineTable(...)`:","","```ts","export default defineSchema({"," todos: defineTable({ title: v.string(), done: v.boolean() }),","});","```","","Codegen reads the schema statically, so it can't follow a variable or a spread \u2014 pass the object literal directly."].join(`
3
3
  `),header:"`defineSchema()` needs an inline object literal",id:"lunora-schema-not-object-literal",test:t(e=>e.includes("defineSchema() expects an object literal"),"test")},{body:["This table name collides with a built-in `ctx.db` member, so the generated client can't expose it.","","Rename the table to anything that isn't a reserved name (the error lists them) \u2014 e.g. `userAccounts` instead of `insert`."].join(`
4
4
  `),header:"Table name is reserved",id:"lunora-table-reserved",test:t(e=>e.includes("is reserved")&&e.includes("ctx.db"),"test")},{body:["Two tables resolve to the same name \u2014 usually a base table and a schema **extension** both defining it.","","Rename one of them, or drop the duplicate from the extension. Each table name must be unique across `defineSchema(...)` and every `.extend(...)`."].join(`
@@ -1 +1 @@
1
- import{a as ye,d as et,e as $e,f as pt}from"./chunk-HA34GYEX.js";import{a as ht,b as Ue}from"./chunk-YNBJ6ICE.js";import{C as Ee,e as ut,i as dt,p as De,q as mt}from"./chunk-7Z5QEFR4.js";import{a as he,c as pe}from"./chunk-ZFWEPGWG.js";import{c as be,j as U}from"./chunk-4FNHHFWR.js";import{a as r,d as Vt,e as N,f as te,g as zt,h as Le,j as Qe}from"./chunk-UHHTEBC3.js";var Mt=N(zt(),1);var ce={};Vt(ce,{Content:()=>Ct,Corner:()=>Tt,Root:()=>vt,Scrollbar:()=>Ot,Thumb:()=>Xt,Viewport:()=>Et});var s=N(te(),1);var Fe=N(te(),1);var tt=Fe.createContext(void 0);function q(){let e=Fe.useContext(tt);if(e===void 0)throw new Error(be(53));return e}r(q,"useScrollAreaRootContext");var Ae=(function(e){return e.scrollAreaCornerHeight="--scroll-area-corner-height",e.scrollAreaCornerWidth="--scroll-area-corner-width",e})({});function Y(e,t,i){if(!e)return 0;let y=getComputedStyle(e),O=i==="x"?"Inline":"Block";return i==="x"&&t==="margin"?parseFloat(y[`${t}InlineStart`])*2:parseFloat(y[`${t}${O}Start`])+parseFloat(y[`${t}${O}End`])}r(Y,"getOffset");var St=(function(e){return e.orientation="data-orientation",e.hovering="data-hovering",e.scrolling="data-scrolling",e.hasOverflowX="data-has-overflow-x",e.hasOverflowY="data-has-overflow-y",e.overflowXStart="data-overflow-x-start",e.overflowXEnd="data-overflow-x-end",e.overflowYStart="data-overflow-y-start",e.overflowYEnd="data-overflow-y-end",e})({});var Se=(function(e){return e.scrolling="data-scrolling",e.hasOverflowX="data-has-overflow-x",e.hasOverflowY="data-has-overflow-y",e.overflowXStart="data-overflow-x-start",e.overflowXEnd="data-overflow-x-end",e.overflowYStart="data-overflow-y-start",e.overflowYEnd="data-overflow-y-end",e})({});var le={hasOverflowX:r(e=>e?{[Se.hasOverflowX]:""}:null,"hasOverflowX"),hasOverflowY:r(e=>e?{[Se.hasOverflowY]:""}:null,"hasOverflowY"),overflowXStart:r(e=>e?{[Se.overflowXStart]:""}:null,"overflowXStart"),overflowXEnd:r(e=>e?{[Se.overflowXEnd]:""}:null,"overflowXEnd"),overflowYStart:r(e=>e?{[Se.overflowYStart]:""}:null,"overflowYStart"),overflowYEnd:r(e=>e?{[Se.overflowYEnd]:""}:null,"overflowYEnd"),cornerHidden:r(()=>null,"cornerHidden")};var wt=N(Le(),1);var It={x:0,y:0},xt={width:0,height:0},_t={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},Lt={x:!0,y:!0,corner:!0},vt=s.forwardRef(r(function(t,i){let{render:y,className:O,overflowEdgeThreshold:a,style:x,...f}=t,{xStart:w,xEnd:R,yStart:X,yEnd:j}=Dt(a),T=ut(),C=Ee(),v=Ee(),{nonce:M,disableStyleElements:S}=pt(),[b,h]=s.useState(!1),[$,V]=s.useState(!1),[H,F]=s.useState(!1),[k,z]=s.useState(!1),[ie,G]=s.useState(!1),[B,fe]=s.useState(xt),[J,Ye]=s.useState(xt),[W,I]=s.useState(_t),[l,Q]=s.useState(Lt),K=s.useRef(null),m=s.useRef(null),g=s.useRef(null),o=s.useRef(null),c=s.useRef(null),u=s.useRef(null),p=s.useRef(null),E=s.useRef(!1),_=s.useRef(0),L=s.useRef(0),A=s.useRef(0),oe=s.useRef(0),P=s.useRef("vertical"),xe=s.useRef(It),we=pe(n=>{let ee=n.x-xe.current.x,Te=n.y-xe.current.y;xe.current=n,Te!==0&&(F(!0),C.start(500,()=>{F(!1)})),ee!==0&&(V(!0),v.start(500,()=>{V(!1)}))}),ne=pe(n=>{n.button===0&&(E.current=!0,_.current=n.clientY,L.current=n.clientX,P.current=n.currentTarget.getAttribute(St.orientation),m.current&&(A.current=m.current.scrollTop,oe.current=m.current.scrollLeft),c.current&&P.current==="vertical"&&c.current.setPointerCapture(n.pointerId),u.current&&P.current==="horizontal"&&u.current.setPointerCapture(n.pointerId))}),ze=pe(n=>{if(!E.current)return;let ee=n.clientY-_.current,Te=n.clientX-L.current;if(m.current){let Me=m.current.scrollHeight,Ie=m.current.clientHeight,Ke=m.current.scrollWidth,Ze=m.current.clientWidth;if(c.current&&g.current&&P.current==="vertical"){let ue=Y(g.current,"padding","y"),de=Y(c.current,"margin","y"),Re=c.current.offsetHeight,He=g.current.offsetHeight-Re-ue-de,We=ee/He;m.current.scrollTop=A.current+We*(Me-Ie),n.preventDefault(),F(!0),C.start(500,()=>{F(!1)})}if(u.current&&o.current&&P.current==="horizontal"){let ue=Y(o.current,"padding","x"),de=Y(u.current,"margin","x"),Re=u.current.offsetWidth,He=o.current.offsetWidth-Re-ue-de,We=Te/He;m.current.scrollLeft=oe.current+We*(Ke-Ze),n.preventDefault(),V(!0),v.start(500,()=>{V(!1)})}}}),ve=pe(n=>{E.current=!1,c.current&&P.current==="vertical"&&c.current.hasPointerCapture(n.pointerId)&&c.current.releasePointerCapture(n.pointerId),u.current&&P.current==="horizontal"&&u.current.hasPointerCapture(n.pointerId)&&u.current.releasePointerCapture(n.pointerId)});function D(n){z(n.pointerType==="touch")}r(D,"handleTouchModalityChange");function Z(n){if(D(n),n.pointerType!=="touch"){let ee=De(K.current,n.target);h(ee)}}r(Z,"handlePointerEnterOrMove");let Xe=s.useMemo(()=>({scrolling:$||H,hasOverflowX:!l.x,hasOverflowY:!l.y,overflowXStart:W.xStart,overflowXEnd:W.xEnd,overflowYStart:W.yStart,overflowYEnd:W.yEnd,cornerHidden:l.corner}),[$,H,l.x,l.y,l.corner,W]),Be={role:"presentation",onPointerEnter:Z,onPointerMove:Z,onPointerDown:D,onPointerLeave(){h(!1)},style:{position:"relative",[Ae.scrollAreaCornerHeight]:`${B.height}px`,[Ae.scrollAreaCornerWidth]:`${B.width}px`}},ge=U("div",t,{state:Xe,ref:[i,K],props:[Be,f],stateAttributesMapping:le}),Ne=s.useMemo(()=>({handlePointerDown:ne,handlePointerMove:ze,handlePointerUp:ve,handleScroll:we,cornerSize:B,setCornerSize:fe,thumbSize:J,setThumbSize:Ye,hasMeasuredScrollbar:ie,setHasMeasuredScrollbar:G,touchModality:k,cornerRef:p,scrollingX:$,setScrollingX:V,scrollingY:H,setScrollingY:F,hovering:b,setHovering:h,viewportRef:m,rootRef:K,scrollbarYRef:g,scrollbarXRef:o,thumbYRef:c,thumbXRef:u,rootId:T,hiddenState:l,setHiddenState:Q,overflowEdges:W,setOverflowEdges:I,viewportState:Xe,overflowEdgeThreshold:{xStart:w,xEnd:R,yStart:X,yEnd:j}}),[ne,ze,ve,we,B,J,ie,k,$,V,H,F,b,h,T,l,W,Xe,w,R,X,j]);return(0,wt.jsxs)(tt.Provider,{value:Ne,children:[!S&&$e.getElement(M),ge]})},"ScrollAreaRoot"));function Dt(e){if(typeof e=="number"){let t=Math.max(0,e);return{xStart:t,xEnd:t,yStart:t,yEnd:t}}return{xStart:Math.max(0,e?.xStart||0),xEnd:Math.max(0,e?.xEnd||0),yStart:Math.max(0,e?.yStart||0),yEnd:Math.max(0,e?.yEnd||0)}}r(Dt,"normalizeOverflowEdgeThreshold");var se=N(te(),1);var ke=N(te(),1);var ot=ke.createContext(void 0);function gt(){let e=ke.useContext(ot);if(e===void 0)throw new Error(be(55));return e}r(gt,"useScrollAreaViewportContext");var re=(function(e){return e.scrollAreaOverflowXStart="--scroll-area-overflow-x-start",e.scrollAreaOverflowXEnd="--scroll-area-overflow-x-end",e.scrollAreaOverflowYStart="--scroll-area-overflow-y-start",e.scrollAreaOverflowYEnd="--scroll-area-overflow-y-end",e})({});var bt=N(Le(),1);var Rt=!1;function $t(){Rt||dt.engine.webkit||(typeof CSS<"u"&&"registerProperty"in CSS&&[re.scrollAreaOverflowXStart,re.scrollAreaOverflowXEnd,re.scrollAreaOverflowYStart,re.scrollAreaOverflowYEnd].forEach(e=>{try{CSS.registerProperty({name:e,syntax:"<length>",inherits:!1,initialValue:"0px"})}catch{}}),Rt=!0)}r($t,"removeCSSVariableInheritance");var Et=se.forwardRef(r(function(t,i){let{render:y,className:O,style:a,...x}=t,{viewportRef:f,scrollbarYRef:w,scrollbarXRef:R,thumbYRef:X,thumbXRef:j,cornerRef:T,cornerSize:C,setCornerSize:v,setThumbSize:M,rootId:S,setHiddenState:b,hiddenState:h,setHasMeasuredScrollbar:$,handleScroll:V,setHovering:H,setOverflowEdges:F,overflowEdges:k,overflowEdgeThreshold:z,scrollingX:ie,scrollingY:G}=q(),B=Ue(),fe=se.useRef(!0),J=se.useRef([NaN,NaN,NaN,NaN]),Ye=Ee(),W=Ee(),I=pe(()=>{let o=f.current,c=w.current,u=R.current,p=X.current,E=j.current,_=T.current;if(!o)return;let L=o.scrollHeight,A=o.scrollWidth,oe=o.clientHeight,P=o.clientWidth,xe=o.scrollTop,we=o.scrollLeft,ne=J.current,ze=Number.isNaN(ne[0]);if(ne[0]=oe,ne[1]=L,ne[2]=P,ne[3]=A,ze&&$(!0),L===0||A===0)return;let ve=Ft(o),D=ve.y,Z=ve.x,Xe=P/A,Be=oe/L,ge=Math.max(0,A-P),Ne=Math.max(0,L-oe),n=0,ee=0;if(!Z){let d=0;B==="rtl"?d=ye(-we,0,ge):d=ye(we,0,ge),n=et(d,ge),ee=ge-n}let Te=D?0:ye(xe,0,Ne),Me=D?0:et(Te,Ne),Ie=D?0:Ne-Me,Ke=Z?0:P,Ze=D?0:oe,ue=0,de=0;!Z&&!D&&(ue=c?.offsetWidth||0,de=u?.offsetHeight||0);let Re=C.width===0&&C.height===0,He=Re?ue:0,We=Re?de:0,lt=Y(u,"padding","x"),st=Y(c,"padding","y"),ct=Y(E,"margin","x"),at=Y(p,"margin","y"),it=Ke-lt-ct,ft=Ze-st-at,Ht=u?Math.min(u.offsetWidth-He,it):it,Wt=c?Math.min(c.offsetHeight-We,ft):ft,qe=Math.max(16,Ht*Xe),Ge=Math.max(16,Wt*Be);if(M(d=>d.height===Ge&&d.width===qe?d:{width:qe,height:Ge}),c&&p){let d=c.offsetHeight-Ge-st-at,me=L-oe,_e=me===0?0:xe/me,Je=Math.min(d,Math.max(0,_e*d));p.style.transform=`translate3d(0,${Je}px,0)`}if(u&&E){let d=u.offsetWidth-qe-lt-ct,me=A-P,_e=me===0?0:we/me,Je=B==="rtl"?ye(_e*d,-d,0):ye(_e*d,0,d);E.style.transform=`translate3d(${Je}px,0,0)`}let Pt=[[re.scrollAreaOverflowXStart,n],[re.scrollAreaOverflowXEnd,ee],[re.scrollAreaOverflowYStart,Me],[re.scrollAreaOverflowYEnd,Ie]];for(let[d,me]of Pt)o.style.setProperty(d,`${me}px`);_&&(Z||D?v({width:0,height:0}):!Z&&!D&&v({width:ue,height:de})),b(d=>kt(d,ve));let Pe={xStart:!Z&&n>z.xStart,xEnd:!Z&&ee>z.xEnd,yStart:!D&&Me>z.yStart,yEnd:!D&&Ie>z.yEnd};F(d=>d.xStart===Pe.xStart&&d.xEnd===Pe.xEnd&&d.yStart===Pe.yStart&&d.yEnd===Pe.yEnd?d:Pe)});he(()=>{f.current&&$t()},[f]),he(()=>{queueMicrotask(I)},[I,h,B,z.xStart,z.xEnd,z.yStart,z.yEnd]),he(()=>{f.current?.matches(":hover")&&H(!0)},[f,H]),he(()=>{let o=f.current;if(typeof ResizeObserver>"u"||!o)return;let c=!1,u=new ResizeObserver(()=>{if(!c){c=!0;let p=J.current;if(p[0]===o.clientHeight&&p[1]===o.scrollHeight&&p[2]===o.clientWidth&&p[3]===o.scrollWidth)return}I()});return u.observe(o),W.start(0,()=>{let p=o.getAnimations({subtree:!0});p.length!==0&&Promise.allSettled(p.map(E=>E.finished)).then(I).catch(()=>{})}),()=>{u.disconnect(),W.clear()}},[I,f,W]);function l(){fe.current=!1}r(l,"handleUserInteraction");let Q={role:"presentation",...S&&{"data-id":`${S}-viewport`},tabIndex:h.x&&h.y?-1:0,className:$e.className,style:{overflow:"scroll"},onScroll(){f.current&&(I(),fe.current||V({x:f.current.scrollLeft,y:f.current.scrollTop}),Ye.start(100,()=>{fe.current=!0}))},onWheel:l,onTouchMove:l,onPointerMove:l,onPointerEnter:l,onKeyDown:l},K=se.useMemo(()=>({scrolling:ie||G,hasOverflowX:!h.x,hasOverflowY:!h.y,overflowXStart:k.xStart,overflowXEnd:k.xEnd,overflowYStart:k.yStart,overflowYEnd:k.yEnd,cornerHidden:h.corner}),[ie,G,h.x,h.y,h.corner,k]),m=U("div",t,{ref:[i,f],state:K,props:[Q,x],stateAttributesMapping:le}),g=se.useMemo(()=>({computeThumbPosition:I}),[I]);return(0,bt.jsx)(ot.Provider,{value:g,children:m})},"ScrollAreaViewport"));function Ft(e){let t=e.clientHeight>=e.scrollHeight,i=e.clientWidth>=e.scrollWidth;return{y:t,x:i,corner:t||i}}r(Ft,"getHiddenState");function kt(e,t){return e.y===t.y&&e.x===t.x&&e.corner===t.corner?e:t}r(kt,"mergeHiddenState");var Ce=N(te(),1);var je=N(te(),1);var nt=je.createContext(void 0);function yt(){let e=je.useContext(nt);if(e===void 0)throw new Error(be(54));return e}r(yt,"useScrollAreaScrollbarContext");var Oe=(function(e){return e.scrollAreaThumbHeight="--scroll-area-thumb-height",e.scrollAreaThumbWidth="--scroll-area-thumb-width",e})({});var At=N(Le(),1);var Ot=Ce.forwardRef(r(function(t,i){let{render:y,className:O,orientation:a="vertical",keepMounted:x=!1,style:f,...w}=t,{hovering:R,scrollingX:X,scrollingY:j,hiddenState:T,overflowEdges:C,scrollbarYRef:v,scrollbarXRef:M,viewportRef:S,thumbYRef:b,thumbXRef:h,handlePointerDown:$,handlePointerUp:V,handleScroll:H,rootId:F,thumbSize:k,hasMeasuredScrollbar:z}=q(),ie={hovering:R,scrolling:{horizontal:X,vertical:j}[a],orientation:a,hasOverflowX:!T.x,hasOverflowY:!T.y,overflowXStart:C.xStart,overflowXEnd:C.xEnd,overflowYStart:C.yStart,overflowYEnd:C.yEnd,cornerHidden:T.corner},G=Ue(),B=!z&&!x,fe=a==="vertical"?T.y:T.x,J=x||!fe;Ce.useEffect(()=>{if(!J)return;let l=S.current,Q=a==="vertical"?v.current:M.current;if(!Q)return;function K(m){if(!l||!Q||m.ctrlKey)return;let g=a==="horizontal",o=g?"scrollLeft":"scrollTop",c=g?m.deltaX:m.deltaY;if(c===0)return;let u=g?l.scrollWidth-l.clientWidth:l.scrollHeight-l.clientHeight,p=g&&G==="rtl"?-u:0,E=g&&G==="rtl"?0:u,_=l[o];_<=p&&c<0||_>=E&&c>0||(m.preventDefault(),l[o]=Math.min(E,Math.max(p,_+c)),H({x:l.scrollLeft,y:l.scrollTop}))}return r(K,"handleWheel"),ht(Q,"wheel",K,{passive:!1})},[G,H,a,M,v,J,S]);let Ye={...F&&{"data-id":`${F}-scrollbar`},onPointerDown(l){if(l.button!==0)return;let Q=mt(l.nativeEvent),K=a==="vertical"?b.current:h.current;if(!(K&&De(K,Q))&&S.current){if(b.current&&v.current&&a==="vertical"){let m=Y(b.current,"margin","y"),g=Y(v.current,"padding","y"),o=b.current.offsetHeight,c=v.current.getBoundingClientRect(),u=l.clientY-c.top-o/2-g+m/2,p=S.current.scrollHeight,E=S.current.clientHeight,_=v.current.offsetHeight-o-g-m,A=u/_*(p-E);S.current.scrollTop=A}if(h.current&&M.current&&a==="horizontal"){let m=Y(h.current,"margin","x"),g=Y(M.current,"padding","x"),o=h.current.offsetWidth,c=M.current.getBoundingClientRect(),u=l.clientX-c.left-o/2-g+m/2,p=S.current.scrollWidth,E=S.current.clientWidth,_=M.current.offsetWidth-o-g-m,L=u/_,A;G==="rtl"?(A=(1-L)*(p-E),S.current.scrollLeft<=0&&(A=-A)):A=L*(p-E),S.current.scrollLeft=A}H({x:S.current.scrollLeft,y:S.current.scrollTop}),$(l)}},onPointerUp:V,onPointerCancel:V,style:{position:"absolute",touchAction:"none",WebkitUserSelect:"none",userSelect:"none",visibility:B?"hidden":void 0,...a==="vertical"&&{top:0,bottom:`var(${Ae.scrollAreaCornerHeight})`,insetInlineEnd:0,[Oe.scrollAreaThumbHeight]:`${k.height}px`},...a==="horizontal"&&{insetInlineStart:0,insetInlineEnd:`var(${Ae.scrollAreaCornerWidth})`,bottom:0,[Oe.scrollAreaThumbWidth]:`${k.width}px`}}},W=U("div",t,{ref:[i,a==="vertical"?v:M],state:ie,props:[Ye,w],stateAttributesMapping:le}),I=Ce.useMemo(()=>({orientation:a}),[a]);return J?(0,At.jsx)(nt.Provider,{value:I,children:W}):null},"ScrollAreaScrollbar"));var Ve=N(te(),1);var Ct=Ve.forwardRef(r(function(t,i){let{render:y,className:O,style:a,...x}=t,{computeThumbPosition:f}=gt(),{hasMeasuredScrollbar:w,viewportState:R}=q(),X=Ve.useRef(null),j=Ve.useRef(w);return he(()=>{if(typeof ResizeObserver>"u")return;let C=!1,v=new ResizeObserver(()=>{!C&&(C=!0,!j.current)||f()});return X.current&&v.observe(X.current),()=>{v.disconnect()}},[f]),U("div",t,{ref:[i,X],state:R,stateAttributesMapping:le,props:[{role:"presentation",style:{minWidth:"fit-content"}},x]})},"ScrollAreaContent"));var Yt=N(te(),1);var Xt=Yt.forwardRef(r(function(t,i){let{render:y,className:O,style:a,...x}=t,{thumbYRef:f,thumbXRef:w,handlePointerDown:R,handlePointerMove:X,handlePointerUp:j,setScrollingX:T,setScrollingY:C,scrollingX:v,scrollingY:M,hasMeasuredScrollbar:S}=q(),{orientation:b}=yt(),h={scrolling:b==="horizontal"?v:M,orientation:b};function $(H){b==="vertical"&&C(!1),b==="horizontal"&&T(!1),j(H)}return r($,"endDrag"),U("div",t,{ref:[i,b==="vertical"?f:w],state:h,props:[{onPointerDown:R,onPointerMove:X,onPointerUp:$,onPointerCancel:$,style:{visibility:S?void 0:"hidden",...b==="vertical"&&{height:`var(${Oe.scrollAreaThumbHeight})`},...b==="horizontal"&&{width:`var(${Oe.scrollAreaThumbWidth})`}}},x]})},"ScrollAreaThumb"));var Nt=N(te(),1);var Tt=Nt.forwardRef(r(function(t,i){let{render:y,className:O,style:a,...x}=t,{cornerRef:f,cornerSize:w,hiddenState:R}=q(),X=U("div",t,{ref:[i,f],props:[{style:{position:"absolute",bottom:0,insetInlineEnd:0,width:w.width,height:w.height}},x]});return R.corner?null:X},"ScrollAreaCorner"));var ae=N(Le(),1);function Co(e){let t=(0,Mt.c)(14),i,y,O;t[0]!==e?({className:y,children:i,...O}=e,t[0]=e,t[1]=i,t[2]=y,t[3]=O):(i=t[1],y=t[2],O=t[3]);let a;t[4]!==y?(a=Qe("relative",y),t[4]=y,t[5]=a):a=t[5];let x;t[6]!==i?(x=(0,ae.jsx)(ce.Viewport,{"data-slot":"scroll-area-viewport",className:"size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1",children:i}),t[6]=i,t[7]=x):x=t[7];let f,w;t[8]===Symbol.for("react.memo_cache_sentinel")?(f=(0,ae.jsx)(jt,{}),w=(0,ae.jsx)(ce.Corner,{}),t[8]=f,t[9]=w):(f=t[8],w=t[9]);let R;return t[10]!==O||t[11]!==a||t[12]!==x?(R=(0,ae.jsxs)(ce.Root,{"data-slot":"scroll-area",className:a,...O,children:[x,f,w]}),t[10]=O,t[11]=a,t[12]=x,t[13]=R):R=t[13],R}r(Co,"z");function jt({className:e,orientation:t="vertical",...i}){return(0,ae.jsx)(ce.Scrollbar,{"data-slot":"scroll-area-scrollbar","data-orientation":t,orientation:t,className:Qe("flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-s data-vertical:border-s-transparent",e),...i,children:(0,ae.jsx)(ce.Thumb,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-md bg-border"})})}r(jt,"f");export{Co as a};
1
+ import{a as ye,d as et,e as $e,f as pt}from"./chunk-2PJNAWB3.js";import{a as ht,b as Ue}from"./chunk-BGBLQ563.js";import{C as Ee,e as ut,i as dt,p as De,q as mt}from"./chunk-CFPZYHPY.js";import{a as he,c as pe}from"./chunk-2OUPA2WJ.js";import{c as be,j as U}from"./chunk-6ST5ECQA.js";import{a as r,d as Vt,e as N,f as te,g as zt,h as Le,j as Qe}from"./chunk-3XIESWL4.js";var Mt=N(zt(),1);var ce={};Vt(ce,{Content:()=>Ct,Corner:()=>Tt,Root:()=>vt,Scrollbar:()=>Ot,Thumb:()=>Xt,Viewport:()=>Et});var s=N(te(),1);var Fe=N(te(),1);var tt=Fe.createContext(void 0);function q(){let e=Fe.useContext(tt);if(e===void 0)throw new Error(be(53));return e}r(q,"useScrollAreaRootContext");var Ae=(function(e){return e.scrollAreaCornerHeight="--scroll-area-corner-height",e.scrollAreaCornerWidth="--scroll-area-corner-width",e})({});function Y(e,t,i){if(!e)return 0;let y=getComputedStyle(e),O=i==="x"?"Inline":"Block";return i==="x"&&t==="margin"?parseFloat(y[`${t}InlineStart`])*2:parseFloat(y[`${t}${O}Start`])+parseFloat(y[`${t}${O}End`])}r(Y,"getOffset");var St=(function(e){return e.orientation="data-orientation",e.hovering="data-hovering",e.scrolling="data-scrolling",e.hasOverflowX="data-has-overflow-x",e.hasOverflowY="data-has-overflow-y",e.overflowXStart="data-overflow-x-start",e.overflowXEnd="data-overflow-x-end",e.overflowYStart="data-overflow-y-start",e.overflowYEnd="data-overflow-y-end",e})({});var Se=(function(e){return e.scrolling="data-scrolling",e.hasOverflowX="data-has-overflow-x",e.hasOverflowY="data-has-overflow-y",e.overflowXStart="data-overflow-x-start",e.overflowXEnd="data-overflow-x-end",e.overflowYStart="data-overflow-y-start",e.overflowYEnd="data-overflow-y-end",e})({});var le={hasOverflowX:r(e=>e?{[Se.hasOverflowX]:""}:null,"hasOverflowX"),hasOverflowY:r(e=>e?{[Se.hasOverflowY]:""}:null,"hasOverflowY"),overflowXStart:r(e=>e?{[Se.overflowXStart]:""}:null,"overflowXStart"),overflowXEnd:r(e=>e?{[Se.overflowXEnd]:""}:null,"overflowXEnd"),overflowYStart:r(e=>e?{[Se.overflowYStart]:""}:null,"overflowYStart"),overflowYEnd:r(e=>e?{[Se.overflowYEnd]:""}:null,"overflowYEnd"),cornerHidden:r(()=>null,"cornerHidden")};var wt=N(Le(),1);var It={x:0,y:0},xt={width:0,height:0},_t={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},Lt={x:!0,y:!0,corner:!0},vt=s.forwardRef(r(function(t,i){let{render:y,className:O,overflowEdgeThreshold:a,style:x,...f}=t,{xStart:w,xEnd:R,yStart:X,yEnd:j}=Dt(a),T=ut(),C=Ee(),v=Ee(),{nonce:M,disableStyleElements:S}=pt(),[b,h]=s.useState(!1),[$,V]=s.useState(!1),[H,F]=s.useState(!1),[k,z]=s.useState(!1),[ie,G]=s.useState(!1),[B,fe]=s.useState(xt),[J,Ye]=s.useState(xt),[W,I]=s.useState(_t),[l,Q]=s.useState(Lt),K=s.useRef(null),m=s.useRef(null),g=s.useRef(null),o=s.useRef(null),c=s.useRef(null),u=s.useRef(null),p=s.useRef(null),E=s.useRef(!1),_=s.useRef(0),L=s.useRef(0),A=s.useRef(0),oe=s.useRef(0),P=s.useRef("vertical"),xe=s.useRef(It),we=pe(n=>{let ee=n.x-xe.current.x,Te=n.y-xe.current.y;xe.current=n,Te!==0&&(F(!0),C.start(500,()=>{F(!1)})),ee!==0&&(V(!0),v.start(500,()=>{V(!1)}))}),ne=pe(n=>{n.button===0&&(E.current=!0,_.current=n.clientY,L.current=n.clientX,P.current=n.currentTarget.getAttribute(St.orientation),m.current&&(A.current=m.current.scrollTop,oe.current=m.current.scrollLeft),c.current&&P.current==="vertical"&&c.current.setPointerCapture(n.pointerId),u.current&&P.current==="horizontal"&&u.current.setPointerCapture(n.pointerId))}),ze=pe(n=>{if(!E.current)return;let ee=n.clientY-_.current,Te=n.clientX-L.current;if(m.current){let Me=m.current.scrollHeight,Ie=m.current.clientHeight,Ke=m.current.scrollWidth,Ze=m.current.clientWidth;if(c.current&&g.current&&P.current==="vertical"){let ue=Y(g.current,"padding","y"),de=Y(c.current,"margin","y"),Re=c.current.offsetHeight,He=g.current.offsetHeight-Re-ue-de,We=ee/He;m.current.scrollTop=A.current+We*(Me-Ie),n.preventDefault(),F(!0),C.start(500,()=>{F(!1)})}if(u.current&&o.current&&P.current==="horizontal"){let ue=Y(o.current,"padding","x"),de=Y(u.current,"margin","x"),Re=u.current.offsetWidth,He=o.current.offsetWidth-Re-ue-de,We=Te/He;m.current.scrollLeft=oe.current+We*(Ke-Ze),n.preventDefault(),V(!0),v.start(500,()=>{V(!1)})}}}),ve=pe(n=>{E.current=!1,c.current&&P.current==="vertical"&&c.current.hasPointerCapture(n.pointerId)&&c.current.releasePointerCapture(n.pointerId),u.current&&P.current==="horizontal"&&u.current.hasPointerCapture(n.pointerId)&&u.current.releasePointerCapture(n.pointerId)});function D(n){z(n.pointerType==="touch")}r(D,"handleTouchModalityChange");function Z(n){if(D(n),n.pointerType!=="touch"){let ee=De(K.current,n.target);h(ee)}}r(Z,"handlePointerEnterOrMove");let Xe=s.useMemo(()=>({scrolling:$||H,hasOverflowX:!l.x,hasOverflowY:!l.y,overflowXStart:W.xStart,overflowXEnd:W.xEnd,overflowYStart:W.yStart,overflowYEnd:W.yEnd,cornerHidden:l.corner}),[$,H,l.x,l.y,l.corner,W]),Be={role:"presentation",onPointerEnter:Z,onPointerMove:Z,onPointerDown:D,onPointerLeave(){h(!1)},style:{position:"relative",[Ae.scrollAreaCornerHeight]:`${B.height}px`,[Ae.scrollAreaCornerWidth]:`${B.width}px`}},ge=U("div",t,{state:Xe,ref:[i,K],props:[Be,f],stateAttributesMapping:le}),Ne=s.useMemo(()=>({handlePointerDown:ne,handlePointerMove:ze,handlePointerUp:ve,handleScroll:we,cornerSize:B,setCornerSize:fe,thumbSize:J,setThumbSize:Ye,hasMeasuredScrollbar:ie,setHasMeasuredScrollbar:G,touchModality:k,cornerRef:p,scrollingX:$,setScrollingX:V,scrollingY:H,setScrollingY:F,hovering:b,setHovering:h,viewportRef:m,rootRef:K,scrollbarYRef:g,scrollbarXRef:o,thumbYRef:c,thumbXRef:u,rootId:T,hiddenState:l,setHiddenState:Q,overflowEdges:W,setOverflowEdges:I,viewportState:Xe,overflowEdgeThreshold:{xStart:w,xEnd:R,yStart:X,yEnd:j}}),[ne,ze,ve,we,B,J,ie,k,$,V,H,F,b,h,T,l,W,Xe,w,R,X,j]);return(0,wt.jsxs)(tt.Provider,{value:Ne,children:[!S&&$e.getElement(M),ge]})},"ScrollAreaRoot"));function Dt(e){if(typeof e=="number"){let t=Math.max(0,e);return{xStart:t,xEnd:t,yStart:t,yEnd:t}}return{xStart:Math.max(0,e?.xStart||0),xEnd:Math.max(0,e?.xEnd||0),yStart:Math.max(0,e?.yStart||0),yEnd:Math.max(0,e?.yEnd||0)}}r(Dt,"normalizeOverflowEdgeThreshold");var se=N(te(),1);var ke=N(te(),1);var ot=ke.createContext(void 0);function gt(){let e=ke.useContext(ot);if(e===void 0)throw new Error(be(55));return e}r(gt,"useScrollAreaViewportContext");var re=(function(e){return e.scrollAreaOverflowXStart="--scroll-area-overflow-x-start",e.scrollAreaOverflowXEnd="--scroll-area-overflow-x-end",e.scrollAreaOverflowYStart="--scroll-area-overflow-y-start",e.scrollAreaOverflowYEnd="--scroll-area-overflow-y-end",e})({});var bt=N(Le(),1);var Rt=!1;function $t(){Rt||dt.engine.webkit||(typeof CSS<"u"&&"registerProperty"in CSS&&[re.scrollAreaOverflowXStart,re.scrollAreaOverflowXEnd,re.scrollAreaOverflowYStart,re.scrollAreaOverflowYEnd].forEach(e=>{try{CSS.registerProperty({name:e,syntax:"<length>",inherits:!1,initialValue:"0px"})}catch{}}),Rt=!0)}r($t,"removeCSSVariableInheritance");var Et=se.forwardRef(r(function(t,i){let{render:y,className:O,style:a,...x}=t,{viewportRef:f,scrollbarYRef:w,scrollbarXRef:R,thumbYRef:X,thumbXRef:j,cornerRef:T,cornerSize:C,setCornerSize:v,setThumbSize:M,rootId:S,setHiddenState:b,hiddenState:h,setHasMeasuredScrollbar:$,handleScroll:V,setHovering:H,setOverflowEdges:F,overflowEdges:k,overflowEdgeThreshold:z,scrollingX:ie,scrollingY:G}=q(),B=Ue(),fe=se.useRef(!0),J=se.useRef([NaN,NaN,NaN,NaN]),Ye=Ee(),W=Ee(),I=pe(()=>{let o=f.current,c=w.current,u=R.current,p=X.current,E=j.current,_=T.current;if(!o)return;let L=o.scrollHeight,A=o.scrollWidth,oe=o.clientHeight,P=o.clientWidth,xe=o.scrollTop,we=o.scrollLeft,ne=J.current,ze=Number.isNaN(ne[0]);if(ne[0]=oe,ne[1]=L,ne[2]=P,ne[3]=A,ze&&$(!0),L===0||A===0)return;let ve=Ft(o),D=ve.y,Z=ve.x,Xe=P/A,Be=oe/L,ge=Math.max(0,A-P),Ne=Math.max(0,L-oe),n=0,ee=0;if(!Z){let d=0;B==="rtl"?d=ye(-we,0,ge):d=ye(we,0,ge),n=et(d,ge),ee=ge-n}let Te=D?0:ye(xe,0,Ne),Me=D?0:et(Te,Ne),Ie=D?0:Ne-Me,Ke=Z?0:P,Ze=D?0:oe,ue=0,de=0;!Z&&!D&&(ue=c?.offsetWidth||0,de=u?.offsetHeight||0);let Re=C.width===0&&C.height===0,He=Re?ue:0,We=Re?de:0,lt=Y(u,"padding","x"),st=Y(c,"padding","y"),ct=Y(E,"margin","x"),at=Y(p,"margin","y"),it=Ke-lt-ct,ft=Ze-st-at,Ht=u?Math.min(u.offsetWidth-He,it):it,Wt=c?Math.min(c.offsetHeight-We,ft):ft,qe=Math.max(16,Ht*Xe),Ge=Math.max(16,Wt*Be);if(M(d=>d.height===Ge&&d.width===qe?d:{width:qe,height:Ge}),c&&p){let d=c.offsetHeight-Ge-st-at,me=L-oe,_e=me===0?0:xe/me,Je=Math.min(d,Math.max(0,_e*d));p.style.transform=`translate3d(0,${Je}px,0)`}if(u&&E){let d=u.offsetWidth-qe-lt-ct,me=A-P,_e=me===0?0:we/me,Je=B==="rtl"?ye(_e*d,-d,0):ye(_e*d,0,d);E.style.transform=`translate3d(${Je}px,0,0)`}let Pt=[[re.scrollAreaOverflowXStart,n],[re.scrollAreaOverflowXEnd,ee],[re.scrollAreaOverflowYStart,Me],[re.scrollAreaOverflowYEnd,Ie]];for(let[d,me]of Pt)o.style.setProperty(d,`${me}px`);_&&(Z||D?v({width:0,height:0}):!Z&&!D&&v({width:ue,height:de})),b(d=>kt(d,ve));let Pe={xStart:!Z&&n>z.xStart,xEnd:!Z&&ee>z.xEnd,yStart:!D&&Me>z.yStart,yEnd:!D&&Ie>z.yEnd};F(d=>d.xStart===Pe.xStart&&d.xEnd===Pe.xEnd&&d.yStart===Pe.yStart&&d.yEnd===Pe.yEnd?d:Pe)});he(()=>{f.current&&$t()},[f]),he(()=>{queueMicrotask(I)},[I,h,B,z.xStart,z.xEnd,z.yStart,z.yEnd]),he(()=>{f.current?.matches(":hover")&&H(!0)},[f,H]),he(()=>{let o=f.current;if(typeof ResizeObserver>"u"||!o)return;let c=!1,u=new ResizeObserver(()=>{if(!c){c=!0;let p=J.current;if(p[0]===o.clientHeight&&p[1]===o.scrollHeight&&p[2]===o.clientWidth&&p[3]===o.scrollWidth)return}I()});return u.observe(o),W.start(0,()=>{let p=o.getAnimations({subtree:!0});p.length!==0&&Promise.allSettled(p.map(E=>E.finished)).then(I).catch(()=>{})}),()=>{u.disconnect(),W.clear()}},[I,f,W]);function l(){fe.current=!1}r(l,"handleUserInteraction");let Q={role:"presentation",...S&&{"data-id":`${S}-viewport`},tabIndex:h.x&&h.y?-1:0,className:$e.className,style:{overflow:"scroll"},onScroll(){f.current&&(I(),fe.current||V({x:f.current.scrollLeft,y:f.current.scrollTop}),Ye.start(100,()=>{fe.current=!0}))},onWheel:l,onTouchMove:l,onPointerMove:l,onPointerEnter:l,onKeyDown:l},K=se.useMemo(()=>({scrolling:ie||G,hasOverflowX:!h.x,hasOverflowY:!h.y,overflowXStart:k.xStart,overflowXEnd:k.xEnd,overflowYStart:k.yStart,overflowYEnd:k.yEnd,cornerHidden:h.corner}),[ie,G,h.x,h.y,h.corner,k]),m=U("div",t,{ref:[i,f],state:K,props:[Q,x],stateAttributesMapping:le}),g=se.useMemo(()=>({computeThumbPosition:I}),[I]);return(0,bt.jsx)(ot.Provider,{value:g,children:m})},"ScrollAreaViewport"));function Ft(e){let t=e.clientHeight>=e.scrollHeight,i=e.clientWidth>=e.scrollWidth;return{y:t,x:i,corner:t||i}}r(Ft,"getHiddenState");function kt(e,t){return e.y===t.y&&e.x===t.x&&e.corner===t.corner?e:t}r(kt,"mergeHiddenState");var Ce=N(te(),1);var je=N(te(),1);var nt=je.createContext(void 0);function yt(){let e=je.useContext(nt);if(e===void 0)throw new Error(be(54));return e}r(yt,"useScrollAreaScrollbarContext");var Oe=(function(e){return e.scrollAreaThumbHeight="--scroll-area-thumb-height",e.scrollAreaThumbWidth="--scroll-area-thumb-width",e})({});var At=N(Le(),1);var Ot=Ce.forwardRef(r(function(t,i){let{render:y,className:O,orientation:a="vertical",keepMounted:x=!1,style:f,...w}=t,{hovering:R,scrollingX:X,scrollingY:j,hiddenState:T,overflowEdges:C,scrollbarYRef:v,scrollbarXRef:M,viewportRef:S,thumbYRef:b,thumbXRef:h,handlePointerDown:$,handlePointerUp:V,handleScroll:H,rootId:F,thumbSize:k,hasMeasuredScrollbar:z}=q(),ie={hovering:R,scrolling:{horizontal:X,vertical:j}[a],orientation:a,hasOverflowX:!T.x,hasOverflowY:!T.y,overflowXStart:C.xStart,overflowXEnd:C.xEnd,overflowYStart:C.yStart,overflowYEnd:C.yEnd,cornerHidden:T.corner},G=Ue(),B=!z&&!x,fe=a==="vertical"?T.y:T.x,J=x||!fe;Ce.useEffect(()=>{if(!J)return;let l=S.current,Q=a==="vertical"?v.current:M.current;if(!Q)return;function K(m){if(!l||!Q||m.ctrlKey)return;let g=a==="horizontal",o=g?"scrollLeft":"scrollTop",c=g?m.deltaX:m.deltaY;if(c===0)return;let u=g?l.scrollWidth-l.clientWidth:l.scrollHeight-l.clientHeight,p=g&&G==="rtl"?-u:0,E=g&&G==="rtl"?0:u,_=l[o];_<=p&&c<0||_>=E&&c>0||(m.preventDefault(),l[o]=Math.min(E,Math.max(p,_+c)),H({x:l.scrollLeft,y:l.scrollTop}))}return r(K,"handleWheel"),ht(Q,"wheel",K,{passive:!1})},[G,H,a,M,v,J,S]);let Ye={...F&&{"data-id":`${F}-scrollbar`},onPointerDown(l){if(l.button!==0)return;let Q=mt(l.nativeEvent),K=a==="vertical"?b.current:h.current;if(!(K&&De(K,Q))&&S.current){if(b.current&&v.current&&a==="vertical"){let m=Y(b.current,"margin","y"),g=Y(v.current,"padding","y"),o=b.current.offsetHeight,c=v.current.getBoundingClientRect(),u=l.clientY-c.top-o/2-g+m/2,p=S.current.scrollHeight,E=S.current.clientHeight,_=v.current.offsetHeight-o-g-m,A=u/_*(p-E);S.current.scrollTop=A}if(h.current&&M.current&&a==="horizontal"){let m=Y(h.current,"margin","x"),g=Y(M.current,"padding","x"),o=h.current.offsetWidth,c=M.current.getBoundingClientRect(),u=l.clientX-c.left-o/2-g+m/2,p=S.current.scrollWidth,E=S.current.clientWidth,_=M.current.offsetWidth-o-g-m,L=u/_,A;G==="rtl"?(A=(1-L)*(p-E),S.current.scrollLeft<=0&&(A=-A)):A=L*(p-E),S.current.scrollLeft=A}H({x:S.current.scrollLeft,y:S.current.scrollTop}),$(l)}},onPointerUp:V,onPointerCancel:V,style:{position:"absolute",touchAction:"none",WebkitUserSelect:"none",userSelect:"none",visibility:B?"hidden":void 0,...a==="vertical"&&{top:0,bottom:`var(${Ae.scrollAreaCornerHeight})`,insetInlineEnd:0,[Oe.scrollAreaThumbHeight]:`${k.height}px`},...a==="horizontal"&&{insetInlineStart:0,insetInlineEnd:`var(${Ae.scrollAreaCornerWidth})`,bottom:0,[Oe.scrollAreaThumbWidth]:`${k.width}px`}}},W=U("div",t,{ref:[i,a==="vertical"?v:M],state:ie,props:[Ye,w],stateAttributesMapping:le}),I=Ce.useMemo(()=>({orientation:a}),[a]);return J?(0,At.jsx)(nt.Provider,{value:I,children:W}):null},"ScrollAreaScrollbar"));var Ve=N(te(),1);var Ct=Ve.forwardRef(r(function(t,i){let{render:y,className:O,style:a,...x}=t,{computeThumbPosition:f}=gt(),{hasMeasuredScrollbar:w,viewportState:R}=q(),X=Ve.useRef(null),j=Ve.useRef(w);return he(()=>{if(typeof ResizeObserver>"u")return;let C=!1,v=new ResizeObserver(()=>{!C&&(C=!0,!j.current)||f()});return X.current&&v.observe(X.current),()=>{v.disconnect()}},[f]),U("div",t,{ref:[i,X],state:R,stateAttributesMapping:le,props:[{role:"presentation",style:{minWidth:"fit-content"}},x]})},"ScrollAreaContent"));var Yt=N(te(),1);var Xt=Yt.forwardRef(r(function(t,i){let{render:y,className:O,style:a,...x}=t,{thumbYRef:f,thumbXRef:w,handlePointerDown:R,handlePointerMove:X,handlePointerUp:j,setScrollingX:T,setScrollingY:C,scrollingX:v,scrollingY:M,hasMeasuredScrollbar:S}=q(),{orientation:b}=yt(),h={scrolling:b==="horizontal"?v:M,orientation:b};function $(H){b==="vertical"&&C(!1),b==="horizontal"&&T(!1),j(H)}return r($,"endDrag"),U("div",t,{ref:[i,b==="vertical"?f:w],state:h,props:[{onPointerDown:R,onPointerMove:X,onPointerUp:$,onPointerCancel:$,style:{visibility:S?void 0:"hidden",...b==="vertical"&&{height:`var(${Oe.scrollAreaThumbHeight})`},...b==="horizontal"&&{width:`var(${Oe.scrollAreaThumbWidth})`}}},x]})},"ScrollAreaThumb"));var Nt=N(te(),1);var Tt=Nt.forwardRef(r(function(t,i){let{render:y,className:O,style:a,...x}=t,{cornerRef:f,cornerSize:w,hiddenState:R}=q(),X=U("div",t,{ref:[i,f],props:[{style:{position:"absolute",bottom:0,insetInlineEnd:0,width:w.width,height:w.height}},x]});return R.corner?null:X},"ScrollAreaCorner"));var ae=N(Le(),1);function Co(e){let t=(0,Mt.c)(14),i,y,O;t[0]!==e?({className:y,children:i,...O}=e,t[0]=e,t[1]=i,t[2]=y,t[3]=O):(i=t[1],y=t[2],O=t[3]);let a;t[4]!==y?(a=Qe("relative",y),t[4]=y,t[5]=a):a=t[5];let x;t[6]!==i?(x=(0,ae.jsx)(ce.Viewport,{"data-slot":"scroll-area-viewport",className:"size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1",children:i}),t[6]=i,t[7]=x):x=t[7];let f,w;t[8]===Symbol.for("react.memo_cache_sentinel")?(f=(0,ae.jsx)(jt,{}),w=(0,ae.jsx)(ce.Corner,{}),t[8]=f,t[9]=w):(f=t[8],w=t[9]);let R;return t[10]!==O||t[11]!==a||t[12]!==x?(R=(0,ae.jsxs)(ce.Root,{"data-slot":"scroll-area",className:a,...O,children:[x,f,w]}),t[10]=O,t[11]=a,t[12]=x,t[13]=R):R=t[13],R}r(Co,"z");function jt({className:e,orientation:t="vertical",...i}){return(0,ae.jsx)(ce.Scrollbar,{"data-slot":"scroll-area-scrollbar","data-orientation":t,orientation:t,className:Qe("flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-s data-vertical:border-s-transparent",e),...i,children:(0,ae.jsx)(ce.Thumb,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-md bg-border"})})}r(jt,"f");export{Co as a};
@@ -1 +1 @@
1
- import{a as n,e as f,f as l,g as d}from"./chunk-UHHTEBC3.js";var i=f(d(),1),a=f(l(),1);var T=n(function(e,o){let t=(0,i.c)(4),r=o===void 0?300:o,[m,c]=(0,a.useState)(e),s,u;return t[0]!==r||t[1]!==e?(s=n(()=>{let p=setTimeout(()=>{c(e)},r);return()=>{clearTimeout(p)}},"r"),u=[e,r],t[0]=r,t[1]=e,t[2]=s,t[3]=u):(s=t[2],u=t[3]),(0,a.useEffect)(s,u),m},"p");export{T as a};
1
+ import{a as n,e as f,f as l,g as d}from"./chunk-3XIESWL4.js";var i=f(d(),1),a=f(l(),1);var T=n(function(e,o){let t=(0,i.c)(4),r=o===void 0?300:o,[m,c]=(0,a.useState)(e),s,u;return t[0]!==r||t[1]!==e?(s=n(()=>{let p=setTimeout(()=>{c(e)},r);return()=>{clearTimeout(p)}},"r"),u=[e,r],t[0]=r,t[1]=e,t[2]=s,t[3]=u):(s=t[2],u=t[3]),(0,a.useEffect)(s,u),m},"p");export{T as a};
@@ -1 +1 @@
1
- import{a as y}from"./chunk-UWF5DOGV.js";import{R as k}from"./chunk-7Z5QEFR4.js";import{d as j}from"./chunk-KLLYGWNF.js";import{a as m,e as b,f as w,g as F,h as $}from"./chunk-UHHTEBC3.js";var C=b(F(),1),h=b(w(),1);var a=b($(),1);var B=m(i=>{let t=(0,C.c)(21),{id:f,onChange:g,testId:e,value:v}=i,r=j(),u=(0,h.useId)(),[d]=(0,h.useState)(A),c;t[0]!==g?(c=m(S=>{g(S.target.value)},"m"),t[0]=g,t[1]=c):c=t[1];let x=c,s;t[2]!==r?(s=r("Shard key"),t[2]=r,t[3]=s):s=t[3];let I=d.length>0?u:void 0,o;t[4]!==r?(o=r("shard key (optional)"),t[4]=r,t[5]=o):o=t[5];let l;t[6]!==f||t[7]!==x||t[8]!==s||t[9]!==I||t[10]!==o||t[11]!==e||t[12]!==v?(l=(0,a.jsx)(k,{"aria-label":s,className:"h-8 w-48","data-testid":e,id:f,list:I,onChange:x,placeholder:o,value:v}),t[6]=f,t[7]=x,t[8]=s,t[9]=I,t[10]=o,t[11]=e,t[12]=v,t[13]=l):l=t[13];let n;t[14]!==u||t[15]!==d||t[16]!==e?(n=d.length>0&&(0,a.jsx)("datalist",{"data-testid":`${e}-recents`,id:u,children:d.map(N)}),t[14]=u,t[15]=d,t[16]=e,t[17]=n):n=t[17];let p;return t[18]!==l||t[19]!==n?(p=(0,a.jsxs)(a.Fragment,{children:[l,n]}),t[18]=l,t[19]=n,t[20]=p):p=t[20],p},"A");function A(){return y()}m(A,"F");function N(i){return(0,a.jsx)("option",{"aria-label":i,value:i},i)}m(N,"w");export{B as a};
1
+ import{a as y}from"./chunk-GRL5MG3Z.js";import{R as k}from"./chunk-CFPZYHPY.js";import{d as j}from"./chunk-4CGALXS3.js";import{a as m,e as b,f as w,g as F,h as $}from"./chunk-3XIESWL4.js";var C=b(F(),1),h=b(w(),1);var a=b($(),1);var B=m(i=>{let t=(0,C.c)(21),{id:f,onChange:g,testId:e,value:v}=i,r=j(),u=(0,h.useId)(),[d]=(0,h.useState)(A),c;t[0]!==g?(c=m(S=>{g(S.target.value)},"m"),t[0]=g,t[1]=c):c=t[1];let x=c,s;t[2]!==r?(s=r("Shard key"),t[2]=r,t[3]=s):s=t[3];let I=d.length>0?u:void 0,o;t[4]!==r?(o=r("shard key (optional)"),t[4]=r,t[5]=o):o=t[5];let l;t[6]!==f||t[7]!==x||t[8]!==s||t[9]!==I||t[10]!==o||t[11]!==e||t[12]!==v?(l=(0,a.jsx)(k,{"aria-label":s,className:"h-8 w-48","data-testid":e,id:f,list:I,onChange:x,placeholder:o,value:v}),t[6]=f,t[7]=x,t[8]=s,t[9]=I,t[10]=o,t[11]=e,t[12]=v,t[13]=l):l=t[13];let n;t[14]!==u||t[15]!==d||t[16]!==e?(n=d.length>0&&(0,a.jsx)("datalist",{"data-testid":`${e}-recents`,id:u,children:d.map(N)}),t[14]=u,t[15]=d,t[16]=e,t[17]=n):n=t[17];let p;return t[18]!==l||t[19]!==n?(p=(0,a.jsxs)(a.Fragment,{children:[l,n]}),t[18]=l,t[19]=n,t[20]=p):p=t[20],p},"A");function A(){return y()}m(A,"F");function N(i){return(0,a.jsx)("option",{"aria-label":i,value:i},i)}m(N,"w");export{B as a};