@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,6 @@
|
|
|
1
|
+
import{a as M,b as E,c as O,d as B,e as R,f as D,g as _,h as J}from"./chunk-V43BLH4J.js";import{a as q}from"./chunk-AHILM3ZP.js";import{a as U}from"./chunk-EEWKIQUE.js";import{d as L,k as I,n as V}from"./chunk-ITQKVEP7.js";import{a as C,e as j,f as z,g as K,h as P}from"./chunk-RRCPZMC2.js";var T=j(K(),1),H=j(z(),1);var a=j(P(),1);var $="inline-flex items-center gap-1 rounded-md border border-border px-2.5 py-1 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50",W=/["\n,]/u,X=/^[=+\-@\t\r]/u,F=C(l=>{if(l==null)return"";let e;return typeof l=="string"?e=X.test(l)?` ${l}`:l:typeof l=="number"||typeof l=="boolean"||typeof l=="bigint"?e=String(l):e=JSON.stringify(l),W.test(e)?`"${e.replaceAll('"','""')}"`:e},"csvCell"),Y=C((l,e)=>{let o=l.map(n=>F(n)).join(","),s=e.map(n=>l.map(t=>F(n[t])).join(","));return[o,...s].join(`
|
|
2
|
+
`)},"toCsv"),Z=C(l=>JSON.stringify(l,null,2),"toJson"),G=500,Q=C(l=>`"${l.replaceAll('"','""')}"`,"sqlIdentifier"),ee=C(l=>l==null?"NULL":typeof l=="number"?Number.isFinite(l)?String(l):"NULL":typeof l=="bigint"?String(l):typeof l=="boolean"?l?"1":"0":`'${(typeof l=="string"?l:JSON.stringify(l)).replaceAll("'","''")}'`,"sqlLiteral"),te=C((l,e,o)=>{if(e.length===0||o.length===0)return"";let s=e.map(t=>Q(t)).join(", "),n=[];for(let t=0;t<o.length;t+=G){let r=o.slice(t,t+G).map(m=>` (${e.map(i=>ee(m[i])).join(", ")})`).join(`,
|
|
3
|
+
`);n.push(`INSERT INTO ${Q(l)} (${s}) VALUES
|
|
4
|
+
${r};`)}return n.join(`
|
|
5
|
+
|
|
6
|
+
`)},"toSql"),A=C((l,e,o)=>{if(!("document"in globalThis))return;let s=globalThis.URL.createObjectURL(new globalThis.Blob([e],{type:o})),n=globalThis.document.createElement("a");n.href=s,n.download=l,globalThis.document.body.append(n),n.click(),n.remove(),globalThis.URL.revokeObjectURL(s)},"downloadFile"),le=C(l=>{let e=(0,T.c)(36),{columns:o,name:s,rows:n}=l,t=L(),r;e[0]!==o||e[1]!==s||e[2]!==n?(r=C(()=>{A(`${s}.csv`,Y(o,n),"text/csv;charset=utf-8")},"t1"),e[0]=o,e[1]=s,e[2]=n,e[3]=r):r=e[3];let m=r,i;e[4]!==s||e[5]!==n?(i=C(()=>{A(`${s}.json`,Z(n),"application/json")},"t2"),e[4]=s,e[5]=n,e[6]=i):i=e[6];let f=i,d;e[7]!==o||e[8]!==s||e[9]!==n?(d=C(()=>{A(`${s}.sql`,te(s,o,n),"application/sql;charset=utf-8")},"t3"),e[7]=o,e[8]=s,e[9]=n,e[10]=d):d=e[10];let p=d,c=n.length===0,u;e[11]!==c?(u=(0,a.jsxDEV)(E,{className:$,"data-testid":"grid-export",disabled:c,title:"Exports only the rows loaded on the current page, not the whole table",children:"Export page"},void 0,!1),e[11]=c,e[12]=u):u=e[12];let v;e[13]===Symbol.for("react.memo_cache_sentinel")?(v=(0,a.jsxDEV)(R,{children:"Export loaded rows"},void 0,!1),e[13]=v):v=e[13];let g;e[14]!==t?(g=t("CSV"),e[14]=t,e[15]=g):g=e[15];let b;e[16]!==m||e[17]!==g?(b=(0,a.jsxDEV)(D,{"data-testid":"grid-export-csv",onClick:m,children:g},void 0,!1),e[16]=m,e[17]=g,e[18]=b):b=e[18];let h;e[19]!==t?(h=t("JSON"),e[19]=t,e[20]=h):h=e[20];let x;e[21]!==f||e[22]!==h?(x=(0,a.jsxDEV)(D,{"data-testid":"grid-export-json",onClick:f,children:h},void 0,!1),e[21]=f,e[22]=h,e[23]=x):x=e[23];let y;e[24]!==t?(y=t("SQL"),e[24]=t,e[25]=y):y=e[25];let w;e[26]!==p||e[27]!==y?(w=(0,a.jsxDEV)(D,{"data-testid":"grid-export-sql",onClick:p,children:y},void 0,!1),e[26]=p,e[27]=y,e[28]=w):w=e[28];let S;e[29]!==x||e[30]!==w||e[31]!==b?(S=(0,a.jsxDEV)(O,{align:"end",children:[v,b,x,w]},void 0,!0),e[29]=x,e[30]=w,e[31]=b,e[32]=S):S=e[32];let N;return e[33]!==S||e[34]!==u?(N=(0,a.jsxDEV)(M,{children:[u,S]},void 0,!0),e[33]=S,e[34]=u,e[35]=N):N=e[35],N},"ExportMenu"),oe=C(l=>{let e=(0,T.c)(9),{column:o}=l,s;e[0]!==o?(s=C(()=>{o.toggleVisibility()},"t1"),e[0]=o,e[1]=s):s=e[1];let n=s,t;e[2]!==o?(t=o.getIsVisible(),e[2]=o,e[3]=t):t=e[3];let r=`grid-column-${o.id}`,m;return e[4]!==o.id||e[5]!==n||e[6]!==t||e[7]!==r?(m=(0,a.jsxDEV)(_,{checked:t,closeOnClick:!1,"data-testid":r,onCheckedChange:n,children:o.id},void 0,!1),e[4]=o.id,e[5]=n,e[6]=t,e[7]=r,e[8]=m):m=e[8],m},"ColumnToggle"),se=C(l=>{let e=(0,T.c)(30),{table:o}=l,s=L(),n;e[0]!==o?(n=o.getIsAllColumnsVisible(),e[0]=o,e[1]=n):n=e[1];let t=n,r;e[2]!==t||e[3]!==o?(r=C(()=>{o.toggleAllColumnsVisible(!t)},"t2"),e[2]=t,e[3]=o,e[4]=r):r=e[4];let m=r,i;e[5]!==s?(i=s("Columns"),e[5]=s,e[6]=i):i=e[6];let f;e[7]!==i?(f=(0,a.jsxDEV)(E,{className:$,"data-testid":"grid-columns",children:i},void 0,!1),e[7]=i,e[8]=f):f=e[8];let d;e[9]!==s?(d=s("Columns"),e[9]=s,e[10]=d):d=e[10];let p;e[11]!==d?(p=(0,a.jsxDEV)(R,{children:d},void 0,!1),e[11]=d,e[12]=p):p=e[12];let c;e[13]!==t||e[14]!==s?(c=s(t?"Hide all":"Show all"),e[13]=t,e[14]=s,e[15]=c):c=e[15];let u;e[16]!==t||e[17]!==m||e[18]!==c?(u=(0,a.jsxDEV)(_,{checked:t,closeOnClick:!1,"data-testid":"grid-columns-all",onCheckedChange:m,children:c},void 0,!1),e[16]=t,e[17]=m,e[18]=c,e[19]=u):u=e[19];let v;e[20]===Symbol.for("react.memo_cache_sentinel")?(v=(0,a.jsxDEV)(J,{},void 0,!1),e[20]=v):v=e[20];let g;e[21]!==o?(g=o.getAllLeafColumns().map(ie),e[21]=o,e[22]=g):g=e[22];let b;e[23]!==g||e[24]!==p||e[25]!==u?(b=(0,a.jsxDEV)(O,{align:"end",className:"max-h-80 overflow-y-auto",children:(0,a.jsxDEV)(B,{children:[p,u,v,g]},void 0,!0)},void 0,!1),e[23]=g,e[24]=p,e[25]=u,e[26]=b):b=e[26];let h;return e[27]!==b||e[28]!==f?(h=(0,a.jsxDEV)(M,{children:[f,b]},void 0,!0),e[27]=b,e[28]=f,e[29]=h):h=e[29],h},"ColumnsMenu"),ne=C(l=>{let e=(0,T.c)(19),{count:o,editable:s,onClear:n,onDelete:t}=l,r=L(),m;e[0]!==o||e[1]!==r?(m=r("{count} selected",{count:o}),e[0]=o,e[1]=r,e[2]=m):m=e[2];let i;e[3]!==m?(i=(0,a.jsxDEV)("span",{className:"font-medium tabular-nums","data-testid":"grid-selection-count",children:m},void 0,!1),e[3]=m,e[4]=i):i=e[4];let f;e[5]!==r?(f=r("Clear"),e[5]=r,e[6]=f):f=e[6];let d;e[7]!==n||e[8]!==f?(d=(0,a.jsxDEV)("button",{className:$,"data-testid":"grid-selection-clear",onClick:n,type:"button",children:f},void 0,!1),e[7]=n,e[8]=f,e[9]=d):d=e[9];let p;e[10]!==o||e[11]!==s||e[12]!==t||e[13]!==r?(p=s&&(0,a.jsxDEV)(U,{confirmLabel:r("Delete {count} rows?",{count:o}),onConfirm:t,testId:"grid-selection-delete",children:r("Delete {count}",{count:o})},void 0,!1),e[10]=o,e[11]=s,e[12]=t,e[13]=r,e[14]=p):p=e[14];let c;return e[15]!==i||e[16]!==d||e[17]!==p?(c=(0,a.jsxDEV)("div",{className:"flex items-center gap-2 rounded-md border border-border bg-accent/40 px-3 py-1.5 text-xs","data-testid":"grid-selection-bar",children:[i,d,p]},void 0,!0),e[15]=i,e[16]=d,e[17]=p,e[18]=c):c=e[18],c},"SelectionBar"),pe=C(l=>{let e=(0,T.c)(32),{column:o,onClose:s,value:n}=l,t=L(),[r,m]=(0,H.useState)(!1),i;e[0]!==n?(i=I(n),e[0]=n,e[1]=i):i=e[1];let f=i,d;e[2]!==f?(d=C(()=>{V(f)&&m(!0)},"t2"),e[2]=f,e[3]=d):d=e[3];let p=d,c;e[4]!==t?(c=t("Cell value"),e[4]=t,e[5]=c):c=e[5];let u;e[6]!==o?(u=(0,a.jsxDEV)("h2",{className:"truncate font-mono text-sm font-semibold text-foreground",children:o},void 0,!1),e[6]=o,e[7]=u):u=e[7];let v;e[8]!==r||e[9]!==t?(v=t(r?"Copied":"Copy"),e[8]=r,e[9]=t,e[10]=v):v=e[10];let g;e[11]!==p||e[12]!==v?(g=(0,a.jsxDEV)("button",{className:$,"data-testid":"grid-cell-copy",onClick:p,type:"button",children:v},void 0,!1),e[11]=p,e[12]=v,e[13]=g):g=e[13];let b;e[14]!==t?(b=t("Close"),e[14]=t,e[15]=b):b=e[15];let h;e[16]!==s||e[17]!==b?(h=(0,a.jsxDEV)("button",{className:$,"data-testid":"grid-cell-close",onClick:s,type:"button",children:b},void 0,!1),e[16]=s,e[17]=b,e[18]=h):h=e[18];let x;e[19]!==g||e[20]!==h?(x=(0,a.jsxDEV)("div",{className:"flex items-center gap-1.5",children:[g,h]},void 0,!0),e[19]=g,e[20]=h,e[21]=x):x=e[21];let y;e[22]!==u||e[23]!==x?(y=(0,a.jsxDEV)("div",{className:"flex items-center justify-between",children:[u,x]},void 0,!0),e[22]=u,e[23]=x,e[24]=y):y=e[24];let w;e[25]!==f?(w=(0,a.jsxDEV)("pre",{className:"min-h-0 flex-1 overflow-auto rounded-md border border-border bg-muted/30 p-3 font-mono text-xs whitespace-pre-wrap","data-testid":"grid-cell-value",children:f},void 0,!1),e[25]=f,e[26]=w):w=e[26];let S;return e[27]!==s||e[28]!==y||e[29]!==w||e[30]!==c?(S=(0,a.jsxDEV)(q,{className:"max-h-[70vh] w-[min(40rem,90vw)]",label:c,onClose:s,panelTestId:"grid-cell-dialog",testId:"grid-cell-dialog-overlay",variant:"dialog",children:[y,w]},void 0,!0),e[27]=s,e[28]=y,e[29]=w,e[30]=c,e[31]=S):S=e[31],S},"CellDetailDialog"),ue=C(l=>{let e=(0,T.c)(33),{columns:o,editable:s,name:n,onBulkDelete:t,onToggleTranspose:r,rows:m,table:i,transposed:f}=l,d=L(),p;e[0]!==i?(p=i.getSelectedRowModel(),e[0]=i,e[1]=p):p=e[1];let c=p.rows,u;e[2]!==i?(u=C(()=>{i.resetRowSelection()},"t2"),e[2]=i,e[3]=u):u=e[3];let v=u,g;e[4]!==t||e[5]!==c||e[6]!==i?(g=C(()=>{t(c.map(re)),i.resetRowSelection()},"t3"),e[4]=t,e[5]=c,e[6]=i,e[7]=g):g=e[7];let b=g,h;e[8]!==o||e[9]!==n||e[10]!==m?(h=(0,a.jsxDEV)(le,{columns:o,name:n,rows:m},void 0,!1),e[8]=o,e[9]=n,e[10]=m,e[11]=h):h=e[11];let x;e[12]!==i?(x=(0,a.jsxDEV)(se,{table:i},void 0,!1),e[12]=i,e[13]=x):x=e[13];let y;e[14]!==d?(y=d("Swap rows and columns"),e[14]=d,e[15]=y):y=e[15];let w;e[16]!==d?(w=d("Transpose"),e[16]=d,e[17]=w):w=e[17];let S;e[18]!==r||e[19]!==y||e[20]!==w||e[21]!==f?(S=(0,a.jsxDEV)("button",{"aria-pressed":f,className:$,"data-testid":"grid-transpose",onClick:r,title:y,type:"button",children:w},void 0,!1),e[18]=r,e[19]=y,e[20]=w,e[21]=f,e[22]=S):S=e[22];let N;e[23]!==s||e[24]!==v||e[25]!==b||e[26]!==c.length?(N=c.length>0&&(0,a.jsxDEV)(ne,{count:c.length,editable:s,onClear:v,onDelete:b},void 0,!1),e[23]=s,e[24]=v,e[25]=b,e[26]=c.length,e[27]=N):N=e[27];let k;return e[28]!==h||e[29]!==x||e[30]!==S||e[31]!==N?(k=(0,a.jsxDEV)("div",{className:"flex flex-wrap items-center gap-1.5","data-testid":"grid-actions",children:[h,x,S,N]},void 0,!0),e[28]=h,e[29]=x,e[30]=S,e[31]=N,e[32]=k):k=e[32],k},"GridActionsBar");function ie(l){return(0,a.jsxDEV)(oe,{column:l},l.id,!1)}C(ie,"_temp");function re(l){return l.id}C(re,"_temp2");export{le as a,ne as b,pe as c,ue as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var s="https://dash.cloudflare.com/?to=/:account",L=`${s}/workers-and-pages/observability`,o=`${s}/workers-and-pages`,R=`${s}/r2`,a=`${s}/workers/d1`,r=`${s}/workers/durable-objects`;export{L as a,o as b,R as c,a as d,r as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as S}from"./chunk-J6J54MBP.js";import{a as R}from"./chunk-EEWKIQUE.js";import{a as h}from"./chunk-JSEXCW5Q.js";import{R as y}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as L}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{b as F}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as w}from"./chunk-G7ZBM54M.js";import{f as P}from"./chunk-SDMZKBTD.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as E,f as N,g as m,h as p,l as u}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a,e as O,f as Q,h as W}from"./chunk-RRCPZMC2.js";var o=O(Q(),1);var e=O(W(),1);var C=N(w.getPitrBookmark),X=N(w.pitrRestore),le=a(({initialShardKey:A})=>{let c=P(),r=E(),i=A??"",[U,v]=(0,o.useState)(null),[n,q]=(0,o.useState)(""),[B,_]=(0,o.useState)(null),[f,K]=(0,o.useState)(""),[x,M]=(0,o.useState)(!1),[s,z]=(0,o.useState)(null),[T,l]=(0,o.useState)(null),[k,d]=(0,o.useState)(!1),b=(0,o.useCallback)(async()=>{d(!0),l(null);try{let t=await c.query(C,{},m(i));v(t.current)}catch(t){l(p(t))}finally{d(!1)}},[c,i]);(0,o.useEffect)(()=>{u(b())},[b]),S(()=>{u((async()=>{try{let t=await c.query(C,{},m(i));v(t.current)}catch{}})())},!0);let D=a(t=>{q(t.target.value)},"onTimeChange"),j=a(t=>{K(t.target.value)},"onBookmarkChange"),G=a(t=>{M(t.target.checked)},"onRestartChange"),V=a(()=>{n.trim()!==""&&u((async()=>{d(!0),l(null);try{let t=await c.query(C,{time:n.trim()},m(i));_(t.forTime??null),v(t.current)}catch(t){_(null),l(p(t))}finally{d(!1)}})())},"onPreview"),I=a(t=>{u((async()=>{d(!0),l(null);try{let g=await c.mutation(X,t,m(i));z(g),await b()}catch(g){l(p(g))}finally{d(!1)}})())},"runRestore"),Z=f.trim()!==""||n.trim()!=="",H=a(()=>{let t=x?{restart:!0}:{};f.trim()===""?t.time=n.trim():t.bookmark=f.trim(),I(t)},"onConfirmRestore"),J=a(()=>{s!==null&&I(x?{bookmark:s.undoBookmark,restart:!0}:{bookmark:s.undoBookmark})},"onUndo");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-pitr",children:[(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-3",children:(0,e.jsxDEV)("span",{className:"text-xs text-muted-foreground",children:[r("Shard"),": ",(0,e.jsxDEV)("span",{className:"font-mono",children:i===""?r("root"):i},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"pitr-note",children:r("In-place recovery to any moment in the last 30 days. For older or portable recovery, use the snapshot backup tier.")},void 0,!1),T!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"pitr-error",role:"alert",children:T},void 0,!1),(0,e.jsxDEV)("section",{className:"rounded-xl border border-border bg-card p-3 shadow-xs",children:[(0,e.jsxDEV)("h3",{className:"mb-2 text-sm font-semibold",children:r("Current bookmark")},void 0,!1),(0,e.jsxDEV)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-current",children:U??(0,e.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1)]},void 0,!0),(0,e.jsxDEV)("section",{className:"flex flex-col gap-3 rounded-xl border border-border bg-card p-3 shadow-xs",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-semibold",children:r("Restore")},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,e.jsxDEV)(h,{htmlFor:"pitr-time",children:r("Time (ISO or epoch-ms, last 30 days)")},void 0,!1),(0,e.jsxDEV)("div",{className:"flex items-center gap-2",children:[(0,e.jsxDEV)(y,{"data-testid":"pitr-time",id:"pitr-time",onChange:D,placeholder:"2026-06-01T00:00:00.000Z",value:n},void 0,!1),(0,e.jsxDEV)(L,{"data-testid":"pitr-preview",disabled:k||n.trim()==="",onClick:V,size:"sm",type:"button",variant:"outline",children:r("Preview")},void 0,!1)]},void 0,!0),B!==null&&(0,e.jsxDEV)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-preview-bookmark",children:[r("Bookmark for that time"),": ",B]},void 0,!0)]},void 0,!0),(0,e.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,e.jsxDEV)(h,{htmlFor:"pitr-bookmark",children:r("Or an explicit bookmark (wins over time)")},void 0,!1),(0,e.jsxDEV)(y,{"data-testid":"pitr-bookmark",id:"pitr-bookmark",onChange:j,placeholder:r("bookmark string"),value:f},void 0,!1)]},void 0,!0),(0,e.jsxDEV)(h,{className:"flex items-center gap-2 text-xs font-normal text-muted-foreground",htmlFor:"pitr-restart",children:[(0,e.jsxDEV)("input",{checked:x,className:"size-4 accent-primary","data-testid":"pitr-restart",id:"pitr-restart",onChange:G,type:"checkbox"},void 0,!1),r("Restart the shard now so recovery applies immediately")]},void 0,!0),(0,e.jsxDEV)("div",{children:(0,e.jsxDEV)(R,{confirmLabel:r("Confirm restore"),disabled:k||!Z,onConfirm:H,testId:"pitr-restore",children:r("Restore")},void 0,!1)},void 0,!1)]},void 0,!0),s!==null&&(0,e.jsxDEV)("section",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs","data-testid":"pitr-result",children:[(0,e.jsxDEV)("div",{className:"flex items-center gap-2",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-semibold",children:r("Restore armed")},void 0,!1),(0,e.jsxDEV)(F,{variant:s.restarted?"destructive":"secondary",children:s.restarted?r("restarted now"):r("on next restart")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)("p",{className:"font-mono text-xs break-all text-muted-foreground",children:[r("Restored to"),": ",s.restoredTo]},void 0,!0),(0,e.jsxDEV)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-undo-bookmark",children:[r("Undo bookmark"),": ",s.undoBookmark]},void 0,!0),(0,e.jsxDEV)("div",{children:(0,e.jsxDEV)(R,{confirmLabel:r("Confirm undo"),disabled:k,onConfirm:J,testId:"pitr-undo",children:r("Undo restore")},void 0,!1)},void 0,!1)]},void 0,!0)]},void 0,!0)},"PitrPanel");export{le as PitrPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as ae}from"./chunk-W666BB6V.js";import{a as $,b as F,c as D,d as p,e as l,f as i}from"./chunk-GTM65MVX.js";import{a as R,e as _}from"./chunk-SEU5V7I6.js";import{a as se}from"./chunk-VLXV72QE.js";import{R as te}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as T}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-CKSHCYGC.js";import{a as K}from"./chunk-G7ZBM54M.js";import{f as Q}from"./chunk-SDMZKBTD.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as B}from"./chunk-TAD43CG5.js";import{d as V,f as X,g as Y,h as E,l as W}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as r,e as ee,f as re,h as le}from"./chunk-RRCPZMC2.js";var n=ee(re(),1);var e=ee(le(),1);var ie=["queued","running","paused","waiting","complete","errored","terminated"],ne=["pause","resume","terminate"],de="WORKFLOWS_NOT_CONFIGURED",ce=r(c=>typeof c=="object"&&c!==null&&c.code===de,"isNotConfigured"),fe=r(c=>{let s=c.error??c.output;if(s===void 0)return"\u2014";try{return JSON.stringify(s)}catch{return"(unserializable)"}},"formatStepPayload"),ue=r(({loadDetail:c,loadInstances:s,readOnly:y,runAction:L,workflowName:v})=>{let A=Q(),o=V(),[x,N]=(0,n.useState)(null),[k,I]=(0,n.useState)(null),[w,P]=(0,n.useState)(""),[g,h]=(0,n.useState)(null),[U,S]=(0,n.useState)(!1),[z,J]=(0,n.useState)(null),m=c??(a=>A.getWorkflowInstance(a)),O=y?void 0:L??(s===void 0?a=>A.setWorkflowInstanceStatus(a):void 0),j=r(async()=>{h(null),S(!1);let a=w===""?void 0:w;try{if(s===void 0){let d=await A.listWorkflowInstances({name:v,status:a});if(d.configured===!1){N(null),S(!0);return}N(d.instances);return}N(await s({name:v,status:a}))}catch(d){N(null),ce(d)?S(!0):h(E(d))}},"load");(0,n.useEffect)(()=>{I(null),W(j())},[v,w]);let G=r(async a=>{h(null);try{I(await m({id:a,name:v}))}catch(d){h(E(d))}},"openDetail"),H=r(async(a,d)=>{if(O!==void 0){J(a),h(null);try{await O({action:d,id:a,name:v}),await j()}catch(M){h(E(M))}finally{J(null)}}},"act");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,e.jsxDEV)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-medium",children:o("Instance history")},void 0,!1),(0,e.jsxDEV)("select",{"aria-label":o("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:r(a=>{P(a.target.value)},"onChange"),value:w,children:[(0,e.jsxDEV)("option",{value:"",children:o("All statuses")},void 0,!1),ie.map(a=>(0,e.jsxDEV)("option",{value:a,children:a},a,!1))]},void 0,!0)]},void 0,!0),g!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:g},void 0,!1),U&&(0,e.jsxDEV)(B,{description:o("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:o("Workflow inspection not configured")},void 0,!1),!U&&x!==null&&x.length===0&&(0,e.jsxDEV)(B,{description:o("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:o("No instances")},void 0,!1),x!==null&&x.length>0&&(0,e.jsxDEV)(R,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(_,{className:"px-0",children:(0,e.jsxDEV)($,{"data-testid":"workflow-instances-table",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:o("Instance id")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Status")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Created")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Ended")},void 0,!1),(0,e.jsxDEV)(l,{"aria-label":o("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:x.map(a=>(0,e.jsxDEV)(p,{"data-testid":`workflow-instance-${a.id}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:a.id},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:a.status},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground tabular-nums",children:a.createdOn??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground tabular-nums",children:a.endedOn??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"text-right",children:(0,e.jsxDEV)("div",{className:"flex justify-end gap-1.5",children:[(0,e.jsxDEV)(T,{"data-testid":`workflow-instance-steps-${a.id}`,onClick:r(()=>{W(G(a.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:o("Steps")},void 0,!1),O!==void 0&&ne.map(d=>(0,e.jsxDEV)(T,{"data-testid":`workflow-instance-${d}-${a.id}`,disabled:z===a.id,onClick:r(()=>{W(H(a.id,d))},"onClick"),size:"sm",type:"button",variant:"ghost",children:o(d)},d,!1))]},void 0,!0)},void 0,!1)]},a.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),k!==null&&(0,e.jsxDEV)(R,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,e.jsxDEV)(_,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,e.jsxDEV)("div",{className:"flex items-center justify-between",children:[(0,e.jsxDEV)("span",{className:"font-mono text-xs",children:[o("Steps")," \xB7 ",k.id]},void 0,!0),(0,e.jsxDEV)(T,{"data-testid":"workflow-instance-detail-close",onClick:r(()=>{I(null)},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Close")},void 0,!1)]},void 0,!0),k.steps.length===0?(0,e.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:o("This instance has no recorded steps yet.")},void 0,!1):(0,e.jsxDEV)($,{"data-testid":"workflow-instance-steps",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:o("Step")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Type")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Attempts")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Started")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Output")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:k.steps.map((a,d)=>(0,e.jsxDEV)(p,{"data-testid":`workflow-step-${String(d)}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:a.name},void 0,!1),(0,e.jsxDEV)(i,{className:"text-xs text-muted-foreground",children:a.type??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"tabular-nums",children:a.attempts??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground tabular-nums",children:a.start??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:fe(a)},void 0,!1)]},`${a.name}:${String(d)}`,!0))},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1)]},void 0,!0)},"WorkflowInstanceHistory"),me=X(K.createWorkflowInstance),ve=X(K.getWorkflowInstanceStatus),he=r(c=>{if(c.error)return`${c.error.name}: ${c.error.message}`;if(c.output===void 0)return"\u2014";try{return JSON.stringify(c.output)}catch{return"(unserializable)"}},"formatPayload"),Oe=r(()=>{let c=Q(),s=V(),{data:y,error:L}=ae(K.listWorkflows,{}),[v,A]=(0,n.useState)(""),[o,x]=(0,n.useState)(""),[N,k]=(0,n.useState)(""),[I,w]=(0,n.useState)(!1),[P,g]=(0,n.useState)(null),[h,U]=(0,n.useState)([]),[S,z]=(0,n.useState)(null),J=y!==void 0,m=(0,n.useMemo)(()=>Array.isArray(y?.workflows)?[...y.workflows].toSorted((t,u)=>t.exportName.localeCompare(u.exportName)):[],[y]),C=(0,n.useMemo)(()=>m.some(t=>t.exportName===v)?v:m[0]?.exportName??"",[m,v]),q=(0,n.useMemo)(()=>m.find(t=>t.exportName===C),[m,C]),O=r(t=>{U(u=>{let f=u.filter(b=>!(b.exportName===t.exportName&&b.id===t.id));return[t,...f]})},"upsertInstance"),j=r(async()=>{let t=C;if(t==="")return;let u,f=N.trim();if(f!=="")try{u=JSON.parse(f)}catch{g(s("Params must be valid JSON"));return}w(!0),g(null);try{let b=o.trim(),Z=await c.query(me,{exportName:t,id:b===""?void 0:b,params:u},Y(""));O({exportName:t,id:Z.id,status:Z.status}),x("")}catch(b){g(E(b))}finally{w(!1)}},"start"),G=r(()=>{W(j())},"startInstance"),H=r(async(t,u)=>{z(u);try{let f=await c.query(ve,{exportName:t,id:u},Y(""));O({error:f.error,exportName:t,id:f.id,output:f.output,status:f.status})}catch(f){g(E(f))}finally{z(null)}},"refreshInstance"),a=r(t=>{A(t.target.value)},"onSelectedExportChange"),d=r(t=>{x(t.target.value)},"onInstanceIdChange"),M=r(t=>{k(t.target.value)},"onParamsChange"),oe=r(t=>{let{export:u,id:f}=t.currentTarget.dataset;u!==void 0&&f!==void 0&&W(H(u,f))},"onRefreshClick");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[L!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:L},void 0,!1),(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:s("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")},void 0,!1),J&&m.length===0?(0,e.jsxDEV)(B,{description:s("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:s("No workflows defined")},void 0,!1):(0,e.jsxDEV)(R,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(_,{className:"px-0",children:(0,e.jsxDEV)($,{"data-testid":"workflows-table",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:s("Export")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Name")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Class")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Binding")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:m.map(t=>(0,e.jsxDEV)(p,{"data-testid":`workflows-row-${t.exportName}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:t.exportName},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.name},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.className},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.binding},void 0,!1)]},t.exportName,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),m.length>0&&(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-medium",children:s("Start instance")},void 0,!1),P!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:P},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)("select",{"aria-label":s("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:a,value:C,children:m.map(t=>(0,e.jsxDEV)("option",{value:t.exportName,children:t.exportName},t.exportName,!1))},void 0,!1),(0,e.jsxDEV)(te,{"aria-label":s("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:d,placeholder:s("Instance id (optional)"),value:o},void 0,!1),(0,e.jsxDEV)(T,{"data-testid":"workflows-start-button",disabled:I||C==="",onClick:G,children:s(I?"Starting\u2026":"Start instance")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)(se,{"aria-label":s("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:M,placeholder:s("Params (JSON, optional)"),value:N},void 0,!1)]},void 0,!0),h.length>0&&(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-medium",children:s("Instances")},void 0,!1),(0,e.jsxDEV)(R,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(_,{className:"px-0",children:(0,e.jsxDEV)($,{"data-testid":"workflows-instances-table",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:s("Workflow")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Instance id")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Status")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Output")},void 0,!1),(0,e.jsxDEV)(l,{},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:h.map(t=>(0,e.jsxDEV)(p,{"data-testid":`workflows-instance-${t.id}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:t.exportName},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.id},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:t.status},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:he(t)},void 0,!1),(0,e.jsxDEV)(i,{children:(0,e.jsxDEV)(T,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:S===t.id,onClick:oe,size:"xs",variant:"outline",children:S===t.id?s("Refreshing\u2026"):s("Refresh")},void 0,!1)},void 0,!1)]},`${t.exportName}:${t.id}`,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),q!==void 0&&(0,e.jsxDEV)(ue,{workflowName:q.name},void 0,!1)]},void 0,!0)},"WorkflowsPanel");export{Oe as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as S,b as w,c as W,i as H,w as E}from"./chunk-O3NAGRTR.js";import{a as K,b as C,j as M}from"./chunk-CKSHCYGC.js";import{a as V}from"./chunk-ZHVTQ37P.js";import{a as s,e as g,f as v,h as ee,j as U}from"./chunk-RRCPZMC2.js";var q=g(v(),1);var m=g(v(),1);var h=g(v(),1);var $=h.createContext(void 0);$.displayName="CompositeRootContext";function A(n=!1){let t=h.useContext($);if(t===void 0&&!n)throw new Error("Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>.");return t}s(A,"useCompositeRootContext");var F=g(v(),1);function L(n){let{focusableWhenDisabled:t,disabled:r,composite:d=!1,tabIndex:o=0,isNativeButton:i}=n,c=d&&t!==!1,b=d&&t===!1;return{props:F.useMemo(()=>{let a={onKeyDown(p){r&&t&&p.key!=="Tab"&&p.preventDefault()}};return d||(a.tabIndex=o,!i&&r&&(a.tabIndex=t?o:-1)),(i&&(t||c)||!i&&r)&&(a["aria-disabled"]=r),i&&(!t||b)&&(a.disabled=r),a},[d,r,t,c,b,i,o])}}s(L,"useFocusableWhenDisabled");function j(n={}){let{disabled:t=!1,focusableWhenDisabled:r,tabIndex:d=0,native:o=!0,composite:i}=n,c=m.useRef(null),b=A(!0),l=i??b!==void 0,{props:a}=L({focusableWhenDisabled:r,disabled:t,composite:l,tabIndex:d,isNativeButton:o});m.useEffect(()=>{if(!c.current)return;let u=k(c.current);if(o){if(!u){let f=w.captureOwnerStack?.()||"";E(`A component that acts as a button expected a native <button> because the \`nativeButton\` prop is true. Rendering a non-<button> removes native button semantics, which can impact forms and accessibility. Use a real <button> in the \`render\` prop, or set \`nativeButton\` to \`false\`.${f}`)}}else if(u){let f=w.captureOwnerStack?.()||"";E(`A component that acts as a button expected a non-<button> because the \`nativeButton\` prop is false. Rendering a <button> keeps native behavior while Base UI applies non-native attributes and handlers, which can add unintended extra attributes (such as \`role\` or \`aria-disabled\`). Use a non-<button> in the \`render\` prop, or set \`nativeButton\` to \`true\`.${f}`)}},[o]);let p=m.useCallback(()=>{let u=c.current;k(u)&&l&&t&&a.disabled===void 0&&u.disabled&&(u.disabled=!1)},[t,a.disabled,l]);S(p,[p]);let R=m.useCallback((u={})=>{let{onClick:f,onMouseDown:B,onKeyUp:J,onKeyDown:Q,onPointerDown:X,...Y}=u;return K({onClick(e){if(t){e.preventDefault();return}f?.(e)},onMouseDown(e){t||B?.(e)},onKeyDown(e){if(t||(C(e),Q?.(e),e.baseUIHandlerPrevented))return;let P=e.target===e.currentTarget,x=e.currentTarget,z=k(x),_=!o&&te(x),I=P&&(o?z:!_),T=e.key==="Enter",O=e.key===" ",D=x.getAttribute("role"),Z=D?.startsWith("menuitem")||D==="option"||D==="gridcell";if(P&&l&&O){if(e.defaultPrevented&&Z)return;e.preventDefault(),_||o&&z?(x.click(),e.preventBaseUIHandler()):I&&(f?.(e),e.preventBaseUIHandler());return}I&&(!o&&(O||T)&&e.preventDefault(),!o&&T&&f?.(e))},onKeyUp(e){if(!t){if(C(e),J?.(e),e.target===e.currentTarget&&o&&l&&k(e.currentTarget)&&e.key===" "){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!o&&!l&&e.key===" "&&f?.(e)}},onPointerDown(e){if(t){e.preventDefault();return}X?.(e)}},o?{type:"button"}:{role:"button"},a,Y)},[t,a,l,o]),N=W(u=>{c.current=u,p()});return{getButtonProps:R,buttonRef:N}}s(j,"useButton");function k(n){return H(n)&&n.tagName==="BUTTON"}s(k,"isButtonElement");function te(n){return!!(n?.tagName==="A"&&n?.href)}s(te,"isValidLinkElement");var y=q.forwardRef(s(function(t,r){let{render:d,className:o,disabled:i=!1,focusableWhenDisabled:c=!1,nativeButton:b=!0,style:l,...a}=t,{getButtonProps:p,buttonRef:R}=j({disabled:i,focusableWhenDisabled:c,native:b});return M("button",t,{state:{disabled:i},ref:[r,R],props:[a,p]})},"Button"));y.displayName="Button";var G=g(ee(),1);var oe=V("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-xs font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2",xs:"h-6 gap-1 rounded-md px-2 text-xs has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-md px-2.5 has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2",icon:"size-8","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-md","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function we({className:n,variant:t="default",size:r="default",...d}){return(0,G.jsxDEV)(y,{"data-slot":"button",className:U(oe({variant:t,size:r,className:n})),...d},void 0,!1)}s(we,"Button");export{A as a,j as b,we as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as Oe,b as Je}from"./chunk-BGG56IF5.js";import{a as Ke}from"./chunk-3GXGLNKW.js";import{a as qe}from"./chunk-AHILM3ZP.js";import{a as We}from"./chunk-J6J54MBP.js";import"./chunk-L7SK4ZZD.js";import{a as Ge}from"./chunk-2K47A3P6.js";import{a as Ze}from"./chunk-W666BB6V.js";import{a as De,b as Re,c as Pe,d as j,e as D,f as R}from"./chunk-GTM65MVX.js";import{a as we,e as Ce}from"./chunk-SEU5V7I6.js";import{a as V}from"./chunk-JSEXCW5Q.js";import"./chunk-4QHKBC77.js";import{R as B}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as U}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{b as $}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as H}from"./chunk-SDMZKBTD.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as Qe}from"./chunk-TAD43CG5.js";import{d as Y,h as ze,k as Ae,l as Ue,p as Fe}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as i,e as je,f as _e,g as et,h as tt}from"./chunk-RRCPZMC2.js";var k=je(_e(),1);var Q=je(et(),1);var t=je(tt(),1);var st=i(()=>{let u=(0,Q.c)(3),{config:e,ready:a}=Oe(),l;return u[0]!==e.capabilities||u[1]!==a?(l={capabilities:e.capabilities,ready:a},u[0]=e.capabilities,u[1]=a,u[2]=l):l=u[2],l},"useAuthCapabilities"),lt={boolean:"checkbox",date:"datetime-local",number:"number",string:"text"},at=i((u,e)=>u.type==="boolean"?!0:typeof e!="string"||e.trim()===""?!1:u.type!=="number"||!Number.isNaN(Number(e.trim())),"isFieldFilled"),it=i((u,e)=>{if(u.type==="boolean")return e===!0?{value:!0}:u.required?{value:!1}:void 0;let a=typeof e=="string"?e.trim():"";if(a!==""){if(u.type==="number"){let l=Number(a);return Number.isNaN(l)?void 0:{value:l}}return{value:a}}},"coerceFieldValue"),ot=i(u=>{let e=(0,Q.c)(105),{onClose:a,onCreated:l}=u,c=H(),s=Y(),{config:r}=Oe(),{busy:o,error:n,run:f}=Je(),[w,S]=(0,k.useState)(""),[x,C]=(0,k.useState)(""),[y,F]=(0,k.useState)(""),[v,g]=(0,k.useState)(""),p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={},e[0]=p):p=e[0];let[h,d]=(0,k.useState)(p),A;e[1]===Symbol.for("react.memo_cache_sentinel")?(A=i(m=>{S(m.target.value)},"t2"),e[1]=A):A=e[1];let b=A,I;e[2]===Symbol.for("react.memo_cache_sentinel")?(I=i(m=>{C(m.target.value)},"t3"),e[2]=I):I=e[2];let M=I,E;e[3]===Symbol.for("react.memo_cache_sentinel")?(E=i(m=>{F(m.target.value)},"t4"),e[3]=E):E=e[3];let Be=E,Z;e[4]===Symbol.for("react.memo_cache_sentinel")?(Z=i(m=>{g(m.target.value)},"t5"),e[4]=Z):Z=e[4];let $e=Z,G;e[5]===Symbol.for("react.memo_cache_sentinel")?(G=i((m,P)=>{d(q=>({...q,[m]:P}))},"t6"),e[5]=G):G=e[5];let Ee=G,W;e[6]!==h?(W=i(m=>h[m.name]??(m.type==="boolean"?!1:""),"t7"),e[6]=h,e[7]=W):W=e[7];let T=W,J;if(e[8]!==r.userFields||e[9]!==T){let m;e[11]!==T?(m=i(P=>!P.required||at(P,T(P)),"t92"),e[11]=T,e[12]=m):m=e[12],J=r.userFields.every(m),e[8]=r.userFields,e[9]=T,e[10]=J}else J=e[10];let Ie=J,K;e[13]!==o||e[14]!==w||e[15]!==x||e[16]!==Ie?(K=!o&&w.trim()!==""&&x.trim()!==""&&Ie,e[13]=o,e[14]=w,e[15]=x,e[16]=Ie,e[17]=K):K=e[17];let Ve=K,X;e[18]!==r.userFields||e[19]!==T?(X=i(()=>{let m={};for(let P of r.userFields){let q=it(P,T(P));q!==void 0&&(m[P.name]=q.value)}return Object.keys(m).length===0?void 0:m},"t10"),e[18]=r.userFields,e[19]=T,e[20]=X):X=e[20];let Se=X,_;e[21]!==Se||e[22]!==c||e[23]!==w||e[24]!==x||e[25]!==a||e[26]!==l||e[27]!==y||e[28]!==v||e[29]!==f?(_=i(()=>{f(async()=>{await c.createAuthUser({data:Se(),email:w.trim(),name:x.trim(),password:y===""?void 0:y,role:v.trim()===""?void 0:v.trim()}),l(),a()})},"t11"),e[21]=Se,e[22]=c,e[23]=w,e[24]=x,e[25]=a,e[26]=l,e[27]=y,e[28]=v,e[29]=f,e[30]=_):_=e[30];let N=_,z;e[31]!==s?(z=s("Create user"),e[31]=s,e[32]=z):z=e[32];let L;e[33]!==s?(L=s("Create user"),e[33]=s,e[34]=L):L=e[34];let O;e[35]!==L?(O=(0,t.jsxDEV)("h2",{className:"text-sm font-semibold text-foreground",children:L},void 0,!1),e[35]=L,e[36]=O):O=e[36];let ee;e[37]!==s?(ee=s("email"),e[37]=s,e[38]=ee):ee=e[38];let te;e[39]!==ee?(te=(0,t.jsxDEV)(V,{htmlFor:"uc-email",children:ee},void 0,!1),e[39]=ee,e[40]=te):te=e[40];let se;e[41]!==w?(se=(0,t.jsxDEV)(B,{"data-testid":"uc-email",id:"uc-email",onChange:b,type:"email",value:w},void 0,!1),e[41]=w,e[42]=se):se=e[42];let le;e[43]!==te||e[44]!==se?(le=(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[te,se]},void 0,!0),e[43]=te,e[44]=se,e[45]=le):le=e[45];let ae;e[46]!==s?(ae=s("name"),e[46]=s,e[47]=ae):ae=e[47];let ie;e[48]!==ae?(ie=(0,t.jsxDEV)(V,{htmlFor:"uc-name",children:ae},void 0,!1),e[48]=ae,e[49]=ie):ie=e[49];let oe;e[50]!==x?(oe=(0,t.jsxDEV)(B,{"data-testid":"uc-name",id:"uc-name",onChange:M,value:x},void 0,!1),e[50]=x,e[51]=oe):oe=e[51];let ne;e[52]!==ie||e[53]!==oe?(ne=(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[ie,oe]},void 0,!0),e[52]=ie,e[53]=oe,e[54]=ne):ne=e[54];let de;e[55]!==s?(de=s("Password (optional)"),e[55]=s,e[56]=de):de=e[56];let re;e[57]!==de?(re=(0,t.jsxDEV)(V,{htmlFor:"uc-password",children:de},void 0,!1),e[57]=de,e[58]=re):re=e[58];let ce;e[59]!==y?(ce=(0,t.jsxDEV)(B,{"data-testid":"uc-password",id:"uc-password",onChange:Be,type:"password",value:y},void 0,!1),e[59]=y,e[60]=ce):ce=e[60];let ue;e[61]!==re||e[62]!==ce?(ue=(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[re,ce]},void 0,!0),e[61]=re,e[62]=ce,e[63]=ue):ue=e[63];let fe;e[64]!==s?(fe=s("Role (optional)"),e[64]=s,e[65]=fe):fe=e[65];let ve;e[66]!==fe?(ve=(0,t.jsxDEV)(V,{htmlFor:"uc-role",children:fe},void 0,!1),e[66]=fe,e[67]=ve):ve=e[67];let me;e[68]!==v?(me=(0,t.jsxDEV)(B,{"data-testid":"uc-role",id:"uc-role",onChange:$e,value:v},void 0,!1),e[68]=v,e[69]=me):me=e[69];let he;e[70]!==ve||e[71]!==me?(he=(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[ve,me]},void 0,!0),e[70]=ve,e[71]=me,e[72]=he):he=e[72];let pe;e[73]!==r.userFields||e[74]!==T||e[75]!==s?(pe=r.userFields.length>0&&(0,t.jsxDEV)("div",{className:"flex flex-col gap-3 border-t border-border pt-3","data-testid":"uc-plugin-fields",children:[(0,t.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Plugin fields")},void 0,!1),r.userFields.map(m=>{let P=`uc-field-${m.name}`,q=m.required?"":` (${s("optional")})`;if(m.type==="boolean"){let Le=T(m)===!0;return(0,t.jsxDEV)("label",{className:"flex items-center gap-2",htmlFor:P,children:[(0,t.jsxDEV)(Ke,{checked:Le,"data-testid":P,id:P,onCheckedChange:i(Xe=>{Ee(m.name,Xe)},"onCheckedChange")},void 0,!1),(0,t.jsxDEV)("span",{className:"text-sm",children:[m.name,q]},void 0,!0)]},m.name,!0)}let Ye=T(m);return(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxDEV)(V,{htmlFor:P,children:[m.name,q]},void 0,!0),(0,t.jsxDEV)(B,{"data-testid":P,id:P,onChange:i(Le=>{Ee(m.name,Le.target.value)},"onChange"),type:lt[m.type],value:typeof Ye=="string"?Ye:""},void 0,!1)]},m.name,!0)})]},void 0,!0),e[73]=r.userFields,e[74]=T,e[75]=s,e[76]=pe):pe=e[76];let be;e[77]!==n?(be=n!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"uc-error",role:"alert",children:n},void 0,!1),e[77]=n,e[78]=be):be=e[78];let xe;e[79]!==s?(xe=s("Cancel"),e[79]=s,e[80]=xe):xe=e[80];let ye;e[81]!==a||e[82]!==xe?(ye=(0,t.jsxDEV)(U,{"data-testid":"uc-cancel",onClick:a,size:"sm",type:"button",variant:"outline",children:xe},void 0,!1),e[81]=a,e[82]=xe,e[83]=ye):ye=e[83];let Me=!Ve,ge;e[84]!==o||e[85]!==s?(ge=s(o?"Creating\u2026":"Create"),e[84]=o,e[85]=s,e[86]=ge):ge=e[86];let Ne;e[87]!==N||e[88]!==Me||e[89]!==ge?(Ne=(0,t.jsxDEV)(U,{"data-testid":"uc-submit",disabled:Me,onClick:N,size:"sm",type:"button",children:ge},void 0,!1),e[87]=N,e[88]=Me,e[89]=ge,e[90]=Ne):Ne=e[90];let ke;e[91]!==ye||e[92]!==Ne?(ke=(0,t.jsxDEV)("div",{className:"flex justify-end gap-2 pt-1",children:[ye,Ne]},void 0,!0),e[91]=ye,e[92]=Ne,e[93]=ke):ke=e[93];let Te;return e[94]!==a||e[95]!==z||e[96]!==O||e[97]!==le||e[98]!==ne||e[99]!==ue||e[100]!==he||e[101]!==pe||e[102]!==be||e[103]!==ke?(Te=(0,t.jsxDEV)(qe,{label:z,onClose:a,panelTestId:"uc-dialog",testId:"uc-overlay",variant:"dialog",children:[O,le,ne,ue,he,pe,be,ke]},void 0,!0),e[94]=a,e[95]=z,e[96]=O,e[97]=le,e[98]=ne,e[99]=ue,e[100]=he,e[101]=pe,e[102]=be,e[103]=ke,e[104]=Te):Te=e[104],Te},"UserCreateDialog"),He=i(u=>{let e=(0,Q.c)(2),{children:a}=u,l;return e[0]!==a?(l=(0,t.jsxDEV)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a},void 0,!1),e[0]=a,e[1]=l):l=e[1],l},"SectionHeading"),nt=i(u=>{let e=(0,Q.c)(29),{busy:a,runAction:l,userId:c,version:s}=u,r=H(),o=Y(),[n,f]=(0,k.useState)(null),[w,S]=(0,k.useState)(null),x;e[0]!==r||e[1]!==c?(x=i(()=>{Ue((async()=>{S(null);try{let b=await r.listAuthSessions({limit:50,userId:c});f(b.rows)}catch(b){let I=b;f(null),S(ze(I))}})())},"t1"),e[0]=r,e[1]=c,e[2]=x):x=e[2];let C;e[3]!==r||e[4]!==c||e[5]!==s?(C=[r,c,s],e[3]=r,e[4]=c,e[5]=s,e[6]=C):C=e[6],(0,k.useEffect)(x,C);let y;e[7]!==r||e[8]!==l?(y=i(b=>{l(()=>r.revokeAuthSession({sessionId:b}))},"t3"),e[7]=r,e[8]=l,e[9]=y):y=e[9];let F=y,v;e[10]!==o?(v=o("Sessions"),e[10]=o,e[11]=v):v=e[11];let g;e[12]!==v?(g=(0,t.jsxDEV)(He,{children:v},void 0,!1),e[12]=v,e[13]=g):g=e[13];let p;e[14]!==w?(p=w!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"ud-sessions-error",role:"alert",children:w},void 0,!1),e[14]=w,e[15]=p):p=e[15];let h;e[16]!==n||e[17]!==o?(h=n!==null&&n.length===0&&(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"ud-sessions-empty",children:o("No active sessions.")},void 0,!1),e[16]=n,e[17]=o,e[18]=h):h=e[18];let d;e[19]!==a||e[20]!==F||e[21]!==n||e[22]!==o?(d=n!==null&&n.length>0&&(0,t.jsxDEV)(we,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Ce,{className:"px-0",children:(0,t.jsxDEV)(De,{"data-testid":"ud-sessions-table",children:[(0,t.jsxDEV)(Re,{children:(0,t.jsxDEV)(j,{children:[(0,t.jsxDEV)(D,{children:o("expires")},void 0,!1),(0,t.jsxDEV)(D,{children:o("ip")},void 0,!1),(0,t.jsxDEV)(D,{children:o("user agent")},void 0,!1),(0,t.jsxDEV)(D,{"aria-label":o("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Pe,{children:n.map(b=>(0,t.jsxDEV)(j,{"data-testid":`ud-session-${b.id}`,children:[(0,t.jsxDEV)(R,{className:"text-muted-foreground tabular-nums",children:Fe(b.expiresAt)},void 0,!1),(0,t.jsxDEV)(R,{children:b.ipAddress??""},void 0,!1),(0,t.jsxDEV)(R,{className:"max-w-40 truncate",children:b.userAgent??""},void 0,!1),(0,t.jsxDEV)(R,{children:(0,t.jsxDEV)(U,{"data-testid":`ud-revoke-${b.id}`,disabled:a,onClick:i(()=>{F(b.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Revoke")},void 0,!1)},void 0,!1)]},b.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[19]=a,e[20]=F,e[21]=n,e[22]=o,e[23]=d):d=e[23];let A;return e[24]!==g||e[25]!==p||e[26]!==h||e[27]!==d?(A=(0,t.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"ud-sessions",children:[g,p,h,d]},void 0,!0),e[24]=g,e[25]=p,e[26]=h,e[27]=d,e[28]=A):A=e[28],A},"UserSessionsPanel"),dt=i(u=>{let e=(0,Q.c)(30),{busy:a,runAction:l,userId:c,version:s}=u,r=H(),o=Y(),[n,f]=(0,k.useState)(null),[w,S]=(0,k.useState)(null),x;e[0]!==r||e[1]!==c?(x=i(()=>{Ue((async()=>{S(null);try{f(await r.listAuthAccounts({userId:c}))}catch(b){let I=b;f(null),S(ze(I))}})())},"t1"),e[0]=r,e[1]=c,e[2]=x):x=e[2];let C;e[3]!==r||e[4]!==c||e[5]!==s?(C=[r,c,s],e[3]=r,e[4]=c,e[5]=s,e[6]=C):C=e[6],(0,k.useEffect)(x,C);let y;e[7]!==r||e[8]!==l||e[9]!==c?(y=i(b=>{l(()=>r.unlinkAuthAccount({accountId:b,userId:c}))},"t3"),e[7]=r,e[8]=l,e[9]=c,e[10]=y):y=e[10];let F=y,v;e[11]!==o?(v=o("Linked accounts"),e[11]=o,e[12]=v):v=e[12];let g;e[13]!==v?(g=(0,t.jsxDEV)(He,{children:v},void 0,!1),e[13]=v,e[14]=g):g=e[14];let p;e[15]!==w?(p=w!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive",role:"alert",children:w},void 0,!1),e[15]=w,e[16]=p):p=e[16];let h;e[17]!==n||e[18]!==o?(h=n!==null&&n.length===0&&(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:o("No linked accounts.")},void 0,!1),e[17]=n,e[18]=o,e[19]=h):h=e[19];let d;e[20]!==n||e[21]!==a||e[22]!==F||e[23]!==o?(d=n!==null&&n.length>0&&(0,t.jsxDEV)(we,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Ce,{className:"px-0",children:(0,t.jsxDEV)(De,{"data-testid":"ud-accounts-table",children:[(0,t.jsxDEV)(Re,{children:(0,t.jsxDEV)(j,{children:[(0,t.jsxDEV)(D,{children:o("provider")},void 0,!1),(0,t.jsxDEV)(D,{children:o("created")},void 0,!1),(0,t.jsxDEV)(D,{"aria-label":o("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Pe,{children:n.map(b=>{let I=Ae(b.id);return(0,t.jsxDEV)(j,{"data-testid":`ud-account-${I}`,children:[(0,t.jsxDEV)(R,{children:Ae(b.providerId)},void 0,!1),(0,t.jsxDEV)(R,{className:"text-muted-foreground tabular-nums",children:Fe(b.createdAt)},void 0,!1),(0,t.jsxDEV)(R,{children:(0,t.jsxDEV)(U,{"data-testid":`ud-unlink-${I}`,disabled:a,onClick:i(()=>{F(I)},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Unlink")},void 0,!1)},void 0,!1)]},I,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[20]=n,e[21]=a,e[22]=F,e[23]=o,e[24]=d):d=e[24];let A;return e[25]!==g||e[26]!==p||e[27]!==h||e[28]!==d?(A=(0,t.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"ud-accounts",children:[g,p,h,d]},void 0,!0),e[25]=g,e[26]=p,e[27]=h,e[28]=d,e[29]=A):A=e[29],A},"UserAccountsPanel"),rt=i(u=>{let e=(0,Q.c)(40),{busy:a,capabilities:l,runAction:c,userId:s,version:r}=u,o=H(),n=Y(),[f,w]=(0,k.useState)(null),S;e[0]!==l.passkey||e[1]!==o||e[2]!==s?(S=i(()=>{l.passkey&&Ue((async()=>{try{w(await o.listAuthPasskeys({userId:s}))}catch{w(null)}})())},"t1"),e[0]=l.passkey,e[1]=o,e[2]=s,e[3]=S):S=e[3];let x;e[4]!==l.passkey||e[5]!==o||e[6]!==s||e[7]!==r?(x=[l.passkey,o,s,r],e[4]=l.passkey,e[5]=o,e[6]=s,e[7]=r,e[8]=x):x=e[8],(0,k.useEffect)(S,x);let C;e[9]!==o||e[10]!==c||e[11]!==s?(C=i(()=>{c(()=>o.disableAuthTwoFactor({userId:s}))},"t3"),e[9]=o,e[10]=c,e[11]=s,e[12]=C):C=e[12];let y=C,F;e[13]!==o||e[14]!==c?(F=i(I=>{c(()=>o.deleteAuthPasskey({passkeyId:I}))},"t4"),e[13]=o,e[14]=c,e[15]=F):F=e[15];let v=F,g;e[16]!==n?(g=n("Security"),e[16]=n,e[17]=g):g=e[17];let p;e[18]!==g?(p=(0,t.jsxDEV)(He,{children:g},void 0,!1),e[18]=g,e[19]=p):p=e[19];let h;e[20]!==a||e[21]!==l.twoFactor||e[22]!==y||e[23]!==n?(h=l.twoFactor&&(0,t.jsxDEV)(U,{"data-testid":"ud-disable-2fa",disabled:a,onClick:y,size:"sm",type:"button",variant:"outline",children:n("Disable two-factor")},void 0,!1),e[20]=a,e[21]=l.twoFactor,e[22]=y,e[23]=n,e[24]=h):h=e[24];let d;e[25]!==l.passkey||e[26]!==f||e[27]!==n?(d=l.passkey&&f!==null&&f.length===0&&(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:n("No passkeys.")},void 0,!1),e[25]=l.passkey,e[26]=f,e[27]=n,e[28]=d):d=e[28];let A;e[29]!==a||e[30]!==l.passkey||e[31]!==v||e[32]!==f||e[33]!==n?(A=l.passkey&&f!==null&&f.length>0&&(0,t.jsxDEV)(we,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Ce,{className:"px-0",children:(0,t.jsxDEV)(De,{"data-testid":"ud-passkeys-table",children:[(0,t.jsxDEV)(Re,{children:(0,t.jsxDEV)(j,{children:[(0,t.jsxDEV)(D,{children:n("name")},void 0,!1),(0,t.jsxDEV)(D,{children:n("created")},void 0,!1),(0,t.jsxDEV)(D,{"aria-label":n("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Pe,{children:f.map(I=>{let M=Ae(I.id);return(0,t.jsxDEV)(j,{"data-testid":`ud-passkey-${M}`,children:[(0,t.jsxDEV)(R,{children:Ae(I.name)||M},void 0,!1),(0,t.jsxDEV)(R,{className:"text-muted-foreground tabular-nums",children:Fe(I.createdAt)},void 0,!1),(0,t.jsxDEV)(R,{children:(0,t.jsxDEV)(U,{"data-testid":`ud-delete-passkey-${M}`,disabled:a,onClick:i(()=>{v(M)},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Delete")},void 0,!1)},void 0,!1)]},M,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[29]=a,e[30]=l.passkey,e[31]=v,e[32]=f,e[33]=n,e[34]=A):A=e[34];let b;return e[35]!==p||e[36]!==h||e[37]!==d||e[38]!==A?(b=(0,t.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"ud-security",children:[p,h,d,A]},void 0,!0),e[35]=p,e[36]=h,e[37]=d,e[38]=A,e[39]=b):b=e[39],b},"UserSecurityPanel"),ct=/(?:at|expires)$/iu,ut=new Set(["banExpires","banned","banReason","email","emailVerified","id","name","role"]),ft=i((u,e)=>typeof e=="number"&&ct.test(u)?Fe(e):Ae(e),"formatField"),vt=i(({capabilities:u,onChanged:e,onClose:a,user:l})=>{let c=H(),s=Y(),r=l.banned===!0,[o,n]=(0,k.useState)(null),[f,w]=(0,k.useState)(!1),[S,x]=(0,k.useState)(0),[C,y]=(0,k.useState)(typeof l.role=="string"?l.role:""),[F,v]=(0,k.useState)(""),[g,p]=(0,k.useState)(""),[h,d]=(0,k.useState)(""),[A,b]=(0,k.useState)(null),[I,M]=(0,k.useState)(!1),E=i((N,z)=>{Ue((async()=>{w(!0),n(null);try{let L=await N();z?.refresh!==!1&&(x(O=>O+1),e()),z?.onResult?.(L)}catch(L){n(ze(L))}finally{w(!1)}})())},"runAction"),Be=i(N=>{y(N.target.value)},"onRoleInputChange"),Z=i(N=>{v(N.target.value)},"onBanReasonChange"),$e=i(N=>{p(N.target.value)},"onBanDaysChange"),G=i(N=>{d(N.target.value)},"onNewPasswordChange"),Ee=i(()=>{let N=C.trim();N!==""&&E(async()=>{await c.setAuthUserRole({role:N,userId:l.id})})},"onSetRole"),W=i(()=>{let N=Number.parseInt(g,10),z=Number.isFinite(N)&&N>0?N*86400:void 0;E(async()=>{await c.banAuthUser({expiresInSeconds:z,reason:F.trim()===""?void 0:F.trim(),userId:l.id})})},"onBan"),T=i(()=>{E(async()=>{await c.unbanAuthUser({userId:l.id})})},"onUnban"),J=i(()=>{E(async()=>{await c.setAuthUserPassword({newPassword:h,userId:l.id}),d("")})},"onSetPassword"),Ie=i(()=>{E(()=>c.impersonateAuthUser({userId:l.id}),{onResult:i(N=>{b(N.token)},"onResult"),refresh:!1})},"onImpersonate"),K=i(()=>{E(async()=>{await c.revokeAuthUserSessions({userId:l.id})})},"onRevokeAll"),Ve=i(()=>{E(async()=>{await c.removeAuthUser({userId:l.id}),a()})},"onDelete"),X=i(()=>{M(!0)},"onConfirmDelete"),Se=i(()=>{M(!1)},"onCancelDelete"),_=Object.entries(l).filter(([N])=>!ut.has(N));return(0,t.jsxDEV)(qe,{label:s("User details"),onClose:a,panelTestId:"ud-panel",testId:"ud-overlay",variant:"drawer",children:[(0,t.jsxDEV)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxDEV)("h2",{className:"text-sm font-semibold text-foreground",children:l.name??l.email??l.id},void 0,!1),(0,t.jsxDEV)("p",{className:"font-mono text-xs text-muted-foreground",children:l.id},void 0,!1),(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[typeof l.role=="string"&&l.role!==""&&(0,t.jsxDEV)($,{variant:"secondary",children:l.role},void 0,!1),r?(0,t.jsxDEV)($,{variant:"destructive",children:s("Banned")},void 0,!1):(0,t.jsxDEV)($,{variant:"outline",children:s("Active")},void 0,!1),l.emailVerified===!0?(0,t.jsxDEV)($,{variant:"secondary",children:s("verified")},void 0,!1):(0,t.jsxDEV)($,{variant:"outline",children:s("unverified")},void 0,!1)]},void 0,!0)]},void 0,!0),(0,t.jsxDEV)(U,{"data-testid":"ud-close",onClick:a,size:"sm",type:"button",variant:"ghost",children:s("Close")},void 0,!1)]},void 0,!0),o!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"ud-action-error",role:"alert",children:o},void 0,!1),u.admin&&(0,t.jsxDEV)(we,{className:"gap-0 py-0",children:[(0,t.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Actions")},void 0,!1)},void 0,!1),(0,t.jsxDEV)(Ce,{className:"flex flex-col gap-3 p-3",children:[(0,t.jsxDEV)("div",{className:"flex items-end gap-2",children:[(0,t.jsxDEV)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsxDEV)(V,{htmlFor:"ud-role",children:s("Role")},void 0,!1),(0,t.jsxDEV)(B,{"data-testid":"ud-role-input",id:"ud-role",onChange:Be,value:C},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(U,{"data-testid":"ud-set-role",disabled:f||C.trim()==="",onClick:Ee,size:"sm",type:"button",variant:"outline",children:s("Set role")},void 0,!1)]},void 0,!0),r?(0,t.jsxDEV)(U,{"data-testid":"ud-unban",disabled:f,onClick:T,size:"sm",type:"button",variant:"outline",children:s("Unban")},void 0,!1):(0,t.jsxDEV)("div",{className:"flex items-end gap-2",children:[(0,t.jsxDEV)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsxDEV)(V,{htmlFor:"ud-ban-reason",children:s("Ban reason (optional)")},void 0,!1),(0,t.jsxDEV)(B,{"data-testid":"ud-ban-reason",id:"ud-ban-reason",onChange:Z,value:F},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex w-24 flex-col gap-1",children:[(0,t.jsxDEV)(V,{htmlFor:"ud-ban-days",children:s("Days")},void 0,!1),(0,t.jsxDEV)(B,{"data-testid":"ud-ban-days",id:"ud-ban-days",onChange:$e,type:"number",value:g},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(U,{"data-testid":"ud-ban",disabled:f,onClick:W,size:"sm",type:"button",variant:"destructive",children:s("Ban user")},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex items-end gap-2",children:[(0,t.jsxDEV)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsxDEV)(V,{htmlFor:"ud-password",children:s("New password")},void 0,!1),(0,t.jsxDEV)(B,{"data-testid":"ud-password",id:"ud-password",onChange:G,type:"password",value:h},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(U,{"data-testid":"ud-set-password",disabled:f||h==="",onClick:J,size:"sm",type:"button",variant:"outline",children:s("Set password")},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsxDEV)(U,{"data-testid":"ud-impersonate",disabled:f,onClick:Ie,size:"sm",type:"button",variant:"outline",children:s("Impersonate")},void 0,!1),(0,t.jsxDEV)(U,{"data-testid":"ud-revoke-all",disabled:f,onClick:K,size:"sm",type:"button",variant:"outline",children:s("Revoke all sessions")},void 0,!1),I?(0,t.jsxDEV)(t.Fragment,{children:[(0,t.jsxDEV)(U,{"data-testid":"ud-delete-confirm",disabled:f,onClick:Ve,size:"sm",type:"button",variant:"destructive",children:s("Confirm delete")},void 0,!1),(0,t.jsxDEV)(U,{"data-testid":"ud-delete-cancel",onClick:Se,size:"sm",type:"button",variant:"ghost",children:s("Cancel")},void 0,!1)]},void 0,!0):(0,t.jsxDEV)(U,{"data-testid":"ud-delete",disabled:f,onClick:X,size:"sm",type:"button",variant:"destructive",children:s("Delete user")},void 0,!1)]},void 0,!0),A!==null&&(0,t.jsxDEV)("div",{className:"flex flex-col gap-1","data-testid":"ud-impersonation",children:[(0,t.jsxDEV)(V,{htmlFor:"ud-token",children:s("Impersonation token")},void 0,!1),(0,t.jsxDEV)(B,{"data-testid":"ud-token",id:"ud-token",readOnly:!0,value:A},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0),(0,t.jsxDEV)(nt,{busy:f,runAction:E,userId:l.id,version:S},void 0,!1),u.accounts&&(0,t.jsxDEV)(dt,{busy:f,runAction:E,userId:l.id,version:S},void 0,!1),(u.twoFactor||u.passkey)&&(0,t.jsxDEV)(rt,{busy:f,capabilities:u,runAction:E,userId:l.id,version:S},void 0,!1),(0,t.jsxDEV)("div",{className:"flex flex-col gap-1","data-testid":"ud-fields",children:[(0,t.jsxDEV)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Fields")},void 0,!1),(0,t.jsxDEV)("dl",{className:"flex flex-col",children:_.map(([N,z])=>(0,t.jsxDEV)("div",{className:"flex flex-col border-t border-border py-1.5",children:[(0,t.jsxDEV)("dt",{className:"text-xs font-semibold text-muted-foreground",children:N},void 0,!1),(0,t.jsxDEV)("dd",{className:"m-0 font-mono text-xs break-words",children:ft(N,z)},void 0,!1)]},N,!0))},void 0,!1)]},void 0,!0)]},void 0,!0)},"UserDetailDrawer"),mt=50,Rt=i(({pageSize:u=mt}={})=>{let e=H(),a=Y(),[l,c]=(0,k.useState)(""),[s,r]=(0,k.useState)(""),o=Ge(l),[n,f]=(0,k.useState)(null),[w,S]=(0,k.useState)(!1),{capabilities:x}=st(),C=o.trim(),y=s.trim(),F=Ze(["lunora-auth-users",C,y,u],()=>e.listAuthUsers({filterField:y===""?void 0:"role",filterValue:y===""?void 0:y,limit:u,search:C===""?void 0:C}),{keepPreviousData:!0}),v=F.data?.rows??null,g=F.error,p=i(()=>{F.refetch()},"reloadUsers");We(()=>{F.refetch()},!0);let h=n===null?null:v?.find(d=>d.id===n)??null;return(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-users",children:[(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxDEV)(B,{"aria-label":a("Search users"),className:"w-56","data-testid":"us-search",onChange:i(d=>{c(d.target.value)},"onChange"),placeholder:a("Search by email or name\u2026"),value:l},void 0,!1),(0,t.jsxDEV)(B,{"aria-label":a("Filter by role"),className:"w-40","data-testid":"us-role-filter",onChange:i(d=>{r(d.target.value)},"onChange"),placeholder:a("Filter by role"),value:s},void 0,!1),(0,t.jsxDEV)(U,{"data-testid":"us-new",onClick:i(()=>{S(!0)},"onClick"),size:"sm",type:"button",children:a("New user")},void 0,!1)]},void 0,!0),g!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"us-users-error",role:"alert",children:g},void 0,!1),v!==null&&v.length===0&&(0,t.jsxDEV)(Qe,{description:a("Users who sign up to your app will appear here."),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:"M16 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M9.5 10a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Zm11.5 10v-2a4 4 0 0 0-3-3.85"},void 0,!1)},void 0,!1),testId:"us-empty",title:a("No users.")},void 0,!1),v!==null&&v.length>0&&(0,t.jsxDEV)(we,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Ce,{className:"px-0",children:(0,t.jsxDEV)(De,{"data-testid":"us-table",children:[(0,t.jsxDEV)(Re,{children:(0,t.jsxDEV)(j,{children:[(0,t.jsxDEV)(D,{children:a("id")},void 0,!1),(0,t.jsxDEV)(D,{children:a("email")},void 0,!1),(0,t.jsxDEV)(D,{children:a("name")},void 0,!1),(0,t.jsxDEV)(D,{children:a("role")},void 0,!1),(0,t.jsxDEV)(D,{children:a("status")},void 0,!1),(0,t.jsxDEV)(D,{children:a("verified")},void 0,!1),(0,t.jsxDEV)(D,{children:a("created")},void 0,!1),(0,t.jsxDEV)(D,{"aria-label":a("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Pe,{children:v.map(d=>(0,t.jsxDEV)(j,{"data-testid":`us-row-${d.id}`,children:[(0,t.jsxDEV)(R,{className:"font-mono text-xs",children:d.id},void 0,!1),(0,t.jsxDEV)(R,{children:d.email??""},void 0,!1),(0,t.jsxDEV)(R,{children:d.name??""},void 0,!1),(0,t.jsxDEV)(R,{children:typeof d.role=="string"&&d.role!==""?(0,t.jsxDEV)($,{variant:"secondary",children:d.role},void 0,!1):""},void 0,!1),(0,t.jsxDEV)(R,{children:d.banned===!0?(0,t.jsxDEV)($,{variant:"destructive",children:a("Banned")},void 0,!1):(0,t.jsxDEV)($,{variant:"success",children:a("Active")},void 0,!1)},void 0,!1),(0,t.jsxDEV)(R,{children:d.emailVerified===!0?(0,t.jsxDEV)($,{variant:"success",children:a("yes")},void 0,!1):(0,t.jsxDEV)($,{variant:"outline",children:a("no")},void 0,!1)},void 0,!1),(0,t.jsxDEV)(R,{className:"text-muted-foreground tabular-nums",children:Fe(d.createdAt)},void 0,!1),(0,t.jsxDEV)(R,{children:(0,t.jsxDEV)(U,{"data-testid":`us-manage-${d.id}`,onClick:i(()=>{f(d.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Manage")},void 0,!1)},void 0,!1)]},d.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),h!==null&&(0,t.jsxDEV)(vt,{capabilities:x,onChanged:p,onClose:i(()=>{f(null)},"onClose"),user:h},void 0,!1),w&&(0,t.jsxDEV)(ot,{onClose:i(()=>{S(!1)},"onClose"),onCreated:p},void 0,!1)]},void 0,!0)},"UsersPanel");export{Rt as UsersPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as pe,c as fn,d as gn,e as xn}from"./chunk-APSSZB6Z.js";import{a as Rn}from"./chunk-QAFAJBAW.js";import{a as $o,c as Ko,d as Qo,e as dn}from"./chunk-WVTPZ6CM.js";import{A as To,D as U,E as wo,F as ko,I as _o,K as Do,L as Ao,O as Vo,P as Bo,Q as Fo,S as Lo,T as Uo,U as Go,V as Ho,W as jo,Y as Yo,_ as zo,aa as Jo,ba as at,ca as Wo,da as Xo,ea as ut,ha as qo,ia as Gt,ja as Ge,l as Ut,la as Zo,ma as en,n as Eo,na as on,o as Io,oa as nn,pa as rn,q as yo,qa as sn,r as nt,ra as an,s as rt,t as Po,ta as un,u as st,ua as cn,v as So,va as pn,w as No,x as Oo,y as it}from"./chunk-SHERR7ZP.js";import{b as tn}from"./chunk-5OIBXYZM.js";import{i as ln,k as mn}from"./chunk-4QHKBC77.js";import{C as Se,I as Fe,J as vo,K as Le,L as tt,M as ot,O as y,P as J,d as Ft,e as ee,h as We,i as Co,p as Lt}from"./chunk-VL23Y44O.js";import{a as ct,b as Ue}from"./chunk-UK64ZSUW.js";import{a as me,b as xo,c as Be,i as Mo,q as ho,t as bo}from"./chunk-O3NAGRTR.js";import{a as he,c as go,d as et,f as Ro,h as Je,i as ce,j as E}from"./chunk-CKSHCYGC.js";import{a as Me}from"./chunk-3OA7PECS.js";import{a as n,d as Xn,e as f,f as C,g as qn,h as Qn,j as Ve}from"./chunk-RRCPZMC2.js";var ke=f(qn(),1),Oc=f(C(),1);var te={};Xn(te,{Arrow:()=>Ht,Backdrop:()=>jt,CheckboxItem:()=>$t,CheckboxItemIndicator:()=>Kt,Group:()=>zt,GroupLabel:()=>Jt,Handle:()=>Qe,Item:()=>Wt,LinkItem:()=>Xt,Popup:()=>qt,Portal:()=>Zt,Positioner:()=>eo,RadioGroup:()=>oo,RadioItem:()=>no,RadioItemIndicator:()=>ro,Root:()=>qe,Separator:()=>Rn,SubmenuRoot:()=>Vn,SubmenuTrigger:()=>po,Trigger:()=>uo,Viewport:()=>co,createHandle:()=>jn});var Mn=f(C(),1);var pt=f(C(),1);var dt=pt.createContext(void 0);dt.displayName="MenuPositionerContext";function W(t){let e=pt.useContext(dt);if(e===void 0&&!t)throw new Error("Base UI: MenuPositionerContext is missing. MenuPositioner parts must be placed within <Menu.Positioner>.");return e}n(W,"useMenuPositionerContext");var lt=f(C(),1);var mt=lt.createContext(void 0);mt.displayName="MenuRootContext";function O(t){let e=lt.useContext(mt);if(e===void 0&&!t)throw new Error("Base UI: MenuRootContext is missing. Menu parts must be placed within <Menu.Root>.");return e}n(O,"useMenuRootContext");var Ht=Mn.forwardRef(n(function(e,o){let{render:i,className:u,style:a,...d}=e,{store:l}=O(),{arrowRef:r,side:m,align:R,arrowUncentered:g,arrowStyles:x}=W(),v={open:l.useState("open"),side:m,align:R,uncentered:g};return E("div",e,{ref:[r,o],stateAttributesMapping:Ge,state:v,props:{style:x,"aria-hidden":!0,...d}})},"MenuArrow"));Ht.displayName="MenuArrow";var bn=f(C(),1);var ft=f(C(),1);var hn=ft.createContext(void 0);hn.displayName="ContextMenuRootContext";function be(t=!0){let e=ft.useContext(hn);if(e===void 0&&!t)throw new Error("Base UI: ContextMenuRootContext is missing. ContextMenu parts must be placed within <ContextMenu.Root>.");return e}n(be,"useContextMenuRootContext");var Zn={...Ge,...Fe},jt=bn.forwardRef(n(function(e,o){let{render:i,className:u,style:a,...d}=e,{store:l}=O(),r=l.useState("open"),m=l.useState("mounted"),R=l.useState("transitionStatus"),g=l.useState("lastOpenChangeReason"),x=be(),M={open:r,transitionStatus:R};return E("div",e,{ref:x?.backdropRef?[o,x.backdropRef]:o,state:M,stateAttributesMapping:Zn,props:[{role:"presentation",hidden:!m,style:{pointerEvents:g===y.triggerHover?"none":void 0,userSelect:"none",WebkitUserSelect:"none"}},d]})},"MenuBackdrop"));jt.displayName="MenuBackdrop";var Mt=f(C(),1);var gt=f(C(),1);var Rt=gt.createContext(void 0);Rt.displayName="MenuCheckboxItemContext";function Cn(){let t=gt.useContext(Rt);if(t===void 0)throw new Error("Base UI: MenuCheckboxItemContext is missing. MenuCheckboxItem parts must be placed within <Menu.CheckboxItem>.");return t}n(Cn,"useMenuCheckboxItemContext");var He=f(C(),1);var vn=f(C(),1);function xt(t){let{closeOnClick:e,highlighted:o,id:i,nodeId:u,store:a,typingRef:d,itemRef:l,itemMetadata:r}=t,{events:m}=a.useState("floatingTreeRoot"),R=a.useState("open"),g=be(!0),x=g!==void 0;return vn.useMemo(()=>({id:i,role:"menuitem",tabIndex:R&&o?0:-1,onKeyDown(M){M.key===" "&&d?.current&&M.preventDefault()},onMouseMove(M){u&&m.emit("itemhover",{nodeId:u,target:M.currentTarget})},onClick(M){e&&m.emit("close",{domEvent:M,reason:y.itemPress})},onMouseUp(M){if(g){let v=g.initialCursorPointRef.current;if(g.initialCursorPointRef.current=null,x&&v&&Math.abs(M.clientX-v.x)<=1&&Math.abs(M.clientY-v.y)<=1||x&&!Co.os.mac&&M.button===2)return}l.current&&a.context.allowMouseUpTriggerRef.current&&(!x||M.button===2)&&(!r||r.type==="regular-item")&&l.current.click()}}),[e,o,i,m,u,R,a,d,l,g,x,r])}n(xt,"useMenuItemCommonProps");var je={type:"regular-item"};function Ne(t){let{closeOnClick:e,disabled:o=!1,highlighted:i,id:u,store:a,typingRef:d=a.context.typingRef,nativeButton:l,itemMetadata:r,nodeId:m}=t,R=a.useState("disabled"),g=o||R,x=He.useRef(null),{getButtonProps:M,buttonRef:v}=Ue({disabled:g,focusableWhenDisabled:!0,native:l,composite:!0}),S=xt({closeOnClick:e,highlighted:i,id:u,nodeId:m,store:a,typingRef:d,itemRef:x,itemMetadata:r}),c=He.useCallback(b=>he(S,{onMouseEnter(){r.type==="submenu-trigger"&&r.setActive()}},b,M),[S,M,r]),h=et(x,v);return He.useMemo(()=>({getItemProps:c,itemRef:h}),[c,h])}n(Ne,"useMenuItem");var Yt=(function(t){return t.checked="data-checked",t.unchecked="data-unchecked",t.disabled="data-disabled",t.highlighted="data-highlighted",t})({});var Oe={checked(t){return t?{[Yt.checked]:""}:{[Yt.unchecked]:""}},...Fe};var En=f(Me(),1);var $t=Mt.forwardRef(n(function(e,o){let{render:i,className:u,id:a,label:d,nativeButton:l=!1,disabled:r=!1,closeOnClick:m=!1,checked:R,defaultChecked:g,onCheckedChange:x,style:M,...v}=e,S=pe({label:d}),c=W(!0),h=ee(a),{store:b}=O(),p=b.useState("isActive",S.index),T=b.useState("itemProps"),[V,s]=ot({controlled:R,default:g??!1,name:"MenuCheckboxItem",state:"checked"}),{getItemProps:k,itemRef:P}=Ne({closeOnClick:m,disabled:r,highlighted:p,id:h,store:b,nativeButton:l,nodeId:c?.context.nodeId,itemMetadata:je}),H=Mt.useMemo(()=>({disabled:r,highlighted:p,checked:V}),[r,p,V]);function N(D){let F=J(y.itemPress,D.nativeEvent,void 0,{preventUnmountOnClose(){}});x?.(!V,F),!F.isCanceled&&s(Y=>!Y)}n(N,"handleClick");let _=E("div",e,{state:H,stateAttributesMapping:Oe,props:[T,{role:"menuitemcheckbox","aria-checked":V,onClick:N},v,k],ref:[P,o,S.ref]});return(0,En.jsx)(Rt.Provider,{value:H,children:_})},"MenuCheckboxItem"));$t.displayName="MenuCheckboxItem";var ht=f(C(),1);var Kt=ht.forwardRef(n(function(e,o){let{render:i,className:u,style:a,keepMounted:d=!1,...l}=e,r=Cn(),m=ht.useRef(null),{transitionStatus:R,setMounted:g}=tt(r.checked);Le({open:r.checked,ref:m,onComplete(){r.checked||g(!1)}});let x={checked:r.checked,disabled:r.disabled,highlighted:r.highlighted,transitionStatus:R};return E("span",e,{state:x,ref:[o,m],stateAttributesMapping:Oe,props:{"aria-hidden":!0,...l},enabled:d||r.checked})},"MenuCheckboxItemIndicator"));Kt.displayName="MenuCheckboxItemIndicator";var Ct=f(C(),1);var bt=f(C(),1);var Ye=bt.createContext(void 0);Ye.displayName="MenuGroupContext";function In(){let t=bt.useContext(Ye);if(t===void 0)throw new Error("Base UI: MenuGroupContext is missing. Menu group parts must be used within <Menu.Group> or <Menu.RadioGroup>.");return t}n(In,"useMenuGroupRootContext");var yn=f(Me(),1);var zt=Ct.forwardRef(n(function(e,o){let{render:i,className:u,style:a,...d}=e,[l,r]=Ct.useState(void 0),m=E("div",e,{ref:o,props:{role:"group","aria-labelledby":l,...d}});return(0,yn.jsx)(Ye.Provider,{value:r,children:m})},"MenuGroup"));zt.displayName="MenuGroup";var Pn=f(C(),1);var Jt=Pn.forwardRef(n(function(e,o){let{render:i,className:u,style:a,id:d,...l}=e,r=ee(d),m=In();return me(()=>(m(r),()=>{m(void 0)}),[m,r]),E("div",e,{ref:o,props:{id:r,role:"presentation",...l}})},"MenuGroupLabel"));Jt.displayName="MenuGroupLabel";var Sn=f(C(),1);var Wt=Sn.forwardRef(n(function(e,o){let{render:i,className:u,id:a,label:d,nativeButton:l=!1,disabled:r=!1,closeOnClick:m=!0,style:R,...g}=e,x=pe({label:d}),M=W(!0),v=ee(a),{store:S}=O(),c=S.useState("isActive",x.index),h=S.useState("itemProps"),{getItemProps:b,itemRef:p}=Ne({closeOnClick:m,disabled:r,highlighted:c,id:v,store:S,nativeButton:l,nodeId:M?.context.nodeId,itemMetadata:je});return E("div",e,{state:{disabled:r,highlighted:c},props:[h,g,b],ref:[p,o,x.ref]})},"MenuItem"));Wt.displayName="MenuItem";var vt=f(C(),1);var Xt=vt.forwardRef(n(function(e,o){let{render:i,className:u,id:a,label:d,closeOnClick:l=!1,style:r,...m}=e,R=vt.useRef(null),g=pe({label:d}),M=W(!0)?.context.nodeId,v=ee(a),{store:S}=O(),c=S.useState("isActive",g.index),h=S.useState("itemProps"),b=S.context.typingRef,{getButtonProps:p,buttonRef:T}=Ue({native:!1,composite:!0}),V=xt({closeOnClick:l,highlighted:c,id:v,nodeId:M,store:S,typingRef:b,itemRef:R});function s(P){return he(V,P,p)}return n(s,"getItemProps"),E("a",e,{state:{highlighted:c},props:[h,m,s],ref:[R,T,o,g.ref]})},"MenuLinkItem"));Xt.displayName="MenuLinkItem";var $e=f(C(),1);var Nn=f(Me(),1);var er={...Ge,...Fe},qt=$e.forwardRef(n(function(e,o){let{render:i,className:u,style:a,finalFocus:d,...l}=e,{store:r}=O(),{side:m,align:R}=W(),g=pn(!0)!=null,x=r.useState("open"),M=r.useState("transitionStatus"),v=r.useState("popupProps"),S=r.useState("mounted"),c=r.useState("instantType"),h=r.useState("activeTriggerElement"),b=r.useState("parent"),p=r.useState("lastOpenChangeReason"),T=r.useState("rootId"),V=r.useState("floatingRootContext"),s=r.useState("floatingTreeRoot"),k=r.useState("closeDelay"),P=r.useState("activeTriggerElement"),H=r.useState("hoverEnabled"),N=r.useState("disabled"),_=r.useState("openMethod"),D=b.type==="context-menu";Le({open:x,ref:r.context.popupRef,onComplete(){x&&r.context.onOpenChangeComplete?.(!0)}}),$e.useEffect(()=>{function K(w){r.setOpen(!1,J(w.reason,w.domEvent))}return n(K,"handleClose"),s.events.on("close",K),()=>{s.events.off("close",K)}},[s.events,r]),Jo(V,{enabled:H&&!N&&!D&&b.type!=="menubar",closeDelay:k});let F=$e.useCallback(K=>{r.set("popupElement",K)},[r]),Y={transitionStatus:M,side:m,align:R,open:x,nested:b.type==="menu",instant:c},$=E("div",e,{state:Y,ref:[o,r.context.popupRef,F],stateAttributesMapping:er,props:[v,{onKeyDown(K){g&&cn.has(K.key)&&K.stopPropagation()}},sn(M),l,{"data-rootownerid":T}]}),q=b.type===void 0||D;return(h||b.type==="menubar"&&p!==y.outsidePress)&&(q=!0),(0,Nn.jsx)(Oo,{context:V,openInteractionType:_,modal:D,disabled:!S,returnFocus:d===void 0?q:d,initialFocus:b.type!=="menu",restoreFocus:!0,externalTree:b.type!=="menubar"?s:void 0,previousFocusableElement:P,nextFocusableElement:b.type===void 0?r.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:b.type===void 0?r.context.beforeContentFocusGuardRef:void 0,children:$})},"MenuPopup"));qt.displayName="MenuPopup";var Tn=f(C(),1);var Et=f(C(),1);var It=Et.createContext(void 0);It.displayName="MenuPortalContext";function On(){let t=Et.useContext(It);if(t===void 0)throw new Error("Base UI: <Menu.Portal> is missing.");return t}n(On,"useMenuPortalContext");var Qt=f(Me(),1);var Zt=Tn.forwardRef(n(function(e,o){let{keepMounted:i=!1,...u}=e,{store:a}=O();return a.useState("mounted")||i?(0,Qt.jsx)(It.Provider,{value:i,children:(0,Qt.jsx)(yo,{ref:o,...u})}):null},"MenuPortal"));Zt.displayName="MenuPortal";var Ce=f(C(),1);var Ke=f(Me(),1);var eo=Ce.forwardRef(n(function(e,o){let{anchor:i,positionMethod:u="absolute",className:a,render:d,side:l,align:r,sideOffset:m=0,alignOffset:R=0,collisionBoundary:g="clipping-ancestors",collisionPadding:x=5,arrowPadding:M=5,sticky:v=!1,disableAnchorTracking:S=!1,collisionAvoidance:c=Eo,style:h,...b}=e,{store:p}=O(),T=On(),V=be(!0),s=p.useState("parent"),k=p.useState("floatingRootContext"),P=p.useState("floatingTreeRoot"),H=p.useState("mounted"),N=p.useState("open"),_=p.useState("modal"),D=p.useState("openMethod"),F=p.useState("activeTriggerElement"),Y=p.useState("transitionStatus"),$=p.useState("positionerElement"),q=p.useState("instantType"),K=p.useState("hasViewport"),w=p.useState("lastOpenChangeReason"),Q=p.useState("floatingNodeId"),ne=p.useState("floatingParentNodeId"),ve=k.useState("domReferenceElement"),de=Ce.useRef(null),ie=vo($,!1,!1),fe=i,ge=m,ye=R,j=r,re=c;s.type==="context-menu"&&(fe=i??s.context?.anchor,j=j??"start",!l&&j!=="center"&&(ye=e.alignOffset??2,ge=e.sideOffset??-5));let ae=l,Re=j;s.type==="menu"?(ae=ae??"inline-end",Re=Re??"start",re=e.collisionAvoidance??Io):s.type==="menubar"&&(ae=ae??(s.context.orientation==="vertical"?"inline-end":"bottom"),Re=Re??"start");let xe=s.type==="context-menu",se=nn({anchor:fe,floatingRootContext:k,positionMethod:V?"fixed":u,mounted:H,side:ae,sideOffset:ge,align:Re,alignOffset:ye,arrowPadding:xe?0:M,collisionBoundary:g,collisionPadding:x,sticky:v,nodeId:Q,keepMounted:T,disableAnchorTracking:S,collisionAvoidance:re,shiftCrossAxis:xe&&!("side"in re&&re.side==="flip"),externalTree:P,adaptiveOrigin:K?on:void 0});Ce.useEffect(()=>{function B(A){A.open&&(A.parentNodeId===Q&&p.set("hoverEnabled",!1),A.nodeId!==Q&&A.parentNodeId===p.select("floatingParentNodeId")&&p.setOpen(!1,J(y.siblingOpen)))}return n(B,"onMenuOpenChange"),P.events.on("menuopenchange",B),()=>{P.events.off("menuopenchange",B)}},[p,P.events,Q]),Ce.useEffect(()=>{if(p.select("floatingParentNodeId")==null)return;function B(A){if(A.open||A.nodeId!==p.select("floatingParentNodeId"))return;let Ee=A.reason??y.siblingOpen;p.setOpen(!1,J(Ee))}return n(B,"onParentClose"),P.events.on("menuopenchange",B),()=>{P.events.off("menuopenchange",B)}},[P.events,p]);let ue=Se();Ce.useEffect(()=>{N||ue.clear()},[N,ue]),Ce.useEffect(()=>{function B(A){if(!(!N||A.nodeId!==p.select("floatingParentNodeId")))if(A.target&&F&&F!==A.target){let Ee=p.select("closeDelay");Ee>0?ue.isStarted()||ue.start(Ee,()=>{p.setOpen(!1,J(y.siblingOpen))}):p.setOpen(!1,J(y.siblingOpen))}else ue.clear()}return n(B,"onItemHover"),P.events.on("itemhover",B),()=>{P.events.off("itemhover",B)}},[P.events,N,F,p,ue]),Ce.useEffect(()=>{let B={open:N,nodeId:Q,parentNodeId:ne,reason:p.select("lastOpenChangeReason")};P.events.emit("menuopenchange",B)},[P.events,N,p,Q,ne]),me(()=>{let B=ve,A=de.current;if(B&&(de.current=B),A&&B&&B!==A){p.set("instantType",void 0);let Ee=new AbortController;return ie(()=>{p.set("instantType","trigger-change")},Ee.signal),()=>{Ee.abort()}}},[ve,ie,p]);let _e={open:N,side:se.side,align:se.align,anchorHidden:se.anchorHidden,nested:s.type==="menu",instant:q},Pe=s.type==="menubar"&&s.context.modal,le=_&&w!==y.triggerHover;un(N&&(Pe||le),D==="touch",$,F);let De=an(e,_e,{styles:se.positionerStyles,transitionStatus:Y,props:b,refs:[o,p.useStateSetter("positionerElement")],hidden:!H,inert:!N}),Ae=H&&s.type!=="menu"&&(s.type!=="menubar"&&_&&w!==y.triggerHover||s.type==="menubar"&&s.context.modal),L=null;return s.type==="menubar"?L=s.context.contentElement:s.type===void 0&&(L=F),(0,Ke.jsxs)(dt.Provider,{value:se,children:[Ae&&(0,Ke.jsx)(rn,{ref:s.type==="context-menu"||s.type==="nested-context-menu"?s.context.internalBackdropRef:null,inert:en(!N),cutout:L}),(0,Ke.jsx)(So,{id:Q,children:(0,Ke.jsx)(fn,{elementsRef:p.context.itemDomElements,labelsRef:p.context.itemLabels,children:De})})]})},"MenuPositioner"));eo.displayName="MenuPositioner";var Te=f(C(),1);var yt=f(C(),1);var Pt=yt.createContext(void 0);Pt.displayName="MenuRadioGroupContext";function wn(){let t=yt.useContext(Pt);if(t===void 0)throw new Error("Base UI: MenuRadioGroupContext is missing. MenuRadioGroup parts must be placed within <Menu.RadioGroup>.");return t}n(wn,"useMenuRadioGroupContext");var to=f(Me(),1);var oo=Te.memo(Te.forwardRef(n(function(e,o){let{render:i,className:u,value:a,defaultValue:d,onValueChange:l,disabled:r=!1,style:m,"aria-labelledby":R,...g}=e,[x,M]=Te.useState(void 0),[v,S]=ot({controlled:a,default:d,name:"MenuRadioGroup"}),c=Be((T,V)=>{l?.(T,V),!V.isCanceled&&S(T)}),b=E("div",e,{state:{disabled:r},ref:o,props:{role:"group","aria-labelledby":R??x,"aria-disabled":r||void 0,...g}}),p=Te.useMemo(()=>({value:v,setValue:c,disabled:r}),[v,c,r]);return(0,to.jsx)(Ye.Provider,{value:M,children:(0,to.jsx)(Pt.Provider,{value:p,children:b})})},"MenuRadioGroup")));oo.displayName="MenuRadioGroup";var Ot=f(C(),1);var St=f(C(),1);var Nt=St.createContext(void 0);Nt.displayName="MenuRadioItemContext";function kn(){let t=St.useContext(Nt);if(t===void 0)throw new Error("Base UI: MenuRadioItemContext is missing. MenuRadioItem parts must be placed within <Menu.RadioItem>.");return t}n(kn,"useMenuRadioItemContext");var _n=f(Me(),1);var no=Ot.forwardRef(n(function(e,o){let{render:i,className:u,id:a,label:d,nativeButton:l=!1,disabled:r=!1,closeOnClick:m=!1,value:R,style:g,...x}=e,M=pe({label:d}),v=W(!0),S=ee(a),{store:c}=O(),h=c.useState("isActive",M.index),b=c.useState("itemProps"),{value:p,setValue:T,disabled:V}=wn(),s=V||r,k=p===R,{getItemProps:P,itemRef:H}=Ne({closeOnClick:m,disabled:s,highlighted:h,id:S,store:c,nativeButton:l,nodeId:v?.context.nodeId,itemMetadata:je}),N=Ot.useMemo(()=>({disabled:s,highlighted:h,checked:k}),[s,h,k]);function _(F){let Y=J(y.itemPress,F.nativeEvent,void 0,{preventUnmountOnClose(){}});T(R,Y)}n(_,"handleClick");let D=E("div",e,{state:N,stateAttributesMapping:Oe,props:[b,{role:"menuitemradio","aria-checked":k,onClick:_},x,P],ref:[H,o,M.ref]});return(0,_n.jsx)(Nt.Provider,{value:N,children:D})},"MenuRadioItem"));no.displayName="MenuRadioItem";var Tt=f(C(),1);var ro=Tt.forwardRef(n(function(e,o){let{render:i,className:u,style:a,keepMounted:d=!1,...l}=e,r=kn(),m=Tt.useRef(null),{transitionStatus:R,setMounted:g}=tt(r.checked);Le({open:r.checked,ref:m,onComplete(){r.checked||g(!1)}});let x={checked:r.checked,disabled:r.disabled,highlighted:r.highlighted,transitionStatus:R};return E("span",e,{state:x,stateAttributesMapping:Oe,ref:[o,m],props:{"aria-hidden":!0,...l},enabled:d||r.checked})},"MenuRadioItemIndicator"));ro.displayName="MenuRadioItemIndicator";var G=f(C(),1);var wt=f(C(),1);var Dn=wt.createContext(null);Dn.displayName="MenubarContext";function kt(t){let e=wt.useContext(Dn);if(e===null&&!t)throw new Error("Base UI: MenubarContext is missing. Menubar parts must be placed within <Menubar>.");return e}n(kt,"useMenubarContext");var Xe=f(C(),1);var tr={...Ko,disabled:U(t=>t.parent.type==="menubar"&&t.parent.context.disabled||t.disabled),modal:U(t=>(t.parent.type===void 0||t.parent.type==="context-menu")&&(t.modal??!0)),openMethod:U(t=>t.openMethod),allowMouseEnter:U(t=>t.allowMouseEnter),highlightItemOnHover:U(t=>t.highlightItemOnHover),stickIfOpen:U(t=>t.stickIfOpen),parent:U(t=>t.parent),rootId:U(t=>t.parent.type==="menu"?t.parent.store.select("rootId"):t.parent.type!==void 0?t.parent.context.rootId:t.rootId),activeIndex:U(t=>t.activeIndex),isActive:U((t,e)=>t.activeIndex===e),hoverEnabled:U(t=>t.hoverEnabled),instantType:U(t=>t.instantType),lastOpenChangeReason:U(t=>t.openChangeReason),floatingTreeRoot:U(t=>t.parent.type==="menu"?t.parent.store.select("floatingTreeRoot"):t.floatingTreeRoot),floatingNodeId:U(t=>t.floatingNodeId),floatingParentNodeId:U(t=>t.floatingParentNodeId),itemProps:U(t=>t.itemProps),closeDelay:U(t=>t.closeDelay),hasViewport:U(t=>t.hasViewport),keyboardEventRelay:U(t=>{if(t.keyboardEventRelay)return t.keyboardEventRelay;if(t.parent.type==="menu")return t.parent.store.select("keyboardEventRelay")})},ze=class t extends _o{static{n(this,"MenuStore")}constructor(e){super({...or(),...e},{positionerRef:Xe.createRef(),popupRef:Xe.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:Xe.createRef(),beforeContentFocusGuardRef:Xe.createRef(),onOpenChangeComplete:void 0,triggerElements:new Yo},tr),this.unsubscribeParentListener=this.observe("parent",o=>{if(this.unsubscribeParentListener?.(),o.type==="menu"){let i=o.store.select("rootId"),u=o.store.select("floatingTreeRoot"),a=o.store.select("keyboardEventRelay");this.unsubscribeParentListener=o.store.subscribe(()=>{let d=o.store.select("rootId"),l=o.store.select("floatingTreeRoot"),r=o.store.select("keyboardEventRelay");i===d&&u===l&&a===r||(i=d,u=l,a=r,this.notifyAll())}),this.context.allowMouseUpTriggerRef=o.store.context.allowMouseUpTriggerRef;return}o.type!==void 0&&(this.context.allowMouseUpTriggerRef=o.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,o){this.state.floatingRootContext.context.events.emit("setOpen",{open:e,eventDetails:o})}static useStore(e,o){let i=go(()=>new t(o)).current;return e??i}unsubscribeParentListener=null};function or(){return{...$o(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new nt,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:ce,keyboardEventRelay:void 0,closeDelay:0,hasViewport:!1}}n(or,"createInitialState");var _t=f(C(),1);var Dt=_t.createContext(void 0);Dt.displayName="MenuSubmenuRootContext";function At(){return _t.useContext(Dt)}n(At,"useMenuSubmenuRootContext");var so=f(Me(),1);var qe=wo(n(function(e){let{children:o,open:i,onOpenChange:u,onOpenChangeComplete:a,defaultOpen:d=!1,disabled:l=!1,modal:r,loopFocus:m=!0,orientation:R="vertical",actionsRef:g,closeParentOnEsc:x=!1,handle:M,triggerId:v,defaultTriggerId:S=null,highlightItemOnHover:c=!0}=e,h=be(!0),b=O(!0),p=kt(!0),T=At(),V=G.useMemo(()=>T&&b?{type:"menu",store:b.store}:p?{type:"menubar",context:p}:h&&!b?{type:"context-menu",context:h}:{type:void 0},[h,b,p,T]),s=ze.useStore(M?.store,{open:d,openProp:i,activeTriggerId:S,triggerIdProp:v,parent:V});Lo(s,i,d,S),s.useControlledProp("openProp",i),s.useControlledProp("triggerIdProp",v),s.useContextCallback("onOpenChangeComplete",a);let k=Ft(),P=Ft(),H=s.useState("floatingTreeRoot"),N=st(H),_=rt(),D=s.useState("open"),F=s.useState("activeTriggerElement"),Y=s.useState("positionerElement"),$=s.useState("hoverEnabled"),q=s.useState("disabled"),K=s.useState("lastOpenChangeReason"),w=s.useState("parent"),Q=s.useState("activeIndex"),ne=s.useState("payload"),ve=s.useState("floatingParentNodeId"),de=G.useRef(null),ie=G.useRef(w.type!=="context-menu"),fe=Se(),ge=G.useRef(!0),ye=Se(),j=ve!=null;w.type!==void 0&&r!==void 0&&console.warn("Base UI: The `modal` prop is not supported on nested menus. It will be ignored.");let{openMethod:re,triggerProps:ae}=Zo(D);s.useSyncedValues({disabled:l,highlightItemOnHover:c,modal:w.type===void 0?r:void 0,openMethod:re,rootId:k}),Go(s);let{forceUnmount:Re}=Ho(D,s,()=>{s.update({allowMouseEnter:!1,stickIfOpen:!0})});me(()=>{h&&!b?s.update({parent:{type:"context-menu",context:h},floatingNodeId:N,floatingParentNodeId:_}):b&&s.update({floatingNodeId:N,floatingParentNodeId:_})},[h,b,N,_,s]),G.useEffect(()=>{if(D||(de.current=null),w.type==="context-menu"){if(!D){fe.clear(),ie.current=!1;return}fe.start(500,()=>{ie.current=!0})}},[fe,D,w.type]),me(()=>{!D&&!$&&s.set("hoverEnabled",!0)},[D,$,s]);let xe=Be((I,z)=>{let Z=z.reason;if(D===I&&z.trigger===F&&K===Z)return;let Jn=Fo(z);if(!I&&z.trigger==null&&(z.trigger=F??void 0),u?.(I,z),z.isCanceled)return;s.state.floatingRootContext.dispatchOpenChange(I,z);let Ze=z.event;if(I===!1&&Ze?.type==="click"&&Ze.pointerType==="touch"&&!ge.current)return;I&&Z===y.triggerFocus?(ge.current=!1,ye.start(300,()=>{ge.current=!0})):(ge.current=!0,ye.clear());let mo=(Z===y.triggerPress||Z===y.itemPress)&&Ze.detail===0&&Ze?.isTrusted,Wn=!I&&(Z===y.escapeKey||Z==null),fo={open:I,openChangeReason:Z};de.current=z.event??null,Bo(fo,I,z.trigger,Jn()),s.update(fo),w.type==="menubar"&&(Z===y.triggerFocus||Z===y.focusOut||Z===y.triggerHover||Z===y.listNavigation||Z===y.siblingOpen)?s.set("instantType","group"):mo||Wn?s.set("instantType",mo?"click":"dismiss"):s.set("instantType",void 0)}),se=Do({popupStore:s,floatingId:P,nested:_!=null,onOpenChange:xe}),ue=se.context.events;G.useEffect(()=>{let I=n(({open:z,eventDetails:Z})=>xe(z,Z),"handleSetOpenEvent");return ue.on("setOpen",I),()=>{ue?.off("setOpen",I)}},[ue,xe]);let _e=G.useCallback(()=>{s.setOpen(!1,J(y.imperativeAction))},[s]);G.useImperativeHandle(g,()=>({unmount:Re,close:_e}),[Re,_e]);let Pe;w.type==="context-menu"&&(Pe=w.context),G.useImperativeHandle(Pe?.positionerRef,()=>Y,[Y]),G.useImperativeHandle(Pe?.actionsRef,()=>({setOpen:xe}),[xe]);let le=To(se,{enabled:!q,bubbles:{escapeKey:x&&w.type==="menu"},outsidePress(){return w.type!=="context-menu"||de.current?.type==="contextmenu"?!0:ie.current},externalTree:j?H:void 0}),De=tn(),Ae=G.useCallback(I=>{s.select("activeIndex")!==I&&s.set("activeIndex",I)},[s]),L=Wo(se,{enabled:!q,listRef:s.context.itemDomElements,activeIndex:Q,nested:w.type!==void 0,loopFocus:m,orientation:R,parentOrientation:w.type==="menubar"?w.context.orientation:void 0,rtl:De==="rtl",disabledIndices:Je,onNavigate:Ae,openOnArrowKeyDown:w.type!=="context-menu",externalTree:j?H:void 0,focusItemOnHover:c}),B=G.useCallback(I=>{s.context.typingRef.current=I},[s]),A=Xo(se,{enabled:!q,listRef:s.context.itemLabels,elementsRef:s.context.itemDomElements,activeIndex:Q,resetMs:500,onMatch:n(I=>{D&&I!==Q&&s.set("activeIndex",I)},"onMatch"),onTyping:B}),Ee=G.useMemo(()=>{let I=he(A.reference,L.reference,le.reference,{onMouseMove(){s.set("allowMouseEnter",!0)}},ae);return I["aria-haspopup"]="menu",I["aria-expanded"]=D,I},[s,A.reference,L.reference,le.reference,ae,D]),Yn=G.useMemo(()=>{let I=he(L.trigger,le.trigger,ae);return I["aria-haspopup"]="menu",I["aria-expanded"]=!1,I},[L.trigger,le.trigger,ae]),$n=G.useMemo(()=>he(Ao,{id:P,role:"menu","aria-labelledby":F?.id,onMouseMove(){s.set("allowMouseEnter",!0),w.type==="menu"&&s.set("hoverEnabled",!1)},onClick(){s.select("hoverEnabled")&&s.set("hoverEnabled",!1)},onKeyDown(I){let z=s.select("keyboardEventRelay");z&&!I.isPropagationStopped()&&z(I)}},A.floating,L.floating,le.floating),[F,P,w.type,s,A.floating,L.floating,le.floating]),Kn=L.item??ce;jo(s,{floatingRootContext:se,activeTriggerProps:Ee,inactiveTriggerProps:Yn,popupProps:$n,itemProps:Kn});let zn=G.useMemo(()=>({store:s,parent:V}),[s,V]),lo=(0,so.jsx)(mt.Provider,{value:zn,children:typeof o=="function"?o({payload:ne}):o});return w.type===void 0||w.type==="context-menu"?(0,so.jsx)(No,{externalTree:H,children:lo}):lo},"MenuRoot"));qe.displayName="MenuRoot";var An=f(C(),1);var io=f(Me(),1);function Vn(t){let e=O().store,o=An.useMemo(()=>({parentMenu:e}),[e]);return(0,io.jsx)(Dt.Provider,{value:o,children:(0,io.jsx)(qe,{...t})})}n(Vn,"MenuSubmenuRoot");var X=f(C(),1);var Bn=f(C(),1);function Fn(t={}){let{highlightItemOnHover:e,highlightedIndex:o,onHighlightedIndexChange:i}=ct(),{ref:u,index:a}=pe(t),d=o===a,l=Bn.useRef(null),r=et(u,l);return{compositeProps:{tabIndex:d?0:-1,onFocus(){i(a)},onMouseMove(){let R=l.current;if(!e||!R)return;let g=R.hasAttribute("disabled")||R.ariaDisabled==="true";!d&&!g&&R.focus()}},compositeRef:r,index:a}}n(Fn,"useCompositeItem");function Ln(t){let{render:e,className:o,style:i,state:u=ce,props:a=Je,refs:d=Je,metadata:l,stateAttributesMapping:r,tag:m="div",...R}=t,{compositeProps:g,compositeRef:x}=Fn({metadata:l});return E(m,t,{state:u,ref:[...d,x],props:[g,...a,R],stateAttributesMapping:r})}n(Ln,"CompositeItem");function ao(t){if(Mo(t)&&t.hasAttribute("data-rootownerid"))return t.getAttribute("data-rootownerid")??void 0;if(!ho(t))return ao(bo(t))}n(ao,"findRootOwnerId");var Vt=f(C(),1);function Un(t){let{enabled:e=!0,mouseDownAction:o,open:i}=t,u=Vt.useRef(!1);return Vt.useMemo(()=>e?{onMouseDown:n(a=>{(o==="open"&&!i||o==="close"&&i)&&(u.current=!0,We(a.currentTarget).addEventListener("click",()=>{u.current=!1},{once:!0}))},"onMouseDown"),onClick:n(a=>{u.current&&(u.current=!1,a.preventBaseUIHandler())},"onClick")}:ce,[e,o,i])}n(Un,"useMixedToggleClickHandler");var we=f(Me(),1);var Bt=2,uo=ko(n(function(e,o){let{render:i,className:u,style:a,disabled:d=!1,nativeButton:l=!0,id:r,openOnHover:m,delay:R=100,closeDelay:g=0,handle:x,payload:M,...v}=e,S=O(!0),c=x?.store??S?.store;if(!c)throw new Error("Base UI: <Menu.Trigger> must be either used within a <Menu.Root> component or provided with a handle.");let h=ee(r),b=c.useState("isTriggerActive",h),p=c.useState("floatingRootContext"),T=c.useState("isOpenedByTrigger",h),V=c.useState("triggerPopupId",h),s=X.useRef(null),k=rr(),P=ct(!0),H=Po(),N=X.useMemo(()=>H??new nt,[H]),_=st(N),D=rt(),{registerTrigger:F,isMountedByThisTrigger:Y}=Uo(h,s,c,{payload:M,closeDelay:g,parent:k,floatingTreeRoot:N,floatingNodeId:_,floatingParentNodeId:D,keyboardEventRelay:P?.relayKeyboardEvent}),$=k.type==="menubar",q=c.useState("disabled"),K=d||q||$&&k.context.disabled,{getButtonProps:w,buttonRef:Q}=Ue({disabled:K,native:l});X.useEffect(()=>{!T&&k.type===void 0&&(c.context.allowMouseUpTriggerRef.current=!1)},[c,T,k.type]);let ne=X.useRef(null),ve=Se(),de=Be(L=>{if(!ne.current)return;ve.clear(),c.context.allowMouseUpTriggerRef.current=!1;let B=L.target;if(Lt(ne.current,B)||Lt(c.select("positionerElement"),B)||B===ne.current||B!=null&&ao(B)===c.select("rootId"))return;let A=gn(ne.current);L.clientX>=A.left-Bt&&L.clientX<=A.right+Bt&&L.clientY>=A.top-Bt&&L.clientY<=A.bottom+Bt||N.events.emit("close",{domEvent:L,reason:y.cancelOpen})});X.useEffect(()=>{T&&c.select("lastOpenChangeReason")===y.triggerHover&&We(ne.current).addEventListener("mouseup",de,{once:!0})},[T,de,c]);let ie=$&&k.context.hasSubmenuOpen,ge=at(p,{enabled:(m??ie)&&!K&&k.type!=="context-menu"&&(!$||ie&&!Y),handleClose:ut({blockPointerEvents:!$}),mouseOnly:!0,move:!1,restMs:k.type===void 0?R:void 0,delay:{close:g},triggerElementRef:s,externalTree:N,isActiveTrigger:b,isClosing:n(()=>c.select("transitionStatus")==="ending","isClosing")}),ye=nr(T,c.select("lastOpenChangeReason")),j=it(p,{enabled:!K&&k.type!=="context-menu",event:T&&$?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:k.type===void 0?ye:!1}),re=zo(p,{enabled:!K&&ie}),ae=Un({open:T,enabled:$,mouseDownAction:"open"}),Re=X.useMemo(()=>he(re.reference,j.reference),[re.reference,j.reference]),xe=c.useState("triggerProps",Y),{preFocusGuardRef:se,handlePreFocusGuardFocus:ue,handleFocusTargetFocus:_e}=Qo(c,s),Pe={disabled:K,open:T},le=[ne,o,Q,F,s],De=[Re,ge??ce,xe,{"aria-haspopup":"menu","aria-controls":V,id:h,onMouseDown:n(L=>{if(c.select("open"))return;ve.start(200,()=>{c.context.allowMouseUpTriggerRef.current=!0}),We(L.currentTarget).addEventListener("mouseup",de,{once:!0})},"onMouseDown")},$?{role:"menuitem"}:{},ae,v,w],Ae=E("button",e,{enabled:!$,stateAttributesMapping:Gt,state:Pe,ref:le,props:De});return $?(0,we.jsx)(Ln,{tag:"button",render:i,className:u,style:a,state:Pe,refs:le,props:De,stateAttributesMapping:Gt}):T?(0,we.jsxs)(X.Fragment,{children:[(0,we.jsx)(Ut,{ref:se,onFocus:ue},`${h}-pre-focus-guard`),(0,we.jsx)(X.Fragment,{children:Ae},h),(0,we.jsx)(Ut,{ref:c.context.triggerFocusTargetRef,onFocus:_e},`${h}-post-focus-guard`)]}):(0,we.jsx)(X.Fragment,{children:Ae},h)},"MenuTrigger"));uo.displayName="MenuTrigger";function nr(t,e){let o=Se(),[i,u]=X.useState(!1);return me(()=>{t&&e==="trigger-hover"?(u(!0),o.start(500,()=>{u(!1)})):t||(o.clear(),u(!1))},[t,e,o]),i}n(nr,"useStickIfOpen");function rr(){let t=be(!0),e=O(!0),o=kt(!0);return X.useMemo(()=>o?{type:"menubar",context:o}:t&&!e?{type:"context-menu",context:t}:{type:void 0},[t,e,o])}n(rr,"useMenuParent");var Hn=f(C(),1);var Gn=(function(t){return t.popupWidth="--popup-width",t.popupHeight="--popup-height",t})({});var sr={activationDirection:n(t=>t?{"data-activation-direction":t}:null,"activationDirection")},co=Hn.forwardRef(n(function(e,o){let{render:i,className:u,style:a,children:d,...l}=e,{store:r}=O(),{side:m}=W(),R=r.useState("instantType"),{children:g,state:x}=dn({store:r,side:m,cssVars:Gn,children:d}),M={activationDirection:x.activationDirection,transitioning:x.transitioning,instant:R};return E("div",e,{state:M,ref:o,props:[l,{children:g}],stateAttributesMapping:sr})},"MenuViewport"));co.displayName="MenuViewport";var Ie=f(C(),1);var po=Ie.forwardRef(n(function(e,o){let{render:i,className:u,style:a,label:d,id:l,nativeButton:r=!1,openOnHover:m=!0,delay:R=100,closeDelay:g=0,disabled:x=!1,...M}=e,v=pe({label:d}),S=W(),{store:c}=O(),h=ee(l),b=c.useState("open"),p=c.useState("floatingRootContext"),T=c.useState("floatingTreeRoot"),V=c.useState("triggerPopupId",h),s=Vo(h,c),k=Ie.useCallback(j=>{let re=s(j);return j!==null&&c.select("open")&&c.select("activeTriggerId")==null&&c.update({activeTriggerId:h,activeTriggerElement:j,closeDelay:g}),re},[s,g,c,h]),P=Ie.useRef(null),H=Ie.useCallback(j=>{P.current=j,c.set("activeTriggerElement",j)},[c]),N=At();if(!N?.parentMenu)throw new Error("Base UI: <Menu.SubmenuTrigger> must be placed in <Menu.SubmenuRoot>.");c.useSyncedValue("closeDelay",g);let _=N.parentMenu,D=c.useState("disabled"),F=_.useState("disabled"),Y=x||D||F;me(()=>{let j=P.current;if(j&&xn(j)&&!Y){let re=xo.captureOwnerStack?.()||"";Ro(`A disabled element was detected on <Menu.SubmenuTrigger>. To properly disable the trigger, use the \`disabled\` prop on the component instead of setting it on the rendered element.${re}`)}});let $=_.useState("itemProps"),q=_.useState("isActive",v.index),K=Ie.useMemo(()=>({type:"submenu-trigger",setActive(){_.select("highlightItemOnHover")&&_.set("activeIndex",v.index)}}),[_,v.index]),{getItemProps:w,itemRef:Q}=Ne({closeOnClick:!1,disabled:Y,highlighted:q,id:h,store:c,typingRef:_.context.typingRef,nativeButton:r,itemMetadata:K,nodeId:S?.context.nodeId}),ne=c.useState("hoverEnabled"),ve=at(p,{enabled:ne&&m&&!Y,handleClose:ut({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:R,delay:{open:R,close:g},shouldOpen:R>0?()=>_.select("allowMouseEnter"):void 0,triggerElementRef:P,externalTree:T,isClosing:n(()=>c.select("transitionStatus")==="ending","isClosing")}),ie=it(p,{enabled:!Y,event:"mousedown",toggle:!m,ignoreMouse:m,stickIfOpen:!1}).reference??ce,fe=c.useState("triggerProps",!0);return delete fe.id,E("div",e,{state:{disabled:Y,highlighted:q,open:b},stateAttributesMapping:qo,props:[ie,ve,fe,$,{"aria-controls":V,tabIndex:b||q?0:-1,onBlur(){q&&_.set("activeIndex",null)}},M,w],ref:[o,v.ref,Q,k,H]})},"MenuSubmenuTrigger"));po.displayName="MenuSubmenuTrigger";var Qe=class{static{n(this,"MenuHandle")}constructor(){this.store=new ze}open(e){let o=e?this.store.context.triggerElements.getById(e):void 0;if(e&&!o)throw new Error(`Base UI: MenuHandle.open: No trigger found with id "${e}".`);this.store.setOpen(!0,J("imperative-action",void 0,o))}close(){this.store.setOpen(!1,J("imperative-action",void 0,void 0))}get isOpen(){return this.store.select("open")}};function jn(){return new Qe}n(jn,"createMenuHandle");var oe=f(Qn(),1);function Dc(t){let e=(0,ke.c)(4),o;e[0]!==t?({...o}=t,e[0]=t,e[1]=o):o=e[1];let i;return e[2]!==o?(i=(0,oe.jsxDEV)(te.Root,{"data-slot":"dropdown-menu",...o},void 0,!1),e[2]=o,e[3]=i):i=e[3],i}n(Dc,"DropdownMenu");function Ac(t){let e=(0,ke.c)(4),o;e[0]!==t?({...o}=t,e[0]=t,e[1]=o):o=e[1];let i;return e[2]!==o?(i=(0,oe.jsxDEV)(te.Trigger,{"data-slot":"dropdown-menu-trigger",...o},void 0,!1),e[2]=o,e[3]=i):i=e[3],i}n(Ac,"DropdownMenuTrigger");function Vc({align:t="start",alignOffset:e=0,side:o="bottom",sideOffset:i=4,className:u,...a}){return(0,oe.jsxDEV)(te.Portal,{children:(0,oe.jsxDEV)(te.Positioner,{className:"isolate z-50 outline-none",align:t,alignOffset:e,side:o,sideOffset:i,children:(0,oe.jsxDEV)(te.Popup,{"data-slot":"dropdown-menu-content",className:Ve("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95 animate-none! relative bg-popover before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!",u),...a},void 0,!1)},void 0,!1)},void 0,!1)}n(Vc,"DropdownMenuContent");function Bc(t){let e=(0,ke.c)(4),o;e[0]!==t?({...o}=t,e[0]=t,e[1]=o):o=e[1];let i;return e[2]!==o?(i=(0,oe.jsxDEV)(te.Group,{"data-slot":"dropdown-menu-group",...o},void 0,!1),e[2]=o,e[3]=i):i=e[3],i}n(Bc,"DropdownMenuGroup");function Fc(t){let e=(0,ke.c)(10),o,i,u;e[0]!==t?({className:o,inset:i,...u}=t,e[0]=t,e[1]=o,e[2]=i,e[3]=u):(o=e[1],i=e[2],u=e[3]);let a;e[4]!==o?(a=Ve("px-2 py-2 text-xs text-muted-foreground data-inset:ps-7",o),e[4]=o,e[5]=a):a=e[5];let d;return e[6]!==i||e[7]!==u||e[8]!==a?(d=(0,oe.jsxDEV)(te.GroupLabel,{"data-slot":"dropdown-menu-label","data-inset":i,className:a,...u},void 0,!1),e[6]=i,e[7]=u,e[8]=a,e[9]=d):d=e[9],d}n(Fc,"DropdownMenuLabel");function Lc({className:t,inset:e,variant:o="default",...i}){return(0,oe.jsxDEV)(te.Item,{"data-slot":"dropdown-menu-item","data-inset":e,"data-variant":o,className:Ve("group/dropdown-menu-item relative flex cursor-default items-center gap-2 rounded-md px-2 py-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:ps-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",t),...i},void 0,!1)}n(Lc,"DropdownMenuItem");function Uc(t){let e=(0,ke.c)(15),o,i,u,a,d;e[0]!==t?({className:u,children:i,checked:o,inset:a,...d}=t,e[0]=t,e[1]=o,e[2]=i,e[3]=u,e[4]=a,e[5]=d):(o=e[1],i=e[2],u=e[3],a=e[4],d=e[5]);let l;e[6]!==u?(l=Ve("relative flex cursor-default items-center gap-2 rounded-md py-2 pe-8 ps-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:ps-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",u),e[6]=u,e[7]=l):l=e[7];let r;e[8]===Symbol.for("react.memo_cache_sentinel")?(r=(0,oe.jsxDEV)("span",{className:"pointer-events-none absolute end-2 flex items-center justify-center","data-slot":"dropdown-menu-checkbox-item-indicator",children:(0,oe.jsxDEV)(te.CheckboxItemIndicator,{children:(0,oe.jsxDEV)(mn,{icon:ln,strokeWidth:2},void 0,!1)},void 0,!1)},void 0,!1),e[8]=r):r=e[8];let m;return e[9]!==o||e[10]!==i||e[11]!==a||e[12]!==d||e[13]!==l?(m=(0,oe.jsxDEV)(te.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item","data-inset":a,className:l,checked:o,...d,children:[r,i]},void 0,!0),e[9]=o,e[10]=i,e[11]=a,e[12]=d,e[13]=l,e[14]=m):m=e[14],m}n(Uc,"DropdownMenuCheckboxItem");function Gc(t){let e=(0,ke.c)(8),o,i;e[0]!==t?({className:o,...i}=t,e[0]=t,e[1]=o,e[2]=i):(o=e[1],i=e[2]);let u;e[3]!==o?(u=Ve("-mx-1 h-px bg-border",o),e[3]=o,e[4]=u):u=e[4];let a;return e[5]!==i||e[6]!==u?(a=(0,oe.jsxDEV)(te.Separator,{"data-slot":"dropdown-menu-separator",className:u,...i},void 0,!1),e[5]=i,e[6]=u,e[7]=a):a=e[7],a}n(Gc,"DropdownMenuSeparator");export{Dc as a,Ac as b,Vc as c,Bc as d,Fc as e,Lc as f,Uc as g,Gc as h};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as Fr}from"./chunk-HV7G6DFP.js";import{a as D,b as xe,c as T,h as Ce,i as Ie,j as Nt,w as de}from"./chunk-O3NAGRTR.js";import{a as St,c as H,g as N,i as ue,j as $}from"./chunk-CKSHCYGC.js";import{a as ce}from"./chunk-3OA7PECS.js";import{a as r,d as re,e as g,f as y,g as Tr,h as Dr,j as At}from"./chunk-RRCPZMC2.js";var hr=g(Tr(),1),Wa=g(y(),1);var gr=g(y(),1);var He={};re(He,{Control:()=>vt,Description:()=>ht,Error:()=>Rt,Item:()=>It,Label:()=>pt,Root:()=>mt,Validity:()=>Et});var S=g(y(),1);var ye=g(y(),1);var et=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});var oe={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},fe={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},wt={disabled:!1,...fe},W={valid(e){return e===null?null:e?{[et.valid]:""}:{[et.invalid]:""}}};var Vr={invalid:void 0,name:void 0,validityData:{state:oe,errors:[],error:"",value:"",initialValue:null},setValidityData:N,disabled:void 0,touched:fe.touched,setTouched:N,dirty:fe.dirty,setDirty:N,filled:fe.filled,setFilled:N,focused:fe.focused,setFocused:N,validate:r(()=>null,"validate"),validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:r(()=>!1,"shouldValidateOnChange"),state:wt,markedDirtyRef:{current:!1},registerFieldControl:N,validation:{getValidationProps:r((e,t=ue)=>t,"getValidationProps"),inputRef:{current:null},registerInput:N,commit:r(async()=>{},"commit"),change:N}},Fe=ye.createContext(Vr);Fe.displayName="FieldRootContext";function B(e=!0){let t=ye.useContext(Fe);if(t.setValidityData===N&&!e)throw new Error("Base UI: FieldRootContext is missing. Field parts must be placed within <Field.Root>.");return t}r(B,"useFieldRootContext");var Te=g(y(),1);var _t=Te.createContext(void 0);_t.displayName="FieldsetRootContext";function Ot(e=!1){let t=Te.useContext(_t);if(!t&&!e)throw new Error("Base UI: FieldsetRootContext is missing. Fieldset parts must be placed within <Fieldset.Root>.");return t}r(Ot,"useFieldsetRootContext");var De=g(y(),1);var Mt=De.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:N,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});Mt.displayName="FormContext";function z(){return De.useContext(Mt)}r(z,"useFormContext");var Z=g(y(),1);var Ve=g(y(),1);var Lt=0;function Ar(e,t="mui"){let[o,n]=Ve.useState(e),i=e||o;return Ve.useEffect(()=>{o==null&&(Lt+=1,n(`${t}-${Lt}`))},[o,t]),i}r(Ar,"useGlobalId");var Pt=xe.useId;function kt(e,t){if(Pt!==void 0){let o=Pt();return e??(t?`${t}-${o}`:o)}return Ar(e,t)}r(kt,"useId");function J(e){return kt(e,"base-ui")}r(J,"useBaseUiId");var Ae=g(y(),1);var Se=Ae.createContext({controlId:void 0,registerControlId:N,labelId:void 0,setLabelId:N,messageIds:[],setMessageIds:N,getDescriptionProps:r(e=>e,"getDescriptionProps")});Se.displayName="LabelableContext";function P(){return Ae.useContext(Se)}r(P,"useLabelableContext");var Ut=g(ce(),1);var ge=r(function(t){let o=J(),n=t.controlId===void 0?o:t.controlId,[i,s]=Z.useState(n),[a,l]=Z.useState(t.labelId),[u,d]=Z.useState([]),m=H(()=>new Map),{messageIds:f}=P(),h=T((R,F)=>{let V=m.current;if(F===void 0){V.delete(R);return}V.set(R,F),s(E=>{if(V.size===0)return;let k;for(let c of V.values()){if(E!==void 0&&c===E)return E;k===void 0&&(k=c)}return k})}),p=Z.useCallback(R=>{let F=R["aria-describedby"]?R["aria-describedby"].split(" "):[];return F.push(...f,...u),{...R,"aria-describedby":Array.from(new Set(F)).join(" ")||void 0}},[f,u]),v=Z.useMemo(()=>({controlId:i,registerControlId:h,labelId:a,setLabelId:l,messageIds:u,setMessageIds:d,getDescriptionProps:p}),[i,h,a,l,u,d,p]);return(0,Ut.jsx)(Se.Provider,{value:v,children:t.children})},"LabelableProvider");ge.displayName="LabelableProvider";var Re=g(y(),1);function jt(e={}){let{id:t,implicit:o=!1,controlRef:n}=e,{controlId:i,registerControlId:s}=P(),a=J(t),l=o?i:void 0,u=H(()=>Symbol("labelable-control")),d=Re.useRef(!1),m=Re.useRef(t!=null),f=T(()=>{!d.current||s===N||(d.current=!1,s(u.current,void 0))});return D(()=>{if(s===N)return;let h;if(o){let p=n?.current;Ce(p)&&p.closest("label")!=null?h=t??null:h=l??a}else if(t!=null)m.current=!0,h=t;else if(m.current)h=a;else{f();return}if(h===void 0){f();return}d.current=!0,s(u.current,h)},[t,n,l,s,o,a,u,f]),Re.useEffect(()=>f,[f]),i??a}r(jt,"useLabelableId");function Ne(e){return e?.ownerDocument||document}r(Ne,"ownerDocument");var we={};re(we,{engine:()=>it,env:()=>at,os:()=>ot,screenReader:()=>st});var ot={};re(ot,{android:()=>Wt,apple:()=>rt,ios:()=>tt,linux:()=>Or,mac:()=>qt,windows:()=>_r});function Sr(){if(typeof navigator>"u")return{userAgent:"",platform:"",maxTouchPoints:0};{let e=navigator.userAgentData;if(e&&Array.isArray(e.brands))return{userAgent:e.brands.map(({brand:t,version:o})=>`${t}/${o}`).join(" "),platform:e.platform??navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}return{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}r(Sr,"readRawData");var{userAgent:Nr,platform:wr,maxTouchPoints:Bt}=Sr(),ne=Nr.toLowerCase(),ie=wr.toLowerCase();var tt=/^i(os$|p)/.test(ie)||ie==="macintel"&&Bt>1,$t="android",Wt=ie===$t||ne.includes($t),qt=!tt&&ie.startsWith("mac"),_r=ie.startsWith("win"),Or=!Wt&&/^(linux|chrome os)/.test(ie),rt=qt||tt;var it={};re(it,{blink:()=>Lr,gecko:()=>Mr,webkit:()=>nt});var nt=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none"),Mr=!nt&&ne.includes("firefox"),Lr=!nt&&ne.includes("chrom");var st={};re(st,{voiceOver:()=>Pr});var Pr=rt;var at={};re(at,{jsdom:()=>kr});var kr=/jsdom|happydom/.test(ne);var lt="data-base-ui-focusable";var ct="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Tn="ArrowLeft",Dn="ArrowRight",Vn="ArrowUp",An="ArrowDown";function ut(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}r(ut,"activeElement");function Gt(e,t){if(!e||!t)return!1;let o=t.getRootNode?.();if(e.contains(t))return!0;if(o&&Nt(o)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}r(Gt,"contains");function dt(e){return"composedPath"in e?e.composedPath()[0]:e.target}r(dt,"getTarget");function kn(e,t){if(!Ce(e))return!1;let o=e;if(t.hasElement(o))return!o.hasAttribute("data-trigger-disabled");for(let[,n]of t.entries())if(Gt(n,o))return!n.hasAttribute("data-trigger-disabled");return!1}r(kn,"isTargetInsideEnabledTrigger");function Un(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);let o=e;return o.target!=null&&t.contains(o.target)}r(Un,"isEventTargetWithin");function jn(e){return e.matches("html,body")}r(jn,"isRootElement");function Ur(e){return Ie(e)&&e.matches(ct)}r(Ur,"isTypeableElement");function Bn(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${ct}`)!=null}r(Bn,"isInteractiveElement");function $n(e){return e?e.getAttribute("role")==="combobox"&&Ur(e):!1}r($n,"isTypeableCombobox");function Wn(e){if(!e||we.env.jsdom)return!0;try{return e.matches(":focus-visible")}catch{return!0}}r(Wn,"matchesFocusVisible");function qn(e){return e?e.hasAttribute(lt)?e:e.querySelector(`[${lt}]`)||e:null}r(qn,"getFloatingFocusElement");function Yt(e,t){let o=J(e);return D(()=>(t(o),()=>{t(void 0)}),[o,t]),o}r(Yt,"useRegisteredLabelId");function Kt(e={}){let{id:t,fallbackControlId:o,native:n=!1,setLabelId:i,focusControl:s}=e,{controlId:a,setLabelId:l}=P(),u=T(p=>{l(p),i?.(p)}),d=Yt(t,u),m=a??o;function f(p){if(s){s(p,m);return}if(!m)return;let v=Ne(p.currentTarget).getElementById(m);Ie(v)&&jr(v)}r(f,"focusControl");function h(p){dt(p.nativeEvent)?.closest("button,input,select,textarea")||(!p.defaultPrevented&&p.detail>1&&p.preventDefault(),!n&&f(p))}return r(h,"handleInteraction"),n?{id:d,htmlFor:m??void 0,onMouseDown:h}:{id:d,onClick:h,onPointerDown(p){p.preventDefault()}}}r(Kt,"useLabel");function jr(e){e.focus({focusVisible:!0})}r(jr,"focusElementWithVisible");var ee=g(y(),1);var Ht=g(y(),1);var Br=[];function _e(e){Ht.useEffect(e,Br)}r(_e,"useOnMount");var he=0,ft=class e{static{r(this,"Timeout")}static create(){return new e}currentId=he;start(t,o){this.clear(),this.currentId=setTimeout(()=>{this.currentId=he,o()},t)}isStarted(){return this.currentId!==he}clear=r(()=>{this.currentId!==he&&(clearTimeout(this.currentId),this.currentId=he)},"clear");disposeEffect=r(()=>this.clear,"disposeEffect")};function zt(){let e=H(ft.create).current;return _e(e.disposeEffect),e}r(zt,"useTimeout");function se(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}r(se,"getCombinedFieldValidityData");var Oe=Object.keys(oe);function $r(e){if(!e||e.valid||!e.valueMissing)return!1;let t=!1;for(let o of Oe)o!=="valid"&&(o==="valueMissing"?t=e[o]:e[o]&&(t=!1));return t}r($r,"isOnlyValueMissing");function Wr(e){let t=null;for(let o of e)if(!o.disabled){if(!o.validity.valid)return o;t??=o}return t}r(Wr,"findRepresentativeInput");function Jt(e,t){let o=!1;for(let n of t)n.setCustomValidity(""),o||=n===e;o||e.setCustomValidity("")}r(Jt,"clearCustomValidity");function Xt(e){let{formRef:t}=z(),{setValidityData:o,validate:n,validityData:i,validationDebounceTime:s,invalid:a,markedDirtyRef:l,state:u,shouldValidateOnChange:d,getRegisteredFieldId:m}=e,{controlId:f,getDescriptionProps:h}=P(),p=zt(),v=ee.useRef(null),R=H(()=>new Set).current,F=ee.useRef(0),V=ee.useCallback(b=>{if(b)return R.add(b),()=>{R.delete(b)}},[R]),E=T(async(b,w=!1)=>{let C=Wr(R)??v.current;if(!C)return;F.current+=1;let te=F.current;function q(L,A=a){let O=m()??f;if(O==null)return;let x=t.current.fields.get(O);if(!x)return;let K=se(L,A);t.current.fields.set(O,{...x,validityData:K})}if(r(q,"updateRegisteredFieldValidity"),w){if(u.valid!==!1)return;let L=C.validity;if(!L.valueMissing){let O={value:b,state:{...oe,valid:!0},error:"",errors:[],initialValue:i.initialValue};Jt(C,R),q(O,!1),o(O);return}let A=Oe.reduce((O,x)=>(O[x]=L[x],O),{});if(!A.valid&&!$r(A))return}function G(L){let A=Oe.reduce((x,K)=>(x[K]=L.validity[K],x),{}),O=!1;for(let x of Oe)if(x!=="valid"){if(x==="valueMissing"&&A[x])O=!0;else if(A[x])return A}return O&&!l.current&&(A.valid=!0,A.valueMissing=!1),A}r(G,"getState"),p.clear();let I=null,M=[],U=G(C),j,Y=d();if(C.validationMessage&&!Y)j=C.validationMessage,M=[C.validationMessage];else{let L=Array.from(t.current.fields.values()).reduce((O,x)=>(x.name&&(O[x.name]=x.getValue()),O),{}),A=n(b,L);if(typeof A=="object"&&A!==null&&"then"in A){if(I=await A,te!==F.current)return}else I=A;I!==null?(U.valid=!1,U.customError=!0,Array.isArray(I)?(M=I,C.setCustomValidity(I.join(`
|
|
2
|
+
`))):I&&(M=[I],C.setCustomValidity(I))):Y&&(Jt(C,R),U.customError=!1,C.validationMessage?(j=C.validationMessage,M=[C.validationMessage]):C.validity.valid&&!U.valid&&(U.valid=!0))}let _={value:b,state:U,error:j??(Array.isArray(I)?I[0]:I??""),errors:M,initialValue:i.initialValue};q(_),o(_)}),k=T(b=>{p.clear();let w=d();w&&b!==""&&s?(F.current+=1,p.start(s,()=>{E(b)})):E(b,!w)}),c=ee.useCallback((b,w={})=>St(h(w),u.valid===!1&&!u.disabled&&!b?{"aria-invalid":!0}:ue),[h,u.disabled,u.valid]);return ee.useMemo(()=>({getValidationProps:c,inputRef:v,registerInput:V,commit:E,change:k}),[c,V,E,k])}r(Xt,"useFieldValidation");var Me=g(y(),1);function Qt(e){let{commit:t,invalid:o,markedDirtyRef:n,name:i,setRegisteredFieldName:s,setRegisteredFieldId:a,setValidityData:l,validityData:u}=e,{formRef:d}=z(),m=Me.useRef(null),f=Me.useRef(null),h=Me.useRef(null),p=T(()=>{let c=f.current;if(c)return c.getValue?c.getValue():c.value});function v(c){return c.value===void 0?p():c.value}r(v,"getRegistrationValue");let R=T(()=>{let c=f.current;if(n.current=!0,!c){t(u.value);return}t(v(c))});function F(){let c=f.current;!c||!c.id||d.current.fields.set(c.id,{getValue:p,name:i??c.name,controlRef:c.controlRef??h,validityData:se(u,o),validate:R})}r(F,"refreshRegistration");function V(c=f.current?.id){c&&d.current.fields.delete(c)}r(V,"deleteRegistration");function E(){let c=f.current;if(!c)return;let b=v(c);u.initialValue===null&&b!==null&&l(w=>({...w,initialValue:b}))}r(E,"syncInitialValue"),D(()=>{let c=f.current;!c||!c.id||(s(i?void 0:c.name),d.current.fields.set(c.id,{getValue:p,name:i??c.name,controlRef:c.controlRef??h,validityData:se(u,o),validate:R}))},[d,p,o,i,s,R,u]),D(()=>{let c=d.current.fields;return()=>{let b=f.current?.id;b&&c.delete(b)}},[d]);let k=T((c,b)=>{if(!b){m.current===c&&(m.current=null,V(),f.current=null,s(void 0),a(void 0));return}let w=f.current?.id;m.current=c,f.current=b,i||s(b.name),a(b.id),w&&w!==b.id&&V(w),E(),F()});return[R,k]}r(Qt,"useFieldControlRegistration");var Le=g(ce(),1);var Zt=S.forwardRef(r(function(t,o){let{errors:n,validationMode:i,submitAttemptedRef:s}=z(),{render:a,className:l,validate:u,validationDebounceTime:d=0,validationMode:m=i,name:f,disabled:h=!1,invalid:p,dirty:v,touched:R,actionsRef:F,style:V,...E}=t,k=Ot(!0)?.disabled,c=T(u||(()=>null)),b=k||h,[w,C]=S.useState(!1),[te,q]=S.useState(!1),[G,I]=S.useState(!1),[M,U]=S.useState(!1),j=v??te,Y=R??w,_=S.useRef(j),L=S.useRef(void 0),[A,O]=S.useState(),x=f??A;D(()=>{v!==void 0&&(_.current=v)},[v]);let K=S.useCallback(()=>L.current,[]),Er=S.useCallback(le=>{L.current=le},[]),yt=T(le=>{v===void 0&&(le&&(_.current=!0),q(le))}),Ft=T(le=>{R===void 0&&C(le)}),Je=T(()=>m==="onChange"||m==="onSubmit"&&s.current),Xe=x&&Object.hasOwn(n,x)?n[x]:null,Cr=!!(Array.isArray(Xe)?Xe.length:Xe),pe=p===!0||Cr,[be,Qe]=S.useState({state:oe,error:"",errors:[],value:null,initialValue:null}),Tt=b?null:!pe&&be.state.valid,Ee=S.useMemo(()=>({disabled:b,touched:Y,dirty:j,valid:Tt,filled:G,focused:M}),[b,Y,j,Tt,G,M]),Ze=Xt({setValidityData:Qe,validate:c,validityData:be,validationDebounceTime:d,invalid:pe,markedDirtyRef:_,state:Ee,shouldValidateOnChange:Je,getRegisteredFieldId:K}),[Dt,Vt]=Qt({commit:Ze.commit,invalid:pe,markedDirtyRef:_,name:f,setRegisteredFieldName:O,setRegisteredFieldId:Er,setValidityData:Qe,validityData:be});S.useImperativeHandle(F,()=>({validate:Dt}),[Dt]);let Ir=S.useMemo(()=>({invalid:pe,name:x,validityData:be,setValidityData:Qe,disabled:b,touched:Y,setTouched:Ft,dirty:j,setDirty:yt,filled:G,setFilled:I,focused:M,setFocused:U,validate:c,validationMode:m,validationDebounceTime:d,shouldValidateOnChange:Je,state:Ee,markedDirtyRef:_,registerFieldControl:Vt,validation:Ze}),[pe,x,be,b,Y,Ft,j,yt,G,I,M,U,c,m,d,Je,Ee,Vt,Ze]),yr=$("div",t,{ref:o,state:Ee,props:E,stateAttributesMapping:W});return(0,Le.jsx)(Fe.Provider,{value:Ir,children:yr})},"FieldRootInner"));Zt.displayName="FieldRootInner";var mt=S.forwardRef(r(function(t,o){return(0,Le.jsx)(ge,{children:(0,Le.jsx)(Zt,{...t,ref:o})})},"FieldRoot"));mt.displayName="FieldRoot";var me=g(y(),1);var Pe=g(y(),1);var ke=Pe.createContext({disabled:!1});ke.displayName="FieldItemContext";function Ue(){return Pe.useContext(ke)}r(Ue,"useFieldItemContext");var pt=me.forwardRef(r(function(t,o){let{render:n,className:i,style:s,id:a,nativeLabel:l=!0,...u}=t,d=B(!1),m=Ue(),{labelId:f}=P(),h={...d.state,disabled:d.disabled||m.disabled},p=me.useRef(null),v=Kt({id:f??a,native:l});return me.useEffect(()=>{if(!p.current)return;let F=p.current.tagName==="LABEL";if(l){if(!F){let V=xe.captureOwnerStack?.()||"";de(`<Field.Label> expected a <label> element because the \`nativeLabel\` prop is true. Rendering a non-<label> disables native label association, so \`htmlFor\` will not work. Use a real <label> in the \`render\` prop, or set \`nativeLabel\` to \`false\`.${V}`)}}else if(F){let V=xe.captureOwnerStack?.()||"";de(`<Field.Label> expected a non-<label> element because the \`nativeLabel\` prop is false. Rendering a <label> assumes native label behavior while Base UI treats it as non-native, which can cause unexpected pointer behavior. Use a non-<label> in the \`render\` prop, or set \`nativeLabel\` to \`true\`.${V}`)}},[l]),$("label",t,{ref:[o,p],state:h,props:[v,u],stateAttributesMapping:W})},"FieldLabel"));pt.displayName="FieldLabel";var ae=g(y(),1);var sr=g(y(),1);var nr=g(Fr(),1);var je=null,er=globalThis.requestAnimationFrame,bt=class{static{r(this,"Scheduler")}callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=r(t=>{this.isScheduled=!1;let o=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let i=0;i<o.length;i+=1)o[i]?.(t)},"tick");request(t){let o=this.nextId;this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1;let n=er!==requestAnimationFrame&&(er=requestAnimationFrame,!0);return(!this.isScheduled||n)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),o}cancel(t){let o=t-this.startId;o<0||o>=this.callbacks.length||(this.callbacks[o]=null,this.callbacksCount-=1)}},Be=new bt,X=class e{static{r(this,"AnimationFrame")}static create(){return new e}static request(t){return Be.request(t)}static cancel(t){return Be.cancel(t)}currentId=je;request(t){this.cancel(),this.currentId=Be.request(()=>{this.currentId=je,t()})}cancel=r(()=>{this.currentId!==je&&(Be.cancel(this.currentId),this.currentId=je)},"cancel");disposeEffect=r(()=>this.cancel,"disposeEffect")};function tr(){let e=H(X.create).current;return _e(e.disposeEffect),e}r(tr,"useAnimationFrame");function rr(e){return e==null?e:"current"in e?e.current:e}r(rr,"resolveRef");var $e=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({}),qr={[$e.startingStyle]:""},Gr={[$e.endingStyle]:""},or={transitionStatus(e){return e==="starting"?qr:e==="ending"?Gr:null}};function ir(e,t=!1,o=!0){let n=tr();return T((i,s=null)=>{n.cancel();let a=rr(e);if(a==null)return;let l=a,u=r(()=>{nr.flushSync(i)},"done");if(typeof l.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function d(){Promise.all(l.getAnimations().map(m=>m.finished)).then(()=>{s?.aborted||u()}).catch(()=>{if(o){s?.aborted||u();return}let m=l.getAnimations();!s?.aborted&&m.length>0&&m.some(f=>f.pending||f.playState!=="finished")&&d()})}if(r(d,"exec"),t){let m=$e.startingStyle;if(!l.hasAttribute(m)){n.request(d);return}let f=new MutationObserver(()=>{l.hasAttribute(m)||(f.disconnect(),d())});f.observe(l,{attributes:!0,attributeFilter:[m]}),s?.addEventListener("abort",()=>f.disconnect(),{once:!0});return}n.request(d)})}r(ir,"useAnimationsFinished");function ar(e){let{enabled:t=!0,open:o,ref:n,onComplete:i}=e,s=T(i),a=ir(n,o,!1);sr.useEffect(()=>{if(!t)return;let l=new AbortController;return a(s,l.signal),()=>{l.abort()}},[t,o,s,a])}r(ar,"useOpenChangeComplete");var xt=g(y(),1);function We(e,t=!1,o=!1){let[n,i]=xt.useState(e&&t?"idle":void 0),[s,a]=xt.useState(e);return e&&!s&&(a(!0),i("starting")),!e&&s&&n!=="ending"&&!o&&i("ending"),!e&&!s&&n==="ending"&&i(void 0),D(()=>{if(!e&&s&&n!=="ending"&&o){let l=X.request(()=>{i("ending")});return()=>{X.cancel(l)}}},[e,s,n,o]),D(()=>{if(!e||t)return;let l=X.request(()=>{i(void 0)});return()=>{X.cancel(l)}},[t,e]),D(()=>{if(!e||!t)return;e&&s&&n!=="idle"&&i("starting");let l=X.request(()=>{i("idle")});return()=>{X.cancel(l)}},[t,e,s,n]),{mounted:s,setMounted:a,transitionStatus:n}}r(We,"useTransitionStatus");var gt=g(ce(),1);var Yr={...W,...or},Rt=ae.forwardRef(r(function(t,o){let{render:n,id:i,className:s,match:a,style:l,...u}=t,d=J(i),{validityData:m,state:f,name:h}=B(!1),{setMessageIds:p}=P(),{errors:v}=z(),R=h&&Object.hasOwn(v,h)?v[h]:null,F=!!(Array.isArray(R)?R.length:R),V=typeof a=="string",E=!1;a===!0?E=!0:f.disabled?E=!1:V?E=!!m.state[a]:E=F||m.state.valid===!1;let{mounted:k,transitionStatus:c,setMounted:b}=We(E);D(()=>{if(!(!E||!d))return p(_=>_.concat(d)),()=>{p(_=>_.filter(L=>L!==d))}},[E,d,p]);let w=ae.useRef(null),[C,te]=ae.useState(null),[q,G]=ae.useState(null),I=m.error;!V&&F?I=R:m.errors.length>1&&(I=m.errors);let M=I??"";Array.isArray(I)&&(M=I.length>1?(0,gt.jsx)("ul",{children:I.map(_=>(0,gt.jsx)("li",{children:_},_))}):I[0]??"");let U=Array.isArray(I)?JSON.stringify(I):I;E&&U!==q&&(G(U),te(M)),ar({open:E,ref:w,onComplete(){E||b(!1)}});let j={...f,transitionStatus:c},Y=$("div",t,{ref:[o,w],state:j,props:[{id:d,children:E?M:C},u],stateAttributesMapping:Yr,enabled:k});return k?Y:null},"FieldError"));Rt.displayName="FieldError";var lr=g(y(),1);var ht=lr.forwardRef(r(function(t,o){let{render:n,id:i,className:s,style:a,...l}=t,u=J(i),d=B(!1),m=Ue(),{setMessageIds:f}=P(),h={...d.state,disabled:d.disabled||m.disabled};return D(()=>{if(u)return f(v=>v.concat(u)),()=>{f(v=>v.filter(R=>R!==u))}},[u,f]),$("p",t,{ref:o,state:h,props:[{id:u},l],stateAttributesMapping:W})},"FieldDescription"));ht.displayName="FieldDescription";var Ge=g(y(),1);var Q=g(y(),1);function ur({controlled:e,default:t,name:o,state:n="value"}){let{current:i}=Q.useRef(e!==void 0),[s,a]=Q.useState(t),l=i?e:s;{Q.useEffect(()=>{i!==(e!==void 0)&&de([`A component is changing the ${i?"":"un"}controlled ${n} state of ${o} to be ${i?"un":""}controlled.`,"Elements should not switch from uncontrolled to controlled (or vice versa).",`Decide between using a controlled or uncontrolled ${o} element for the lifetime of the component.`,"The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.","More info: https://fb.me/react-controlled-components"].join(`
|
|
3
|
+
`))},[n,o,e]);let{current:d}=Q.useRef(t);Q.useEffect(()=>{!i&&cr(d)!==cr(t)&&de([`A component is changing the default ${n} state of an uncontrolled ${o} after being initialized. To suppress this warning opt to use a controlled ${o}.`].join(`
|
|
4
|
+
`))},[t])}let u=Q.useCallback(d=>{i||a(d)},[]);return[l,u]}r(ur,"useControlled");function cr(e){let t=0,o=new WeakMap;try{return JSON.stringify(e,r(function(s,a){if(!(s==="_owner"&&this!=null&&typeof this=="object"&&"$$typeof"in this)){if(typeof a=="bigint")return`__bigint__:${a}`;if(a!==null&&typeof a=="object"){let l=o.get(a);if(l!==void 0)return`__object__:${l}`;o.set(a,t),t+=1}return a}},"replacer"))??`__top__:${typeof e}`}catch{return"__unserializable__"}}r(cr,"serializeToDevModeString");var dr=g(y(),1);function fr(e,t,o,n,i=!0,s){let{registerFieldControl:a}=B(),l=dr.useRef(null);l.current||(l.current=Symbol()),D(()=>{let u=l.current;return!u||!i?void 0:(a(u,{controlRef:e,getValue:n,id:t,name:s,value:o}),()=>{a(u,void 0)})},[e,i,n,t,s,a,o])}r(fr,"useRegisterFieldControl");var qe={};re(qe,{cancelOpen:()=>Eo,chipRemovePress:()=>ro,clearPress:()=>to,closePress:()=>Zr,closeWatcher:()=>po,decrementPress:()=>io,disabled:()=>Io,drag:()=>Ro,escapeKey:()=>mo,focusOut:()=>fo,imperativeAction:()=>To,incrementPress:()=>no,initial:()=>Fo,inputBlur:()=>lo,inputChange:()=>so,inputClear:()=>ao,inputPaste:()=>co,inputPress:()=>uo,itemPress:()=>Qr,keyboard:()=>xo,linkPress:()=>eo,listNavigation:()=>bo,missing:()=>yo,none:()=>Kr,outsidePress:()=>Xr,pointer:()=>go,scrub:()=>vo,siblingOpen:()=>Co,swipe:()=>Do,trackPress:()=>oo,triggerFocus:()=>Jr,triggerHover:()=>zr,triggerPress:()=>Hr,wheel:()=>ho,windowResize:()=>Vo});var Kr="none",Hr="trigger-press",zr="trigger-hover",Jr="trigger-focus",Xr="outside-press",Qr="item-press",Zr="close-press",eo="link-press",to="clear-press",ro="chip-remove-press",oo="track-press",no="increment-press",io="decrement-press",so="input-change",ao="input-clear",lo="input-blur",co="input-paste",uo="input-press",fo="focus-out",mo="escape-key",po="close-watcher",bo="list-navigation",xo="keyboard",go="pointer",Ro="drag",ho="wheel",vo="scrub",Eo="cancel-open",Co="sibling-open",Io="disabled",yo="missing",Fo="initial",To="imperative-action",Do="swipe",Vo="window-resize";function mr(e,t,o,n){let i=!1,s=!1,a=n??ue;return{reason:e,event:t??new Event("base-ui"),cancel(){i=!0},allowPropagation(){s=!0},get isCanceled(){return i},get isPropagationAllowed(){return s},trigger:o,...a}}r(mr,"createChangeEventDetails");var vt=Ge.forwardRef(r(function(t,o){let{render:n,className:i,id:s,name:a,value:l,disabled:u=!1,onValueChange:d,defaultValue:m,autoFocus:f=!1,style:h,...p}=t,{state:v,name:R,disabled:F,setTouched:V,setDirty:E,validityData:k,setFocused:c,setFilled:b,validationMode:w,validation:C}=B(),{clearErrors:te}=z(),q=F||u,G=R??a,I={...v,disabled:q},{labelId:M}=P(),U=jt({id:s});D(()=>{let x=l!=null;C.inputRef.current?.value||x&&l!==""?b(!0):x&&l===""&&b(!1)},[C.inputRef,b,l]);let j=Ge.useRef(null);D(()=>{f&&j.current===ut(Ne(j.current))&&c(!0)},[f,c]);let[Y]=ur({controlled:l,default:m,name:"FieldControl",state:"value"}),_=l!==void 0,L=_?Y:void 0,A=T(()=>C.inputRef.current?.value);return fr(C.inputRef,U,L,A,!q,a),$("input",t,{ref:[o,j],state:I,props:[{id:U,disabled:q,name:G,ref:C.inputRef,"aria-labelledby":M,autoFocus:f,..._?{value:L}:{defaultValue:m},onChange(x){let K=x.currentTarget.value;d?.(K,mr(qe.none,x.nativeEvent)),E(K!==k.initialValue),b(K!==""),x.nativeEvent.defaultPrevented||(te(G),C.change(K))},onFocus(){c(!0)},onBlur(x){V(!0),c(!1),w==="onBlur"&&C.commit(x.currentTarget.value)},onKeyDown(x){x.currentTarget.tagName==="INPUT"&&x.key==="Enter"&&(V(!0),C.commit(x.currentTarget.value))}},p,x=>C.getValidationProps(q,x)],stateAttributesMapping:W})},"FieldControl"));vt.displayName="FieldControl";var ve=g(y(),1);var pr=g(ce(),1);var Et=r(function(t){let{children:o}=t,{validityData:n,invalid:i}=B(!1),s=ve.useMemo(()=>se(n,i),[n,i]),a=s.state.valid===!1,{transitionStatus:l}=We(a),u=ve.useMemo(()=>({...s,validity:s.state,transitionStatus:l}),[s,l]);return(0,pr.jsx)(ve.Fragment,{children:o(u)})},"FieldValidity");Et.displayName="FieldValidity";var Ke=g(y(),1);var Ye=g(y(),1);var br=Ye.createContext(void 0);br.displayName="CheckboxGroupContext";function xr(e=!0){let t=Ye.useContext(br);if(t===void 0&&!e)throw new Error("Base UI: CheckboxGroupContext is missing. CheckboxGroup parts must be placed within <CheckboxGroup>.");return t}r(xr,"useCheckboxGroupContext");var Ct=g(ce(),1);var It=Ke.forwardRef(r(function(t,o){let{render:n,className:i,style:s,disabled:a=!1,...l}=t,{state:u,disabled:d}=B(!1),m=d||a,f={...u,disabled:m},h=xr(),v=h?.allValues!==void 0?h?.parent.id:void 0,R=Ke.useMemo(()=>({disabled:m}),[m]),F=$("div",t,{ref:o,state:f,props:l,stateAttributesMapping:W});return(0,Ct.jsx)(ge,{controlId:v,children:(0,Ct.jsx)(ke.Provider,{value:R,children:F})})},"FieldItem"));It.displayName="FieldItem";var Rr=g(ce(),1);var ze=gr.forwardRef(r(function(t,o){return(0,Rr.jsx)(He.Control,{ref:o,...t})},"Input"));ze.displayName="Input";var vr=g(Dr(),1);function Ya(e){let t=(0,hr.c)(10),o,n,i;t[0]!==e?({className:o,type:i,...n}=e,t[0]=e,t[1]=o,t[2]=n,t[3]=i):(o=t[1],n=t[2],i=t[3]);let s;t[4]!==o?(s=At("h-8 w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-xs file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 md:text-xs dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",o),t[4]=o,t[5]=s):s=t[5];let a;return t[6]!==n||t[7]!==s||t[8]!==i?(a=(0,vr.jsxDEV)(ze,{type:i,"data-slot":"input",className:s,...n},void 0,!1),t[6]=n,t[7]=s,t[8]=i,t[9]=a):a=t[9],a}r(Ya,"Input");export{W as a,B as b,z as c,kt as d,J as e,P as f,jt as g,Ne as h,we as i,lt as j,Tn as k,Dn as l,Vn as m,An as n,ut as o,Gt as p,dt as q,kn as r,Un as s,jn as t,Ur as u,Bn as v,$n as w,Wn as x,qn as y,Kt as z,_e as A,ft as B,zt as C,Ue as D,X as E,tr as F,rr as G,$e as H,or as I,ir as J,ar as K,We as L,ur as M,fr as N,qe as O,mr as P,xr as Q,Ya as R};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as He}from"./chunk-EOE5NDMK.js";import"./chunk-DWDILV2E.js";import{a as je}from"./chunk-J6J54MBP.js";import"./chunk-5OIBXYZM.js";import{a as Pe}from"./chunk-WUFVFVHJ.js";import{a as Ge}from"./chunk-XNJNSCLM.js";import{b as De}from"./chunk-W666BB6V.js";import{a as Be,b as Re,c as $e,d as j,e as E,f as _}from"./chunk-GTM65MVX.js";import{a as Le,e as Me}from"./chunk-SEU5V7I6.js";import{a as Ve}from"./chunk-VLXV72QE.js";import{R as We}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as V}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{b as de}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as J}from"./chunk-G7ZBM54M.js";import{f as Fe}from"./chunk-SDMZKBTD.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as ie}from"./chunk-TAD43CG5.js";import{d as U,f as ce,g as ue,h as me,l as fe,p as ze}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as f,e as Ie,f as at,g as ot,h as rt}from"./chunk-RRCPZMC2.js";var F=Ie(ot(),1);var w=Ie(at(),1);var t=Ie(rt(),1);var lt=f((o,e)=>{let s=new Set(o.map(a=>a.deadLetterQueue).filter(a=>typeof a=="string"&&a!=="")),i=o.filter(a=>(a.deadLetterQueue===void 0||a.deadLetterQueue==="")&&!s.has(a.name)),n=e.filter(a=>a.deadLettered).length;return{deadLetteredCount:n,queuesWithoutDlq:i,showReliabilityWarning:i.length>0||n>0}},"computeQueueReliability"),nt=200,dt=ce(J.sendQueueMessage),it=ce(J.replayQueueMessage),ct=ce(J.clearQueueMessages),Ye=96,ut=f(o=>{if(o===void 0)return"\u2014";try{return JSON.stringify(o)}catch{return"[unserializable]"}},"formatBody"),mt=f(o=>o.length>Ye?`${o.slice(0,Ye)}\u2026`:o,"truncate"),ft=f(o=>o==="error"?"destructive":o==="retry"?"outline":"secondary","outcomeVariant"),ht=f((o,e)=>e(o==="messages"?"Messages":o==="send"?"Send":"Declared"),"tabLabel"),pt=f(o=>{let e=(0,F.c)(11),{loaded:s,queues:i}=o,n=U(),a;e[0]!==n?(a=n("Queues are declared in code with defineQueue. Enqueue from a mutation or action with ctx.queues.<name>.send(...); push consumers process batches in the worker."),e[0]=n,e[1]=a):a=e[1];let l;e[2]!==a?(l=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:a},void 0,!1),e[2]=a,e[3]=l):l=e[3];let r;e[4]!==s||e[5]!==i||e[6]!==n?(r=s&&i.length===0?(0,t.jsxDEV)(ie,{description:n("No defineQueue is declared in lunora/queues.ts in this deployment. Add one to offload async work to a Cloudflare Queue."),testId:"queues-empty",title:n("No queues defined")},void 0,!1):(0,t.jsxDEV)(Le,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Me,{className:"px-0",children:(0,t.jsxDEV)(Be,{"data-testid":"queues-table",children:[(0,t.jsxDEV)(Re,{children:(0,t.jsxDEV)(j,{children:[(0,t.jsxDEV)(E,{children:n("Export")},void 0,!1),(0,t.jsxDEV)(E,{children:n("Queue")},void 0,!1),(0,t.jsxDEV)(E,{children:n("Mode")},void 0,!1),(0,t.jsxDEV)(E,{children:n("Binding")},void 0,!1),(0,t.jsxDEV)(E,{children:n("Dead-letter")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)($e,{children:i.map(yt)},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[4]=s,e[5]=i,e[6]=n,e[7]=r):r=e[7];let h;return e[8]!==l||e[9]!==r?(h=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"queues-declared",children:[l,r]},void 0,!0),e[8]=l,e[9]=r,e[10]=h):h=e[10],h},"QueuesDeclaredTab"),gt=f(o=>{let e=(0,F.c)(67),{message:s,onReplay:i,replayingId:n}=o,a=U(),l,r,h,u,y,p,x,d,m,g;if(e[0]!==s.attempts||e[1]!==s.body||e[2]!==s.deadLettered||e[3]!==s.exportName||e[4]!==s.id||e[5]!==s.messageId||e[6]!==s.outcome||e[7]!==s.queue||e[8]!==a){let W=ut(s.body);r=j,p=`queues-message-${s.id}`;let z=s.exportName??s.queue;e[19]!==z?(x=(0,t.jsxDEV)(_,{className:"font-mono text-xs",children:z},void 0,!1),e[19]=z,e[20]=x):x=e[20],e[21]!==s.messageId?(d=(0,t.jsxDEV)(_,{className:"max-w-[16ch] truncate font-mono text-xs text-muted-foreground",title:s.messageId,children:s.messageId},void 0,!1),e[21]=s.messageId,e[22]=d):d=e[22],e[23]!==s.attempts?(m=(0,t.jsxDEV)(_,{className:"font-mono text-xs tabular-nums",children:s.attempts},void 0,!1),e[23]=s.attempts,e[24]=m):m=e[24];let I=`queues-outcome-${s.id}`,L;e[25]!==s.outcome?(L=ft(s.outcome),e[25]=s.outcome,e[26]=L):L=e[26];let T;e[27]!==s.outcome||e[28]!==I||e[29]!==L?(T=(0,t.jsxDEV)(de,{"data-testid":I,variant:L,children:s.outcome},void 0,!1),e[27]=s.outcome,e[28]=I,e[29]=L,e[30]=T):T=e[30];let M;e[31]!==s.deadLettered||e[32]!==s.id||e[33]!==a?(M=s.deadLettered&&(0,t.jsxDEV)(de,{"data-testid":`queues-dlq-${s.id}`,variant:"destructive",children:a("DLQ")},void 0,!1),e[31]=s.deadLettered,e[32]=s.id,e[33]=a,e[34]=M):M=e[34],e[35]!==T||e[36]!==M?(g=(0,t.jsxDEV)(_,{children:(0,t.jsxDEV)("span",{className:"inline-flex items-center gap-1",children:[T,M]},void 0,!0)},void 0,!1),e[35]=T,e[36]=M,e[37]=g):g=e[37],l=_,h="max-w-[32ch] truncate font-mono text-xs text-muted-foreground",u=W,y=mt(W),e[0]=s.attempts,e[1]=s.body,e[2]=s.deadLettered,e[3]=s.exportName,e[4]=s.id,e[5]=s.messageId,e[6]=s.outcome,e[7]=s.queue,e[8]=a,e[9]=l,e[10]=r,e[11]=h,e[12]=u,e[13]=y,e[14]=p,e[15]=x,e[16]=d,e[17]=m,e[18]=g}else l=e[9],r=e[10],h=e[11],u=e[12],y=e[13],p=e[14],x=e[15],d=e[16],m=e[17],g=e[18];let v;e[38]!==l||e[39]!==h||e[40]!==u||e[41]!==y?(v=(0,t.jsxDEV)(l,{className:h,title:u,children:y},void 0,!1),e[38]=l,e[39]=h,e[40]=u,e[41]=y,e[42]=v):v=e[42];let N;e[43]!==s.capturedAt?(N=ze(s.capturedAt,"\u2014"),e[43]=s.capturedAt,e[44]=N):N=e[44];let b;e[45]!==N?(b=(0,t.jsxDEV)(_,{className:"text-xs text-muted-foreground tabular-nums",children:N},void 0,!1),e[45]=N,e[46]=b):b=e[46];let S=`queues-replay-${s.id}`,A=n!==null,C;e[47]!==s.id||e[48]!==n||e[49]!==a?(C=n===s.id?a("Replaying\u2026"):a("Replay"),e[47]=s.id,e[48]=n,e[49]=a,e[50]=C):C=e[50];let Q;e[51]!==s.id||e[52]!==i||e[53]!==S||e[54]!==A||e[55]!==C?(Q=(0,t.jsxDEV)(_,{children:(0,t.jsxDEV)(V,{"data-id":s.id,"data-testid":S,disabled:A,onClick:i,size:"xs",type:"button",variant:"outline",children:C},void 0,!1)},void 0,!1),e[51]=s.id,e[52]=i,e[53]=S,e[54]=A,e[55]=C,e[56]=Q):Q=e[56];let D;return e[57]!==r||e[58]!==b||e[59]!==Q||e[60]!==p||e[61]!==x||e[62]!==d||e[63]!==m||e[64]!==g||e[65]!==v?(D=(0,t.jsxDEV)(r,{"data-testid":p,children:[x,d,m,g,v,b,Q]},void 0,!0),e[57]=r,e[58]=b,e[59]=Q,e[60]=p,e[61]=x,e[62]=d,e[63]=m,e[64]=g,e[65]=v,e[66]=D):D=e[66],D},"QueueLogRow"),vt=f(o=>{let e=(0,F.c)(26),{hasError:s,messages:i,onClear:n,onReplay:a,replayingId:l}=o,r=U(),h;e[0]!==r?(h=r("Cloudflare Queues have no peek API, so this is what push consumers actually processed \u2014 not pending depth."),e[0]=r,e[1]=h):h=e[1];let u;e[2]!==h?(u=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:h},void 0,!1),e[2]=h,e[3]=u):u=e[3];let y=i.length===0,p;e[4]!==r?(p=r("Clear log"),e[4]=r,e[5]=p):p=e[5];let x;e[6]!==n||e[7]!==y||e[8]!==p?(x=(0,t.jsxDEV)(V,{className:"ml-auto","data-testid":"queues-clear",disabled:y,onClick:n,size:"sm",type:"button",variant:"outline",children:p},void 0,!1),e[6]=n,e[7]=y,e[8]=p,e[9]=x):x=e[9];let d;e[10]!==i.length||e[11]!==r?(d=i.length>0&&(0,t.jsxDEV)(de,{"data-testid":"queues-count",variant:"secondary",children:r("{count} messages",{count:i.length})},void 0,!1),e[10]=i.length,e[11]=r,e[12]=d):d=e[12];let m;e[13]!==u||e[14]!==x||e[15]!==d?(m=(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[u,x,d]},void 0,!0),e[13]=u,e[14]=x,e[15]=d,e[16]=m):m=e[16];let g;e[17]!==s||e[18]!==i||e[19]!==a||e[20]!==l||e[21]!==r?(g=!s&&i.length===0?(0,t.jsxDEV)(ie,{description:r("Consumed messages appear here once a push consumer processes a batch in dev. Send one from the Send tab to see it captured."),testId:"queues-messages-empty",title:r("No consumed messages yet.")},void 0,!1):(0,t.jsxDEV)(Le,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Me,{className:"px-0",children:(0,t.jsxDEV)(He,{className:"max-h-[32rem]","data-testid":"queues-messages-scroll",children:(0,t.jsxDEV)(Be,{"data-testid":"queues-messages-table",children:[(0,t.jsxDEV)(Re,{children:(0,t.jsxDEV)(j,{children:[(0,t.jsxDEV)(E,{children:r("Export")},void 0,!1),(0,t.jsxDEV)(E,{children:r("Message")},void 0,!1),(0,t.jsxDEV)(E,{children:r("Attempts")},void 0,!1),(0,t.jsxDEV)(E,{children:r("Outcome")},void 0,!1),(0,t.jsxDEV)(E,{children:r("Body")},void 0,!1),(0,t.jsxDEV)(E,{children:r("Captured")},void 0,!1),(0,t.jsxDEV)(E,{},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)($e,{children:i.map(N=>(0,t.jsxDEV)(gt,{message:N,onReplay:a,replayingId:l},N.id,!1))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)},void 0,!1),e[17]=s,e[18]=i,e[19]=a,e[20]=l,e[21]=r,e[22]=g):g=e[22];let v;return e[23]!==m||e[24]!==g?(v=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"queues-messages",children:[m,g]},void 0,!0),e[23]=m,e[24]=g,e[25]=v):v=e[25],v},"QueuesMessagesTab"),xt=f(o=>{let e=(0,F.c)(20),{batchMode:s,bodyText:i,delayText:n,onBatchModeChange:a,onBodyChange:l,onDelayChange:r,onSelectExport:h,onSend:u,queues:y,selectedExportName:p,sending:x}=o,d=U(),m;e[0]!==d?(m=d("Enqueue a JSON message to a declared producer to exercise its consumer. Nothing is captured until the consumer processes it."),e[0]=d,e[1]=m):m=e[1];let g;e[2]!==m?(g=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:m},void 0,!1),e[2]=m,e[3]=g):g=e[3];let v;e[4]!==s||e[5]!==i||e[6]!==n||e[7]!==a||e[8]!==l||e[9]!==r||e[10]!==h||e[11]!==u||e[12]!==y||e[13]!==p||e[14]!==x||e[15]!==d?(v=y.length===0?(0,t.jsxDEV)(ie,{description:d("Declare a queue with defineQueue in lunora/queues.ts to enqueue a test message."),testId:"queues-send-empty",title:d("No queues to send to")},void 0,!1):(0,t.jsxDEV)(t.Fragment,{children:[(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxDEV)("select",{"aria-label":d("Queue"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"queues-send-select",onChange:h,value:p,children:y.map(bt)},void 0,!1),(0,t.jsxDEV)(We,{"aria-label":d("Delay (seconds)"),className:"max-w-36","data-testid":"queues-send-delay",min:0,onChange:r,placeholder:d("Delay (s)"),type:"number",value:n},void 0,!1),(0,t.jsxDEV)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"queues-send-batch",children:[(0,t.jsxDEV)("input",{checked:s,"data-testid":"queues-send-batch",id:"queues-send-batch",onChange:a,type:"checkbox"},void 0,!1),d("Send as batch (JSON array)")]},void 0,!0),(0,t.jsxDEV)(V,{className:"ml-auto","data-testid":"queues-send-button",disabled:x||p==="",onClick:u,type:"button",children:d(x?"Sending\u2026":"Send message")},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(Ve,{"aria-label":d("Message body (JSON)"),className:"font-mono","data-testid":"queues-send-body",onChange:l,placeholder:s?'[ { "hello": "world" } ]':'{ "hello": "world" }',value:i},void 0,!1)]},void 0,!0),e[4]=s,e[5]=i,e[6]=n,e[7]=a,e[8]=l,e[9]=r,e[10]=h,e[11]=u,e[12]=y,e[13]=p,e[14]=x,e[15]=d,e[16]=v):v=e[16];let N;return e[17]!==g||e[18]!==v?(N=(0,t.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"queues-send",children:[g,v]},void 0,!0),e[17]=g,e[18]=v,e[19]=N):N=e[19],N},"QueuesSendTab"),Ut=f(o=>{let e=(0,F.c)(59),{limit:s}=o,i=s??nt,n=Fe(),a=U(),[l,r]=(0,w.useState)("declared"),[h,u]=(0,w.useState)(null),y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y={},e[0]=y):y=e[0];let{data:p,error:x,errorSource:d}=De(J.listQueues,y),m;e[1]!==i?(m={limit:i},e[1]=i,e[2]=m):m=e[2];let{data:g,error:v,errorSource:N,refetch:b}=De(J.getQueueMessages,m),S=Array.isArray(p?.queues)?[...p.queues].toSorted(Nt):[],A=g?.entries??[],{deadLetteredCount:C,queuesWithoutDlq:Q,showReliabilityWarning:D}=lt(S,A),[W,z]=(0,w.useState)(""),[I,L]=(0,w.useState)(""),[T,M]=(0,w.useState)(""),[G,Xe]=(0,w.useState)(!1),[he,Oe]=(0,w.useState)(!1),[pe,ke]=(0,w.useState)(null),H=S.some(c=>c.exportName===W)?W:S[0]?.exportName??"",Ue=l==="messages"?v:x,Ke=l==="messages"?N:d,ge=Ue??h,ve=Ue===null?h:Ke,Y;e[3]!==b?(Y=f(()=>{b()},"t3"),e[3]=b,e[4]=Y):Y=e[4],je(Y,l==="messages");let xe=f(async()=>{u(null);let c=H;if(c==="")return;let q=null,we=I.trim();if(we!=="")try{q=JSON.parse(we)}catch{u(a("Body must be valid JSON."));return}let Ae,Je=T.trim();if(Je!==""){let P=Number(Je);if(!Number.isFinite(P)||P<0){u(a("Delay must be a non-negative number of seconds."));return}Ae=P}if(G&&!Array.isArray(q)){u(a("Batch mode needs a JSON array body \u2014 each element is enqueued as one message."));return}Oe(!0);let st=G?{batch:q,delaySeconds:Ae,exportName:c}:{body:q,delaySeconds:Ae,exportName:c};try{await n.query(dt,st,ue("")),b()}catch(P){u(me(P))}Oe(!1)},"send"),X;e[5]!==n||e[6]!==b?(X=f(async c=>{u(null),ke(c);try{await n.query(it,{id:c},ue("")),b()}catch(q){u(me(q))}ke(null)},"t5"),e[5]=n,e[6]=b,e[7]=X):X=e[7];let ye=X,K;e[8]!==n||e[9]!==b?(K=f(async()=>{u(null);try{await n.query(ct,{},ue("")),b()}catch(c){u(me(c))}},"t6"),e[8]=n,e[9]=b,e[10]=K):K=e[10];let be=K,Z;e[11]===Symbol.for("react.memo_cache_sentinel")?(Z=f(c=>{let q=c.currentTarget.dataset.tab;(q==="declared"||q==="messages"||q==="send")&&r(q)},"t7"),e[11]=Z):Z=e[11];let Ze=Z,ee;e[12]===Symbol.for("react.memo_cache_sentinel")?(ee=f(c=>{z(c.currentTarget.value)},"t8"),e[12]=ee):ee=e[12];let Ne=ee,te;e[13]===Symbol.for("react.memo_cache_sentinel")?(te=f(c=>{L(c.currentTarget.value)},"t9"),e[13]=te):te=e[13];let qe=te,se;e[14]===Symbol.for("react.memo_cache_sentinel")?(se=f(c=>{M(c.currentTarget.value)},"t10"),e[14]=se):se=e[14];let Se=se,ae;e[15]===Symbol.for("react.memo_cache_sentinel")?(ae=f(c=>{Xe(c.currentTarget.checked)},"t11"),e[15]=ae):ae=e[15];let Ee=ae,oe;e[16]!==xe?(oe=f(()=>{fe(xe())},"t12"),e[16]=xe,e[17]=oe):oe=e[17];let _e=oe,re;e[18]!==ye?(re=f(c=>{let{id:q}=c.currentTarget.dataset;q!==void 0&&fe(ye(q))},"t13"),e[18]=ye,e[19]=re):re=e[19];let Te=re,le;e[20]!==be?(le=f(()=>{fe(be())},"t14"),e[20]=be,e[21]=le):le=e[21];let Ce=le,et="flex flex-col gap-6",tt="lunora-queues-panel",B;e[22]!==a||e[23]!==l?(B=(0,t.jsxDEV)("div",{className:"flex items-center gap-1","data-testid":"queues-tabs",role:"tablist",children:["declared","messages","send"].map(c=>(0,t.jsxDEV)(V,{"aria-selected":l===c,"data-tab":c,"data-testid":`queues-tab-${c}`,onClick:Ze,role:"tab",size:"sm",type:"button",variant:l===c?"secondary":"ghost",children:ht(c,a)},c,!1))},void 0,!1),e[22]=a,e[23]=l,e[24]=B):B=e[24];let R;e[25]!==ge||e[26]!==ve?(R=ge!==null&&(0,t.jsxDEV)(Pe,{error:ve,testId:"queues-error"},void 0,!1),e[25]=ge,e[26]=ve,e[27]=R):R=e[27];let Qe=D&&(0,t.jsxDEV)(Ge,{icon:(0,t.jsxDEV)("span",{"aria-hidden":"true",className:"text-base leading-none",children:"\u26A0"},void 0,!1),testId:"queues-dlq-warning",variant:"warning",children:(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[Q.length>0&&(0,t.jsxDEV)(t.Fragment,{children:[(0,t.jsxDEV)("p",{className:"font-medium",children:a("No dead-letter queue on {queues}.",{queues:Q.map(qt).join(", ")})},void 0,!1),(0,t.jsxDEV)("p",{className:"text-muted-foreground",children:a("Exhausted messages are dropped after retries. Add a deadLetterQueue to capture them.")},void 0,!1)]},void 0,!0),C>0&&(0,t.jsxDEV)("p",{className:Q.length>0?"text-muted-foreground":"font-medium",children:C===1?a("1 message was recently dead-lettered."):a("{count} messages were recently dead-lettered.",{count:C})},void 0,!1)]},void 0,!0)},void 0,!1),$;e[28]!==S||e[29]!==p||e[30]!==l?($=l==="declared"&&(0,t.jsxDEV)(pt,{loaded:p!==void 0,queues:S},void 0,!1),e[28]=S,e[29]=p,e[30]=l,e[31]=$):$=e[31];let O;e[32]!==A||e[33]!==v||e[34]!==Ce||e[35]!==Te||e[36]!==pe||e[37]!==l?(O=l==="messages"&&(0,t.jsxDEV)(vt,{hasError:v!==null,messages:A,onClear:Ce,onReplay:Te,replayingId:pe},void 0,!1),e[32]=A,e[33]=v,e[34]=Ce,e[35]=Te,e[36]=pe,e[37]=l,e[38]=O):O=e[38];let k;e[39]!==G||e[40]!==I||e[41]!==T||e[42]!==Ee||e[43]!==qe||e[44]!==Se||e[45]!==Ne||e[46]!==_e||e[47]!==S||e[48]!==H||e[49]!==he||e[50]!==l?(k=l==="send"&&(0,t.jsxDEV)(xt,{batchMode:G,bodyText:I,delayText:T,onBatchModeChange:Ee,onBodyChange:qe,onDelayChange:Se,onSelectExport:Ne,onSend:_e,queues:S,selectedExportName:H,sending:he},void 0,!1),e[39]=G,e[40]=I,e[41]=T,e[42]=Ee,e[43]=qe,e[44]=Se,e[45]=Ne,e[46]=_e,e[47]=S,e[48]=H,e[49]=he,e[50]=l,e[51]=k):k=e[51];let ne;return e[52]!==B||e[53]!==R||e[54]!==Qe||e[55]!==$||e[56]!==O||e[57]!==k?(ne=(0,t.jsxDEV)("div",{className:et,"data-testid":tt,children:[B,R,Qe,$,O,k]},void 0,!0),e[52]=B,e[53]=R,e[54]=Qe,e[55]=$,e[56]=O,e[57]=k,e[58]=ne):ne=e[58],ne},"QueuesPanel");function yt(o){return(0,t.jsxDEV)(j,{"data-testid":`queues-row-${o.exportName}`,children:[(0,t.jsxDEV)(_,{className:"font-mono text-xs",children:o.exportName},void 0,!1),(0,t.jsxDEV)(_,{className:"font-mono text-xs text-muted-foreground",children:o.name},void 0,!1),(0,t.jsxDEV)(_,{className:"font-mono text-xs text-muted-foreground",children:o.mode},void 0,!1),(0,t.jsxDEV)(_,{className:"font-mono text-xs text-muted-foreground",children:o.binding},void 0,!1),(0,t.jsxDEV)(_,{className:"font-mono text-xs text-muted-foreground",children:o.deadLetterQueue??"\u2014"},void 0,!1)]},o.exportName,!0)}f(yt,"_temp");function bt(o){return(0,t.jsxDEV)("option",{value:o.exportName,children:o.exportName},o.exportName,!1)}f(bt,"_temp2");function Nt(o,e){return o.exportName.localeCompare(e.exportName)}f(Nt,"_temp3");function qt(o){return o.name}f(qt,"_temp4");export{Ut as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as o,e as n,f as u,g as b,h as p,j as s}from"./chunk-RRCPZMC2.js";var l=n(b(),1),f=n(u(),1);var c=n(p(),1);function m(d){let i=(0,l.c)(8),e,r;i[0]!==d?({className:e,...r}=d,i[0]=d,i[1]=e,i[2]=r):(e=i[1],r=i[2]);let t;i[3]!==e?(t=s("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-2.5 py-2 text-xs transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 md:text-xs dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),i[3]=e,i[4]=t):t=i[4];let a;return i[5]!==r||i[6]!==t?(a=(0,c.jsxDEV)("textarea",{"data-slot":"textarea",className:t,...r},void 0,!1),i[5]=r,i[6]=t,i[7]=a):a=i[7],a}o(m,"Textarea");export{m as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b,c as v,d as g,f as D}from"./chunk-SDMZKBTD.js";import{f as y,g as p,h as P,l as O}from"./chunk-ITQKVEP7.js";import{a as n,e as Q,f as N,g as _}from"./chunk-RRCPZMC2.js";var E=Q(_(),1);var c=Q(N(),1);var C=n((e,r,o)=>["lunora-admin",e,r,o.trim()],"adminQueryKey"),h=1e3,S=25,q=new Map,k=n(e=>{let r=Date.now(),o=(q.get(e)??[]).filter(s=>r-s<h);o.push(r),q.set(e,o),o.length===S&&(console.error(`[lunora-studio] possible request loop: ${e} fired ${String(S)}\xD7 in <1s \u2014 a render/effect is re-issuing this read unbounded.`),console.trace("[lunora-studio] request-loop call site"))},"noteQueryFetch");function R(e,r,o={}){let{enabled:s=!0,keepPreviousData:a=!1,staleTime:i=0}=o,t=g({enabled:s,queryFn:n(()=>(k(JSON.stringify(e)),r()),"trackedQueryFunction"),placeholderData:a?b:void 0,queryKey:e,staleTime:i});return{data:t.data,error:t.error?P(t.error):t.error,errorSource:t.error??void 0,isLoading:t.isLoading,liveError:void 0,refetch:n(()=>{O(t.refetch())},"refetch")}}n(R,"useClientQuery");function K(e,r,o={}){let s=D(),a=v(),{enabled:i=!0,keepPreviousData:u=!1,live:t=!1,shardKey:l="",staleTime:I}=o,d=C(e,r,l),L=R(d,()=>s.query(y(e),r,p(l)),{enabled:i,keepPreviousData:u,staleTime:I??(t?Number.POSITIVE_INFINITY:0)}),[T,f]=(0,c.useState)(void 0),F=JSON.stringify(d);return(0,c.useEffect)(()=>{if(!(!i||!t))return f(void 0),s.subscribe(y(e),r,m=>{f(void 0),a.setQueryData(d,m)},{...p(l),onError:n(m=>{f(m.message)},"onError")})},[F,i,t]),{...L,liveError:i&&t?T:void 0}}n(K,"useAdminQuery");var M=n(()=>{let e=(0,E.c)(2),r=v(),o;return e[0]!==r?(o=n((s,a,i)=>{let u=a===void 0?["lunora-admin",s]:C(s,a,i??"");O(r.invalidateQueries({queryKey:u}))},"t0"),e[0]=r,e[1]=o):o=e[1],o},"useInvalidateAdmin");export{R as a,K as b,M as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as k,b as N,c as O,d as x,e as q,f as D}from"./chunk-GTM65MVX.js";import{a as g}from"./chunk-SEU5V7I6.js";import{a as C}from"./chunk-TAD43CG5.js";import{d as T,h as I,k as _,l as w}from"./chunk-ITQKVEP7.js";import{b as L}from"./chunk-22C6COGE.js";import{a as d,e as b,f as U,g as Y,h as F}from"./chunk-RRCPZMC2.js";var M=b(Y(),1);var H="https://api.cloudflare.com/client/v4/accounts",E=class extends L{static{d(this,"AnalyticsSqlError")}constructor(e,f){super("ANALYTICS_SQL_ERROR",`Analytics Engine SQL API returned ${String(e)}: ${f}`,{name:"AnalyticsSqlError",status:e})}},v=d(t=>{let e=t.fetch??globalThis.fetch,f=`${H}/${encodeURIComponent(t.accountId)}/analytics_engine/sql`;return{query:d(async s=>{let l=await e(f,{body:s,headers:{Authorization:`Bearer ${t.apiToken}`,"Content-Type":"text/plain"},method:"POST"});if(!l.ok)throw new E(l.status,await l.text());let n;try{n=await l.json()}catch{throw new E(l.status,"Analytics Engine SQL API returned a non-JSON body.")}let o=n,a=o.data??[];return{columns:o.meta??[],rowCount:o.rows??a.length,rows:a}},"query")}},"createAnalyticsSqlClient");var m=b(U(),1);var r=b(F(),1);var W="ANALYTICS",P=[{key:"volume",sql:d(t=>`SELECT blob2 AS fn, count() AS calls FROM ${t} WHERE blob1 = 'function_call' GROUP BY fn ORDER BY calls DESC LIMIT 25`,"sql"),title:"Request volume per function"},{key:"latency",sql:d(t=>`SELECT blob2 AS fn, quantileWeighted(0.50)(double1, _sample_interval) AS p50, quantileWeighted(0.95)(double1, _sample_interval) AS p95 FROM ${t} WHERE blob1 = 'function_call' GROUP BY fn ORDER BY p95 DESC LIMIT 25`,"sql"),title:"Latency p50 / p95 per function"},{key:"hotShards",sql:d(t=>`SELECT blob3 AS shard, count() AS calls FROM ${t} WHERE blob1 = 'function_call' GROUP BY shard ORDER BY calls DESC LIMIT 25`,"sql"),title:"Hot shards"}],j={error:null,loading:!0,result:null},G=d(t=>{let e=(0,M.c)(27),{state:f,title:p}=t,s=T(),{error:l,loading:n,result:o}=f,a=`analytics-panel-${p}`,i;e[0]!==s||e[1]!==p?(i=s(p),e[0]=s,e[1]=p,e[2]=i):i=e[2];let c;e[3]!==i?(c=(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:i},void 0,!1)},void 0,!1),e[3]=i,e[4]=c):c=e[4];let u;e[5]!==n||e[6]!==s?(u=n&&(0,r.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"analytics-loading",children:s("Loading\u2026")},void 0,!1),e[5]=n,e[6]=s,e[7]=u):u=e[7];let y;e[8]!==l||e[9]!==n?(y=!n&&l!==null&&(0,r.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"analytics-error",role:"alert",children:l},void 0,!1),e[8]=l,e[9]=n,e[10]=y):y=e[10];let h;e[11]!==l||e[12]!==n||e[13]!==o||e[14]!==s?(h=!n&&l===null&&o!==null&&o.rows.length===0&&(0,r.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"analytics-empty-rows",children:s("No data points yet.")},void 0,!1),e[11]=l,e[12]=n,e[13]=o,e[14]=s,e[15]=h):h=e[15];let A;e[16]!==l||e[17]!==n||e[18]!==o?(A=!n&&l===null&&o!==null&&o.rows.length>0&&(0,r.jsxDEV)(k,{children:[(0,r.jsxDEV)(N,{children:(0,r.jsxDEV)(x,{children:o.columns.map(Q)},void 0,!1)},void 0,!1),(0,r.jsxDEV)(O,{children:o.rows.map((B,$)=>(0,r.jsxDEV)(x,{children:o.columns.map(R=>(0,r.jsxDEV)(D,{className:"font-mono text-xs",children:_(B[R.name])},R.name,!1))},$,!1))},void 0,!1)]},void 0,!0),e[16]=l,e[17]=n,e[18]=o,e[19]=A):A=e[19];let S;return e[20]!==a||e[21]!==c||e[22]!==u||e[23]!==y||e[24]!==h||e[25]!==A?(S=(0,r.jsxDEV)(g,{className:"gap-0 py-0","data-testid":a,children:[c,u,y,h,A]},void 0,!0),e[20]=a,e[21]=c,e[22]=u,e[23]=y,e[24]=h,e[25]=A,e[26]=S):S=e[26],S},"PanelResult"),re=d(({config:t,dataset:e=W,runQuery:f}={})=>{let p=T(),[s,l]=(0,m.useState)({}),n=(0,m.useMemo)(()=>{if(f!==void 0)return f;if(t===void 0)return null;let a=v({accountId:t.accountId,apiToken:t.apiToken});return i=>a.query(i)},[t,f]),o=(0,m.useCallback)(async a=>{if(n!==null)for(let i of P){if(a.cancelled)return;l(c=>({...c,[i.key]:{error:null,loading:!0,result:null}}));try{let c=await n(i.sql(e));a.cancelled||l(u=>({...u,[i.key]:{error:null,loading:!1,result:c}}))}catch(c){a.cancelled||l(u=>({...u,[i.key]:{error:I(c),loading:!1,result:null}}))}}},[n,e]);return(0,m.useEffect)(()=>{let a={cancelled:!1};return w(o(a)),()=>{a.cancelled=!0}},[o]),n===null?(0,r.jsxDEV)(C,{description:p("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN (Analytics Read) in your .dev.vars to enable usage panels."),icon:(0,r.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,r.jsxDEV)("path",{d:"M5 20V10m6.5 10V4M18 20v-7M3 20h18"},void 0,!1)},void 0,!1),testId:"analytics-not-configured",title:p("Analytics is not configured.")},void 0,!1):(0,r.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-analytics-panel",children:P.map(a=>(0,r.jsxDEV)(G,{state:s[a.key]??j,title:a.title},a.key,!1))},void 0,!1)},"AnalyticsPanel");function Q(t){return(0,r.jsxDEV)(q,{children:t.name},t.name,!1)}d(Q,"_temp");export{re as AnalyticsPanel};
|