@lunora/studio 1.0.0-alpha.3 → 1.0.0-alpha.30
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/__assets__/package-og.svg +1 -1
- package/dist/index.d.ts +29 -18
- package/dist/index.js +29 -29
- package/dist/mount.d.ts +1 -1
- package/dist/mount.js +1 -1
- 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} +24 -36
- package/dist/{packem_shared/ExportImportPanel-dxY56TDF.js → packem_chunks/ExportImportPanel.js} +13 -9
- package/dist/{packem_shared/FileBrowser-Dhy4zES8.js → packem_chunks/FileBrowser.js} +15 -15
- package/dist/{packem_shared/FunctionRunner--fQJRPAD.js → packem_chunks/FunctionRunner.js} +10 -10
- package/dist/{packem_shared/FunctionStatsPanel-BjRUA_G3.js → packem_chunks/FunctionStatsPanel.js} +147 -204
- 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} +107 -69
- package/dist/{packem_shared/LogsPanel-CTW8CFcM.js → packem_chunks/LogsPanel.js} +41 -53
- package/dist/{packem_shared/MailPanel-BwkvfIHF.js → packem_chunks/MailPanel.js} +37 -44
- package/dist/{packem_shared/MetricsPanel-BLuOhZQ4.js → packem_chunks/MetricsPanel.js} +41 -322
- package/dist/{packem_shared/MigrationsPanel-DT3lnwHF.js → packem_chunks/MigrationsPanel.js} +39 -46
- package/dist/{packem_shared/PitrPanel-CdErL7EJ.js → packem_chunks/PitrPanel.js} +9 -9
- package/dist/{packem_shared/SchemaViewer-LJDcmNIO.js → packem_chunks/SchemaViewer.js} +15 -15
- package/dist/{packem_shared/SecurityAdvisorPanel-C_ETsPih.js → packem_chunks/SecurityAdvisorPanel.js} +44 -31
- package/dist/packem_chunks/SettingsPanel.js +390 -0
- package/dist/{packem_shared/sql-editor-panel-BFRpzj6r.js → packem_chunks/SqlEditorPanel.js} +12 -252
- package/dist/{packem_shared/TableEditor-ChfUOZec.js → packem_chunks/TableEditor.js} +10 -68
- package/dist/packem_chunks/analytics-panel.js +261 -0
- package/dist/packem_chunks/auth-config-panel.js +179 -0
- package/dist/packem_chunks/auth-sessions-panel.js +175 -0
- package/dist/packem_chunks/dashboards-panel.js +779 -0
- package/dist/packem_chunks/fanout-panel.js +481 -0
- package/dist/packem_chunks/flags-panel.js +176 -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 +670 -0
- package/dist/packem_chunks/payments-panel.js +185 -0
- package/dist/packem_chunks/permissions-panel.js +804 -0
- package/dist/packem_chunks/queues-panel.js +147 -0
- package/dist/packem_chunks/rls-panel.js +313 -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 +138 -0
- package/dist/packem_chunks/subscriptions-panel.js +236 -0
- package/dist/packem_chunks/users-panel.js +1265 -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-CdaxLGkE.js} +3 -0
- package/dist/packem_shared/{ApiDocsPanel-C5-yJ1p7.js → ApiDocsPanel-B6u_wnz-.js} +2 -2
- package/dist/packem_shared/{ApiReferencePanel-1vubqG5s.js → ApiReferencePanel-Drz4UO0a.js} +2 -1
- package/dist/packem_shared/{CommandPalette-BtgkBzZI.js → CommandPalette-B5BertvU.js} +1 -1
- package/dist/packem_shared/{DataBrowser-CtBe1So9.js → DataBrowser-ANTHLWWh.js} +198 -247
- package/dist/packem_shared/{GlobalDataBrowser-BTEmGrph.js → GlobalDataBrowser-CjgTG_wa.js} +37 -66
- package/dist/packem_shared/HomePanel-c2FodE9t.js +14 -0
- package/dist/packem_shared/{OpenRpcReferencePanel-vbcYbv3V.js → OpenRpcReferencePanel-CspFdbUT.js} +2 -1
- package/dist/packem_shared/{ScheduledJobs-CabfKbyM.js → ScheduledJobs-BEJXtsBn.js} +163 -60
- package/dist/packem_shared/Studio-CVTtA_sB.js +16 -0
- package/dist/packem_shared/{StudioApp-CHOZA-z-.js → StudioApp-BSYV2fz6.js} +277 -3
- package/dist/packem_shared/{advisor-view-CGcfMiPq.js → advisor-view-DzqyvUU3.js} +1 -1
- package/dist/packem_shared/{app.d-CCmwDEVs.d.ts → app.d-B6MyY_al.d.ts} +1 -1
- package/dist/packem_shared/{bar-chart-CzJAgqkp.js → bar-chart-Bb__F5-u.js} +1 -1
- package/dist/packem_shared/browser-storage-d03UsV7v.js +249 -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-Dsg6nRjo.js} +1 -1
- package/dist/packem_shared/data-view-params-Cd6yRVbv.js +96 -0
- package/dist/packem_shared/{grid-features-CzUfqgsM.js → grid-features-D7nNzBYm.js} +4 -99
- package/dist/packem_shared/{HomePanel-Cw16stjq.js → home-panel-aOR_drVv.js} +833 -469
- package/dist/packem_shared/{internal-rXJEAhXS.js → internal-FcNZ3beb.js} +1 -1
- package/dist/packem_shared/modal-shell-hyaJvIJ6.js +100 -0
- package/dist/packem_shared/{reference-view-B4E49Lip.js → reference-view-Doy1XlQq.js} +4 -44
- package/dist/packem_shared/select-UkNYCT3s.js +273 -0
- package/dist/packem_shared/skeleton-CGhL0p20.js +45 -0
- package/dist/packem_shared/{sparkline-10dG-_f0.js → sparkline-KgMPHS4u.js} +1 -1
- package/dist/packem_shared/studio-dMTJ-kRR.js +3987 -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-VMo0ftxD.js} +1 -1
- package/dist/packem_shared/use-admin-query-BViPA3US.js +105 -0
- package/dist/packem_shared/use-auth-capabilities-BHkoBnbZ.js +32 -0
- package/dist/standalone/chunk-2DS7JLWL.js +13 -0
- package/dist/standalone/chunk-2K47A3P6.js +1 -0
- package/dist/standalone/chunk-2NGUNNGW.js +1 -0
- package/dist/standalone/chunk-2PDQ4KZ6.js +1 -0
- package/dist/standalone/chunk-3BP4BTLR.js +4 -0
- package/dist/standalone/chunk-3OA7PECS.js +6 -0
- package/dist/standalone/chunk-4QHKBC77.js +1 -0
- package/dist/standalone/chunk-57LYXHXH.js +1 -0
- package/dist/standalone/chunk-5NSZVXCS.js +1 -0
- package/dist/standalone/chunk-5OIBXYZM.js +1 -0
- package/dist/standalone/chunk-63XKJQTQ.js +1 -0
- package/dist/standalone/chunk-6RC6L33K.js +4 -0
- package/dist/standalone/chunk-6VTGE3WJ.js +1 -0
- package/dist/standalone/chunk-7PBZKXYA.js +1 -0
- package/dist/standalone/chunk-7POIIWC5.js +3 -0
- package/dist/standalone/chunk-7RYIQKZA.js +1 -0
- package/dist/standalone/chunk-7TJJXVSE.js +1 -0
- package/dist/standalone/chunk-AB6QGMBF.js +1 -0
- package/dist/standalone/chunk-AHILM3ZP.js +1 -0
- package/dist/standalone/chunk-AQGOX5DK.js +1 -0
- package/dist/standalone/chunk-ASLGNHAX.js +1 -0
- package/dist/standalone/chunk-BHTPZS7L.js +4 -0
- package/dist/standalone/chunk-BJGBHGK3.js +1 -0
- package/dist/standalone/chunk-D7HKX4DI.js +1 -0
- package/dist/standalone/chunk-DGWTR4G7.js +1 -0
- package/dist/standalone/chunk-DSX53PBM.js +1 -0
- package/dist/standalone/chunk-DV2MNASX.js +1 -0
- package/dist/standalone/chunk-DWDILV2E.js +1 -0
- package/dist/standalone/chunk-E7AVZZKO.js +1 -0
- package/dist/standalone/chunk-EGJX34WM.js +1 -0
- package/dist/standalone/chunk-FCR3HKFV.js +1 -0
- package/dist/standalone/chunk-FKO3HO6I.js +4 -0
- package/dist/standalone/chunk-FQKNJSRA.js +76 -0
- package/dist/standalone/chunk-G2TFEWEQ.js +4 -0
- package/dist/standalone/chunk-GABMIICA.js +1 -0
- package/dist/standalone/chunk-GTM65MVX.js +1 -0
- package/dist/standalone/chunk-GZXPPJVK.js +1 -0
- package/dist/standalone/chunk-HFBRE65A.js +1 -0
- package/dist/standalone/chunk-HFMQNUBC.js +1 -0
- package/dist/standalone/chunk-HG7Q5B3H.js +1 -0
- package/dist/standalone/chunk-HTQL7AXU.js +1 -0
- package/dist/standalone/chunk-HV7G6DFP.js +5 -0
- package/dist/standalone/chunk-ITLLHEVG.js +1 -0
- package/dist/standalone/chunk-J6J54MBP.js +1 -0
- package/dist/standalone/chunk-JSEXCW5Q.js +1 -0
- package/dist/standalone/chunk-KEGAWN6Y.js +1 -0
- package/dist/standalone/chunk-KG3QTFWE.js +1 -0
- package/dist/standalone/chunk-KGS7KM4A.js +2 -0
- package/dist/standalone/chunk-KODWGUAB.js +1 -0
- package/dist/standalone/chunk-KZ6INM5M.js +1 -0
- package/dist/standalone/chunk-MGFEVTRI.js +1 -0
- package/dist/standalone/chunk-N2QDG3MW.js +1 -0
- package/dist/standalone/chunk-N4JI6VQD.js +1 -0
- package/dist/standalone/chunk-NNISYDNI.js +1 -0
- package/dist/standalone/chunk-O4PXDNR3.js +1 -0
- package/dist/standalone/chunk-O77VNUFD.js +1 -0
- package/dist/standalone/chunk-OD2POGPJ.js +1 -0
- package/dist/standalone/chunk-OXCK3ZUG.js +1 -0
- package/dist/standalone/chunk-P7DSVO4U.js +1 -0
- package/dist/standalone/chunk-PKAM3N5C.js +1 -0
- package/dist/standalone/chunk-QGXGBHQO.js +1 -0
- package/dist/standalone/chunk-QHA3TAEJ.js +1 -0
- package/dist/standalone/chunk-QQWC62X7.js +1 -0
- package/dist/standalone/chunk-RMYA7NAH.js +1 -0
- package/dist/standalone/chunk-RRCPZMC2.js +22 -0
- package/dist/standalone/chunk-S53RUBW5.js +1 -0
- package/dist/standalone/chunk-SB4GT6PK.js +1 -0
- package/dist/standalone/chunk-SEU5V7I6.js +1 -0
- package/dist/standalone/chunk-SHIOUDOT.js +1 -0
- package/dist/standalone/chunk-SIDRSX7Y.js +1 -0
- package/dist/standalone/chunk-SVR644RF.js +1 -0
- package/dist/standalone/chunk-TAD43CG5.js +1 -0
- package/dist/standalone/chunk-TBMYIZIO.js +1 -0
- package/dist/standalone/chunk-TICVNLPM.js +1 -0
- package/dist/standalone/chunk-TQ36RWOP.js +1 -0
- package/dist/standalone/chunk-UGMRUEBU.js +1 -0
- package/dist/standalone/chunk-UII66UVF.js +1 -0
- package/dist/standalone/chunk-VJPQUBN6.js +8 -0
- package/dist/standalone/chunk-VLXV72QE.js +1 -0
- package/dist/standalone/chunk-VMJKJWG6.js +1 -0
- package/dist/standalone/chunk-VPDPN5RR.js +2 -0
- package/dist/standalone/chunk-VSEGZA3J.js +1 -0
- package/dist/standalone/chunk-VXBZQIGY.js +4 -0
- package/dist/standalone/chunk-W7PCVQTE.js +1 -0
- package/dist/standalone/chunk-XLILSHPE.js +1 -0
- package/dist/standalone/chunk-XURNGQSS.js +1 -0
- package/dist/standalone/chunk-YJGANMU7.js +18 -0
- package/dist/standalone/chunk-YQQJ4N6U.js +1 -0
- package/dist/standalone/chunk-ZH7UES4T.js +2 -0
- package/dist/standalone/chunk-ZPUO7FNI.js +1 -0
- package/dist/standalone/chunk-ZQCVDXDL.js +1 -0
- package/dist/standalone/studio.js +104 -246
- package/dist/styles.css +1 -1
- package/package.json +13 -12
- package/dist/packem_shared/SettingsPanel-C0uLRf5P.js +0 -176
- package/dist/packem_shared/SqlEditorPanel-CguV7otm.js +0 -13
- package/dist/packem_shared/Studio-DFWAlcuf.js +0 -33
- package/dist/packem_shared/studio-Bj8psK1c.js +0 -10303
- package/dist/packem_shared/use-live-admin-Dq6g3daN.js +0 -73
- package/dist/packem_shared/use-live-shard-seed-Cuk3dnH0.js +0 -76
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as 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{a as De}from"./chunk-OD2POGPJ.js";import{a as Fe}from"./chunk-7TJJXVSE.js";import{e as Ke}from"./chunk-SVR644RF.js";import{a as He}from"./chunk-2K47A3P6.js";import"./chunk-KEGAWN6Y.js";import{a as D,b as We}from"./chunk-AB6QGMBF.js";import"./chunk-GTM65MVX.js";import{a as Ue}from"./chunk-RMYA7NAH.js";import{b as Oe}from"./chunk-TBMYIZIO.js";import"./chunk-BHTPZS7L.js";import{c as Pe}from"./chunk-YQQJ4N6U.js";import"./chunk-TICVNLPM.js";import"./chunk-HV7G6DFP.js";import{a as S}from"./chunk-AQGOX5DK.js";import{b as C}from"./chunk-FCR3HKFV.js";import"./chunk-SEU5V7I6.js";import"./chunk-ZH7UES4T.js";import{f as qe}from"./chunk-KODWGUAB.js";import"./chunk-3OA7PECS.js";import{d as I,e as H,f as W,i as T}from"./chunk-YJGANMU7.js";import{a as r,e as U,f as Ze,g as et,h as tt}from"./chunk-RRCPZMC2.js";var Ee=U(et(),1);var y=U(Ze(),1);var A=U(tt(),1);var l=r((a,t)=>({cacheKey:t.cacheKey,categories:t.categories??a.categories,description:a.description,detail:t.detail,facing:t.facing??a.facing,level:t.level??a.level,metadata:t.metadata,name:a.name,remediation:a.remediation,title:a.title}),"emit");var L=5,j=r(a=>typeof a._id=="string"?a._id:"?","rowId"),z=r((a,t,e)=>a?` (sample capped at ${t.toString()} rows \u2014 ${e})`:"","truncatedSuffix"),X=r((a,t)=>{let e=a.slice(0,L),n=t-e.length,i=e.map(o=>`"${o}"`).join(", ");return n>0?`${i} (+${n.toString()} more)`:i},"formatExamples"),nt=r((a,t,e,n)=>{if(e.kind!=="one")return;let i=e.field,o=[];for(let u of t.rows){let g=u[i];if(g==null)continue;let m=String(g);n.existingIds.has(m)||o.push(j(u))}if(o.length===0)return;let s=t.truncated||n.truncated,c=Math.min(t.cap,n.cap),d=`Table "${t.table}": ${o.length.toString()} sampled row(s) have a dangling FK value in column "${i}" \u2014 the referenced "${e.table}" row does not exist. Row ids: ${X(o,o.length)}${z(s,c,"more rows may exist beyond the window")}.`;return l(a,{cacheKey:`constraint_validator:fk:${t.table}:${i}`,detail:d,metadata:{cap:c,column:i,count:o.length,examples:o.slice(0,L),kind:"fk",referencesTable:e.table,table:t.table,truncated:s}})},"checkFkRelation"),at=r((a,t,e,n)=>{if(!n)return;let i=[];for(let s of t.rows){let c=s[e];c==null&&i.push(j(s))}if(i.length===0)return;let o=`Table "${t.table}": ${i.length.toString()} sampled row(s) have a null/missing value in column "${e}", which is declared as non-optional. Row ids: ${X(i,i.length)}${z(t.truncated,t.cap,"more rows may exist beyond the window")}.`;return l(a,{cacheKey:`constraint_validator:null:${t.table}:${e}`,detail:o,metadata:{cap:t.cap,column:e,count:i.length,examples:i.slice(0,L),kind:"null",table:t.table,truncated:t.truncated}})},"checkNullField"),it=r((a,t)=>{let e=[];for(let n of t){let i=a[n];if(i==null)return;e.push(JSON.stringify(i))}return e.join("|")},"compositeKey"),ot=r((a,t,e)=>{e.includes(t)||e.push(t),e.push(a)},"recordDuplicate"),rt=r((a,t,e)=>{if(e.kind!=="index"||e.unique!==!0)return;let n=new Map,i=[];for(let s of t.rows){let c=j(s),d=it(s,e.fields);if(d===void 0)continue;let u=n.get(d);u===void 0?n.set(d,c):ot(c,u,i)}if(i.length===0)return;let o=`Table "${t.table}": ${i.length.toString()} sampled row(s) share duplicate values on unique index "${e.name}" (${e.fields.join(", ")}). Row ids: ${X(i,i.length)}${z(t.truncated,t.cap,"duplicates beyond the window may exist")}.`;return l(a,{cacheKey:`constraint_validator:unique:${t.table}:${e.name}`,detail:o,metadata:{cap:t.cap,count:i.length,examples:i.slice(0,L),fields:e.fields,index:e.name,kind:"unique",table:t.table,truncated:t.truncated}})},"checkUniqueIndex"),st=r((a,t,e,n)=>{let i=n.get(t.table);if(!i)return[];let o=[];for(let s of i.relations){let c=e.get(s.table);if(!c)continue;let d=nt(a,t,s,c);d&&o.push(d)}for(let s of i.fields){let c=!i.optionalFields?.has(s),d=at(a,t,s,c);d&&o.push(d)}for(let s of i.indexes){let c=rt(a,t,s);c&&o.push(c)}return o},"checkTable"),B={categories:["SCHEMA"],description:"Sampled rows violate one or more declared constraints: a foreign-key column references a non-existent row, a non-optional column contains null, or a unique-indexed column has duplicate values. These violations indicate data inserted before a constraint was enforced (e.g. a schema migration, a raw import, or a bug in a past data-migration transform).",facing:"INTERNAL",level:"WARN",name:"constraint_validator",remediation:"Inspect the listed rows and correct or remove the violating values. Run a data migration to backfill nulls, dedup unique violations, or re-link dangling FK references. For FK violations, confirm the target table rows exist before fixing the referencing rows.",run:r(a=>{if(!a.tableSamples||a.tableSamples.length===0)return[];let t=new Map;for(let n of a.tableSamples)t.set(n.table,n);let e=new Map(a.schema.tables.map(n=>[n.name,n]));return a.tableSamples.flatMap(n=>st(B,n,t,e))},"run"),source:"runtime",title:"Constraint violation"};var lt=.5,ct=50,Q={categories:["PERFORMANCE"],description:"One shard is taking a disproportionate share of a sharded function's traffic, so the busy shard becomes a single-DO bottleneck while its siblings sit idle \u2014 the hot-key skew sharding is meant to avoid.",facing:"EXTERNAL",level:"WARN",name:"hot_shard",remediation:"Re-shard on a higher-cardinality / more evenly-distributed key, or split the hot entity's state, so request volume spreads across shards instead of concentrating on one.",run:r(a=>{let t=(a.shardTraffic??[]).filter(i=>i.requests>0),e=t.reduce((i,o)=>i+o.requests,0);if(t.length<2||e<ct)return[];let n=[];for(let i of t){let o=i.requests/e;if(o<lt)continue;let s=i.group!==void 0&&i.group!==""?`"${i.group}" `:"",c=i.shardKey===""?"the root shard":`shard "${i.shardKey}"`,d=Math.round(o*100);n.push(l(Q,{cacheKey:`hot_shard:${i.group??""}:${i.shardKey}`,detail:`${s}${c} handled ${i.requests.toString()} of ${e.toString()} requests (${d.toString()}%) across ${t.length.toString()} shards \u2014 a hot-key skew. Re-shard on a more evenly-distributed key.`,metadata:{group:i.group,requests:i.requests,shardCount:t.length,shardKey:i.shardKey,share:o,totalRequests:e}}))}return n},"run"),source:"runtime",title:"Hot shard"};var dt=25,M={categories:["PERFORMANCE"],description:"Recorded reads show an index the workload doesn't pay for: either a declared index no read ever used (dead overhead on every write) or a table read hot with no index at all (a repeated full scan that degrades as it grows).",facing:"INTERNAL",level:"INFO",name:"index_utilization",remediation:"Drop a dead index so writes stop maintaining it; add an index covering the hot full-scanned table's read predicate so the read stops scanning every row.",run:r(a=>{let t=[];for(let e of a.indexHits??[])e.reads>0||t.push(l(M,{cacheKey:`index_utilization:dead_index:${e.table}:${e.index}`,detail:`Index "${e.index}" on table "${e.table}" has recorded no reads since its counter was created \u2014 it's dead overhead: every write maintains it and nothing reads through it.`,metadata:{index:e.index,kind:"dead_index",reads:e.reads,table:e.table}}));for(let e of a.tableScans??[])e.scans<dt||t.push(l(M,{cacheKey:`index_utilization:hot_scan:${e.table}`,detail:`Table "${e.table}" has been full-scanned ${e.scans.toString()} times (cumulative) with no index \u2014 a repeated full scan that degrades linearly as "${e.table}" grows. Add an index covering the read predicate.`,facing:"EXTERNAL",level:"WARN",metadata:{kind:"hot_scan",scans:e.scans,table:e.table}}));return t},"run"),source:"runtime",title:"Index utilization"};var Y={categories:["SECURITY"],description:"An `httpRoute` on an admin/privileged path has no visible auth/admin guard. REST routes aren't covered by RLS, so an unguarded `/admin/*` route is callable by anyone who reaches the URL.",facing:"EXTERNAL",level:"WARN",name:"admin_route_without_guard",remediation:"Assert an authenticated, authorized caller at the top of the handler \u2014 check `ctx.auth` / `getSession(...)`, or a `requireAdmin`-style guard \u2014 and reject (401/403) before doing privileged work. For machine callers, verify a secret with a timing-safe compare.",run:r(a=>{if(a.adminRoutes===void 0)return[];let t=[];for(let e of a.adminRoutes)e.usesGuard||t.push(l(Y,{cacheKey:`admin_route_without_guard:${e.file}:${e.method}:${e.path}`,detail:`Route \`${e.method} ${e.path}\` (\`${e.exportName}\` in ${e.file}) is on an admin/privileged path but its handler shows no auth/admin guard. Assert an authorized caller before doing privileged work.`,metadata:{exportName:e.exportName,file:e.file,method:e.method,path:e.path}}));return t},"run"),source:"static",title:"Admin route without an auth guard"};var V={categories:["SECURITY"],description:"A `ctx.authApi.<method>(...)` call omits `headers` \u2014 better-auth skips session authorization and runs the call with full server-to-server privileges, regardless of the caller's identity.",facing:"EXTERNAL",level:"WARN",name:"auth_api_call_without_headers",remediation:"Pass the inbound `headers` from the incoming request into every `ctx.authApi.*` call: `ctx.authApi.<method>({ body, headers: request.headers })`. See the `withAuthPlugins` middleware doc for details.",run:r(a=>{if(a.authApiCalls===void 0)return[];let t=[],e=new Map;for(let n of a.authApiCalls){if(n.hasHeaders)continue;let i=`${n.file}:${n.line.toString()}:${n.method}`,o=(e.get(i)??0)+1;e.set(i,o);let s=o>1?`:${o.toString()}`:"";t.push(l(V,{cacheKey:`auth_api_call_without_headers:${i}${s}`,detail:`\`ctx.authApi.${n.method||"<method>"}(\u2026)\` in ${n.exportName} (${n.file}:${n.line.toString()}) is called without \`headers\` \u2014 better-auth skips session authorization, so this runs with full privileges. Pass the inbound \`headers\`.`,metadata:{exportName:n.exportName,file:n.file,line:n.line,method:n.method}}))}return t},"run"),source:"static",title:"Privileged ctx.authApi call missing headers"};var G={categories:["SCHEMA"],description:"A chain of foreign-key relations forms a cycle (e.g. A \u2192 B \u2192 C \u2192 A). Circular FK dependencies can cause unexpected behavior during DELETE operations \u2014 a CASCADE chain may loop indefinitely, and even a RESTRICT cycle prevents deletion of any row in the loop without temporarily disabling constraints.",facing:"INTERNAL",level:"WARN",name:"circular_fk",remediation:"Remove or break the cycle by dropping at least one FK relation from the loop. Consider replacing the circular dependency with a nullable FK and explicit application logic, or restructure the schema using a junction table.",run:r(a=>{let t=[],e=new Map;for(let c of a.schema.tables)for(let d of c.relations){if(d.kind!=="one")continue;let u=e.get(c.name);u===void 0&&(u=new Set,e.set(c.name,u)),u.add(d.table)}let n=new Set,i=new Set,o=r((c,d)=>{let u=d.indexOf(c);if(u===-1)return;let g=d.slice(u);if(g.length<2)return;let m=0;for(let w=1;w<g.length;w+=1)g[w]<g[m]&&(m=w);let h=[...g.slice(m),...g.slice(0,m)],v=h.join("\u2192");if(i.has(v))return;i.add(v);let x=[...h,h[0]].join(" \u2192 ");t.push(l(G,{cacheKey:`circular_fk:${v}`,detail:`Circular foreign-key dependency detected: ${x}. This cycle can cause unexpected behavior during DELETE operations.`,metadata:{cycle:h,path:x,tables:h}}))},"reportBackEdge"),s=r((c,d)=>{n.add(c),d.push(c);for(let u of e.get(c)??[])n.has(u)?o(u,d):s(u,d);d.pop(),n.delete(c)},"dfs");for(let c of a.schema.tables)s(c.name,[]);return t},"run"),source:"static",title:"Circular foreign-key dependency"};var ut=new Set(["standard-3","standard-4"]),mt=2,ft=4096,ht=r(a=>typeof a=="string"?ut.has(a):(a.vcpu??0)>mt||(a.memoryMib??0)>ft,"isOversized"),J={categories:["PERFORMANCE"],description:"A container is declared on a large instance type, whose provisioned memory and disk are billed for the lifetime of every running instance.",facing:"INTERNAL",level:"INFO",name:"container_oversized_instance",remediation:"Confirm the workload needs this size; a smaller instanceType (lite/basic/standard-1) costs less while idle-but-running.",run:r(a=>{let t=[];for(let e of a.containers??[]){let{instanceType:n}=e;if(n===void 0||!ht(n))continue;let i=typeof n=="string"?n:JSON.stringify(n);t.push(l(J,{cacheKey:`container_oversized_instance:${e.exportName}`,detail:`Container "${e.exportName}" uses a large instance type (${i}); its memory + disk are billed while any instance runs.`,metadata:{container:e.exportName,instanceType:n}}))}return t},"run"),source:"static",title:"Oversized container instance"};var Z={categories:["SECURITY"],description:"A container leaves outbound internet access at the default (enabled), which is billed per GB of egress and widens the attack surface.",facing:"INTERNAL",level:"INFO",name:"container_public_internet",remediation:"Set `enableInternet: false` on the container if it doesn't call external services, or `true` to opt in deliberately.",run:r(a=>{let t=[];for(let e of a.containers??[])e.enableInternet===void 0&&t.push(l(Z,{cacheKey:`container_public_internet:${e.exportName}`,detail:`Container "${e.exportName}" doesn't set enableInternet, so outbound internet is on by default (egress is billed).`,metadata:{container:e.exportName}}));return t},"run"),source:"static",title:"Container egress enabled by default"};var pt=r((a,t)=>a.length>t.length?!1:a.every((e,n)=>e===t[n]),"isLeadingPrefix"),ee={categories:["PERFORMANCE"],description:"A secondary index is redundant because another index already covers every lookup it serves (its columns are a leading prefix of the other's). The redundant index costs storage and is maintained on every write for no read benefit.",facing:"INTERNAL",level:"INFO",name:"duplicate_index",remediation:"Drop the redundant index; the covering index already serves its lookups.",run:r(a=>{let t=[];for(let e of a.schema.tables){let n=e.indexes.filter(i=>i.kind==="index");for(let i of n){if(i.unique===!0)continue;let o=n.find(s=>s===i||!pt(i.fields,s.fields)?!1:i.fields.length===s.fields.length?i.name>s.name:!0);o&&t.push(l(ee,{cacheKey:`duplicate_index:${e.name}:${i.name}`,detail:`Index "${i.name}" on table "${e.name}" (${i.fields.join(", ")}) is redundant \u2014 index "${o.name}" (${o.fields.join(", ")}) already covers its lookups.`,metadata:{coveredBy:{fields:o.fields,name:o.name},fields:i.fields,index:i.name,table:e.name}}))}}return t},"run"),source:"static",title:"Duplicate / redundant index"};var te={categories:["SCHEMA"],description:"An index declares no columns, so it indexes nothing and can never narrow a read.",facing:"INTERNAL",level:"WARN",name:"empty_index",remediation:"Give the index its columns, or remove it.",run:r(a=>{let t=[];for(let e of a.schema.tables)for(let n of e.indexes)n.kind!=="index"||n.fields.length>0||t.push(l(te,{cacheKey:`empty_index:${e.name}:${n.name}`,detail:`Index "${n.name}" on table "${e.name}" declares no columns.`,metadata:{index:n.name,table:e.name}}));return t},"run"),source:"static",title:"Empty index"};var ne={categories:["PERFORMANCE"],description:"A query calls `.filter()` without a `.withIndex()` / `.withSearchIndex()`, so it loads every row in the table and filters in memory \u2014 a full table scan that gets linearly slower as the table grows.",facing:"EXTERNAL",level:"WARN",name:"filter_without_index",remediation:'Narrow the read with `.withIndex("name", (q) => q.eq(...))` first, then `.filter()` only for what the index cannot express.',run:r(a=>{let t=[];for(let e of a.queries??[]){if(!e.hasFilter||e.hasIndex||e.table==="")continue;let n=e.line>0?`${e.file}:${e.line.toString()}`:e.file;t.push(l(ne,{cacheKey:`filter_without_index:${e.file}:${e.line.toString()}:${e.table}`,detail:`Query on "${e.table}" at ${n} calls .filter() without an index \u2014 it loads every row of "${e.table}" and filters in memory.`,metadata:{file:e.file,line:e.line,table:e.table}}))}return t},"run"),source:"static",title:"Filter without index"};var ae={categories:["SECURITY"],description:"A secret-shaped string literal (live API key, access key, private key, or high-entropy token) is hard-coded in the source. Committed secrets leak via clone/fork/history and force a redeploy to rotate.",facing:"INTERNAL",level:"ERROR",name:"hardcoded_secret",remediation:'Move the secret out of source: set it locally in `.dev.vars` (`lunora env set <NAME> "<value>"`) and in production with `wrangler secret put <NAME>`, then read it at runtime from `env.<NAME>`. Rotate the exposed value \u2014 assume it is already compromised.',run:r(a=>{if(a.secretLiterals===void 0)return[];let t=[],e=new Map;for(let n of a.secretLiterals){let i=`${n.file}:${n.line.toString()}:${n.kind}`,o=(e.get(i)??0)+1;e.set(i,o);let s=o>1?`:${o.toString()}`:"";t.push(l(ae,{cacheKey:`hardcoded_secret:${i}${s}`,detail:`A ${n.kind.replaceAll("_"," ")} (${n.preview}) is hard-coded at ${n.file}:${n.line.toString()}. Move it to \`.dev.vars\` / \`wrangler secret put\` and read it from \`env\`. Rotate the exposed value.`,metadata:{file:n.file,kind:n.kind,line:n.line,preview:n.preview}}))}return t},"run"),source:"static",title:"Hard-coded secret in source"};var ie={categories:["SCHEMA"],description:"A `query`/`mutation` handler accesses Hyperdrive via `ctx.sql`. Hyperdrive hits an external database Lunora does not own: queries are non-deterministic (like `fetch`) and external writes are invisible to live queries. `ctx.sql` is available on `ActionCtx` only and must be confined to `action` handlers.",facing:"EXTERNAL",level:"WARN",name:"hyperdrive_outside_action",remediation:"Move the `ctx.sql` access into an `action(...)` (the only context where it is typed), where external I/O is allowed. If a query/mutation needs the data, have the action read it via `ctx.sql` and write a projection into a `defineSchema` DO/D1 table \u2014 that write is tracked by live queries, whereas the external DB is not.",run:r(a=>{if(a.hyperdriveCalls===void 0)return[];let t=[];for(let e of a.hyperdriveCalls)t.push(l(ie,{cacheKey:`hyperdrive_outside_action:${e.file}:${e.line.toString()}:${e.callee}`,detail:`\`${e.callee}(\u2026)\` in ${e.exportName} (${e.file}:${e.line.toString()}) runs inside a ${e.kind} handler \u2014 Hyperdrive's \`ctx.sql\` is non-deterministic and non-reactive, so it is available only in actions. Move the external SQL into an \`action\` and project the result into a Lunora table if a query/mutation needs it.`,metadata:{callee:e.callee,exportName:e.exportName,file:e.file,kind:e.kind,line:e.line}}));return t},"run"),source:"static",title:"Hyperdrive `ctx.sql` used outside an action"};var gt=new Set(["_creationTime","_id"]),q=r(a=>new Set([...gt,...a.fields]),"tableColumnSet");var oe={categories:["SCHEMA"],description:"An index references a column that is not declared on its table. The index can never match, and the typo would otherwise surface only at runtime.",facing:"INTERNAL",level:"ERROR",name:"index_references_unknown_field",remediation:"Fix the column name in the index declaration, or add the column to the table.",run:r(a=>{let t=[];for(let e of a.schema.tables){let n=q(e);for(let i of e.indexes)for(let o of i.fields)n.has(o)||t.push(l(oe,{cacheKey:`index_references_unknown_field:${e.name}:${i.name}:${o}`,detail:`Index "${i.name}" on table "${e.name}" references column "${o}", which is not declared on the table.`,metadata:{field:o,index:i.name,indexKind:i.kind,table:e.name}}))}return t},"run"),source:"static",title:"Index references unknown field"};var re={categories:["SECURITY"],description:"A public procedure reads a table whose columns are masked by `.use(mask(...))` elsewhere in the app, but this procedure's builder chain does not include `.use(mask(...))`. It returns those columns in the clear while a sibling procedure redacts them.",facing:"EXTERNAL",level:"WARN",name:"mask_uncovered_pii_column",remediation:"Add `.use(mask(policies))` to the procedure's builder chain \u2014 e.g. `c.use(mask(myMasks)).query(...)` \u2014 so its returned rows redact the same columns as the rest of the app. If this procedure is intentionally privileged (e.g. an admin export), declare it with `internalQuery` / `internalMutation` / `internalAction` instead of the public builder so the intent is explicit.",run:r(a=>{if(a.maskProcedures===void 0)return[];let t=new Map;for(let n of a.maskProcedures)for(let{column:i,table:o}of n.maskColumns){if(o===""||i==="")continue;let s=t.get(o)??new Set;s.add(i),t.set(o,s)}if(t.size===0)return[];let e=[];for(let n of a.maskProcedures){if(n.usesMask||n.visibility==="internal")continue;let i=new Set;for(let o of n.tablesRead)o!==""&&t.has(o)&&i.add(o);for(let o of i){let s=[...t.get(o)??new Set].toSorted((d,u)=>d.localeCompare(u)),c=s.map(d=>`\`${d}\``).join(", ");e.push(l(re,{cacheKey:`mask_uncovered_pii_column:${n.file}:${n.exportName}:${o}`,detail:`\`${n.exportName}\` in ${n.file} reads table \`${o}\` without \`.use(mask(...))\` \u2014 its column${s.length===1?"":"s"} ${c} ${s.length===1?"is":"are"} masked elsewhere in the app but returned in the clear here.`,metadata:{columns:s,exportName:n.exportName,file:n.file,table:o}}))}}return e},"run"),source:"static",title:"Maskable column returned without mask() middleware"};var se={categories:["SCHEMA"],description:"A custom mutator's `server` impl writes with `ctx.db.replace(id, document)` \u2014 a whole-row overwrite. On a synced table this clobbers a concurrent edit to a different column; `ctx.db.patch(id, { field })` merges at the column level so independent field edits coexist.",facing:"EXTERNAL",level:"WARN",name:"mutator_full_row_replace",remediation:"Prefer `ctx.db.patch(id, { onlyTheChangedField })` so a concurrent edit to another column isn't lost. Keep `replace` only when the mutator genuinely owns the entire row (e.g. a full-form save).",run:r(a=>a.mutatorWrites===void 0?[]:a.mutatorWrites.map(t=>l(se,{cacheKey:`mutator_full_row_replace:${t.exportName}:${String(t.line)}`,detail:`Mutator \`${t.exportName}\` (${t.file}:${String(t.line)}) writes with \`ctx.db.replace(...)\`, overwriting the whole row. A concurrent edit to a different column is clobbered \u2014 use \`ctx.db.patch(id, { field })\` to merge at the column level.`,metadata:{exportName:t.exportName,file:t.file,line:t.line}})),"run"),source:"static",title:"Mutator overwrites the whole row (clobbers concurrent column edits)"};var le={categories:["SCHEMA"],description:"A `query`/`mutation` handler calls a non-deterministic API (`Date.now`, `Math.random`, `crypto.randomUUID`, `crypto.getRandomValues`, or `fetch`). These handlers may be re-run on OCC retry / subscription re-evaluation, so they must be deterministic \u2014 time, randomness, and network belong in an `action`.",facing:"EXTERNAL",level:"WARN",name:"nondeterministic_query_mutation",remediation:"Move the non-deterministic call into an `action(...)` (which runs once and may use ambient APIs), then pass the computed value into the mutation as an argument \u2014 e.g. compute `Date.now()` in the action and call `ctx.runMutation(api.\u2026, { now })`. Take generated ids/timestamps as args instead of producing them in the handler.",run:r(a=>{if(a.nondeterministicCalls===void 0)return[];let t=[],e=new Map;for(let n of a.nondeterministicCalls){let i=`${n.file}:${n.line.toString()}:${n.callee}`,o=(e.get(i)??0)+1;e.set(i,o);let s=o>1?`:${o.toString()}`:"";t.push(l(le,{cacheKey:`nondeterministic_query_mutation:${i}${s}`,detail:`\`${n.callee}(\u2026)\` in ${n.exportName} (${n.file}:${n.line.toString()}) runs inside a ${n.kind} handler \u2014 query/mutation handlers must be deterministic. Compute it in an \`action\` and pass the value into the mutation as an argument.`,metadata:{callee:n.callee,exportName:n.exportName,file:n.file,kind:n.kind,line:n.line}}))}return t},"run"),source:"static",title:"Non-deterministic call in query/mutation handler"};var ce={categories:["SECURITY"],description:"An RLS policy is bound to a `table` name that does not exist in the schema. The `rls()` middleware never matches it, so the table the policy was meant to protect is left ungated \u2014 reads return unrestricted rows and writes are allowed.",facing:"EXTERNAL",level:"WARN",name:"policy_references_unknown_table",remediation:"Fix the policy's `table` to a real table name (check for a typo or a table that was renamed/removed). If the table is gone, delete the dead policy.",run:r(a=>{if(a.rlsProcedures===void 0)return[];let t=new Set(a.schema.tables.map(i=>i.name)),e=new Set,n=[];for(let i of a.rlsProcedures)for(let o of i.rlsTables)o===""||t.has(o)||e.has(o)||(e.add(o),n.push(l(ce,{cacheKey:`policy_references_unknown_table:${o}`,detail:`An RLS policy in \`${i.exportName}\` (${i.file}) is bound to table \`${o}\`, which is not declared in the schema. The policy never matches, so \`${o}\` \u2014 if it exists under another name \u2014 is left ungated.`,metadata:{exportName:i.exportName,file:i.file,table:o}})));return n},"run"),source:"static",title:"RLS policy bound to an unknown table"};var de={categories:["SECURITY"],description:"A public procedure declares a `v.any()` argument. `v.any()` accepts arbitrary untyped input from an untrusted client \u2014 defeating validation and opening injection / oversized-payload abuse.",facing:"EXTERNAL",level:"WARN",name:"public_arg_uses_any",remediation:"Replace `v.any()` with a precise validator \u2014 `v.object({...})`, `v.string()`, `v.union(...)`, etc. If the shape is genuinely dynamic, model the known variants with `v.union` rather than accepting anything.",run:r(a=>{if(a.argValidators===void 0)return[];let t=[];for(let e of a.argValidators)for(let n of e.anyArgs)t.push(l(de,{cacheKey:`public_arg_uses_any:${e.file}:${e.exportName}:${n}`,detail:`Arg \`${n}\` of public procedure \`${e.exportName}\` (${e.file}:${e.line.toString()}) is \`v.any()\` \u2014 untrusted input with no validation. Give it a precise validator.`,metadata:{argument:n,exportName:e.exportName,file:e.file,line:e.line}}));return t},"run"),source:"static",title:"Public argument uses v.any()"};var bt=/contact|forgot|login|magic|otp|register|reset|signin|signup|subscribe|verify/iu,ue={categories:["SECURITY"],description:"A public `mutation`/`action` has no `rateLimit` middleware. Publicly-callable writes are flood and brute-force targets \u2014 an attacker can exhaust writes, mail quota, or credits, or guess credentials on auth-shaped endpoints.",facing:"EXTERNAL",level:"WARN",name:"public_mutation_without_ratelimit",remediation:'Attach a rate limit: `.use(rateLimit(limiter, "<bucket>"))` from `@lunora/ratelimit`, or wrap the recommended public-procedure guards with `.use(protectPublic({ rateLimit, captcha }))` from `@lunora/server`. Genuinely-open writes can be acknowledged by adding a permissive limiter.',run:r(a=>{if(a.procedureProtections===void 0)return[];let t=[];for(let e of a.procedureProtections){if(!(e.visibility==="public"&&(e.kind==="mutation"||e.kind==="action"))||e.usesRateLimit)continue;let i=bt.test(e.exportName);t.push(l(ue,{cacheKey:`public_mutation_without_ratelimit:${e.file}:${e.exportName}`,detail:`Public ${e.kind} \`${e.exportName}\` (${e.file}) has no rate limit${i?" \u2014 its name suggests an auth/abuse-sensitive endpoint, so this is high-risk":""}. Add \`.use(rateLimit(...))\` or \`.use(protectPublic({ rateLimit }))\`.`,metadata:{exportName:e.exportName,file:e.file,kind:e.kind,sensitive:i}}))}return t},"run"),source:"static",title:"Public write without a rate limit"};var me={categories:["SCHEMA"],description:"A `query`/`mutation` handler accesses R2 SQL via `ctx.r2sql`. R2 SQL queries external Apache Iceberg tables over REST (no Workers binding): queries are non-deterministic (like `fetch`) and the reads are invisible to live queries. `ctx.r2sql` is available on `ActionCtx` only and must be confined to `action` handlers.",facing:"EXTERNAL",level:"WARN",name:"r2sql_outside_action",remediation:"Move the `ctx.r2sql` access into an `action(...)` (the only context where it is typed), where external I/O is allowed. If a query/mutation needs the data, have the action read it via `ctx.r2sql` and write a projection into a `defineSchema` DO/D1 table \u2014 that write is tracked by live queries, whereas R2 SQL is not.",run:r(a=>{if(a.r2sqlCalls===void 0)return[];let t=[];for(let e of a.r2sqlCalls)t.push(l(me,{cacheKey:`r2sql_outside_action:${e.file}:${e.line.toString()}:${e.callee}`,detail:`\`${e.callee}(\u2026)\` in ${e.exportName} (${e.file}:${e.line.toString()}) runs inside a ${e.kind} handler \u2014 R2 SQL's \`ctx.r2sql\` is non-deterministic and non-reactive, so it is available only in actions. Move the external query into an \`action\` and project the result into a Lunora table if a query/mutation needs it.`,metadata:{callee:e.callee,exportName:e.exportName,file:e.file,kind:e.kind,line:e.line}}));return t},"run"),source:"static",title:"R2 SQL `ctx.r2sql` used outside an action"};var wt=r((a,t,e,n)=>{let i=a.get(n.table);if(!i)return[];let o=n.kind==="one"?e:i,s=n.kind==="one"?i:e,c=[];return t(o).has(n.field)||c.push({column:n.field,owner:o.name,side:"field"}),t(s).has(n.references)||c.push({column:n.references,owner:s.name,side:"references"}),c},"missingColumns"),fe={categories:["SCHEMA"],description:"A relation references a foreign-key or referenced column that is not declared on its table, so the join can never resolve.",facing:"INTERNAL",level:"ERROR",name:"relation_references_unknown_field",remediation:"Fix the `field` / `references` column name in the relation, or add the missing column.",run:r(a=>{let t=new Map(a.schema.tables.map(i=>[i.name,i])),e=new Map,n=r(i=>{let o=e.get(i);return o||(o=q(i),e.set(i,o)),o},"columnsOf");return a.schema.tables.flatMap(i=>i.relations.flatMap(o=>wt(t,n,i,o).map(s=>l(fe,{cacheKey:`relation_references_unknown_field:${i.name}:${o.name}:${s.side}`,detail:`Relation "${o.name}" on table "${i.name}" uses ${s.side} "${s.column}", which is not declared on table "${s.owner}".`,metadata:{column:s.column,owner:s.owner,relation:o.name,side:s.side,table:i.name}}))))},"run"),source:"static",title:"Relation references unknown field"};var he={categories:["SCHEMA"],description:"A relation targets a table that does not exist in the schema. The relation can never load \u2014 the target is a typo or a removed/renamed table.",facing:"INTERNAL",level:"ERROR",name:"relation_references_unknown_table",remediation:"Fix the target table name in the relation, or add the missing table to the schema.",run:r(a=>{let t=[],e=new Set(a.schema.tables.map(n=>n.name));for(let n of a.schema.tables)for(let i of n.relations)e.has(i.table)||t.push(l(he,{cacheKey:`relation_references_unknown_table:${n.name}:${i.name}`,detail:`Relation "${i.name}" on table "${n.name}" targets table "${i.table}", which does not exist in the schema.`,metadata:{relation:i.name,table:n.name,target:i.table}}));return t},"run"),source:"static",title:"Relation references unknown table"};var pe={categories:["SECURITY"],description:"A public procedure reads or writes a table that is covered by an RLS policy elsewhere in the app, but this procedure's builder chain does not include `.use(rls(...))`. The raw, unwrapped `ctx.db` silently bypasses every policy in the list.",facing:"EXTERNAL",level:"WARN",name:"rls_uncovered_table",remediation:"Add `.use(rls(policies))` to the procedure's builder chain \u2014 e.g. `c.use(rls(myPolicies)).query(...)` \u2014 so its `ctx.db` is wrapped by the same policy evaluator as the rest of the app. If this procedure is intentionally privileged (e.g. a background job), declare it with `internalQuery` / `internalMutation` / `internalAction` instead of the public builder so the intent is explicit.",run:r(a=>{if(a.rlsProcedures===void 0)return[];let t=new Set;for(let n of a.rlsProcedures)for(let i of n.rlsTables)i!==""&&t.add(i);if(t.size===0)return[];let e=[];for(let n of a.rlsProcedures){if(n.usesRls||n.visibility==="internal")continue;let i=new Set;for(let o of[...n.tablesRead,...n.tablesWritten])o!==""&&t.has(o)&&i.add(o);for(let o of i)e.push(l(pe,{cacheKey:`rls_uncovered_table:${n.file}:${n.exportName}:${o}`,detail:`\`${n.exportName}\` in ${n.file} accesses table \`${o}\` without \`.use(rls(...))\` \u2014 the table is policy-gated elsewhere in the app but this procedure bypasses those policies entirely.`,metadata:{exportName:n.exportName,file:n.file,table:o}}))}return e},"run"),source:"static",title:"RLS-gated table accessed without rls() middleware"};var ge={categories:["PERFORMANCE"],description:"A `defineShape` replicates from a `.global()` table. Global tables live outside the shard DO's SQLite op-log, so the shape is served through the cross-shard tier \u2014 coordinator/poll-refreshed and latency-tiered, not poke-live like a sharded shape.",facing:"EXTERNAL",level:"WARN",name:"shape_targets_global_table",remediation:"Expected if you want the cross-shard tier \u2014 just don't assume poke-live freshness; global shapes refresh on a poll. For live updates, replicate from a sharded table instead (denormalize the columns you need into the shard).",run:r(a=>{if(a.shapes===void 0)return[];let t=new Set(a.schema.tables.filter(n=>n.shardKind==="global").map(n=>n.name)),e=[];for(let n of a.shapes)n.table===void 0||!t.has(n.table)||e.push(l(ge,{cacheKey:`shape_targets_global_table:${n.exportName}`,detail:`Shape \`${n.exportName}\` (${n.file}) replicates from the \`.global()\` table \`${n.table}\`. It is served through the cross-shard global tier \u2014 poll-refreshed and latency-tiered, not poke-live.`,metadata:{exportName:n.exportName,file:n.file,table:n.table}}));return e},"run"),source:"static",title:"Shape replicates from a global (cross-shard) table"};var be={categories:["SCHEMA"],description:"A `defineShape` is bound to a `table` name that does not exist in the schema. The shape can never resolve a rowset \u2014 its subscription seeds empty and errors at the first flush.",facing:"INTERNAL",level:"ERROR",name:"shape_unknown_table",remediation:"Fix the shape's `table` to a real table name (check for a typo or a table that was renamed/removed).",run:r(a=>{if(a.shapes===void 0)return[];let t=new Set(a.schema.tables.map(n=>n.name)),e=[];for(let n of a.shapes)n.table===void 0||t.has(n.table)||e.push(l(be,{cacheKey:`shape_unknown_table:${n.exportName}`,detail:`Shape \`${n.exportName}\` (${n.file}) replicates from table \`${n.table}\`, which is not declared in the schema. The shape can never resolve a rowset.`,metadata:{exportName:n.exportName,file:n.file,table:n.table}}));return e},"run"),source:"static",title:"Shape bound to an unknown table"};var we={categories:["SECURITY"],description:"A `ctx.sql` tagged-template interpolates an unparameterized string-building expression (concatenation or nested template) instead of a bound value \u2014 splicing raw text into the query and reopening SQL injection.",facing:"EXTERNAL",level:"ERROR",name:"sql_injection_risk",remediation:"Pass the value through a bound placeholder so the driver parameterizes it \u2014 keep request input inside a `ctx.sql` placeholder instead of concatenating it into the query string. Never build SQL text from request input by hand.",run:r(a=>a.sqlInterpolations===void 0?[]:a.sqlInterpolations.map(t=>l(we,{cacheKey:`sql_injection_risk:${t.file}:${t.line.toString()}`,detail:`\`ctx.sql\` in \`${t.exportName}\` (${t.file}:${t.line.toString()}) interpolates a string-building expression instead of a bound value \u2014 a SQL-injection vector. Pass the value through a bound placeholder so the driver parameterizes it.`,metadata:{exportName:t.exportName,file:t.file,line:t.line}})),"run"),source:"static",title:"Possible SQL injection in ctx.sql interpolation"};var ve={categories:["SCHEMA"],description:'No function inserts into this table via `ctx.db.insert("<table>", \u2026)`. It may be read-only by design (seeded by a migration, replicated, or written through a path the advisor can\'t see) \u2014 or it may be dead schema.',facing:"INTERNAL",level:"INFO",name:"table_without_insert",remediation:'If the table should be writable, add a mutation that calls `ctx.db.insert("<table>", \u2026)`. If it is read-only or seeded elsewhere, this advisory can be ignored.',run:r(a=>{if(a.inserts===void 0)return[];let t=new Set(a.inserts.filter(n=>n.table!=="").map(n=>n.table)),e=[];for(let n of a.schema.tables)t.has(n.name)||n.externallyManaged===!0||e.push(l(ve,{cacheKey:`table_without_insert:${n.name}`,detail:`No function calls \`ctx.db.insert("${n.name}", \u2026)\` \u2014 table "${n.name}" has no discovered insert path.`,metadata:{table:n.name}}));return e},"run"),source:"static",title:"Table has no insert path"};var ye={categories:["SECURITY"],description:"A public `v.string()` argument has no maximum-length bound. An unbounded string lets a client submit arbitrarily large input \u2014 abusing storage and CPU on every request that processes it.",facing:"EXTERNAL",level:"INFO",name:"unbounded_string_arg",remediation:"Add a max-length bound via `.check(...)` / `.meta({ maxLength })` on the string validator (e.g. cap a name at 256, a body at a few KB). Size the cap to the field's real-world maximum.",run:r(a=>{if(a.argValidators===void 0)return[];let t=[];for(let e of a.argValidators)for(let n of e.unboundedStringArgs)t.push(l(ye,{cacheKey:`unbounded_string_arg:${e.file}:${e.exportName}:${n}`,detail:`Arg \`${n}\` of public procedure \`${e.exportName}\` (${e.file}:${e.line.toString()}) is an unbounded \`v.string()\`. Add a max-length bound to cap payload size.`,metadata:{argument:n,exportName:e.exportName,file:e.file,line:e.line}}));return t},"run"),source:"static",title:"Public string argument has no length bound"};var K=r(a=>`by${a.charAt(0).toUpperCase()}${a.slice(1)}`,"suggestIndexName"),P=r(a=>new Set(a.indexes.filter(t=>t.kind==="index").map(t=>t.fields[0]).filter(t=>t!==void 0)),"leadingIndexedColumns");var $e={categories:["PERFORMANCE"],description:"A foreign-key column declared by a `one` relation has no index leading with it. Reads that filter or join on the column full-scan the table, which gets linearly slower as rows accumulate.",facing:"EXTERNAL",level:"INFO",name:"unindexed_foreign_key",remediation:'Add a secondary index leading with the FK column, e.g. `.index("byAuthorId", ["authorId"])`.',run:r(a=>{let t=[];for(let e of a.schema.tables){let n=P(e);for(let i of e.relations){if(i.kind!=="one")continue;let o=i.field;if(o==="_id"||n.has(o))continue;let s=K(o);t.push(l($e,{cacheKey:`unindexed_foreign_key:${e.name}:${o}`,detail:`Relation "${i.name}" on table "${e.name}" references "${i.table}" via column "${o}", which is not the leading column of any index. Reads filtering or joining on "${o}" full-scan "${e.name}".`,metadata:{fkColumn:o,references:{column:i.references,table:i.table},relation:i.name,suggestedIndex:{fields:[o],name:s},table:e.name}}))}}return t},"run"),source:"static",title:"Unindexed foreign key"};var ke={categories:["PERFORMANCE"],description:"A `many` relation's foreign-key column on the target table has no index leading with it. Relation predicates (`some`/`none`/`every`) and `with:` child reads filter the target on that column, full-scanning it as rows accumulate.",facing:"EXTERNAL",level:"INFO",name:"unindexed_relation_target",remediation:'Add a secondary index on the target table leading with the FK column, e.g. `.index("byAuthorId", ["authorId"])`.',run:r(a=>{let t=[],e=new Map(a.schema.tables.map(n=>[n.name,n]));for(let n of a.schema.tables)for(let i of n.relations){if(i.kind!=="many")continue;let o=e.get(i.table);if(o===void 0)continue;let s=i.field;if(s==="_id"||o.relations.some(u=>u.kind==="one"&&u.field===s)||P(o).has(s))continue;let d=K(s);t.push(l(ke,{cacheKey:`unindexed_relation_target:${i.table}:${s}`,detail:`Relation "${i.name}" on table "${n.name}" is a to-many over "${i.table}" via its column "${s}", which is not the leading column of any index on "${i.table}". Relation predicates (\`some\`/\`none\`/\`every\`) and \`with:\` reads of "${i.name}" full-scan "${i.table}".`,metadata:{fkColumn:s,references:{column:i.references,table:n.name},relation:i.name,suggestedIndex:{fields:[s],name:d},table:i.table}}))}return t},"run"),source:"static",title:"Unindexed relation target"};var Ae={categories:["SECURITY"],description:"A public `mutation`/`action` that creates a user/session or sends mail has no CAPTCHA / bot check. Account-creating and mail-sending endpoints are prime automated-abuse targets (credential stuffing, mailbox flooding, disposable-account farming).",facing:"EXTERNAL",level:"WARN",name:"user_creating_mutation_without_captcha",remediation:"Add a server-verified human check: `.use(verifyTurnstile({ secret, token }))` from `@lunora/auth`, or wrap it with `.use(protectPublic({ rateLimit, captcha }))` from `@lunora/server`. Pair with a rate limit for defense in depth.",run:r(a=>{if(a.procedureProtections===void 0)return[];let t=[];for(let e of a.procedureProtections){let n=e.visibility==="public"&&(e.kind==="mutation"||e.kind==="action"),i=e.writesUserTable||e.callsMail;if(!n||!i||e.usesCaptcha)continue;let o=e.writesUserTable?"writes a user/session table":"sends mail";t.push(l(Ae,{cacheKey:`user_creating_mutation_without_captcha:${e.file}:${e.exportName}`,detail:`Public ${e.kind} \`${e.exportName}\` (${e.file}) ${o} but has no CAPTCHA check. Add \`.use(verifyTurnstile(...))\` or \`.use(protectPublic({ captcha }))\`.`,metadata:{callsMail:e.callsMail,exportName:e.exportName,file:e.file,kind:e.kind,writesUserTable:e.writesUserTable}}))}return t},"run"),source:"static",title:"Account-creating / mail-sending write without a CAPTCHA"};var Ne={categories:["SCHEMA"],description:"Two durable steps in this workflow share a name. Cloudflare memoizes a step by its name, so on replay the second call returns the first step's cached result instead of running its body \u2014 silently skipping the work without an error.",facing:"INTERNAL",level:"ERROR",name:"workflow_duplicate_step_name",remediation:"Give every `step.do` / `step.sleep` / `step.sleepUntil` / `step.waitForEvent` call in the workflow a unique name. If a step legitimately repeats (e.g. a loop), make the name distinct per iteration by interpolating the item id into the step name.",run:r(a=>{if(a.workflows===void 0)return[];let t=[];for(let e of a.workflows){let{steps:n}=e;if(n===void 0||n.length===0)continue;let i=new Map,o=new Set;for(let s of n){let c=i.get(s.name);if(c===void 0){i.set(s.name,s.line);continue}o.has(s.name)||(o.add(s.name),t.push(l(Ne,{cacheKey:`workflow_duplicate_step_name:${e.exportName}:${s.name}`,detail:`Workflow "${e.exportName}" reuses the durable step name "${s.name}" (first at line ${String(c)}, again at line ${String(s.line)}). The second call returns the first's cached result instead of running.`,metadata:{firstLine:c,line:s.line,stepName:s.name,workflow:e.exportName}})))}}return t},"run"),source:"static",title:"Duplicate durable step name in workflow"};var Re={categories:["SCHEMA"],description:'A `ctx.workflows.get("<name>")` call references a workflow that is not declared by any `defineWorkflow` export in `lunora/workflows.ts`. The name is a typo or points at a removed/renamed workflow \u2014 the call throws at runtime.',facing:"INTERNAL",level:"ERROR",name:"workflow_unknown_target",remediation:'Fix the workflow name in the `ctx.workflows.get("\u2026")` call, or add the missing `defineWorkflow` export to `lunora/workflows.ts`.',run:r(a=>{if(a.workflows===void 0||a.workflowCalls===void 0)return[];let t=new Set(a.workflows.map(n=>n.exportName)),e=[];for(let n of a.workflowCalls)n.workflow===""||t.has(n.workflow)||e.push(l(Re,{cacheKey:`workflow_unknown_target:${n.file}:${n.exportName}:${n.workflow}`,detail:`\`ctx.workflows.get("${n.workflow}")\` in "${n.exportName}" (${n.file}) references workflow "${n.workflow}", which is not declared in lunora/workflows.ts.`,metadata:{exportName:n.exportName,file:n.file,line:n.line,workflow:n.workflow}}));return e},"run"),source:"static",title:"Workflow call references unknown workflow"};var Se={categories:["SCHEMA"],description:'No function starts this workflow via `ctx.workflows.get("<name>")`. It may be triggered through a path the advisor can\'t see (the Cloudflare API, a wrangler invocation, a cross-service binding) \u2014 or it may be dead code that still deploys as a billable WorkflowEntrypoint.',facing:"INTERNAL",level:"INFO",name:"workflow_unused",remediation:'If the workflow should be triggered in-app, start it from a mutation/action with `ctx.workflows.get("<name>").create({ params })`. If it is started externally or is no longer needed, this advisory can be ignored (or remove the `defineWorkflow` export).',run:r(a=>{if(a.workflows===void 0)return[];let t=a.workflowCalls??[];if(t.some(i=>i.workflow===""))return[];let e=new Set(t.map(i=>i.workflow)),n=[];for(let i of a.workflows)e.has(i.exportName)||n.push(l(Se,{cacheKey:`workflow_unused:${i.exportName}`,detail:`No function calls \`ctx.workflows.get("${i.exportName}")\` \u2014 workflow "${i.exportName}" is declared but never started in app code.`,metadata:{workflow:i.exportName}}));return n},"run"),source:"static",title:"Workflow is never started"};var vt=[oe,he,fe,Re,Ne,be,te,G,$e,ke,ee,ve,Se,ne,ge,se,le,ie,me,V,ce,pe,re,J,Z,ue,Ae,de,ye,ae,we,Y],_e=[Q,M,B],yt=[...vt,..._e],je=r((a,t={})=>{let e=t.lints??yt,n=[];for(let i of e)t.source!==void 0&&i.source!==t.source||n.push(...i.run(a));return n},"runAdvisor");var xt=r(a=>{let{suggestedIndex:t,table:e}=a;return!(typeof e!="string"||e.length===0||typeof t!="object"||t===null||!Array.isArray(t.fields)||t.fields.length===0)},"hasIndexMetadata"),$t=r((a,t,e)=>{let n=`"${a}"`,i=`"${t}"`,o=e.map(s=>`"${s}"`).join(", ");return`CREATE INDEX IF NOT EXISTS ${i} ON ${n} (${o});`},"composeCreateIndex"),kt=r(a=>{let t=(0,Ee.c)(19),{fields:e,indexName:n,table:i,testId:o}=a,s=I(),[c,d]=(0,y.useState)(!1),u;t[0]!==e||t[1]!==n||t[2]!==i?(u=r(()=>{let x="navigator"in globalThis?globalThis.navigator.clipboard:void 0;if(x===void 0)return;let w=$t(i,n,e);T(x.writeText(w)),d(!0)},"t1"),t[0]=e,t[1]=n,t[2]=i,t[3]=u):u=t[3];let g=u;if(c){let x=`${o}-applied`,w;t[4]!==s?(w=s("CREATE INDEX SQL copied to clipboard."),t[4]=s,t[5]=w):w=t[5];let R;return t[6]!==x||t[7]!==w?(R=(0,A.jsxDEV)("span",{className:"text-xs text-muted-foreground","data-testid":x,children:w},void 0,!1),t[6]=x,t[7]=w,t[8]=R):R=t[8],R}let m;t[9]!==s?(m=s("Apply?"),t[9]=s,t[10]=m):m=t[10];let h;t[11]!==s||t[12]!==i?(h=s("Apply index on {table}",{table:i}),t[11]=s,t[12]=i,t[13]=h):h=t[13];let v;return t[14]!==g||t[15]!==m||t[16]!==h||t[17]!==o?(v=(0,A.jsxDEV)(De,{confirmLabel:m,onConfirm:g,testId:o,children:h},void 0,!1),t[14]=g,t[15]=m,t[16]=h,t[17]=o,t[18]=v):v=t[18],v},"ApplyIndexButton"),At=r((a,t)=>{let e=new Map;for(let n of t){let i=`${n.table} ${n.index}`;e.set(i,(e.get(i)??0)+n.reads)}return a.map(n=>({index:n.index,reads:e.get(`${n.table} ${n.index}`)??0,table:n.table}))},"reconcileIndexHits"),Nt=r(a=>{let t=new Map;for(let e of a)for(let n of e.scannedTables??[])t.set(n.table,(t.get(n.table)??0)+n.scans);return[...t].map(([e,n])=>({scans:n,table:e}))},"aggregateTableScans"),Rt=r((a,t)=>t.map(e=>({index:e.name,table:a})),"declaredIndexesFor"),St=r(a=>{let t=At(a.declaredIndexes??[],a.indexHits??[]),e=Nt(a.functions??[]),n=a.shardTraffic??[],i=a.analyticsMetrics,o=i&&i.indexHits.length>0?i.indexHits:t,s=i&&i.tableScans.length>0?i.tableScans:e,c=i&&i.shardTraffic.length>0?i.shardTraffic:n,d=je({indexHits:o,schema:{tables:[]},shardTraffic:c,tableScans:s},{lints:_e,source:"runtime"}),u=a.suppressHotScanTables;return(u===void 0?d:d.filter(m=>!(m.metadata.kind==="hot_scan"&&typeof m.metadata.table=="string"&&u.has(m.metadata.table)))).map(m=>D(m))},"deriveRuntimeAdvisories"),_t=H(S.listTables),Tt=H(S.listTableIndexes),Te=r(a=>`${(a*100).toFixed(1)}%`,"percent"),ze=r(a=>`${(a/1e3).toFixed(2)}s`,"seconds"),Et=r(a=>{if(a.length<=1)return a[0]??"";let t=a[a.length-1]??"";return`${a.slice(0,-1).join(", ")} and ${t}`},"tableList"),It=r((a,t)=>({"high-error-rate":a("High error rate"),"high-evictions":a("High cache eviction rate"),"high-write-contention":a("High write contention"),"low-cache-hit-rate":a("Low cache hit rate"),"missing-index":a("Missing index"),"slow-function":a("Slow function")})[t.kind],"insightTitle"),Xe=r((a,t)=>({"high-error-rate":a("{rate} of calls failed.",{rate:Te(t.value)}),"high-evictions":a("{count} entries evicted recently.",{count:t.value}),"high-write-contention":a("{rate} of calls hit a write conflict \u2014 consider sharding to cut contention.",{rate:Te(t.value)}),"low-cache-hit-rate":a("{rate} hit rate over recent traffic.",{rate:Te(t.value)}),"missing-index":a("Slowest call took {duration} \u2014 it full-scanned {tables} with no index.",{duration:ze(t.value),tables:Et(t.tables??[])}),"slow-function":a("Slowest call took {duration}.",{duration:ze(t.value)})})[t.kind],"insightDetail"),Ct=r(a=>{let t=(0,Ee.c)(10),{onJump:e,table:n}=a,i=I(),o;t[0]!==e||t[1]!==n?(o=r(()=>{e(n)},"t1"),t[0]=e,t[1]=n,t[2]=o):o=t[2];let s=o,c=`in-add-index-${n}`,d;t[3]!==i||t[4]!==n?(d=i("Add index on {table}",{table:n}),t[3]=i,t[4]=n,t[5]=d):d=t[5];let u;return t[6]!==s||t[7]!==c||t[8]!==d?(u=(0,A.jsxDEV)(Pe,{"data-testid":c,onClick:s,size:"sm",type:"button",variant:"outline",children:d},void 0,!1),t[6]=s,t[7]=c,t[8]=d,t[9]=u):u=t[9],u},"AddIndexButton"),Oi=r(({initialShardKey:a,loadShardTraffic:t})=>{let e=qe(),n=Ke(),i=I(),[o,s]=(0,y.useState)(a??""),[c,d]=(0,y.useState)(null),[u,g]=(0,y.useState)(null),m=He(o.trim(),400),h=(0,y.useRef)(""),v=C(S.getMetrics,{},{live:!0,shardKey:m}),x=C(S.getFunctionStats,{},{live:!0,shardKey:m}),w=C(S.getAdvisories,{},{live:!0,shardKey:m}),R=v.data??null,Ie=x.data?.functions??null,Ce=w.data?.advisories??null,Be=v.data?.indexHits??null,Qe=v.error!==null&&x.error!==null?v.error:null,Ye=t??(f=>e.shardTraffic(f)),Ve=r(async(f,k)=>{let N=f[0];if(N===void 0||N===""){h.current===k&&g(null);return}try{let p=await Ye(N);if(h.current!==k)return;let $=new Map;for(let b of p.shards)$.has(b.shardKey)||$.set(b.shardKey,{requests:b.requests,shardKey:b.shardKey});g([...$.values()])}catch{h.current===k&&g(null)}},"loadShardTrafficFeed"),E=(0,y.useCallback)(async f=>{h.current=f;let k=[];try{let N=await e.query(_t,{},W(f));if(h.current!==f)return;Oe(f),k=N.map(b=>b.name);let p=await Promise.allSettled(N.map(async b=>[b.name,await e.query(Tt,{table:b.name},W(f))]));if(h.current!==f)return;let $=[];for(let b of p)if(b.status==="fulfilled"){let[_,O]=b.value;$.push(...Rt(_,O.indexes))}d($)}catch{h.current===f&&d(null)}await Ve(k,f)},[e]);(0,y.useEffect)(()=>{T(E(m))},[m,E]),(0,y.useEffect)(()=>{let f=r(()=>{document.visibilityState==="visible"&&(v.refetch(),x.refetch(),w.refetch(),T(E(m)))},"onVisible");return document.addEventListener("visibilitychange",f),()=>{document.removeEventListener("visibilitychange",f)}},[w,m,E,x,v]);let Le=(0,y.useCallback)(f=>{T(n({search:{table:f},to:"/schema"}))},[n]),F=Fe(R,Ie),Ge=new Set(F.filter(f=>f.kind==="missing-index").flatMap(f=>f.tables??[])),Me=St({declaredIndexes:c??[],functions:Ie,indexHits:Be,shardTraffic:u,suppressHotScanTables:Ge}),Je=(0,y.useMemo)(()=>{let f=F.map(p=>{let $=p.kind==="missing-index"?p.tables??[]:[];return{action:$.length>0?$.map(b=>(0,A.jsxDEV)(Ct,{onJump:Le,table:b},b,!1)):void 0,description:p.message===void 0?Xe(i,p):`${Xe(i,p)} \u2014 ${p.message}`,entity:p.fn,issueType:It(i,p),key:`${p.kind}:${p.fn??""}`,level:p.severity}}),k=new Set(["unindexed_foreign_key","unindexed_relation_target"]);return[...(Ce??[]).map(p=>{let $=D(p);if(k.has(p.name)&&xt(p.metadata)){let{table:b,suggestedIndex:_}=p.metadata,O=`in-apply-index-${b}-${_.name}`;return{...$,action:(0,A.jsxDEV)(kt,{fields:_.fields,indexName:_.name,table:b,testId:O},void 0,!1)}}return $}),...Me,...f]},[Ce,F,Le,Me,i]);return(0,A.jsxDEV)(We,{error:Qe,rows:Je,testId:"lunora-insights",toolbar:(0,A.jsxDEV)(Ue,{onChange:s,testId:"in-shard-input",value:o},void 0,!1)},void 0,!1)},"InsightsPanel");export{Oi as InsightsPanel};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";import{a as Ue,b as Lt,c as Ce,f as ut}from"./chunk-DWDILV2E.js";import{a as ft}from"./chunk-UGMRUEBU.js";import{a as It}from"./chunk-J6J54MBP.js";import{a as Ht,b as $e}from"./chunk-5OIBXYZM.js";import{C as ye,R as Xt,e as Tt,i as Mt,p as De,q as Yt}from"./chunk-BHTPZS7L.js";import{c as Ne}from"./chunk-YQQJ4N6U.js";import{a as ve,c as xe}from"./chunk-TICVNLPM.js";import"./chunk-HV7G6DFP.js";import{a as Fe}from"./chunk-AQGOX5DK.js";import{a as Pt}from"./chunk-TAD43CG5.js";import{b as zt}from"./chunk-FCR3HKFV.js";import{b as Ot}from"./chunk-O4PXDNR3.js";import{j as G}from"./chunk-ZH7UES4T.js";import{f as Ct}from"./chunk-KODWGUAB.js";import{a as lt}from"./chunk-3OA7PECS.js";import{d as At,e as st,f as at,g as it,i as ct,j as Wt,l as dt}from"./chunk-YJGANMU7.js";import{a as r,d as er,e as L,f as te,g as tr,h as rr,j as ke}from"./chunk-RRCPZMC2.js";var ae=L(te(),1);var Zt=L(tr(),1);var ue={};er(ue,{Content:()=>xt,Corner:()=>St,Root:()=>ht,Scrollbar:()=>vt,Thumb:()=>gt,Viewport:()=>pt});var c=L(te(),1);var je=L(te(),1);var Be=je.createContext(void 0);Be.displayName="ScrollAreaRootContext";function re(){let e=je.useContext(Be);if(e===void 0)throw new Error("Base UI: ScrollAreaRootContext is missing. ScrollArea parts must be placed within <ScrollArea.Root>.");return e}r(re,"useScrollAreaRootContext");var Ae=(function(e){return e.scrollAreaCornerHeight="--scroll-area-corner-height",e.scrollAreaCornerWidth="--scroll-area-corner-width",e})({});function V(e,t,n){if(!e)return 0;let C=getComputedStyle(e),M=n==="x"?"Inline":"Block";return n==="x"&&t==="margin"?parseFloat(C[`${t}InlineStart`])*2:parseFloat(C[`${t}${M}Start`])+parseFloat(C[`${t}${M}End`])}r(V,"getOffset");var Vt=(function(e){return e.orientation="data-orientation",e.hovering="data-hovering",e.scrolling="data-scrolling",e.hasOverflowX="data-has-overflow-x",e.hasOverflowY="data-has-overflow-y",e.overflowXStart="data-overflow-x-start",e.overflowXEnd="data-overflow-x-end",e.overflowYStart="data-overflow-y-start",e.overflowYEnd="data-overflow-y-end",e})({});var ge=(function(e){return e.scrolling="data-scrolling",e.hasOverflowX="data-has-overflow-x",e.hasOverflowY="data-has-overflow-y",e.overflowXStart="data-overflow-x-start",e.overflowXEnd="data-overflow-x-end",e.overflowYStart="data-overflow-y-start",e.overflowYEnd="data-overflow-y-end",e})({});var de={hasOverflowX:r(e=>e?{[ge.hasOverflowX]:""}:null,"hasOverflowX"),hasOverflowY:r(e=>e?{[ge.hasOverflowY]:""}:null,"hasOverflowY"),overflowXStart:r(e=>e?{[ge.overflowXStart]:""}:null,"overflowXStart"),overflowXEnd:r(e=>e?{[ge.overflowXEnd]:""}:null,"overflowXEnd"),overflowYStart:r(e=>e?{[ge.overflowYStart]:""}:null,"overflowYStart"),overflowYEnd:r(e=>e?{[ge.overflowYEnd]:""}:null,"overflowYEnd"),cornerHidden:r(()=>null,"cornerHidden")};var kt=L(lt(),1);var or={x:0,y:0},_t={width:0,height:0},nr={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},lr={x:!0,y:!0,corner:!0},ht=c.forwardRef(r(function(t,n){let{render:C,className:M,overflowEdgeThreshold:d,style:w,...u}=t,{xStart:g,xEnd:y,yStart:Y,yEnd:P}=sr(d),z=Tt(),A=ye(),N=ye(),{nonce:R,disableStyleElements:S}=Lt(),[O,b]=c.useState(!1),[D,_]=c.useState(!1),[I,$]=c.useState(!1),[F,k]=c.useState(!1),[U,h]=c.useState(!1),[X,oe]=c.useState(_t),[Q,l]=c.useState(_t),[f,B]=c.useState(nr),[i,ne]=c.useState(lr),J=c.useRef(null),x=c.useRef(null),T=c.useRef(null),s=c.useRef(null),m=c.useRef(null),p=c.useRef(null),E=c.useRef(null),H=c.useRef(!1),q=c.useRef(0),K=c.useRef(0),W=c.useRef(0),ie=c.useRef(0),j=c.useRef("vertical"),Se=c.useRef(or),be=xe(a=>{let le=a.x-Se.current.x,Xe=a.y-Se.current.y;Se.current=a,Xe!==0&&($(!0),A.start(500,()=>{$(!1)})),le!==0&&(_(!0),N.start(500,()=>{_(!1)}))}),ce=xe(a=>{a.button===0&&(H.current=!0,q.current=a.clientY,K.current=a.clientX,j.current=a.currentTarget.getAttribute(Vt.orientation),x.current&&(W.current=x.current.scrollTop,ie.current=x.current.scrollLeft),m.current&&j.current==="vertical"&&m.current.setPointerCapture(a.pointerId),p.current&&j.current==="horizontal"&&p.current.setPointerCapture(a.pointerId))}),Le=xe(a=>{if(!H.current)return;let le=a.clientY-q.current,Xe=a.clientX-K.current;if(x.current){let He=x.current.scrollHeight,Ve=x.current.clientHeight,et=x.current.scrollWidth,tt=x.current.clientWidth;if(m.current&&T.current&&j.current==="vertical"){let me=V(T.current,"padding","y"),he=V(m.current,"margin","y"),Ee=m.current.offsetHeight,Pe=T.current.offsetHeight-Ee-me-he,We=le/Pe;x.current.scrollTop=W.current+We*(He-Ve),a.preventDefault(),$(!0),A.start(500,()=>{$(!1)})}if(p.current&&s.current&&j.current==="horizontal"){let me=V(s.current,"padding","x"),he=V(p.current,"margin","x"),Ee=p.current.offsetWidth,Pe=s.current.offsetWidth-Ee-me-he,We=Xe/Pe;x.current.scrollLeft=ie.current+We*(et-tt),a.preventDefault(),_(!0),N.start(500,()=>{_(!1)})}}}),we=xe(a=>{H.current=!1,m.current&&j.current==="vertical"&&m.current.hasPointerCapture(a.pointerId)&&m.current.releasePointerCapture(a.pointerId),p.current&&j.current==="horizontal"&&p.current.hasPointerCapture(a.pointerId)&&p.current.releasePointerCapture(a.pointerId)});function Z(a){k(a.pointerType==="touch")}r(Z,"handleTouchModalityChange");function ee(a){if(Z(a),a.pointerType!=="touch"){let le=De(J.current,a.target);b(le)}}r(ee,"handlePointerEnterOrMove");let Me=c.useMemo(()=>({scrolling:D||I,hasOverflowX:!i.x,hasOverflowY:!i.y,overflowXStart:f.xStart,overflowXEnd:f.xEnd,overflowYStart:f.yStart,overflowYEnd:f.yEnd,cornerHidden:i.corner}),[D,I,i.x,i.y,i.corner,f]),Je={role:"presentation",onPointerEnter:ee,onPointerMove:ee,onPointerDown:Z,onPointerLeave(){b(!1)},style:{position:"relative",[Ae.scrollAreaCornerHeight]:`${X.height}px`,[Ae.scrollAreaCornerWidth]:`${X.width}px`}},Re=G("div",t,{state:Me,ref:[n,J],props:[Je,u],stateAttributesMapping:de}),Ye=c.useMemo(()=>({handlePointerDown:ce,handlePointerMove:Le,handlePointerUp:we,handleScroll:be,cornerSize:X,setCornerSize:oe,thumbSize:Q,setThumbSize:l,hasMeasuredScrollbar:U,setHasMeasuredScrollbar:h,touchModality:F,cornerRef:E,scrollingX:D,setScrollingX:_,scrollingY:I,setScrollingY:$,hovering:O,setHovering:b,viewportRef:x,rootRef:J,scrollbarYRef:T,scrollbarXRef:s,thumbYRef:m,thumbXRef:p,rootId:z,hiddenState:i,setHiddenState:ne,overflowEdges:f,setOverflowEdges:B,viewportState:Me,overflowEdgeThreshold:{xStart:g,xEnd:y,yStart:Y,yEnd:P}}),[ce,Le,we,be,X,Q,U,F,D,_,I,$,O,b,z,i,f,Me,g,y,Y,P]);return(0,kt.jsxs)(Be.Provider,{value:Ye,children:[!S&&Ue.getElement(R),Re]})},"ScrollAreaRoot"));ht.displayName="ScrollAreaRoot";function sr(e){if(typeof e=="number"){let t=Math.max(0,e);return{xStart:t,xEnd:t,yStart:t,yEnd:t}}return{xStart:Math.max(0,e?.xStart||0),xEnd:Math.max(0,e?.xEnd||0),yStart:Math.max(0,e?.yStart||0),yEnd:Math.max(0,e?.yEnd||0)}}r(sr,"normalizeOverflowEdgeThreshold");var fe=L(te(),1);var qe=L(te(),1);var Ke=qe.createContext(void 0);Ke.displayName="ScrollAreaViewportContext";function Dt(){let e=qe.useContext(Ke);if(e===void 0)throw new Error("Base UI: ScrollAreaViewportContext missing. ScrollAreaViewport parts must be placed within <ScrollArea.Viewport>.");return e}r(Dt,"useScrollAreaViewportContext");var se=(function(e){return e.scrollAreaOverflowXStart="--scroll-area-overflow-x-start",e.scrollAreaOverflowXEnd="--scroll-area-overflow-x-end",e.scrollAreaOverflowYStart="--scroll-area-overflow-y-start",e.scrollAreaOverflowYEnd="--scroll-area-overflow-y-end",e})({});var Ft=L(lt(),1);var $t=!1;function ir(){$t||Mt.engine.webkit||(typeof CSS<"u"&&"registerProperty"in CSS&&[se.scrollAreaOverflowXStart,se.scrollAreaOverflowXEnd,se.scrollAreaOverflowYStart,se.scrollAreaOverflowYEnd].forEach(e=>{try{CSS.registerProperty({name:e,syntax:"<length>",inherits:!1,initialValue:"0px"})}catch{}}),$t=!0)}r(ir,"removeCSSVariableInheritance");var pt=fe.forwardRef(r(function(t,n){let{render:C,className:M,style:d,...w}=t,{viewportRef:u,scrollbarYRef:g,scrollbarXRef:y,thumbYRef:Y,thumbXRef:P,cornerRef:z,cornerSize:A,setCornerSize:N,setThumbSize:R,rootId:S,setHiddenState:O,hiddenState:b,setHasMeasuredScrollbar:D,handleScroll:_,setHovering:I,setOverflowEdges:$,overflowEdges:F,overflowEdgeThreshold:k,scrollingX:U,scrollingY:h}=re(),X=$e(),oe=fe.useRef(!0),Q=fe.useRef([NaN,NaN,NaN,NaN]),l=ye(),f=ye(),B=xe(()=>{let s=u.current,m=g.current,p=y.current,E=Y.current,H=P.current,q=z.current;if(!s)return;let K=s.scrollHeight,W=s.scrollWidth,ie=s.clientHeight,j=s.clientWidth,Se=s.scrollTop,be=s.scrollLeft,ce=Q.current,Le=Number.isNaN(ce[0]);if(ce[0]=ie,ce[1]=K,ce[2]=j,ce[3]=W,Le&&D(!0),K===0||W===0)return;let we=cr(s),Z=we.y,ee=we.x,Me=j/W,Je=ie/K,Re=Math.max(0,W-j),Ye=Math.max(0,K-ie),a=0,le=0;if(!ee){let v=0;X==="rtl"?v=Ce(-be,0,Re):v=Ce(be,0,Re),a=ut(v,Re),le=Re-a}let Xe=Z?0:Ce(Se,0,Ye),He=Z?0:ut(Xe,Ye),Ve=Z?0:Ye-He,et=ee?0:j,tt=Z?0:ie,me=0,he=0;!ee&&!Z&&(me=m?.offsetWidth||0,he=p?.offsetHeight||0);let Ee=A.width===0&&A.height===0,Pe=Ee?me:0,We=Ee?he:0,bt=V(p,"padding","x"),wt=V(m,"padding","y"),Rt=V(H,"margin","x"),Et=V(E,"margin","y"),yt=et-bt-Rt,Nt=tt-wt-Et,Gt=p?Math.min(p.offsetWidth-Pe,yt):yt,Qt=m?Math.min(m.offsetHeight-We,Nt):Nt,rt=Math.max(16,Gt*Me),ot=Math.max(16,Qt*Je);if(R(v=>v.height===ot&&v.width===rt?v:{width:rt,height:ot}),m&&E){let v=m.offsetHeight-ot-wt-Et,pe=K-ie,_e=pe===0?0:Se/pe,nt=Math.min(v,Math.max(0,_e*v));E.style.transform=`translate3d(0,${nt}px,0)`}if(p&&H){let v=p.offsetWidth-rt-bt-Rt,pe=W-j,_e=pe===0?0:be/pe,nt=X==="rtl"?Ce(_e*v,-v,0):Ce(_e*v,0,v);H.style.transform=`translate3d(${nt}px,0,0)`}let Jt=[[se.scrollAreaOverflowXStart,a],[se.scrollAreaOverflowXEnd,le],[se.scrollAreaOverflowYStart,He],[se.scrollAreaOverflowYEnd,Ve]];for(let[v,pe]of Jt)s.style.setProperty(v,`${pe}px`);q&&(ee||Z?N({width:0,height:0}):!ee&&!Z&&N({width:me,height:he})),O(v=>dr(v,we));let ze={xStart:!ee&&a>k.xStart,xEnd:!ee&&le>k.xEnd,yStart:!Z&&He>k.yStart,yEnd:!Z&&Ve>k.yEnd};$(v=>v.xStart===ze.xStart&&v.xEnd===ze.xEnd&&v.yStart===ze.yStart&&v.yEnd===ze.yEnd?v:ze)});ve(()=>{u.current&&ir()},[u]),ve(()=>{queueMicrotask(B)},[B,b,X,k.xStart,k.xEnd,k.yStart,k.yEnd]),ve(()=>{u.current?.matches(":hover")&&I(!0)},[u,I]),ve(()=>{let s=u.current;if(typeof ResizeObserver>"u"||!s)return;let m=!1,p=new ResizeObserver(()=>{if(!m){m=!0;let E=Q.current;if(E[0]===s.clientHeight&&E[1]===s.scrollHeight&&E[2]===s.clientWidth&&E[3]===s.scrollWidth)return}B()});return p.observe(s),f.start(0,()=>{let E=s.getAnimations({subtree:!0});E.length!==0&&Promise.allSettled(E.map(H=>H.finished)).then(B).catch(()=>{})}),()=>{p.disconnect(),f.clear()}},[B,u,f]);function i(){oe.current=!1}r(i,"handleUserInteraction");let ne={role:"presentation",...S&&{"data-id":`${S}-viewport`},tabIndex:b.x&&b.y?-1:0,className:Ue.className,style:{overflow:"scroll"},onScroll(){u.current&&(B(),oe.current||_({x:u.current.scrollLeft,y:u.current.scrollTop}),l.start(100,()=>{oe.current=!0}))},onWheel:i,onTouchMove:i,onPointerMove:i,onPointerEnter:i,onKeyDown:i},J=fe.useMemo(()=>({scrolling:U||h,hasOverflowX:!b.x,hasOverflowY:!b.y,overflowXStart:F.xStart,overflowXEnd:F.xEnd,overflowYStart:F.yStart,overflowYEnd:F.yEnd,cornerHidden:b.corner}),[U,h,b.x,b.y,b.corner,F]),x=G("div",t,{ref:[n,u],state:J,props:[ne,w],stateAttributesMapping:de}),T=fe.useMemo(()=>({computeThumbPosition:B}),[B]);return(0,Ft.jsx)(Ke.Provider,{value:T,children:x})},"ScrollAreaViewport"));pt.displayName="ScrollAreaViewport";function cr(e){let t=e.clientHeight>=e.scrollHeight,n=e.clientWidth>=e.scrollWidth;return{y:t,x:n,corner:t||n}}r(cr,"getHiddenState");function dr(e,t){return e.y===t.y&&e.x===t.x&&e.corner===t.corner?e:t}r(dr,"mergeHiddenState");var Te=L(te(),1);var Ze=L(te(),1);var Ge=Ze.createContext(void 0);Ge.displayName="ScrollAreaScrollbarContext";function Ut(){let e=Ze.useContext(Ge);if(e===void 0)throw new Error("Base UI: ScrollAreaScrollbarContext is missing. ScrollAreaScrollbar parts must be placed within <ScrollArea.Scrollbar>.");return e}r(Ut,"useScrollAreaScrollbarContext");var Oe=(function(e){return e.scrollAreaThumbHeight="--scroll-area-thumb-height",e.scrollAreaThumbWidth="--scroll-area-thumb-width",e})({});var jt=L(lt(),1);var vt=Te.forwardRef(r(function(t,n){let{render:C,className:M,orientation:d="vertical",keepMounted:w=!1,style:u,...g}=t,{hovering:y,scrollingX:Y,scrollingY:P,hiddenState:z,overflowEdges:A,scrollbarYRef:N,scrollbarXRef:R,viewportRef:S,thumbYRef:O,thumbXRef:b,handlePointerDown:D,handlePointerUp:_,handleScroll:I,rootId:$,thumbSize:F,hasMeasuredScrollbar:k}=re(),U={hovering:y,scrolling:{horizontal:Y,vertical:P}[d],orientation:d,hasOverflowX:!z.x,hasOverflowY:!z.y,overflowXStart:A.xStart,overflowXEnd:A.xEnd,overflowYStart:A.yStart,overflowYEnd:A.yEnd,cornerHidden:z.corner},h=$e(),X=!k&&!w,oe=d==="vertical"?z.y:z.x,Q=w||!oe;Te.useEffect(()=>{if(!Q)return;let i=S.current,ne=d==="vertical"?N.current:R.current;if(!ne)return;function J(x){if(!i||!ne||x.ctrlKey)return;let T=d==="horizontal",s=T?"scrollLeft":"scrollTop",m=T?x.deltaX:x.deltaY;if(m===0)return;let p=T?i.scrollWidth-i.clientWidth:i.scrollHeight-i.clientHeight,E=T&&h==="rtl"?-p:0,H=T&&h==="rtl"?0:p,q=i[s];q<=E&&m<0||q>=H&&m>0||(x.preventDefault(),i[s]=Math.min(H,Math.max(E,q+m)),I({x:i.scrollLeft,y:i.scrollTop}))}return r(J,"handleWheel"),Ht(ne,"wheel",J,{passive:!1})},[h,I,d,R,N,Q,S]);let l={...$&&{"data-id":`${$}-scrollbar`},onPointerDown(i){if(i.button!==0)return;let ne=Yt(i.nativeEvent),J=d==="vertical"?O.current:b.current;if(!(J&&De(J,ne))&&S.current){if(O.current&&N.current&&d==="vertical"){let x=V(O.current,"margin","y"),T=V(N.current,"padding","y"),s=O.current.offsetHeight,m=N.current.getBoundingClientRect(),p=i.clientY-m.top-s/2-T+x/2,E=S.current.scrollHeight,H=S.current.clientHeight,q=N.current.offsetHeight-s-T-x,W=p/q*(E-H);S.current.scrollTop=W}if(b.current&&R.current&&d==="horizontal"){let x=V(b.current,"margin","x"),T=V(R.current,"padding","x"),s=b.current.offsetWidth,m=R.current.getBoundingClientRect(),p=i.clientX-m.left-s/2-T+x/2,E=S.current.scrollWidth,H=S.current.clientWidth,q=R.current.offsetWidth-s-T-x,K=p/q,W;h==="rtl"?(W=(1-K)*(E-H),S.current.scrollLeft<=0&&(W=-W)):W=K*(E-H),S.current.scrollLeft=W}I({x:S.current.scrollLeft,y:S.current.scrollTop}),D(i)}},onPointerUp:_,onPointerCancel:_,style:{position:"absolute",touchAction:"none",WebkitUserSelect:"none",userSelect:"none",visibility:X?"hidden":void 0,...d==="vertical"&&{top:0,bottom:`var(${Ae.scrollAreaCornerHeight})`,insetInlineEnd:0,[Oe.scrollAreaThumbHeight]:`${F.height}px`},...d==="horizontal"&&{insetInlineStart:0,insetInlineEnd:`var(${Ae.scrollAreaCornerWidth})`,bottom:0,[Oe.scrollAreaThumbWidth]:`${F.width}px`}}},f=G("div",t,{ref:[n,d==="vertical"?N:R],state:U,props:[l,g],stateAttributesMapping:de}),B=Te.useMemo(()=>({orientation:d}),[d]);return Q?(0,jt.jsx)(Ge.Provider,{value:B,children:f}):null},"ScrollAreaScrollbar"));vt.displayName="ScrollAreaScrollbar";var Ie=L(te(),1);var xt=Ie.forwardRef(r(function(t,n){let{render:C,className:M,style:d,...w}=t,{computeThumbPosition:u}=Dt(),{hasMeasuredScrollbar:g,viewportState:y}=re(),Y=Ie.useRef(null),P=Ie.useRef(g);return ve(()=>{if(typeof ResizeObserver>"u")return;let A=!1,N=new ResizeObserver(()=>{!A&&(A=!0,!P.current)||u()});return Y.current&&N.observe(Y.current),()=>{N.disconnect()}},[u]),G("div",t,{ref:[n,Y],state:y,stateAttributesMapping:de,props:[{role:"presentation",style:{minWidth:"fit-content"}},w]})},"ScrollAreaContent"));xt.displayName="ScrollAreaContent";var Bt=L(te(),1);var gt=Bt.forwardRef(r(function(t,n){let{render:C,className:M,style:d,...w}=t,{thumbYRef:u,thumbXRef:g,handlePointerDown:y,handlePointerMove:Y,handlePointerUp:P,setScrollingX:z,setScrollingY:A,scrollingX:N,scrollingY:R,hasMeasuredScrollbar:S}=re(),{orientation:O}=Ut(),b={scrolling:O==="horizontal"?N:R,orientation:O};function D(I){O==="vertical"&&A(!1),O==="horizontal"&&z(!1),P(I)}return r(D,"endDrag"),G("div",t,{ref:[n,O==="vertical"?u:g],state:b,props:[{onPointerDown:y,onPointerMove:Y,onPointerUp:D,onPointerCancel:D,style:{visibility:S?void 0:"hidden",...O==="vertical"&&{height:`var(${Oe.scrollAreaThumbHeight})`},...O==="horizontal"&&{width:`var(${Oe.scrollAreaThumbWidth})`}}},w]})},"ScrollAreaThumb"));gt.displayName="ScrollAreaThumb";var qt=L(te(),1);var St=qt.forwardRef(r(function(t,n){let{render:C,className:M,style:d,...w}=t,{cornerRef:u,cornerSize:g,hiddenState:y}=re(),Y=G("div",t,{ref:[n,u],props:[{style:{position:"absolute",bottom:0,insetInlineEnd:0,width:g.width,height:g.height}},w]});return y.corner?null:Y},"ScrollAreaCorner"));St.displayName="ScrollAreaCorner";var o=L(rr(),1);function fr({className:e,orientation:t="horizontal",...n}){return(0,o.jsxDEV)(ft,{"data-slot":"separator",orientation:t,className:ke("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",e),...n},void 0,!1)}r(fr,"Separator");function ur(e){let t=(0,Zt.c)(14),n,C,M;t[0]!==e?({className:C,children:n,...M}=e,t[0]=e,t[1]=n,t[2]=C,t[3]=M):(n=t[1],C=t[2],M=t[3]);let d;t[4]!==C?(d=ke("relative",C),t[4]=C,t[5]=d):d=t[5];let w;t[6]!==n?(w=(0,o.jsxDEV)(ue.Viewport,{"data-slot":"scroll-area-viewport",className:"size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1",children:n},void 0,!1),t[6]=n,t[7]=w):w=t[7];let u,g;t[8]===Symbol.for("react.memo_cache_sentinel")?(u=(0,o.jsxDEV)(mr,{},void 0,!1),g=(0,o.jsxDEV)(ue.Corner,{},void 0,!1),t[8]=u,t[9]=g):(u=t[8],g=t[9]);let y;return t[10]!==M||t[11]!==d||t[12]!==w?(y=(0,o.jsxDEV)(ue.Root,{"data-slot":"scroll-area",className:d,...M,children:[w,u,g]},void 0,!0),t[10]=M,t[11]=d,t[12]=w,t[13]=y):y=t[13],y}r(ur,"ScrollArea");function mr({className:e,orientation:t="vertical",...n}){return(0,o.jsxDEV)(ue.Scrollbar,{"data-slot":"scroll-area-scrollbar","data-orientation":t,orientation:t,className:ke("flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-s data-vertical:border-s-transparent",e),...n,children:(0,o.jsxDEV)(ue.Thumb,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-md bg-border"},void 0,!1)},void 0,!1)}r(mr,"ScrollBar");var hr=st(Fe.clearCapturedMail),pr=st(Fe.sendTestMail),vr=/https?:\/\/[^\s"'<>)]+/i,Kt=r(e=>e===void 0?void 0:vr.exec(e)?.[0],"firstLink"),xr=r(e=>{if(e!==void 0)return Kt(e.html)??Kt(e.text)},"selectedLink"),gr=`<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src data:; style-src 'unsafe-inline'; font-src data:">`,Sr=r(e=>`${gr}${e}`,"withPreviewCsp"),Qe=r(e=>e===void 0?"":Array.isArray(e)?e.join(", "):e,"recipientText"),fn=r(({limit:e=100})=>{let t=Ct(),n=At(),{data:C,error:M,isLoading:d,refetch:w}=zt(Fe.getCapturedMail,{limit:e}),[u,g]=(0,ae.useState)(null),[y,Y]=(0,ae.useState)(null),[P,z]=(0,ae.useState)("html"),[A,N]=(0,ae.useState)(""),R=(0,ae.useMemo)(()=>C?.entries??[],[C]),S=M??u,O=r(async()=>{g(null);try{await t.query(hr,{},at("")),Y(null),w()}catch(l){g(it(l))}},"clearInbox"),b=r(async()=>{g(null);try{await t.query(pr,{},at("")),w()}catch(l){g(it(l))}},"sendTest");It(()=>{w()},!0);let D=r(()=>{ct(O())},"onClear"),_=r(()=>{ct(b())},"onSendTest"),I=r(l=>{N(l.currentTarget.value)},"onFilterChange"),$=r(l=>{let{id:f}=l.currentTarget.dataset;f!==void 0&&Y(f)},"onSelectMessage"),F=r(l=>{let f=l.currentTarget.dataset.tab;(f==="headers"||f==="html"||f==="text")&&z(f)},"onSelectTab"),k=r(l=>n(l==="html"?"HTML":l==="text"?"Plain text":"Headers"),"tabTitle"),U=(0,ae.useMemo)(()=>{let l=A.trim().toLowerCase();return l===""?R:R.filter(f=>`${f.subject} ${Qe(f.to)}`.toLowerCase().includes(l))},[R,A]),h=(0,ae.useMemo)(()=>{if(U.length!==0)return U.find(l=>l.id===y)??U[0]},[U,y]),X=xr(h),oe=r(()=>{X!==void 0&&Wt(X)},"onCopyLink"),Q=r(()=>{X!==void 0&&"window"in globalThis&&globalThis.window.open(X,"_blank","noopener")},"onOpenLink");return(0,o.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"mail-panel",children:[(0,o.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,o.jsxDEV)(Ne,{"data-testid":"mail-send-test",onClick:_,size:"sm",type:"button",variant:"outline",children:n("Send test")},void 0,!1),(0,o.jsxDEV)(Ne,{"data-testid":"mail-clear",disabled:R.length===0,onClick:D,size:"sm",type:"button",variant:"outline",children:n("Clear inbox")},void 0,!1),R.length>0&&(0,o.jsxDEV)(Ot,{className:"ml-auto","data-testid":"mail-count",variant:"secondary",children:n("{count} messages",{count:R.length})},void 0,!1)]},void 0,!0),S!==null&&(0,o.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"mail-error",role:"alert",children:S},void 0,!1),S===null&&!d&&R.length===0&&(0,o.jsxDEV)(Pt,{description:n("Email your app sends in dev is captured here \u2014 nothing is delivered."),icon:(0,o.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,o.jsxDEV)("path",{d:"M4 5h16v14H4z"},void 0,!1),(0,o.jsxDEV)("path",{d:"m4 6 8 6 8-6"},void 0,!1)]},void 0,!0),testId:"mail-empty",title:n("No captured email.")},void 0,!1),R.length>0&&(0,o.jsxDEV)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-[minmax(0,22rem)_1fr]","data-testid":"mail-reader",children:[(0,o.jsxDEV)("div",{className:"flex flex-col gap-2",children:[(0,o.jsxDEV)(Xt,{"aria-label":n("Search messages"),"data-testid":"mail-search",onChange:I,placeholder:n("Filter messages"),type:"search",value:A},void 0,!1),(0,o.jsxDEV)(ur,{className:"max-h-[32rem] rounded-xl border border-border bg-card shadow-xs","data-testid":"mail-list",children:(0,o.jsxDEV)("ul",{className:"divide-y",children:U.map(l=>{let f=l.id===h?.id;return(0,o.jsxDEV)("li",{children:(0,o.jsxDEV)("button",{className:`flex w-full flex-col items-start gap-0.5 px-3 py-2 text-left text-sm hover:bg-muted/60 ${f?"bg-muted":""}`,"data-active":f,"data-id":l.id,"data-testid":"mail-list-item",onClick:$,type:"button",children:[(0,o.jsxDEV)("span",{className:"w-full truncate font-medium",children:l.subject||n("(no subject)")},void 0,!1),(0,o.jsxDEV)("span",{className:"w-full truncate text-xs text-muted-foreground",children:Qe(l.to)},void 0,!1),(0,o.jsxDEV)("span",{className:"text-xs text-muted-foreground tabular-nums",children:dt(l.capturedAt,"\u2014")},void 0,!1)]},void 0,!0)},l.id,!1)})},void 0,!1)},void 0,!1)]},void 0,!0),h!==void 0&&(0,o.jsxDEV)("div",{className:"flex min-w-0 flex-col gap-3 rounded-xl border border-border bg-card p-4 shadow-xs","data-testid":"mail-detail",children:[(0,o.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,o.jsxDEV)("h2",{className:"truncate text-base font-semibold","data-testid":"mail-subject",children:h.subject||n("(no subject)")},void 0,!1),(0,o.jsxDEV)("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-xs text-muted-foreground",children:[(0,o.jsxDEV)("dt",{children:n("From")},void 0,!1),(0,o.jsxDEV)("dd",{className:"truncate font-mono",children:h.from??"\u2014"},void 0,!1),(0,o.jsxDEV)("dt",{children:n("To")},void 0,!1),(0,o.jsxDEV)("dd",{className:"truncate font-mono",children:Qe(h.to)},void 0,!1),h.cc!==void 0&&h.cc.length>0&&(0,o.jsxDEV)(o.Fragment,{children:[(0,o.jsxDEV)("dt",{children:n("Cc")},void 0,!1),(0,o.jsxDEV)("dd",{className:"truncate font-mono",children:Qe(h.cc)},void 0,!1)]},void 0,!0),(0,o.jsxDEV)("dt",{children:n("Sent")},void 0,!1),(0,o.jsxDEV)("dd",{className:"tabular-nums",children:dt(h.capturedAt,"\u2014")},void 0,!1)]},void 0,!0)]},void 0,!0),(0,o.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2","data-testid":"mail-actions",children:[(0,o.jsxDEV)(Ne,{"data-testid":"mail-copy-link",disabled:X===void 0,onClick:oe,size:"sm",type:"button",variant:"outline",children:n("Copy link")},void 0,!1),(0,o.jsxDEV)(Ne,{"data-testid":"mail-open-link",disabled:X===void 0,onClick:Q,size:"sm",type:"button",variant:"outline",children:n("Open in new tab")},void 0,!1)]},void 0,!0),(0,o.jsxDEV)(fr,{},void 0,!1),(0,o.jsxDEV)("div",{className:"flex items-center gap-1","data-testid":"mail-tabs",role:"tablist",children:["html","text","headers"].map(l=>(0,o.jsxDEV)(Ne,{"aria-selected":P===l,"data-tab":l,"data-testid":`mail-tab-${l}`,onClick:F,role:"tab",size:"sm",type:"button",variant:P===l?"secondary":"ghost",children:k(l)},l,!1))},void 0,!1),(0,o.jsxDEV)("div",{className:"min-h-[12rem]",children:[P==="html"&&(h.html===void 0?(0,o.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:n("No HTML body.")},void 0,!1):(0,o.jsxDEV)("iframe",{className:"h-[24rem] w-full rounded-md border bg-white","data-testid":"mail-preview-html",sandbox:"",srcDoc:Sr(h.html),title:n("Email preview")},void 0,!1)),P==="text"&&(h.text===void 0?(0,o.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:n("No text body.")},void 0,!1):(0,o.jsxDEV)("pre",{className:"overflow-auto whitespace-pre-wrap rounded-md border bg-muted/30 p-3 text-xs","data-testid":"mail-preview-text",children:h.text},void 0,!1)),P==="headers"&&(h.headers===void 0||Object.keys(h.headers).length===0?(0,o.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:n("No headers.")},void 0,!1):(0,o.jsxDEV)("pre",{className:"overflow-auto whitespace-pre-wrap rounded-md border bg-muted/30 p-3 text-xs","data-testid":"mail-preview-headers",children:Object.entries(h.headers).map(([l,f])=>`${l}: ${f}`).join(`
|
|
2
|
+
`)},void 0,!1))]},void 0,!0)]},void 0,!0)]},void 0,!0)]},void 0,!0)},"MailPanel");export{fn as MailPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as d,b as u}from"./chunk-FQKNJSRA.js";import"./chunk-BJGBHGK3.js";import"./chunk-UII66UVF.js";import"./chunk-KEGAWN6Y.js";import"./chunk-HV7G6DFP.js";import"./chunk-3OA7PECS.js";import{a as c,e as m,g as p,h as v}from"./chunk-RRCPZMC2.js";var h=m(p(),1);var o=m(v(),1);var y={value:{colors:{dark:["var(--foreground)"],light:["var(--foreground)"]},label:""}},g=c(n=>{let e=(0,h.c)(6),{data:i}=n,a,r;if(e[0]!==i){r=Symbol.for("react.early_return_sentinel");e:{let f=i.slice(-16);if(f.length<3){r=null;break e}a=f.map(_)}e[0]=i,e[1]=a,e[2]=r}else a=e[1],r=e[2];if(r!==Symbol.for("react.early_return_sentinel"))return r;let s=a,t;e[3]===Symbol.for("react.memo_cache_sentinel")?(t=(0,o.jsxDEV)(u,{dataKey:"value"},void 0,!1),e[3]=t):t=e[3];let l;return e[4]!==s?(l=(0,o.jsxDEV)("div",{"aria-hidden":"true",className:"h-8 w-28",children:(0,o.jsxDEV)(d,{animationType:"none",barCategoryGap:1,className:"h-8 w-full",config:y,data:s,children:t},void 0,!1)},void 0,!1),e[4]=s,e[5]=l):l=e[5],l},"Sparkline");function _(n,e){return{index:e,value:n}}c(_,"_temp");export{g as Sparkline};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as R}from"./chunk-TQ36RWOP.js";import{R as C}from"./chunk-BHTPZS7L.js";import{c as k}from"./chunk-YQQJ4N6U.js";import"./chunk-TICVNLPM.js";import"./chunk-HV7G6DFP.js";import{a as w,e as N}from"./chunk-SEU5V7I6.js";import"./chunk-ZH7UES4T.js";import"./chunk-3OA7PECS.js";import{d as b,g as S,i as T,j as L}from"./chunk-YJGANMU7.js";import{a as f,e as y,f as W,g as j,h as D}from"./chunk-RRCPZMC2.js";var O=y(j(),1),v=y(W(),1);var t=y(D(),1);var I=f(s=>{let e=(0,O.c)(23),{destination:o}=s,h=b(),m;e[0]!==o.snippet?(m=f(()=>{L(o.snippet)},"t1"),e[0]=o.snippet,e[1]=m):m=e[1];let u=m,r;e[2]!==o.title?(r=(0,t.jsxDEV)("h4",{className:"text-sm font-semibold",children:o.title},void 0,!1),e[2]=o.title,e[3]=r):r=e[3];let a;e[4]!==o.description?(a=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:o.description},void 0,!1),e[4]=o.description,e[5]=a):a=e[5];let l;e[6]!==r||e[7]!==a?(l=(0,t.jsxDEV)("div",{children:[r,a]},void 0,!0),e[6]=r,e[7]=a,e[8]=l):l=e[8];let g=`drain-copy-${o.id}`,d;e[9]!==h?(d=h("Copy"),e[9]=h,e[10]=d):d=e[10];let i;e[11]!==u||e[12]!==g||e[13]!==d?(i=(0,t.jsxDEV)(k,{"data-testid":g,onClick:u,size:"sm",variant:"outline",children:d},void 0,!1),e[11]=u,e[12]=g,e[13]=d,e[14]=i):i=e[14];let n;e[15]!==l||e[16]!==i?(n=(0,t.jsxDEV)("div",{className:"flex items-start justify-between gap-3",children:[l,i]},void 0,!0),e[15]=l,e[16]=i,e[17]=n):n=e[17];let c;e[18]!==o.snippet?(c=(0,t.jsxDEV)("pre",{className:"mt-2 overflow-x-auto rounded bg-muted p-2 font-mono text-xs",children:o.snippet},void 0,!1),e[18]=o.snippet,e[19]=c):c=e[19];let p;return e[20]!==n||e[21]!==c?(p=(0,t.jsxDEV)(w,{className:"py-0","data-testid":"drain-card",children:(0,t.jsxDEV)(N,{className:"p-3",children:[n,c]},void 0,!0)},void 0,!1),e[20]=n,e[21]=c,e[22]=p):p=e[22],p},"DestinationRow"),F=f(()=>{let s=b(),e=[{description:s("Stream every request log to R2, a SIEM, or a third-party log service."),id:"logpush",snippet:["{",' "logpush": true',"}"].join(`
|
|
2
|
+
`),title:s("Logpush")},{description:s("Send logs programmatically to a Worker for custom capture and forwarding."),id:"tail-worker",snippet:["{",' "tail_consumers": [{ "service": "my-log-forwarder" }]',"}"].join(`
|
|
3
|
+
`),title:s("Tail Workers")},{description:s("Retain and query recent request logs directly in Cloudflare's dashboard."),id:"workers-logs",snippet:["{",' "observability": { "enabled": true }',"}"].join(`
|
|
4
|
+
`),title:s("Workers Logs")}],[o,h]=(0,v.useState)(""),[m,u]=(0,v.useState)(!1),[r,a]=(0,v.useState)(null),l=f(async()=>{let i=o.trim();if(i==="")return;let n="fetch"in globalThis?globalThis.fetch:void 0;if(n===void 0){a({kind:"error",message:s("fetch is unavailable in this environment.")});return}let c={durationMs:12,function:"messages:list",outcome:"ok",shard:"root",source:"lunora",tablesRead:["messages"],tablesWritten:[],ts:new Date().toISOString(),type:"request"};u(!0),a(null);let p=performance.now();try{let x=await n(i,{body:JSON.stringify(c),headers:{"Content-Type":"application/json"},method:"POST"});a({kind:"success",latencyMs:Math.round(performance.now()-p),status:x.status})}catch(x){a({kind:"error",message:S(x)})}finally{u(!1)}},"sendTest"),g=f(()=>{T(l())},"onSendTest"),d=f(i=>{h(i.target.value)},"onWebhookUrlChange");return(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"log-drains",children:[(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-3",children:(0,t.jsxDEV)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"drain-cf-link",href:R,rel:"noreferrer",target:"_blank",children:s("Open in Cloudflare")},void 0,!1)},void 0,!1),(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"drain-readonly-note",children:s("Lunora does not ship logs itself \u2014 forwarding is handled by Cloudflare. Configure a destination below, then test your collector.")},void 0,!1),(0,t.jsxDEV)("section",{className:"flex flex-col gap-3","data-testid":"drain-destinations",children:[(0,t.jsxDEV)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Cloudflare destinations")},void 0,!1),e.map(i=>(0,t.jsxDEV)(I,{destination:i},i.id,!1))]},void 0,!0),(0,t.jsxDEV)(w,{className:"py-0",children:(0,t.jsxDEV)(N,{className:"p-3",children:(0,t.jsxDEV)("section",{"data-testid":"drain-webhook",children:[(0,t.jsxDEV)("h3",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Webhook test")},void 0,!1),(0,t.jsxDEV)("p",{className:"mb-2 text-sm text-muted-foreground",children:s("POST a sample Lunora request-log envelope to your collector to confirm it is reachable.")},void 0,!1),(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxDEV)(C,{className:"min-w-[20rem] flex-1","data-testid":"drain-webhook-url",onChange:d,placeholder:s("https://example.com/logs"),type:"url",value:o},void 0,!1),(0,t.jsxDEV)(k,{"data-testid":"drain-webhook-test",disabled:m||o.trim()==="",onClick:g,children:s(m?"Sending\u2026":"Send test event")},void 0,!1)]},void 0,!0),r!==null&&(0,t.jsxDEV)("p",{className:r.kind==="success"?"mt-2 text-sm text-muted-foreground":"mt-2 text-sm text-destructive","data-testid":"drain-webhook-result",role:r.kind==="error"?"alert":void 0,children:r.kind==="success"?s("Delivered \u2014 status {status} in {latency}ms",{latency:r.latencyMs,status:r.status}):s("Failed: {message}",{message:r.message})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0)},"LogDrainsPanel");export{F as LogDrainsPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as $}from"./chunk-7RYIQKZA.js";import{a as W}from"./chunk-OD2POGPJ.js";import{a as q}from"./chunk-2K47A3P6.js";import{a as G,b as P,c as V,d as b,e as i,f as n}from"./chunk-GTM65MVX.js";import{a as y}from"./chunk-JSEXCW5Q.js";import{a as _}from"./chunk-RMYA7NAH.js";import{b as U}from"./chunk-TBMYIZIO.js";import{R as k}from"./chunk-BHTPZS7L.js";import{c as S}from"./chunk-YQQJ4N6U.js";import"./chunk-TICVNLPM.js";import"./chunk-HV7G6DFP.js";import{a as g}from"./chunk-AQGOX5DK.js";import{a as F}from"./chunk-TAD43CG5.js";import{b as Q}from"./chunk-FCR3HKFV.js";import{a as B,e as A}from"./chunk-SEU5V7I6.js";import{b as L}from"./chunk-O4PXDNR3.js";import"./chunk-ZH7UES4T.js";import{f as w}from"./chunk-KODWGUAB.js";import"./chunk-3OA7PECS.js";import{d as E,e as K,f as O,g as j,i as z,l as H}from"./chunk-YJGANMU7.js";import{a as s,e as T,f as oe,h as de}from"./chunk-RRCPZMC2.js";var a=T(oe(),1);var e=T(de(),1);var le=K(g.runMigration),Te=s(({initialShardKey:J})=>{let X=w(),r=E(),[c,Y]=(0,a.useState)(J??""),[x,Z]=(0,a.useState)(""),[N,ee]=(0,a.useState)("up"),[f,re]=(0,a.useState)(!0),[u,R]=(0,a.useState)(!1),[d,h]=(0,a.useState)(null),[C,p]=(0,a.useState)(null),m=q(c.trim(),400),I=c.trim()===m,o=Q(g.migrationStatus,{},{live:!0,shardKey:m}),l=o.data?.migrations??null,D=o.error,{liveError:te}=o;(0,a.useEffect)(()=>{o.data!==void 0&&U(m)},[o.data,m]);let ae=s(async()=>{let t=x.trim();if(t===""){p(r("Enter a migration id")),h(null);return}R(!0),p(null);try{let v=await X.query(le,{direction:N,dryRun:f,id:t},O(c));h(v),o.refetch()}catch(v){h(null),p(j(v))}finally{R(!1)}},"run"),M=s(()=>{z(ae())},"runMigration"),ie=s(t=>{Z(t.target.value)},"onIdChange"),ne=s(t=>{ee(t.target.value==="down"?"down":"up")},"onDirectionChange"),se=s(t=>{re(t.target.checked)},"onDryRunChange");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-migrations",children:[(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)(_,{onChange:Y,testId:"mg-shard-input",value:c},void 0,!1),(0,e.jsxDEV)($,{message:te,prefix:"mg"},void 0,!1)]},void 0,!0),D!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"mg-status-error",role:"alert",children:D},void 0,!1),l!==null&&l.length===0&&(0,e.jsxDEV)(F,{description:r("Data migrations you run against this shard will be tracked here."),icon:(0,e.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsxDEV)("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"},void 0,!1)},void 0,!1),testId:"mg-empty",title:r("No migrations have run on this shard.")},void 0,!1),l!==null&&l.length>0&&(0,e.jsxDEV)(B,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(A,{className:"px-0",children:(0,e.jsxDEV)(G,{"data-testid":"mg-table",children:[(0,e.jsxDEV)(P,{children:(0,e.jsxDEV)(b,{children:[(0,e.jsxDEV)(i,{children:r("id")},void 0,!1),(0,e.jsxDEV)(i,{children:r("direction")},void 0,!1),(0,e.jsxDEV)(i,{children:r("status")},void 0,!1),(0,e.jsxDEV)(i,{children:r("processed")},void 0,!1),(0,e.jsxDEV)(i,{children:r("changed")},void 0,!1),(0,e.jsxDEV)(i,{children:r("updated")},void 0,!1),(0,e.jsxDEV)(i,{children:r("error")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(V,{children:l.map(t=>(0,e.jsxDEV)(b,{"data-testid":`mg-row-${t.id}`,children:[(0,e.jsxDEV)(n,{children:t.id},void 0,!1),(0,e.jsxDEV)(n,{children:t.direction},void 0,!1),(0,e.jsxDEV)(n,{children:(0,e.jsxDEV)(L,{variant:"secondary",children:t.status},void 0,!1)},void 0,!1),(0,e.jsxDEV)(n,{children:t.processed},void 0,!1),(0,e.jsxDEV)(n,{children:t.changed},void 0,!1),(0,e.jsxDEV)(n,{children:H(t.updatedAt)},void 0,!1),(0,e.jsxDEV)(n,{children:t.error??""},void 0,!1)]},t.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs",children:[(0,e.jsxDEV)(y,{children:r("Run migration")},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)(k,{"aria-label":r("Migration id"),className:"w-auto","data-testid":"mg-id-input",onChange:ie,placeholder:r("migration id"),value:x},void 0,!1),(0,e.jsxDEV)("select",{"aria-label":r("Direction"),className:"flex h-9 rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"mg-direction",onChange:ne,value:N,children:[(0,e.jsxDEV)("option",{value:"up",children:r("up")},void 0,!1),(0,e.jsxDEV)("option",{value:"down",children:r("down")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)(y,{className:"flex items-center gap-1.5",htmlFor:"mg-dry-run",children:[(0,e.jsxDEV)("input",{checked:f,className:"size-4 accent-primary","data-testid":"mg-dry-run",id:"mg-dry-run",onChange:se,type:"checkbox"},void 0,!1),r("Dry run")]},void 0,!0),f?(0,e.jsxDEV)(S,{"data-testid":"mg-run",disabled:u||!I,onClick:M,size:"sm",type:"button",children:r(u?"Running\u2026":"Run")},void 0,!1):(0,e.jsxDEV)(W,{confirmLabel:r(u?"Running\u2026":"Run migration?"),disabled:u||!I,onConfirm:M,testId:"mg-run",children:r("Run")},void 0,!1)]},void 0,!0)]},void 0,!0),C!==null&&(0,e.jsxDEV)("pre",{className:"text-sm text-destructive whitespace-pre-wrap","data-testid":"mg-run-error",role:"alert",children:C},void 0,!1),d!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"mg-run-result",children:[d.dryRun?r("Dry run: "):"",r("{status} \u2014 processed",{status:d.status}),d.processed,r(", changed"),d.changed]},void 0,!0)]},void 0,!0)},"MigrationsPanel");export{Te as MigrationsPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as te}from"./chunk-7RYIQKZA.js";import{a as X}from"./chunk-2K47A3P6.js";import{a as Y,b as Z,c as ee,d as P,e as i,f as o}from"./chunk-GTM65MVX.js";import{a as J}from"./chunk-RMYA7NAH.js";import"./chunk-TBMYIZIO.js";import"./chunk-BHTPZS7L.js";import{c as O}from"./chunk-YQQJ4N6U.js";import"./chunk-TICVNLPM.js";import"./chunk-HV7G6DFP.js";import{a as G}from"./chunk-AQGOX5DK.js";import{a as Q}from"./chunk-TAD43CG5.js";import{b as W}from"./chunk-FCR3HKFV.js";import{a as V,e as z}from"./chunk-SEU5V7I6.js";import{b as H}from"./chunk-O4PXDNR3.js";import"./chunk-ZH7UES4T.js";import"./chunk-KODWGUAB.js";import"./chunk-3OA7PECS.js";import{d as q,l as U}from"./chunk-YJGANMU7.js";import{a,e as R,f as de,g as ce,h as fe,j as L}from"./chunk-RRCPZMC2.js";var re=R(ce(),1),j=R(de(),1);var t=R(fe(),1);var me={action:"outline",mutation:"default",query:"secondary"},le=a(l=>l<1e3?`${l<10?l.toFixed(1):Math.round(l).toString()}ms`:`${(l/1e3).toFixed(2)}s`,"formatMs"),ue=a(l=>l.calls===0?"\u2014":l.errors===0?"0":`${l.errors.toString()} (${(l.errors/l.calls*100).toFixed(1)}%)`,"errorCell"),he=a(l=>{let e=l.conflicts??0;return l.calls===0?"\u2014":e===0?"0":`${e.toString()} (${(e/l.calls*100).toFixed(1)}%)`},"conflictCell"),ve={calls:a((l,e)=>e.calls-l.calls,"calls"),recent:a((l,e)=>e.lastCalledAt-l.lastCalledAt,"recent"),slowest:a((l,e)=>e.maxDurationMs-l.maxDurationMs,"slowest")},De=a(l=>{let e=(0,re.c)(45),{functions:A,initialShardKey:se}=l,s=q(),[n,ae]=(0,j.useState)(se??""),[c,ie]=(0,j.useState)("recent"),k;e[0]!==n?(k=n.trim(),e[0]=n,e[1]=k):k=e[1];let F=X(k,400),C;e[2]===Symbol.for("react.memo_cache_sentinel")?(C={},e[2]=C):C=e[2];let M;e[3]!==F?(M={live:!0,shardKey:F},e[3]=F,e[4]=M):M=e[4];let{data:oe,error:d,liveError:N}=W(G.getFunctionStats,C,M),b=oe?.functions??null,T;e[5]!==A?(T=new Map((A??[]).map(pe)),e[5]=A,e[6]=T):T=e[6];let I=T,w;e[7]===Symbol.for("react.memo_cache_sentinel")?(w=a(S=>{ie(S.currentTarget.dataset.sort)},"t5"),e[7]=w):w=e[7];let ne=w,$;if(e[8]!==d||e[9]!==I||e[10]!==N||e[11]!==n||e[12]!==c||e[13]!==b||e[14]!==s){let S=b===null?[]:b.toSorted(ve[c]),f;e[16]!==s?(f=s("Recent"),e[16]=s,e[17]=f):f=e[17];let m;e[18]!==f?(m={key:"recent",label:f},e[18]=f,e[19]=m):m=e[19];let u;e[20]!==s?(u=s("Most called"),e[20]=s,e[21]=u):u=e[21];let h;e[22]!==u?(h={key:"calls",label:u},e[22]=u,e[23]=h):h=e[23];let v;e[24]!==s?(v=s("Slowest"),e[24]=s,e[25]=v):v=e[25];let p;e[26]!==v?(p={key:"slowest",label:v},e[26]=v,e[27]=p):p=e[27];let B;e[28]!==h||e[29]!==p||e[30]!==m?(B=[m,h,p],e[28]=h,e[29]=p,e[30]=m,e[31]=B):B=e[31];let K=B,x;e[32]!==n?(x=(0,t.jsxDEV)(J,{onChange:ae,testId:"fs-shard-input",value:n},void 0,!1),e[32]=n,e[33]=x):x=e[33];let g;e[34]!==N?(g=(0,t.jsxDEV)(te,{message:N,prefix:"fs"},void 0,!1),e[34]=N,e[35]=g):g=e[35];let y;e[36]!==K||e[37]!==c?(y=(0,t.jsxDEV)("div",{className:"ml-auto flex items-center gap-1",role:"group",children:K.map(r=>(0,t.jsxDEV)(O,{"data-sort":r.key,"data-testid":`fs-sort-${r.key}`,onClick:ne,size:"sm",type:"button",variant:c===r.key?"secondary":"ghost",children:r.label},r.key,!1))},void 0,!1),e[36]=K,e[37]=c,e[38]=y):y=e[38];let D;e[39]!==x||e[40]!==g||e[41]!==y?(D=(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[x,g,y]},void 0,!0),e[39]=x,e[40]=g,e[41]=y,e[42]=D):D=e[42];let E;e[43]!==d?(E=d!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"fs-error",role:"alert",children:d},void 0,!1),e[43]=d,e[44]=E):E=e[44],$=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-stats",children:[D,E,b!==null&&S.length===0&&d===null&&(0,t.jsxDEV)(Q,{description:s("Per-function call counts, error rates, and latency land here after your first request."),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:"M3 3v18h18"},void 0,!1),(0,t.jsxDEV)("path",{d:"M7 14l4-4 3 3 5-6"},void 0,!1)]},void 0,!0),testId:"fs-empty",title:s("No functions have run on this shard yet.")},void 0,!1),S.length>0&&(0,t.jsxDEV)(V,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(z,{className:"px-0",children:(0,t.jsxDEV)(Y,{"data-testid":"fs-table",children:[(0,t.jsxDEV)(Z,{children:(0,t.jsxDEV)(P,{children:[(0,t.jsxDEV)(i,{children:s("function")},void 0,!1),(0,t.jsxDEV)(i,{children:s("kind")},void 0,!1),(0,t.jsxDEV)(i,{className:"text-right",children:s("calls")},void 0,!1),(0,t.jsxDEV)(i,{className:"text-right",children:s("errors")},void 0,!1),(0,t.jsxDEV)(i,{className:"text-right",children:s("conflicts")},void 0,!1),(0,t.jsxDEV)(i,{className:"text-right",children:s("avg")},void 0,!1),(0,t.jsxDEV)(i,{className:"text-right",children:s("max")},void 0,!1),(0,t.jsxDEV)(i,{children:s("last run")},void 0,!1),(0,t.jsxDEV)(i,{children:s("last error")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(ee,{children:S.map(r=>{let _=I.get(r.path);return(0,t.jsxDEV)(P,{"data-testid":`fs-row-${r.path}`,children:[(0,t.jsxDEV)(o,{className:"font-medium",children:r.path},void 0,!1),(0,t.jsxDEV)(o,{children:_===void 0?(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1):(0,t.jsxDEV)(H,{variant:me[_],children:_},void 0,!1)},void 0,!1),(0,t.jsxDEV)(o,{className:"text-right tabular-nums",children:r.calls},void 0,!1),(0,t.jsxDEV)(o,{className:L("text-right tabular-nums",r.errors>0&&"text-destructive"),children:ue(r)},void 0,!1),(0,t.jsxDEV)(o,{className:L("text-right tabular-nums",(r.conflicts??0)>0&&"text-warning"),children:he(r)},void 0,!1),(0,t.jsxDEV)(o,{className:"text-right tabular-nums",children:r.calls===0?"\u2014":le(r.totalDurationMs/r.calls)},void 0,!1),(0,t.jsxDEV)(o,{className:"text-right tabular-nums",children:r.calls===0?"\u2014":le(r.maxDurationMs)},void 0,!1),(0,t.jsxDEV)(o,{className:"text-muted-foreground",children:U(r.lastCalledAt,"\u2014")},void 0,!1),(0,t.jsxDEV)(o,{className:"max-w-[24ch] truncate text-destructive",title:r.lastErrorMessage??void 0,children:r.lastErrorMessage??(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1)]},r.path,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),e[8]=d,e[9]=I,e[10]=N,e[11]=n,e[12]=c,e[13]=b,e[14]=s,e[15]=$}else $=e[15];return $},"FunctionStatsPanel");function pe(l){return[l.path,l.kind]}a(pe,"_temp");export{De as FunctionStatsPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as N,h}from"./chunk-YJGANMU7.js";import{a as m,e as w,g as y,h as C}from"./chunk-RRCPZMC2.js";var v=w(y(),1);var o=w(C(),1);var T=m(b=>{let e=(0,v.c)(8),{value:l}=b;if(l==null){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,o.jsxDEV)("span",{className:"text-muted-foreground/50 italic",children:"NULL"},void 0,!1),e[0]=a):a=e[0],a}let t;e[1]!==l?(t=h(l),e[1]=l,e[2]=t):t=e[2];let r;e[3]!==l?(r=h(l),e[3]=l,e[4]=r):r=e[4];let s;return e[5]!==t||e[6]!==r?(s=(0,o.jsxDEV)("span",{title:t,children:r},void 0,!1),e[5]=t,e[6]=r,e[7]=s):s=e[7],s},"CellValue"),G=m(b=>{let e=(0,v.c)(22),{columns:l,rows:t}=b,r=N(),s;e[0]!==r?(s=r("Field"),e[0]=r,e[1]=s):s=e[1];let a;e[2]!==s?(a=(0,o.jsxDEV)("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:s},void 0,!1),e[2]=s,e[3]=a):a=e[3];let i;if(e[4]!==t||e[5]!==r){let d;e[7]!==r?(d=m((u,x)=>(0,o.jsxDEV)("th",{className:"border-b border-border px-3 py-1.5 text-start font-mono text-[11px] tracking-wide uppercase tabular-nums text-muted-foreground",children:r("Row {n}",{n:x+1})},x,!1),"t42"),e[7]=r,e[8]=d):d=e[8],i=t.map(d),e[4]=t,e[5]=r,e[6]=i}else i=e[6];let n;e[9]!==a||e[10]!==i?(n=(0,o.jsxDEV)("thead",{className:"sticky top-0 z-10 bg-muted",children:(0,o.jsxDEV)("tr",{children:[a,i]},void 0,!0)},void 0,!1),e[9]=a,e[10]=i,e[11]=n):n=e[11];let f;if(e[12]!==l||e[13]!==t){let d;e[15]!==t?(d=m(u=>(0,o.jsxDEV)("tr",{className:"hover:bg-muted/40",children:[(0,o.jsxDEV)("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono font-medium whitespace-nowrap",scope:"row",children:u},void 0,!1),t.map((x,g)=>(0,o.jsxDEV)("td",{className:"max-w-md truncate border-b border-border px-3 py-1.5 font-mono",children:(0,o.jsxDEV)(T,{value:x[u]},void 0,!1)},g,!1))]},u,!0),"t62"),e[15]=t,e[16]=d):d=e[16],f=l.map(d),e[12]=l,e[13]=t,e[14]=f}else f=e[14];let c;e[17]!==f?(c=(0,o.jsxDEV)("tbody",{children:f},void 0,!1),e[17]=f,e[18]=c):c=e[18];let p;return e[19]!==n||e[20]!==c?(p=(0,o.jsxDEV)("div",{className:"min-h-0 flex-1 overflow-auto","data-testid":"db-transposed",children:(0,o.jsxDEV)("table",{className:"border-collapse text-xs",children:[n,c]},void 0,!0)},void 0,!1),e[19]=n,e[20]=c,e[21]=p):p=e[21],p},"TransposedTable"),L=m(({children:b,layout:e="card",testId:l})=>(0,o.jsxDEV)("div",{className:e==="fill"?"flex min-h-0 flex-1 flex-col overflow-hidden border-t border-border":"overflow-x-auto border border-border bg-card","data-testid":l,children:b},void 0,!1),"GridContainer");export{T as a,G as b,L as c};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import{a,c as te,e as de,f as qe}from"./chunk-RRCPZMC2.js";var pe=te((he,W)=>{(function(t,r){typeof define=="function"&&define.amd?define([],r):typeof W=="object"&&W.exports?W.exports=r():t.moo=r()})(he,function(){"use strict";var t=Object.prototype.hasOwnProperty,r=Object.prototype.toString,e=typeof new RegExp().sticky=="boolean";function s(n){return n&&r.call(n)==="[object RegExp]"}a(s,"isRegExp");function i(n){return n&&typeof n=="object"&&!s(n)&&!Array.isArray(n)}a(i,"isObject");function l(n){return n.replace(/[-\/\\^$*+?.()|[\]{}]/g,function(o){return o==="-"?"\\x2d":"\\"+o})}a(l,"reEscape");function c(n){var o=new RegExp("|"+n);return o.exec("").length-1}a(c,"reGroups");function h(n){return"("+n+")"}a(h,"reCapture");function w(n){if(!n.length)return"(?!)";var o=n.map(function(u){return"(?:"+u+")"}).join("|");return"(?:"+o+")"}a(w,"reUnion");function S(n){if(typeof n=="string")return"(?:"+l(n)+")";if(s(n)){if(n.ignoreCase)throw new Error("RegExp /i flag not allowed");if(n.global)throw new Error("RegExp /g flag is implied");if(n.sticky)throw new Error("RegExp /y flag is implied");if(n.multiline)throw new Error("RegExp /m flag is implied");return n.source}else throw new Error("Not a pattern: "+n)}a(S,"regexpOrLiteral");function b(n,o){return n.length>o?n:Array(o-n.length+1).join(" ")+n}a(b,"pad");function M(n,o){for(var u=n.length,f=0;;){var g=n.lastIndexOf(`
|
|
2
|
+
`,u-1);if(g===-1||(f++,u=g,f===o)||u===0)break}var d=f<o?0:u+1;return n.substring(d).split(`
|
|
3
|
+
`)}a(M,"lastNLines");function K(n){for(var o=Object.getOwnPropertyNames(n),u=[],f=0;f<o.length;f++){var g=o[f],d=n[g],m=[].concat(d);if(g==="include"){for(var v=0;v<m.length;v++)u.push({include:m[v]});continue}var y=[];m.forEach(function(p){i(p)?(y.length&&u.push($(g,y)),u.push($(g,p)),y=[]):y.push(p)}),y.length&&u.push($(g,y))}return u}a(K,"objectToRules");function O(n){for(var o=[],u=0;u<n.length;u++){var f=n[u];if(f.include){for(var g=[].concat(f.include),d=0;d<g.length;d++)o.push({include:g[d]});continue}if(!f.type)throw new Error("Rule has no type: "+JSON.stringify(f));o.push($(f.type,f))}return o}a(O,"arrayToRules");function $(n,o){if(i(o)||(o={match:o}),o.include)throw new Error("Matching rules cannot also include states");var u={defaultType:n,lineBreaks:!!o.error||!!o.fallback,pop:!1,next:null,push:null,error:!1,fallback:!1,value:null,type:null,shouldThrow:!1};for(var f in o)t.call(o,f)&&(u[f]=o[f]);if(typeof u.type=="string"&&n!==u.type)throw new Error("Type transform cannot be a string (type '"+u.type+"' for token '"+n+"')");var g=u.match;return u.match=Array.isArray(g)?g:g?[g]:[],u.match.sort(function(d,m){return s(d)&&s(m)?0:s(m)?-1:s(d)?1:m.length-d.length}),u}a($,"ruleOptions");function C(n){return Array.isArray(n)?O(n):K(n)}a(C,"toRules");var N=$("error",{lineBreaks:!0,shouldThrow:!0});function F(n,o){for(var u=null,f=Object.create(null),g=!0,d=null,m=[],v=[],y=0;y<n.length;y++)n[y].fallback&&(g=!1);for(var y=0;y<n.length;y++){var p=n[y];if(p.include)throw new Error("Inheritance is not allowed in stateless lexers");if(p.error||p.fallback){if(u)throw!p.fallback==!u.fallback?new Error("Multiple "+(p.fallback?"fallback":"error")+" rules not allowed (for token '"+p.defaultType+"')"):new Error("fallback and error are mutually exclusive (for token '"+p.defaultType+"')");u=p}var _=p.match.slice();if(g)for(;_.length&&typeof _[0]=="string"&&_[0].length===1;){var D=_.shift();f[D.charCodeAt(0)]=p}if(p.pop||p.push||p.next){if(!o)throw new Error("State-switching options are not allowed in stateless lexers (for token '"+p.defaultType+"')");if(p.fallback)throw new Error("State-switching options are not allowed on fallback tokens (for token '"+p.defaultType+"')")}if(_.length!==0){g=!1,m.push(p);for(var P=0;P<_.length;P++){var q=_[P];if(s(q)){if(d===null)d=q.unicode;else if(d!==q.unicode&&p.fallback===!1)throw new Error("If one rule is /u then all must be")}}var I=w(_.map(S)),T=new RegExp(I);if(T.test(""))throw new Error("RegExp matches empty string: "+T);var L=c(I);if(L>0)throw new Error("RegExp has capture groups: "+T+`
|
|
4
|
+
Use (?: \u2026 ) instead`);if(!p.lineBreaks&&T.test(`
|
|
5
|
+
`))throw new Error("Rule should declare lineBreaks: "+T);v.push(h(I))}}var R=u&&u.fallback,U=e&&!R?"ym":"gm",H=e||R?"":"|";d===!0&&(U+="u");var Pe=new RegExp(w(v)+H,U);return{regexp:Pe,groups:m,fast:f,error:u||N}}a(F,"compileRules");function X(n){var o=F(C(n));return new k({start:o},"start")}a(X,"compile");function fe(n,o,u){var f=n&&(n.push||n.next);if(f&&!u[f])throw new Error("Missing state '"+f+"' (in token '"+n.defaultType+"' of state '"+o+"')");if(n&&n.pop&&+n.pop!=1)throw new Error("pop must be 1 (in token '"+n.defaultType+"' of state '"+o+"')")}a(fe,"checkStateGroup");function $e(n,o){var u=n.$all?C(n.$all):[];delete n.$all;var f=Object.getOwnPropertyNames(n);o||(o=f[0]);for(var g=Object.create(null),d=0;d<f.length;d++){var m=f[d];g[m]=C(n[m]).concat(u)}for(var d=0;d<f.length;d++)for(var m=f[d],v=g[m],y=Object.create(null),p=0;p<v.length;p++){var _=v[p];if(_.include){var D=[p,1];if(_.include!==m&&!y[_.include]){y[_.include]=!0;var P=g[_.include];if(!P)throw new Error("Cannot include nonexistent state '"+_.include+"' (in state '"+m+"')");for(var q=0;q<P.length;q++){var I=P[q];v.indexOf(I)===-1&&D.push(I)}}v.splice.apply(v,D),p--}}for(var T=Object.create(null),d=0;d<f.length;d++){var m=f[d];T[m]=F(g[m],!0)}for(var d=0;d<f.length;d++){for(var L=f[d],R=T[L],U=R.groups,p=0;p<U.length;p++)fe(U[p],L,T);for(var H=Object.getOwnPropertyNames(R.fast),p=0;p<H.length;p++)fe(R.fast[H[p]],L,T)}return new k(T,o)}a($e,"compileStates");function Be(n){for(var o=typeof Map<"u",u=o?new Map:Object.create(null),f=Object.getOwnPropertyNames(n),g=0;g<f.length;g++){var d=f[g],m=n[d],v=Array.isArray(m)?m:[m];v.forEach(function(y){if(typeof y!="string")throw new Error("keyword must be string (in keyword '"+d+"')");o?u.set(y,d):u[y]=d})}return function(y){return o?u.get(y):u[y]}}a(Be,"keywordTransform");var k=a(function(n,o){this.startState=o,this.states=n,this.buffer="",this.stack=[],this.reset()},"Lexer");k.prototype.reset=function(n,o){return this.buffer=n||"",this.index=0,this.line=o?o.line:1,this.col=o?o.col:1,this.queuedToken=o?o.queuedToken:null,this.queuedText=o?o.queuedText:"",this.queuedThrow=o?o.queuedThrow:null,this.setState(o?o.state:this.startState),this.stack=o&&o.stack?o.stack.slice():[],this},k.prototype.save=function(){return{line:this.line,col:this.col,state:this.state,stack:this.stack.slice(),queuedToken:this.queuedToken,queuedText:this.queuedText,queuedThrow:this.queuedThrow}},k.prototype.setState=function(n){if(!(!n||this.state===n)){this.state=n;var o=this.states[n];this.groups=o.groups,this.error=o.error,this.re=o.regexp,this.fast=o.fast}},k.prototype.popState=function(){this.setState(this.stack.pop())},k.prototype.pushState=function(n){this.stack.push(this.state),this.setState(n)};var Ce=e?function(n,o){return n.exec(o)}:function(n,o){var u=n.exec(o);return u[0].length===0?null:u};k.prototype._getGroup=function(n){for(var o=this.groups.length,u=0;u<o;u++)if(n[u+1]!==void 0)return this.groups[u];throw new Error("Cannot find token type for matched text")};function De(){return this.value}if(a(De,"tokenToString"),k.prototype.next=function(){var n=this.index;if(this.queuedGroup){var o=this._token(this.queuedGroup,this.queuedText,n);return this.queuedGroup=null,this.queuedText="",o}var u=this.buffer;if(n!==u.length){var m=this.fast[u.charCodeAt(n)];if(m)return this._token(m,u.charAt(n),n);var f=this.re;f.lastIndex=n;var g=Ce(f,u),d=this.error;if(g==null)return this._token(d,u.slice(n,u.length),n);var m=this._getGroup(g),v=g[0];return d.fallback&&g.index!==n?(this.queuedGroup=m,this.queuedText=v,this._token(d,u.slice(n,g.index),n)):this._token(m,v,n)}},k.prototype._token=function(n,o,u){var f=0;if(n.lineBreaks){var g=/\n/g,d=1;if(o===`
|
|
6
|
+
`)f=1;else for(;g.exec(o);)f++,d=g.lastIndex}var m={type:typeof n.type=="function"&&n.type(o)||n.defaultType,value:typeof n.value=="function"?n.value(o):o,text:o,toString:De,offset:u,lineBreaks:f,line:this.line,col:this.col},v=o.length;if(this.index+=v,this.line+=f,f!==0?this.col=v-d+1:this.col+=v,n.shouldThrow){var y=new Error(this.formatError(m,"invalid syntax"));throw y}return n.pop?this.popState():n.push?this.pushState(n.push):n.next&&this.setState(n.next),m},typeof Symbol<"u"&&Symbol.iterator){var ee=a(function(n){this.lexer=n},"LexerIterator");ee.prototype.next=function(){var n=this.lexer.next();return{value:n,done:!n}},ee.prototype[Symbol.iterator]=function(){return this},k.prototype[Symbol.iterator]=function(){return new ee(this)}}return k.prototype.formatError=function(n,o){if(n==null)var u=this.buffer.slice(this.index),n={text:u,offset:this.index,lineBreaks:u.indexOf(`
|
|
7
|
+
`)===-1?0:1,line:this.line,col:this.col};var f=2,g=Math.max(n.line-f,1),d=n.line+f,m=String(d).length,v=M(this.buffer,this.line-n.line+f+1).slice(0,5),y=[];y.push(o+" at line "+n.line+" col "+n.col+":"),y.push("");for(var p=0;p<v.length;p++){var _=v[p],D=g+p;y.push(b(String(D),m)+" "+_),D===n.line&&y.push(b("",m+n.col+1)+"^")}return y.join(`
|
|
8
|
+
`)},k.prototype.clone=function(){return new k(this.states,this.state)},k.prototype.has=function(n){return!0},{compile:X,states:$e,error:Object.freeze({error:!0}),fallback:Object.freeze({fallback:!0}),keywords:Be}})});var ge=te(A=>{"use strict";var Ne=A&&A.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(A,"__esModule",{value:!0});A.lexer=A.states=void 0;var Fe=Ne(pe());A.states={body:{doubleapos:{match:"''",value:a(()=>"'","value")},quoted:{lineBreaks:!0,match:/'[{}#](?:[^']|'')*'(?!')/u,value:a(t=>t.slice(1,-1).replace(/''/g,"'"),"value")},argument:{lineBreaks:!0,match:/\{\s*[^\p{Pat_Syn}\p{Pat_WS}]+\s*/u,push:"arg",value:a(t=>t.substring(1).trim(),"value")},octothorpe:"#",end:{match:"}",pop:1},content:{lineBreaks:!0,match:/[^][^{}#']*/u}},arg:{select:{lineBreaks:!0,match:/,\s*(?:plural|select|selectordinal)\s*,\s*/u,next:"select",value:a(t=>t.split(",")[1].trim(),"value")},"func-args":{lineBreaks:!0,match:/,\s*[^\p{Pat_Syn}\p{Pat_WS}]+\s*,/u,next:"body",value:a(t=>t.split(",")[1].trim(),"value")},"func-simple":{lineBreaks:!0,match:/,\s*[^\p{Pat_Syn}\p{Pat_WS}]+\s*/u,value:a(t=>t.substring(1).trim(),"value")},end:{match:"}",pop:1}},select:{offset:{lineBreaks:!0,match:/\s*offset\s*:\s*\d+\s*/u,value:a(t=>t.split(":")[1].trim(),"value")},case:{lineBreaks:!0,match:/\s*(?:=\d+|[^\p{Pat_Syn}\p{Pat_WS}]+)\s*\{/u,push:"body",value:a(t=>t.substring(0,t.indexOf("{")).trim(),"value")},end:{match:/\s*\}/u,pop:1}}};A.lexer=Fe.default.states(A.states)});var we=te(z=>{"use strict";Object.defineProperty(z,"__esModule",{value:!0});z.ParseError=void 0;z.parse=Le;var ye=ge(),Z=a(t=>({offset:t.offset,line:t.line,col:t.col,text:t.text,lineBreaks:t.lineBreaks}),"getContext"),re=a(t=>t==="plural"||t==="select"||t==="selectordinal","isSelectType");function Ie(t,r){let e="",s="";for(let l of r){let c=l.ctx.text;switch(s+=c,l.type){case"content":e+=l.value;break;case"argument":case"function":case"octothorpe":e+=c;break;default:throw new x(t,`Unsupported part in strict mode function arg style: ${c}`)}}return[{type:"content",value:e.trim(),ctx:Object.assign({},r[0].ctx,{text:s})}]}a(Ie,"strictArgStyleParam");var Re=["number","date","time","spellout","ordinal","duration"],me=["zero","one","two","few","many","other"],x=class extends Error{static{a(this,"ParseError")}constructor(r,e){super(ye.lexer.formatError(r,e))}};z.ParseError=x;var ne=class{static{a(this,"Parser")}constructor(r,e){var s,i,l,c;this.lexer=ye.lexer.reset(r),this.cardinalKeys=(s=e?.cardinal)!==null&&s!==void 0?s:me,this.ordinalKeys=(i=e?.ordinal)!==null&&i!==void 0?i:me,this.strict=(l=e?.strict)!==null&&l!==void 0?l:!1,this.strictPluralKeys=(c=e?.strictPluralKeys)!==null&&c!==void 0?c:!0}parse(){return this.parseBody(!1,!0)}checkSelectKey(r,e,s){if(s[0]==="="){if(e==="select")throw new x(r,`The case ${s} is not valid with select`)}else if(e!=="select"){let i=e==="plural"?this.cardinalKeys:this.ordinalKeys;if(this.strictPluralKeys&&i.length>0&&!i.includes(s)){let l=`The ${e} case ${s} is not valid in this locale`;throw new x(r,l)}}}parseSelect({value:r},e,s,i){let l={type:i,arg:r,cases:[],ctx:s};i==="plural"||i==="selectordinal"?e=!0:this.strict&&(e=!1);for(let c of this.lexer)switch(c.type){case"offset":if(i==="select")throw new x(c,"Unexpected plural offset for select");if(l.cases.length>0)throw new x(c,"Plural offset must be set before cases");l.pluralOffset=Number(c.value),s.text+=c.text,s.lineBreaks+=c.lineBreaks;break;case"case":{this.checkSelectKey(c,i,c.value),l.cases.push({key:c.value,tokens:this.parseBody(e),ctx:Z(c)});break}case"end":return l;default:throw new x(c,`Unexpected lexer token: ${c.type}`)}throw new x(null,"Unexpected message end")}parseArgToken(r,e){let s=Z(r),i=this.lexer.next();if(!i)throw new x(null,"Unexpected message end");if(s.text+=i.text,s.lineBreaks+=i.lineBreaks,this.strict&&(i.type==="func-simple"||i.type==="func-args")&&!Re.includes(i.value)){let l=`Invalid strict mode function arg type: ${i.value}`;throw new x(r,l)}switch(i.type){case"end":return{type:"argument",arg:r.value,ctx:s};case"func-simple":{let l=this.lexer.next();if(!l)throw new x(null,"Unexpected message end");if(l.type!=="end")throw new x(l,`Unexpected lexer token: ${l.type}`);if(s.text+=l.text,re(i.value.toLowerCase()))throw new x(i,`Invalid type identifier: ${i.value}`);return{type:"function",arg:r.value,key:i.value,ctx:s}}case"func-args":{if(re(i.value.toLowerCase())){let c=`Invalid type identifier: ${i.value}`;throw new x(i,c)}let l=this.parseBody(this.strict?!1:e);return this.strict&&l.length>0&&(l=Ie(r,l)),{type:"function",arg:r.value,key:i.value,param:l,ctx:s}}case"select":if(re(i.value))return this.parseSelect(r,e,s,i.value);throw new x(i,`Unexpected select type ${i.value}`);default:throw new x(i,`Unexpected lexer token: ${i.type}`)}}parseBody(r,e){let s=[],i=null;for(let l of this.lexer)if(l.type==="argument")i&&(i=null),s.push(this.parseArgToken(l,r));else if(l.type==="octothorpe"&&r)i&&(i=null),s.push({type:"octothorpe",ctx:Z(l)});else{if(l.type==="end"&&!e)return s;{let c=l.value;if(!r&&l.type==="quoted"&&c[0]==="#"){if(c.includes("{")){let h=`Unsupported escape pattern: ${c}`;throw new x(l,h)}c=l.text}i?(i.value+=c,i.ctx.text+=l.text,i.ctx.lineBreaks+=l.lineBreaks):(i={type:"content",value:c,ctx:Z(l)},s.push(i))}}if(e)return s;throw new x(null,"Unexpected message end")}};function Le(t,r={}){return new ne(t,r).parse()}a(Le,"parse")});var _e=de(we(),1);var E=class extends Error{static{a(this,"DateFormatError")}constructor(r,e,s){super(r),this.token=e,this.type=s||"error"}},ve=a(t=>t<4?"short":t===4?"long":"narrow","alpha"),G=a(t=>t%2===0?"2-digit":"numeric","numeric");function Ue(t,r){switch(t.char){case"y":return{year:G(t.width)};case"r":return{calendar:"gregory",year:"numeric"};default:return r(`${t.desc} is not supported; falling back to year:numeric`,E.WARNING),{year:"numeric"}}}a(Ue,"yearOptions");function ze(t,r){switch(t.width){case 1:return"numeric";case 2:return"2-digit";case 3:return"short";case 4:return"long";case 5:return"narrow";default:r(`${t.desc} is not supported with width ${t.width}`);return}}a(ze,"monthStyle");function Ge(t,r){let{char:e,desc:s,width:i}=t;if(e==="d")return G(i);r(`${s} is not supported`)}a(Ge,"dayStyle");function Ke(t,r){let{char:e,desc:s,width:i}=t;if((e==="c"||e==="e")&&i<3){let l=`Numeric value is not supported for ${s}; falling back to weekday:short`;r(l,E.WARNING)}return ve(i)}a(Ke,"weekdayStyle");function He(t){let r=G(t.width),e;switch(t.char){case"h":e="h12";break;case"H":e="h23";break;case"k":e="h24";break;case"K":e="h11";break}return e?{hour:r,hourCycle:e}:{hour:r}}a(He,"hourOptions");function We(t,r){let{char:e,desc:s,width:i}=t;switch(e){case"v":case"z":return i===4?"long":"short";case"V":if(i===4)return"long";r(`${s} is not supported with width ${i}`);return;case"X":r(`${s} is not supported`);return}return"short"}a(We,"timeZoneNameStyle");function Ze(t,r){switch(t.field){case"era":return{era:ve(t.width)};case"year":return Ue(t,r);case"month":return{month:ze(t,r)};case"day":return{day:Ge(t,r)};case"weekday":return{weekday:Ke(t,r)};case"period":return;case"hour":return He(t);case"min":return{minute:G(t.width)};case"sec":return{second:G(t.width)};case"tz":return{timeZoneName:We(t,r)};case"quarter":case"week":case"sec-frac":case"ms":r(`${t.desc} is not supported`)}}a(Ze,"compileOptions");function se(t,r,e=s=>{throw s}){let s={timeZone:r},i=[];for(let l of t){let{error:c,field:h,str:w}=l;if(c){let b=new E(c.message,l);b.stack=c.stack,e(b)}if(w){let b=`Ignoring string part: ${w}`;e(new E(b,l,E.WARNING))}h&&(i.indexOf(h)===-1?i.push(h):e(new E(`Duplicate ${h} token`,l)));let S=Ze(l,(b,M)=>e(new E(b,l,M)));S&&Object.assign(s,S)}return s}a(se,"getDateFormatOptions");var Je={G:{field:"era",desc:"Era"},y:{field:"year",desc:"Year"},Y:{field:"year",desc:'Year of "Week of Year"'},u:{field:"year",desc:"Extended year"},U:{field:"year",desc:"Cyclic year name"},r:{field:"year",desc:"Related Gregorian year"},Q:{field:"quarter",desc:"Quarter"},q:{field:"quarter",desc:"Stand-alone quarter"},M:{field:"month",desc:"Month in year"},L:{field:"month",desc:"Stand-alone month in year"},w:{field:"week",desc:"Week of year"},W:{field:"week",desc:"Week of month"},d:{field:"day",desc:"Day in month"},D:{field:"day",desc:"Day of year"},F:{field:"day",desc:"Day of week in month"},g:{field:"day",desc:"Modified julian day"},E:{field:"weekday",desc:"Day of week"},e:{field:"weekday",desc:"Local day of week"},c:{field:"weekday",desc:"Stand-alone local day of week"},a:{field:"period",desc:"AM/PM marker"},b:{field:"period",desc:"AM/PM/noon/midnight marker"},B:{field:"period",desc:"Flexible day period"},h:{field:"hour",desc:"Hour in AM/PM (1~12)"},H:{field:"hour",desc:"Hour in day (0~23)"},k:{field:"hour",desc:"Hour in day (1~24)"},K:{field:"hour",desc:"Hour in AM/PM (0~11)"},j:{field:"hour",desc:"Hour in preferred cycle"},J:{field:"hour",desc:"Hour in preferred cycle without marker"},C:{field:"hour",desc:"Hour in preferred cycle with flexible marker"},m:{field:"min",desc:"Minute in hour"},s:{field:"sec",desc:"Second in minute"},S:{field:"sec-frac",desc:"Fractional second"},A:{field:"ms",desc:"Milliseconds in day"},z:{field:"tz",desc:"Time Zone: specific non-location"},Z:{field:"tz",desc:"Time Zone"},O:{field:"tz",desc:"Time Zone: localized"},v:{field:"tz",desc:"Time Zone: generic non-location"},V:{field:"tz",desc:"Time Zone: ID"},X:{field:"tz",desc:"Time Zone: ISO8601 with Z"},x:{field:"tz",desc:"Time Zone: ISO8601"}},xe=a(t=>t>="A"&&t<="Z"||t>="a"&&t<="z","isLetter");function je(t,r){let e=t[r],s=1;for(;t[++r]===e;)++s;let i=Je[e];if(!i){let l=`The letter ${e} is not a valid field identifier`;return{char:e,error:new Error(l),width:s}}return{char:e,field:i.field,desc:i.desc,width:s}}a(je,"readFieldToken");function Ye(t,r){let e=t[++r],s=2;if(e==="'")return{char:"'",str:e,width:s};for(;;){let i=t[++r];if(++s,i===void 0){let l=`Unterminated quoted literal in pattern: ${e||t}`;return{char:"'",error:new Error(l),str:e,width:s}}else if(i==="'"){if(t[++r]!=="'")return{char:"'",str:e,width:s};++s}e+=i}}a(Ye,"readQuotedToken");function Qe(t,r){let e=t[r];if(!e)return null;if(xe(e))return je(t,r);if(e==="'")return Ye(t,r);let s=e,i=1;for(;;){let l=t[++r];if(!l||xe(l)||l==="'")return{char:e,str:s,width:i};s+=l,i+=1}}a(Qe,"readToken");function J(t){let r=[],e=0;for(;;){let s=Qe(t,e);if(!s)return r;r.push(s),e+=s.width}}a(J,"parseDateTokens");function ke(t,r){return t.filter(e=>e.type!=="content").length?t.map(e=>{if(e.type==="content")return r(e.value);if(e.type==="octothorpe")return"#";if(e.type==="argument")return[e.arg];if(e.type==="function"){let l=e?.param?.[0];if(e.key==="date"&&l){let c=Ve(l.value.trim(),h=>{throw new Error(`Unable to compile date expression: ${h.message}`)});return[e.arg,e.key,c]}return l?[e.arg,e.key,l.value.trim()]:[e.arg,e.key]}let s=e.pluralOffset,i={};return e.cases.forEach(({key:l,tokens:c})=>{let h=l[0]==="="?l.slice(1):l;i[h]=ke(c,r)}),[e.arg,e.type,{offset:s,...i}]}):t.map(e=>r(e.value))}a(ke,"processTokens");function Ve(t,r){if(/^::/.test(t)){let e=J(t.substring(2));return se(e,void 0,r)}return t}a(Ve,"compileDateExpression");function Xe(t,r=e=>e){return ke((0,_e.parse)(t),r)}a(Xe,"compileMessageOrThrow");function j(t,r=e=>e){try{return Xe(t,r)}catch(e){return console.error(`${e.message}
|
|
9
|
+
|
|
10
|
+
Message: ${t}`),[t]}}a(j,"compileMessage");var B=a(t=>typeof t=="string","isString"),et=a(t=>typeof t=="function","isFunction"),be=new Map,Te="en";function le(t){return[...Array.isArray(t)?t:[t],Te]}a(le,"normalizeLocales");function ce(t,r,e){let s=le(t);e||(e="default");let i;if(typeof e=="string")switch(i={day:"numeric",month:"short",year:"numeric"},e){case"full":i.weekday="long";case"long":i.month="long";break;case"short":i.month="numeric";break}else i=e;return Y(()=>Q("date",s,e),()=>new Intl.DateTimeFormat(s,i)).format(B(r)?new Date(r):r)}a(ce,"date");function tt(t,r,e){let s;if(e||(e="default"),typeof e=="string")switch(s={second:"numeric",minute:"numeric",hour:"numeric"},e){case"full":case"long":s.timeZoneName="short";break;case"short":delete s.second}else s=e;return ce(t,r,s)}a(tt,"time");function ie(t,r,e){let s=le(t);return Y(()=>Q("number",s,e),()=>new Intl.NumberFormat(s,e)).format(r)}a(ie,"number");function Se(t,r,e,{offset:s=0,...i}){let l=le(t),c=r?Y(()=>Q("plural-ordinal",l),()=>new Intl.PluralRules(l,{type:"ordinal"})):Y(()=>Q("plural-cardinal",l),()=>new Intl.PluralRules(l,{type:"cardinal"}));return i[e]??i[c.select(e-s)]??i.other}a(Se,"plural");function Y(t,r){let e=t(),s=be.get(e);return s||(s=r(),be.set(e,s)),s}a(Y,"getMemoized");function Q(t,r,e){let s=r.join("-");return`${t}-${s}-${JSON.stringify(e)}`}a(Q,"cacheKey");var Ee=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/,Oe=a(t=>t.replace(/\\u([a-fA-F0-9]{4})|\\x([a-fA-F0-9]{2})/g,(r,e,s)=>{if(e){let i=parseInt(e,16);return String.fromCharCode(i)}else{let i=parseInt(s,16);return String.fromCharCode(i)}}),"decodeEscapeSequences"),Ae="%__lingui_octothorpe__%",rt=a((t,r,e={})=>{let s=r||t,i=a(c=>typeof c=="object"?c:e[c],"style"),l=a((c,h)=>{let w=Object.keys(e).length?i("number"):void 0,S=ie(s,c,w);return h.replace(new RegExp(Ae,"g"),S)},"replaceOctothorpe");return{plural:a((c,h)=>{let{offset:w=0}=h,S=Se(s,!1,c,h);return l(c-w,S)},"plural"),selectordinal:a((c,h)=>{let{offset:w=0}=h,S=Se(s,!0,c,h);return l(c-w,S)},"selectordinal"),select:nt,number:a((c,h)=>ie(s,c,i(h)||{style:h}),"number"),date:a((c,h)=>ce(s,c,i(h)||h),"date"),time:a((c,h)=>tt(s,c,i(h)||h),"time")}},"getDefaultFormats"),nt=a((t,r)=>r[t]??r.other,"selectFormatter");function st(t,r,e){return(s={},i)=>{let l=rt(r,e,i),c=a((w,S=!1)=>Array.isArray(w)?w.reduce((b,M)=>{if(M==="#"&&S)return b+Ae;if(B(M))return b+M;let[K,O,$]=M,C={};O==="plural"||O==="selectordinal"||O==="select"?Object.entries($).forEach(([F,X])=>{C[F]=c(X,O==="plural"||O==="selectordinal")}):C=$;let N;if(O){let F=l[O];N=F(s[K],C)}else N=s[K];return N==null?b:b+N},""):w,"formatMessage"),h=c(t);return B(h)&&Ee.test(h)?Oe(h):B(h)?h:h?String(h):""}}a(st,"interpolate");var ae=class{static{a(this,"EventEmitter")}_events={};on(r,e){return this._events[r]??=new Set,this._events[r].add(e),()=>this.removeListener(r,e)}removeListener(r,e){let s=this._events[r];s?.delete(e),s?.size===0&&delete this._events[r]}emit(r,...e){let s=this._events[r];if(s)for(let i of[...s])i.apply(this,e)}},oe=class extends ae{static{a(this,"I18n")}_locale="";_locales;_messages={};_missing;_messageCompiler;constructor(r){super(),this.setMessagesCompiler(j),r.missing!=null&&(this._missing=r.missing),r.messages!=null&&this.load(r.messages),(typeof r.locale=="string"||r.locales)&&this.activate(r.locale??Te,r.locales)}get locale(){return this._locale}get locales(){return this._locales}get messages(){return this._messages[this._locale]??{}}setMessagesCompiler(r){return this._messageCompiler=r,this}_load(r,e){let s=this._messages[r];s?Object.assign(s,e):this._messages[r]=e}load(r,e){typeof r=="string"&&typeof e=="object"?this._load(r,e):Object.entries(r).forEach(([s,i])=>this._load(s,i)),this.emit("change")}loadAndActivate({locale:r,locales:e,messages:s}){this._locale=r,this._locales=e||void 0,this._messages[this._locale]=s,this.emit("change")}activate(r,e){this._messages[r]||console.warn(`Messages for locale "${r}" not loaded.`),this._locale=r,this._locales=e,this.emit("change")}_(r,e,s){if(!this.locale)throw new Error("Lingui: Attempted to call a translation function without setting a locale.\nMake sure to call `i18n.activate(locale)` before using Lingui functions.\nThis issue may also occur due to a race condition in your initialization logic.");let i=s?.message;r||(r=""),B(r)||(e=r.values||e,i=r.message,r=r.id);let l=this.messages[r],c=l===void 0,h=this._missing;if(h&&c)return et(h)?h(this._locale,r):h;c&&this.emit("missing",{id:r,locale:this._locale});let w=l||i||r;return B(w)&&(this._messageCompiler?w=this._messageCompiler(w):console.warn(`Uncompiled message detected! Message:
|
|
11
|
+
|
|
12
|
+
> ${w}
|
|
13
|
+
|
|
14
|
+
That means you use raw catalog or your catalog doesn't have a translation for the message and fallback was used.
|
|
15
|
+
ICU features such as interpolation and plurals will not work properly for that message.
|
|
16
|
+
|
|
17
|
+
Please compile your catalog first.
|
|
18
|
+
`)),B(w)&&Ee.test(w)?Oe(w):B(w)?w:st(w,this._locale,this._locales)(e,s?.formats)}t=this._.bind(this);date(r,e){return ce(this._locales||this._locale,r,e)}number(r,e){return ie(this._locales||this._locale,r,e)}};function ue(t={}){return new oe(t)}a(ue,"setupI18n");var qt=ue();var V=de(qe(),1);var it={},Me="en",at={en:it},ot=a((t=Me,r=at)=>{let e=ue();e.setMessagesCompiler(j);for(let[s,i]of Object.entries(r))e.load(s,i);return e.activate(r[t]===void 0?Me:t),e},"createStudioI18n"),lt=ot(),ct=(0,V.createContext)(lt),Lt=a(()=>{let t=(0,V.use)(ct);return(r,e)=>t._(r,e)},"useT");var Gt=a(t=>({__lunoraRef:t}),"adminRef"),Kt=a(t=>{let r=t.trim();return r===""?{}:{shardKey:r}},"callOptions"),Ht=a(t=>t instanceof Error?t.message:String(t),"errorMessage"),Wt=a(t=>{if(t==null)return"";switch(typeof t){case"bigint":case"boolean":case"number":return t.toString();case"string":return t;case"symbol":return t.toString();default:return JSON.stringify(t)}},"formatCell"),ut=a((t,r)=>{t.catch(e=>{})},"fireAndForget"),Zt=a(t=>{let r="navigator"in globalThis?globalThis.navigator.clipboard:void 0;r!==void 0&&ut(r.writeText(t))},"copyToClipboard"),Jt=a(t=>{if(t==null)return"\u2014";if(t<1024)return`${t.toString()} B`;let r=["KB","MB","GB","TB"],e=t/1024,s=0;for(;e>=1024&&s<r.length-1;)e/=1024,s+=1;return`${e.toFixed(1)} ${r[s]??"TB"}`},"formatBytes"),jt=a((t,r="")=>{if(t==null||t==="")return r;let e=new Date(t);return Number.isNaN(e.getTime())?String(t):e.toLocaleString()},"formatTimestamp");export{ot as a,lt as b,ct as c,Lt as d,Gt as e,Kt as f,Ht as g,Wt as h,ut as i,Zt as j,Jt as k,jt as l};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as S,b as w,c as W,i as H,w as E}from"./chunk-TICVNLPM.js";import{a as K,b as C,j as M,k as V}from"./chunk-ZH7UES4T.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,2 @@
|
|
|
1
|
+
import{a as r,e as E,f as y,i as j}from"./chunk-RRCPZMC2.js";function b(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}r(b,"mergeObjects");var C={};function P(e,t,n,o,c){if(!n&&!o&&!c&&!e)return h(t);let i=h(e);return t&&(i=R(i,t)),n&&(i=R(i,n)),o&&(i=R(i,o)),c&&(i=R(i,c)),i}r(P,"mergeProps");function M(e){if(e.length===0)return C;if(e.length===1)return h(e[0]);let t=h(e[0]);for(let n=1;n<e.length;n+=1)t=R(t,e[n]);return t}r(M,"mergePropsN");function h(e){return I(e)?{...U(e,C)}:te(e)}r(h,"createInitialMergedProps");function R(e,t){return I(t)?U(t,e):ne(e,t)}r(R,"mergeInto");function te(e){let t={...e};for(let n in t){let o=t[n];S(n,o)&&(t[n]=L(o))}return t}r(te,"copyInitialProps");function ne(e,t){if(!t)return e;for(let n in t){let o=t[n];switch(n){case"style":{e[n]=b(e.style,o);break}case"className":{e[n]=O(e.className,o);break}default:S(n,o)?e[n]=re(e[n],o):e[n]=o}}return e}r(ne,"mutablyMergeInto");function S(e,t){let n=e.charCodeAt(0),o=e.charCodeAt(1),c=e.charCodeAt(2);return n===111&&o===110&&c>=65&&c<=90&&(typeof t=="function"||typeof t>"u")}r(S,"isEventHandler");function I(e){return typeof e=="function"}r(I,"isPropsGetter");function U(e,t){return I(e)?e(t):e??C}r(U,"resolvePropsGetter");function re(e,t){return t?e?(...n)=>{let o=n[0];if(B(o)){let i=o;$(i);let u=t(...n);return i.baseUIHandlerPrevented||e?.(...n),u}let c=t(...n);return e?.(...n),c}:L(t):e}r(re,"mergeEventHandlers");function L(e){return e&&((...t)=>{let n=t[0];return B(n)&&$(n),e(...t)})}r(L,"wrapEventHandler");function $(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}r($,"makeEventPreventable");function O(e,t){return t?e?t+" "+e:t:e}r(O,"mergeClassNames");function B(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}r(B,"isSyntheticEvent");var m=E(y(),1);var Y=E(y(),1);var D={};function w(e,t){let n=Y.useRef(D);return n.current===D&&(n.current=e(t)),n}r(w,"useRefWithInit");function x(e,t,n,o){let c=w(W).current;return oe(c,e,t,n,o)&&Z(c,[e,t,n,o]),c.callback}r(x,"useMergedRefs");function z(e){let t=w(W).current;return ie(t,e)&&Z(t,e),t.callback}r(z,"useMergedRefsN");function W(){return{callback:null,cleanup:null,refs:[]}}r(W,"createForkRef");function oe(e,t,n,o,c){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==o||e.refs[3]!==c}r(oe,"didChange");function ie(e,t){return e.refs.length!==t.length||e.refs.some((n,o)=>n!==t[o])}r(ie,"didChangeN");function Z(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){let o=Array(t.length).fill(null);for(let c=0;c<t.length;c+=1){let i=t[c];if(i!=null)switch(typeof i){case"function":{let u=i(n);typeof u=="function"&&(o[c]=u);break}case"object":{i.current=n;break}default:}}e.cleanup=()=>{for(let c=0;c<t.length;c+=1){let i=t[c];if(i!=null)switch(typeof i){case"function":{let u=o[c];typeof u=="function"?u():i(null);break}case"object":{i.current=null;break}default:}}}}}}r(Z,"update");var H=E(y(),1);var F=E(y(),1);var ce=parseInt(F.version,10);function G(e){return ce>=e}r(G,"isReactVersionAtLeast");function V(e){if(!H.isValidElement(e))return null;let t=e,n=t.props;return(G(19)?n?.ref:t.ref)??null}r(V,"getReactElementRef");var _;_=new Set;function J(...e){{let t=e.join(" ");_.has(t)||(_.add(t),console.warn(`Base UI: ${t}`))}}r(J,"warn");function Te(){}r(Te,"NOOP");var ke=Object.freeze([]),p=Object.freeze({});function K(e,t){let n={};for(let o in e){let c=e[o];if(t?.hasOwnProperty(o)){let i=t[o](c);i!=null&&Object.assign(n,i);continue}c===!0?n[`data-${o.toLowerCase()}`]="":c&&(n[`data-${o.toLowerCase()}`]=c.toString())}return n}r(K,"getStateAttributesProps");function q(e,t){return typeof e=="function"?e(t):e}r(q,"resolveClassName");function Q(e,t){return typeof e=="function"?e(t):e}r(Q,"resolveStyle");var T=E(y(),1);function qe(e,t,n={}){let o=t.render,c=se(t,n);if(n.enabled===!1)return null;let i=n.state??p;return de(e,o,c,i)}r(qe,"useRenderElement");function se(e,t={}){let{className:n,style:o,render:c}=e,{state:i=p,ref:u,props:v,stateAttributesMapping:N,enabled:s=!0}=t,l=s?q(n,i):void 0,f=s?Q(o,i):void 0,d=s?K(i,N):p,A=s&&v?ue(v):void 0,a=s?b(d,A)??{}:p;return typeof document<"u"&&(s?Array.isArray(u)?a.ref=z([a.ref,V(c),...u]):a.ref=x(a.ref,V(c),u):x(null,null)),s?(l!==void 0&&(a.className=O(a.className,l)),f!==void 0&&(a.style=b(a.style,f)),a):p}r(se,"useRenderElementProps");function ue(e){return Array.isArray(e)?M(e):P(void 0,e)}r(ue,"resolveRenderFunctionProps");var ae=Symbol.for("react.lazy"),le=/^[A-Z][A-Za-z0-9$]*$/,fe=/[a-z]/;function de(e,t,n,o){if(t){if(typeof t=="function")return me(t),t(n,o);let c=P(n,t.props);c.ref=n.ref;let i=t;if(i?.$$typeof===ae&&(i=m.Children.toArray(t)[0]),!m.isValidElement(i))throw new Error(["Base UI: The `render` prop was provided an invalid React element as `React.isValidElement(render)` is `false`.","A valid React element must be provided to the `render` prop because it is cloned with props to replace the default element.","https://base-ui.com/r/invalid-render-prop"].join(`
|
|
2
|
+
`));return m.cloneElement(i,c)}if(e&&typeof e=="string")return pe(e,n);throw new Error("Base UI: Render element or function are not defined.")}r(de,"evaluateRenderProp");function me(e){let t=e.name;t.length!==0&&le.test(t)&&fe.test(t)&&J(`The \`render\` prop received a function named \`${t}\` that starts with an uppercase letter.`,"This usually means a React component was passed directly as `render={Component}`.","Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.","If this is an intentional render callback, rename it to start with a lowercase letter.","Use `render={<Component />}` or `render={(props) => <Component {...props} />}` instead.","https://base-ui.com/r/invalid-render-prop")}r(me,"warnIfRenderPropLooksLikeComponent");function pe(e,t){return e==="button"?(0,T.createElement)("button",{type:"button",...t,key:t.key}):e==="img"?(0,T.createElement)("img",{alt:"",...t,key:t.key}):m.createElement(e,t)}r(pe,"renderTag");var X=r(e=>typeof e=="boolean"?`${e}`:e===0?"0":e,"falsyToString"),ee=j,tt=r((e,t)=>n=>{var o;if(t?.variants==null)return ee(e,n?.class,n?.className);let{variants:c,defaultVariants:i}=t,u=Object.keys(c).map(s=>{let l=n?.[s],f=i?.[s];if(l===null)return null;let d=X(l)||X(f);return c[s][d]}),v=n&&Object.entries(n).reduce((s,l)=>{let[f,d]=l;return d===void 0||(s[f]=d),s},{}),N=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((s,l)=>{let{class:f,className:d,...A}=l;return Object.entries(A).every(a=>{let[k,g]=a;return Array.isArray(g)?g.includes({...i,...v}[k]):{...i,...v}[k]===g})?[...s,f,d]:s},[]);return ee(e,u,N,n?.class,n?.className)},"cva");export{P as a,$ as b,w as c,x as d,G as e,J as f,Te as g,ke as h,p as i,qe as j,tt as k};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as o}from"./chunk-RRCPZMC2.js";var f=new Set(["contains","eq","gt","gte","lt","lte","ne"]),i=o(t=>{if(typeof t!="string")return;let r=t.trim();return r===""?void 0:r},"stringParameter"),g=o(t=>{if(t===null||typeof t!="object")return!1;let r=t;return typeof r.column=="string"&&typeof r.operator=="string"&&f.has(r.operator)},"isFilterClause"),l=o(t=>{if(typeof t!="string"||t==="")return[];try{let r=JSON.parse(t);return Array.isArray(r)?r.filter(g):[]}catch{return[]}},"parseFilters"),c=o(t=>{if(typeof t!="string"||t==="")return;let r=t.lastIndexOf(":");if(r<=0)return;let e=t.slice(0,r),s=t.slice(r+1);if(!(s!=="asc"&&s!=="desc"))return{column:e,direction:s}},"parseOrder"),u=o(t=>{let r={};t.schema==="global"&&(r.schema="global");let e=i(t.table);e!==void 0&&(r.table=e);let s=i(t.shard);s!==void 0&&(r.shard=s);let d=i(t.search);d!==void 0&&(r.search=d);let n=i(t.order);n!==void 0&&c(n)!==void 0&&(r.order=n);let a=i(t.filters);return a!==void 0&&l(a).length>0&&(r.filters=a),r},"validateDataViewSearch"),h=o(t=>{let r=l(t.filters),e=c(t.order);return{filters:r.length>0?r:void 0,orderBy:e,search:typeof t.search=="string"&&t.search!==""?t.search:void 0,shard:typeof t.shard=="string"&&t.shard!==""?t.shard:void 0,table:typeof t.table=="string"&&t.table!==""?t.table:void 0,tier:t.schema==="global"?"global":"shard"}},"searchToDataView"),b=o(t=>{let r=t.filters??[];return{filters:r.length>0?JSON.stringify(r):void 0,order:t.orderBy===void 0?void 0:`${t.orderBy.column}:${t.orderBy.direction}`,schema:t.tier==="global"?"global":void 0,search:t.search!==void 0&&t.search!==""?t.search:void 0,shard:t.shard!==void 0&&t.shard!==""?t.shard:void 0,table:t.table!==void 0&&t.table!==""?t.table:void 0}},"dataViewToSearch");export{u as a,h as b,b as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as Ae}from"./chunk-P7DSVO4U.js";import{a as we}from"./chunk-J6J54MBP.js";import{a as ve,b as ge,c as pe,d as K,e as O,f as T}from"./chunk-GTM65MVX.js";import{c as fe}from"./chunk-YQQJ4N6U.js";import"./chunk-TICVNLPM.js";import{a as he}from"./chunk-TAD43CG5.js";import{a as re}from"./chunk-FCR3HKFV.js";import{a as me,e as ue}from"./chunk-SEU5V7I6.js";import"./chunk-ZH7UES4T.js";import{f as xe}from"./chunk-KODWGUAB.js";import"./chunk-3OA7PECS.js";import{d as ce,h as w,i as ye,l as ze}from"./chunk-YJGANMU7.js";import{a as o,e as de,f as Oe,g as Te,h as _e}from"./chunk-RRCPZMC2.js";var be=de(Te(),1);var Ie=de(Oe(),1);var i=de(_e(),1);var Ce=o(e=>{let t=(0,be.c)(35),{actionLabel:l,actionPrefix:f,columns:p,heading:r,onAction:_,rowPrefix:b,rows:I,testId:N}=e,A=ce(),n;t[0]!==r?(n=(0,i.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,i.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r},void 0,!1)},void 0,!1),t[0]=r,t[1]=n):n=t[1];let m;t[2]!==p?(m=p.map($e),t[2]=p,t[3]=m):m=t[3];let u;t[4]!==A?(u=A("Actions"),t[4]=A,t[5]=u):u=t[5];let x;t[6]!==u?(x=(0,i.jsxDEV)(O,{"aria-label":u},void 0,!1),t[6]=u,t[7]=x):x=t[7];let h;t[8]!==m||t[9]!==x?(h=(0,i.jsxDEV)(ge,{children:(0,i.jsxDEV)(K,{children:[m,x]},void 0,!0)},void 0,!1),t[8]=m,t[9]=x,t[10]=h):h=t[10];let s;if(t[11]!==l||t[12]!==f||t[13]!==p||t[14]!==_||t[15]!==b||t[16]!==I){let d;t[18]!==l||t[19]!==f||t[20]!==p||t[21]!==_||t[22]!==b?(d=o($=>{let z=w($.id);return(0,i.jsxDEV)(K,{"data-testid":`${b}-${z}`,children:[p.map(P=>(0,i.jsxDEV)(T,{children:P.render($)},P.head,!1)),(0,i.jsxDEV)(T,{children:(0,i.jsxDEV)(fe,{"data-testid":`${f}-${z}`,onClick:o(()=>{_(z)},"onClick"),size:"xs",type:"button",variant:"ghost",children:l},void 0,!1)},void 0,!1)]},z,!0)},"t72"),t[18]=l,t[19]=f,t[20]=p,t[21]=_,t[22]=b,t[23]=d):d=t[23],s=I.map(d),t[11]=l,t[12]=f,t[13]=p,t[14]=_,t[15]=b,t[16]=I,t[17]=s}else s=t[17];let v;t[24]!==s?(v=(0,i.jsxDEV)(pe,{children:s},void 0,!1),t[24]=s,t[25]=v):v=t[25];let g;t[26]!==h||t[27]!==v?(g=(0,i.jsxDEV)(ue,{className:"px-0",children:(0,i.jsxDEV)(ve,{children:[h,v]},void 0,!0)},void 0,!1),t[26]=h,t[27]=v,t[28]=g):g=t[28];let y;t[29]!==n||t[30]!==g?(y=(0,i.jsxDEV)(me,{className:"overflow-hidden py-0",children:[n,g]},void 0,!0),t[29]=n,t[30]=g,t[31]=y):y=t[31];let C;return t[32]!==y||t[33]!==N?(C=(0,i.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":N,children:y},void 0,!1),t[32]=y,t[33]=N,t[34]=C):C=t[34],C},"OrgRowTable"),Ge=o(()=>{let e=(0,be.c)(95),t=xe(),l=ce(),{capabilities:f,ready:p}=Ae(),[r,_]=(0,Ie.useState)(null),b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b=["lunora-auth-orgs"],e[0]=b):b=e[0];let I;e[1]!==t?(I=o(()=>t.listAuthOrganizations({limit:100}),"t1"),e[1]=t,e[2]=I):I=e[2];let N;e[3]!==f.organization?(N={enabled:f.organization},e[3]=f.organization,e[4]=N):N=e[4];let A=re(b,I,N),n=A.data?.rows??null,m;e[5]!==r?(m=["lunora-auth-org-members",r],e[5]=r,e[6]=m):m=e[6];let u;e[7]!==t||e[8]!==r?(u=o(()=>t.listAuthOrgMembers({limit:200,organizationId:r??""}),"t4"),e[7]=t,e[8]=r,e[9]=u):u=e[9];let x=r!==null,h;e[10]!==x?(h={enabled:x},e[10]=x,e[11]=h):h=e[11];let s=re(m,u,h),v;e[12]!==r?(v=["lunora-auth-org-invitations",r],e[12]=r,e[13]=v):v=e[13];let g;e[14]!==t||e[15]!==r?(g=o(()=>t.listAuthOrgInvitations({limit:200,organizationId:r??""}),"t8"),e[14]=t,e[15]=r,e[16]=g):g=e[16];let y=r!==null,C;e[17]!==y?(C={enabled:y},e[17]=y,e[18]=C):C=e[18];let d=re(v,g,C),$=r===null?null:s.data?.rows??null,z=r===null?null:d.data?.rows??null,P=A.error??s.error??d.error,U;e[19]!==d||e[20]!==s||e[21]!==A||e[22]!==r?(U=o(()=>{A.refetch(),r!==null&&(s.refetch(),d.refetch())},"t11"),e[19]=d,e[20]=s,e[21]=A,e[22]=r,e[23]=U):U=e[23],we(U,f.organization);let W;e[24]===Symbol.for("react.memo_cache_sentinel")?(W=o(a=>{_(a)},"t12"),e[24]=W):W=e[24];let Ne=W,X;e[25]!==d||e[26]!==s?(X=o(a=>{ye((async()=>{await a(),s.refetch(),d.refetch()})())},"t13"),e[25]=d,e[26]=s,e[27]=X):X=e[27];let S=X,Y;e[28]!==t||e[29]!==S?(Y=o(a=>{S(()=>t.removeAuthOrgMember({memberId:a}))},"t14"),e[28]=t,e[29]=S,e[30]=Y):Y=e[30];let oe=Y,Z;e[31]!==t||e[32]!==S?(Z=o(a=>{S(()=>t.cancelAuthOrgInvitation({invitationId:a}))},"t15"),e[31]=t,e[32]=S,e[33]=Z):Z=e[33];let ae=Z,M;e[34]!==l?(M=l("userId"),e[34]=l,e[35]=M):M=e[35];let R;e[36]!==M?(R={head:M,render:Pe},e[36]=M,e[37]=R):R=e[37];let E;e[38]!==l?(E=l("role"),e[38]=l,e[39]=E):E=e[39];let L;e[40]!==E?(L={head:E,render:Se},e[40]=E,e[41]=L):L=e[41];let ee;e[42]!==R||e[43]!==L?(ee=[R,L],e[42]=R,e[43]=L,e[44]=ee):ee=e[44];let ne=ee,Q;e[45]!==l?(Q=l("email"),e[45]=l,e[46]=Q):Q=e[46];let k;e[47]!==Q?(k={head:Q,render:Me},e[47]=Q,e[48]=k):k=e[48];let B;e[49]!==l?(B=l("role"),e[49]=l,e[50]=B):B=e[50];let H;e[51]!==B?(H={head:B,render:Re},e[51]=B,e[52]=H):H=e[52];let j;e[53]!==l?(j=l("status"),e[53]=l,e[54]=j):j=e[54];let D;e[55]!==j?(D={head:j,render:Ee},e[55]=j,e[56]=D):D=e[56];let te;e[57]!==k||e[58]!==H||e[59]!==D?(te=[k,H,D],e[57]=k,e[58]=H,e[59]=D,e[60]=te):te=e[60];let se=te;if(p&&!f.organization){let a;e[61]!==l?(a=l("Enable the organization() plugin in your auth config to manage organizations here."),e[61]=l,e[62]=a):a=e[62];let c;e[63]!==l?(c=l("Organizations are not enabled."),e[63]=l,e[64]=c):c=e[64];let ie;return e[65]!==a||e[66]!==c?(ie=(0,i.jsxDEV)(he,{description:a,testId:"org-disabled",title:c},void 0,!1),e[65]=a,e[66]=c,e[67]=ie):ie=e[67],ie}let F;e[68]!==P?(F=P!==null&&(0,i.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"org-error",role:"alert",children:P},void 0,!1),e[68]=P,e[69]=F):F=e[69];let V;e[70]!==n||e[71]!==l?(V=n!==null&&n.length===0&&(0,i.jsxDEV)(he,{testId:"org-empty",title:l("No organizations.")},void 0,!1),e[70]=n,e[71]=l,e[72]=V):V=e[72];let q;e[73]!==n||e[74]!==r||e[75]!==l?(q=n!==null&&n.length>0&&(0,i.jsxDEV)(me,{className:"overflow-hidden py-0",children:(0,i.jsxDEV)(ue,{className:"px-0",children:(0,i.jsxDEV)(ve,{"data-testid":"org-table",children:[(0,i.jsxDEV)(ge,{children:(0,i.jsxDEV)(K,{children:[(0,i.jsxDEV)(O,{children:l("id")},void 0,!1),(0,i.jsxDEV)(O,{children:l("name")},void 0,!1),(0,i.jsxDEV)(O,{children:l("slug")},void 0,!1),(0,i.jsxDEV)(O,{children:l("created")},void 0,!1),(0,i.jsxDEV)(O,{"aria-label":l("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,i.jsxDEV)(pe,{children:n.map(a=>{let c=w(a.id);return(0,i.jsxDEV)(K,{"data-testid":`org-row-${c}`,children:[(0,i.jsxDEV)(T,{className:"font-mono text-xs",children:c},void 0,!1),(0,i.jsxDEV)(T,{children:w(a.name)},void 0,!1),(0,i.jsxDEV)(T,{children:w(a.slug)},void 0,!1),(0,i.jsxDEV)(T,{className:"text-muted-foreground tabular-nums",children:ze(a.createdAt)},void 0,!1),(0,i.jsxDEV)(T,{children:(0,i.jsxDEV)(fe,{"aria-pressed":r===c,"data-testid":`org-select-${c}`,onClick:o(()=>{Ne(c)},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Members")},void 0,!1)},void 0,!1)]},c,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[73]=n,e[74]=r,e[75]=l,e[76]=q):q=e[76];let G;e[77]!==ne||e[78]!==$||e[79]!==oe||e[80]!==r||e[81]!==l?(G=r!==null&&$!==null&&(0,i.jsxDEV)(Ce,{actionLabel:l("Remove"),actionPrefix:"org-remove-member",columns:ne,heading:l("Members"),onAction:oe,rowPrefix:"org-member",rows:$,testId:"org-members"},void 0,!1),e[77]=ne,e[78]=$,e[79]=oe,e[80]=r,e[81]=l,e[82]=G):G=e[82];let J;e[83]!==se||e[84]!==z||e[85]!==ae||e[86]!==r||e[87]!==l?(J=r!==null&&z!==null&&z.length>0&&(0,i.jsxDEV)(Ce,{actionLabel:l("Cancel"),actionPrefix:"org-cancel-invitation",columns:se,heading:l("Invitations"),onAction:ae,rowPrefix:"org-invitation",rows:z,testId:"org-invitations"},void 0,!1),e[83]=se,e[84]=z,e[85]=ae,e[86]=r,e[87]=l,e[88]=J):J=e[88];let le;return e[89]!==F||e[90]!==V||e[91]!==q||e[92]!==G||e[93]!==J?(le=(0,i.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-organizations",children:[F,V,q,G,J]},void 0,!0),e[89]=F,e[90]=V,e[91]=q,e[92]=G,e[93]=J,e[94]=le):le=e[94],le},"OrganizationsPanel");function $e(e){return(0,i.jsxDEV)(O,{children:e.head},e.head,!1)}o($e,"_temp");function Pe(e){return w(e.userId)}o(Pe,"_temp2");function Se(e){return w(e.role)}o(Se,"_temp3");function Me(e){return w(e.email)}o(Me,"_temp4");function Re(e){return w(e.role)}o(Re,"_temp5");function Ee(e){return w(e.status)}o(Ee,"_temp6");export{Ge as OrganizationsPanel};
|