@lunora/studio 1.0.0-alpha.5 → 1.0.0-alpha.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +6 -0
- package/__assets__/package-og.svg +1 -1
- package/dist/index.d.ts +45 -23
- package/dist/index.js +31 -31
- package/dist/mount.d.ts +1 -1
- package/dist/mount.js +3 -2
- package/dist/{packem_shared/ApiTab-W3no0KOj.js → packem_chunks/ApiTab.js} +5 -5
- package/dist/{packem_shared/AuditPanel-Bq4o_IqT.js → packem_chunks/AuditPanel.js} +29 -41
- package/dist/{packem_shared/ExportImportPanel-dxY56TDF.js → packem_chunks/ExportImportPanel.js} +16 -11
- package/dist/{packem_shared/FileBrowser-Dhy4zES8.js → packem_chunks/FileBrowser.js} +55 -32
- package/dist/{packem_shared/FunctionRunner--fQJRPAD.js → packem_chunks/FunctionRunner.js} +15 -32
- package/dist/{packem_shared/FunctionStatsPanel-BjRUA_G3.js → packem_chunks/FunctionStatsPanel.js} +153 -208
- package/dist/{packem_shared/HealthPanel-PxclMWmA.js → packem_chunks/HealthPanel.js} +37 -29
- package/dist/{packem_shared/InsightsPanel-CWS_C-xW.js → packem_chunks/InsightsPanel.js} +108 -69
- package/dist/{packem_shared/LogsPanel-CTW8CFcM.js → packem_chunks/LogsPanel.js} +46 -58
- package/dist/{packem_shared/MailPanel-BwkvfIHF.js → packem_chunks/MailPanel.js} +45 -139
- package/dist/{packem_shared/MetricsPanel-BLuOhZQ4.js → packem_chunks/MetricsPanel.js} +41 -322
- package/dist/{packem_shared/MigrationsPanel-DT3lnwHF.js → packem_chunks/MigrationsPanel.js} +44 -51
- package/dist/{packem_shared/PitrPanel-CdErL7EJ.js → packem_chunks/PitrPanel.js} +9 -9
- package/dist/{packem_shared/SchemaViewer-LJDcmNIO.js → packem_chunks/SchemaViewer.js} +17 -16
- package/dist/{packem_shared/SecurityAdvisorPanel-C_ETsPih.js → packem_chunks/SecurityAdvisorPanel.js} +47 -31
- package/dist/packem_chunks/SettingsPanel.js +391 -0
- package/dist/{packem_shared/sql-editor-panel-BFRpzj6r.js → packem_chunks/SqlEditorPanel.js} +159 -387
- package/dist/{packem_shared/TableEditor-ChfUOZec.js → packem_chunks/TableEditor.js} +13 -94
- package/dist/packem_chunks/agents-panel.js +326 -0
- package/dist/packem_chunks/analytics-panel.js +261 -0
- package/dist/packem_chunks/auth-config-panel.js +365 -0
- package/dist/packem_chunks/auth-sessions-panel.js +175 -0
- package/dist/packem_chunks/containers-panel.js +261 -0
- package/dist/packem_chunks/dashboards-panel.js +781 -0
- package/dist/packem_chunks/fanout-panel.js +482 -0
- package/dist/packem_chunks/flags-panel.js +176 -0
- package/dist/packem_chunks/issues-panel.js +188 -0
- package/dist/packem_chunks/kv-browser.js +1896 -0
- package/dist/packem_chunks/log-drains-panel.js +273 -0
- package/dist/packem_chunks/organizations-panel.js +3178 -0
- package/dist/packem_chunks/payments-panel.js +186 -0
- package/dist/packem_chunks/permissions-panel.js +805 -0
- package/dist/packem_chunks/queues-panel.js +1075 -0
- package/dist/packem_chunks/rls-panel.js +315 -0
- package/dist/packem_chunks/schedule-panel.js +831 -0
- package/dist/packem_chunks/sparkline.js +79 -0
- package/dist/packem_chunks/storage-rules-panel.js +140 -0
- package/dist/packem_chunks/subscriptions-panel.js +238 -0
- package/dist/packem_chunks/users-panel.js +1731 -0
- package/dist/packem_chunks/vector-browser.js +281 -0
- package/dist/packem_chunks/workflows-panel.js +562 -0
- package/dist/packem_shared/{ADMIN_FUNCTIONS-DmBqMZ-z.js → ADMIN_FUNCTIONS-DNeyYtUN.js} +8 -0
- package/dist/packem_shared/{ApiDocsPanel-C5-yJ1p7.js → ApiDocsPanel-_aEZxAMX.js} +2 -2
- package/dist/packem_shared/{ApiReferencePanel-1vubqG5s.js → ApiReferencePanel-Dd8pcswz.js} +2 -1
- package/dist/packem_shared/{CommandPalette-BtgkBzZI.js → CommandPalette-BXV4eKf5.js} +1 -1
- package/dist/packem_shared/{DataBrowser-CtBe1So9.js → DataBrowser-C8hejnub.js} +201 -250
- package/dist/packem_shared/{DataFilters-FNquMaiu.js → DataFilters-B1Q7mrt7.js} +6 -2
- package/dist/packem_shared/{GlobalDataBrowser-BTEmGrph.js → GlobalDataBrowser-CxJxRRf2.js} +37 -66
- package/dist/packem_shared/HomePanel-Ye8PaqQL.js +14 -0
- package/dist/packem_shared/{OpenRpcReferencePanel-vbcYbv3V.js → OpenRpcReferencePanel-CWaf0ZtX.js} +2 -1
- package/dist/packem_shared/{ScheduledJobs-CabfKbyM.js → ScheduledJobs-dHMgnJbx.js} +163 -60
- package/dist/packem_shared/{ShardInput-gx_DZXXn.js → ShardInput-CZnpHILL.js} +1 -1
- package/dist/packem_shared/Studio-xJLTlLpf.js +16 -0
- package/dist/packem_shared/{StudioApp-D4azxYBu.js → StudioApp-oCQholCL.js} +6 -21
- package/dist/packem_shared/{advisor-view-CGcfMiPq.js → advisor-view-Cx21PS_T.js} +6 -6
- package/dist/packem_shared/alert-CdAET2K_.js +68 -0
- package/dist/packem_shared/{app.d-CCmwDEVs.d.ts → app.d-CGdOmLTm.d.ts} +1 -1
- package/dist/packem_shared/{bar-chart-CzJAgqkp.js → bar-chart-DSwcWIRy.js} +5 -4
- package/dist/packem_shared/browser-storage-L4gOP5gJ.js +105 -0
- package/dist/packem_shared/{cf-links-2cktDedA.js → cf-links-BZfRdxSE.js} +1 -1
- package/dist/packem_shared/{data-grid-B5CaV3wS.js → data-grid-C9I16KWr.js} +1 -1
- package/dist/packem_shared/data-view-params-Cd6yRVbv.js +96 -0
- package/dist/packem_shared/error-alert-vIPQoN3Y.js +114 -0
- package/dist/packem_shared/{grid-features-CzUfqgsM.js → grid-features-B_fZH4iQ.js} +133 -164
- package/dist/packem_shared/home-panel-D62G8108.js +1889 -0
- package/dist/packem_shared/internal-zwBoOv24.js +122 -0
- package/dist/packem_shared/modal-shell-hyaJvIJ6.js +100 -0
- package/dist/packem_shared/{reference-view-B4E49Lip.js → reference-view-DUULLuOi.js} +8 -61
- package/dist/packem_shared/result-chart-DZradBAS.js +119 -0
- package/dist/packem_shared/scroll-area-DLhcy-ml.js +93 -0
- package/dist/packem_shared/select-UkNYCT3s.js +273 -0
- package/dist/packem_shared/shard-history-AxiJ1WPP.js +16 -0
- package/dist/packem_shared/skeleton-CGhL0p20.js +45 -0
- package/dist/packem_shared/{sparkline-10dG-_f0.js → sparkline-BnA1kC9X.js} +1 -1
- package/dist/packem_shared/studio-WZUOecDv.js +4069 -0
- package/dist/packem_shared/{table-_RzNvy3R.js → table-DsCa9Qp9.js} +1 -1
- package/dist/packem_shared/{table-list-sidebar-Bg7uzbvC.js → table-list-sidebar-huX4VmgI.js} +19 -9
- package/dist/packem_shared/use-admin-query-BGJ010yZ.js +106 -0
- package/dist/packem_shared/use-async-submit-DGCtuDyz.js +91 -0
- package/dist/standalone/chunk-22C6COGE.js +13 -0
- package/dist/standalone/chunk-2CCWLKQW.js +1 -0
- package/dist/standalone/chunk-2JTPX3CV.js +1 -0
- package/dist/standalone/chunk-2K47A3P6.js +1 -0
- package/dist/standalone/chunk-2MLA6WFH.js +1 -0
- package/dist/standalone/chunk-2NGUNNGW.js +1 -0
- package/dist/standalone/chunk-3CPQ5IQU.js +1 -0
- package/dist/standalone/chunk-3GXGLNKW.js +1 -0
- package/dist/standalone/chunk-3OA7PECS.js +6 -0
- package/dist/standalone/chunk-4AXW2ECS.js +13 -0
- package/dist/standalone/chunk-4BVRLBEW.js +1 -0
- package/dist/standalone/chunk-4PC7IXNY.js +1 -0
- package/dist/standalone/chunk-4QHKBC77.js +1 -0
- package/dist/standalone/chunk-5OIBXYZM.js +1 -0
- package/dist/standalone/chunk-5OZQHQ26.js +1 -0
- package/dist/standalone/chunk-6RREMPQX.js +2 -0
- package/dist/standalone/chunk-6ZBU3JWR.js +3 -0
- package/dist/standalone/chunk-7LDYSHOU.js +1 -0
- package/dist/standalone/chunk-7TJJXVSE.js +1 -0
- package/dist/standalone/chunk-A2DBMISD.js +1 -0
- package/dist/standalone/chunk-A3ZJACVT.js +4 -0
- package/dist/standalone/chunk-A66LI6OV.js +4 -0
- package/dist/standalone/chunk-AHILM3ZP.js +1 -0
- package/dist/standalone/chunk-AITOCPML.js +1 -0
- package/dist/standalone/chunk-APSSZB6Z.js +1 -0
- package/dist/standalone/chunk-BGG56IF5.js +1 -0
- package/dist/standalone/chunk-BJGBHGK3.js +1 -0
- package/dist/standalone/chunk-CJXJIRSN.js +1 -0
- package/dist/standalone/chunk-CKSHCYGC.js +2 -0
- package/dist/standalone/chunk-DR6LGPXE.js +1 -0
- package/dist/standalone/chunk-DWDILV2E.js +1 -0
- package/dist/standalone/chunk-EEWKIQUE.js +1 -0
- package/dist/standalone/chunk-EOE5NDMK.js +1 -0
- package/dist/standalone/chunk-FAUN4Z72.js +1 -0
- package/dist/standalone/chunk-G7ZBM54M.js +1 -0
- package/dist/standalone/chunk-GTM65MVX.js +1 -0
- package/dist/standalone/chunk-HAJSYWFT.js +8 -0
- package/dist/standalone/chunk-HQM6MBPS.js +1 -0
- package/dist/standalone/chunk-HTQNZXDT.js +1 -0
- package/dist/standalone/chunk-HV7G6DFP.js +5 -0
- package/dist/standalone/chunk-IO2XEI6T.js +1 -0
- package/dist/standalone/chunk-ITQKVEP7.js +19 -0
- package/dist/standalone/chunk-IZN4TYMN.js +1 -0
- package/dist/standalone/chunk-J6J54MBP.js +1 -0
- package/dist/standalone/chunk-JM7XBQVK.js +1 -0
- package/dist/standalone/chunk-JPILGFXT.js +1 -0
- package/dist/standalone/chunk-JSEXCW5Q.js +1 -0
- package/dist/standalone/chunk-JUDPYSJZ.js +1 -0
- package/dist/standalone/chunk-K4S652EQ.js +4 -0
- package/dist/standalone/chunk-KEGAWN6Y.js +1 -0
- package/dist/standalone/chunk-KJFFID72.js +1 -0
- package/dist/standalone/chunk-KJJ3WM6H.js +4 -0
- package/dist/standalone/chunk-KZ6INM5M.js +1 -0
- package/dist/standalone/chunk-L7SK4ZZD.js +1 -0
- package/dist/standalone/chunk-LAK5VSPI.js +1 -0
- package/dist/standalone/chunk-LJAAZNQ6.js +1 -0
- package/dist/standalone/chunk-LUP4YTBS.js +1 -0
- package/dist/standalone/chunk-LX7KONE3.js +1 -0
- package/dist/standalone/chunk-MDTNVR3G.js +1 -0
- package/dist/standalone/chunk-NS23QR4W.js +1 -0
- package/dist/standalone/chunk-NW6SZZ5O.js +1 -0
- package/dist/standalone/chunk-O3NAGRTR.js +1 -0
- package/dist/standalone/chunk-P2ERTKMB.js +1 -0
- package/dist/standalone/chunk-PS3XCCZD.js +1 -0
- package/dist/standalone/chunk-QAFAJBAW.js +1 -0
- package/dist/standalone/chunk-RRCPZMC2.js +22 -0
- package/dist/standalone/chunk-RS7S7XVP.js +1 -0
- package/dist/standalone/chunk-S5NTGHCG.js +1 -0
- package/dist/standalone/chunk-S7AB7Y75.js +1 -0
- package/dist/standalone/chunk-SDMZKBTD.js +1 -0
- package/dist/standalone/chunk-SDQE2IUJ.js +1 -0
- package/dist/standalone/chunk-SEU5V7I6.js +1 -0
- package/dist/standalone/chunk-SHERR7ZP.js +1 -0
- package/dist/standalone/chunk-SHJUAHC6.js +1 -0
- package/dist/standalone/chunk-TAD43CG5.js +1 -0
- package/dist/standalone/chunk-TO6D2PJC.js +6 -0
- package/dist/standalone/chunk-TQ36RWOP.js +1 -0
- package/dist/standalone/chunk-TYN6SQ73.js +1 -0
- package/dist/standalone/chunk-U26QNHMO.js +1 -0
- package/dist/standalone/chunk-UK64ZSUW.js +1 -0
- package/dist/standalone/chunk-UTHHHJYS.js +1 -0
- package/dist/standalone/chunk-V43BLH4J.js +1 -0
- package/dist/standalone/chunk-VL23Y44O.js +4 -0
- package/dist/standalone/chunk-VL6HOZHF.js +1 -0
- package/dist/standalone/chunk-VLXV72QE.js +1 -0
- package/dist/standalone/chunk-W666BB6V.js +1 -0
- package/dist/standalone/chunk-W6JKUZKD.js +1 -0
- package/dist/standalone/chunk-WI7GWFEG.js +1 -0
- package/dist/standalone/chunk-WUFVFVHJ.js +1 -0
- package/dist/standalone/chunk-WVTPZ6CM.js +1 -0
- package/dist/standalone/chunk-X2TQRMQV.js +1 -0
- package/dist/standalone/chunk-X4676IX6.js +1 -0
- package/dist/standalone/chunk-X4QFAAZ5.js +76 -0
- package/dist/standalone/chunk-XJU5SRNL.js +4 -0
- package/dist/standalone/chunk-XNJNSCLM.js +1 -0
- package/dist/standalone/chunk-XWPZBZSZ.js +3 -0
- package/dist/standalone/chunk-YLHDKM2P.js +1 -0
- package/dist/standalone/chunk-ZHVTQ37P.js +1 -0
- package/dist/standalone/chunk-ZIGWVHCS.js +1 -0
- package/dist/standalone/chunk-ZPP2KOR4.js +1 -0
- package/dist/standalone/chunk-ZPUO7FNI.js +1 -0
- package/dist/standalone/studio.js +104 -246
- package/dist/styles.css +2 -2
- package/package.json +17 -15
- package/dist/packem_shared/HomePanel-Cw16stjq.js +0 -1273
- package/dist/packem_shared/SettingsPanel-C0uLRf5P.js +0 -176
- package/dist/packem_shared/SqlEditorPanel-CguV7otm.js +0 -13
- package/dist/packem_shared/Studio-BmSGSIuY.js +0 -33
- package/dist/packem_shared/internal-rXJEAhXS.js +0 -68
- package/dist/packem_shared/shard-history-DyebH1R5.js +0 -38
- package/dist/packem_shared/studio-H9fuQgSj.js +0 -10303
- package/dist/packem_shared/use-live-admin-Dq6g3daN.js +0 -73
- package/dist/packem_shared/use-live-shard-seed-Cuk3dnH0.js +0 -76
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as At,b as re}from"./chunk-BGG56IF5.js";import{a as Dt}from"./chunk-AHILM3ZP.js";import{a as It}from"./chunk-J6J54MBP.js";import{a as ce}from"./chunk-W666BB6V.js";import{a as pt,b as yt,c as Ct,d as Ze,e as ae,f as ne}from"./chunk-GTM65MVX.js";import{a as ht,e as bt}from"./chunk-SEU5V7I6.js";import{a as xt}from"./chunk-VLXV72QE.js";import{a as zt}from"./chunk-JSEXCW5Q.js";import{R as Y}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as E}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-CKSHCYGC.js";import{f as ie}from"./chunk-SDMZKBTD.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as me}from"./chunk-TAD43CG5.js";import{d as X,k as z,l as St,p as Nt}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as n,e as vt,f as Rt,g as Et,h as Lt}from"./chunk-RRCPZMC2.js";var W=vt(Et(),1);var L=vt(Rt(),1);var o=vt(Lt(),1);var Tt=n(t=>{let e=JSON.parse(t);if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError("Expected a JSON object");return e},"parseJsonObject"),jt=n(t=>{let e=Tt(t),l={};for(let[d,f]of Object.entries(e)){if(!Array.isArray(f)||f.some(r=>typeof r!="string"))throw new TypeError(`"${d}" must map to an array of action strings`);l[d]=f}return l},"parsePermission"),Mt=n(t=>t==null||t===""?"":typeof t=="string"?t:JSON.stringify(t,null,2),"jsonInitial"),K=n(t=>{let e=(0,W.c)(6),{children:l,htmlFor:d,label:f}=t,r;e[0]!==d||e[1]!==f?(r=(0,o.jsxDEV)(zt,{htmlFor:d,children:f},void 0,!1),e[0]=d,e[1]=f,e[2]=r):r=e[2];let i;return e[3]!==l||e[4]!==r?(i=(0,o.jsxDEV)("div",{className:"flex flex-col gap-1",children:[r,l]},void 0,!0),e[3]=l,e[4]=r,e[5]=i):i=e[5],i},"Field"),de=n(({busy:t,canSubmit:e,children:l,destructive:d=!1,error:f,onClose:r,onSubmit:i,submitLabel:s,testId:a,title:m})=>{let c=X();return(0,o.jsxDEV)(Dt,{label:m,onClose:r,panelTestId:`${a}-panel`,testId:`${a}-overlay`,variant:"dialog",children:[(0,o.jsxDEV)("h2",{className:"text-sm font-semibold text-foreground",children:m},void 0,!1),l,f!==null&&(0,o.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":`${a}-error`,role:"alert",children:f},void 0,!1),(0,o.jsxDEV)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,o.jsxDEV)(E,{"data-testid":`${a}-cancel`,onClick:r,size:"sm",type:"button",variant:"outline",children:c("Cancel")},void 0,!1),(0,o.jsxDEV)(E,{"data-testid":`${a}-submit`,disabled:t||!e,onClick:i,size:"sm",type:"button",variant:d?"destructive":"default",children:t?c("Saving\u2026"):s},void 0,!1)]},void 0,!0)]},void 0,!0)},"DialogForm"),Ot=n(t=>{let e=(0,W.c)(79),{mode:l,onClose:d,onDone:f,org:r}=t,i=ie(),s=X(),{busy:a,error:m,run:c}=re(),k;e[0]!==r?(k=r?z(r.name):"",e[0]=r,e[1]=k):k=e[1];let[u,g]=(0,L.useState)(k),y;e[2]!==r?(y=r?z(r.slug):"",e[2]=r,e[3]=y):y=e[3];let[h,b]=(0,L.useState)(y),w;e[4]!==r?(w=r?z(r.logo):"",e[4]=r,e[5]=w):w=e[5];let[p,I]=(0,L.useState)(w),[v,S]=(0,L.useState)(""),C;e[6]!==l||e[7]!==r?.metadata?(C=l==="edit"?Mt(r?.metadata):"",e[6]=l,e[7]=r?.metadata,e[8]=C):C=e[8];let[x,N]=(0,L.useState)(C),_;e[9]!==i||e[10]!==p||e[11]!==x||e[12]!==l||e[13]!==u||e[14]!==d||e[15]!==f||e[16]!==r?.id||e[17]!==v||e[18]!==c||e[19]!==h?(_=n(()=>{c(async()=>{let V=x.trim()===""?void 0:Tt(x);l==="create"?await i.createAuthOrganization({logo:p.trim()===""?void 0:p.trim(),metadata:V,name:u.trim(),ownerId:v.trim()===""?void 0:v.trim(),slug:h.trim()===""?void 0:h.trim()}):await i.updateAuthOrganization({logo:p.trim()===""?void 0:p.trim(),metadata:V,name:u.trim()===""?void 0:u.trim(),organizationId:z(r?.id),slug:h.trim()===""?void 0:h.trim()}),f(),d()})},"t5"),e[9]=i,e[10]=p,e[11]=x,e[12]=l,e[13]=u,e[14]=d,e[15]=f,e[16]=r?.id,e[17]=v,e[18]=c,e[19]=h,e[20]=_):_=e[20];let A=_,D;e[21]!==l||e[22]!==u?(D=u.trim()!==""||l==="edit",e[21]=l,e[22]=u,e[23]=D):D=e[23];let T;e[24]!==l||e[25]!==s?(T=s(l==="create"?"Create":"Save"),e[24]=l,e[25]=s,e[26]=T):T=e[26];let $;e[27]!==l||e[28]!==s?($=s(l==="create"?"New organization":"Edit organization"),e[27]=l,e[28]=s,e[29]=$):$=e[29];let j;e[30]!==s?(j=s("name"),e[30]=s,e[31]=j):j=e[31];let U;e[32]===Symbol.for("react.memo_cache_sentinel")?(U=n(V=>{g(V.target.value)},"t10"),e[32]=U):U=e[32];let P;e[33]!==u?(P=(0,o.jsxDEV)(Y,{"data-testid":"org-form-name",id:"org-form-name",onChange:U,value:u},void 0,!1),e[33]=u,e[34]=P):P=e[34];let Q;e[35]!==P||e[36]!==j?(Q=(0,o.jsxDEV)(K,{htmlFor:"org-form-name",label:j,children:P},void 0,!1),e[35]=P,e[36]=j,e[37]=Q):Q=e[37];let J;e[38]!==s?(J=s("Slug (optional \u2014 derived from name)"),e[38]=s,e[39]=J):J=e[39];let q;e[40]===Symbol.for("react.memo_cache_sentinel")?(q=n(V=>{b(V.target.value)},"t14"),e[40]=q):q=e[40];let M;e[41]!==h?(M=(0,o.jsxDEV)(Y,{"data-testid":"org-form-slug",id:"org-form-slug",onChange:q,value:h},void 0,!1),e[41]=h,e[42]=M):M=e[42];let F;e[43]!==J||e[44]!==M?(F=(0,o.jsxDEV)(K,{htmlFor:"org-form-slug",label:J,children:M},void 0,!1),e[43]=J,e[44]=M,e[45]=F):F=e[45];let B;e[46]!==s?(B=s("Logo URL (optional)"),e[46]=s,e[47]=B):B=e[47];let oe;e[48]===Symbol.for("react.memo_cache_sentinel")?(oe=n(V=>{I(V.target.value)},"t18"),e[48]=oe):oe=e[48];let Z;e[49]!==p?(Z=(0,o.jsxDEV)(Y,{"data-testid":"org-form-logo",id:"org-form-logo",onChange:oe,value:p},void 0,!1),e[49]=p,e[50]=Z):Z=e[50];let ee;e[51]!==B||e[52]!==Z?(ee=(0,o.jsxDEV)(K,{htmlFor:"org-form-logo",label:B,children:Z},void 0,!1),e[51]=B,e[52]=Z,e[53]=ee):ee=e[53];let O;e[54]!==l||e[55]!==v||e[56]!==s?(O=l==="create"&&(0,o.jsxDEV)(K,{htmlFor:"org-form-owner",label:s("Owner user id (optional)"),children:(0,o.jsxDEV)(Y,{"data-testid":"org-form-owner",id:"org-form-owner",onChange:n(V=>{S(V.target.value)},"onChange"),value:v},void 0,!1)},void 0,!1),e[54]=l,e[55]=v,e[56]=s,e[57]=O):O=e[57];let te;e[58]!==s?(te=s("Metadata (JSON, optional)"),e[58]=s,e[59]=te):te=e[59];let G;e[60]===Symbol.for("react.memo_cache_sentinel")?(G=n(V=>{N(V.target.value)},"t23"),e[60]=G):G=e[60];let le;e[61]!==x?(le=(0,o.jsxDEV)(xt,{"data-testid":"org-form-metadata",id:"org-form-metadata",onChange:G,value:x},void 0,!1),e[61]=x,e[62]=le):le=e[62];let H;e[63]!==te||e[64]!==le?(H=(0,o.jsxDEV)(K,{htmlFor:"org-form-metadata",label:te,children:le},void 0,!1),e[63]=te,e[64]=le,e[65]=H):H=e[65];let se;return e[66]!==a||e[67]!==m||e[68]!==d||e[69]!==A||e[70]!==Q||e[71]!==F||e[72]!==ee||e[73]!==O||e[74]!==H||e[75]!==D||e[76]!==T||e[77]!==$?(se=(0,o.jsxDEV)(de,{busy:a,canSubmit:D,error:m,onClose:d,onSubmit:A,submitLabel:T,testId:"org-form",title:$,children:[Q,F,ee,O,H]},void 0,!0),e[66]=a,e[67]=m,e[68]=d,e[69]=A,e[70]=Q,e[71]=F,e[72]=ee,e[73]=O,e[74]=H,e[75]=D,e[76]=T,e[77]=$,e[78]=se):se=e[78],se},"OrgFormDialog"),Pt=n(t=>{let e=(0,W.c)(40),{onClose:l,onDone:d,organizationId:f}=t,r=ie(),i=X(),{busy:s,error:a,run:m}=re(),[c,k]=(0,L.useState)(""),[u,g]=(0,L.useState)(""),y;e[0]!==r||e[1]!==l||e[2]!==d||e[3]!==f||e[4]!==u||e[5]!==m||e[6]!==c?(y=n(()=>{m(async()=>{await r.addAuthOrgMember({organizationId:f,role:u.trim()===""?void 0:u.trim(),userId:c.trim()}),d(),l()})},"t1"),e[0]=r,e[1]=l,e[2]=d,e[3]=f,e[4]=u,e[5]=m,e[6]=c,e[7]=y):y=e[7];let h=y,b;e[8]!==c?(b=c.trim(),e[8]=c,e[9]=b):b=e[9];let w=b!=="",p;e[10]!==i?(p=i("Add member"),e[10]=i,e[11]=p):p=e[11];let I;e[12]!==i?(I=i("Add member"),e[12]=i,e[13]=I):I=e[13];let v;e[14]!==i?(v=i("User id"),e[14]=i,e[15]=v):v=e[15];let S;e[16]===Symbol.for("react.memo_cache_sentinel")?(S=n($=>{k($.target.value)},"t7"),e[16]=S):S=e[16];let C;e[17]!==c?(C=(0,o.jsxDEV)(Y,{"data-testid":"org-add-member-user",id:"org-add-member-user",onChange:S,value:c},void 0,!1),e[17]=c,e[18]=C):C=e[18];let x;e[19]!==v||e[20]!==C?(x=(0,o.jsxDEV)(K,{htmlFor:"org-add-member-user",label:v,children:C},void 0,!1),e[19]=v,e[20]=C,e[21]=x):x=e[21];let N;e[22]!==i?(N=i("Role (optional)"),e[22]=i,e[23]=N):N=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=n($=>{g($.target.value)},"t11"),e[24]=_):_=e[24];let A;e[25]!==u?(A=(0,o.jsxDEV)(Y,{"data-testid":"org-add-member-role",id:"org-add-member-role",onChange:_,value:u},void 0,!1),e[25]=u,e[26]=A):A=e[26];let D;e[27]!==N||e[28]!==A?(D=(0,o.jsxDEV)(K,{htmlFor:"org-add-member-role",label:N,children:A},void 0,!1),e[27]=N,e[28]=A,e[29]=D):D=e[29];let T;return e[30]!==s||e[31]!==a||e[32]!==l||e[33]!==h||e[34]!==D||e[35]!==w||e[36]!==p||e[37]!==I||e[38]!==x?(T=(0,o.jsxDEV)(de,{busy:s,canSubmit:w,error:a,onClose:l,onSubmit:h,submitLabel:p,testId:"org-add-member",title:I,children:[x,D]},void 0,!0),e[30]=s,e[31]=a,e[32]=l,e[33]=h,e[34]=D,e[35]=w,e[36]=p,e[37]=I,e[38]=x,e[39]=T):T=e[39],T},"MemberAddDialog"),Qt=n(t=>{let e=(0,W.c)(40),{onClose:l,onDone:d,organizationId:f}=t,r=ie(),i=X(),{busy:s,error:a,run:m}=re(),[c,k]=(0,L.useState)(""),[u,g]=(0,L.useState)(""),y;e[0]!==r||e[1]!==c||e[2]!==l||e[3]!==d||e[4]!==f||e[5]!==u||e[6]!==m?(y=n(()=>{m(async()=>{await r.inviteAuthOrgMember({email:c.trim(),organizationId:f,role:u.trim()===""?void 0:u.trim()}),d(),l()})},"t1"),e[0]=r,e[1]=c,e[2]=l,e[3]=d,e[4]=f,e[5]=u,e[6]=m,e[7]=y):y=e[7];let h=y,b;e[8]!==c?(b=c.trim(),e[8]=c,e[9]=b):b=e[9];let w=b!=="",p;e[10]!==i?(p=i("Send invitation"),e[10]=i,e[11]=p):p=e[11];let I;e[12]!==i?(I=i("Invite member"),e[12]=i,e[13]=I):I=e[13];let v;e[14]!==i?(v=i("email"),e[14]=i,e[15]=v):v=e[15];let S;e[16]===Symbol.for("react.memo_cache_sentinel")?(S=n($=>{k($.target.value)},"t7"),e[16]=S):S=e[16];let C;e[17]!==c?(C=(0,o.jsxDEV)(Y,{"data-testid":"org-invite-member-email",id:"org-invite-member-email",onChange:S,type:"email",value:c},void 0,!1),e[17]=c,e[18]=C):C=e[18];let x;e[19]!==v||e[20]!==C?(x=(0,o.jsxDEV)(K,{htmlFor:"org-invite-member-email",label:v,children:C},void 0,!1),e[19]=v,e[20]=C,e[21]=x):x=e[21];let N;e[22]!==i?(N=i("Role (optional)"),e[22]=i,e[23]=N):N=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=n($=>{g($.target.value)},"t11"),e[24]=_):_=e[24];let A;e[25]!==u?(A=(0,o.jsxDEV)(Y,{"data-testid":"org-invite-member-role",id:"org-invite-member-role",onChange:_,value:u},void 0,!1),e[25]=u,e[26]=A):A=e[26];let D;e[27]!==N||e[28]!==A?(D=(0,o.jsxDEV)(K,{htmlFor:"org-invite-member-role",label:N,children:A},void 0,!1),e[27]=N,e[28]=A,e[29]=D):D=e[29];let T;return e[30]!==s||e[31]!==a||e[32]!==l||e[33]!==h||e[34]!==D||e[35]!==w||e[36]!==p||e[37]!==I||e[38]!==x?(T=(0,o.jsxDEV)(de,{busy:s,canSubmit:w,error:a,onClose:l,onSubmit:h,submitLabel:p,testId:"org-invite-member",title:I,children:[x,D]},void 0,!0),e[30]=s,e[31]=a,e[32]=l,e[33]=h,e[34]=D,e[35]=w,e[36]=p,e[37]=I,e[38]=x,e[39]=T):T=e[39],T},"MemberInviteDialog"),Jt=n(t=>{let e=(0,W.c)(32),{member:l,onClose:d,onDone:f}=t,r=ie(),i=X(),{busy:s,error:a,run:m}=re(),c;e[0]!==l.role?(c=z(l.role),e[0]=l.role,e[1]=c):c=e[1];let[k,u]=(0,L.useState)(c),g;e[2]!==r||e[3]!==l.id||e[4]!==d||e[5]!==f||e[6]!==k||e[7]!==m?(g=n(()=>{m(async()=>{await r.setAuthOrgMemberRole({memberId:z(l.id),role:k.trim()}),f(),d()})},"t2"),e[2]=r,e[3]=l.id,e[4]=d,e[5]=f,e[6]=k,e[7]=m,e[8]=g):g=e[8];let y=g,h;e[9]!==k?(h=k.trim(),e[9]=k,e[10]=h):h=e[10];let b=h!=="",w;e[11]!==i?(w=i("Save"),e[11]=i,e[12]=w):w=e[12];let p;e[13]!==i?(p=i("Change member role"),e[13]=i,e[14]=p):p=e[14];let I;e[15]!==i?(I=i("Role"),e[15]=i,e[16]=I):I=e[16];let v;e[17]===Symbol.for("react.memo_cache_sentinel")?(v=n(N=>{u(N.target.value)},"t8"),e[17]=v):v=e[17];let S;e[18]!==k?(S=(0,o.jsxDEV)(Y,{"data-testid":"org-member-role-value",id:"org-member-role-value",onChange:v,value:k},void 0,!1),e[18]=k,e[19]=S):S=e[19];let C;e[20]!==I||e[21]!==S?(C=(0,o.jsxDEV)(K,{htmlFor:"org-member-role-value",label:I,children:S},void 0,!1),e[20]=I,e[21]=S,e[22]=C):C=e[22];let x;return e[23]!==s||e[24]!==a||e[25]!==d||e[26]!==y||e[27]!==C||e[28]!==b||e[29]!==w||e[30]!==p?(x=(0,o.jsxDEV)(de,{busy:s,canSubmit:b,error:a,onClose:d,onSubmit:y,submitLabel:w,testId:"org-member-role",title:p,children:C},void 0,!1),e[23]=s,e[24]=a,e[25]=d,e[26]=y,e[27]=C,e[28]=b,e[29]=w,e[30]=p,e[31]=x):x=e[31],x},"MemberRoleDialog"),_t=n(t=>{let e=(0,W.c)(36),{mode:l,onClose:d,onDone:f,organizationId:r,team:i}=t,s=ie(),a=X(),{busy:m,error:c,run:k}=re(),u;e[0]!==i?(u=i?z(i.name):"",e[0]=i,e[1]=u):u=e[1];let[g,y]=(0,L.useState)(u),h;e[2]!==s||e[3]!==l||e[4]!==g||e[5]!==d||e[6]!==f||e[7]!==r||e[8]!==k||e[9]!==i?.id?(h=n(()=>{k(async()=>{await(l==="create"?s.createAuthOrgTeam({name:g.trim(),organizationId:r}):s.updateAuthOrgTeam({name:g.trim(),teamId:z(i?.id)})),f(),d()})},"t2"),e[2]=s,e[3]=l,e[4]=g,e[5]=d,e[6]=f,e[7]=r,e[8]=k,e[9]=i?.id,e[10]=h):h=e[10];let b=h,w;e[11]!==g?(w=g.trim(),e[11]=g,e[12]=w):w=e[12];let p=w!=="",I;e[13]!==l||e[14]!==a?(I=a(l==="create"?"Create":"Save"),e[13]=l,e[14]=a,e[15]=I):I=e[15];let v;e[16]!==l||e[17]!==a?(v=a(l==="create"?"New team":"Rename team"),e[16]=l,e[17]=a,e[18]=v):v=e[18];let S;e[19]!==a?(S=a("name"),e[19]=a,e[20]=S):S=e[20];let C;e[21]===Symbol.for("react.memo_cache_sentinel")?(C=n(A=>{y(A.target.value)},"t8"),e[21]=C):C=e[21];let x;e[22]!==g?(x=(0,o.jsxDEV)(Y,{"data-testid":"org-team-form-name",id:"org-team-form-name",onChange:C,value:g},void 0,!1),e[22]=g,e[23]=x):x=e[23];let N;e[24]!==S||e[25]!==x?(N=(0,o.jsxDEV)(K,{htmlFor:"org-team-form-name",label:S,children:x},void 0,!1),e[24]=S,e[25]=x,e[26]=N):N=e[26];let _;return e[27]!==m||e[28]!==c||e[29]!==d||e[30]!==b||e[31]!==N||e[32]!==p||e[33]!==I||e[34]!==v?(_=(0,o.jsxDEV)(de,{busy:m,canSubmit:p,error:c,onClose:d,onSubmit:b,submitLabel:I,testId:"org-team-form",title:v,children:N},void 0,!1),e[27]=m,e[28]=c,e[29]=d,e[30]=b,e[31]=N,e[32]=p,e[33]=I,e[34]=v,e[35]=_):_=e[35],_},"TeamFormDialog"),Ut=n(t=>{let e=(0,W.c)(30),{onClose:l,onDone:d,teamId:f}=t,r=ie(),i=X(),{busy:s,error:a,run:m}=re(),[c,k]=(0,L.useState)(""),u;e[0]!==r||e[1]!==l||e[2]!==d||e[3]!==m||e[4]!==f||e[5]!==c?(u=n(()=>{m(async()=>{await r.addAuthOrgTeamMember({teamId:f,userId:c.trim()}),d(),l()})},"t1"),e[0]=r,e[1]=l,e[2]=d,e[3]=m,e[4]=f,e[5]=c,e[6]=u):u=e[6];let g=u,y;e[7]!==c?(y=c.trim(),e[7]=c,e[8]=y):y=e[8];let h=y!=="",b;e[9]!==i?(b=i("Add member"),e[9]=i,e[10]=b):b=e[10];let w;e[11]!==i?(w=i("Add team member"),e[11]=i,e[12]=w):w=e[12];let p;e[13]!==i?(p=i("User id"),e[13]=i,e[14]=p):p=e[14];let I;e[15]===Symbol.for("react.memo_cache_sentinel")?(I=n(x=>{k(x.target.value)},"t7"),e[15]=I):I=e[15];let v;e[16]!==c?(v=(0,o.jsxDEV)(Y,{"data-testid":"org-team-add-member-user",id:"org-team-add-member-user",onChange:I,value:c},void 0,!1),e[16]=c,e[17]=v):v=e[17];let S;e[18]!==p||e[19]!==v?(S=(0,o.jsxDEV)(K,{htmlFor:"org-team-add-member-user",label:p,children:v},void 0,!1),e[18]=p,e[19]=v,e[20]=S):S=e[20];let C;return e[21]!==s||e[22]!==a||e[23]!==l||e[24]!==g||e[25]!==h||e[26]!==b||e[27]!==w||e[28]!==S?(C=(0,o.jsxDEV)(de,{busy:s,canSubmit:h,error:a,onClose:l,onSubmit:g,submitLabel:b,testId:"org-team-add-member",title:w,children:S},void 0,!1),e[21]=s,e[22]=a,e[23]=l,e[24]=g,e[25]=h,e[26]=b,e[27]=w,e[28]=S,e[29]=C):C=e[29],C},"TeamMemberAddDialog"),$t=n(t=>{let e=(0,W.c)(47),{mode:l,onClose:d,onDone:f,organizationId:r,role:i}=t,s=ie(),a=X(),{busy:m,error:c,run:k}=re(),u;e[0]!==i?(u=i?z(i.role):"",e[0]=i,e[1]=u):u=e[1];let[g,y]=(0,L.useState)(u),h;e[2]!==l||e[3]!==i?.permission?(h=l==="edit"?Mt(i?.permission):"",e[2]=l,e[3]=i?.permission,e[4]=h):h=e[4];let[b,w]=(0,L.useState)(h),p;e[5]!==s||e[6]!==l||e[7]!==g||e[8]!==d||e[9]!==f||e[10]!==r||e[11]!==b||e[12]!==i?.id||e[13]!==k?(p=n(()=>{k(async()=>{let $=jt(b);await(l==="create"?s.createAuthOrgRole({organizationId:r,permission:$,role:g.trim()}):s.updateAuthOrgRole({permission:$,roleId:z(i?.id)})),f(),d()})},"t3"),e[5]=s,e[6]=l,e[7]=g,e[8]=d,e[9]=f,e[10]=r,e[11]=b,e[12]=i?.id,e[13]=k,e[14]=p):p=e[14];let I=p,v;e[15]!==l||e[16]!==g||e[17]!==b?(v=b.trim()!==""&&(l==="edit"||g.trim()!==""),e[15]=l,e[16]=g,e[17]=b,e[18]=v):v=e[18];let S;e[19]!==l||e[20]!==a?(S=a(l==="create"?"Create":"Save"),e[19]=l,e[20]=a,e[21]=S):S=e[21];let C;e[22]!==l||e[23]!==a?(C=a(l==="create"?"New role":"Edit role"),e[22]=l,e[23]=a,e[24]=C):C=e[24];let x;e[25]!==l||e[26]!==g||e[27]!==a?(x=l==="create"&&(0,o.jsxDEV)(K,{htmlFor:"org-role-form-name",label:a("Role name"),children:(0,o.jsxDEV)(Y,{"data-testid":"org-role-form-name",id:"org-role-form-name",onChange:n($=>{y($.target.value)},"onChange"),value:g},void 0,!1)},void 0,!1),e[25]=l,e[26]=g,e[27]=a,e[28]=x):x=e[28];let N;e[29]!==a?(N=a('Permission (JSON, e.g. {"project":["create","update"]})'),e[29]=a,e[30]=N):N=e[30];let _;e[31]===Symbol.for("react.memo_cache_sentinel")?(_=n($=>{w($.target.value)},"t9"),e[31]=_):_=e[31];let A;e[32]!==b?(A=(0,o.jsxDEV)(xt,{"data-testid":"org-role-form-permission",id:"org-role-form-permission",onChange:_,value:b},void 0,!1),e[32]=b,e[33]=A):A=e[33];let D;e[34]!==A||e[35]!==N?(D=(0,o.jsxDEV)(K,{htmlFor:"org-role-form-permission",label:N,children:A},void 0,!1),e[34]=A,e[35]=N,e[36]=D):D=e[36];let T;return e[37]!==m||e[38]!==c||e[39]!==d||e[40]!==I||e[41]!==D||e[42]!==v||e[43]!==S||e[44]!==C||e[45]!==x?(T=(0,o.jsxDEV)(de,{busy:m,canSubmit:v,error:c,onClose:d,onSubmit:I,submitLabel:S,testId:"org-role-form",title:C,children:[x,D]},void 0,!0),e[37]=m,e[38]=c,e[39]=d,e[40]=I,e[41]=D,e[42]=v,e[43]=S,e[44]=C,e[45]=x,e[46]=T):T=e[46],T},"RoleFormDialog"),Ft=n(t=>{let e=(0,W.c)(18),{action:l,message:d,onClose:f,onDone:r,testId:i,title:s}=t,a=X(),{busy:m,error:c,run:k}=re(),u;e[0]!==l||e[1]!==f||e[2]!==r||e[3]!==k?(u=n(()=>{k(async()=>{await l(),r(),f()})},"t1"),e[0]=l,e[1]=f,e[2]=r,e[3]=k,e[4]=u):u=e[4];let g=u,y;e[5]!==a?(y=a("Delete"),e[5]=a,e[6]=y):y=e[6];let h;e[7]!==d?(h=(0,o.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:d},void 0,!1),e[7]=d,e[8]=h):h=e[8];let b;return e[9]!==m||e[10]!==c||e[11]!==f||e[12]!==g||e[13]!==y||e[14]!==h||e[15]!==i||e[16]!==s?(b=(0,o.jsxDEV)(de,{busy:m,canSubmit:!0,destructive:!0,error:c,onClose:f,onSubmit:g,submitLabel:y,testId:i,title:s,children:h},void 0,!1),e[9]=m,e[10]=c,e[11]=f,e[12]=g,e[13]=y,e[14]=h,e[15]=i,e[16]=s,e[17]=b):b=e[17],b},"ConfirmDialog"),et=n(t=>{let e=(0,W.c)(13),{action:l,children:d,heading:f,testId:r}=t,i;e[0]!==f?(i=(0,o.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:f},void 0,!1),e[0]=f,e[1]=i):i=e[1];let s;e[2]!==l?(s=l!==void 0&&(0,o.jsxDEV)("div",{className:"flex items-center gap-2",children:l},void 0,!1),e[2]=l,e[3]=s):s=e[3];let a;e[4]!==i||e[5]!==s?(a=(0,o.jsxDEV)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[i,s]},void 0,!0),e[4]=i,e[5]=s,e[6]=a):a=e[6];let m;e[7]!==d?(m=(0,o.jsxDEV)(bt,{className:"px-0",children:d},void 0,!1),e[7]=d,e[8]=m):m=e[8];let c;return e[9]!==a||e[10]!==m||e[11]!==r?(c=(0,o.jsxDEV)(ht,{className:"overflow-hidden py-0","data-testid":r,children:[a,m]},void 0,!0),e[9]=a,e[10]=m,e[11]=r,e[12]=c):c=e[12],c},"SectionCard"),tt=n(t=>{let e=(0,W.c)(23),{columns:l,rowActions:d,rowPrefix:f,rows:r}=t,i=X(),s;e[0]!==l?(s=l.map(Ht),e[0]=l,e[1]=s):s=e[1];let a;e[2]!==i?(a=i("Actions"),e[2]=i,e[3]=a):a=e[3];let m;e[4]!==a?(m=(0,o.jsxDEV)(ae,{"aria-label":a},void 0,!1),e[4]=a,e[5]=m):m=e[5];let c;e[6]!==s||e[7]!==m?(c=(0,o.jsxDEV)(yt,{children:(0,o.jsxDEV)(Ze,{children:[s,m]},void 0,!0)},void 0,!1),e[6]=s,e[7]=m,e[8]=c):c=e[8];let k;if(e[9]!==l||e[10]!==d||e[11]!==f||e[12]!==r){let y;e[14]!==l||e[15]!==d||e[16]!==f?(y=n(h=>{let b=z(h.id);return(0,o.jsxDEV)(Ze,{"data-testid":`${f}-${b}`,children:[l.map(w=>(0,o.jsxDEV)(ne,{className:w.className,children:w.render(h)},w.head,!1)),(0,o.jsxDEV)(ne,{children:(0,o.jsxDEV)("div",{className:"flex justify-end gap-1",children:d(h)},void 0,!1)},void 0,!1)]},b,!0)},"t62"),e[14]=l,e[15]=d,e[16]=f,e[17]=y):y=e[17],k=r.map(y),e[9]=l,e[10]=d,e[11]=f,e[12]=r,e[13]=k}else k=e[13];let u;e[18]!==k?(u=(0,o.jsxDEV)(Ct,{children:k},void 0,!1),e[18]=k,e[19]=u):u=e[19];let g;return e[20]!==c||e[21]!==u?(g=(0,o.jsxDEV)(pt,{children:[c,u]},void 0,!0),e[20]=c,e[21]=u,e[22]=g):g=e[22],g},"ManagedTable"),Bt=n(t=>{let e=(0,W.c)(213),{organizationId:l,rolesEnabled:d,teamsEnabled:f}=t,r=ie(),i=X(),[s,a]=(0,L.useState)(null),[m,c]=(0,L.useState)(null),k;e[0]!==l?(k=["lunora-auth-org-members",l],e[0]=l,e[1]=k):k=e[1];let u;e[2]!==r||e[3]!==l?(u=n(()=>r.listAuthOrgMembers({limit:200,organizationId:l}),"t2"),e[2]=r,e[3]=l,e[4]=u):u=e[4];let g=ce(k,u),y;e[5]!==l?(y=["lunora-auth-org-invitations",l],e[5]=l,e[6]=y):y=e[6];let h;e[7]!==r||e[8]!==l?(h=n(()=>r.listAuthOrgInvitations({limit:200,organizationId:l}),"t4"),e[7]=r,e[8]=l,e[9]=h):h=e[9];let b=ce(y,h),w;e[10]!==l?(w=["lunora-auth-org-teams",l],e[10]=l,e[11]=w):w=e[11];let p;e[12]!==r||e[13]!==l?(p=n(()=>r.listAuthOrgTeams({limit:200,organizationId:l}),"t6"),e[12]=r,e[13]=l,e[14]=p):p=e[14];let I;e[15]!==f?(I={enabled:f},e[15]=f,e[16]=I):I=e[16];let v=ce(w,p,I),S;e[17]!==l?(S=["lunora-auth-org-roles",l],e[17]=l,e[18]=S):S=e[18];let C;e[19]!==r||e[20]!==l?(C=n(()=>r.listAuthOrgRoles({limit:200,organizationId:l}),"t9"),e[19]=r,e[20]=l,e[21]=C):C=e[21];let x;e[22]!==d?(x={enabled:d},e[22]=d,e[23]=x):x=e[23];let N=ce(S,C,x),_;e[24]!==m?(_=["lunora-auth-org-team-members",m],e[24]=m,e[25]=_):_=e[25];let A;e[26]!==r||e[27]!==m?(A=n(()=>r.listAuthOrgTeamMembers({limit:200,teamId:m??""}),"t12"),e[26]=r,e[27]=m,e[28]=A):A=e[28];let D=m!==null,T;e[29]!==D?(T={enabled:D},e[29]=D,e[30]=T):T=e[30];let $=ce(_,A,T),j;e[31]!==g.data?.rows?(j=g.data?.rows??[],e[31]=g.data?.rows,e[32]=j):j=e[32];let U=j,P;e[33]!==b.data?.rows?(P=b.data?.rows??[],e[33]=b.data?.rows,e[34]=P):P=e[34];let Q=P,J;e[35]!==v.data?.rows?(J=v.data?.rows??[],e[35]=v.data?.rows,e[36]=J):J=e[36];let q=J,M;e[37]!==N.data?.rows?(M=N.data?.rows??[],e[37]=N.data?.rows,e[38]=M):M=e[38];let F=M,B;e[39]!==m||e[40]!==$?(B=m===null?[]:$.data?.rows??[],e[39]=m,e[40]=$,e[41]=B):B=e[41];let oe=B,Z=g.error??b.error??v.error??N.error??$.error,ee;e[42]!==b||e[43]!==g||e[44]!==d||e[45]!==N||e[46]!==m||e[47]!==$||e[48]!==f||e[49]!==v?(ee=n(()=>{g.refetch(),b.refetch(),f&&v.refetch(),d&&N.refetch(),m!==null&&$.refetch()},"t20"),e[42]=b,e[43]=g,e[44]=d,e[45]=N,e[46]=m,e[47]=$,e[48]=f,e[49]=v,e[50]=ee):ee=e[50];let O=ee;It(O,!0);let te;e[51]===Symbol.for("react.memo_cache_sentinel")?(te=n(()=>{a(null)},"t21"),e[51]=te):te=e[51];let G=te,le;e[52]!==O?(le=n(R=>{St((async()=>{await R(),O()})())},"t22"),e[52]=O,e[53]=le):le=e[53];let H=le,se;e[54]!==r||e[55]!==i?(se=n(R=>{let kt=z(R.id);a({action:n(async()=>{await r.removeAuthOrgTeam({teamId:kt}),c(wt=>wt===kt?null:wt)},"action"),kind:"confirm",message:i("Delete this team and its memberships? This cannot be undone."),testId:"org-team-delete",title:i("Delete team")})},"t23"),e[54]=r,e[55]=i,e[56]=se):se=e[56];let V=se,fe;e[57]!==i?(fe=i("userId"),e[57]=i,e[58]=fe):fe=e[58];let ue;e[59]!==fe?(ue={head:fe,render:Vt},e[59]=fe,e[60]=ue):ue=e[60];let ge;e[61]!==i?(ge=i("role"),e[61]=i,e[62]=ge):ge=e[62];let ve;e[63]!==ge?(ve={head:ge,render:qt},e[63]=ge,e[64]=ve):ve=e[64];let lt;e[65]!==ue||e[66]!==ve?(lt=[ue,ve],e[65]=ue,e[66]=ve,e[67]=lt):lt=e[67];let mt=lt,he;e[68]!==i?(he=i("email"),e[68]=i,e[69]=he):he=e[69];let be;e[70]!==he?(be={head:he,render:Gt},e[70]=he,e[71]=be):be=e[71];let pe;e[72]!==i?(pe=i("role"),e[72]=i,e[73]=pe):pe=e[73];let ye;e[74]!==pe?(ye={head:pe,render:Kt},e[74]=pe,e[75]=ye):ye=e[75];let Ce;e[76]!==i?(Ce=i("status"),e[76]=i,e[77]=Ce):Ce=e[77];let xe;e[78]!==Ce?(xe={head:Ce,render:Wt},e[78]=Ce,e[79]=xe):xe=e[79];let it;e[80]!==be||e[81]!==ye||e[82]!==xe?(it=[be,ye,xe],e[80]=be,e[81]=ye,e[82]=xe,e[83]=it):it=e[83];let ct=it,Ie;e[84]!==i?(Ie=i("id"),e[84]=i,e[85]=Ie):Ie=e[85];let ke;e[86]!==Ie?(ke={className:"font-mono text-xs",head:Ie,render:Xt},e[86]=Ie,e[87]=ke):ke=e[87];let we;e[88]!==i?(we=i("name"),e[88]=i,e[89]=we):we=e[89];let Se;e[90]!==we?(Se={head:we,render:Yt},e[90]=we,e[91]=Se):Se=e[91];let ot;e[92]!==ke||e[93]!==Se?(ot=[ke,Se],e[92]=ke,e[93]=Se,e[94]=ot):ot=e[94];let ft=ot,Ne;e[95]!==i?(Ne=i("userId"),e[95]=i,e[96]=Ne):Ne=e[96];let st;e[97]!==Ne?(st=[{head:Ne,render:Zt}],e[97]=Ne,e[98]=st):st=e[98];let ut=st,ze;e[99]!==i?(ze=i("role"),e[99]=i,e[100]=ze):ze=e[100];let Ae;e[101]!==ze?(Ae={head:ze,render:el},e[101]=ze,e[102]=Ae):Ae=e[102];let De;e[103]!==i?(De=i("Permission"),e[103]=i,e[104]=De):De=e[104];let Oe;e[105]!==De?(Oe={className:"font-mono text-xs whitespace-pre-wrap",head:De,render:tl},e[105]=De,e[106]=Oe):Oe=e[106];let rt;e[107]!==Ae||e[108]!==Oe?(rt=[Ae,Oe],e[107]=Ae,e[108]=Oe,e[109]=rt):rt=e[109];let gt=rt,_e;e[110]!==Z?(_e=Z!==null&&(0,o.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"org-detail-error",role:"alert",children:Z},void 0,!1),e[110]=Z,e[111]=_e):_e=e[111];let at;e[112]===Symbol.for("react.memo_cache_sentinel")?(at=n(()=>{a({kind:"add-member"})},"t49"),e[112]=at):at=e[112];let $e;e[113]!==i?($e=i("Add member"),e[113]=i,e[114]=$e):$e=e[114];let Te;e[115]!==$e?(Te=(0,o.jsxDEV)(E,{"data-testid":"org-open-add-member",onClick:at,size:"xs",type:"button",variant:"outline",children:$e},void 0,!1),e[115]=$e,e[116]=Te):Te=e[116];let nt;e[117]===Symbol.for("react.memo_cache_sentinel")?(nt=n(()=>{a({kind:"invite-member"})},"t52"),e[117]=nt):nt=e[117];let Me;e[118]!==i?(Me=i("Invite member"),e[118]=i,e[119]=Me):Me=e[119];let Fe;e[120]!==Me?(Fe=(0,o.jsxDEV)(E,{"data-testid":"org-open-invite-member",onClick:nt,size:"xs",type:"button",variant:"outline",children:Me},void 0,!1),e[120]=Me,e[121]=Fe):Fe=e[121];let Re;e[122]!==Te||e[123]!==Fe?(Re=(0,o.jsxDEV)(o.Fragment,{children:[Te,Fe]},void 0,!0),e[122]=Te,e[123]=Fe,e[124]=Re):Re=e[124];let Ee;e[125]!==i?(Ee=i("Members"),e[125]=i,e[126]=Ee):Ee=e[126];let Le;e[127]!==r||e[128]!==mt||e[129]!==U||e[130]!==H||e[131]!==i?(Le=U.length===0?(0,o.jsxDEV)("div",{className:"p-3",children:(0,o.jsxDEV)(me,{testId:"org-members-empty",title:i("No members.")},void 0,!1)},void 0,!1):(0,o.jsxDEV)(tt,{columns:mt,rowActions:n(R=>(0,o.jsxDEV)(o.Fragment,{children:[(0,o.jsxDEV)(E,{"data-testid":`org-member-role-${z(R.id)}`,onClick:n(()=>{a({kind:"member-role",member:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Change role")},void 0,!1),(0,o.jsxDEV)(E,{"data-testid":`org-remove-member-${z(R.id)}`,onClick:n(()=>{H(()=>r.removeAuthOrgMember({memberId:z(R.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Remove")},void 0,!1)]},void 0,!0),"rowActions"),rowPrefix:"org-member",rows:U},void 0,!1),e[127]=r,e[128]=mt,e[129]=U,e[130]=H,e[131]=i,e[132]=Le):Le=e[132];let je;e[133]!==Re||e[134]!==Ee||e[135]!==Le?(je=(0,o.jsxDEV)(et,{action:Re,heading:Ee,testId:"org-members",children:Le},void 0,!1),e[133]=Re,e[134]=Ee,e[135]=Le,e[136]=je):je=e[136];let Pe;e[137]!==r||e[138]!==ct||e[139]!==Q||e[140]!==H||e[141]!==i?(Pe=Q.length>0&&(0,o.jsxDEV)(et,{heading:i("Invitations"),testId:"org-invitations",children:(0,o.jsxDEV)(tt,{columns:ct,rowActions:n(R=>(0,o.jsxDEV)(E,{"data-testid":`org-cancel-invitation-${z(R.id)}`,onClick:n(()=>{H(()=>r.cancelAuthOrgInvitation({invitationId:z(R.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Cancel")},void 0,!1),"rowActions"),rowPrefix:"org-invitation",rows:Q},void 0,!1)},void 0,!1),e[137]=r,e[138]=ct,e[139]=Q,e[140]=H,e[141]=i,e[142]=Pe):Pe=e[142];let Qe;e[143]!==V||e[144]!==m||e[145]!==i||e[146]!==ft||e[147]!==q||e[148]!==f?(Qe=f&&(0,o.jsxDEV)(et,{action:(0,o.jsxDEV)(E,{"data-testid":"org-open-create-team",onClick:n(()=>{a({kind:"team-create"})},"onClick"),size:"xs",type:"button",variant:"outline",children:i("New team")},void 0,!1),heading:i("Teams"),testId:"org-teams",children:q.length===0?(0,o.jsxDEV)("div",{className:"p-3",children:(0,o.jsxDEV)(me,{testId:"org-teams-empty",title:i("No teams.")},void 0,!1)},void 0,!1):(0,o.jsxDEV)(tt,{columns:ft,rowActions:n(R=>(0,o.jsxDEV)(o.Fragment,{children:[(0,o.jsxDEV)(E,{"aria-pressed":m===z(R.id),"data-testid":`org-team-select-${z(R.id)}`,onClick:n(()=>{c(z(R.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Members")},void 0,!1),(0,o.jsxDEV)(E,{"data-testid":`org-team-rename-${z(R.id)}`,onClick:n(()=>{a({kind:"team-rename",team:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Rename")},void 0,!1),(0,o.jsxDEV)(E,{"data-testid":`org-team-delete-${z(R.id)}`,onClick:n(()=>{V(R)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Delete")},void 0,!1)]},void 0,!0),"rowActions"),rowPrefix:"org-team",rows:q},void 0,!1)},void 0,!1),e[143]=V,e[144]=m,e[145]=i,e[146]=ft,e[147]=q,e[148]=f,e[149]=Qe):Qe=e[149];let Je;e[150]!==r||e[151]!==H||e[152]!==m||e[153]!==i||e[154]!==ut||e[155]!==oe||e[156]!==f?(Je=f&&m!==null&&(0,o.jsxDEV)(et,{action:(0,o.jsxDEV)(E,{"data-testid":"org-open-add-team-member",onClick:n(()=>{a({kind:"team-add-member",teamId:m})},"onClick"),size:"xs",type:"button",variant:"outline",children:i("Add member")},void 0,!1),heading:i("Team members"),testId:"org-team-members",children:oe.length===0?(0,o.jsxDEV)("div",{className:"p-3",children:(0,o.jsxDEV)(me,{testId:"org-team-members-empty",title:i("No team members.")},void 0,!1)},void 0,!1):(0,o.jsxDEV)(tt,{columns:ut,rowActions:n(R=>(0,o.jsxDEV)(E,{"data-testid":`org-team-remove-member-${z(R.id)}`,onClick:n(()=>{H(()=>r.removeAuthOrgTeamMember({teamMemberId:z(R.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Remove")},void 0,!1),"rowActions"),rowPrefix:"org-team-member",rows:oe},void 0,!1)},void 0,!1),e[150]=r,e[151]=H,e[152]=m,e[153]=i,e[154]=ut,e[155]=oe,e[156]=f,e[157]=Je):Je=e[157];let Ue;e[158]!==r||e[159]!==gt||e[160]!==F||e[161]!==d||e[162]!==i?(Ue=d&&(0,o.jsxDEV)(et,{action:(0,o.jsxDEV)(E,{"data-testid":"org-open-create-role",onClick:n(()=>{a({kind:"role-create"})},"onClick"),size:"xs",type:"button",variant:"outline",children:i("New role")},void 0,!1),heading:i("Roles"),testId:"org-roles",children:F.length===0?(0,o.jsxDEV)("div",{className:"p-3",children:(0,o.jsxDEV)(me,{testId:"org-roles-empty",title:i("No custom roles.")},void 0,!1)},void 0,!1):(0,o.jsxDEV)(tt,{columns:gt,rowActions:n(R=>(0,o.jsxDEV)(o.Fragment,{children:[(0,o.jsxDEV)(E,{"data-testid":`org-role-edit-${z(R.id)}`,onClick:n(()=>{a({kind:"role-edit",role:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Edit")},void 0,!1),(0,o.jsxDEV)(E,{"data-testid":`org-role-delete-${z(R.id)}`,onClick:n(()=>{a({action:n(()=>r.deleteAuthOrgRole({roleId:z(R.id)}),"action"),kind:"confirm",message:i("Delete this custom role? Members keeping it will lose its grants."),testId:"org-role-delete",title:i("Delete role")})},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Delete")},void 0,!1)]},void 0,!0),"rowActions"),rowPrefix:"org-role",rows:F},void 0,!1)},void 0,!1),e[158]=r,e[159]=gt,e[160]=F,e[161]=d,e[162]=i,e[163]=Ue):Ue=e[163];let Be;e[164]!==s?.kind||e[165]!==l||e[166]!==O?(Be=s?.kind==="add-member"&&(0,o.jsxDEV)(Pt,{onClose:G,onDone:O,organizationId:l},void 0,!1),e[164]=s?.kind,e[165]=l,e[166]=O,e[167]=Be):Be=e[167];let He;e[168]!==s?.kind||e[169]!==l||e[170]!==O?(He=s?.kind==="invite-member"&&(0,o.jsxDEV)(Qt,{onClose:G,onDone:O,organizationId:l},void 0,!1),e[168]=s?.kind,e[169]=l,e[170]=O,e[171]=He):He=e[171];let Ve;e[172]!==s||e[173]!==O?(Ve=s?.kind==="member-role"&&(0,o.jsxDEV)(Jt,{member:s.member,onClose:G,onDone:O},void 0,!1),e[172]=s,e[173]=O,e[174]=Ve):Ve=e[174];let qe;e[175]!==s?.kind||e[176]!==l||e[177]!==O?(qe=s?.kind==="team-create"&&(0,o.jsxDEV)(_t,{mode:"create",onClose:G,onDone:O,organizationId:l},void 0,!1),e[175]=s?.kind,e[176]=l,e[177]=O,e[178]=qe):qe=e[178];let Ge;e[179]!==s||e[180]!==l||e[181]!==O?(Ge=s?.kind==="team-rename"&&(0,o.jsxDEV)(_t,{mode:"edit",onClose:G,onDone:O,organizationId:l,team:s.team},void 0,!1),e[179]=s,e[180]=l,e[181]=O,e[182]=Ge):Ge=e[182];let Ke;e[183]!==s||e[184]!==O?(Ke=s?.kind==="team-add-member"&&(0,o.jsxDEV)(Ut,{onClose:G,onDone:O,teamId:s.teamId},void 0,!1),e[183]=s,e[184]=O,e[185]=Ke):Ke=e[185];let We;e[186]!==s?.kind||e[187]!==l||e[188]!==O?(We=s?.kind==="role-create"&&(0,o.jsxDEV)($t,{mode:"create",onClose:G,onDone:O,organizationId:l},void 0,!1),e[186]=s?.kind,e[187]=l,e[188]=O,e[189]=We):We=e[189];let Xe;e[190]!==s||e[191]!==l||e[192]!==O?(Xe=s?.kind==="role-edit"&&(0,o.jsxDEV)($t,{mode:"edit",onClose:G,onDone:O,organizationId:l,role:s.role},void 0,!1),e[190]=s,e[191]=l,e[192]=O,e[193]=Xe):Xe=e[193];let Ye;e[194]!==s||e[195]!==O?(Ye=s?.kind==="confirm"&&(0,o.jsxDEV)(Ft,{action:s.action,message:s.message,onClose:G,onDone:O,testId:s.testId,title:s.title},void 0,!1),e[194]=s,e[195]=O,e[196]=Ye):Ye=e[196];let dt;return e[197]!==_e||e[198]!==je||e[199]!==Pe||e[200]!==Qe||e[201]!==Je||e[202]!==Ue||e[203]!==Be||e[204]!==He||e[205]!==Ve||e[206]!==qe||e[207]!==Ge||e[208]!==Ke||e[209]!==We||e[210]!==Xe||e[211]!==Ye?(dt=(0,o.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"org-detail",children:[_e,je,Pe,Qe,Je,Ue,Be,He,Ve,qe,Ge,Ke,We,Xe,Ye]},void 0,!0),e[197]=_e,e[198]=je,e[199]=Pe,e[200]=Qe,e[201]=Je,e[202]=Ue,e[203]=Be,e[204]=He,e[205]=Ve,e[206]=qe,e[207]=Ge,e[208]=Ke,e[209]=We,e[210]=Xe,e[211]=Ye,e[212]=dt):dt=e[212],dt},"OrganizationDetail");function Ht(t){return(0,o.jsxDEV)(ae,{children:t.head},t.head,!1)}n(Ht,"_temp");function Vt(t){return(0,o.jsxDEV)("span",{className:"font-mono text-xs",children:z(t.userId)},void 0,!1)}n(Vt,"_temp2");function qt(t){return z(t.role)}n(qt,"_temp3");function Gt(t){return z(t.email)}n(Gt,"_temp4");function Kt(t){return z(t.role)}n(Kt,"_temp5");function Wt(t){return z(t.status)}n(Wt,"_temp6");function Xt(t){return z(t.id)}n(Xt,"_temp7");function Yt(t){return z(t.name)}n(Yt,"_temp8");function Zt(t){return(0,o.jsxDEV)("span",{className:"font-mono text-xs",children:z(t.userId)},void 0,!1)}n(Zt,"_temp9");function el(t){return z(t.role)}n(el,"_temp0");function tl(t){return z(t.permission)}n(tl,"_temp1");var hl=n(()=>{let t=(0,W.c)(62),e=ie(),l=X(),{config:d,ready:f}=At(),r=d.capabilities.organization,[i,s]=(0,L.useState)(null),[a,m]=(0,L.useState)(null),c;t[0]===Symbol.for("react.memo_cache_sentinel")?(c=["lunora-auth-orgs"],t[0]=c):c=t[0];let k;t[1]!==e?(k=n(()=>e.listAuthOrganizations({limit:100}),"t1"),t[1]=e,t[2]=k):k=t[2];let u;t[3]!==r?(u={enabled:r},t[3]=r,t[4]=u):u=t[4];let g=ce(c,k,u),y=g.data?.rows??null,h;t[5]!==g?(h=n(()=>{g.refetch()},"t3"),t[5]=g,t[6]=h):h=t[6],It(h,r);let b;t[7]===Symbol.for("react.memo_cache_sentinel")?(b=n(()=>{m(null)},"t4"),t[7]=b):b=t[7];let w=b,p;t[8]!==g?(p=n(()=>{g.refetch()},"t5"),t[8]=g,t[9]=p):p=t[9];let I=p,v;t[10]===Symbol.for("react.memo_cache_sentinel")?(v=n(M=>{s(M)},"t6"),t[10]=v):v=t[10];let S=v;if(f&&!r){let M;t[11]!==l?(M=l("Enable the organization() plugin in your auth config to manage organizations here."),t[11]=l,t[12]=M):M=t[12];let F;t[13]!==l?(F=l("Organizations are not enabled."),t[13]=l,t[14]=F):F=t[14];let B;return t[15]!==M||t[16]!==F?(B=(0,o.jsxDEV)(me,{description:M,testId:"org-disabled",title:F},void 0,!1),t[15]=M,t[16]=F,t[17]=B):B=t[17],B}let C;t[18]!==l?(C=l("Organizations"),t[18]=l,t[19]=C):C=t[19];let x;t[20]!==C?(x=(0,o.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:C},void 0,!1),t[20]=C,t[21]=x):x=t[21];let N;t[22]===Symbol.for("react.memo_cache_sentinel")?(N=n(()=>{m({kind:"create"})},"t9"),t[22]=N):N=t[22];let _;t[23]!==l?(_=l("New organization"),t[23]=l,t[24]=_):_=t[24];let A;t[25]!==_?(A=(0,o.jsxDEV)(E,{"data-testid":"org-new",onClick:N,size:"sm",type:"button",children:_},void 0,!1),t[25]=_,t[26]=A):A=t[26];let D;t[27]!==A||t[28]!==x?(D=(0,o.jsxDEV)("div",{className:"flex items-center justify-between",children:[x,A]},void 0,!0),t[27]=A,t[28]=x,t[29]=D):D=t[29];let T;t[30]!==g.error?(T=g.error!==null&&(0,o.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"org-error",role:"alert",children:g.error},void 0,!1),t[30]=g.error,t[31]=T):T=t[31];let $;t[32]!==y||t[33]!==l?($=y!==null&&y.length===0&&(0,o.jsxDEV)(me,{testId:"org-empty",title:l("No organizations.")},void 0,!1),t[32]=y,t[33]=l,t[34]=$):$=t[34];let j;t[35]!==y||t[36]!==i||t[37]!==l?(j=y!==null&&y.length>0&&(0,o.jsxDEV)(ht,{className:"overflow-hidden py-0",children:(0,o.jsxDEV)(bt,{className:"px-0",children:(0,o.jsxDEV)(pt,{"data-testid":"org-table",children:[(0,o.jsxDEV)(yt,{children:(0,o.jsxDEV)(Ze,{children:[(0,o.jsxDEV)(ae,{children:l("id")},void 0,!1),(0,o.jsxDEV)(ae,{children:l("name")},void 0,!1),(0,o.jsxDEV)(ae,{children:l("slug")},void 0,!1),(0,o.jsxDEV)(ae,{children:l("created")},void 0,!1),(0,o.jsxDEV)(ae,{"aria-label":l("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,o.jsxDEV)(Ct,{children:y.map(M=>{let F=z(M.id);return(0,o.jsxDEV)(Ze,{"data-testid":`org-row-${F}`,children:[(0,o.jsxDEV)(ne,{className:"font-mono text-xs",children:F},void 0,!1),(0,o.jsxDEV)(ne,{children:z(M.name)},void 0,!1),(0,o.jsxDEV)(ne,{children:z(M.slug)},void 0,!1),(0,o.jsxDEV)(ne,{className:"text-muted-foreground tabular-nums",children:Nt(M.createdAt)},void 0,!1),(0,o.jsxDEV)(ne,{children:(0,o.jsxDEV)("div",{className:"flex justify-end gap-1",children:[(0,o.jsxDEV)(E,{"aria-pressed":i===F,"data-testid":`org-select-${F}`,onClick:n(()=>{S(F)},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Manage")},void 0,!1),(0,o.jsxDEV)(E,{"data-testid":`org-edit-${F}`,onClick:n(()=>{m({kind:"edit",org:M})},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Edit")},void 0,!1),(0,o.jsxDEV)(E,{"data-testid":`org-delete-${F}`,onClick:n(()=>{m({kind:"delete",org:M})},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Delete")},void 0,!1)]},void 0,!0)},void 0,!1)]},F,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),t[35]=y,t[36]=i,t[37]=l,t[38]=j):j=t[38];let U;t[39]!==d.organization||t[40]!==i?(U=i!==null&&(0,o.jsxDEV)(Bt,{organizationId:i,rolesEnabled:d.organization.roles,teamsEnabled:d.organization.teams},void 0,!1),t[39]=d.organization,t[40]=i,t[41]=U):U=t[41];let P;t[42]!==a?.kind||t[43]!==I?(P=a?.kind==="create"&&(0,o.jsxDEV)(Ot,{mode:"create",onClose:w,onDone:I},void 0,!1),t[42]=a?.kind,t[43]=I,t[44]=P):P=t[44];let Q;t[45]!==a||t[46]!==I?(Q=a?.kind==="edit"&&(0,o.jsxDEV)(Ot,{mode:"edit",onClose:w,onDone:I,org:a.org},void 0,!1),t[45]=a,t[46]=I,t[47]=Q):Q=t[47];let J;t[48]!==e||t[49]!==a||t[50]!==I||t[51]!==l?(J=a?.kind==="delete"&&(0,o.jsxDEV)(Ft,{action:n(async()=>{let M=z(a.org.id);await e.deleteAuthOrganization({organizationId:M}),s(F=>F===M?null:F)},"action"),message:l("Delete this organization? Its members, invitations, teams, and custom roles are removed. This cannot be undone."),onClose:w,onDone:I,testId:"org-delete",title:l("Delete organization")},void 0,!1),t[48]=e,t[49]=a,t[50]=I,t[51]=l,t[52]=J):J=t[52];let q;return t[53]!==D||t[54]!==T||t[55]!==$||t[56]!==j||t[57]!==U||t[58]!==P||t[59]!==Q||t[60]!==J?(q=(0,o.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-organizations",children:[D,T,$,j,U,P,Q,J]},void 0,!0),t[53]=D,t[54]=T,t[55]=$,t[56]=j,t[57]=U,t[58]=P,t[59]=Q,t[60]=J,t[61]=q):q=t[61],q},"OrganizationsPanel");export{hl as OrganizationsPanel};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as Pe}from"./chunk-SDQE2IUJ.js";import{a as Be}from"./chunk-JM7XBQVK.js";import{a as $e}from"./chunk-TO6D2PJC.js";import"./chunk-V43BLH4J.js";import"./chunk-APSSZB6Z.js";import"./chunk-QAFAJBAW.js";import"./chunk-AHILM3ZP.js";import"./chunk-WVTPZ6CM.js";import"./chunk-SHERR7ZP.js";import"./chunk-5OIBXYZM.js";import"./chunk-L7SK4ZZD.js";import"./chunk-X4QFAAZ5.js";import"./chunk-BJGBHGK3.js";import"./chunk-ZIGWVHCS.js";import"./chunk-EEWKIQUE.js";import"./chunk-KEGAWN6Y.js";import{a as Re}from"./chunk-XNJNSCLM.js";import{a as Le,b as Ae,c as Oe,d as xe,e as Me,f as De}from"./chunk-GTM65MVX.js";import"./chunk-4QHKBC77.js";import{a as Ie}from"./chunk-LUP4YTBS.js";import{b as qe}from"./chunk-4PC7IXNY.js";import{d as re,e as ve,f as ge}from"./chunk-2MLA6WFH.js";import"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-CKSHCYGC.js";import{a as le}from"./chunk-G7ZBM54M.js";import{f as he}from"./chunk-SDMZKBTD.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as G,f as ne,g as se,h as Ee,l as Q}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as r,e as be,f as It,g as Rt,h as Lt,j as oe}from"./chunk-RRCPZMC2.js";var K=be(Rt(),1);var q=be(It(),1);var n=be(Lt(),1);var At=["ORDER BY","GROUP BY","LEFT JOIN","RIGHT JOIN","INNER JOIN","OUTER JOIN","CROSS JOIN","EXPLAIN QUERY PLAN","SELECT","DISTINCT","FROM","WHERE","HAVING","LIMIT","OFFSET","JOIN","ON","AND","OR","AS","ASC","DESC","WITH","UNION","EXPLAIN"],Ot=["FROM","WHERE","ORDER BY","GROUP BY","HAVING","LIMIT","OFFSET","UNION","JOIN","LEFT JOIN","RIGHT JOIN","INNER JOIN","OUTER JOIN","CROSS JOIN"],ae=String.fromCodePoint(0),Mt=new RegExp(`${ae}${String.raw`(\d+)`}${ae}`,"gu"),Dt=At.map(s=>({pattern:new RegExp(String.raw`\b${s.replaceAll(" ",String.raw`\s+`)}\b`,"giu"),replacement:s})),Bt=Ot.map(s=>({pattern:new RegExp(String.raw`\s+${s.replaceAll(" ",String.raw`\s+`)}\b`,"gu"),replacement:`
|
|
2
|
+
${s}`})),$t=r(s=>{let e=[],o=s.replaceAll(/'(?:[^']|'')*'/gu,l=>(e.push(l),`${ae}${(e.length-1).toString()}${ae}`)).replaceAll(/\s+/gu," ").trim();for(let{pattern:l,replacement:a}of Dt)o=o.replaceAll(l,a);for(let{pattern:l,replacement:a}of Bt)o=o.replaceAll(l,a);return o=o.replaceAll(Mt,(l,a)=>e[Number(a)]??""),o},"formatSql"),ie=8,Pt=["AND","ASC","AS","BY","COUNT","DESC","DISTINCT","EXPLAIN","FROM","GROUP","HAVING","INNER","JOIN","LEFT","LIKE","LIMIT","NOT","NULL","OFFSET","ON","ORDER","OR","QUERY","SELECT","WHERE","WITH"],_t=new Set(["AND","BY","HAVING","ON","OR","SELECT","WHERE"]),Wt=/[\w$]/,He=r(s=>s!==void 0&&Wt.test(s),"isWordChar"),Fe=r(s=>{let e=s.length;for(;e>0&&He(s[e-1]);)e-=1;return s.slice(e)},"trailingWord"),ze=r((s,e)=>{let t=e;for(;t>0&&He(s[t-1]);)t-=1;return{end:e,start:t,text:s.slice(t,e)}},"tokenAt"),_e=r((s,e)=>{let t=s.slice(0,e).trimEnd();return t.endsWith(".")||_t.has(Fe(t).toUpperCase())},"prefersColumns"),Ht=r((s,e)=>{let t=s.slice(0,e);if(!t.endsWith("."))return;let o=Fe(t.slice(0,-1));return o===""?void 0:o},"qualifierTable"),ke=r((s,e)=>s.toLowerCase().startsWith(e.toLowerCase()),"matches"),We=r((s,e,t,o)=>{let l=[];for(let a of s)if(ke(a,e)&&(l.push(o(a)),l.length>=t))break;return l},"takeMatches"),Ft=r((s,e,t)=>{let o=new Map;for(let[l,a]of Object.entries(s.columns))for(let d of a)if(ke(d,e)&&!o.has(d)&&(o.set(d,l),o.size>=t))return[...o].map(([p,c])=>({detail:c,kind:"column",label:p}));return[...o].map(([l,a])=>({detail:a,kind:"column",label:l}))},"takeColumnMatches"),zt=r((s,e,t)=>{let o=ze(s,e),l=Ht(s,o.start);if(l!==void 0){let u=t.columns[l]??t.columns[l.toLowerCase()]??[];return We(u,o.text,ie,y=>({detail:l,kind:"column",label:y}))}if(o.text===""&&!_e(s,o.start))return[];let a=We(t.tables,o.text,ie,u=>({kind:"table",label:u})),d=Ft(t,o.text,ie),p=Pt.filter(u=>o.text!==""&&ke(u,o.text)&&u.toLowerCase()!==o.text.toLowerCase()).map(u=>({kind:"keyword",label:u}));return(_e(s,o.start)?[...d,...a,...p]:[...a,...d,...p]).slice(0,ie)},"suggestionsFor"),Ut=r((s,e,t)=>{let o=ze(s,e),l=s.slice(0,o.start)+t.label+s.slice(o.end);return{caret:o.start+t.label.length,value:l}},"acceptSuggestion"),Yt=["boxSizing","borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textTransform","width","wordSpacing"],jt=r((s,e)=>{let t=globalThis.getComputedStyle(s),o=globalThis.document.createElement("div"),{style:l}=o;l.position="absolute",l.visibility="hidden",l.whiteSpace="pre-wrap",l.overflowWrap="break-word";for(let c of Yt)l[c]=t[c];o.textContent=s.value.slice(0,Math.max(0,e));let a=globalThis.document.createElement("span");a.textContent=s.value.slice(Math.max(0,e))||".",o.append(a),globalThis.document.body.append(o);let d=a.offsetLeft-s.scrollLeft,p=a.offsetTop-s.scrollTop;return o.remove(),{left:d,top:p}},"caretOffset"),Kt=r((s,e,t)=>{let o=(0,K.c)(13),[l,a]=(0,q.useState)(null),d;o[0]!==s||o[1]!==e?(d=r((N,x)=>{let S=zt(N,x,s);if(S.length===0){a(null);return}let h=e.current,{left:w,top:C}=h===null?{left:0,top:0}:jt(h,x);a({active:0,left:w,suggestions:S,top:C})},"t0"),o[0]=s,o[1]=e,o[2]=d):d=o[2];let p=d,c;o[3]===Symbol.for("react.memo_cache_sentinel")?(c=r(()=>{a(null)},"t1"),o[3]=c):c=o[3];let u=c,y;o[4]===Symbol.for("react.memo_cache_sentinel")?(y=r(N=>{a(x=>{if(x===null)return x;let S=x.suggestions.length,h=(x.active+N+S)%S;return{...x,active:h}})},"t2"),o[4]=y):y=o[4];let g=y,v;o[5]!==t||o[6]!==l||o[7]!==e?(v=r(()=>{let N=e.current;if(l===null||N===null)return!1;let x=l.suggestions[l.active];if(x===void 0)return!1;let S=Ut(N.value,N.selectionStart,x);return t(S.value),a(null),requestAnimationFrame(()=>{let h=e.current;h!==null&&(h.focus(),h.setSelectionRange(S.caret,S.caret))}),!0},"t3"),o[5]=t,o[6]=l,o[7]=e,o[8]=v):v=o[8];let m=v,f;return o[9]!==m||o[10]!==p||o[11]!==l?(f={close:u,commit:m,move:g,refresh:p,state:l},o[9]=m,o[10]=p,o[11]=l,o[12]=f):f=o[12],f},"useSqlAutocomplete"),Gt={column:"column",keyword:"keyword",table:"table"},Vt=20,Jt=r(s=>{let e=(0,K.c)(17),{listboxId:t,onPick:o,state:l}=s,a=G(),d;e[0]!==l?(d=l===null?void 0:{left:l.left,top:l.top+Vt},e[0]=l,e[1]=d):d=e[1];let p=d;if(l===null)return null;let c;if(e[2]!==t||e[3]!==o||e[4]!==l.active||e[5]!==l.suggestions||e[6]!==a){let y;e[8]!==t||e[9]!==o||e[10]!==l.active||e[11]!==a?(y=r((g,v)=>(0,n.jsxDEV)("li",{"aria-selected":v===l.active,className:oe("flex cursor-pointer items-center gap-2 px-2 py-1 text-[13px]",v===l.active?"bg-accent text-accent-foreground":"text-foreground"),"data-testid":"sql-autocomplete-item",id:`${t}-opt-${v.toString()}`,onMouseDown:r(m=>{m.preventDefault(),o(v)},"onMouseDown"),role:"option",children:[(0,n.jsxDEV)("span",{className:"truncate font-mono",children:g.label},void 0,!1),g.detail!==void 0&&(0,n.jsxDEV)("span",{className:"ms-auto truncate text-xs text-muted-foreground",children:g.detail},void 0,!1),(0,n.jsxDEV)("span",{className:"shrink-0 font-mono text-[10px] tracking-wide text-muted-foreground/70 uppercase",children:a(Gt[g.kind])},void 0,!1)]},`${g.kind}:${g.label}`,!0),"t32"),e[8]=t,e[9]=o,e[10]=l.active,e[11]=a,e[12]=y):y=e[12],c=l.suggestions.map(y),e[2]=t,e[3]=o,e[4]=l.active,e[5]=l.suggestions,e[6]=a,e[7]=c}else c=e[7];let u;return e[13]!==t||e[14]!==p||e[15]!==c?(u=(0,n.jsxDEV)("ul",{className:"absolute z-30 max-h-56 w-72 overflow-auto rounded-md border border-border bg-popover py-1 text-popover-foreground shadow-md","data-testid":"sql-autocomplete",id:t,role:"listbox",style:p,children:c},void 0,!1),e[13]=t,e[14]=p,e[15]=c,e[16]=u):u=e[16],u},"AutocompletePopover"),Ue=[{label:"List tables",sql:"SELECT name FROM sqlite_master WHERE type = 'table' ORDER BY name;"},{label:"Table row count",sql:"SELECT COUNT(*) AS rows FROM messages;"},{label:"Recent rows",sql:"SELECT id, _creationTime, __doc__ FROM messages ORDER BY _creationTime DESC LIMIT 50;"},{label:"Index list",sql:"SELECT name, tbl_name FROM sqlite_master WHERE type = 'index' ORDER BY tbl_name;"}],Qt=r(s=>{let e=(0,K.c)(29),{active:t,onDelete:o,onSelect:l,query:a}=s,d=G(),p;e[0]!==l||e[1]!==a.id?(p=r(()=>{l(a.id)},"t1"),e[0]=l,e[1]=a.id,e[2]=p):p=e[2];let c=p,u;e[3]!==o||e[4]!==a.id?(u=r(E=>{E.stopPropagation(),o(a.id)},"t2"),e[3]=o,e[4]=a.id,e[5]=u):u=e[5];let y=u,g=t?"bg-sidebar-accent font-medium text-foreground":"text-muted-foreground",v;e[6]!==g?(v=oe("flex min-w-0 flex-1 items-center gap-2 rounded-md px-2 py-1.5 text-start text-[13px] outline-none transition-colors hover:bg-sidebar-accent focus-visible:bg-sidebar-accent",g),e[6]=g,e[7]=v):v=e[7];let m=`sql-query-${a.id}`,f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=(0,n.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3.5 shrink-0 opacity-70",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,n.jsxDEV)("path",{d:"M4 6h16M4 12h10M4 18h7"},void 0,!1)},void 0,!1),e[8]=f):f=e[8];let N;e[9]!==a.name?(N=(0,n.jsxDEV)("span",{className:"truncate",children:a.name},void 0,!1),e[9]=a.name,e[10]=N):N=e[10];let x;e[11]!==t||e[12]!==c||e[13]!==v||e[14]!==m||e[15]!==N?(x=(0,n.jsxDEV)("button",{"aria-pressed":t,className:v,"data-testid":m,onClick:c,type:"button",children:[f,N]},void 0,!0),e[11]=t,e[12]=c,e[13]=v,e[14]=m,e[15]=N,e[16]=x):x=e[16];let S;e[17]!==d?(S=d("Delete query"),e[17]=d,e[18]=S):S=e[18];let h;e[19]!==d?(h=d("Delete query"),e[19]=d,e[20]=h):h=e[20];let w;e[21]===Symbol.for("react.memo_cache_sentinel")?(w=(0,n.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,n.jsxDEV)("path",{d:"M5 7h14M9 7V5h6v2m-1 0v12H10V7M7 7v13h10V7"},void 0,!1)},void 0,!1),e[21]=w):w=e[21];let C;e[22]!==y||e[23]!==h||e[24]!==S?(C=(0,n.jsxDEV)("button",{"aria-label":S,className:"me-1 hidden size-6 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-destructive/10 hover:text-destructive group-hover/q:flex",onClick:y,title:h,type:"button",children:w},void 0,!1),e[22]=y,e[23]=h,e[24]=S,e[25]=C):C=e[25];let A;return e[26]!==C||e[27]!==x?(A=(0,n.jsxDEV)("li",{className:"group/q flex items-center",children:[x,C]},void 0,!0),e[26]=C,e[27]=x,e[28]=A):A=e[28],A},"QueryRow"),Xt=r(s=>{let e=(0,K.c)(58),{activeId:t,history:o,listRef:l,onClearHistory:a,onDelete:d,onLoadHistory:p,onLoadTemplate:c,onNew:u,onSearchChange:y,onSelect:g,queries:v,search:m}=s,f=G(),N;if(e[0]!==v||e[1]!==m){let T=m.trim().toLowerCase();N=T===""?[...v]:v.filter(R=>R.name.toLowerCase().includes(T)),e[0]=v,e[1]=m,e[2]=N}else N=e[2];let x=N,S;e[3]!==f?(S=f("Search queries\u2026"),e[3]=f,e[4]=S):S=e[4];let h;e[5]!==y||e[6]!==m||e[7]!==S?(h=(0,n.jsxDEV)("input",{className:"h-8 min-w-0 flex-1 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"sql-search",onChange:y,placeholder:S,type:"text",value:m},void 0,!1),e[5]=y,e[6]=m,e[7]=S,e[8]=h):h=e[8];let w;e[9]!==f?(w=f("New query"),e[9]=f,e[10]=w):w=e[10];let C;e[11]!==f?(C=f("New query"),e[11]=f,e[12]=C):C=e[12];let A;e[13]===Symbol.for("react.memo_cache_sentinel")?(A=(0,n.jsxDEV)("svg",{"aria-hidden":"true",className:"size-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.7,viewBox:"0 0 24 24",children:(0,n.jsxDEV)("path",{d:"M12 5v14M5 12h14"},void 0,!1)},void 0,!1),e[13]=A):A=e[13];let E;e[14]!==u||e[15]!==w||e[16]!==C?(E=(0,n.jsxDEV)("button",{"aria-label":w,className:"flex size-8 shrink-0 items-center justify-center rounded-md border border-border text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"sql-new",onClick:u,title:C,type:"button",children:A},void 0,!1),e[14]=u,e[15]=w,e[16]=C,e[17]=E):E=e[17];let M;e[18]!==h||e[19]!==E?(M=(0,n.jsxDEV)("div",{className:"flex shrink-0 items-center gap-2 border-b border-border p-2",children:[h,E]},void 0,!0),e[18]=h,e[19]=E,e[20]=M):M=e[20];let D;e[21]!==f?(D=f("Private"),e[21]=f,e[22]=D):D=e[22];let O;e[23]!==D?(O=(0,n.jsxDEV)("p",{className:"px-1 pb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:D},void 0,!1),e[23]=D,e[24]=O):O=e[24];let B;e[25]!==t||e[26]!==x||e[27]!==l||e[28]!==d||e[29]!==g||e[30]!==f?(B=x.length===0?(0,n.jsxDEV)("p",{className:"px-1 py-2 text-xs text-muted-foreground","data-testid":"sql-private-empty",children:f("No saved queries yet \u2014 they save to this browser as you type.")},void 0,!1):(0,n.jsxDEV)("ul",{className:"flex flex-col gap-px","data-testid":"sql-private",ref:l,children:x.map(T=>(0,n.jsxDEV)(Qt,{active:t===T.id,onDelete:d,onSelect:g,query:T},T.id,!1))},void 0,!1),e[25]=t,e[26]=x,e[27]=l,e[28]=d,e[29]=g,e[30]=f,e[31]=B):B=e[31];let P;e[32]!==O||e[33]!==B?(P=(0,n.jsxDEV)("div",{children:[O,B]},void 0,!0),e[32]=O,e[33]=B,e[34]=P):P=e[34];let _;e[35]!==f?(_=f("Reference"),e[35]=f,e[36]=_):_=e[36];let Y;e[37]!==_?(Y=(0,n.jsxDEV)("p",{className:"px-1 pb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:_},void 0,!1),e[37]=_,e[38]=Y):Y=e[38];let F;e[39]!==c?(F=Ue.map(T=>(0,n.jsxDEV)("li",{children:(0,n.jsxDEV)("button",{className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-start text-[13px] text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-foreground focus-visible:bg-sidebar-accent","data-sql":T.sql,onClick:c,type:"button",children:[(0,n.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3.5 shrink-0 opacity-70",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,n.jsxDEV)("path",{d:"M7 4h7l4 4v12H7zM14 4v4h4"},void 0,!1)},void 0,!1),T.label]},void 0,!0)},T.label,!1)),e[39]=c,e[40]=F):F=e[40];let $;e[41]!==F?($=(0,n.jsxDEV)("ul",{className:"flex flex-col gap-px",children:F},void 0,!1),e[41]=F,e[42]=$):$=e[42];let I;e[43]!==Y||e[44]!==$?(I=(0,n.jsxDEV)("div",{children:[Y,$]},void 0,!0),e[43]=Y,e[44]=$,e[45]=I):I=e[45];let L;e[46]!==o||e[47]!==a||e[48]!==p||e[49]!==f?(L=o.length>0&&(0,n.jsxDEV)("div",{children:[(0,n.jsxDEV)("div",{className:"flex items-center justify-between px-1 pb-1",children:[(0,n.jsxDEV)("p",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:f("History")},void 0,!1),(0,n.jsxDEV)("button",{className:"rounded px-1 text-[11px] text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:text-foreground","data-testid":"sql-history-clear",onClick:a,type:"button",children:f("Clear history")},void 0,!1)]},void 0,!0),(0,n.jsxDEV)("ul",{className:"flex flex-col gap-px","data-testid":"sql-history",children:o.map(T=>(0,n.jsxDEV)("li",{children:(0,n.jsxDEV)("button",{className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-start text-[13px] text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-foreground focus-visible:bg-sidebar-accent","data-sql":T.sql,"data-testid":"sql-history-item",onClick:p,title:T.sql,type:"button",children:[(0,n.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3.5 shrink-0 opacity-70",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,n.jsxDEV)("path",{d:"M12 8v4l3 2M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18Z"},void 0,!1)},void 0,!1),(0,n.jsxDEV)("span",{className:"truncate font-mono",children:T.sql},void 0,!1)]},void 0,!0)},`${T.at.toString()}:${T.sql}`,!1))},void 0,!1)]},void 0,!0),e[46]=o,e[47]=a,e[48]=p,e[49]=f,e[50]=L):L=e[50];let W;e[51]!==P||e[52]!==I||e[53]!==L?(W=(0,n.jsxDEV)("div",{className:"flex flex-1 flex-col gap-4 overflow-y-auto p-2",children:[P,I,L]},void 0,!0),e[51]=P,e[52]=I,e[53]=L,e[54]=W):W=e[54];let H;return e[55]!==W||e[56]!==M?(H=(0,n.jsxDEV)("aside",{className:"flex h-full w-64 shrink-0 flex-col border-e border-border bg-sidebar",children:[M,W]},void 0,!0),e[55]=W,e[56]=M,e[57]=H):H=e[57],H},"SqlQuerySidebar"),Zt=ne(le.listTables),eo=ne(le.readTablePage),to=r(s=>{let e=(0,K.c)(16),t=he(),o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],e[0]=o):o=e[0];let[l,a]=(0,q.useState)(o),d;e[1]===Symbol.for("react.memo_cache_sentinel")?(d={},e[1]=d):d=e[1];let[p,c]=(0,q.useState)(d),u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=new Set,e[2]=u):u=e[2];let y=(0,q.useRef)(u),g,v;e[3]!==t||e[4]!==s?(g=r(()=>{let h={cancelled:!1};return Q(r(async()=>{try{let C=await t.query(Zt,{},se(s));h.cancelled||(a(C.map(no)),c({}),y.current=new Set)}catch{h.cancelled||(a([]),c({}),y.current=new Set)}},"load")()),()=>{h.cancelled=!0}},"t3"),v=[t,s],e[3]=t,e[4]=s,e[5]=g,e[6]=v):(g=e[5],v=e[6]),(0,q.useEffect)(g,v);let m;e[7]!==t||e[8]!==s?(m=r(h=>{if(y.current.has(h))return;y.current.add(h),Q(r(async()=>{try{let C=await t.query(eo,{limit:1,offset:0,table:h},se(s));c(A=>({...A,[h]:C.columns}))}catch{y.current.delete(h)}},"fetchColumns")())},"t5"),e[7]=t,e[8]=s,e[9]=m):m=e[9];let f=m,N;e[10]!==p||e[11]!==l?(N={columns:p,tables:l},e[10]=p,e[11]=l,e[12]=N):N=e[12];let x=N,S;return e[13]!==f||e[14]!==x?(S={probe:f,schema:x},e[13]=f,e[14]=x,e[15]=S):S=e[15],S},"useSqlSchema"),ye=/\b(?:from|join|update|into)\s+([a-z_][\w$]*)|\b([a-z_][\w$]*)\s*\./gi,oo=r(s=>{let e=new Set;ye.lastIndex=0;let t=ye.exec(s);for(;t!==null;)e.add(t[1]??t[2]),t=ye.exec(s);return[...e]},"referencedTables");function no(s){return s.name}r(no,"_temp$2");var so="lunora-studio-sql-tabs",lo="lunora-studio-sql-active-tab",Se=12,X=r((s="",e="")=>({activeId:null,id:ge("tab"),name:e,sql:s}),"makeTab"),ro=r(()=>ve(lo,""),"usePersistedActive"),io=r(s=>{let[e,t]=re(so),[o,l]=ro(),a=(0,q.useRef)(null);e.length===0&&a.current===null&&(a.current=s()),(0,q.useEffect)(()=>{if(e.length===0&&a.current!==null){let c=a.current;t([c])}},[t,e.length]);let d=e.length===0&&a.current!==null?[a.current]:e;return{activeId:d.some(c=>c.id===o)?o:d[0]?.id??"",setActiveId:l,setTabs:t,tabs:d}},"usePersistedTabs"),Ye=r(s=>s.activeId===null&&s.sql.trim()!=="","isDirty"),ao=r((s,e)=>[...s,e].slice(-Se),"addTab"),co=r((s,e,t)=>{let o=s.findIndex(d=>d.id===e);if(o===-1)return{activeId:s[0]?.id??"",tabs:[...s]};let l=s.filter(d=>d.id!==e);if(l.length===0){let d=t();return{activeId:d.id,tabs:[d]}}return{activeId:l[Math.min(o,l.length-1)].id,tabs:l}},"closeTab"),uo=r((s,e)=>{let t=s.filter(o=>o.id===e);return t.length===0?{activeId:s[0]?.id??"",tabs:[...s]}:{activeId:e,tabs:t}},"closeOtherTabs"),fo=r((s,e,t)=>{let o=s.findIndex(a=>a.id===e);if(o===-1)return{activeId:t,tabs:[...s]};let l=s.slice(0,o+1);return{activeId:l.some(a=>a.id===t)?t:e,tabs:l}},"closeTabsToRight"),mo=r(s=>{let e=s();return{activeId:e.id,tabs:[e]}},"closeAllTabs"),po=r((s,e,t)=>{if(s==="others")return e.filter(o=>o.id!==t);if(s==="right"){let o=e.findIndex(l=>l.id===t);return o===-1?[]:e.slice(o+1)}return[...e]},"tabsClosedBy"),bo=r((s,e)=>s.trim()===""?e:(s.split(`
|
|
3
|
+
`)[0]??s).slice(0,24),"derivedTabLabel"),ho=r(s=>{let e=(0,K.c)(14),{initial:t,onCancel:o,onCommit:l,placeholder:a,testId:d}=s,p=G(),c=xo,u;e[0]!==l?(u=r(N=>{l(N.currentTarget.value.trim())},"t1"),e[0]=l,e[1]=u):u=e[1];let y=u,g;e[2]!==o||e[3]!==l?(g=r(N=>{N.key==="Enter"?l(N.currentTarget.value.trim()):N.key==="Escape"&&o()},"t2"),e[2]=o,e[3]=l,e[4]=g):g=e[4];let v=g,m;e[5]!==p?(m=p("Tab title"),e[5]=p,e[6]=m):m=e[6];let f;return e[7]!==t||e[8]!==y||e[9]!==v||e[10]!==a||e[11]!==m||e[12]!==d?(f=(0,n.jsxDEV)("input",{"aria-label":m,className:"w-40 rounded border border-ring bg-background px-1 py-0.5 text-xs outline-none","data-testid":d,defaultValue:t,onBlur:y,onKeyDown:v,placeholder:a,ref:c,type:"text"},void 0,!1),e[7]=t,e[8]=y,e[9]=v,e[10]=a,e[11]=m,e[12]=d,e[13]=f):f=e[13],f},"TabRenameInput"),vo=r(s=>{let e=(0,K.c)(29),{idBase:t,onDiscard:o,onKeep:l}=s,a=G(),d=`sql-tab-close-prompt-${t}`,p;e[0]!==a?(p=a("Discard?"),e[0]=a,e[1]=p):p=e[1];let c;e[2]!==p?(c=(0,n.jsxDEV)("span",{className:"text-[11px] text-muted-foreground",children:p},void 0,!1),e[2]=p,e[3]=c):c=e[3];let u;e[4]!==a?(u=a("Discard changes"),e[4]=a,e[5]=u):u=e[5];let y=`sql-tab-close-confirm-${t}`,g;e[6]!==a?(g=a("Discard changes"),e[6]=a,e[7]=g):g=e[7];let v;e[8]===Symbol.for("react.memo_cache_sentinel")?(v=(0,n.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.4,viewBox:"0 0 24 24",children:(0,n.jsxDEV)("path",{d:"M5 13l4 4L19 7"},void 0,!1)},void 0,!1),e[8]=v):v=e[8];let m;e[9]!==o||e[10]!==u||e[11]!==y||e[12]!==g?(m=(0,n.jsxDEV)("button",{"aria-label":u,className:"flex size-5 items-center justify-center rounded text-destructive hover:bg-destructive/10","data-testid":y,onClick:o,title:g,type:"button",children:v},void 0,!1),e[9]=o,e[10]=u,e[11]=y,e[12]=g,e[13]=m):m=e[13];let f;e[14]!==a?(f=a("Keep editing"),e[14]=a,e[15]=f):f=e[15];let N=`sql-tab-close-cancel-${t}`,x;e[16]!==a?(x=a("Keep editing"),e[16]=a,e[17]=x):x=e[17];let S;e[18]===Symbol.for("react.memo_cache_sentinel")?(S=(0,n.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.4,viewBox:"0 0 24 24",children:(0,n.jsxDEV)("path",{d:"M6 6l12 12M18 6 6 18"},void 0,!1)},void 0,!1),e[18]=S):S=e[18];let h;e[19]!==l||e[20]!==N||e[21]!==x||e[22]!==f?(h=(0,n.jsxDEV)("button",{"aria-label":f,className:"flex size-5 items-center justify-center rounded text-muted-foreground hover:bg-accent","data-testid":N,onClick:l,title:x,type:"button",children:S},void 0,!1),e[19]=l,e[20]=N,e[21]=x,e[22]=f,e[23]=h):h=e[23];let w;return e[24]!==d||e[25]!==h||e[26]!==c||e[27]!==m?(w=(0,n.jsxDEV)("span",{className:"flex shrink-0 items-center gap-1","data-testid":d,role:"group",children:[c,m,h]},void 0,!0),e[24]=d,e[25]=h,e[26]=c,e[27]=m,e[28]=w):w=e[28],w},"TabCloseConfirm"),go=r(s=>{let e=(0,K.c)(47),{active:t,canClose:o,onClose:l,onMenu:a,onRename:d,onSelect:p,tab:c}=s,u=G(),[y,g]=(0,q.useState)(!1),[v,m]=(0,q.useState)(!1),f;e[0]!==a||e[1]!==c.id?(f=r(z=>{a(c.id,z)},"t1"),e[0]=a,e[1]=c.id,e[2]=f):f=e[2];let N=f,x;e[3]!==p||e[4]!==c.id?(x=r(()=>{p(c.id)},"t2"),e[3]=p,e[4]=c.id,e[5]=x):x=e[5];let S=x,h;e[6]===Symbol.for("react.memo_cache_sentinel")?(h=r(()=>{g(!0)},"t3"),e[6]=h):h=e[6];let w=h,C;e[7]!==l||e[8]!==c?(C=r(z=>{z.stopPropagation(),Ye(c)?m(!0):l(c.id)},"t4"),e[7]=l,e[8]=c,e[9]=C):C=e[9];let A=C,E;e[10]!==l||e[11]!==c.id?(E=r(z=>{z.stopPropagation(),m(!1),l(c.id)},"t5"),e[10]=l,e[11]=c.id,e[12]=E):E=e[12];let M=E,D;e[13]===Symbol.for("react.memo_cache_sentinel")?(D=r(z=>{z.stopPropagation(),m(!1)},"t6"),e[13]=D):D=e[13];let O=D,B;e[14]!==d||e[15]!==c.id?(B=r(z=>{d(c.id,z),g(!1)},"t7"),e[14]=d,e[15]=c.id,e[16]=B):B=e[16];let P=B,_;e[17]===Symbol.for("react.memo_cache_sentinel")?(_=r(()=>{g(!1)},"t8"),e[17]=_):_=e[17];let Y=_,F;e[18]!==c.name?(F=c.name.trim(),e[18]=c.name,e[19]=F):F=e[19];let $=F,I;e[20]!==u||e[21]!==c.sql?(I=bo(c.sql,u("Untitled")),e[20]=u,e[21]=c.sql,e[22]=I):I=e[22];let L=I,W=t?"bg-background text-foreground":"bg-muted/40 text-muted-foreground hover:text-foreground",H;e[23]!==W?(H=oe("group/tab flex shrink-0 items-center gap-1 border-e border-border ps-3 pe-1.5 text-xs",W),e[23]=W,e[24]=H):H=e[24];let T=`sql-tab-${c.id}`,R;e[25]!==t||e[26]!==P||e[27]!==$||e[28]!==L||e[29]!==y||e[30]!==S||e[31]!==u||e[32]!==c.id?(R=y?(0,n.jsxDEV)(ho,{initial:$,onCancel:Y,onCommit:P,placeholder:L,testId:`sql-tab-rename-${c.id}`},void 0,!1):(0,n.jsxDEV)("button",{"aria-pressed":t,className:"max-w-40 truncate py-1.5 outline-none","data-testid":`sql-tab-select-${c.id}`,onClick:S,onDoubleClick:w,title:u("Double-click to rename"),type:"button",children:$===""?L:$},void 0,!1),e[25]=t,e[26]=P,e[27]=$,e[28]=L,e[29]=y,e[30]=S,e[31]=u,e[32]=c.id,e[33]=R):R=e[33];let j;e[34]!==o||e[35]!==M||e[36]!==v||e[37]!==A||e[38]!==u||e[39]!==c.id?(j=o&&(v?(0,n.jsxDEV)(vo,{idBase:c.id,onDiscard:M,onKeep:O},void 0,!1):(0,n.jsxDEV)("button",{"aria-label":u("Close tab"),className:"flex size-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-destructive/10 hover:text-destructive","data-testid":`sql-tab-close-${c.id}`,onClick:A,title:u("Close tab"),type:"button",children:(0,n.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",children:(0,n.jsxDEV)("path",{d:"M6 6l12 12M18 6 6 18"},void 0,!1)},void 0,!1)},void 0,!1)),e[34]=o,e[35]=M,e[36]=v,e[37]=A,e[38]=u,e[39]=c.id,e[40]=j):j=e[40];let J;return e[41]!==N||e[42]!==H||e[43]!==T||e[44]!==R||e[45]!==j?(J=(0,n.jsxDEV)("div",{className:H,"data-testid":T,onContextMenu:N,children:[R,j]},void 0,!0),e[41]=N,e[42]=H,e[43]=T,e[44]=R,e[45]=j,e[46]=J):J=e[46],J},"TabButton");function xo(s){s?.focus(),s?.select()}r(xo,"_temp$1");var yo=ne(le.runSql),No="lunora-studio-sql-queries",So="lunora-studio-sql-history",ko="lunora-studio-sql-split-view",Co=25,wo={minWidth:"2.75rem",paddingInline:"0.5rem"},Ne={error:null,pane:"results",result:null},To=r(s=>{let e=(0,K.c)(16),{result:t}=s;if(t.columns.length===0){let c=t.rowCount===0?"0 rows":"",u;return e[0]!==c?(u=(0,n.jsxDEV)("p",{className:"p-4 text-sm text-muted-foreground",children:c},void 0,!1),e[0]=c,e[1]=u):u=e[1],u}let o;e[2]!==t.columns?(o=t.columns.map(Eo),e[2]=t.columns,e[3]=o):o=e[3];let l;e[4]!==o?(l=(0,n.jsxDEV)(Ae,{className:"sticky top-0 z-10 bg-muted",children:(0,n.jsxDEV)(xe,{children:o},void 0,!1)},void 0,!1),e[4]=o,e[5]=l):l=e[5];let a;if(e[6]!==t.columns||e[7]!==t.rows){let c;e[9]!==t.columns?(c=r((u,y)=>(0,n.jsxDEV)(xe,{"data-testid":"sql-row",children:t.columns.map(g=>(0,n.jsxDEV)(De,{className:"max-w-md truncate font-mono text-xs",children:(0,n.jsxDEV)(Be,{value:u[g]},void 0,!1)},g,!1))},y,!1),"t42"),e[9]=t.columns,e[10]=c):c=e[10],a=t.rows.map(c),e[6]=t.columns,e[7]=t.rows,e[8]=a}else a=e[8];let d;e[11]!==a?(d=(0,n.jsxDEV)(Oe,{children:a},void 0,!1),e[11]=a,e[12]=d):d=e[12];let p;return e[13]!==l||e[14]!==d?(p=(0,n.jsxDEV)(Le,{"data-testid":"sql-rows",children:[l,d]},void 0,!0),e[13]=l,e[14]=d,e[15]=p):p=e[15],p},"SqlResultTable"),Ho=r(({initialShardKey:s})=>{let e=he(),t=G(),[o,l]=re(No),[a,d]=re(So),[p,c]=(0,q.useState)(""),u=r(()=>X(Ue[0]?.sql??""),"seedTab"),{activeId:y,setActiveId:g,setTabs:v,tabs:m}=io(u),[f,N]=(0,q.useState)({}),[x,S]=(0,q.useState)(s??""),[h,w]=(0,q.useState)(!1),[C,A]=ve(ko,!1),[E,M]=(0,q.useState)(null),[D,O]=(0,q.useState)(null),B=(0,q.useRef)(null),P=(0,q.useRef)(null),_=(0,q.useRef)(null),Y=(0,q.useId)(),{probe:F,schema:$}=to(x),I=m.find(i=>i.id===y)??m[0]??X(),L=I.sql,{activeId:W}=I,H=f[I.id]??Ne,{error:T,result:R}=H,j=H.pane,J=r(i=>{v(b=>b.map(k=>k.id===I.id?{...k,...i}:k))},"patchActiveTab"),z=r(i=>{N(b=>{let k=b[I.id]??Ne;return{...b,[I.id]:{error:i.error,pane:i.pane??k.pane,result:i.result}}})},"setActiveOutput"),Ce=r(i=>{N(b=>{let k=b[I.id]??Ne;return{...b,[I.id]:{...k,pane:i}}})},"setActivePane"),ce=r(i=>{J({sql:i}),W!==null&&l(b=>b.map(k=>k.id===W?{...k,sql:i}:k))},"setDraft"),je=Kt($,P,ce),{close:de,commit:we,move:ue,refresh:Z,state:V}=je,Ke=r(i=>{ue(i-(V?.active??0)),we()},"onPickSuggestion");(0,q.useEffect)(()=>{let i=P.current;i!==null&&i===document.activeElement&&Z(i.value,i.selectionStart)},[Z,$]);let Ge=r(i=>{d(b=>b[0]?.sql===i?b:[{at:Date.now(),sql:i},...b.filter(U=>U.sql!==i)].slice(0,Co))},"recordHistory"),fe=r(async i=>{if(L.trim()==="")return;w(!0);let b=i==="explain"?`EXPLAIN QUERY PLAN ${L}`:L;try{let k=await e.query(yo,{sql:b},se(x));z({error:null,pane:i,result:k}),qe(x),Ge(b)}catch(k){z({error:Ee(k),pane:i,result:null})}finally{w(!1)}},"run"),Ve=r(()=>{Q(fe("results"))},"onRun"),Je=r(i=>{let{selectionStart:b,value:k}=i.target;ce(k);for(let U of oo(k))F(U);Z(k,b)},"onDraftChange"),Qe=r(i=>{let b=i.currentTarget;Z(b.value,b.selectionStart)},"onEditorSelect"),Xe=r(i=>{if(V!==null){if(i.key==="ArrowDown"){i.preventDefault(),ue(1);return}if(i.key==="ArrowUp"){i.preventDefault(),ue(-1);return}if(i.key==="Escape"){i.preventDefault(),de();return}if((i.key==="Enter"||i.key==="Tab")&&!i.metaKey&&!i.ctrlKey&&we()){i.preventDefault();return}}(i.metaKey||i.ctrlKey)&&i.key==="Enter"&&(i.preventDefault(),Q(fe(j)))},"onEditorKeyDown"),Ze=r(()=>{requestAnimationFrame(()=>{de()})},"onEditorBlur"),et=r(i=>{B.current!==null&&(B.current.scrollTop=i.currentTarget.scrollTop)},"onEditorScroll"),ee=r((i,b)=>{v(k=>k.map(U=>U.id===I.id?{...U,activeId:b,sql:i}:U)),z({error:null,result:null})},"loadIntoActiveTab"),tt=r(()=>{let i={id:ge("q"),name:t("Untitled query"),sql:""};l(b=>[i,...b]),ee("",i.id)},"newQuery"),ot=r(i=>{let b=o.find(k=>k.id===i);b!==void 0&&(ee(b.sql,i),_.current?.querySelector(`[data-testid="sql-query-${i}"]`)?.scrollIntoView({block:"nearest"}))},"selectQuery"),nt=r(i=>{l(b=>b.filter(k=>k.id!==i)),v(b=>b.map(k=>k.activeId===i?{...k,activeId:null}:k))},"deleteQuery"),st=r(i=>{ee(i.currentTarget.dataset.sql??"",null)},"loadTemplate"),lt=r(i=>{ee(i.currentTarget.dataset.sql??"",null)},"loadFromHistory"),rt=r(()=>{d([])},"clearHistory"),it=r(()=>{ce($t(L))},"formatDraft"),at=r(()=>{if(m.length>=Se)return;let i=X();v(b=>ao(b,i)),g(i.id)},"addEditorTab"),te=r(i=>{M(null),O(null),v(i.tabs),g(i.activeId);let b=new Set(i.tabs.map(k=>k.id));N(k=>Object.fromEntries(Object.entries(k).filter(([U])=>b.has(U))))},"commitTabs"),ct=r(i=>{te(co(m,i,X))},"closeEditorTab"),Te=r((i,b)=>{te(i==="others"?uo(m,b):i==="right"?fo(m,b,y):mo(X))},"applyBulk"),me=r(i=>{E!==null&&(po(i,m,E.id).some(b=>Ye(b))?O(i):Te(i,E.id))},"requestBulk"),dt=r((i,b)=>{b.preventDefault(),O(null),M({id:i,x:b.clientX,y:b.clientY})},"openTabMenu"),ut=r(()=>{M(null),O(null)},"closeTabMenu"),ft=r(i=>{i.preventDefault(),M(null),O(null)},"onBackdropContextMenu"),mt=r(()=>{me("others")},"onCloseOthers"),pt=r(()=>{me("right")},"onCloseToRight"),bt=r(()=>{me("all")},"onCloseAll"),ht=r(()=>{E!==null&&D!==null&&Te(D,E.id),O(null)},"confirmBulk"),vt=r(()=>{O(null)},"cancelBulk"),gt=E===null?void 0:{left:E.x,top:E.y},xt=r(i=>{de(),g(i)},"selectTab"),yt=r((i,b)=>{v(k=>k.map(U=>U.id===i?{...U,name:b}:U))},"renameTab"),Nt=r(()=>{Ce("results")},"showResults"),St=r(()=>{Q(fe("explain"))},"showExplain"),kt=r(()=>{Ce("chart")},"showChart"),Ct=r(()=>{A(!C)},"toggleSplit"),wt=L.split(`
|
|
4
|
+
`).length,Tt=r(i=>{c(i.target.value)},"onSearchChange"),pe=r(i=>`border-b-2 px-3 py-2 text-sm outline-none transition-colors ${i?"border-foreground font-medium text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,"tabClass"),Et=C?"flex min-h-0 flex-1 flex-row":"flex min-h-0 flex-1 flex-col",qt=C?"flex w-2/5 min-h-0 min-w-0 shrink-0 flex-col border-s border-border":"flex h-2/5 min-h-0 shrink-0 flex-col border-t border-border";return(0,n.jsxDEV)("div",{className:"flex h-full min-w-0","data-testid":"lunora-sql-editor",children:[(0,n.jsxDEV)(Xt,{activeId:W,history:a,listRef:_,onClearHistory:rt,onDelete:nt,onLoadHistory:lt,onLoadTemplate:st,onNew:tt,onSearchChange:Tt,onSelect:ot,queries:o,search:p},void 0,!1),(0,n.jsxDEV)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,n.jsxDEV)("div",{className:"flex shrink-0 items-stretch overflow-x-auto border-b border-border bg-muted/30","data-testid":"sql-tab-strip",role:"tablist",children:[m.map(i=>(0,n.jsxDEV)(go,{active:i.id===I.id,canClose:m.length>1,onClose:ct,onMenu:dt,onRename:yt,onSelect:xt,tab:i},i.id,!1)),(0,n.jsxDEV)("button",{"aria-label":t("New tab"),className:"flex size-8 shrink-0 items-center justify-center text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-40","data-testid":"sql-tab-add",disabled:m.length>=Se,onClick:at,title:t("New tab"),type:"button",children:(0,n.jsxDEV)("svg",{"aria-hidden":"true",className:"size-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.7,viewBox:"0 0 24 24",children:(0,n.jsxDEV)("path",{d:"M12 5v14M5 12h14"},void 0,!1)},void 0,!1)},void 0,!1)]},void 0,!0),E!==null&&(0,n.jsxDEV)(n.Fragment,{children:[(0,n.jsxDEV)("div",{className:"fixed inset-0 z-40","data-testid":"sql-tab-menu-backdrop",onClick:ut,onContextMenu:ft,role:"presentation"},void 0,!1),(0,n.jsxDEV)("div",{className:"fixed z-50 min-w-44 rounded-md border border-border bg-popover py-1 text-popover-foreground shadow-md","data-testid":"sql-tab-menu",role:"menu",style:gt,children:D===null?(0,n.jsxDEV)(n.Fragment,{children:[(0,n.jsxDEV)("button",{className:"flex w-full items-center px-3 py-1.5 text-start text-xs outline-none hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-40","data-testid":"sql-tab-menu-close-others",disabled:m.length<=1,onClick:mt,role:"menuitem",type:"button",children:t("Close other tabs")},void 0,!1),(0,n.jsxDEV)("button",{className:"flex w-full items-center px-3 py-1.5 text-start text-xs outline-none hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-40","data-testid":"sql-tab-menu-close-right",disabled:m.findIndex(i=>i.id===E.id)>=m.length-1,onClick:pt,role:"menuitem",type:"button",children:t("Close tabs to the right")},void 0,!1),(0,n.jsxDEV)("button",{className:"flex w-full items-center px-3 py-1.5 text-start text-xs outline-none hover:bg-accent focus-visible:bg-accent","data-testid":"sql-tab-menu-close-all",onClick:bt,role:"menuitem",type:"button",children:t("Close all tabs")},void 0,!1)]},void 0,!0):(0,n.jsxDEV)("div",{className:"px-3 py-1.5","data-testid":"sql-tab-menu-confirm",children:[(0,n.jsxDEV)("p",{className:"pb-1.5 text-xs text-muted-foreground",children:t("Discard unsaved tabs?")},void 0,!1),(0,n.jsxDEV)("div",{className:"flex items-center gap-1.5",children:[(0,n.jsxDEV)("button",{className:"rounded px-2 py-1 text-xs font-medium text-destructive outline-none hover:bg-destructive/10 focus-visible:bg-destructive/10","data-testid":"sql-tab-menu-confirm-discard",onClick:ht,type:"button",children:t("Discard")},void 0,!1),(0,n.jsxDEV)("button",{className:"rounded px-2 py-1 text-xs text-muted-foreground outline-none hover:bg-accent focus-visible:bg-accent","data-testid":"sql-tab-menu-confirm-cancel",onClick:vt,type:"button",children:t("Cancel")},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1)]},void 0,!0),(0,n.jsxDEV)("div",{className:Et,children:[(0,n.jsxDEV)("div",{className:"flex min-h-0 min-w-0 flex-1",children:[(0,n.jsxDEV)("div",{"aria-hidden":"true",className:"shrink-0 select-none overflow-hidden border-e border-border bg-muted/30 py-3 text-end font-mono text-xs leading-5 text-muted-foreground/60",ref:B,style:wo,children:Array.from({length:wt},(i,b)=>(0,n.jsxDEV)("div",{children:b+1},b,!1))},void 0,!1),(0,n.jsxDEV)("div",{className:"relative min-w-0 flex-1",children:[(0,n.jsxDEV)("textarea",{"aria-activedescendant":V===null?void 0:`${Y}-opt-${V.active.toString()}`,"aria-autocomplete":"list","aria-controls":V===null?void 0:Y,"aria-expanded":V!==null,"aria-label":t("SQL query"),className:"size-full resize-none bg-background p-3 font-mono text-xs leading-5 outline-none","data-testid":"sql-input",onBlur:Ze,onChange:Je,onKeyDown:Xe,onScroll:et,onSelect:Qe,placeholder:"SELECT * FROM \u2026",ref:P,role:"combobox",spellCheck:!1,value:L},void 0,!1),(0,n.jsxDEV)(Jt,{listboxId:Y,onPick:Ke,state:V},void 0,!1)]},void 0,!0)]},void 0,!0),(0,n.jsxDEV)("div",{className:qt,children:[(0,n.jsxDEV)("div",{className:"flex shrink-0 items-center gap-2 border-b border-border pe-2",children:[(0,n.jsxDEV)("button",{className:pe(j==="results"),"data-testid":"sql-tab-results",onClick:Nt,type:"button",children:t("Results")},void 0,!1),(0,n.jsxDEV)("button",{className:pe(j==="chart"),"data-testid":"sql-tab-chart",onClick:kt,type:"button",children:t("Chart")},void 0,!1),(0,n.jsxDEV)("button",{className:pe(j==="explain"),"data-testid":"sql-tab-explain",onClick:St,type:"button",children:t("Explain")},void 0,!1),(0,n.jsxDEV)("div",{className:"ms-auto flex items-center gap-2",children:[(0,n.jsxDEV)("button",{"aria-label":t("Split editor and results"),"aria-pressed":C,className:`inline-flex items-center rounded-md border border-border px-2 py-1.5 outline-none transition-colors hover:bg-accent focus-visible:bg-accent ${C?"bg-accent text-foreground":"text-muted-foreground"}`,"data-testid":"sql-split-toggle",onClick:Ct,title:t("Split editor and results"),type:"button",children:(0,n.jsxDEV)("svg",{"aria-hidden":"true",className:"size-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.7,viewBox:"0 0 24 24",children:[(0,n.jsxDEV)("rect",{height:"16",rx:"2",width:"18",x:"3",y:"4"},void 0,!1),(0,n.jsxDEV)("path",{d:"M12 4v16"},void 0,!1)]},void 0,!0)},void 0,!1),R!==null&&R.columns.length>0&&(0,n.jsxDEV)($e,{columns:R.columns,name:"query-result",rows:R.rows},void 0,!1),(0,n.jsxDEV)("button",{className:"inline-flex items-center rounded-md border border-border px-3 py-1.5 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50","data-testid":"sql-format",disabled:h,onClick:it,type:"button",children:t("Format")},void 0,!1),(0,n.jsxDEV)(Ie,{onChange:S,testId:"sql-shard-input",value:x},void 0,!1),(0,n.jsxDEV)("button",{className:"inline-flex items-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground outline-none transition-colors hover:bg-primary/90 focus-visible:bg-primary/90 disabled:pointer-events-none disabled:opacity-50","data-testid":"sql-run",disabled:h,onClick:Ve,type:"button",children:[t(h?"Running\u2026":"Run"),(0,n.jsxDEV)("kbd",{className:"rounded border border-primary-foreground/30 px-1 font-sans text-[10px]",children:"\u2318\u21B5"},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0),(0,n.jsxDEV)("div",{className:"min-h-0 flex-1 overflow-auto",children:[T!==null&&(0,n.jsxDEV)(Re,{className:"m-3 font-mono text-xs",testId:"sql-error",variant:"destructive",children:T},void 0,!1),T===null&&R===null&&(0,n.jsxDEV)("p",{className:"p-4 text-sm text-muted-foreground","data-testid":"sql-empty",children:t("Click Run to execute your query.")},void 0,!1),T===null&&R!==null&&(0,n.jsxDEV)("div",{"data-testid":"sql-result",children:[j==="chart"?(0,n.jsxDEV)(Pe,{result:R},void 0,!1):(0,n.jsxDEV)(To,{result:R},void 0,!1),(0,n.jsxDEV)("p",{className:"border-t border-border px-3 py-1.5 text-xs text-muted-foreground","data-testid":"sql-count",children:R.truncated?t("Showing the first {max} of {count} rows.",{count:R.rowCount,max:R.rows.length}):t("{count} rows",{count:R.rowCount})},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0)]},void 0,!0)]},void 0,!0)]},void 0,!0)},"SqlEditorPanel");function Eo(s){return(0,n.jsxDEV)(Me,{children:s},s,!1)}r(Eo,"_temp");export{Ho as SqlEditorPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,c as v,f as G}from"./chunk-RRCPZMC2.js";var C=v(h=>{"use strict";(function(){function T(e,r){return e===r&&(e!==0||1/e===1/r)||e!==e&&r!==r}a(T,"is");function f(e,r){u||i.startTransition===void 0||(u=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var t=r();if(!c){var o=r();L(t,o)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),c=!0)}o=y({inst:{value:t,getSnapshot:r}});var n=o[0].inst,O=o[1];return D(function(){n.value=t,n.getSnapshot=r,d(n)&&O({inst:n})},[e,t,r]),m(function(){return d(n)&&O({inst:n}),e(function(){d(n)&&O({inst:n})})},[e]),_(t),t}a(f,"useSyncExternalStore$2");function d(e){var r=e.getSnapshot;e=e.value;try{var t=r();return!L(e,t)}catch{return!0}}a(d,"checkIfSnapshotChanged");function A(e,r){return r()}a(A,"useSyncExternalStore$1"),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var i=G(),L=typeof Object.is=="function"?Object.is:T,y=i.useState,m=i.useEffect,D=i.useLayoutEffect,_=i.useDebugValue,u=!1,c=!1,E=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?A:f;h.useSyncExternalStore=i.useSyncExternalStore!==void 0?i.useSyncExternalStore:E,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var B=v((w,g)=>{"use strict";g.exports=C()});var K=v(H=>{"use strict";(function(){function T(_,u){return _===u&&(_!==0||1/_===1/u)||_!==_&&u!==u}a(T,"is"),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var f=G(),d=B(),A=typeof Object.is=="function"?Object.is:T,i=d.useSyncExternalStore,L=f.useRef,y=f.useEffect,m=f.useMemo,D=f.useDebugValue;H.useSyncExternalStoreWithSelector=function(_,u,c,E,e){var r=L(null);if(r.current===null){var t={hasValue:!1,value:null};r.current=t}else t=r.current;r=m(function(){function n(s){if(!O){if(O=!0,p=s,s=E(s),e!==void 0&&t.hasValue){var l=t.value;if(e(l,s))return S=l}return S=s}if(l=S,A(p,s))return l;var R=E(s);return e!==void 0&&e(l,R)?(p=s,l):(p=s,S=R)}a(n,"memoizedSelector");var O=!1,p,S,V=c===void 0?null:c;return[function(){return n(u())},V===null?void 0:function(){return n(V())}]},[u,c,E,e]);var o=i(_,r[0],r[1]);return y(function(){t.hasValue=!0,t.value=o},[o]),D(o),o},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var M=v((z,I)=>{"use strict";I.exports=K()});export{B as a,M as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as be,b as ge,c as xe,d as Ne,e as Ce}from"./chunk-S5NTGHCG.js";import"./chunk-DWDILV2E.js";import"./chunk-APSSZB6Z.js";import"./chunk-QAFAJBAW.js";import{a as ue}from"./chunk-3GXGLNKW.js";import{g as me,h as ve,i as fe,j as pe}from"./chunk-XWPZBZSZ.js";import"./chunk-ZPUO7FNI.js";import"./chunk-WVTPZ6CM.js";import"./chunk-SHERR7ZP.js";import"./chunk-5OIBXYZM.js";import"./chunk-L7SK4ZZD.js";import"./chunk-ZIGWVHCS.js";import"./chunk-7TJJXVSE.js";import"./chunk-WI7GWFEG.js";import"./chunk-KEGAWN6Y.js";import"./chunk-W666BB6V.js";import{a as de,b as ne,c as oe,d as q,e as Q,f as X}from"./chunk-GTM65MVX.js";import{a as re,e as se}from"./chunk-SEU5V7I6.js";import{a as ce}from"./chunk-VLXV72QE.js";import{a as W}from"./chunk-JSEXCW5Q.js";import"./chunk-KZ6INM5M.js";import"./chunk-4QHKBC77.js";import{R as le}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as $}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{b as he}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-G7ZBM54M.js";import{f as Y}from"./chunk-SDMZKBTD.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as ye}from"./chunk-TAD43CG5.js";import{d as U,h as z,l as R,n as ie,o as ke}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as n,e as ae,f as Me,g as Le,h as Be}from"./chunk-RRCPZMC2.js";var J=ae(Me(),1);var ee=ae(Le(),1);var l=ae(Be(),1);var De=n(r=>{let e=r.trim();if(e==="")return;let s=Number(e);return Number.isFinite(s)&&s>0?Math.floor(s):void 0},"parseTtl"),Oe=n(r=>r===void 0?"\u2014":new Date(r*1e3).toISOString(),"formatExpiration"),Ae=n(r=>new TextEncoder().encode(r).length,"byteLength"),Te=n(r=>{if(r.trim()!=="")try{return JSON.stringify(JSON.parse(r),void 0,2)}catch{return}},"tryFormatJson"),Ee=n(r=>{if(r.trim()==="")return!0;try{return JSON.parse(r),!0}catch{return!1}},"isJsonOrEmpty"),Fe=[{key:"seconds",seconds:1},{key:"minutes",seconds:60},{key:"hours",seconds:3600},{key:"days",seconds:86400}],Se=n((r,e)=>{let s=r.trim();if(s==="")return"";let u=Number(s),d=Fe.find(f=>f.key===e)?.seconds??1;return Number.isFinite(u)&&u>0?String(Math.round(u*d)):s},"ttlToSeconds"),Ke=n(r=>{let e=r.trim();if(e==="")return!0;let s=Number(e);return Number.isInteger(s)&&s>=60},"isTtlValid"),Ve=n((r,e,s,u)=>{let d=De(r.ttl);return{expiration:d===void 0?u:void 0,expirationTtl:d,key:e,metadata:r.metadata.trim()===""?void 0:JSON.parse(r.metadata),namespace:s,value:r.value}},"buildKvPutOptions"),Ie=n(r=>{let e=(0,ee.c)(60),{helper:s,id:u,invalid:d,onChange:f,testId:o}=r,t=U(),[a,p]=(0,J.useState)(""),[c,x]=(0,J.useState)("seconds"),b;e[0]!==f||e[1]!==c?(b=n(g=>{p(g.target.value),f(Se(g.target.value,c))},"t1"),e[0]=f,e[1]=c,e[2]=b):b=e[2];let M=b,V;e[3]!==a||e[4]!==f?(V=n(g=>{g!==null&&(x(g),f(Se(a,g)))},"t2"),e[3]=a,e[4]=f,e[5]=V):V=e[5];let L=V,h;e[6]!==t?(h=t("days"),e[6]=t,e[7]=h):h=e[7];let v;e[8]!==t?(v=t("hours"),e[8]=t,e[9]=v):v=e[9];let y;e[10]!==t?(y=t("minutes"),e[10]=t,e[11]=y):y=e[11];let N;e[12]!==t?(N=t("seconds"),e[12]=t,e[13]=N):N=e[13];let C;e[14]!==h||e[15]!==v||e[16]!==y||e[17]!==N?(C={days:h,hours:v,minutes:y,seconds:N},e[14]=h,e[15]=v,e[16]=y,e[17]=N,e[18]=C):C=e[18];let S=C,k;e[19]!==t?(k=t("Expires after"),e[19]=t,e[20]=k):k=e[20];let w;e[21]!==u||e[22]!==k?(w=(0,l.jsxDEV)(W,{className:"text-xs",htmlFor:u,children:k},void 0,!1),e[21]=u,e[22]=k,e[23]=w):w=e[23];let E;e[24]!==t?(E=t("No expiration"),e[24]=t,e[25]=E):E=e[25];let B;e[26]!==a||e[27]!==u||e[28]!==d||e[29]!==M||e[30]!==E||e[31]!==o?(B=(0,l.jsxDEV)(le,{"aria-invalid":d,className:"flex-1","data-testid":o,id:u,inputMode:"numeric",onChange:M,placeholder:E,value:a},void 0,!1),e[26]=a,e[27]=u,e[28]=d,e[29]=M,e[30]=E,e[31]=o,e[32]=B):B=e[32];let I;e[33]!==t?(I=t("TTL unit"),e[33]=t,e[34]=I):I=e[34];let O=`${o}-unit`,D;e[35]===Symbol.for("react.memo_cache_sentinel")?(D=(0,l.jsxDEV)(ge,{},void 0,!1),e[35]=D):D=e[35];let i;e[36]!==I||e[37]!==O?(i=(0,l.jsxDEV)(xe,{"aria-label":I,className:"w-[7.5rem]","data-testid":O,children:D},void 0,!1),e[36]=I,e[37]=O,e[38]=i):i=e[38];let m;e[39]!==S?(m=Fe.map(g=>(0,l.jsxDEV)(Ce,{value:g.key,children:S[g.key]},g.key,!1)),e[39]=S,e[40]=m):m=e[40];let K;e[41]!==m?(K=(0,l.jsxDEV)(Ne,{children:m},void 0,!1),e[41]=m,e[42]=K):K=e[42];let T;e[43]!==L||e[44]!==i||e[45]!==K||e[46]!==c?(T=(0,l.jsxDEV)(be,{onValueChange:L,value:c,children:[i,K]},void 0,!0),e[43]=L,e[44]=i,e[45]=K,e[46]=c,e[47]=T):T=e[47];let _;e[48]!==B||e[49]!==T?(_=(0,l.jsxDEV)("div",{className:"flex gap-2",children:[B,T]},void 0,!0),e[48]=B,e[49]=T,e[50]=_):_=e[50];let F;e[51]!==s||e[52]!==d||e[53]!==t||e[54]!==o?(F=d?(0,l.jsxDEV)("p",{className:"text-xs text-destructive","data-testid":`${o}-invalid`,children:t("TTL must be at least 60 seconds.")},void 0,!1):s!==void 0&&(0,l.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:s},void 0,!1),e[51]=s,e[52]=d,e[53]=t,e[54]=o,e[55]=F):F=e[55];let A;return e[56]!==_||e[57]!==F||e[58]!==w?(A=(0,l.jsxDEV)("div",{className:"mb-3 grid gap-1",children:[w,_,F]},void 0,!0),e[56]=_,e[57]=F,e[58]=w,e[59]=A):A=e[59],A},"TtlField"),_e=n(r=>{let e=(0,ee.c)(36),{id:s,invalidTestId:u,onChange:d,testId:f,valid:o,value:t}=r,a=U(),p;e[0]!==t?(p=Te(t),e[0]=t,e[1]=p):p=e[1];let c=p,x;e[2]!==a?(x=a("Metadata (JSON)"),e[2]=a,e[3]=x):x=e[3];let b;e[4]!==s||e[5]!==x?(b=(0,l.jsxDEV)(W,{className:"text-xs",htmlFor:s,children:x},void 0,!1),e[4]=s,e[5]=x,e[6]=b):b=e[6];let M=`${f}-format`,V=c===void 0,L;e[7]!==c||e[8]!==d?(L=n(()=>{c!==void 0&&d(c)},"t6"),e[7]=c,e[8]=d,e[9]=L):L=e[9];let h;e[10]!==a?(h=a("Format JSON"),e[10]=a,e[11]=h):h=e[11];let v;e[12]!==M||e[13]!==V||e[14]!==L||e[15]!==h?(v=(0,l.jsxDEV)($,{"data-testid":M,disabled:V,onClick:L,size:"sm",variant:"outline",children:h},void 0,!1),e[12]=M,e[13]=V,e[14]=L,e[15]=h,e[16]=v):v=e[16];let y;e[17]!==b||e[18]!==v?(y=(0,l.jsxDEV)("div",{className:"flex items-center justify-between gap-2",children:[b,v]},void 0,!0),e[17]=b,e[18]=v,e[19]=y):y=e[19];let N=!o,C;e[20]!==d?(C=n(E=>{d(E.target.value)},"t11"),e[20]=d,e[21]=C):C=e[21];let S;e[22]!==s||e[23]!==N||e[24]!==C||e[25]!==f||e[26]!==t?(S=(0,l.jsxDEV)(ce,{"aria-invalid":N,className:"min-h-[4rem] font-mono text-xs","data-testid":f,id:s,onChange:C,value:t},void 0,!1),e[22]=s,e[23]=N,e[24]=C,e[25]=f,e[26]=t,e[27]=S):S=e[27];let k;e[28]!==u||e[29]!==a||e[30]!==o?(k=!o&&(0,l.jsxDEV)("p",{className:"text-xs text-destructive","data-testid":u,children:a("Metadata must be valid JSON.")},void 0,!1),e[28]=u,e[29]=a,e[30]=o,e[31]=k):k=e[31];let w;return e[32]!==S||e[33]!==k||e[34]!==y?(w=(0,l.jsxDEV)("div",{className:"mb-3 grid gap-1",children:[y,S,k]},void 0,!0),e[32]=S,e[33]=k,e[34]=y,e[35]=w):w=e[35],w},"MetadataField"),Je={busy:!1,error:null,metadata:"",name:"",ttl:"",value:""},Pe=n((r,e)=>{switch(e.type){case"setField":return{...r,[e.field]:e.value};case"submitFailed":return{...r,busy:!1,error:e.error};case"submitStart":return{...r,busy:!0,error:null};default:return r}},"createReducer"),$e=n(r=>{let e=(0,ee.c)(73),{namespace:s,onCancel:u,onCreated:d}=r,f=Y(),o=U(),[t,a]=(0,J.useReducer)(Pe,Je),p;e[0]!==t.metadata?(p=Ee(t.metadata),e[0]=t.metadata,e[1]=p):p=e[1];let c=p,x;e[2]!==t.ttl?(x=Ke(t.ttl),e[2]=t.ttl,e[3]=x):x=e[3];let b=x,M;e[4]!==c||e[5]!==t.busy||e[6]!==t.name||e[7]!==b?(M=t.name.trim()!==""&&c&&b&&!t.busy,e[4]=c,e[5]=t.busy,e[6]=t.name,e[7]=b,e[8]=M):M=e[8];let V=M,L;e[9]!==V||e[10]!==f||e[11]!==s||e[12]!==d||e[13]!==t.metadata||e[14]!==t.name||e[15]!==t.ttl||e[16]!==t.value?(L=n(()=>{V&&(a({type:"submitStart"}),R((async()=>{try{await f.putKvValue(Ve({metadata:t.metadata,ttl:t.ttl,value:t.value},t.name,s)),d()}catch(H){a({error:z(H),type:"submitFailed"})}})()))},"t4"),e[9]=V,e[10]=f,e[11]=s,e[12]=d,e[13]=t.metadata,e[14]=t.name,e[15]=t.ttl,e[16]=t.value,e[17]=L):L=e[17];let h=L,v;e[18]!==o?(v=o("Key name"),e[18]=o,e[19]=v):v=e[19];let y;e[20]!==v?(y=(0,l.jsxDEV)(W,{className:"text-xs",htmlFor:"kv-create-name",children:v},void 0,!1),e[20]=v,e[21]=y):y=e[21];let N;e[22]===Symbol.for("react.memo_cache_sentinel")?(N=n(H=>{a({field:"name",type:"setField",value:H.target.value})},"t7"),e[22]=N):N=e[22];let C;e[23]!==o?(C=o("Key name"),e[23]=o,e[24]=C):C=e[24];let S;e[25]!==t.name||e[26]!==C?(S=(0,l.jsxDEV)(le,{autoFocus:!0,"data-testid":"kv-create-name",id:"kv-create-name",onChange:N,placeholder:C,value:t.name},void 0,!1),e[25]=t.name,e[26]=C,e[27]=S):S=e[27];let k;e[28]!==y||e[29]!==S?(k=(0,l.jsxDEV)("div",{className:"grid gap-1",children:[y,S]},void 0,!0),e[28]=y,e[29]=S,e[30]=k):k=e[30];let w;e[31]!==o?(w=o("Value"),e[31]=o,e[32]=w):w=e[32];let E;e[33]!==w?(E=(0,l.jsxDEV)(W,{className:"text-xs",htmlFor:"kv-create-value",children:w},void 0,!1),e[33]=w,e[34]=E):E=e[34];let B;e[35]===Symbol.for("react.memo_cache_sentinel")?(B=n(H=>{a({field:"value",type:"setField",value:H.target.value})},"t13"),e[35]=B):B=e[35];let I;e[36]!==t.value?(I=(0,l.jsxDEV)(ce,{className:"min-h-[6rem] font-mono text-xs","data-testid":"kv-create-value",id:"kv-create-value",onChange:B,value:t.value},void 0,!1),e[36]=t.value,e[37]=I):I=e[37];let O;e[38]!==E||e[39]!==I?(O=(0,l.jsxDEV)("div",{className:"grid gap-1",children:[E,I]},void 0,!0),e[38]=E,e[39]=I,e[40]=O):O=e[40];let D=!b,i;e[41]===Symbol.for("react.memo_cache_sentinel")?(i=n(H=>{a({field:"ttl",type:"setField",value:H})},"t17"),e[41]=i):i=e[41];let m;e[42]!==D?(m=(0,l.jsxDEV)(Ie,{id:"kv-create-ttl",invalid:D,onChange:i,testId:"kv-create-ttl"},void 0,!1),e[42]=D,e[43]=m):m=e[43];let K;e[44]===Symbol.for("react.memo_cache_sentinel")?(K=n(H=>{a({field:"metadata",type:"setField",value:H})},"t19"),e[44]=K):K=e[44];let T;e[45]!==c||e[46]!==t.metadata?(T=(0,l.jsxDEV)(_e,{id:"kv-create-metadata",invalidTestId:"kv-create-metadata-invalid",onChange:K,testId:"kv-create-metadata",valid:c,value:t.metadata},void 0,!1),e[45]=c,e[46]=t.metadata,e[47]=T):T=e[47];let _=!V,F;e[48]!==t.busy||e[49]!==o?(F=t.busy?o("Creating\u2026"):o("Create key"),e[48]=t.busy,e[49]=o,e[50]=F):F=e[50];let A;e[51]!==h||e[52]!==_||e[53]!==F?(A=(0,l.jsxDEV)($,{"data-testid":"kv-create-submit",disabled:_,onClick:h,children:F},void 0,!1),e[51]=h,e[52]=_,e[53]=F,e[54]=A):A=e[54];let g=t.busy,P;e[55]!==o?(P=o("Cancel"),e[55]=o,e[56]=P):P=e[56];let j;e[57]!==u||e[58]!==t.busy||e[59]!==P?(j=(0,l.jsxDEV)($,{"data-testid":"kv-create-cancel",disabled:g,onClick:u,variant:"outline",children:P},void 0,!1),e[57]=u,e[58]=t.busy,e[59]=P,e[60]=j):j=e[60];let Z;e[61]!==A||e[62]!==j?(Z=(0,l.jsxDEV)("div",{className:"flex flex-wrap gap-2",children:[A,j]},void 0,!0),e[61]=A,e[62]=j,e[63]=Z):Z=e[63];let G;e[64]!==t.error?(G=t.error!==null&&(0,l.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"kv-create-error",role:"alert",children:t.error},void 0,!1),e[64]=t.error,e[65]=G):G=e[65];let te;return e[66]!==k||e[67]!==O||e[68]!==m||e[69]!==T||e[70]!==Z||e[71]!==G?(te=(0,l.jsxDEV)("div",{className:"grid gap-3 px-4 pb-4","data-testid":"kv-create-form",children:[k,O,m,T,Z,G]},void 0,!0),e[66]=k,e[67]=O,e[68]=m,e[69]=T,e[70]=Z,e[71]=G,e[72]=te):te=e[72],te},"KvCreateForm"),He={busy:"",editedMetadata:"",editedTtl:"",editedValue:"",loadError:null,loading:!0,value:null,writeError:null},Re=n((r,e)=>{switch(e.type){case"deleteStart":return{...r,busy:"deleting",writeError:null};case"editMetadata":return{...r,editedMetadata:e.value};case"editTtl":return{...r,editedTtl:e.value};case"editValue":return{...r,editedValue:e.value};case"loaded":return{...r,editedMetadata:e.metadata===null||e.metadata===void 0?"":JSON.stringify(e.metadata,null,2),editedValue:e.value??"",loading:!1,value:e.value};case"loadFailed":return{...r,loadError:e.error,loading:!1};case"saveOk":return{...r,busy:"",value:r.editedValue};case"saveStart":return{...r,busy:"saving",writeError:null};case"writeFailed":return{...r,busy:"",writeError:e.error};default:return r}},"valueReducer"),je=n(r=>{let e=(0,ee.c)(67),{expiration:s,keyName:u,namespace:d,onDeleted:f}=r,o=Y(),t=U(),[a,p]=(0,J.useReducer)(Re,He),c,x;e[0]!==o||e[1]!==u||e[2]!==d?(c=n(()=>{let g={cancelled:!1};return R((async()=>{try{let P=await o.getKvValue({key:u,namespace:d});g.cancelled||p({metadata:P.metadata,type:"loaded",value:P.value})}catch(P){let j=P;g.cancelled||p({error:z(j),type:"loadFailed"})}})()),()=>{g.cancelled=!0}},"t1"),x=[o,d,u],e[0]=o,e[1]=u,e[2]=d,e[3]=c,e[4]=x):(c=e[3],x=e[4]),(0,J.useEffect)(c,x);let b;e[5]===Symbol.for("react.memo_cache_sentinel")?(b=n(g=>{p({type:"editValue",value:g.target.value})},"t3"),e[5]=b):b=e[5];let M=b,V;e[6]===Symbol.for("react.memo_cache_sentinel")?(V=n(g=>{p({type:"editMetadata",value:g})},"t4"),e[6]=V):V=e[6];let L=V,h;e[7]!==a.editedValue?(h=Te(a.editedValue),e[7]=a.editedValue,e[8]=h):h=e[8];let v=h,y;e[9]!==a.editedMetadata?(y=Ee(a.editedMetadata),e[9]=a.editedMetadata,e[10]=y):y=e[10];let N=y,C;e[11]!==a.editedTtl?(C=Ke(a.editedTtl),e[11]=a.editedTtl,e[12]=C):C=e[12];let S=C,k;e[13]!==v?(k=n(()=>{v!==void 0&&p({type:"editValue",value:v})},"t8"),e[13]=v,e[14]=k):k=e[14];let w=k,E;e[15]!==o||e[16]!==s||e[17]!==u||e[18]!==N||e[19]!==d||e[20]!==a.editedMetadata||e[21]!==a.editedTtl||e[22]!==a.editedValue||e[23]!==t?(E=n(()=>{if(!N){p({error:t("Metadata must be valid JSON."),type:"writeFailed"});return}p({type:"saveStart"}),R((async()=>{try{await o.putKvValue(Ve({metadata:a.editedMetadata,ttl:a.editedTtl,value:a.editedValue},u,d,s)),p({type:"saveOk"})}catch(g){p({error:z(g),type:"writeFailed"})}})())},"t9"),e[15]=o,e[16]=s,e[17]=u,e[18]=N,e[19]=d,e[20]=a.editedMetadata,e[21]=a.editedTtl,e[22]=a.editedValue,e[23]=t,e[24]=E):E=e[24];let B=E,I;e[25]!==o||e[26]!==u||e[27]!==d||e[28]!==f?(I=n(()=>{p({type:"deleteStart"}),R((async()=>{try{await o.deleteKvKey({key:u,namespace:d}),f(u)}catch(g){p({error:z(g),type:"writeFailed"})}})())},"t10"),e[25]=o,e[26]=u,e[27]=d,e[28]=f,e[29]=I):I=e[29];let O=I,D;e[30]!==u?(D=n(()=>{ie(u)},"t11"),e[30]=u,e[31]=D):D=e[31];let i;e[32]!==t?(i=t("Copy key"),e[32]=t,e[33]=i):i=e[33];let m;e[34]!==D||e[35]!==i?(m=(0,l.jsxDEV)("div",{className:"mb-2 flex justify-end",children:(0,l.jsxDEV)($,{"data-testid":"kv-copy-key-btn",onClick:D,size:"sm",variant:"outline",children:i},void 0,!1)},void 0,!1),e[34]=D,e[35]=i,e[36]=m):m=e[36];let K;e[37]!==a.loadError?(K=a.loadError!==null&&(0,l.jsxDEV)("p",{className:"mb-2 text-sm text-destructive","data-testid":"kv-value-error",role:"alert",children:a.loadError},void 0,!1),e[37]=a.loadError,e[38]=K):K=e[38];let T;e[39]!==a.loading||e[40]!==t?(T=a.loading&&(0,l.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"kv-value-loading",children:t("Loading\u2026")},void 0,!1),e[39]=a.loading,e[40]=t,e[41]=T):T=e[41];let _;e[42]!==v||e[43]!==N||e[44]!==O||e[45]!==w||e[46]!==B||e[47]!==a.busy||e[48]!==a.editedMetadata||e[49]!==a.editedValue||e[50]!==a.loading||e[51]!==a.value||e[52]!==a.writeError||e[53]!==t||e[54]!==S?(_=!a.loading&&a.value!==null&&(0,l.jsxDEV)(l.Fragment,{children:[(0,l.jsxDEV)("div",{className:"mb-1 flex flex-wrap items-center gap-2",children:[(0,l.jsxDEV)(W,{className:"text-xs",htmlFor:"kv-value-editor",children:t("Value")},void 0,!1),v!==void 0&&(0,l.jsxDEV)(he,{variant:"secondary",children:t("JSON")},void 0,!1),(0,l.jsxDEV)("span",{className:"ml-auto text-xs tabular-nums text-muted-foreground","data-testid":"kv-value-size",children:ke(Ae(a.editedValue))},void 0,!1)]},void 0,!0),(0,l.jsxDEV)("textarea",{"aria-label":t("KV value"),className:"mb-2 min-h-[8rem] w-full rounded border border-border bg-muted/30 p-2 font-mono text-xs","data-testid":"kv-value-editor",id:"kv-value-editor",onChange:M,value:a.editedValue},void 0,!1),(0,l.jsxDEV)("div",{className:"mb-3 flex flex-wrap gap-2",children:[(0,l.jsxDEV)($,{"data-testid":"kv-format-btn",disabled:v===void 0,onClick:w,size:"sm",variant:"outline",children:t("Format JSON")},void 0,!1),(0,l.jsxDEV)($,{"data-testid":"kv-copy-value-btn",onClick:n(()=>{ie(a.editedValue)},"onClick"),size:"sm",variant:"outline",children:t("Copy value")},void 0,!1)]},void 0,!0),(0,l.jsxDEV)(Ie,{helper:t("Leave blank to keep the current expiration."),id:"kv-ttl-input",invalid:!S,onChange:n(g=>{p({type:"editTtl",value:g})},"onChange"),testId:"kv-ttl-input"},void 0,!1),(0,l.jsxDEV)(_e,{id:"kv-metadata-editor",invalidTestId:"kv-metadata-invalid",onChange:L,testId:"kv-metadata-editor",valid:N,value:a.editedMetadata},void 0,!1),(0,l.jsxDEV)("div",{className:"flex flex-wrap gap-2",children:[(0,l.jsxDEV)($,{"data-testid":"kv-save-btn",disabled:a.busy!==""||!N||!S,onClick:B,children:a.busy==="saving"?t("Saving\u2026"):t("Save")},void 0,!1),(0,l.jsxDEV)($,{"data-testid":"kv-delete-btn",disabled:a.busy!=="",onClick:O,variant:"destructive",children:a.busy==="deleting"?t("Deleting\u2026"):t("Delete")},void 0,!1)]},void 0,!0),a.writeError!==null&&(0,l.jsxDEV)("p",{className:"mt-2 text-sm text-destructive","data-testid":"kv-save-error",role:"alert",children:a.writeError},void 0,!1)]},void 0,!0),e[42]=v,e[43]=N,e[44]=O,e[45]=w,e[46]=B,e[47]=a.busy,e[48]=a.editedMetadata,e[49]=a.editedValue,e[50]=a.loading,e[51]=a.value,e[52]=a.writeError,e[53]=t,e[54]=S,e[55]=_):_=e[55];let F;e[56]!==a.loadError||e[57]!==a.loading||e[58]!==a.value||e[59]!==t?(F=!a.loading&&a.value===null&&a.loadError===null&&(0,l.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"kv-absent",children:t("Key is absent or has no value.")},void 0,!1),e[56]=a.loadError,e[57]=a.loading,e[58]=a.value,e[59]=t,e[60]=F):F=e[60];let A;return e[61]!==m||e[62]!==K||e[63]!==T||e[64]!==_||e[65]!==F?(A=(0,l.jsxDEV)("div",{className:"px-4 pb-4","data-testid":"kv-value-section",children:[m,K,T,_,F]},void 0,!0),e[61]=m,e[62]=K,e[63]=T,e[64]=_,e[65]=F,e[66]=A):A=e[66],A},"KvValueEditor"),we=100,ze={appliedPrefix:"",bulk:[],bulkBusy:!1,bulkError:null,cursor:null,keys:null,listComplete:!1,loadError:null,loading:!1,prefixInput:"",reloadNonce:0,selectedKey:null},Ue=n((r,e)=>{switch(e.type){case"appendPage":return{...r,cursor:e.cursor,keys:[...r.keys??[],...e.keys],listComplete:e.listComplete,loading:!1};case"applyFilter":return{...r,appliedPrefix:r.prefixInput,bulk:[],bulkError:null,cursor:null,keys:null,listComplete:!1,selectedKey:null};case"bulkDeleted":{let s=new Set(e.deleted);return{...r,bulk:r.bulk.filter(u=>!s.has(u)),bulkBusy:!1,bulkError:e.error,keys:r.keys===null?null:r.keys.filter(u=>!s.has(u.name)),selectedKey:r.selectedKey!==null&&s.has(r.selectedKey)?null:r.selectedKey}}case"bulkDeleteStart":return{...r,bulkBusy:!0,bulkError:null};case"firstPage":return{...r,cursor:e.cursor,keys:e.keys,listComplete:e.listComplete,loading:!1};case"keyDeleted":return{...r,bulk:r.bulk.filter(s=>s!==e.name),keys:r.keys===null?null:r.keys.filter(s=>s.name!==e.name),selectedKey:null};case"loadFailed":return{...r,loadError:e.error,loading:!1};case"loadStart":return{...r,loadError:null,loading:!0};case"prefixInput":return{...r,prefixInput:e.value};case"reload":return{...r,bulk:[],bulkError:null,reloadNonce:r.reloadNonce+1,selectedKey:null};case"selectKey":return{...r,selectedKey:e.name};case"toggleAllBulk":return{...r,bulk:e.names};case"toggleBulk":return{...r,bulk:r.bulk.includes(e.name)?r.bulk.filter(s=>s!==e.name):[...r.bulk,e.name]};default:return r}},"keyListReducer"),Ze=n(({namespace:r})=>{let e=Y(),s=U(),[u,d]=(0,J.useReducer)(Ue,ze),{appliedPrefix:f,bulk:o,bulkBusy:t,bulkError:a,cursor:p,keys:c,listComplete:x,loadError:b,loading:M,prefixInput:V,reloadNonce:L,selectedKey:h}=u,[v,y]=(0,J.useState)(!1);(0,J.useEffect)(()=>{let i={cancelled:!1};return R((async()=>{d({type:"loadStart"});try{let m=await e.listKvKeys({limit:we,namespace:r,prefix:f===""?void 0:f});i.cancelled||d({cursor:m.cursor??null,keys:m.keys,listComplete:m.listComplete,type:"firstPage"})}catch(m){i.cancelled||d({error:z(m),type:"loadFailed"})}})()),()=>{i.cancelled=!0}},[e,r,f,L]);let N=n(i=>{d({type:"prefixInput",value:i.target.value})},"onPrefixChange"),C=n(()=>{d({type:"applyFilter"})},"onFilter"),S=n(i=>{d({name:i.currentTarget.dataset.key??null,type:"selectKey"})},"onSelectKey"),k=n(()=>{p!==null&&(d({type:"loadStart"}),R((async()=>{try{let i=await e.listKvKeys({cursor:p,limit:we,namespace:r,prefix:f===""?void 0:f});d({cursor:i.cursor??null,keys:i.keys,listComplete:i.listComplete,type:"appendPage"})}catch(i){d({error:z(i),type:"loadFailed"})}})()))},"onLoadMore"),w=n(i=>{d({name:i,type:"keyDeleted"})},"onKeyDeleted"),E=n(i=>{d({name:i,type:"toggleBulk"})},"onToggleBulk"),B=n(i=>{d({names:i&&c!==null?c.map(m=>m.name):[],type:"toggleAllBulk"})},"onToggleAll"),I=n(()=>{if(o.length===0)return;let i=[...o];d({type:"bulkDeleteStart"}),R((async()=>{let m=await Promise.allSettled(i.map(_=>e.deleteKvKey({key:_,namespace:r}))),K=i.filter((_,F)=>m[F]?.status==="fulfilled"),T=i.length-K.length;d({deleted:K,error:T>0?s("Failed to delete {count} keys.",{count:T}):null,type:"bulkDeleted"})})())},"onBulkDelete"),O=n(()=>{y(!1),d({type:"reload"})},"onCreated"),D=c!==null&&c.length>0&&o.length===c.length;return(0,l.jsxDEV)(l.Fragment,{children:[(0,l.jsxDEV)("section",{className:"border border-border bg-card p-3","data-testid":"kv-keys-section",children:[(0,l.jsxDEV)("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[(0,l.jsxDEV)(le,{"aria-label":s("Filter keys by prefix"),className:"min-w-[16rem] flex-1","data-testid":"kv-prefix-input",onChange:N,placeholder:s("Filter by prefix\u2026"),value:V},void 0,!1),(0,l.jsxDEV)($,{"data-testid":"kv-filter-btn",disabled:M,onClick:C,children:s("Filter")},void 0,!1),(0,l.jsxDEV)($,{"data-testid":"kv-new-key-btn",onClick:n(()=>{y(i=>!i)},"onClick"),variant:"outline",children:s("New key")},void 0,!1),o.length>0&&(0,l.jsxDEV)($,{"data-testid":"kv-bulk-delete-btn",disabled:t,onClick:I,variant:"destructive",children:t?s("Deleting\u2026"):s("Delete {count}",{count:o.length})},void 0,!1)]},void 0,!0),a!==null&&(0,l.jsxDEV)("p",{className:"mb-2 text-sm text-destructive","data-testid":"kv-bulk-error",role:"alert",children:a},void 0,!1),b!==null&&(0,l.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"kv-keys-error",role:"alert",children:b},void 0,!1),c!==null&&c.length===0&&!M&&(0,l.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"kv-no-keys",children:s("No keys.")},void 0,!1),c!==null&&c.length>0&&(0,l.jsxDEV)(re,{className:"overflow-hidden py-0",children:(0,l.jsxDEV)(se,{className:"px-0",children:(0,l.jsxDEV)(de,{"data-testid":"kv-key-table",children:[(0,l.jsxDEV)(ne,{children:(0,l.jsxDEV)(q,{children:[(0,l.jsxDEV)(Q,{className:"w-10",children:(0,l.jsxDEV)(ue,{"aria-label":s("Select all"),checked:D,"data-testid":"kv-select-all",onCheckedChange:B},void 0,!1)},void 0,!1),(0,l.jsxDEV)(Q,{children:s("Key")},void 0,!1),(0,l.jsxDEV)(Q,{children:s("Expiration")},void 0,!1)]},void 0,!0)},void 0,!1),(0,l.jsxDEV)(oe,{children:c.map(i=>(0,l.jsxDEV)(q,{className:i.name===h?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-key":i.name,"data-testid":`kv-key-row-${i.name}`,onClick:S,children:[(0,l.jsxDEV)(X,{onClick:n(m=>{m.stopPropagation()},"onClick"),children:(0,l.jsxDEV)(ue,{"aria-label":s("Select {name}",{name:i.name}),checked:o.includes(i.name),"data-testid":`kv-select-${i.name}`,onCheckedChange:n(()=>{E(i.name)},"onCheckedChange")},void 0,!1)},void 0,!1),(0,l.jsxDEV)(X,{className:"font-mono text-xs",children:i.name},void 0,!1),(0,l.jsxDEV)(X,{className:"tabular-nums text-xs",children:Oe(i.expiration)},void 0,!1)]},i.name,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),!x&&p!==null&&(0,l.jsxDEV)("div",{className:"mt-2",children:(0,l.jsxDEV)($,{"data-testid":"kv-load-more",disabled:M,onClick:k,variant:"outline",children:s(M?"Loading\u2026":"Load more")},void 0,!1)},void 0,!1)]},void 0,!0),(0,l.jsxDEV)(me,{onOpenChange:n(i=>{i||y(!1)},"onOpenChange"),open:v,children:(0,l.jsxDEV)(ve,{className:"w-full gap-0 overflow-y-auto sm:max-w-md","data-testid":"kv-create-sheet",side:"right",children:[(0,l.jsxDEV)(fe,{children:(0,l.jsxDEV)(pe,{children:s("New key")},void 0,!1)},void 0,!1),(0,l.jsxDEV)($e,{namespace:r,onCancel:n(()=>{y(!1)},"onCancel"),onCreated:O},void 0,!1)]},void 0,!0)},void 0,!1),(0,l.jsxDEV)(me,{onOpenChange:n(i=>{i||d({name:null,type:"selectKey"})},"onOpenChange"),open:h!==null,children:(0,l.jsxDEV)(ve,{className:"w-full gap-0 overflow-y-auto sm:max-w-md","data-testid":"kv-editor-sheet",side:"right",children:[(0,l.jsxDEV)(fe,{children:(0,l.jsxDEV)(pe,{className:"truncate font-mono text-xs",children:h},void 0,!1)},void 0,!1),h!==null&&(0,l.jsxDEV)(je,{expiration:c?.find(i=>i.name===h)?.expiration,keyName:h,namespace:r,onDeleted:w},`${r}:${h}`,!1)]},void 0,!0)},void 0,!1)]},void 0,!0)},"KvKeyList"),ot=n(({loadNamespaces:r}={})=>{let e=Y(),s=U(),[u,d]=(0,J.useState)(null),[f,o]=(0,J.useState)(null),[t,a]=(0,J.useState)(null);(0,J.useEffect)(()=>{let c={cancelled:!1};return R((async()=>{try{let x=await(r??(()=>e.listKvNamespaces()))();c.cancelled||(d(x),o(null),a(b=>b??x[0]?.binding??null))}catch(x){c.cancelled||(d(null),o(z(x)))}})()),()=>{c.cancelled=!0}},[e,r]);let p=n(c=>{a(c.currentTarget.dataset.ns??null)},"onSelectNs");return(0,l.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-kv-browser",children:[f!==null&&(0,l.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"kv-ns-error",role:"alert",children:f},void 0,!1),u!==null&&u.length===0&&(0,l.jsxDEV)(ye,{description:s("Add a kv_namespaces binding to wrangler.jsonc \u2014 it appears here automatically, no wiring needed."),icon:(0,l.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,l.jsxDEV)("path",{d:"M5 5h14v4H5V5Zm0 5h14v4H5v-4Zm0 5h14v4H5v-4Z"},void 0,!1)},void 0,!1),testId:"kv-empty",title:s("No KV namespaces.")},void 0,!1),u!==null&&u.length>0&&(0,l.jsxDEV)(re,{className:"overflow-hidden py-0",children:(0,l.jsxDEV)(se,{className:"px-0",children:(0,l.jsxDEV)(de,{"data-testid":"kv-namespace-table",children:[(0,l.jsxDEV)(ne,{children:(0,l.jsxDEV)(q,{children:(0,l.jsxDEV)(Q,{children:s("Namespace")},void 0,!1)},void 0,!1)},void 0,!1),(0,l.jsxDEV)(oe,{children:u.map(c=>(0,l.jsxDEV)(q,{className:c.binding===t?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-ns":c.binding,"data-testid":`kv-ns-row-${c.binding}`,onClick:p,children:(0,l.jsxDEV)(X,{className:"font-mono text-xs",children:c.binding},void 0,!1)},c.binding,!1))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),t!==null&&(0,l.jsxDEV)(Ze,{namespace:t},t,!1)]},void 0,!0)},"KvBrowser");export{ot as KvBrowser};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as H}from"./chunk-HV7G6DFP.js";import{a as d,e as D,f as $}from"./chunk-RRCPZMC2.js";function k(r,h,t){let e=new Array(r);return new Proxy(e,{get(s,n,o){if(typeof n=="string"){let i=n.charCodeAt(0);if(i>=48&&i<=57){let l=+n;if(Number.isInteger(l)&&l>=0&&l<r){let a=s[l];if(!a){let u=h[l*2];a=s[l]={index:l,key:t(l),start:u,size:h[l*2+1],end:u+h[l*2+1],lane:0}}return a}}if(n==="length")return r}return Reflect.get(s,n,o)}})}d(k,"createLazyMeasurementsView");function z(r,h,t){let e=t.initialDeps??[],s,n=!0;function o(){var i;let l=!!t.key&&!!((i=t.debug)!=null&&i.call(t)),a=0;l&&(a=Date.now());let u=r();if(!(u.length!==e.length||u.some((p,c)=>e[c]!==p)))return s;e=u;let f=0;if(l&&(f=Date.now()),s=h(...u),l){let p=Math.round((Date.now()-a)*100)/100,c=Math.round((Date.now()-f)*100)/100,E=c/16,v=d((g,b)=>{for(g=String(g);g.length<b;)g=" "+g;return g},"pad");console.info(`%c\u23F1 ${v(c,5)} /${v(p,5)} ms`,`
|
|
2
|
+
font-size: .6rem;
|
|
3
|
+
font-weight: bold;
|
|
4
|
+
color: hsl(${Math.max(0,Math.min(120-120*E,120))}deg 100% 31%);`,t?.key)}return t?.onChange&&!(n&&t.skipInitialOnChange)&&t.onChange(s),n=!1,s}return d(o,"memoizedFunction"),o.updateDeps=i=>{e=i},o}d(z,"memo");function C(r,h){if(r===void 0)throw new Error(`Unexpected undefined${h?`: ${h}`:""}`);return r}d(C,"notUndefined");var W=d((r,h)=>Math.abs(r-h)<1.01,"approxEqual"),L=d((r,h,t)=>{let e;return function(...s){r.clearTimeout(e),e=r.setTimeout(()=>h.apply(this,s),t)}},"debounce");var y,A=d(()=>{if(y!==void 0)return y;if(typeof navigator>"u")return y=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return y=!0;let r=navigator.maxTouchPoints;return y=navigator.platform==="MacIntel"&&r!==void 0&&r>0},"isIOSWebKit");var V=d(r=>{let{offsetWidth:h,offsetHeight:t}=r;return{width:h,height:t}},"getRect"),J=d(r=>r,"defaultKeyExtractor"),q=d(r=>{let h=Math.max(r.startIndex-r.overscan,0),e=Math.min(r.endIndex+r.overscan,r.count-1)-h+1,s=new Array(e);for(let n=0;n<e;n++)s[n]=h+n;return s},"defaultRangeExtractor"),j=d((r,h)=>{let t=r.scrollElement;if(!t)return;let e=r.targetWindow;if(!e)return;let s=d(o=>{let{width:i,height:l}=o;h({width:Math.round(i),height:Math.round(l)})},"handler");if(s(V(t)),!e.ResizeObserver)return()=>{};let n=new e.ResizeObserver(o=>{let i=d(()=>{let l=o[0];if(l?.borderBoxSize){let a=l.borderBoxSize[0];if(a){s({width:a.inlineSize,height:a.blockSize});return}}s(V(t))},"run");r.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()});return n.observe(t,{box:"border-box"}),()=>{n.unobserve(t)}},"observeElementRect"),_={passive:!0};var U=typeof window>"u"?!0:"onscrollend"in window,X=d((r,h,t)=>{let e=r.scrollElement;if(!e)return;let s=r.targetWindow;if(!s)return;let n=r.options.useScrollendEvent&&U,o=0,i=n?null:L(s,()=>h(o,!1),r.options.isScrollingResetDelay),l=d(m=>()=>{o=t(e),i?.(),h(o,m)},"createHandler"),a=l(!0),u=l(!1);return e.addEventListener("scroll",a,_),n&&e.addEventListener("scrollend",u,_),()=>{e.removeEventListener("scroll",a),n&&e.removeEventListener("scrollend",u)}},"observeOffset"),N=d((r,h)=>X(r,h,t=>{let{horizontal:e,isRtl:s}=r.options;return e?t.scrollLeft*(s&&-1||1):t.scrollTop}),"observeElementOffset");var Y=d((r,h,t)=>{if(t.options.useCachedMeasurements){let e=t.indexFromElement(r),s=t.options.getItemKey(e);return t.itemSizeCache.get(s)??t.options.estimateSize(e)}if(h?.borderBoxSize){let e=h.borderBoxSize[0];if(e)return Math.round(e[t.options.horizontal?"inlineSize":"blockSize"])}if(!h){let e=t.indexFromElement(r),s=t.options.getItemKey(e),n=t.itemSizeCache.get(s);if(n!==void 0)return n}return r[t.options.horizontal?"offsetWidth":"offsetHeight"]},"measureElement"),G=d((r,{adjustments:h=0,behavior:t},e)=>{var s,n;(n=(s=e.scrollElement)==null?void 0:s.scrollTo)==null||n.call(s,{[e.options.horizontal?"left":"top"]:r+h,behavior:t})},"scrollWithAdjustments");var K=G,T=class{static{d(this,"Virtualizer")}constructor(h){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var t,e,s;return((s=(e=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:e.now)==null?void 0:s.call(e))??Date.now()},this.observer=(()=>{let t=null,e=d(()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(s=>{s.forEach(n=>{let o=d(()=>{let i=n.target,l=this.indexFromElement(i);if(!i.isConnected){this.observer.unobserve(i);for(let[a,u]of this.elementsCache)if(u===i){this.elementsCache.delete(a);break}return}this.shouldMeasureDuringScroll(l)&&this.resizeItem(l,this.options.measureElement(i,n,this))},"run");this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})})),"get");return{disconnect:d(()=>{var s;(s=e())==null||s.disconnect(),t=null},"disconnect"),observe:d(s=>{var n;return(n=e())==null?void 0:n.observe(s,{box:"border-box"})},"observe"),unobserve:d(s=>{var n;return(n=e())==null?void 0:n.unobserve(s)},"unobserve")}})(),this.range=null,this.setOptions=t=>{var e,s;let n={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:J,rangeExtractor:q,onChange:d(()=>{},"onChange"),measureElement:Y,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(let f in t){let p=t[f];p!==void 0&&(n[f]=p)}let o=this.options,i=null,l=null,a=!1;if(o!==void 0&&o.enabled&&n.enabled&&n.anchorTo==="end"&&this.scrollElement!==null){let f=o.count,p=n.count,c=this.getMeasurements(),E=f>0?((e=c[0])==null?void 0:e.key)??o.getItemKey(0):null,v=f>0?((s=c[f-1])==null?void 0:s.key)??o.getItemKey(f-1):null;if(p!==f||f>0&&p>0&&(n.getItemKey(0)!==E||n.getItemKey(p-1)!==v)){a=!0;let S=f>0?this.getVirtualItemForOffset(this.getScrollOffset())??c[0]:null;S&&(i=[S.key,this.getScrollOffset()-S.start]);let x=n.followOnAppend===!0?"auto":n.followOnAppend||null;x&&p>f&&this.isAtEnd(o.scrollEndThreshold)&&(f===0||n.getItemKey(p-1)!==v)&&(l=x)}}this.options=n,a&&(this.pendingMin=0,this.itemSizeCacheVersion++);let u=!1,m=0;if(i&&this.scrollOffset!==null){let[f,p]=i,c=this.getMeasurements(),{count:E,getItemKey:v}=this.options,g=0;for(;g<E&&v(g)!==f;)g++;if(g<E){let b=c[g];if(b){let S=b.start+p;S!==this.scrollOffset&&(m=S-this.scrollOffset,this.scrollOffset=S,u=!0)}}}(u||l)&&(this.pendingScrollAnchor=[u?i[0]:null,u?i[1]:0,l,m])},this.notify=t=>{var e,s;(s=(e=this.options).onChange)==null||s.call(e,this,t)},this.maybeNotify=z(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:"maybeNotify",debug:d(()=>this.options.debug,"debug"),initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}if(this.scrollElement=e,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(n=>{this.observer.observe(n)}),this.unsubs.push(this.options.observeElementRect(this,n=>{this.scrollRect=n,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(n,o)=>{if(o&&this._intendedScrollOffset===null&&n===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(n-this._intendedScrollOffset)<1.5&&(n=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;let i=this.getScrollOffset();this.scrollDirection=o?i===n?this.scrollDirection:i<n?"forward":"backward":null,this.scrollOffset=n,this.isScrolling=o,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){let n=this.scrollElement,o=d(()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},"onTouchStart"),i=d(()=>{this._iosTouching=!1,!(!A()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))},"onTouchEnd");n.addEventListener("touchstart",o,_),n.addEventListener("touchend",i,_),this.unsubs.push(()=>{n.removeEventListener("touchstart",o),n.removeEventListener("touchend",i),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}let s=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,s&&this.scrollElement&&this.options.enabled){let[n,o,i,l]=s;n!==null&&!i&&(A()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?l!==0&&(this._iosDeferredAdjustment+=l):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),i&&this.scrollToEnd({behavior:i})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;let t=this.getScrollOffset(),e=this.getMaxScrollOffset();if(t<0||t>e)return;let s=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(t,{adjustments:this.scrollAdjustments+=s,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(t,e)=>{let s=new Map,n=new Map;for(let o=e-1;o>=0;o--){let i=t[o];if(s.has(i.lane))continue;let l=n.get(i.lane);if(l==null||i.end>l.end?n.set(i.lane,i):i.end<l.end&&s.set(i.lane,!0),s.size===this.options.lanes)break}return n.size===this.options.lanes?Array.from(n.values()).sort((o,i)=>o.end===i.end?o.index-i.index:o.end-i.end)[0]:void 0},this.getMeasurementOptions=z(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(t,e,s,n,o,i,l)=>(this.prevLanes!==void 0&&this.prevLanes!==i&&(this.lanesChangedFlag=!0),this.prevLanes=i,this.pendingMin=null,{count:t,paddingStart:e,scrollMargin:s,getItemKey:n,enabled:o,lanes:i,laneAssignmentMode:l}),{key:!1}),this.getMeasurements=z(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:t,paddingStart:e,scrollMargin:s,getItemKey:n,enabled:o,lanes:i,laneAssignmentMode:l},a)=>{let u=this.itemSizeCache;if(!o)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(let c of this.laneAssignments.keys())c>=t&&this.laneAssignments.delete(c);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(c=>{this.itemSizeCache.set(c.key,c.size)}));let m=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1),i===1){let c=this.options.gap,E=t*2,v=this._flatMeasurements;if(!v||v.length<E){let S=new Float64Array(E);v&&m>0&&S.set(v.subarray(0,m*2)),v=S,this._flatMeasurements=v}let g;if(m===0)g=e+s;else{let S=m-1;g=v[S*2]+v[S*2+1]+c}for(let S=m;S<t;S++){let x=n(S),I=u.get(x),M=typeof I=="number"?I:this.options.estimateSize(S);v[S*2]=g,v[S*2+1]=M,g+=M+c}let b=k(t,v,n);return this.measurementsCache=b,b}let f=this.measurementsCache.slice(0,m),p=new Array(i).fill(void 0);for(let c=0;c<m;c++){let E=f[c];E&&(p[E.lane]=c)}for(let c=m;c<t;c++){let E=n(c),v=this.laneAssignments.get(c),g,b,S=l==="estimate"||u.has(E);if(v!==void 0&&this.options.lanes>1){g=v;let w=p[g],F=w!==void 0?f[w]:void 0;b=F?F.end+this.options.gap:e+s}else{let w=this.options.lanes===1?f[c-1]:this.getFurthestMeasurement(f,c);b=w?w.end+this.options.gap:e+s,g=w?w.lane:c%this.options.lanes,this.options.lanes>1&&S&&this.laneAssignments.set(c,g)}let x=u.get(E),I=typeof x=="number"?x:this.options.estimateSize(c),M=b+I;f[c]={index:c,start:b,size:I,end:M,key:E,lane:g},p[g]=c}return this.measurementsCache=f,f},{key:"getMeasurements",debug:d(()=>this.options.debug,"debug")}),this.calculateRange=z(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,e,s,n)=>t.length===0||e===0?(this.range=null,null):(this.range=Z(t,e,s,n,n===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:"calculateRange",debug:d(()=>this.options.debug,"debug")}),this.getVirtualIndexes=z(()=>{let t=null,e=null,s=this.calculateRange();return s&&(t=s.startIndex,e=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,e]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,e]},(t,e,s,n,o)=>n===null||o===null?[]:t({startIndex:n,endIndex:o,overscan:e,count:s}),{key:"getVirtualIndexes",debug:d(()=>this.options.debug,"debug")}),this.indexFromElement=t=>{let e=this.options.indexAttribute,s=t.getAttribute(e);return s?parseInt(s,10):(console.warn(`Missing attribute name '${e}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var e;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;let s=this.scrollState.index??((e=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:e.index);if(s!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),o=Math.max(0,s-n),i=Math.min(this.options.count-1,s+n);return t>=o&&t<=i}return!0},this.measureElement=t=>{if(!t){this.elementsCache.forEach((o,i)=>{o.isConnected||(this.observer.unobserve(o),this.elementsCache.delete(i))});return}let e=this.indexFromElement(t),s=this.options.getItemKey(e),n=this.elementsCache.get(s);n!==t&&(n&&this.observer.unobserve(n),this.observer.observe(t),this.elementsCache.set(s,t)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(e)&&this.resizeItem(e,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,e)=>{var s,n;if(t<0||t>=this.options.count)return;let o,i,l,a=this._flatMeasurements;if(this.options.lanes===1&&a!==null)l=this.options.getItemKey(t),i=a[t*2],o=a[t*2+1];else{let f=this.measurementsCache[t];if(!f)return;l=f.key,i=f.start,o=f.size}let u=this.itemSizeCache.get(l)??o,m=e-u;if(m!==0){let f=this.options.anchorTo==="end"&&((s=this.scrollState)==null?void 0:s.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,p=f?this.getTotalSize():0,c=((n=this.scrollState)==null?void 0:n.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[t]??{index:t,key:l,start:i,size:o,end:i+o,lane:0},m,this):i<this.getScrollOffset()+this.scrollAdjustments&&(!this.itemSizeCache.has(l)||this.scrollDirection!=="backward"));(this.pendingMin===null||t<this.pendingMin)&&(this.pendingMin=t),this.itemSizeCache.set(l,e),this.itemSizeCacheVersion++,f?this.applyScrollAdjustment(this.getTotalSize()-p):c&&this.applyScrollAdjustment(m),this.notify(!1)}},this.getVirtualItems=z(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,e)=>{let s=[];for(let n=0,o=t.length;n<o;n++){let i=t[n],l=e[i];s.push(l)}return s},{key:"getVirtualItems",debug:d(()=>this.options.debug,"debug")}),this.getVirtualItemForOffset=t=>{let e=this.getMeasurements();if(e.length===0)return;let s=this._flatMeasurements,n=this.options.lanes===1&&s!=null,o=P(0,e.length-1,n?i=>s[i*2]:i=>C(e[i]).start,t);return C(e[o])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(t=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=t,this.getOffsetForAlignment=(t,e,s=0)=>{if(!this.scrollElement)return 0;let n=this.getSize(),o=this.getScrollOffset();e==="auto"&&(e=t>=o+n?"end":"start"),e==="center"?t+=(s-n)/2:e==="end"&&(t-=n);let i=this.getMaxScrollOffset();return Math.max(Math.min(i,t),0)},this.getOffsetForIndex=(t,e="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));let s=this.getSize(),n=this.getScrollOffset(),o=this.measurementsCache[t];if(!o)return;if(e==="auto")if(o.end>=n+s-this.options.scrollPaddingEnd)e="end";else if(o.start<=n+this.options.scrollPaddingStart)e="start";else return[n,e];if(e==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),e];let i=e==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(i,e,o.size),e]},this.scrollToOffset=(t,{align:e="start",behavior:s="auto"}={})=>{let n=this.getOffsetForAlignment(t,e),o=this.now();this.scrollState={index:null,align:e,behavior:s,startedAt:o,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:e="auto",behavior:s="auto"}={})=>{t=Math.max(0,Math.min(t,this.options.count-1));let n=this.getOffsetForIndex(t,e);if(!n)return;let[o,i]=n,l=this.now();this.scrollState={index:t,align:i,behavior:s,startedAt:l,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:e="auto"}={})=>{let s=this.getScrollOffset()+t,n=this.now();this.scrollState={index:null,align:"start",behavior:e,startedAt:n,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:e}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:t="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:t});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:t})},this.getTotalSize=()=>{var t;let e=this.getMeasurements(),s;if(e.length===0)s=this.options.paddingStart;else if(this.options.lanes===1){let n=e.length-1,o=this._flatMeasurements;o!=null?s=o[n*2]+o[n*2+1]:s=((t=e[n])==null?void 0:t.end)??0}else{let n=Array(this.options.lanes).fill(null),o=e.length-1;for(;o>=0&&n.some(i=>i===null);){let i=e[o];n[i.lane]===null&&(n[i.lane]=i.end),o--}s=Math.max(...n.filter(i=>i!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let t=[];if(this.itemSizeCache.size===0)return t;let e=this.getMeasurements();for(let s of e)s&&this.itemSizeCache.has(s.key)&&t.push({index:s.index,key:s.key,start:s.start,size:s.size,end:s.end,lane:s.lane});return t},this._scrollToOffset=(t,{adjustments:e,behavior:s})=>{this._intendedScrollOffset=t+(e??0),this.options.scrollToFn(t,{behavior:s,adjustments:e},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(h)}applyScrollAdjustment(h,t){h!==0&&(this.options.debug&&console.info("correction",h),A()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=h:(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=h,behavior:t}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollAdjustments=0)))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,s=e?e[0]:this.scrollState.lastTargetOffset,n=1,o=s!==this.scrollState.lastTargetOffset;if(!o&&W(s,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=n){this.getScrollOffset()!==s&&this._scrollToOffset(s,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,o){let i=this.getSize()||600,l=Math.abs(s-this.getScrollOffset()),a=this.scrollState.behavior==="smooth"&&l>i;this.scrollState.lastTargetOffset=s,a||(this.scrollState.behavior="auto"),this._scrollToOffset(s,{adjustments:void 0,behavior:a?"smooth":"auto"})}this.scheduleScrollReconcile()}},P=d((r,h,t,e)=>{for(;r<=h;){let s=(r+h)/2|0,n=t(s);if(n<e)r=s+1;else if(n>e)h=s-1;else return s}return r>0?r-1:0},"findNearestBinarySearch");function Q(r,h,t){let e=0;for(;e<=h;){let s=(e+h)/2|0,n=r[s*2];if(n<t)e=s+1;else if(n>t)h=s-1;else return s}return e>0?e-1:0}d(Q,"findNearestBinarySearchFlat");function Z(r,h,t,e,s){let n=r.length-1;if(r.length<=e)return{startIndex:0,endIndex:n};if(e===1&&s!==null){let a=Q(s,n,t),u=a,m=t+h;for(;u<n&&s[u*2]+s[u*2+1]<m;)u++;return{startIndex:a,endIndex:u}}let i=P(0,n,d(a=>r[a].start,"getStart"),t),l=i;if(e===1)for(;l<n&&r[l].end<t+h;)l++;else if(e>1){let a=Array(e).fill(0);for(;l<n&&a.some(m=>m<t+h);){let m=r[l];a[m.lane]=m.end,l++}let u=Array(e).fill(t+h);for(;i>=0&&u.some(m=>m>=t);){let m=r[i];u[m.lane]=m.start,i--}i=Math.max(0,i-i%e),l=Math.min(n,l+(e-1-l%e))}return{startIndex:i,endIndex:l}}d(Z,"calculateRangeImpl");var O=D($(),1),B=D(H(),1);var R=typeof document<"u"?O.useLayoutEffect:O.useEffect;function tt({useFlushSync:r=!0,directDomUpdates:h=!1,directDomUpdatesMode:t="transform",...e}){let s=O.useReducer(a=>a+1,0)[1],n=O.useRef({enabled:h,mode:t,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});n.current.enabled=h,n.current.mode=t;let o=d(a=>{let u=n.current;if(!u.enabled||!u.container)return;let m=a.getTotalSize();if(m!==u.lastSize){u.lastSize=m;let g=a.options.horizontal?"width":"height";u.container.style[g]=`${m}px`}let f=!!a.options.horizontal,p=u.mode==="transform",c=f?"left":"top",E=a.options.scrollMargin,v=a.getVirtualItems();for(let g of v){let b=g.start-E,S=a.elementsCache.get(g.key);S&&u.lastPositions.get(S)!==b&&(u.lastPositions.set(S,b),p?S.style.transform=f?`translate3d(${b}px, 0, 0)`:`translate3d(0, ${b}px, 0)`:S.style[c]=`${b}px`)}},"applyDirectStyles"),i={...e,onChange:d((a,u)=>{var m;let f=n.current,p=!0;if(f.enabled){o(a);let c=a.range,E=f.prevRange;p=!E||E.isScrolling!==a.isScrolling||E.startIndex!==c?.startIndex||E.endIndex!==c?.endIndex,p&&(f.prevRange=c?{startIndex:c.startIndex,endIndex:c.endIndex,isScrolling:a.isScrolling}:null)}p&&(r&&u?(0,B.flushSync)(s):s()),(m=e.onChange)==null||m.call(e,a,u)},"onChange")},[l]=O.useState(()=>{let a=new T(i);return Object.assign(a,{containerRef:d(u=>{let m=n.current;if(m.container=u,m.lastSize=null,u&&m.enabled){let f=a.getTotalSize();m.lastSize=f;let p=a.options.horizontal?"width":"height";u.style[p]=`${f}px`}},"containerRef")})});return l.setOptions(i),R(()=>l._didMount(),[]),R(()=>l._willUpdate()),R(()=>{o(l)}),l}d(tt,"useVirtualizerBase");function ft(r){return tt({observeElementRect:j,observeElementOffset:N,scrollToFn:K,...r})}d(ft,"useVirtualizer");export{j as a,ft as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as m,e as r,g as c,h as d,j as i}from"./chunk-RRCPZMC2.js";var n=r(c(),1);var f=r(d(),1);function u(a){let e=(0,n.c)(8),t,s;e[0]!==a?({className:t,...s}=a,e[0]=a,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=i("animate-pulse rounded-md bg-muted",t),e[3]=t,e[4]=o):o=e[4];let l;return e[5]!==s||e[6]!==o?(l=(0,f.jsxDEV)("div",{"data-slot":"skeleton",className:o,...s},void 0,!1),e[5]=s,e[6]=o,e[7]=l):l=e[7],l}m(u,"Skeleton");export{u as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as o,c as r}from"./chunk-O3NAGRTR.js";import{a as i,e as d,f as l}from"./chunk-RRCPZMC2.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as o}from"./chunk-KJJ3WM6H.js";import{a as t}from"./chunk-RRCPZMC2.js";var d=t((h,i,r)=>o(h,e=>{i(e.height>0?e:{height:r,width:e.width})}),"flooredRectObserver");export{d as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as S}from"./chunk-WUFVFVHJ.js";import"./chunk-XNJNSCLM.js";import{b as T}from"./chunk-W666BB6V.js";import{a as w,b as A,c as E,d as m,e as s,f as l}from"./chunk-GTM65MVX.js";import{a as N,e as b}from"./chunk-SEU5V7I6.js";import{a as O}from"./chunk-VLXV72QE.js";import{a as k}from"./chunk-JSEXCW5Q.js";import{b as y}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as C}from"./chunk-G7ZBM54M.js";import"./chunk-SDMZKBTD.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as u}from"./chunk-TAD43CG5.js";import{d as h}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as d,e as p,f as D,h as H}from"./chunk-RRCPZMC2.js";var n=p(D(),1);var e=p(H(),1);var K=d(a=>{let t=a.trim();if(t.length===0)return{context:void 0,error:null};try{let o=JSON.parse(t);return o===null||typeof o!="object"||Array.isArray(o)?{context:void 0,error:"Targeting context must be a JSON object."}:{context:o,error:null}}catch{return{context:void 0,error:"Targeting context is not valid JSON."}}},"parseContext"),R='{ "targetingKey": "user-123", "plan": "premium" }',M=d(a=>a.type==="object"?JSON.stringify(a.value):String(a.value),"formatValue"),Y=d(({initialShardKey:a=""})=>{let t=h(),[o,F]=(0,n.useState)(""),{context:f,error:g}=K(o),I=(0,n.useMemo)(()=>f===void 0?{}:{context:f},[f]),{data:i,error:J,errorSource:L,liveError:j}=T(C.listFlags,I,{live:!0,shardKey:a}),v=i!==void 0,V=i?.configured??!1,x=(0,n.useMemo)(()=>Array.isArray(i?.flags)?[...i.flags].toSorted((r,B)=>r.key.localeCompare(B.key)):[],[i]),c;return v&&!V?c=(0,e.jsxDEV)(u,{description:t("No @lunora/flags provider is wired in this deployment. Add lunora/flags.ts with defineFlags({ provider }) to gate code paths on feature flags."),testId:"flags-unconfigured",title:t("No flags provider configured")},void 0,!1):v&&x.length===0?c=(0,e.jsxDEV)(u,{description:t('A flags provider is configured, but no handler reads a flag yet. Call ctx.flags.boolean("key", false) in a query, mutation, or action.'),testId:"flags-empty",title:t("No flags read")},void 0,!1):c=(0,e.jsxDEV)(N,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(b,{className:"px-0",children:(0,e.jsxDEV)(w,{"data-testid":"flags-table",children:[(0,e.jsxDEV)(A,{children:(0,e.jsxDEV)(m,{children:[(0,e.jsxDEV)(s,{children:t("Key")},void 0,!1),(0,e.jsxDEV)(s,{children:t("Type")},void 0,!1),(0,e.jsxDEV)(s,{children:t("Value")},void 0,!1),(0,e.jsxDEV)(s,{children:t("Reason")},void 0,!1),(0,e.jsxDEV)(s,{children:t("Variant")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(E,{children:x.map(r=>(0,e.jsxDEV)(m,{"data-testid":`flags-row-${r.key}`,children:[(0,e.jsxDEV)(l,{className:"font-mono text-xs",children:r.key},void 0,!1),(0,e.jsxDEV)(l,{className:"font-mono text-xs text-muted-foreground",children:r.type},void 0,!1),(0,e.jsxDEV)(l,{className:"font-mono text-xs",children:M(r)},void 0,!1),(0,e.jsxDEV)(l,{children:r.errorCode===void 0?(0,e.jsxDEV)("span",{className:"font-mono text-xs text-muted-foreground",children:r.reason??"\u2014"},void 0,!1):(0,e.jsxDEV)(y,{"data-testid":`flags-error-${r.key}`,variant:"destructive",children:r.errorCode},void 0,!1)},void 0,!1),(0,e.jsxDEV)(l,{className:"font-mono text-xs text-muted-foreground",children:r.variant??"\u2014"},void 0,!1)]},r.key,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-flags-panel",children:[J!==null&&(0,e.jsxDEV)(S,{error:L,testId:"flags-error"},void 0,!1),(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:t('Feature flags are read in code with ctx.flags.<type>("key", default). They evaluate through the OpenFeature provider configured in lunora/flags.ts; edit the targeting context below to see how each flag resolves for a given audience.')},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-col gap-2",children:[(0,e.jsxDEV)(k,{htmlFor:"flags-targeting-context",children:t("Targeting context (JSON)")},void 0,!1),(0,e.jsxDEV)(O,{className:"font-mono text-xs","data-testid":"flags-context-input",id:"flags-targeting-context",onChange:d(r=>{F(r.target.value)},"onChange"),placeholder:R,rows:3,value:o},void 0,!1),g!==null&&(0,e.jsxDEV)("p",{className:"text-xs text-destructive","data-testid":"flags-context-error",role:"alert",children:t(g)},void 0,!1),j!==void 0&&(0,e.jsxDEV)("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"flags-live-error",role:"alert",children:t("Live updates unavailable; showing the last evaluation.")},void 0,!1)]},void 0,!0),c]},void 0,!0)},"FlagsPanel");export{Y as FlagsPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as x}from"./chunk-4PC7IXNY.js";import{R as k}from"./chunk-VL23Y44O.js";import{d as b}from"./chunk-ITQKVEP7.js";import{a as c,e as C,f as $,g as j,h as w}from"./chunk-RRCPZMC2.js";var y=C(j(),1),u=C($(),1);var e=C(w(),1);var T=c(r=>{let t=(0,y.c)(21),{id:h,onChange:g,testId:o,value:v}=r,l=b(),f=(0,u.useId)(),[d]=(0,u.useState)(D),m;t[0]!==g?(m=c(_=>{g(_.target.value)},"t1"),t[0]=g,t[1]=m):m=t[1];let I=m,a;t[2]!==l?(a=l("Shard key"),t[2]=l,t[3]=a):a=t[3];let S=d.length>0?f:void 0,n;t[4]!==l?(n=l("shard key (optional)"),t[4]=l,t[5]=n):n=t[5];let s;t[6]!==h||t[7]!==I||t[8]!==a||t[9]!==S||t[10]!==n||t[11]!==o||t[12]!==v?(s=(0,e.jsxDEV)(k,{"aria-label":a,className:"h-8 w-48","data-testid":o,id:h,list:S,onChange:I,placeholder:n,value:v},void 0,!1),t[6]=h,t[7]=I,t[8]=a,t[9]=S,t[10]=n,t[11]=o,t[12]=v,t[13]=s):s=t[13];let i;t[14]!==f||t[15]!==d||t[16]!==o?(i=d.length>0&&(0,e.jsxDEV)("datalist",{"data-testid":`${o}-recents`,id:f,children:d.map(E)},void 0,!1),t[14]=f,t[15]=d,t[16]=o,t[17]=i):i=t[17];let p;return t[18]!==s||t[19]!==i?(p=(0,e.jsxDEV)(e.Fragment,{children:[s,i]},void 0,!0),t[18]=s,t[19]=i,t[20]=p):p=t[20],p},"ShardInput");function D(){return x()}c(D,"_temp");function E(r){return(0,e.jsxDEV)("option",{"aria-label":r,value:r},r,!1)}c(E,"_temp2");export{T as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as w}from"./chunk-WUFVFVHJ.js";import"./chunk-XNJNSCLM.js";import{b as k}from"./chunk-W666BB6V.js";import{a as C,b as $,c as A,d as v,e as n,f as c}from"./chunk-GTM65MVX.js";import{a as N,e as R}from"./chunk-SEU5V7I6.js";import{b as y}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as S}from"./chunk-G7ZBM54M.js";import"./chunk-SDMZKBTD.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as T}from"./chunk-TAD43CG5.js";import{d as b}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as p,e as x,g as O,h as B}from"./chunk-RRCPZMC2.js";var I=x(O(),1);var t=x(B(),1);var D=p((e,r)=>({delete:e("Delete"),list:e("List"),read:e("Read"),write:e("Write")})[r],"operationLabel"),E={delete:2,list:3,read:0,write:1},_=p(e=>[...e].toSorted((r,a)=>r.bucket.localeCompare(a.bucket)||E[r.on]-E[a.on]||(r.prefix??"").localeCompare(a.prefix??"")),"sortRules"),Q=p(()=>{let e=(0,I.c)(14),r=b(),a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];let{data:l,error:d,errorSource:i}=k(S.storageRules,a),h=l!==void 0,f;if(e[1]!==l||e[2]!==d||e[3]!==i||e[4]!==h||e[5]!==r){let g=_(Array.isArray(l?.rules)?l.rules:[]),m;e[7]!==d||e[8]!==i?(m=d!==null&&(0,t.jsxDEV)(w,{error:i,testId:"storage-rules-error"},void 0,!1),e[7]=d,e[8]=i,e[9]=m):m=e[9];let s;e[10]!==r?(s=r("Storage rules are declared in code with defineStorageRule and gate ctx.storage access per bucket. This view is read-only."),e[10]=r,e[11]=s):s=e[11];let u;e[12]!==s?(u=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"storage-rules-note",children:s},void 0,!1),e[12]=s,e[13]=u):u=e[13],f=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-storage-rules-panel",children:[m,u,h&&g.length===0?(0,t.jsxDEV)(T,{description:r("No defineStorageRule is wired through .use(storageRules(...)) in this deployment. Add one to gate object access by key prefix."),testId:"storage-rules-empty",title:r("No storage rules defined")},void 0,!1):(0,t.jsxDEV)(N,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(R,{className:"px-0",children:(0,t.jsxDEV)(C,{"data-testid":"storage-rules-table",children:[(0,t.jsxDEV)($,{children:(0,t.jsxDEV)(v,{children:[(0,t.jsxDEV)(n,{children:r("Bucket")},void 0,!1),(0,t.jsxDEV)(n,{children:r("Operation")},void 0,!1),(0,t.jsxDEV)(n,{children:r("Key prefix")},void 0,!1),(0,t.jsxDEV)(n,{children:r("Guarded by")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(A,{children:g.map(o=>(0,t.jsxDEV)(v,{"data-testid":`storage-rule-${o.bucket}-${o.on}-${o.prefix??""}`,children:[(0,t.jsxDEV)(c,{className:"font-mono text-xs",children:o.bucket},void 0,!1),(0,t.jsxDEV)(c,{children:(0,t.jsxDEV)(y,{variant:"secondary",children:D(r,o.on)},void 0,!1)},void 0,!1),(0,t.jsxDEV)(c,{className:"font-mono text-xs",children:o.prefix??(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:r("(whole bucket)")},void 0,!1)},void 0,!1),(0,t.jsxDEV)(c,{className:"font-mono text-xs text-muted-foreground",children:o.procedure},void 0,!1)]},`${o.bucket}:${o.on}:${o.prefix??""}:${o.procedure}`,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),e[1]=l,e[2]=d,e[3]=i,e[4]=h,e[5]=r,e[6]=f}else f=e[6];return f},"StorageRulesPanel");export{Q as StorageRulesPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as N}from"./chunk-WUFVFVHJ.js";import{a as y,b as T,c as E,d,e as c,f as n}from"./chunk-GTM65MVX.js";import{a as g,e as x}from"./chunk-SEU5V7I6.js";import{d as h}from"./chunk-ITQKVEP7.js";import{a as i,e as v,f as A,h as V,j as b}from"./chunk-RRCPZMC2.js";var m=v(A(),1);var e=v(V(),1);var $={ERROR:"error",INFO:"info",WARN:"warning"},F=i(r=>{let o=typeof r.metadata.table=="string"?r.metadata.table:void 0;return{description:`${r.detail} ${r.remediation}`,entity:o,issueType:r.title,key:r.cacheKey,level:$[r.level]}},"advisoryRow"),k=["error","warning","info"],D={error:"bg-destructive",info:"bg-info",warning:"bg-warning"},O=i((r,o)=>({error:r("Errors"),info:r("Info"),warning:r("Warnings")})[o],"levelLabel"),S=i((r,o,a)=>({error:r("{count} errors",{count:a}),info:r("{count} suggestions",{count:a}),warning:r("{count} warnings",{count:a})})[o],"levelCount"),H=i((r,o)=>({error:r("No errors detected"),info:r("No suggestions"),warning:r("No warnings detected")})[o],"emptyTitle"),K=i(({error:r=null,errorSource:o,rows:a,testId:l,toolbar:u})=>{let s=h(),[f,w]=(0,m.useState)("error"),C=(0,m.useMemo)(()=>{let t={error:0,info:0,warning:0};for(let R of a??[])t[R.level]+=1;return t},[a]),p=(a??[]).filter(t=>t.level===f),L=i(t=>{w(t.currentTarget.dataset.level)},"selectTab");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":l,children:[(0,e.jsxDEV)("div",{className:"flex border-b border-border",role:"tablist",children:k.map(t=>(0,e.jsxDEV)("button",{"aria-selected":f===t,className:"flex min-w-32 flex-col gap-0.5 border-b-2 border-transparent px-4 py-2 text-start outline-none transition-colors hover:bg-muted/40 focus-visible:bg-muted/40 aria-selected:border-foreground","data-level":t,"data-testid":`${l}-tab-${t}`,onClick:L,role:"tab",type:"button",children:[(0,e.jsxDEV)("span",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[(0,e.jsxDEV)("span",{"aria-hidden":"true",className:b("size-2 rounded-sm",D[t])},void 0,!1),O(s,t)]},void 0,!0),(0,e.jsxDEV)("span",{className:"ps-4 text-xs text-muted-foreground",children:S(s,t,C[t])},void 0,!1)]},t,!0))},void 0,!1),u!==void 0&&(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:u},void 0,!1),r!==null&&(0,e.jsxDEV)(N,{error:o??r,testId:`${l}-error`},void 0,!1),(0,e.jsxDEV)(g,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(x,{className:"px-0",children:(0,e.jsxDEV)(y,{children:[(0,e.jsxDEV)(T,{children:(0,e.jsxDEV)(d,{children:[(0,e.jsxDEV)(c,{children:s("Issue type")},void 0,!1),(0,e.jsxDEV)(c,{children:s("Entity/item")},void 0,!1),(0,e.jsxDEV)(c,{children:s("Description")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(E,{children:p.length===0?(0,e.jsxDEV)(d,{children:(0,e.jsxDEV)(n,{className:"h-40 text-center align-middle text-muted-foreground",colSpan:3,"data-testid":`${l}-empty`,children:[(0,e.jsxDEV)("span",{className:"block text-sm font-medium text-foreground",children:H(s,f)},void 0,!1),(0,e.jsxDEV)("span",{className:"block text-sm",children:s("Nothing to report for this deployment.")},void 0,!1)]},void 0,!0)},void 0,!1):p.map(t=>(0,e.jsxDEV)(d,{children:[(0,e.jsxDEV)(n,{className:"font-medium text-foreground",children:t.issueType},void 0,!1),(0,e.jsxDEV)(n,{className:"font-mono text-xs text-muted-foreground",children:t.entity??"\u2014"},void 0,!1),(0,e.jsxDEV)(n,{className:"text-muted-foreground",children:[(0,e.jsxDEV)("span",{children:t.description},void 0,!1),t.action!==void 0&&(0,e.jsxDEV)("span",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:t.action},void 0,!1)]},void 0,!0)]},t.key,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0)},"AdvisorView");export{F as a,K as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as q,b as B,c as V,d as p,e as d,f as n}from"./chunk-GTM65MVX.js";import{a as S,e as k}from"./chunk-SEU5V7I6.js";import{R as $}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as A}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-CKSHCYGC.js";import{f as F}from"./chunk-SDMZKBTD.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as H}from"./chunk-TAD43CG5.js";import{d as Q,h as E,k as K,l as I}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as f,e as C,f as Z,g as G,h as J}from"./chunk-RRCPZMC2.js";var z=C(G(),1);var s=C(Z(),1);var e=C(J(),1);var X=10,g=f(x=>{let l=(0,z.c)(7),{label:m,value:a}=x,r;l[0]!==m?(r=(0,e.jsxDEV)("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:m},void 0,!1),l[0]=m,l[1]=r):r=l[1];let v=a??"\u2014",o;l[2]!==v?(o=(0,e.jsxDEV)("span",{className:"font-mono text-sm",children:v},void 0,!1),l[2]=v,l[3]=o):o=l[3];let u;return l[4]!==r||l[5]!==o?(u=(0,e.jsxDEV)("div",{className:"flex flex-col gap-0.5",children:[r,o]},void 0,!0),l[4]=r,l[5]=o,l[6]=u):u=l[6],u},"Detail"),oe=f(({loadIndexes:x,runQuery:l}={})=>{let m=F(),a=Q(),[r,v]=(0,s.useState)(null),[o,u]=(0,s.useState)(null),[b,L]=(0,s.useState)(null),[N,O]=(0,s.useState)(""),[h,y]=(0,s.useState)(null),[M,w]=(0,s.useState)(null),[j,D]=(0,s.useState)(!1);(0,s.useEffect)(()=>{let t={cancelled:!1};return I((async()=>{try{let c=await(x??(()=>m.listVectorIndexes()))();t.cancelled||(v(c),u(null),L(T=>T??c[0]?.name??null))}catch(c){t.cancelled||(v(null),u(E(c)))}})()),()=>{t.cancelled=!0}},[m,x]);let i=r?.find(t=>t.name===b)??null,P=f(t=>{L(t.currentTarget.dataset.index??null),y(null),w(null)},"onSelect"),R=f(t=>{O(t.target.value)},"onQueryTextChange"),U=f(async()=>{let t=N.trim();if(!(b===null||t==="")){D(!0),w(null);try{let c=await(l??(T=>m.queryVectorIndex(T)))({name:b,text:t,topK:X});y(c)}catch(c){y(null),w(E(c))}finally{D(!1)}}},"search"),W=f(()=>{I(U())},"onSearch");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-vector-browser",children:[o!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"vector-error",role:"alert",children:o},void 0,!1),r!==null&&r.length===0&&(0,e.jsxDEV)(H,{description:a("Indexes declared with .vectorize() or defineVectorIndex() appear here."),icon:(0,e.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsxDEV)("path",{d:"M4 7l8-4 8 4-8 4-8-4Zm0 5 8 4 8-4M4 17l8 4 8-4"},void 0,!1)},void 0,!1),testId:"vector-empty",title:a("No vector indexes.")},void 0,!1),r!==null&&r.length>0&&(0,e.jsxDEV)(S,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(k,{className:"px-0",children:(0,e.jsxDEV)(q,{"data-testid":"vector-table",children:[(0,e.jsxDEV)(B,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(d,{children:a("name")},void 0,!1),(0,e.jsxDEV)(d,{children:a("table")},void 0,!1),(0,e.jsxDEV)(d,{children:a("dimensions")},void 0,!1),(0,e.jsxDEV)(d,{children:a("metric")},void 0,!1),(0,e.jsxDEV)(d,{children:a("vectors")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(V,{children:r.map(t=>(0,e.jsxDEV)(p,{className:t.name===b?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-index":t.name,"data-testid":`vector-row-${t.name}`,onClick:P,children:[(0,e.jsxDEV)(n,{className:"font-mono text-xs",children:t.name},void 0,!1),(0,e.jsxDEV)(n,{className:"font-mono text-xs",children:t.table},void 0,!1),(0,e.jsxDEV)(n,{className:"tabular-nums",children:t.dimensions??"\u2014"},void 0,!1),(0,e.jsxDEV)(n,{children:t.metric??"\u2014"},void 0,!1),(0,e.jsxDEV)(n,{className:"tabular-nums",children:t.vectorsCount??"\u2014"},void 0,!1)]},t.name,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),i!==null&&(0,e.jsxDEV)("section",{className:"border border-border bg-card p-3","data-testid":"vector-detail",children:[(0,e.jsxDEV)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,e.jsxDEV)(g,{label:a("field"),value:i.field},void 0,!1),(0,e.jsxDEV)(g,{label:a("dimensions"),value:i.dimensions},void 0,!1),(0,e.jsxDEV)(g,{label:a("metric"),value:i.metric},void 0,!1),(0,e.jsxDEV)(g,{label:a("vectors"),value:i.vectorsCount},void 0,!1)]},void 0,!0),i.metadata!==void 0&&i.metadata.length>0&&(0,e.jsxDEV)("p",{className:"mt-3 text-xs text-muted-foreground","data-testid":"vector-metadata",children:[a("metadata"),": ",(0,e.jsxDEV)("span",{className:"font-mono",children:i.metadata.join(", ")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)($,{className:"min-w-[18rem] flex-1","data-testid":"vector-query-input",onChange:R,placeholder:a("Search by similarity\u2026"),value:N},void 0,!1),(0,e.jsxDEV)(A,{"data-testid":"vector-search",disabled:j||N.trim()==="",onClick:W,children:a(j?"Searching\u2026":"Search")},void 0,!1)]},void 0,!0),M!==null&&(0,e.jsxDEV)("p",{className:"mt-2 text-sm text-destructive","data-testid":"vector-query-error",role:"alert",children:M},void 0,!1),h!==null&&h.length===0&&(0,e.jsxDEV)("p",{className:"mt-2 text-sm text-muted-foreground","data-testid":"vector-no-matches",children:a("No matches.")},void 0,!1),h!==null&&h.length>0&&(0,e.jsxDEV)(S,{className:"mt-3 overflow-hidden py-0",children:(0,e.jsxDEV)(k,{className:"px-0",children:(0,e.jsxDEV)(q,{"data-testid":"vector-matches",children:[(0,e.jsxDEV)(B,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(d,{children:a("id")},void 0,!1),(0,e.jsxDEV)(d,{children:a("score")},void 0,!1),(0,e.jsxDEV)(d,{children:a("metadata")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(V,{children:h.map(t=>(0,e.jsxDEV)(p,{"data-testid":`vector-match-${t.id}`,children:[(0,e.jsxDEV)(n,{className:"font-mono text-xs",children:t.id},void 0,!1),(0,e.jsxDEV)(n,{className:"tabular-nums",children:t.score.toFixed(4)},void 0,!1),(0,e.jsxDEV)(n,{className:"max-w-md truncate font-mono text-xs",children:t.metadata===void 0?"\u2014":K(t.metadata)},void 0,!1)]},t.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0)]},void 0,!0)},"VectorBrowser");export{oe as VectorBrowser};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as O}from"./chunk-J6J54MBP.js";import{a as j}from"./chunk-2K47A3P6.js";import{a as H}from"./chunk-WUFVFVHJ.js";import"./chunk-XNJNSCLM.js";import{b as K}from"./chunk-W666BB6V.js";import{a as P,b as F,c as L,d as k,e as u,f as m}from"./chunk-GTM65MVX.js";import{a as M,e as $}from"./chunk-SEU5V7I6.js";import{a as _}from"./chunk-LUP4YTBS.js";import"./chunk-4PC7IXNY.js";import"./chunk-2MLA6WFH.js";import"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import"./chunk-O3NAGRTR.js";import{b as y}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as R}from"./chunk-G7ZBM54M.js";import"./chunk-SDMZKBTD.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as B}from"./chunk-TAD43CG5.js";import{d as D}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as S,e as T,f as U,g as V,h as X}from"./chunk-RRCPZMC2.js";var G=T(V(),1),J=T(U(),1);var t=T(X(),1);var W=80,Z=S(a=>{if(a===void 0)return"";let e=JSON.stringify(a);return e.length>W?`${e.slice(0,W)}\u2026`:e},"formatArguments"),q=S(a=>{let e=[];for(let n of a){let o=n.id.toString();if(n.subscriptions.length===0){e.push({admin:n.admin,connectionId:n.id,key:`c${o}`,subscription:null});continue}n.subscriptions.forEach((s,N)=>{e.push({admin:n.admin,connectionId:n.id,key:`c${o}-s${N.toString()}`,subscription:s})})}return e},"toRows"),w=(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1),de=S(a=>{let e=(0,G.c)(22),{initialShardKey:n}=a,o=D(),[s,N]=(0,J.useState)(n??""),f;e[0]!==s?(f=s.trim(),e[0]=s,e[1]=f):f=e[1];let A=j(f,400),h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h={},e[2]=h):h=e[2];let p;e[3]!==A?(p={keepPreviousData:!0,shardKey:A},e[3]=A,e[4]=p):p=e[4];let{data:i,error:r,errorSource:c,refetch:Q}=K(R.listSubscriptions,h,p);O(Q,!0);let v;if(e[5]!==r||e[6]!==c||e[7]!==i||e[8]!==s||e[9]!==o){let C=i===void 0?[]:q(i.connections),l;e[11]!==s?(l=(0,t.jsxDEV)(_,{onChange:N,testId:"subs-shard-input",value:s},void 0,!1),e[11]=s,e[12]=l):l=e[12];let d;e[13]!==i||e[14]!==o?(d=i!==void 0&&(0,t.jsxDEV)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"subs-count",children:[(0,t.jsxDEV)(y,{variant:"secondary",children:o("{count} connections",{count:i.totalConnections})},void 0,!1),(0,t.jsxDEV)(y,{variant:"secondary",children:o("{count} subscriptions",{count:i.totalSubscriptions})},void 0,!1)]},void 0,!0),e[13]=i,e[14]=o,e[15]=d):d=e[15];let b;e[16]!==l||e[17]!==d?(b=(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[l,d]},void 0,!0),e[16]=l,e[17]=d,e[18]=b):b=e[18];let g;e[19]!==r||e[20]!==c?(g=r!==null&&(0,t.jsxDEV)(H,{error:c,testId:"subs-error"},void 0,!1),e[19]=r,e[20]=c,e[21]=g):g=e[21],v=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"subs-panel",children:[b,g,r===null&&i!==void 0&&C.length===0&&(0,t.jsxDEV)(B,{description:o("Active WebSocket subscriptions on this shard."),icon:(0,t.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsxDEV)("path",{d:"M5 12a7 7 0 0 1 14 0M8 12a4 4 0 0 1 8 0M12 12v8m0-8a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"},void 0,!1)},void 0,!1),testId:"subs-empty",title:o("No active subscriptions.")},void 0,!1),r===null&&C.length>0&&(0,t.jsxDEV)(M,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)($,{className:"px-0",children:(0,t.jsxDEV)(P,{"data-testid":"subs-table",children:[(0,t.jsxDEV)(F,{children:(0,t.jsxDEV)(k,{children:[(0,t.jsxDEV)(u,{children:o("Connection")},void 0,!1),(0,t.jsxDEV)(u,{children:o("Function path")},void 0,!1),(0,t.jsxDEV)(u,{children:o("Table")},void 0,!1),(0,t.jsxDEV)(u,{children:o("Arguments")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(L,{children:C.map(x=>{let{subscription:I}=x,E=Z(I?.args);return(0,t.jsxDEV)(k,{"data-testid":"subs-row",children:[(0,t.jsxDEV)(m,{className:"font-medium tabular-nums",children:(0,t.jsxDEV)("span",{className:"inline-flex items-center gap-1.5",children:["#",x.connectionId,x.admin&&(0,t.jsxDEV)(y,{variant:"outline",children:o("admin")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(m,{className:"font-mono text-xs",children:I?.functionPath??w},void 0,!1),(0,t.jsxDEV)(m,{children:I?.table??w},void 0,!1),(0,t.jsxDEV)(m,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:E||void 0,children:E||w},void 0,!1)]},x.key,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),e[5]=r,e[6]=c,e[7]=i,e[8]=s,e[9]=o,e[10]=v}else v=e[10];return v},"SubscriptionsPanel");export{de as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as y}from"./chunk-CKSHCYGC.js";import{a as n,e as b,f as h}from"./chunk-RRCPZMC2.js";var N=b(h(),1);var _=n(()=>{},"noop"),F=typeof document<"u"?N.useLayoutEffect:_;var O=b(h(),1),l={...O};var a=l.useInsertionEffect,V=a&&a!==l.useLayoutEffect?a:t=>t();function z(t){let e=y(B).current;return e.next=t,V(e.effect),e.trampoline}n(z,"useStableCallback");function B(){let t={next:void 0,callback:W,trampoline:n((...e)=>t.callback?.(...e),"trampoline"),effect:n(()=>{t.callback=t.next},"effect")};return t}n(B,"createStableCallback");function W(){throw new Error("Base UI: Cannot call an event handler while rendering.")}n(W,"assertNotCalled");function u(){return typeof window<"u"}n(u,"hasWindow");function m(t){return v(t)?(t.nodeName||"").toLowerCase():"#document"}n(m,"getNodeName");function i(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}n(i,"getWindow");function $(t){var e;return(e=(v(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}n($,"getDocumentElement");function v(t){return u()?t instanceof Node||t instanceof i(t).Node:!1}n(v,"isNode");function C(t){return u()?t instanceof Element||t instanceof i(t).Element:!1}n(C,"isElement");function L(t){return u()?t instanceof HTMLElement||t instanceof i(t).HTMLElement:!1}n(L,"isHTMLElement");function S(t){return!u()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof i(t).ShadowRoot}n(S,"isShadowRoot");function R(t){let{overflow:e,overflowX:c,overflowY:s,display:o}=k(t);return/auto|scroll|overlay|hidden|clip/.test(e+s+c)&&o!=="inline"&&o!=="contents"}n(R,"isOverflowElement");function Q(t){return/^(table|td|th)$/.test(m(t))}n(Q,"isTableElement");function I(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}n(I,"isTopLayer");var A=/transform|translate|scale|rotate|perspective|filter/,H=/paint|layout|strict|content/,r=n(t=>!!t&&t!=="none","isNotNone"),d;function K(t){let e=C(t)?k(t):t;return r(e.transform)||r(e.translate)||r(e.scale)||r(e.rotate)||r(e.perspective)||!M()&&(r(e.backdropFilter)||r(e.filter))||A.test(e.willChange||"")||H.test(e.contain||"")}n(K,"isContainingBlock");function Z(t){let e=p(t);for(;L(e)&&!D(e);){if(K(e))return e;if(I(e))return null;e=p(e)}return null}n(Z,"getContainingBlock");function M(){return d==null&&(d=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),d}n(M,"isWebKit");function D(t){return/^(html|body|#document)$/.test(m(t))}n(D,"isLastTraversableNode");function k(t){return i(t).getComputedStyle(t)}n(k,"getComputedStyle");function tt(t){return C(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}n(tt,"getNodeScroll");function p(t){if(m(t)==="html")return t;let e=t.assignedSlot||t.parentNode||S(t)&&t.host||$(t);return S(e)?e.host:e}n(p,"getParentNode");function x(t){let e=p(t);return D(e)?t.ownerDocument?t.ownerDocument.body:t.body:L(e)&&R(e)?e:x(e)}n(x,"getNearestOverflowAncestor");function g(t,e,c){var s;e===void 0&&(e=[]),c===void 0&&(c=!0);let o=x(t),T=o===((s=t.ownerDocument)==null?void 0:s.body),f=i(o);if(T){let E=j(f);return e.concat(f,f.visualViewport||[],R(o)?o:[],E&&c?g(E):[])}else return e.concat(o,g(o,[],c))}n(g,"getOverflowAncestors");function j(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}n(j,"getFrameElement");var w;w=new Set;function ot(...t){{let e=t.join(" ");w.has(e)||(w.add(e),console.error(`Base UI: ${e}`))}}n(ot,"error");export{F as a,l as b,z as c,m as d,i as e,$ as f,v as g,C as h,L as i,S as j,R as k,Q as l,I as m,K as n,Z as o,M as p,D as q,k as r,tt as s,p as t,g as u,j as v,ot as w};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as de,e as j}from"./chunk-JPILGFXT.js";import{a as ce}from"./chunk-AITOCPML.js";import"./chunk-X4QFAAZ5.js";import"./chunk-BJGBHGK3.js";import"./chunk-ZIGWVHCS.js";import"./chunk-KEGAWN6Y.js";import{b as ne}from"./chunk-W666BB6V.js";import{a as S}from"./chunk-SEU5V7I6.js";import{a as ie}from"./chunk-4PC7IXNY.js";import"./chunk-2MLA6WFH.js";import"./chunk-HV7G6DFP.js";import{b as A}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as E}from"./chunk-G7ZBM54M.js";import{f as ae,g as le}from"./chunk-SDMZKBTD.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as D,f as T,g as H,h as Q,l as F,p as oe}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as h,e as k,f as ke,g as re,h as se,j as w}from"./chunk-RRCPZMC2.js";var ve=k(re(),1);var c=k(ke(),1);var ue=k(re(),1);var W=k(se(),1);var Ae={connected:"bg-success",connecting:"bg-warning",idle:"bg-muted-foreground",offline:"bg-destructive"},fe=h(()=>{let t=(0,ue.c)(16),e=D(),a=le(),s;e:switch(a){case"connected":{let n;t[0]!==e?(n=e("Connected"),t[0]=e,t[1]=n):n=t[1],s=n;break e}case"connecting":{let n;t[2]!==e?(n=e("Connecting\u2026"),t[2]=e,t[3]=n):n=t[3],s=n;break e}case"idle":{let n;t[4]!==e?(n=e("Idle"),t[4]=e,t[5]=n):n=t[5],s=n;break e}case"offline":{let n;t[6]!==e?(n=e("Offline"),t[6]=e,t[7]=n):n=t[7],s=n;break e}default:s=a}let l=Ae[a],d;t[8]!==l?(d=w("size-2 rounded-full",l),t[8]=l,t[9]=d):d=t[9];let u;t[10]!==d?(u=(0,W.jsxDEV)("span",{"aria-hidden":"true",className:d},void 0,!1),t[10]=d,t[11]=u):u=t[11];let i;return t[12]!==a||t[13]!==u||t[14]!==s?(i=(0,W.jsxDEV)("span",{"aria-live":"polite",className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground","data-status":a,"data-testid":"dash-connection",role:"status",children:[u,s]},void 0,!0),t[12]=a,t[13]=u,t[14]=s,t[15]=i):i=t[15],i},"ConnectionBadge");var r=k(se(),1);var me={completed:0,failed:2,in_progress:1},Re=h(t=>{let e=0,a=0,s=0,l=0,d=[];for(let{metrics:u}of t){if(u===null){l+=1;continue}s+=1,e+=u.requests,a+=u.errors,d.push(...u.history??[])}return{errors:a,failed:l,history:d,reachable:s,requests:e}},"sumShardMetrics"),Me=h(t=>{let e=new Map;for(let a of t)for(let s of a){let l=e.get(s.path);if(l===void 0){e.set(s.path,{...s});continue}l.calls+=s.calls,l.errors+=s.errors,l.totalDurationMs+=s.totalDurationMs,l.scans=(l.scans??0)+(s.scans??0),l.maxDurationMs=Math.max(l.maxDurationMs,s.maxDurationMs),l.lastCalledAt=Math.max(l.lastCalledAt,s.lastCalledAt),(s.lastErrorAt??0)>(l.lastErrorAt??0)&&(l.lastErrorAt=s.lastErrorAt,l.lastErrorMessage=s.lastErrorMessage)}return[...e.values()]},"mergeFunctionStats"),_e=h(t=>{let e=new Map;for(let a of t)for(let s of a){let l=e.get(s.id);if(l===void 0){e.set(s.id,s);continue}let d=me[s.status]-me[l.status];(d>0||d===0&&(s.updatedAt??0)>(l.updatedAt??0))&&e.set(s.id,s)}return[...e.values()]},"dedupeMigrations"),Ie=T(E.getAuthMetrics),Le=T(E.getFunctionStats),Ce=T(E.getLogs),Oe=T(E.getMetrics),qe=T(E.migrationStatus),De=5,he=2e3,Fe=5,pe=.01,ge=.05,je=.1,Ue=.3,Pe=1,Ge=50,X=h((t,e,a)=>t>=a?"crit":t>=e?"warn":"ok","rateLevel"),Ve=h((t,e,a)=>t>=a?"crit":t>=e?"warn":"ok","countLevel"),Be={crit:"destructive",ok:"secondary",warn:"default"},U=h((t,e)=>e===0?"\u2014":`${(t/e*100).toFixed(1)}%`,"ratePercent"),Ke=h(t=>{let e=new Map;for(let s of t??[]){let l=e.get(s.bucketMs)??{calls:0,errors:0};l.calls+=s.calls,l.errors+=s.errors,e.set(s.bucketMs,l)}let a=[...e.entries()].toSorted((s,l)=>s[0]-l[0]);return{errors:a.map(([,s])=>s.errors),requests:a.map(([,s])=>s.calls)}},"requestErrorSeries"),$e=h(t=>{let e=0,a=0;for(let l of t)l.status==="failed"?e+=1:l.status==="in_progress"&&(a+=1);let s="ok";return e>0?s="crit":a>0&&(s="warn"),{failed:e,level:s,running:a}},"migrationSummary"),ze=h((t,e)=>t.failed>0?e("{count} failed",{count:t.failed.toString()}):t.running>0?e("{count} running",{count:t.running.toString()}):e("OK"),"migrationTileValue"),xe={crit:"bg-destructive",ok:"bg-success",warn:"bg-warning"},Ne={crit:"text-destructive",ok:"text-foreground",warn:"text-warning"},He={crit:"bg-destructive/10 text-destructive",ok:"bg-success/10 text-success",warn:"bg-warning/10 text-warning"},Qe=h(t=>t.includes("crit")?"crit":t.includes("warn")?"warn":"ok","worstLevel"),P=h(t=>{let e=(0,ve.c)(19),{chart:a,label:s,level:l,testId:d,value:u}=t,i=xe[l],n;e[0]!==i?(n=w("size-1.5 shrink-0 rounded-full",i),e[0]=i,e[1]=n):n=e[1];let p;e[2]!==n?(p=(0,r.jsxDEV)("span",{"aria-hidden":"true",className:n},void 0,!1),e[2]=n,e[3]=p):p=e[3];let g;e[4]!==s||e[5]!==p?(g=(0,r.jsxDEV)("span",{className:"flex items-center gap-1.5 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:[p,s]},void 0,!0),e[4]=s,e[5]=p,e[6]=g):g=e[6];let b=Ne[l],m;e[7]!==b?(m=w("truncate text-2xl font-semibold tabular-nums",b),e[7]=b,e[8]=m):m=e[8];let f;e[9]!==m||e[10]!==d||e[11]!==u?(f=(0,r.jsxDEV)("span",{className:m,"data-testid":d,children:u},void 0,!1),e[9]=m,e[10]=d,e[11]=u,e[12]=f):f=e[12];let v;e[13]!==a||e[14]!==f?(v=(0,r.jsxDEV)("div",{className:"flex items-center justify-between gap-3",children:[f,a]},void 0,!0),e[13]=a,e[14]=f,e[15]=v):v=e[15];let x;return e[16]!==g||e[17]!==v?(x=(0,r.jsxDEV)(S,{className:"gap-0 py-0",children:(0,r.jsxDEV)("div",{className:"flex flex-col gap-2.5 p-4",children:[g,v]},void 0,!0)},void 0,!1),e[16]=g,e[17]=v,e[18]=x):x=e[18],x},"SloCard"),We=h(async(t,e,a)=>{let s=await Promise.all(a.map(m=>{let f=H(m);return Promise.allSettled([t.query(Oe,{},f),t.query(Le,{},f),t.query(qe,{},f)])})),l=H(e),d=typeof t.schedulerStatus=="function"?t.schedulerStatus():Promise.reject(new Error("scheduler status unavailable")),[u,i,n]=await Promise.allSettled([t.query(Ce,{},l),t.query(Ie,{},l),d]),p=s.map(([m,f,v])=>({functions:f.status==="fulfilled"?f.value.functions:[],metrics:m.status==="fulfilled"?m.value:null,migrations:v.status==="fulfilled"?v.value.migrations:[]})),g=Re(p),b=s[0]?.[0];return{auth:i.status==="fulfilled"?i.value:null,entries:u.status==="fulfilled"?u.value.entries:[],functions:Me(p.map(m=>m.functions)),logsError:u.status==="rejected"?Q(u.reason):null,metricsError:g.reachable===0&&b?.status==="rejected"?Q(b.reason):null,migrations:_e(p.map(m=>m.migrations)),scheduler:n.status==="fulfilled"?n.value:null,totals:g}},"loadSloData"),ht=h(({initialShardKey:t})=>{let e=ae(),a=D(),[s,l]=(0,c.useState)([]),[d,u]=(0,c.useState)(null),[i,n]=(0,c.useState)(null),[p,g]=(0,c.useState)(null),[b,m]=(0,c.useState)([]),[f,v]=(0,c.useState)(null),[x,be]=(0,c.useState)(null),[we,Ee]=(0,c.useState)([]),[y]=(0,c.useState)(ie),R=(0,c.useRef)(!1),G=(0,c.useRef)(!0);(0,c.useEffect)(()=>(G.current=!0,()=>{G.current=!1}),[]);let M=t??"",_=(0,c.useCallback)(async()=>{if(R.current)return;R.current=!0;let o=await We(e,M,de(M,y));if(!G.current){R.current=!1;return}n(o.totals),g(o.metricsError),m(o.functions),Ee(o.migrations),l(o.entries),u(o.logsError),v(o.auth),be(o.scheduler),R.current=!1},[e,y,M]);(0,c.useEffect)(()=>{F(_())},[_]);let V=(0,c.useRef)(0),I=(0,c.useRef)(null),Se=h(()=>{let o=Date.now()-V.current;if(o>=he){V.current=Date.now(),F(_());return}I.current??=setTimeout(()=>{I.current=null,V.current=Date.now(),F(_())},he-o)},"scheduleFanOut");(0,c.useEffect)(()=>()=>{I.current!==null&&clearTimeout(I.current)},[]);let{data:J,liveError:Te}=ne(E.getMetrics,{},{live:!0,shardKey:M});(0,c.useEffect)(()=>{J!==void 0&&Se()},[J]);let B=s.filter(o=>o.level==="error"),K=B.slice(0,De),L=Ke(i?.history),Y=(0,c.useMemo)(()=>{let o=f?.history??[];return{attempts:o.map(N=>N.attempts),failures:o.map(N=>N.failures)}},[f?.history]),Z=b.filter(o=>o.calls>0).toSorted((o,N)=>N.errors/N.calls-o.errors/o.calls||N.calls-o.calls).slice(0,Fe),$=$e(we),ye=i===null||i.requests===0?0:i.errors/i.requests,z=X(ye,pe,ge),ee=f===null?"ok":X(f.failureRate,je,Ue),te=x===null?"ok":Ve(x.backlog,Pe,Ge),C=Qe([z,ee,te,$.level]),O,q;return C==="crit"?(O=a("Critical"),q=a("One or more service levels are breached.")):C==="warn"?(O=a("Degraded"),q=a("Some service levels need attention.")):(O=a("All systems healthy"),q=a("All service levels are within target.")),(0,r.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-health",children:[(0,r.jsxDEV)(S,{className:"gap-0 py-0",children:[(0,r.jsxDEV)("div",{className:"flex flex-wrap items-center justify-between gap-4 p-4",children:[(0,r.jsxDEV)("div",{className:"flex items-center gap-3",children:[(0,r.jsxDEV)("span",{"aria-hidden":"true",className:w("flex size-10 shrink-0 items-center justify-center rounded-full",He[C]),children:(0,r.jsxDEV)("span",{className:w("size-3 rounded-full",xe[C])},void 0,!1)},void 0,!1),(0,r.jsxDEV)("div",{className:"grid leading-tight",children:[(0,r.jsxDEV)("span",{className:"text-sm font-semibold text-foreground","data-testid":"hl-status",children:O},void 0,!1),(0,r.jsxDEV)("span",{className:"text-[13px] text-muted-foreground",children:q},void 0,!1)]},void 0,!0)]},void 0,!0),(0,r.jsxDEV)("div",{className:"flex flex-wrap items-center gap-4",children:[(0,r.jsxDEV)("div",{className:"text-end",children:[(0,r.jsxDEV)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:a("Requests")},void 0,!1),(0,r.jsxDEV)("div",{className:"flex items-center justify-end gap-2",children:[L.requests.length>=2&&(0,r.jsxDEV)(j,{ariaLabel:a("Requests over time"),className:"h-6 w-20 text-foreground",series:L.requests,testId:"hl-spark-requests"},void 0,!1),(0,r.jsxDEV)("span",{className:"text-lg font-semibold tabular-nums text-foreground","data-testid":"hl-requests",children:(i?.requests??0).toString()},void 0,!1)]},void 0,!0)]},void 0,!0),(0,r.jsxDEV)("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"},void 0,!1),(0,r.jsxDEV)("div",{className:"text-end",children:[(0,r.jsxDEV)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:a("Error rate")},void 0,!1),(0,r.jsxDEV)("div",{className:w("text-lg font-semibold tabular-nums",Ne[z]),"data-testid":"hl-error-rate",children:i===null?"\u2014":U(i.errors,i.requests)},void 0,!1)]},void 0,!0),(0,r.jsxDEV)("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"},void 0,!1),(0,r.jsxDEV)("div",{className:"flex items-center gap-2",children:[(0,r.jsxDEV)(fe,{},void 0,!1),(0,r.jsxDEV)(ce,{message:Te,prefix:"hl"},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0),p!==null&&(0,r.jsxDEV)("div",{className:"border-t border-border bg-destructive/5 px-4 py-2 text-sm text-destructive","data-testid":"hl-metrics-error",role:"alert",children:p},void 0,!1)]},void 0,!0),(0,r.jsxDEV)("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4","data-testid":"hl-slo",children:[(0,r.jsxDEV)(P,{chart:L.errors.length>=2?(0,r.jsxDEV)(j,{ariaLabel:a("Errors over time"),className:"h-7 w-20 text-destructive",series:L.errors,testId:"hl-spark-errors"},void 0,!1):void 0,label:a("Error rate"),level:z,testId:"hl-slo-errorrate",value:i===null?"\u2014":U(i.errors,i.requests)},void 0,!1),(0,r.jsxDEV)(P,{chart:Y.failures.length>=2?(0,r.jsxDEV)(j,{ariaLabel:a("Auth failures over time"),className:"h-7 w-20 text-destructive",series:Y.failures,testId:"hl-spark-auth"},void 0,!1):void 0,label:a("Auth failures"),level:ee,testId:"hl-slo-auth",value:f===null?"\u2014":U(f.failures,f.attempts)},void 0,!1),(0,r.jsxDEV)(P,{label:a("Scheduler backlog"),level:te,testId:"hl-slo-backlog",value:x===null?"\u2014":x.backlog.toString()},void 0,!1),(0,r.jsxDEV)(P,{label:a("Migrations"),level:$.level,testId:"hl-slo-migrations",value:ze($,a)},void 0,!1)]},void 0,!0),(0,r.jsxDEV)("div",{className:"grid gap-3 lg:grid-cols-2",children:[(0,r.jsxDEV)(S,{className:"gap-0 py-0","data-testid":"hl-functions",children:[(0,r.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Functions by error rate")},void 0,!1)},void 0,!1),Z.length===0?(0,r.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-functions-empty",children:a("No function activity yet.")},void 0,!1):(0,r.jsxDEV)("ul",{className:"divide-y divide-border",children:Z.map(o=>(0,r.jsxDEV)("li",{className:"flex flex-wrap items-center justify-between gap-2 px-4 py-2 text-xs","data-testid":"hl-fn-row",children:[(0,r.jsxDEV)("span",{className:"truncate font-mono text-foreground",children:o.path},void 0,!1),(0,r.jsxDEV)("span",{className:"flex shrink-0 items-center gap-2",children:[(0,r.jsxDEV)("span",{className:"tabular-nums text-muted-foreground",children:a("{count} calls",{count:o.calls.toString()})},void 0,!1),(0,r.jsxDEV)(A,{variant:Be[X(o.errors/o.calls,pe,ge)],children:U(o.errors,o.calls)},void 0,!1)]},void 0,!0)]},o.path,!0))},void 0,!1)]},void 0,!0),(0,r.jsxDEV)(S,{className:"gap-0 py-0",children:[(0,r.jsxDEV)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[(0,r.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Recent errors")},void 0,!1),(0,r.jsxDEV)(A,{"data-testid":"hl-error-count",variant:B.length>0?"destructive":"outline",children:B.length},void 0,!1)]},void 0,!0),d!==null&&(0,r.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"hl-logs-error",role:"alert",children:d},void 0,!1),d===null&&K.length===0&&(0,r.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-errors-empty",children:a("No recent errors.")},void 0,!1),K.length>0&&(0,r.jsxDEV)("ul",{className:"divide-y divide-border",children:K.map((o,N)=>(0,r.jsxDEV)("li",{className:"flex flex-col gap-0.5 px-4 py-2 text-xs","data-testid":"hl-error-row",children:[(0,r.jsxDEV)("span",{className:"flex items-center gap-2",children:[(0,r.jsxDEV)("time",{className:"shrink-0 text-muted-foreground",children:oe(o.timestamp)},void 0,!1),o.functionPath!==void 0&&(0,r.jsxDEV)("span",{className:"truncate font-mono text-foreground",children:o.functionPath},void 0,!1)]},void 0,!0),(0,r.jsxDEV)("span",{className:"text-destructive",children:o.message},void 0,!1)]},`${o.timestamp.toString()}-${N.toString()}`,!0))},void 0,!1)]},void 0,!0)]},void 0,!0),(0,r.jsxDEV)(S,{className:"gap-0 py-0",children:[(0,r.jsxDEV)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[(0,r.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Shards seen")},void 0,!1),(0,r.jsxDEV)(A,{"data-testid":"hl-shard-count",variant:"outline",children:y.length},void 0,!1)]},void 0,!0),y.length>0&&(0,r.jsxDEV)("ul",{className:"flex flex-wrap gap-1.5 p-4",children:y.map(o=>(0,r.jsxDEV)("li",{"data-testid":"hl-shard",children:(0,r.jsxDEV)(A,{variant:"secondary",children:o},void 0,!1)},o,!1))},void 0,!1)]},void 0,!0)]},void 0,!0)},"HealthPanel");export{ht as HealthPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as V}from"./chunk-J6J54MBP.js";import{a as L}from"./chunk-2K47A3P6.js";import{a as W}from"./chunk-WUFVFVHJ.js";import"./chunk-XNJNSCLM.js";import{b as _}from"./chunk-W666BB6V.js";import{a as O,b as Q,c as U,d as K,e as R,f as D}from"./chunk-GTM65MVX.js";import{a as E}from"./chunk-SEU5V7I6.js";import{a as j}from"./chunk-LUP4YTBS.js";import"./chunk-4PC7IXNY.js";import"./chunk-2MLA6WFH.js";import"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import"./chunk-O3NAGRTR.js";import{b as w}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as H}from"./chunk-G7ZBM54M.js";import"./chunk-SDMZKBTD.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as B}from"./chunk-TAD43CG5.js";import{d as A}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as C,e as F,f as J,g as X,h as Y}from"./chunk-RRCPZMC2.js";var P=F(X(),1),G=F(J(),1);var t=F(Y(),1);var q=C(r=>`${r.toString()} ms`,"formatMs"),Z=C(r=>r.totalConnections===0&&r.shapePoke.passes===0&&r.whisper.passes===0,"isFanoutIdle"),$=C(r=>{let e=(0,P.c)(8),{label:o,testId:s,value:i}=r,l;e[0]!==o?(l=(0,t.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o},void 0,!1),e[0]=o,e[1]=l):l=e[1];let d;e[2]!==s||e[3]!==i?(d=(0,t.jsxDEV)("span",{className:"truncate text-2xl font-semibold tabular-nums text-foreground","data-testid":s,children:i},void 0,!1),e[2]=s,e[3]=i,e[4]=d):d=e[4];let v;return e[5]!==l||e[6]!==d?(v=(0,t.jsxDEV)(E,{className:"gap-0 py-0",children:(0,t.jsxDEV)("div",{className:"flex flex-col gap-2.5 p-4",children:[l,d]},void 0,!0)},void 0,!1),e[5]=l,e[6]=d,e[7]=v):v=e[7],v},"StatCard"),z=C(r=>{let e=(0,P.c)(48),{counters:o,includeTiming:s,prefix:i,t:l,title:d}=r,v=`${i}-section`,h;e[0]!==d?(h=(0,t.jsxDEV)("h3",{className:"text-sm font-medium text-foreground",children:d},void 0,!1),e[0]=d,e[1]=h):h=e[1];let k=`${i}-stats`,a;e[2]!==l?(a=l("Passes"),e[2]=l,e[3]=a):a=e[3];let n=`${i}-passes`,g;e[4]!==o.passes||e[5]!==a||e[6]!==n?(g=(0,t.jsxDEV)($,{label:a,testId:n,value:o.passes},void 0,!1),e[4]=o.passes,e[5]=a,e[6]=n,e[7]=g):g=e[7];let N;e[8]!==l?(N=l("Sockets iterated"),e[8]=l,e[9]=N):N=e[9];let I=`${i}-iterated`,c;e[10]!==o.socketsIterated||e[11]!==N||e[12]!==I?(c=(0,t.jsxDEV)($,{label:N,testId:I,value:o.socketsIterated},void 0,!1),e[10]=o.socketsIterated,e[11]=N,e[12]=I,e[13]=c):c=e[13];let f;e[14]!==l?(f=l("Delivered"),e[14]=l,e[15]=f):f=e[15];let y=`${i}-delivered`,u;e[16]!==o.socketsDelivered||e[17]!==f||e[18]!==y?(u=(0,t.jsxDEV)($,{label:f,testId:y,value:o.socketsDelivered},void 0,!1),e[16]=o.socketsDelivered,e[17]=f,e[18]=y,e[19]=u):u=e[19];let m;e[20]!==l?(m=l("Peak width"),e[20]=l,e[21]=m):m=e[21];let b=`${i}-peak`,p;e[22]!==o.peakSocketsIterated||e[23]!==m||e[24]!==b?(p=(0,t.jsxDEV)($,{label:m,testId:b,value:o.peakSocketsIterated},void 0,!1),e[22]=o.peakSocketsIterated,e[23]=m,e[24]=b,e[25]=p):p=e[25];let x;e[26]!==o.totalMs||e[27]!==s||e[28]!==i||e[29]!==l?(x=s&&(0,t.jsxDEV)($,{label:l("Total time"),testId:`${i}-total-ms`,value:q(o.totalMs)},void 0,!1),e[26]=o.totalMs,e[27]=s,e[28]=i,e[29]=l,e[30]=x):x=e[30];let S;e[31]!==o.maxMs||e[32]!==s||e[33]!==i||e[34]!==l?(S=s&&(0,t.jsxDEV)($,{label:l("Max time"),testId:`${i}-max-ms`,value:q(o.maxMs)},void 0,!1),e[31]=o.maxMs,e[32]=s,e[33]=i,e[34]=l,e[35]=S):S=e[35];let T;e[36]!==u||e[37]!==p||e[38]!==x||e[39]!==S||e[40]!==k||e[41]!==g||e[42]!==c?(T=(0,t.jsxDEV)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":k,children:[g,c,u,p,x,S]},void 0,!0),e[36]=u,e[37]=p,e[38]=x,e[39]=S,e[40]=k,e[41]=g,e[42]=c,e[43]=T):T=e[43];let M;return e[44]!==v||e[45]!==T||e[46]!==h?(M=(0,t.jsxDEV)("section",{className:"flex flex-col gap-2","data-testid":v,children:[h,T]},void 0,!0),e[44]=v,e[45]=T,e[46]=h,e[47]=M):M=e[47],M},"PathCounters"),ue=C(r=>{let e=(0,P.c)(32),{initialShardKey:o}=r,s=A(),[i,l]=(0,G.useState)(o??""),d;e[0]!==i?(d=i.trim(),e[0]=i,e[1]=d):d=e[1];let v=L(d,400),h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h={},e[2]=h):h=e[2];let k;e[3]!==v?(k={keepPreviousData:!0,shardKey:v},e[3]=v,e[4]=k):k=e[4];let{data:a,error:n,errorSource:g,refetch:N}=_(H.getFanoutMetrics,h,k);V(N,!0);let I;e[5]!==a?(I=a!==void 0&&Z(a),e[5]=a,e[6]=I):I=e[6];let c=I,f;e[7]!==i?(f=(0,t.jsxDEV)(j,{onChange:l,testId:"fanout-shard-input",value:i},void 0,!1),e[7]=i,e[8]=f):f=e[8];let y;e[9]!==a||e[10]!==s?(y=a!==void 0&&(0,t.jsxDEV)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"fanout-count",children:[a.promoted&&(0,t.jsxDEV)(w,{"data-testid":"fanout-promoted",variant:a.relayCount>=a.maxRelays?"destructive":"default",children:a.relayCount>=a.maxRelays?s("auto-scaled: {relayCount}/{maxRelays} relays (at ceiling)",{maxRelays:a.maxRelays,relayCount:a.relayCount}):s("auto-scaled: {relayCount}/{maxRelays} relays",{maxRelays:a.maxRelays,relayCount:a.relayCount})},void 0,!1),(0,t.jsxDEV)(w,{variant:"secondary",children:s("{count} connections",{count:a.totalConnections})},void 0,!1),(0,t.jsxDEV)(w,{variant:"secondary",children:s("peak {count} subscribers",{count:a.peakSubscribers})},void 0,!1)]},void 0,!0),e[9]=a,e[10]=s,e[11]=y):y=e[11];let u;e[12]!==f||e[13]!==y?(u=(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[f,y]},void 0,!0),e[12]=f,e[13]=y,e[14]=u):u=e[14];let m;e[15]!==n||e[16]!==g?(m=n!==null&&(0,t.jsxDEV)(W,{error:g,testId:"fanout-error"},void 0,!1),e[15]=n,e[16]=g,e[17]=m):m=e[17];let b;e[18]!==n||e[19]!==c||e[20]!==s?(b=n===null&&c&&(0,t.jsxDEV)(B,{description:s("Realtime fan-out cost and per-topic subscriber counts for this shard."),icon:(0,t.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsxDEV)("path",{d:"M4 12h4l3 7 4-14 3 7h2"},void 0,!1)},void 0,!1),testId:"fanout-empty",title:s("No fan-out activity yet.")},void 0,!1),e[18]=n,e[19]=c,e[20]=s,e[21]=b):b=e[21];let p;e[22]!==n||e[23]!==c||e[24]!==a||e[25]!==s?(p=n===null&&a!==void 0&&!c&&(0,t.jsxDEV)(t.Fragment,{children:[a.topics.length>0&&(0,t.jsxDEV)("section",{className:"flex flex-col gap-2","data-testid":"fanout-topics-section",children:[(0,t.jsxDEV)("h3",{className:"text-sm font-medium text-foreground",children:s("Hot topics")},void 0,!1),(0,t.jsxDEV)(E,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(O,{"data-testid":"fanout-topics-table",children:[(0,t.jsxDEV)(Q,{children:(0,t.jsxDEV)(K,{children:[(0,t.jsxDEV)(R,{children:s("Topic")},void 0,!1),(0,t.jsxDEV)(R,{children:s("Kind")},void 0,!1),(0,t.jsxDEV)(R,{className:"text-right",children:s("Subscribers")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(U,{children:a.topics.map(ee)},void 0,!1)]},void 0,!0)},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("section",{className:"flex flex-col gap-3","data-testid":"fanout-cost",children:[(0,t.jsxDEV)("h2",{className:"text-sm font-medium text-muted-foreground",children:s("Fan-out cost since this instance woke")},void 0,!1),(0,t.jsxDEV)(z,{counters:a.shapePoke,includeTiming:!0,prefix:"fanout-poke",t:s,title:s("Shape pokes")},void 0,!1),(0,t.jsxDEV)(z,{counters:a.whisper,includeTiming:!1,prefix:"fanout-whisper",t:s,title:s("Whisper broadcasts")},void 0,!1)]},void 0,!0)]},void 0,!0),e[22]=n,e[23]=c,e[24]=a,e[25]=s,e[26]=p):p=e[26];let x;return e[27]!==p||e[28]!==u||e[29]!==m||e[30]!==b?(x=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"fanout-panel",children:[u,m,b,p]},void 0,!0),e[27]=p,e[28]=u,e[29]=m,e[30]=b,e[31]=x):x=e[31],x},"FanoutPanel");function ee(r){return(0,t.jsxDEV)(K,{"data-testid":"fanout-topic-row",children:[(0,t.jsxDEV)(D,{className:"font-mono text-xs",children:r.topic},void 0,!1),(0,t.jsxDEV)(D,{children:(0,t.jsxDEV)(w,{variant:"outline",children:r.kind},void 0,!1)},void 0,!1),(0,t.jsxDEV)(D,{className:"text-right font-medium tabular-nums",children:r.subscribers},void 0,!1)]},`${r.kind}:${r.topic}`,!0)}C(ee,"_temp");export{ue as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as o}from"./chunk-CKSHCYGC.js";import{a as r,e as i,f as p}from"./chunk-RRCPZMC2.js";var a=i(p(),1);var c=a.forwardRef(r(function(e,n){let{className:m,render:f,orientation:t="horizontal",style:d,...s}=e;return o("div",e,{state:{orientation:t},ref:n,props:[{role:"separator","aria-orientation":t},s]})},"SeparatorComponent"));c.displayName="Separator";export{c as a};
|