@lunora/studio 1.0.0-alpha.394 → 1.0.0-alpha.395
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/README.md +2 -0
- package/dist/index.mjs +1 -1
- package/dist/mount.mjs +1 -1
- package/dist/packem_chunks/ai-knowledge.mjs +1 -1
- package/dist/packem_shared/StudioApp-CmlMUUAq.mjs +1 -0
- package/dist/standalone/{chunk-AWMHWVF7.js → chunk-2ASCHUYZ.js} +1 -1
- package/dist/standalone/{chunk-BTHVLHPT.js → chunk-2GY7PZLR.js} +1 -1
- package/dist/standalone/{chunk-DUICFFES.js → chunk-2Q2YW6DP.js} +1 -1
- package/dist/standalone/{chunk-YQI2YAD7.js → chunk-2SQ4R6JF.js} +1 -1
- package/dist/standalone/{chunk-Y4KOJPOW.js → chunk-2V76BRXG.js} +1 -1
- package/dist/standalone/{chunk-U4ZQVQZA.js → chunk-37QBGHAB.js} +1 -1
- package/dist/standalone/{chunk-YREHZBTG.js → chunk-37YN7GKB.js} +1 -1
- package/dist/standalone/{chunk-4Z2GLDF7.js → chunk-3FRO43CC.js} +1 -1
- package/dist/standalone/chunk-3NPH3ZH2.js +1 -0
- package/dist/standalone/{chunk-DRSX6KR3.js → chunk-3SFU5VY4.js} +1 -1
- package/dist/standalone/{chunk-YC3TUO5H.js → chunk-3WPPFTDC.js} +1 -1
- package/dist/standalone/{chunk-BUYKTV27.js → chunk-43LNUM4U.js} +1 -1
- package/dist/standalone/{chunk-HCLUIJMW.js → chunk-4A6J4C6A.js} +1 -1
- package/dist/standalone/chunk-4DZXYINC.js +1 -0
- package/dist/standalone/{chunk-26RNXTU3.js → chunk-4EJG4J2A.js} +1 -1
- package/dist/standalone/{chunk-BCT3KY76.js → chunk-4FTKFUPJ.js} +1 -1
- package/dist/standalone/{chunk-SQO3WGXH.js → chunk-4L2BABMS.js} +1 -1
- package/dist/standalone/{chunk-A33FOU2H.js → chunk-5BI76KCT.js} +1 -1
- package/dist/standalone/{chunk-BMGMBZAW.js → chunk-5IFJNGRV.js} +1 -1
- package/dist/standalone/{chunk-PT4GNZU7.js → chunk-5JCH67JD.js} +1 -1
- package/dist/standalone/{chunk-JCJCUWVN.js → chunk-5KNYRYVI.js} +1 -1
- package/dist/standalone/{chunk-5J2UX2CO.js → chunk-5PWQ7HBE.js} +1 -1
- package/dist/standalone/{chunk-JXW6H6LE.js → chunk-6CVUGL2K.js} +1 -1
- package/dist/standalone/{chunk-IC2PEYF7.js → chunk-6E2GHT3X.js} +1 -1
- package/dist/standalone/chunk-6MAIN66N.js +1 -0
- package/dist/standalone/{chunk-3GBBYV7C.js → chunk-6OE7TT2Y.js} +1 -1
- package/dist/standalone/{chunk-T6YZEXZO.js → chunk-6PQX7SHZ.js} +1 -1
- package/dist/standalone/{chunk-PVQDT47U.js → chunk-6QP547WA.js} +1 -1
- package/dist/standalone/chunk-7EUM7G2I.js +33 -0
- package/dist/standalone/{chunk-EEDAK4NS.js → chunk-7TGL5VXY.js} +1 -1
- package/dist/standalone/{chunk-TNQHMR76.js → chunk-7UN2ZZZV.js} +1 -1
- package/dist/standalone/{chunk-7URG6FZD.js → chunk-AFOBKJOK.js} +1 -1
- package/dist/standalone/{chunk-BFV46XUH.js → chunk-AGM656HF.js} +1 -1
- package/dist/standalone/{chunk-EBGXOUAO.js → chunk-AHX6CSR3.js} +1 -1
- package/dist/standalone/{chunk-2Q4WVEPB.js → chunk-AK6ZI3YN.js} +1 -1
- package/dist/standalone/{chunk-VLQU4G6O.js → chunk-AL5S7LVU.js} +1 -1
- package/dist/standalone/{chunk-M6WDFEUZ.js → chunk-B65U64C3.js} +1 -1
- package/dist/standalone/{chunk-PWHUPKZB.js → chunk-B7W7O2RS.js} +1 -1
- package/dist/standalone/chunk-BD76RVBZ.js +7 -0
- package/dist/standalone/{chunk-ZARTCW6W.js → chunk-BGU4O7PL.js} +1 -1
- package/dist/standalone/{chunk-VUWHTKLJ.js → chunk-BNDXMSLI.js} +1 -1
- package/dist/standalone/{chunk-ZG6VEBVA.js → chunk-BYUH4YAY.js} +1 -1
- package/dist/standalone/{chunk-N3MKRANL.js → chunk-CKGUHRV2.js} +1 -1
- package/dist/standalone/{chunk-ADOZBBJC.js → chunk-DL5ZVSGL.js} +1 -1
- package/dist/standalone/{chunk-TAZRDWQE.js → chunk-EE6QEAGV.js} +1 -1
- package/dist/standalone/{chunk-5BTQ4VV2.js → chunk-EGO7EG33.js} +1 -1
- package/dist/standalone/{chunk-AFUJCRWR.js → chunk-EHQ2LCCB.js} +1 -1
- package/dist/standalone/{chunk-HXWW3XML.js → chunk-FGAXBLHE.js} +1 -1
- package/dist/standalone/{chunk-K3HWPNON.js → chunk-FHR4JFT7.js} +1 -1
- package/dist/standalone/{chunk-EH53XOVI.js → chunk-G237Z4YL.js} +1 -1
- package/dist/standalone/{chunk-WVAWKCNQ.js → chunk-H4NGBPG2.js} +1 -1
- package/dist/standalone/{chunk-RRIRWVQY.js → chunk-I6TDZTVT.js} +1 -1
- package/dist/standalone/{chunk-QJ3M3IQW.js → chunk-IB4M4AI2.js} +1 -1
- package/dist/standalone/{chunk-S3HFNWDK.js → chunk-IGQXAWBB.js} +1 -1
- package/dist/standalone/{chunk-5XQM44J7.js → chunk-IGSYGAHI.js} +1 -1
- package/dist/standalone/{chunk-J2SIGUHW.js → chunk-IJAV3RXF.js} +1 -1
- package/dist/standalone/{chunk-NFIFRB3W.js → chunk-IT3JTYC4.js} +1 -1
- package/dist/standalone/{chunk-D4CP2AUO.js → chunk-J2IFOOCG.js} +1 -1
- package/dist/standalone/{chunk-YQEIOEEC.js → chunk-JARVMFE6.js} +1 -1
- package/dist/standalone/{chunk-WARWYT4K.js → chunk-JCHZNPJU.js} +1 -1
- package/dist/standalone/{chunk-2ZNMZPPZ.js → chunk-JGSHDQGZ.js} +1 -1
- package/dist/standalone/{chunk-EYFAYJYD.js → chunk-KHNHN37V.js} +1 -1
- package/dist/standalone/{chunk-ECXQQPVU.js → chunk-LTWCT32V.js} +1 -1
- package/dist/standalone/{chunk-HPQLTLIE.js → chunk-LVWOITSU.js} +1 -1
- package/dist/standalone/{chunk-TIFTYP3Z.js → chunk-M2NWC7G3.js} +1 -1
- package/dist/standalone/{chunk-MEYZIZGX.js → chunk-M2SFKF5Z.js} +1 -1
- package/dist/standalone/{chunk-S3WL3QZ2.js → chunk-MCJCCS7G.js} +1 -1
- package/dist/standalone/chunk-MYIUZ3KE.js +1 -0
- package/dist/standalone/{chunk-TDF4VVIF.js → chunk-N6F3WFL4.js} +1 -1
- package/dist/standalone/{chunk-FSY7UKMG.js → chunk-NBJ6DCHA.js} +1 -1
- package/dist/standalone/{chunk-QRXJTY2S.js → chunk-NJMFSHMW.js} +1 -1
- package/dist/standalone/{chunk-4OWWWAMB.js → chunk-OGRACGHY.js} +1 -1
- package/dist/standalone/{chunk-ZSXJJYWN.js → chunk-OSYCXIGN.js} +1 -1
- package/dist/standalone/{chunk-FRKRT73U.js → chunk-P5SHS466.js} +1 -1
- package/dist/standalone/{chunk-RIRXDYLA.js → chunk-PIFKJ3ES.js} +1 -1
- package/dist/standalone/chunk-QE2BYD4G.js +1 -0
- package/dist/standalone/{chunk-C4PC3TVC.js → chunk-QJH6HTCT.js} +1 -1
- package/dist/standalone/{chunk-OEPNNICC.js → chunk-RELSLYVS.js} +1 -1
- package/dist/standalone/{chunk-CBFVQCWS.js → chunk-REZHNEUN.js} +1 -1
- package/dist/standalone/{chunk-3BDGZAZD.js → chunk-RG5MG5I4.js} +1 -1
- package/dist/standalone/{chunk-5FHGTA7V.js → chunk-SFGYW6JZ.js} +1 -1
- package/dist/standalone/{chunk-UB6S6VYI.js → chunk-STKYARMP.js} +1 -1
- package/dist/standalone/{chunk-A7L3PZEL.js → chunk-THCO2YN5.js} +1 -1
- package/dist/standalone/{chunk-KEHWNM7Q.js → chunk-TPY5BJYD.js} +1 -1
- package/dist/standalone/{chunk-HLN47VMG.js → chunk-TWOO3G2Q.js} +1 -1
- package/dist/standalone/{chunk-LUHBGCMO.js → chunk-U7U4ADXH.js} +1 -1
- package/dist/standalone/{chunk-MLX6ME3Q.js → chunk-UWJXX5AV.js} +1 -1
- package/dist/standalone/{chunk-UHFZV34O.js → chunk-V335NVH7.js} +1 -1
- package/dist/standalone/{chunk-HE2XT2P7.js → chunk-V4X27TLH.js} +1 -1
- package/dist/standalone/{chunk-E32WBVTB.js → chunk-VAZ2FZKT.js} +1 -1
- package/dist/standalone/{chunk-WY23EROJ.js → chunk-VKBLXJIZ.js} +1 -1
- package/dist/standalone/{chunk-XWLURY4U.js → chunk-VUC5V5XF.js} +1 -1
- package/dist/standalone/{chunk-7XZENNML.js → chunk-WC2DKA2R.js} +1 -1
- package/dist/standalone/{chunk-4WFEKKAZ.js → chunk-X7ZYE4GP.js} +1 -1
- package/dist/standalone/{chunk-KJHVB5KM.js → chunk-XACKMLPO.js} +1 -1
- package/dist/standalone/{chunk-EOTHFTZG.js → chunk-YCZQNUZV.js} +1 -1
- package/dist/standalone/chunk-YIZDDGWA.js +1 -0
- package/dist/standalone/{chunk-VEG327ST.js → chunk-YNO5YLZT.js} +5 -5
- package/dist/standalone/chunk-YQJIG7QG.js +167 -0
- package/dist/standalone/{chunk-HPCOC223.js → chunk-YRC2DXSL.js} +1 -1
- package/dist/standalone/{chunk-VND72OIC.js → chunk-YUENB45T.js} +1 -1
- package/dist/standalone/{chunk-F4NZZ3LK.js → chunk-YYRXX5Z4.js} +1 -1
- package/dist/standalone/chunk-Z2ERBKWN.js +1 -0
- package/dist/standalone/{chunk-VUMS4VIV.js → chunk-ZBAR562M.js} +1 -1
- package/dist/standalone/{chunk-V5ZKAZR6.js → chunk-ZKEXJDGJ.js} +1 -1
- package/dist/standalone/{chunk-BADHCM45.js → chunk-ZO6KBU54.js} +1 -1
- package/dist/standalone/{chunk-5YEMXXQZ.js → chunk-ZQGRGSI7.js} +1 -1
- package/dist/standalone/studio.js +5 -5
- package/dist/styles.css +1 -1
- package/package.json +4 -4
- package/dist/packem_shared/StudioApp-DKBDIF7N.mjs +0 -1
- package/dist/standalone/chunk-C57KLL4U.js +0 -1
- package/dist/standalone/chunk-G4H5DPO6.js +0 -33
- package/dist/standalone/chunk-GATWEWRW.js +0 -1
- package/dist/standalone/chunk-HQJXQWJM.js +0 -1
- package/dist/standalone/chunk-JSVT5VBU.js +0 -1
- package/dist/standalone/chunk-KQ6YQP3Z.js +0 -1
- package/dist/standalone/chunk-OZUPOUHR.js +0 -1
- package/dist/standalone/chunk-PLCYDHU3.js +0 -7
- package/dist/standalone/chunk-UG6ZNYWH.js +0 -167
- package/dist/standalone/chunk-ZUFBUWT4.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as O}from"./chunk-
|
|
1
|
+
import{a as O}from"./chunk-SFGYW6JZ.js";import{a as C}from"./chunk-TPY5BJYD.js";import{a as c}from"./chunk-ZKEXJDGJ.js";import{b as N}from"./chunk-STKYARMP.js";import"./chunk-DMQVY5L7.js";import{a as k}from"./chunk-OGRACGHY.js";import"./chunk-IGSYGAHI.js";import{a as w,b as T,c as A,d as f,e as s,f as l}from"./chunk-H4NGBPG2.js";import"./chunk-YUENB45T.js";import"./chunk-AL5S7LVU.js";import"./chunk-EOFWXI3T.js";import{a as v}from"./chunk-LYVYUTQY.js";import{c as p}from"./chunk-U7U4ADXH.js";import{a as b,e as S}from"./chunk-ZBAR562M.js";import"./chunk-BD76RVBZ.js";import"./chunk-VKBLXJIZ.js";import{B as y}from"./chunk-7EUM7G2I.js";import"./chunk-Z2ERBKWN.js";import"./chunk-A6TVTNKO.js";import{a as R,b as V}from"./chunk-ADABTCDI.js";import{a as n,d as x}from"./chunk-5PEAXTYQ.js";var F=x(R(),1);var e=x(V(),1);var $=n(a=>{let t=a.trim();if(t.length===0)return{context:void 0,error:null};try{let o=JSON.parse(t);return o===null||typeof o!="object"||Array.isArray(o)?{context:void 0,error:"Targeting context must be a JSON object."}:{context:o,error:null}}catch{return{context:void 0,error:"Targeting context is not valid JSON."}}},"H"),q='{ "targetingKey": "user-123", "plan": "premium" }',D=n(a=>a.type==="object"?JSON.stringify(a.value):String(a.value),"R"),Y=n(({initialShardKey:a=""})=>{let t=y(),[o,j]=(0,F.useState)(""),{context:g,error:m}=$(o),I=g===void 0?{}:{context:g},{data:i,error:J,errorSource:K,liveError:E}=p(v.listFlags,I,{live:!0,shardKey:a}),u=i!==void 0,L=i?.configured??!1,h=Array.isArray(i?.flags)?[...i.flags].toSorted((r,B)=>r.key.localeCompare(B.key)):[],d;return u&&!L?d=(0,e.jsx)(c,{description:t("No @lunora/flags provider is wired in this deployment. Add lunora/flags.ts with defineFlags({ provider }) to gate code paths on feature flags."),testId:"flags-unconfigured",title:t("No flags provider configured")}):u&&h.length===0?d=(0,e.jsx)(c,{description:t('A flags provider is configured, but no handler reads a flag yet. Call ctx.flags.boolean("key", false) in a query, mutation, or action.'),testId:"flags-empty",title:t("No flags read")}):d=(0,e.jsx)(b,{className:"overflow-hidden py-0",children:(0,e.jsx)(S,{className:"px-0",children:(0,e.jsxs)(w,{"data-testid":"flags-table",children:[(0,e.jsx)(T,{children:(0,e.jsxs)(f,{children:[(0,e.jsx)(s,{children:t("Key")}),(0,e.jsx)(s,{children:t("Type")}),(0,e.jsx)(s,{children:t("Value")}),(0,e.jsx)(s,{children:t("Reason")}),(0,e.jsx)(s,{children:t("Variant")})]})}),(0,e.jsx)(A,{children:h.map(r=>(0,e.jsxs)(f,{"data-testid":`flags-row-${r.key}`,children:[(0,e.jsx)(l,{className:"font-mono text-xs",children:r.key}),(0,e.jsx)(l,{className:"font-mono text-xs text-muted-foreground",children:r.type}),(0,e.jsx)(l,{className:"font-mono text-xs",children:D(r)}),(0,e.jsx)(l,{children:r.errorCode===void 0?(0,e.jsx)("span",{className:"font-mono text-xs text-muted-foreground",children:r.reason??"\u2014"}):(0,e.jsx)(N,{"data-testid":`flags-error-${r.key}`,variant:"destructive",children:r.errorCode})}),(0,e.jsx)(l,{className:"font-mono text-xs text-muted-foreground",children:r.variant??"\u2014"})]},r.key))})]})})}),(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-flags-panel",children:[J!==null&&(0,e.jsx)(k,{error:K,shardKey:a,testId:"flags-error"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:t('Feature flags are read in code with ctx.flags.<type>("key", default). They evaluate through the OpenFeature provider configured in lunora/flags.ts; edit the targeting context below to see how each flag resolves for a given audience.')}),(0,e.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,e.jsx)(C,{htmlFor:"flags-targeting-context",children:t("Targeting context (JSON)")}),(0,e.jsx)(O,{className:"font-mono text-xs","data-testid":"flags-context-input",id:"flags-targeting-context",onChange:n(r=>{j(r.target.value)},"onChange"),placeholder:q,rows:3,value:o}),m!==null&&(0,e.jsx)("p",{className:"text-xs text-destructive","data-testid":"flags-context-error",role:"alert",children:t(m)}),E!==void 0&&(0,e.jsx)("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"flags-live-error",role:"alert",children:t("Live updates unavailable; showing the last evaluation.")})]}),d]})},"W");export{Y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as H}from"./chunk-
|
|
1
|
+
import{j as H}from"./chunk-4L2BABMS.js";import"./chunk-R76ATTPC.js";import"./chunk-4AG356VE.js";import{a as G}from"./chunk-LTWCT32V.js";import"./chunk-EOHXBC4U.js";import"./chunk-JEJV6SVN.js";import{a as J}from"./chunk-ZKEXJDGJ.js";import"./chunk-DMQVY5L7.js";import{a as Q,b as W,c as Z,d as V,e as I,f as S}from"./chunk-H4NGBPG2.js";import{a as F,e as K}from"./chunk-ZBAR562M.js";import{n as D}from"./chunk-BD76RVBZ.js";import"./chunk-VKBLXJIZ.js";import{B,j as $,r as A,s as z}from"./chunk-7EUM7G2I.js";import"./chunk-Z2ERBKWN.js";import{a as X}from"./chunk-A6TVTNKO.js";import{a as U,b as Y}from"./chunk-ADABTCDI.js";import{a as k,d as M}from"./chunk-5PEAXTYQ.js";var L=M(X(),1),g=M(U(),1);var t=M(Y(),1);var _=10,E=k(h=>{let e=(0,L.c)(7),{label:i,value:l}=h,r;e[0]!==i?(r=(0,t.jsx)("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:i}),e[0]=i,e[1]=r):r=e[1];let a=l??"\u2014",n;e[2]!==a?(n=(0,t.jsx)("span",{className:"font-mono text-sm",children:a}),e[2]=a,e[3]=n):n=e[3];let s;return e[4]!==r||e[5]!==n?(s=(0,t.jsxs)("div",{className:"flex flex-col gap-0.5",children:[r,n]}),e[4]=r,e[5]=n,e[6]=s):s=e[6],s},"_"),ee=k(h=>{let e=(0,L.c)(38),{indexes:i,onSelect:l,selected:r}=h,a=B(),n;e[0]!==a?(n=a("name"),e[0]=a,e[1]=n):n=e[1];let s;e[2]!==n?(s=(0,t.jsx)(I,{children:n}),e[2]=n,e[3]=s):s=e[3];let c;e[4]!==a?(c=a("table"),e[4]=a,e[5]=c):c=e[5];let o;e[6]!==c?(o=(0,t.jsx)(I,{children:c}),e[6]=c,e[7]=o):o=e[7];let d;e[8]!==a?(d=a("dimensions"),e[8]=a,e[9]=d):d=e[9];let x;e[10]!==d?(x=(0,t.jsx)(I,{children:d}),e[10]=d,e[11]=x):x=e[11];let m;e[12]!==a?(m=a("metric"),e[12]=a,e[13]=m):m=e[13];let p;e[14]!==m?(p=(0,t.jsx)(I,{children:m}),e[14]=m,e[15]=p):p=e[15];let u;e[16]!==a?(u=a("vectors"),e[16]=a,e[17]=u):u=e[17];let v;e[18]!==u?(v=(0,t.jsx)(I,{children:u}),e[18]=u,e[19]=v):v=e[19];let C;e[20]!==v||e[21]!==s||e[22]!==o||e[23]!==x||e[24]!==p?(C=(0,t.jsx)(W,{children:(0,t.jsxs)(V,{children:[s,o,x,p,v]})}),e[20]=v,e[21]=s,e[22]=o,e[23]=x,e[24]=p,e[25]=C):C=e[25];let y;if(e[26]!==i||e[27]!==l||e[28]!==r){let q;e[30]!==l||e[31]!==r?(q=k(w=>(0,t.jsxs)(V,{className:w.name===r?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-index":w.name,"data-testid":`vector-row-${w.name}`,onClick:l,children:[(0,t.jsx)(S,{className:"font-mono text-xs",children:w.name}),(0,t.jsx)(S,{className:"font-mono text-xs",children:w.table}),(0,t.jsx)(S,{className:"tabular-nums",children:w.dimensions??"\u2014"}),(0,t.jsx)(S,{children:w.metric??"\u2014"}),(0,t.jsx)(S,{className:"tabular-nums",children:w.vectorsCount??"\u2014"})]},w.name),"q"),e[30]=l,e[31]=r,e[32]=q):q=e[32],y=i.map(q),e[26]=i,e[27]=l,e[28]=r,e[29]=y}else y=e[29];let N;e[33]!==y?(N=(0,t.jsx)(Z,{children:y}),e[33]=y,e[34]=N):N=e[34];let f;return e[35]!==C||e[36]!==N?(f=(0,t.jsx)(F,{className:"overflow-hidden py-0",children:(0,t.jsx)(K,{className:"px-0",children:(0,t.jsxs)(Q,{"data-testid":"vector-table",children:[C,N]})})}),e[35]=C,e[36]=N,e[37]=f):f=e[37],f},"X"),te=k(h=>{let e=(0,L.c)(27),{matches:i}=h,l=B();if(i.length===0){let u;e[0]!==l?(u=l("No matches."),e[0]=l,e[1]=u):u=e[1];let v;return e[2]!==u?(v=(0,t.jsx)("p",{className:"mt-2 text-sm text-muted-foreground","data-testid":"vector-no-matches",children:u}),e[2]=u,e[3]=v):v=e[3],v}let r;e[4]!==l?(r=l("id"),e[4]=l,e[5]=r):r=e[5];let a;e[6]!==r?(a=(0,t.jsx)(I,{children:r}),e[6]=r,e[7]=a):a=e[7];let n;e[8]!==l?(n=l("score"),e[8]=l,e[9]=n):n=e[9];let s;e[10]!==n?(s=(0,t.jsx)(I,{children:n}),e[10]=n,e[11]=s):s=e[11];let c;e[12]!==l?(c=l("metadata"),e[12]=l,e[13]=c):c=e[13];let o;e[14]!==c?(o=(0,t.jsx)(I,{children:c}),e[14]=c,e[15]=o):o=e[15];let d;e[16]!==a||e[17]!==s||e[18]!==o?(d=(0,t.jsx)(W,{children:(0,t.jsxs)(V,{children:[a,s,o]})}),e[16]=a,e[17]=s,e[18]=o,e[19]=d):d=e[19];let x;e[20]!==i?(x=i.map(le),e[20]=i,e[21]=x):x=e[21];let m;e[22]!==x?(m=(0,t.jsx)(Z,{children:x}),e[22]=x,e[23]=m):m=e[23];let p;return e[24]!==d||e[25]!==m?(p=(0,t.jsx)(F,{className:"mt-3 overflow-hidden py-0",children:(0,t.jsx)(K,{className:"px-0",children:(0,t.jsxs)(Q,{"data-testid":"vector-matches",children:[d,m]})})}),e[24]=d,e[25]=m,e[26]=p):p=e[26],p},"Y"),me=k(({loadIndexes:h,runQuery:e}={})=>{let i=D(),l=B(),[r,a]=(0,g.useState)(null),[n,s]=(0,g.useState)(null),[c,o]=(0,g.useState)(null),[d,x]=(0,g.useState)(""),[m,p]=(0,g.useState)(null),[u,v]=(0,g.useState)(null),[C,y]=(0,g.useState)(!1),N=(0,g.useRef)(0);(0,g.useEffect)(()=>{let b={cancelled:!1};return z((async()=>{try{let j=await(h??(()=>i.listVectorIndexes()))();b.cancelled||(a(j),s(null),o(T=>T??j[0]?.name??null))}catch(j){b.cancelled||(a(null),s($(j)))}})()),()=>{b.cancelled=!0}},[i,h]);let f=r?.find(b=>b.name===c)??null,q=k(b=>{N.current+=1,o(b.currentTarget.dataset.index??null),p(null),v(null),y(!1)},"q"),w=k(b=>{x(b.target.value)},"y"),O=k(async()=>{let b=d.trim();if(c===null||b==="")return;N.current+=1;let j=N.current;y(!0),v(null);try{let T=await(e??(R=>i.queryVectorIndex(R)))({name:c,text:b,topK:_});if(j!==N.current)return;p(T)}catch(T){if(j!==N.current)return;p(null),v($(T))}y(!1)},"H"),P=k(()=>{z(O())},"K");return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-vector-browser",children:[n!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"vector-error",role:"alert",children:n}),r!==null&&r.length===0&&(0,t.jsx)(J,{description:l("Indexes declared with .vectorize() or defineVectorIndex() appear here."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 7l8-4 8 4-8 4-8-4Zm0 5 8 4 8-4M4 17l8 4 8-4"})}),testId:"vector-empty",title:l("No vector indexes.")}),r!==null&&r.length>0&&(0,t.jsx)(ee,{indexes:r,onSelect:q,selected:c}),f!==null&&(0,t.jsxs)("section",{className:"border border-border bg-card p-3","data-testid":"vector-detail",children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,t.jsx)(E,{label:l("field"),value:f.field}),(0,t.jsx)(E,{label:l("dimensions"),value:f.dimensions}),(0,t.jsx)(E,{label:l("metric"),value:f.metric}),(0,t.jsx)(E,{label:l("vectors"),value:f.vectorsCount})]}),f.metadata!==void 0&&f.metadata.length>0&&(0,t.jsxs)("p",{className:"mt-3 text-xs text-muted-foreground","data-testid":"vector-metadata",children:[l("metadata"),": ",(0,t.jsx)("span",{className:"font-mono",children:f.metadata.join(", ")})]}),(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,t.jsx)(H,{className:"min-w-[18rem] flex-1","data-testid":"vector-query-input",onChange:w,placeholder:l("Search by similarity\u2026"),value:d}),(0,t.jsx)(G,{"data-testid":"vector-search",disabled:C||d.trim()==="",onClick:P,children:l(C?"Searching\u2026":"Search")})]}),u!==null&&(0,t.jsx)("p",{className:"mt-2 text-sm text-destructive","data-testid":"vector-query-error",role:"alert",children:u}),m!==null&&(0,t.jsx)(te,{matches:m})]})]})},"ue");function le(h){return(0,t.jsxs)(V,{"data-testid":`vector-match-${h.id}`,children:[(0,t.jsx)(S,{className:"font-mono text-xs",children:h.id}),(0,t.jsx)(S,{className:"tabular-nums",children:h.score.toFixed(4)}),(0,t.jsx)(S,{className:"max-w-md truncate font-mono text-xs",children:h.metadata===void 0?"\u2014":A(h.metadata)})]},h.id)}k(le,"ee");export{me as VectorBrowser};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as k,b as y}from"./chunk-LJLNIVUA.js";import{b as N}from"./chunk-
|
|
1
|
+
import{a as k,b as y}from"./chunk-LJLNIVUA.js";import{b as N}from"./chunk-STKYARMP.js";import{B as b,w}from"./chunk-7EUM7G2I.js";import{a as _}from"./chunk-A6TVTNKO.js";import{a as S,b as E}from"./chunk-ADABTCDI.js";import{a as h,d as x}from"./chunk-5PEAXTYQ.js";var v=x(_(),1);var j=x(S(),1);var l=x(E(),1);var F={debug:"secondary",error:"destructive",fatal:"destructive",info:"outline",log:"outline",trace:"outline",warn:"secondary"},L=h(f=>{let e=(0,v.c)(19),{errors:t}=f,i=b(),[r,u]=(0,j.useState)(!1),s,m;if(e[0]!==t||e[1]!==r||e[2]!==i){let g=t.map(B).join(", ");s=r,m=i(r?"Hide the stack and cause of {field}":"Show the stack and cause of {field}",{field:g}),e[0]=t,e[1]=r,e[2]=i,e[3]=s,e[4]=m}else s=e[3],m=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=h(()=>{u(C)},"i"),e[5]=c):c=e[5];let p=r?"\u25BE":"\u25B8",a;e[6]!==i?(a=i("Error details"),e[6]=i,e[7]=a):a=e[7];let n;e[8]!==s||e[9]!==m||e[10]!==p||e[11]!==a?(n=(0,l.jsxs)("button",{"aria-expanded":s,"aria-label":m,className:"shrink-0 pl-2 text-[11px] text-destructive underline-offset-2 hover:underline","data-testid":"lg-error-toggle",onClick:c,type:"button",children:[p," ",a]}),e[8]=s,e[9]=m,e[10]=p,e[11]=a,e[12]=n):n=e[12];let o;e[13]!==t||e[14]!==r?(o=r?(0,l.jsx)("pre",{className:"order-last mt-1 basis-full overflow-x-auto whitespace-pre rounded-md bg-muted/50 p-2 font-mono text-[11px] leading-snug text-muted-foreground","data-testid":"lg-error-detail",children:k(t)}):null,e[13]=t,e[14]=r,e[15]=o):o=e[15];let d;return e[16]!==n||e[17]!==o?(d=(0,l.jsxs)(l.Fragment,{children:[n,o]}),e[16]=n,e[17]=o,e[18]=d):d=e[18],d},"_");function B(f){let[e]=f;return e}h(B,"j");function C(f){return!f}h(C,"F");var q=h(f=>{let e=(0,v.c)(24),{entry:t}=f,i;e[0]!==t.fields?(i=y(t.fields),e[0]=t.fields,e[1]=i):i=e[1];let r=i,u;e[2]!==t.timestamp?(u=w(t.timestamp),e[2]=t.timestamp,e[3]=u):u=e[3];let s;e[4]!==u?(s=(0,l.jsx)("span",{className:"w-44 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:u}),e[4]=u,e[5]=s):s=e[5];let m=F[t.level],c;e[6]!==t.level||e[7]!==m?(c=(0,l.jsx)("span",{className:"w-20 shrink-0",role:"gridcell",children:(0,l.jsx)(N,{variant:m,children:t.level})}),e[6]=t.level,e[7]=m,e[8]=c):c=e[8];let p=t.functionPath??"\u2014",a;e[9]!==p?(a=(0,l.jsx)("span",{className:"w-48 shrink-0 truncate text-muted-foreground",role:"gridcell",children:p}),e[9]=p,e[10]=a):a=e[10];let n;e[11]!==r.text?(n=r.text===""?null:(0,l.jsx)("span",{className:"ml-2 text-muted-foreground","data-testid":"lg-fields",children:r.text}),e[11]=r.text,e[12]=n):n=e[12];let o;e[13]!==t.message||e[14]!==n?(o=(0,l.jsxs)("span",{className:"min-w-0 flex-1 truncate",role:"gridcell",children:[t.message,n]}),e[13]=t.message,e[14]=n,e[15]=o):o=e[15];let d;e[16]!==r.errors?(d=r.errors.length===0?null:(0,l.jsx)("span",{className:"contents",role:"gridcell",children:(0,l.jsx)(L,{errors:r.errors})}),e[16]=r.errors,e[17]=d):d=e[17];let g;return e[18]!==d||e[19]!==s||e[20]!==c||e[21]!==a||e[22]!==o?(g=(0,l.jsxs)("div",{className:"flex min-w-0 flex-1 flex-wrap items-center",role:"none",children:[s,c,a,o,d]}),e[18]=d,e[19]=s,e[20]=c,e[21]=a,e[22]=o,e[23]=g):g=e[23],g},"D");export{F as a,L as b,q as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as ct,b as he,c as ze,d as We,e as ut,f as dr}from"./chunk-QBBNGQJA.js";import{b as sr,c as ir,d as lr,e as ar,f as cr,g as ur,h as Pe,i as pr,j as mr}from"./chunk-YWGOETFP.js";import{a as Yt}from"./chunk-6KIDLGYM.js";import{$ as Ho,Aa as Jo,Ba as Zo,Ca as Qo,Da as er,E as Vo,F as Do,H as Lo,J as _o,K as Uo,Q as Fo,Z as ko,b as vo,g as yo,ia as Bo,ja as jo,la as zo,oa as Wo,pa as qo,r as Pt,u as Mo,va as Yo,wa as $o,x as Oo,xa as Xo,ya as Ko}from"./chunk-YIZDDGWA.js";import{a as To,b as Go}from"./chunk-HXFXD5EP.js";import{a as No,b as Po}from"./chunk-EUNTXABP.js";import{a as tr,b as or,i as rr,j as nr,k as at}from"./chunk-2NUCBQFU.js";import{a as wt,b as He,c as mo,d as go,e as Ct,f as Io,h as wo,i as Co}from"./chunk-4L2BABMS.js";import{C as bo,F as Be,H as Eo,L as je,M as Nt,N as Ao,O as se,Q,c as fo,d as So,f as At,n as Ne,p as Gt,q as xo,r as ho,s as Tt,t as Ro}from"./chunk-R76ATTPC.js";import{c as Et}from"./chunk-EOHXBC4U.js";import{b as It,u as Ie,v as te,w as Ee,x as st}from"./chunk-JEJV6SVN.js";import{a as uo,b as nt,d as po,f as it,g as qt,h as lt,i as C}from"./chunk-DMQVY5L7.js";import{x as Ue}from"./chunk-7EUM7G2I.js";import{a as vn}from"./chunk-A6TVTNKO.js";import{a as L,b as be}from"./chunk-ADABTCDI.js";import{a as o,c as bn,d as v}from"./chunk-5PEAXTYQ.js";var ft=v(vn(),1);var oe={};bn(oe,{Arrow:()=>en,Backdrop:()=>Ur,Group:()=>pn,GroupLabel:()=>dn,Icon:()=>Or,Item:()=>Yr,ItemIndicator:()=>Jr,ItemText:()=>Zr,Label:()=>wr,List:()=>qr,Popup:()=>zr,Portal:()=>Lr,Positioner:()=>Fr,Root:()=>vr,ScrollDownArrow:()=>nn,ScrollUpArrow:()=>an,Separator:()=>Sn,Trigger:()=>Tr,Value:()=>Pr});var U=v(L(),1);var fr=v(L(),1);function gr(t){let e=fr.useRef(!0);e.current&&(e.current=!1,t())}o(gr,"useOnFirstRender");var qe=v(L(),1);var $t=qe.createContext(void 0),Xt=qe.createContext(void 0);function _(){let t=qe.useContext($t);if(t===void 0)throw new Error(Ee(60));return t}o(_,"useSelectRootContext");function Mt(){let t=qe.useContext(Xt);if(t===void 0)throw new Error(Ee(61));return t}o(Mt,"useSelectFloatingContext");function Sr(t,e,r=Object.is){let{length:n}=t;if(n!==e.length)return!1;for(let s=0;s<n;s+=1)if(!r(t[s],e[s]))return!1;return!0}o(Sr,"areArraysEqual");var Jt=o((t,e)=>Object.is(t,e),"defaultItemEquality");function we(t,e,r){return t==null||e==null?Object.is(t,e):r(t,e)}o(we,"compareItemEquality");function xr(t,e,r){return Array.isArray(t)&&Array.isArray(e)?!Sr(t,e,(n,s)=>we(n,s,r)):t!==e}o(xr,"isSelectedValueDirty");function Kt(t,e,r){return t?t.some(n=>n===void 0?!1:we(e,n,r)):!1}o(Kt,"selectedValueIncludes");function pt(t,e,r){return t?t.findIndex(n=>n===void 0?!1:we(n,e,r)):-1}o(pt,"findItemIndex");function yn(t,e){if(e!==Jt)return n=>Kt(t,n,e);let r=new Set(t);return r.delete(void 0),n=>r.has(n)&&(n!==0||t.some(s=>Object.is(n,s)))}o(yn,"createSelectionMatcher");function Zt(t,e,r,n){let s=n&&Array.isArray(e)?t.findIndex(yn(e,r)):pt(t,e,r);return s===-1?null:s}o(Zt,"findSelectionIndex");function hr(t,e,r,n,s,a){return Kt(n,e,s)?a!=null&&t>a&&Kt(n,r[a],s)?a:t:t===a?Zt(r,n,s,!0):a}o(hr,"resolveSelectedIndex");function Rr(t,e,r){return t.filter(n=>!we(e,n,r))}o(Rr,"removeItem");var br={id:o(t=>t.id,"id"),labelId:o(t=>t.labelId,"labelId"),modal:o(t=>t.modal,"modal"),multiple:o(t=>t.multiple,"multiple"),disabled:o(t=>t.disabled,"disabled"),readOnly:o(t=>t.readOnly,"readOnly"),required:o(t=>t.required,"required"),highlightItemOnHover:o(t=>t.highlightItemOnHover,"highlightItemOnHover"),items:o(t=>t.items,"items"),itemToStringLabel:o(t=>t.itemToStringLabel,"itemToStringLabel"),isItemEqualToValue:o(t=>t.isItemEqualToValue,"isItemEqualToValue"),value:o(t=>t.value,"value"),hasSelectedValue:o(t=>{let{value:e,multiple:r,itemToStringValue:n}=t;return e==null?!1:r&&Array.isArray(e)?e.length>0:Pe(e,n)!==""},"hasSelectedValue"),hasNullItemLabel:o((t,e)=>e?cr(t.items):!1,"hasNullItemLabel"),open:o(t=>t.open,"open"),mounted:o(t=>t.mounted,"mounted"),forceMount:o(t=>t.forceMount,"forceMount"),transitionStatus:o(t=>t.transitionStatus,"transitionStatus"),openMethod:o(t=>t.openMethod,"openMethod"),activeIndex:o(t=>t.activeIndex,"activeIndex"),selectedIndex:o(t=>t.selectedIndex,"selectedIndex"),isActive:o((t,e)=>t.activeIndex===e,"isActive"),isSelected:o((t,e)=>{let r=t.isItemEqualToValue,n=t.value;return t.multiple?Array.isArray(n)&&n.some(s=>we(e,s,r)):we(e,n,r)},"isSelected"),isSelectedByFocus:o((t,e)=>t.selectedIndex===e,"isSelectedByFocus"),popupProps:o(t=>t.popupProps,"popupProps"),triggerProps:o(t=>t.triggerProps,"triggerProps"),itemRoot:o(t=>t.itemRoot,"itemRoot"),triggerElement:o(t=>t.triggerElement,"triggerElement"),positionerElement:o(t=>t.positionerElement,"positionerElement"),listElement:o(t=>t.listElement,"listElement"),popupSide:o(t=>t.popupSide,"popupSide"),scrollUpArrowVisible:o(t=>t.scrollUpArrowVisible,"scrollUpArrowVisible"),scrollDownArrowVisible:o(t=>t.scrollDownArrowVisible,"scrollDownArrowVisible"),hasScrollArrows:o(t=>t.hasScrollArrows,"hasScrollArrows")};var Ge=v(be(),1);function vr(t){let{id:e,value:r,defaultValue:n=null,onValueChange:s,open:a,defaultOpen:l=!1,onOpenChange:m,name:i,form:f,autoComplete:p,disabled:h=!1,readOnly:b=!1,required:d=!1,modal:N=!0,actionsRef:I,inputRef:S,onOpenChangeComplete:F,items:z,multiple:y=!1,itemToStringLabel:g,itemToStringValue:P,isItemEqualToValue:A=Jt,highlightItemOnHover:M=!0,children:H}=t,{clearErrors:W}=mo(),{setDirty:ie,setTouched:q,setFocused:X,validityData:c,setFilled:j,name:Y,disabled:le,validation:G,validationMode:ae}=He(),O=Ct({id:e}),u=le||h,E=Y??i,[R,x]=Yt({controlled:r,default:y?n??qt:n,name:"Select",state:"value"}),[V,K]=Yt({controlled:a,default:l,name:"Select",state:"open"}),re=U.useRef([]),J=U.useRef([]),pe=U.useRef(null),Se=U.useRef(null),ee=U.useRef(0),me=U.useRef(null),D=U.useRef([]),k=U.useRef(!1),ce=U.useRef(null),Z=U.useRef(null),Oe=U.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),Ce=U.useRef(!1),Ae=U.useRef(R),{openMethod:de,triggerProps:Te}=Wo(V),T=uo(()=>new ko({id:O,labelId:void 0,modal:N,multiple:y,disabled:u,readOnly:b,required:d,highlightItemOnHover:M,itemToStringLabel:g,itemToStringValue:P,isItemEqualToValue:A,value:R,open:V,mounted:V,transitionStatus:void 0,items:z,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:lt,triggerProps:lt,itemRoot:{props:lt,multiple:y,disabled:u,readOnly:b,isItemEqualToValue:A},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:it,setOpen:it,handleScrollArrowVisibility:it,onOpenChangeComplete:it,listRef:re,popupRef:pe,scrollHandlerRef:Se,scrollArrowsMountedCountRef:ee,valueRef:me,valuesRef:D,labelsRef:J,typingRef:k,selectionRef:Oe,firstItemTextRef:ce,selectedItemTextRef:Z,alignItemWithTriggerActiveRef:Ce,initialValueRef:Ae},br)).current,[ue,gt]=U.useState(!1),{mounted:St,transitionStatus:ve,forceUnmount:xt}=_o({open:V,ref:pe,preventUnmountOnClose:ue,setPreventUnmountOnClose:gt,onUnmount(){T.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),F?.(!1)}}),ht=T.useState("activeIndex"),xe=T.useState("selectedIndex"),Ze=T.useState("triggerElement"),Rt=T.useState("positionerElement"),Qe=er(de),ye=de??Qe,bt=U.useMemo(()=>y?"":Pe(R,P),[y,R,P]),et=U.useMemo(()=>y&&Array.isArray(R)?R.map(w=>Pe(w,P)):Pe(R,P),[y,R,P]),Bt=Pt(Ze),vt=Ie(()=>et);Co(Bt,O,R,vt,!u,i);let Fe=y?Array.isArray(R)&&R.length>0:R!=null&&bt!=="";te(()=>{j(Fe)},[Fe,j]),te(o(function(){let $=Zt(D.current,R,A,y);$===null&&(Z.current=null),!V&&T.set("selectedIndex",$)},"syncSelectedIndex"),[y,V,R,A,T]),Ao(R,()=>{W(E),ie(xr(R,c.initialValue,A)),G.change(R)});let ke=Ie((w,$)=>{let _e=$,ot=Fo(_e);m?.(w,_e),!$.isCanceled&&(w||gt(ot()),K(w),!w&&($.reason===Q.focusOut||$.reason===Q.outsidePress)&&(q(!0),X(!1),ae==="onBlur"&&G.commit(R)))});U.useImperativeHandle(I,()=>({unmount:xt,close:o(()=>{T.state.open&&ke(!1,se(Q.imperativeAction))},"close")}),[xt,ke,T]);let tt=Ie((w,$)=>{s?.(w,$),!$.isCanceled&&x(w)}),jt=Ie(w=>{let $=ze(w.scrollHeight,w.clientHeight),_e=We(w.scrollTop,$),ot=_e>0,rt=_e<$;T.set("scrollUpArrowVisible",ot),T.set("scrollDownArrowVisible",rt)}),ne=Ho({open:V,onOpenChange:ke,elements:{reference:Ze,floating:Rt}}),Ve=Do(ne,{enabled:!u,event:"mousedown"}),De=Lo(ne),Le=Bo(ne,{enabled:!u,listRef:re,activeIndex:ht,selectedIndex:xe,disabledIndices:qt,onNavigate(w){w===null&&!V||T.set("activeIndex",w)},focusItemOnHover:M}),yt=jo(ne,{enabled:!u&&(V||!b&&!y),listRef:J,activeIndex:ht,selectedIndex:xe,disabledIndices:o(w=>ar(re.current[w]),"disabledIndices"),onMatch(w){V?T.set("activeIndex",w):tt(D.current[w],se(Q.none))},onTyping(w){k.current=w}}),ro=U.useMemo(()=>nt(yt.reference,Le.reference,De.reference,Ve.reference,Te),[Ve.reference,yt.reference,Le.reference,De.reference,Te]),no=U.useMemo(()=>nt(Uo,yt.floating,Le.floating,De.floating),[yt.floating,Le.floating,De.floating]),so=Le.item??lt,io=U.useMemo(()=>({props:so,multiple:y,disabled:u,readOnly:b,isItemEqualToValue:A}),[so,y,u,b,A]);T.useContextCallback("setValue",tt),T.useContextCallback("setOpen",ke),T.useContextCallback("handleScrollArrowVisibility",jt),T.useContextCallback("onOpenChangeComplete",F),gr(()=>{T.update({popupProps:no,triggerProps:ro,itemRoot:io})}),T.useSyncedValues({id:O,modal:N,multiple:y,disabled:u,readOnly:b,required:d,highlightItemOnHover:M,value:R,open:V,mounted:St,transitionStatus:ve,popupProps:no,triggerProps:ro,itemRoot:io,items:z,itemToStringLabel:g,itemToStringValue:P,isItemEqualToValue:A,openMethod:ye});let xn=po(S,G.inputRef),lo=y?void 0:E,hn=U.useMemo(()=>!y||!Array.isArray(R)||!E?null:R.map(w=>{let $=Pe(w,P);return(0,Ge.jsx)("input",{type:"hidden",form:f,name:E,value:$,disabled:u},$)}),[y,R,f,E,P,u]);return(0,Ge.jsxs)($t.Provider,{value:T,children:[(0,Ge.jsx)(Xt.Provider,{value:ne,children:H}),(0,Ge.jsx)("input",{...G.getValidationProps(u,{onFocus(){T.state.triggerElement?.focus({focusVisible:!0})},onChange(w){if(w.nativeEvent.defaultPrevented||u||b)return;let $=w.currentTarget.value,_e=se(Q.none,w.nativeEvent);function ot(){if(y)return;let rt=$.toLowerCase(),zt=D.current.findIndex(Wt=>Pe(Wt,P).toLowerCase()===rt||ur(Wt,g).toLowerCase()===rt);zt===-1&&(zt=D.current.findIndex((Wt,Rn)=>{let co=J.current[Rn];return co!=null&&co.toLowerCase()===rt}));let ao=D.current[zt];ao!=null&&tt(ao,_e)}o(ot,"handleChange"),T.set("forceMount",!0),queueMicrotask(ot)}}),id:O&&lo==null?`${O}-hidden-input`:void 0,form:f,name:lo,autoComplete:p,value:bt,disabled:u,required:d&&!(y&&Fe),readOnly:b,ref:xn,style:E?Po:No,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),hn]})}o(vr,"SelectRoot");var Er=v(L(),1);function yr(t){return t==null?void 0:`${t}-label`}o(yr,"getDefaultLabelId");function Ir(t,e){return t??e}o(Ir,"resolveAriaLabelledBy");var wr=Er.forwardRef(o(function(e,r){let{render:n,className:s,style:a,...l}=e,m=l;delete m.id;let i=He(),f=_(),p=f.useState("triggerElement"),h=f.useState("id"),b=yr(h),d=Io({id:b,fallbackControlId:p?.id??h,setLabelId(N){let I=typeof N=="function"?N(f.state.labelId):N;f.set("labelId",I)}});return C("div",e,{ref:r,state:i.state,props:[d,l],stateAttributesMapping:wt})},"SelectLabel"));var Ye=v(L(),1);var Us=Gt.popupOpen,Fs=Gt.pressed;var Cr="data-popup-side";var In=400,En={...ho,...wt,popupSide:o(t=>t?{[Cr]:t}:null,"popupSide"),value:o(()=>null,"value")},Tr=Ye.forwardRef(o(function(e,r){let{render:n,className:s,id:a,disabled:l=!1,nativeButton:m=!0,style:i,...f}=e,{setTouched:p,validationMode:h,validation:b,state:d,disabled:N}=He(),{labelId:I}=go(),S=_(),F=S.useState("readOnly"),z=S.useState("required"),y=S.useState("disabled"),g=N||y||l,P=S.useState("open"),A=S.useState("mounted"),M=S.useState("value"),H=S.useState("triggerProps"),W=S.useState("positionerElement"),ie=S.useState("listElement"),q=S.useState("popupSide"),X=S.useState("id"),c=S.useState("labelId"),j=S.useState("hasSelectedValue"),Y=A&&W?q:null,le=a??X,G=Ir(I,c);Ct({id:a});let ae=Pt(W),O=Ye.useRef(null),u=wo(g,O),{getButtonProps:E,buttonRef:R}=Et({disabled:g,native:m}),x=S.useStateSetter("triggerElement"),V=Be(),K=Be(),re=Be();Ye.useEffect(()=>{if(P)return re.start(In,()=>{S.context.selectionRef.current.allowUnselectedMouseUp=!0,S.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{re.clear()};S.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},K.clear()},[P,S,K,re]);let J=nt(H,{id:le,role:"combobox","aria-expanded":P,"aria-haspopup":"listbox","aria-controls":P?ie?.id??bo(W)?.id:void 0,"aria-labelledby":G,"aria-readonly":F||void 0,"aria-required":z||void 0,tabIndex:g?-1:0,onFocus(ee){u(!0),P&&S.context.alignItemWithTriggerActiveRef.current&&S.context.setOpen(!1,se(Q.none,ee.nativeEvent)),V.start(0,()=>{S.set("forceMount",!0)})},onBlur(ee){At(W,ee.relatedTarget)||(p(!0),u(!1),h==="onBlur"&&b.commit(M))},onMouseDown(ee){if(P)return;let me=st(ee.currentTarget);function D(k){if(!O.current)return;let ce=k.target;At(O.current,ce)||At(ae.current,ce)||lr(k,O.current)||S.context.setOpen(!1,se(Q.cancelOpen,k))}o(D,"handleMouseUp"),K.start(0,()=>{me.addEventListener("mouseup",D,{once:!0})})}},f,E),pe=b.getValidationProps(g,J);pe.role="combobox";let Se={...d,open:P,disabled:g,value:M,readOnly:F,popupSide:Y,placeholder:!j};return C("button",e,{ref:[r,O,R,x],state:Se,stateAttributesMapping:En,props:pe})},"SelectTrigger"));var Nr=v(L(),1);var wn={value:o(()=>null,"value")},Pr=Nr.forwardRef(o(function(e,r){let{className:n,render:s,children:a,placeholder:l,style:m,...i}=e,f=_(),p=f.useState("value"),h=f.useState("items"),b=f.useState("itemToStringLabel"),d=f.useState("hasSelectedValue"),N=!d&&l!=null&&a==null,I=f.useState("hasNullItemLabel",N),S={value:p,placeholder:!d},F=null;return typeof a=="function"?F=a(p):a!=null?F=a:N&&!I?F=l:Array.isArray(p)?F=mr(p,h,b):F=pr(p,h,b),C("span",e,{state:S,ref:[r,f.context.valueRef],props:[{children:F},i],stateAttributesMapping:wn})},"SelectValue"));var Mr=v(L(),1);var Or=Mr.forwardRef(o(function(e,r){let{render:n,className:s,style:a,...l}=e,f={open:_().useState("open")};return C("span",e,{state:f,ref:r,props:[{"aria-hidden":!0,children:"\u25BC"},l],stateAttributesMapping:xo})},"SelectIcon"));var Vr=v(L(),1);var Dr=v(be(),1);var Lr=Vr.forwardRef(o(function(e,r){let n=_(),s=n.useState("mounted"),a=n.useState("forceMount");return s||a?(0,Dr.jsx)(Oo,{ref:r,...e}):null},"SelectPortal"));var _r=v(L(),1);var Cn={...Tt,...Ne},Ur=_r.forwardRef(o(function(e,r){let{render:n,className:s,style:a,...l}=e,m=_(),i=m.useState("open"),f=m.useState("mounted"),p=m.useState("transitionStatus");return C("div",e,{state:{open:i,transitionStatus:p},ref:r,props:[{role:"presentation",hidden:!f,style:{userSelect:"none",WebkitUserSelect:"none"}},l],stateAttributesMapping:Cn})},"SelectBackdrop"));var fe=v(L(),1);var Ot=v(L(),1);var Qt=Ot.createContext(void 0);function Me(){let t=Ot.useContext(Qt);if(!t)throw new Error(Ee(59));return t}o(Me,"useSelectPositionerContext");function $e(t,e){t&&Object.assign(t.style,e)}o($e,"clearStyles");var Vt={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"};var mt=v(be(),1);var An={position:"fixed"},Fr=fe.forwardRef(o(function(e,r){let{anchor:n,className:s,render:a,positionMethod:l,side:m,align:i,sideOffset:f,alignOffset:p,collisionBoundary:h="clipping-ancestors",collisionPadding:b,arrowPadding:d,sticky:N,disableAnchorTracking:I,alignItemWithTrigger:S=!0,collisionAvoidance:F=Mo,style:z,...y}=e,g=_(),P=Mt(),A=g.useState("open"),M=g.useState("mounted"),H=g.useState("modal"),W=g.useState("value"),ie=g.useState("openMethod"),q=g.useState("positionerElement"),X=g.useState("triggerElement"),c=g.useState("isItemEqualToValue"),j=g.useState("transitionStatus"),Y=fe.useRef(null),le=fe.useRef(null),[G,ae]=fe.useState(S),O=M&&G&&ie!=="touch";!M&&G!==S&&ae(S),fe.useImperativeHandle(g.context.alignItemWithTriggerActiveRef,()=>O),Jo((O||H)&&A,ie==="touch",q,X);let u=Yo({anchor:n,floatingRootContext:P,positionMethod:l,mounted:M,side:m,sideOffset:f,align:i,alignOffset:p,arrowPadding:d,collisionBoundary:h,collisionPadding:b,sticky:N,disableAnchorTracking:I??O,collisionAvoidance:F,keepMounted:!0}),E=O?"none":u.side,R=O?An:u.positionerStyles,x={open:A,side:E,align:u.align,anchorHidden:u.anchorHidden};te(()=>{g.set("popupSide",u.side)},[g,u.side]);let V=g.useStateSetter("positionerElement"),K=Ko(e,x,{styles:R,transitionStatus:j,props:y,refs:[r,V],hidden:!M,inert:!A}),re=fe.useRef(0),J=Ie(Se=>{if(g.context.valuesRef.current.length===0)return;let ee=re.current;re.current=Se.size;let me=se(Q.none);if(ee!==0&&!g.state.multiple&&W!==null&&pt(g.context.valuesRef.current,W,c)===-1){let k=g.context.initialValueRef.current,Z=k!=null&&pt(g.context.valuesRef.current,k,c)!==-1?k:null;g.context.setValue(Z,me),Z===null&&(g.set("selectedIndex",null),g.context.selectedItemTextRef.current=null)}if(ee!==0&&g.state.multiple&&Array.isArray(W)){let D=W.filter(k=>pt(g.context.valuesRef.current,k,c)!==-1);D.length!==W.length&&(g.context.setValue(D,me),D.length===0&&(g.set("selectedIndex",null),g.context.selectedItemTextRef.current=null))}if(A&&O){g.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let D={height:""};$e(q,D),$e(g.context.popupRef.current,D)}}),pe=fe.useMemo(()=>({...u,side:E,alignItemWithTriggerActive:O,setControlledAlignItemWithTrigger:ae,scrollUpArrowRef:Y,scrollDownArrowRef:le}),[u,E,O,ae]);return(0,mt.jsx)(ir,{elementsRef:g.context.listRef,labelsRef:g.context.labelsRef,onMapChange:J,children:(0,mt.jsxs)(Qt.Provider,{value:pe,children:[M&&H&&(0,mt.jsx)($o,{inert:qo(!A),cutout:X}),K]})})},"SelectPositioner"));var ge=v(L(),1);var eo="--transform-origin";var _t=v(be(),1);var Tn={...Tt,...Ne},zr=ge.forwardRef(o(function(e,r){let{render:n,className:s,style:a,finalFocus:l,...m}=e,i=_(),f=i.useState("multiple"),p=i.useState("readOnly"),h=i.useState("highlightItemOnHover"),b=Mt(),{side:d,align:N,alignItemWithTriggerActive:I,isPositioned:S,setControlledAlignItemWithTrigger:F}=Me(),z=Qo(!0)!=null,y=Go(),{nonce:g,disableStyleElements:P}=dr(),A=i.useState("id"),M=i.useState("open"),H=i.useState("openMethod"),W=i.useState("mounted"),ie=i.useState("popupProps"),q=i.useState("transitionStatus"),X=i.useState("triggerElement"),c=i.useState("positionerElement"),j=i.useState("listElement"),Y=ge.useRef(!1),le=ge.useRef(!1),G=ge.useRef({}),ae=Eo(),O=Ie(x=>{if(!c||!i.context.popupRef.current||!le.current)return;let V=c.style.top==="0px",K=c.style.bottom==="0px";if(Y.current||!I||!V&&!K){i.context.handleScrollArrowVisibility(x);return}let re=Br(c),J=dt(c.getBoundingClientRect().height,"y",re),pe=st(c),Se=It(c),ee=Se.getComputedStyle(c),me=parseFloat(ee.marginTop),D=parseFloat(ee.marginBottom),k=Hr(Se.getComputedStyle(i.context.popupRef.current)),ce=Math.min(pe.documentElement.clientHeight-me-D,k),Z=x.scrollTop,Oe=Dt(x),Ce=null,Ae=o(ue=>{c.style.height=`${ue}px`},"setHeight"),de=V?Oe-Z:Z,Te=Math.min(J+de,ce);if(de<=he){let ue=ct(de,0,ce-J);ue>0&&Ae(J+ue),x.scrollTop=V?Oe:0,ce-(J+ue)<=he&&(Y.current=!0),i.context.handleScrollArrowVisibility(x);return}if(ce-Te>he)Ce=V?1/0:0;else if(K&&Z<Oe){let ue=J+de-ce;Ce=Z-(de-ue)}let T=Math.ceil(Te);if(T!==0&&Ae(T),Ce!=null){let ue=ct(Ce,0,Dt(x));Math.abs(x.scrollTop-ue)>he&&(x.scrollTop=ue)}T>=ce-he&&(Y.current=!0),i.context.handleScrollArrowVisibility(x)});ge.useImperativeHandle(i.context.scrollHandlerRef,()=>O,[O]),je({open:M,ref:i.context.popupRef,onComplete(){M&&i.context.onOpenChangeComplete(!0)}});let u={open:M,transitionStatus:q,side:d,align:N};te(()=>{!c||!i.context.popupRef.current||Object.keys(G.current).length||(G.current={top:c.style.top||"0",left:c.style.left||"0",right:c.style.right,height:c.style.height,bottom:c.style.bottom,minHeight:c.style.minHeight,maxHeight:c.style.maxHeight,marginTop:c.style.marginTop,marginBottom:c.style.marginBottom})},[i,c]),te(()=>{M||I||(le.current=!1,Y.current=!1,$e(c,G.current))},[M,I,c]),te(()=>{let x=i.context.popupRef.current;if(!M||!X||!c||!x||I&&!S||i.state.transitionStatus==="ending")return;if(le.current=!0,x.style.removeProperty(eo),!I){ae.request(()=>i.context.handleScrollArrowVisibility(j||x));return}let V=Nn(x);try{let K=i.context.selectedItemTextRef.current;K?.isConnected||(K=!i.select("hasSelectedValue")&&i.context.firstItemTextRef.current?.isConnected?i.context.firstItemTextRef.current:null);let re=i.context.valueRef.current,J=It(c),pe=J.getComputedStyle(c),Se=J.getComputedStyle(x),ee=st(X),me=Br(X),D=Lt(X.getBoundingClientRect(),me),k=Lt(c.getBoundingClientRect(),me),ce=D.height,Z=j||x,Oe=Z.scrollHeight,Ce=parseFloat(Se.borderBottomWidth),Ae=parseFloat(pe.marginTop)||10,de=parseFloat(pe.marginBottom)||10,Te=parseFloat(pe.minHeight)||100,T=Hr(Se),ue=5,gt=5,St=20,ve=ee.documentElement.clientHeight-Ae-de,xt=ee.documentElement.clientWidth,ht=ve-D.bottom+ce,xe,Ze=y==="rtl"?D.right-k.width:D.left,Rt=0;if(K&&re){let ne=Lt(re.getBoundingClientRect(),me);xe=Lt(K.getBoundingClientRect(),me),Ze=k.left+(y==="rtl"?ne.right-xe.right:ne.left-xe.left);let Ve=ne.top-D.top+ne.height/2;Rt=xe.top-k.top+xe.height/2-Ve}let Qe=ht+Rt+de+Ce,ye=Math.min(ve,Qe),bt=ve-Ae-de,et=Qe-ye,Bt=xt-gt;c.style.left=`${ct(Ze,ue,Bt-k.width)}px`,c.style.height=`${ye}px`,c.style.maxHeight="none",c.style.marginTop=`${Ae}px`,c.style.marginBottom=`${de}px`,x.style.height="100%";let vt=Dt(Z),Fe=et>=vt-he;Fe&&(ye=Math.min(ve,k.height)-(et-vt));let ke=D.top<St||D.bottom>ve-St||Math.ceil(ye)+he<Math.min(Oe,Te),tt=(J.visualViewport?.scale??1)!==1&&So.engine.webkit;if(ke||tt){$e(c,G.current),F(!1);return}let jt=Math.max(Te,ye);if(Fe){let ne=Math.max(0,ve-Qe);c.style.top=k.height>=bt?"0":`${ne}px`,c.style.height=`${ye}px`,Z.scrollTop=Dt(Z)}else c.style.bottom="0",Z.scrollTop=et;if(xe){let ne=k.top,Ve=k.height,De=xe.top+xe.height/2,Le=ct(Ve>0?(De-ne)/Ve*100:50,0,100);x.style.setProperty(eo,`50% ${Le}%`)}(jt===ve||ye>=T)&&(Y.current=!0),i.context.handleScrollArrowVisibility(Z),h&&i.state.selectedIndex===null&&i.state.activeIndex===null&&i.context.listRef.current[0]!=null&&i.set("activeIndex",0)}finally{V()}},[i,M,c,X,I,F,ae,j,h,y,S]),ge.useEffect(()=>{if(!I||!c||!M)return;let x=It(c);function V(K){i.context.setOpen(!1,se(Q.windowResize,K))}return o(V,"handleResize"),To(x,"resize",V)},[i,I,c,M]);let E={...j?{role:"presentation"}:{role:"listbox","aria-multiselectable":f||void 0,"aria-readonly":p||void 0,id:`${A}-list`},onKeyDown(x){z&&Zo.has(x.key)&&x.stopPropagation()},onScroll(x){j||O(x.currentTarget)},...I&&{style:j?{height:"100%"}:Vt},className:!j&&I?ut.className:void 0},R=C("div",e,{ref:[r,i.context.popupRef],state:u,stateAttributesMapping:Tn,props:[ie,E,Xo(q),m]});return(0,_t.jsxs)(ge.Fragment,{children:[!P&&ut.getElement(g),(0,_t.jsx)(Vo,{context:b,modal:!1,disabled:!W,openInteractionType:H,returnFocus:l,restoreFocus:!0,children:R})]})},"SelectPopup"));function Hr(t){let e=t.maxHeight;return e.endsWith("px")&&parseFloat(e)||1/0}o(Hr,"getMaxPopupHeight");function Dt(t){return ze(t.scrollHeight,t.clientHeight)}o(Dt,"getMaxScrollTop");function Br(t){return zo.getScale(t)}o(Br,"getScale");function dt(t,e,r){return t/r[e]}o(dt,"normalizeSize");function Lt(t,e){return yo({x:dt(t.x,"x",e),y:dt(t.y,"y",e),width:dt(t.width,"x",e),height:dt(t.height,"y",e)})}o(Lt,"normalizeRect");var jr=[["transform","none"],["scale","1"],["translate","0 0"]];function Nn(t){let{style:e}=t,r={};for(let[n,s]of jr)r[n]=e.getPropertyValue(n),e.setProperty(n,s,"important");return()=>{for(let[n]of jr){let s=r[n];s?e.setProperty(n,s):e.removeProperty(n)}}}o(Nn,"unsetTransformStyles");var Wr=v(L(),1);var qr=Wr.forwardRef(o(function(e,r){let{render:n,className:s,style:a,...l}=e,m=_(),i=m.useState("multiple"),f=m.useState("readOnly"),{alignItemWithTriggerActive:p}=Me(),h=m.useState("hasScrollArrows"),b=m.useState("openMethod"),N={id:`${m.useState("id")}-list`,role:"listbox","aria-multiselectable":i||void 0,"aria-readonly":f||void 0,onScroll(S){m.context.scrollHandlerRef.current?.(S.currentTarget)},...p&&{style:Vt},className:h&&b!=="touch"?ut.className:void 0},I=m.useStateSetter("listElement");return C("div",e,{ref:[r,I],props:[N,l]})},"SelectList"));var Re=v(L(),1);var Ut=v(L(),1);var to=Ut.createContext(void 0);function Ft(){let t=Ut.useContext(to);if(!t)throw new Error(Ee(57));return t}o(Ft,"useSelectItemContext");var Gr=v(be(),1);var Yr=Re.memo(Re.forwardRef(o(function(e,r){let{render:n,className:s,style:a,value:l=null,label:m,disabled:i=!1,nativeButton:f=!1,...p}=e,h=Re.useRef(null),b=sr({guess:!0,label:m,textRef:h}),d=_(),{props:N,multiple:I,disabled:S,readOnly:F,isItemEqualToValue:z}=d.useState("itemRoot"),y=S||i,g=d.useState("isActive",b.index),P=d.useState("open"),A=d.useState("isSelected",l),M=d.useState("isSelectedByFocus",b.index),H=b.index,W=Re.useRef(null);te(()=>{let u=d.context.valuesRef.current;return u[H]=l,()=>{delete u[H]}},[H,l,d]),te(()=>{let u=d.state.value,E=d.state.selectedIndex,R=E,x;I&&Array.isArray(u)?(R=hr(H,l,d.context.valuesRef.current,u,z,E),x=R===H,H===E&&!x&&(d.context.selectedItemTextRef.current=null)):(x=u!==void 0&&we(l,u,z),x&&(R=H)),d.set("selectedIndex",R),x&&h.current&&(d.context.selectedItemTextRef.current=h.current)},[H,I,z,d,l]);let ie=Re.useRef("mouse"),q=Re.useRef(!1),{getButtonProps:X,buttonRef:c}=Et({disabled:y,focusableWhenDisabled:!0,native:f,composite:!0}),j={disabled:y,selected:A,highlighted:g};function Y(u){if(S||F)return;let E=d.state.value;if(I){let R=Array.isArray(E)?E:[],x=A?Rr(R,l,z):[...R,l];d.context.setValue(x,se(Q.itemPress,u))}else d.context.setValue(l,se(Q.itemPress,u)),d.context.setOpen(!1,se(Q.itemPress,u))}o(Y,"commitSelection");function le(){d.context.selectionRef.current.dragY=0}o(le,"resetDragMovement");let G={role:"option","aria-selected":A,tabIndex:P&&g?0:-1,onKeyDown(u){d.set("activeIndex",H),u.key===" "&&d.context.typingRef.current&&u.preventDefault()},onClick(u){let E=ie.current!=="touch",R=u.nativeEvent.pointerType,x=E&&vo(u.nativeEvent)&&(R!==void 0||g),V=E&&!x&&!q.current;q.current=!1,!(y||V)&&Y(u.nativeEvent)},onPointerEnter(u){ie.current=u.pointerType},onPointerMove(u){if(u.pointerType==="mouse"&&u.buttons===1){let E=d.context.selectionRef.current;E.dragY+=u.movementY,E.dragY**2>=64&&(E.allowUnselectedMouseUp=!0)}},onPointerDown(u){ie.current=u.pointerType,q.current=!0,le()},onMouseUp(){if(le(),y||ie.current==="touch"||q.current)return;let u=!d.context.selectionRef.current.allowSelectedMouseUp&&A,E=!d.context.selectionRef.current.allowUnselectedMouseUp&&!A;u||E||(q.current=!0,W.current?.click(),q.current=!1)}},ae=C("div",e,{ref:[c,r,b.ref,W],state:j,props:[N,G,p,X]}),O=Re.useMemo(()=>({selected:A,index:H,textRef:h,selectedByFocus:M}),[A,H,h,M]);return(0,Gr.jsx)(to.Provider,{value:O,children:ae})},"SelectItem")));var Xr=v(L(),1);var Xe=v(L(),1);var $r=Xe.memo(Xe.forwardRef(o(function(e,r){let{render:n,className:s,style:a,keepMounted:l,selected:m,...i}=e,f=Xe.useRef(null),{transitionStatus:p,setMounted:h}=Nt(m),d=C("span",e,{ref:[r,f],state:{selected:m,transitionStatus:p},props:[{"aria-hidden":!0,children:"\u2714\uFE0F"},i],stateAttributesMapping:Ne});return je({batch:!0,enabled:!m,open:m,ref:f,onComplete(){m||h(!1)}}),d},"ItemIndicator")));var Kr=v(be(),1);var Jr=Xr.forwardRef(o(function(e,r){let{selected:n}=Ft();return e.keepMounted||n?(0,Kr.jsx)($r,{...e,selected:n,ref:r}):null},"SelectItemIndicator"));var Ke=v(L(),1);var Zr=Ke.memo(Ke.forwardRef(o(function(e,r){let{index:n,textRef:s,selectedByFocus:a}=Ft(),l=_(),{render:m,className:i,style:f,...p}=e,h=Ke.useCallback(d=>{d&&(n===0&&(l.context.firstItemTextRef.current=d),a&&(l.context.selectedItemTextRef.current=d))},[l,n,a]);return C("div",e,{ref:[h,r,s],props:p})},"SelectItemText")));var Qr=v(L(),1);var en=Qr.forwardRef(o(function(e,r){let{render:n,className:s,style:a,...l}=e,m=_(),{side:i,align:f,arrowRef:p,arrowStyles:h,arrowUncentered:b,alignItemWithTriggerActive:d}=Me(),I={open:m.useState("open"),side:i,align:f,uncentered:b},S=C("div",e,{state:I,ref:[p,r],props:[{style:h,"aria-hidden":!0},l],stateAttributesMapping:Ro});return d?null:S},"SelectArrow"));var on=v(L(),1);var tn=v(L(),1);var kt=tn.forwardRef(o(function(e,r){let{render:n,className:s,style:a,direction:l,keepMounted:m,...i}=e,f=l==="up",p=_(),{side:h,scrollDownArrowRef:b,scrollUpArrowRef:d}=Me(),N=f?"scrollUpArrowVisible":"scrollDownArrowVisible",I=p.useState(N),S=p.useState("openMethod"),F=I&&S!=="touch",z=Be(),y=f?d:b,{mounted:g,transitionStatus:P,setMounted:A}=Nt(F);te(()=>(p.context.scrollArrowsMountedCountRef.current+=1,p.set("hasScrollArrows",!0),()=>{p.context.scrollArrowsMountedCountRef.current=Math.max(0,p.context.scrollArrowsMountedCountRef.current-1),p.context.scrollArrowsMountedCountRef.current===0&&p.set("hasScrollArrows",!1)}),[p]),je({open:F,ref:y,onComplete(){F||A(!1)}});let W=C("div",e,{ref:[r,y],state:{direction:l,visible:F,side:h,transitionStatus:P},props:[{"aria-hidden":!0,children:f?"\u25B2":"\u25BC",style:{position:"absolute"},onMouseMove(q){if(q.movementX===0&&q.movementY===0||z.isStarted())return;p.set("activeIndex",null);function X(){let c=p.state.listElement??p.context.popupRef.current;if(!c)return;p.set("activeIndex",null),p.context.handleScrollArrowVisibility(c);let j=ze(c.scrollHeight,c.clientHeight),Y=We(c.scrollTop,j),le=Y===(f?0:j),G=p.context.listRef.current;if(Y!==c.scrollTop&&(c.scrollTop=Y),le){z.clear();return}if(G.length>0){let ae=y.current?.offsetHeight||0;c.scrollTop=Pn(G,f,Y,c.clientHeight,ae,j)}z.start(40,X)}o(X,"scrollNextItem"),z.start(40,X)},onMouseLeave(){z.clear()}},i],stateAttributesMapping:Ne});return g||m?W:null},"SelectScrollArrow"));function Pn(t,e,r,n,s,a){if(e){let p=0,h=r+s-he;for(let N=0;N<t.length;N+=1){let I=t[N];if(I&&I.offsetTop>=h){p=N;break}}let b=Math.max(0,p-1),d=t[b];return b<p&&d?We(d.offsetTop-s,a):0}let l=t.length-1,m=r+n-s+he;for(let p=0;p<t.length;p+=1){let h=t[p];if(h&&h.offsetTop+h.offsetHeight>m){l=Math.max(0,p-1);break}}let i=Math.min(t.length-1,l+1),f=t[i];return i>l&&f?We(f.offsetTop+f.offsetHeight-n+s,a):a}o(Pn,"getTargetScrollTop");var rn=v(be(),1);var nn=on.forwardRef(o(function(e,r){return(0,rn.jsx)(kt,{...e,ref:r,direction:"down"})},"SelectScrollDownArrow"));var sn=v(L(),1);var ln=v(be(),1);var an=sn.forwardRef(o(function(e,r){return(0,ln.jsx)(kt,{...e,ref:r,direction:"up"})},"SelectScrollUpArrow"));var Je=v(L(),1);var Ht=v(L(),1);var oo=Ht.createContext(void 0);function cn(){let t=Ht.useContext(oo);if(t===void 0)throw new Error(Ee(56));return t}o(cn,"useSelectGroupContext");var un=v(be(),1);var pn=Je.forwardRef(o(function(e,r){let{render:n,className:s,style:a,...l}=e,[m,i]=Je.useState(),f=Je.useMemo(()=>({labelId:m,setLabelId:i}),[m,i]),p=C("div",e,{ref:r,props:[{role:"group","aria-labelledby":m},l]});return(0,un.jsx)(oo.Provider,{value:f,children:p})},"SelectGroup"));var mn=v(L(),1);var dn=mn.forwardRef(o(function(e,r){let{render:n,className:s,style:a,id:l,...m}=e,{setLabelId:i}=cn(),f=fo(l);return te(()=>(i(f),()=>{i(h=>h===f?void 0:h)}),[f,i]),C("div",e,{ref:r,props:[{id:f,"aria-hidden":!0},m]})},"SelectGroupLabel"));var fn=v(L(),1);var gn=fn.forwardRef(o(function(e,r){let{className:n,render:s,orientation:a="horizontal",style:l,...m}=e;return C("div",e,{state:{orientation:a},ref:r,props:[{role:"presentation"},m]})},"ListboxSeparator"));var Sn=gn;var B=v(be(),1);var wc=oe.Root;function Cc(t){let e=(0,ft.c)(8),r,n;e[0]!==t?({className:r,...n}=t,e[0]=t,e[1]=r,e[2]=n):(r=e[1],n=e[2]);let s;e[3]!==r?(s=Ue("flex flex-1 text-start",r),e[3]=r,e[4]=s):s=e[4];let a;return e[5]!==n||e[6]!==s?(a=(0,B.jsx)(oe.Value,{"data-slot":"select-value",className:s,...n}),e[5]=n,e[6]=s,e[7]=a):a=e[7],a}o(Cc,"$");function Ac({className:t,size:e="default",children:r,...n}){return(0,B.jsxs)(oe.Trigger,{"data-slot":"select-trigger","data-size":e,className:Ue("flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-transparent py-2 pe-2 ps-2.5 text-xs whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-md *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 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",t),...n,children:[r,(0,B.jsx)(oe.Icon,{render:(0,B.jsx)(at,{icon:nr,strokeWidth:2,className:"pointer-events-none size-4 text-muted-foreground"})})]})}o(Ac,"j");function Tc({className:t,children:e,side:r="bottom",sideOffset:n=4,align:s="center",alignOffset:a=0,alignItemWithTrigger:l=!0,...m}){return(0,B.jsx)(oe.Portal,{children:(0,B.jsx)(oe.Positioner,{side:r,sideOffset:n,align:s,alignOffset:a,alignItemWithTrigger:l,className:"isolate z-50",children:(0,B.jsxs)(oe.Popup,{"data-slot":"select-content","data-align-trigger":l,className:Ue("isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 animate-none! relative bg-popover before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!",t),...m,children:[(0,B.jsx)(Mn,{}),(0,B.jsx)(oe.List,{children:e}),(0,B.jsx)(On,{})]})})})}o(Tc,"A");function Nc(t){let e=(0,ft.c)(13),r,n,s;e[0]!==t?({className:n,children:r,...s}=t,e[0]=t,e[1]=r,e[2]=n,e[3]=s):(r=e[1],n=e[2],s=e[3]);let a;e[4]!==n?(a=Ue("relative flex w-full cursor-default items-center gap-2 rounded-md py-2 pe-8 ps-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",n),e[4]=n,e[5]=a):a=e[5];let l;e[6]!==r?(l=(0,B.jsx)(oe.ItemText,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:r}),e[6]=r,e[7]=l):l=e[7];let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=(0,B.jsx)(oe.ItemIndicator,{render:(0,B.jsx)("span",{className:"pointer-events-none absolute end-2 flex size-4 items-center justify-center"}),children:(0,B.jsx)(at,{icon:rr,strokeWidth:2,className:"pointer-events-none"})}),e[8]=m):m=e[8];let i;return e[9]!==s||e[10]!==a||e[11]!==l?(i=(0,B.jsxs)(oe.Item,{"data-slot":"select-item",className:a,...s,children:[l,m]}),e[9]=s,e[10]=a,e[11]=l,e[12]=i):i=e[12],i}o(Nc,"U");function Mn(t){let e=(0,ft.c)(9),r,n;e[0]!==t?({className:r,...n}=t,e[0]=t,e[1]=r,e[2]=n):(r=e[1],n=e[2]);let s;e[3]!==r?(s=Ue("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",r),e[3]=r,e[4]=s):s=e[4];let a;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=(0,B.jsx)(at,{icon:or,strokeWidth:2}),e[5]=a):a=e[5];let l;return e[6]!==n||e[7]!==s?(l=(0,B.jsx)(oe.ScrollUpArrow,{"data-slot":"select-scroll-up-button",className:s,...n,children:a}),e[6]=n,e[7]=s,e[8]=l):l=e[8],l}o(Mn,"x");function On(t){let e=(0,ft.c)(9),r,n;e[0]!==t?({className:r,...n}=t,e[0]=t,e[1]=r,e[2]=n):(r=e[1],n=e[2]);let s;e[3]!==r?(s=Ue("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",r),e[3]=r,e[4]=s):s=e[4];let a;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=(0,B.jsx)(at,{icon:tr,strokeWidth:2}),e[5]=a):a=e[5];let l;return e[6]!==n||e[7]!==s?(l=(0,B.jsx)(oe.ScrollDownArrow,{"data-slot":"select-scroll-down-button",className:s,...n,children:a}),e[6]=n,e[7]=s,e[8]=l):l=e[8],l}o(On,"w");export{wc as a,Cc as b,Ac as c,Tc as d,Nc as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as L}from"./chunk-
|
|
1
|
+
import{a as L}from"./chunk-4A6J4C6A.js";import"./chunk-RELSLYVS.js";import{a as z}from"./chunk-43LNUM4U.js";import{a as R}from"./chunk-LTWCT32V.js";import"./chunk-EOHXBC4U.js";import"./chunk-JEJV6SVN.js";import{a as E}from"./chunk-ZKEXJDGJ.js";import"./chunk-DMQVY5L7.js";import{a as O,b as F,c as H,d as k,e as r,f as n}from"./chunk-H4NGBPG2.js";import{b as j}from"./chunk-U7U4ADXH.js";import{a as T,e as $}from"./chunk-ZBAR562M.js";import{n as I}from"./chunk-BD76RVBZ.js";import"./chunk-VKBLXJIZ.js";import{B,s as S,w as C}from"./chunk-7EUM7G2I.js";import"./chunk-Z2ERBKWN.js";import{a as G}from"./chunk-A6TVTNKO.js";import{a as D,b as J}from"./chunk-ADABTCDI.js";import{a as f,d as y}from"./chunk-5PEAXTYQ.js";var P=y(G(),1),Q=y(D(),1);var s=y(J(),1);var w=200,se=f(()=>{let e=(0,P.c)(28),d=I(),a=B(),[l,q]=(0,Q.useState)(0),p;e[0]!==l?(p=["lunora-auth-sessions",w,l],e[0]=l,e[1]=p):p=e[1];let x;e[2]!==d||e[3]!==l?(x=f(()=>d.listAuthSessions({limit:w,offset:l}),"p"),e[2]=d,e[3]=l,e[4]=x):x=e[4];let o=j(p,x),{error:g}=o,t=o.data?.rows??null,N;e[5]!==o?(N=f(()=>o.poll(),"b"),e[5]=o,e[6]=N):N=e[6],z(N,!0);let v;e[7]!==d||e[8]!==o?(v=f(i=>{S((async()=>{await d.revokeAuthSession({sessionId:i}),o.refetch()})())},"g"),e[7]=d,e[8]=o,e[9]=v):v=e[9];let b=v,c;e[10]!==g?(c=g!==null&&(0,s.jsx)("p",{className:"text-sm text-destructive","data-testid":"auth-sessions-error",role:"alert",children:g}),e[10]=g,e[11]=c):c=e[11];let m;e[12]!==t||e[13]!==a?(m=t!==null&&t.length===0&&(0,s.jsx)(E,{testId:"auth-sessions-empty",title:a("No active sessions.")}),e[12]=t,e[13]=a,e[14]=m):m=e[14];let h;e[15]!==b||e[16]!==t||e[17]!==a?(h=t!==null&&t.length>0&&(0,s.jsx)(T,{className:"overflow-hidden py-0",children:(0,s.jsx)($,{className:"px-0",children:(0,s.jsxs)(O,{"data-testid":"auth-sessions-table",children:[(0,s.jsx)(F,{children:(0,s.jsxs)(k,{children:[(0,s.jsx)(r,{children:a("user")}),(0,s.jsx)(r,{children:a("expires")}),(0,s.jsx)(r,{children:a("ip")}),(0,s.jsx)(r,{children:a("user agent")}),(0,s.jsx)(r,{children:a("impersonated by")}),(0,s.jsx)(r,{"aria-label":a("Actions")})]})}),(0,s.jsx)(H,{children:t.map(i=>(0,s.jsxs)(k,{"data-testid":`auth-session-${i.id}`,children:[(0,s.jsx)(n,{className:"font-mono text-xs",children:i.userId}),(0,s.jsx)(n,{className:"text-muted-foreground tabular-nums",children:C(i.expiresAt)}),(0,s.jsx)(n,{children:i.ipAddress??""}),(0,s.jsx)(n,{className:"max-w-40 truncate",children:i.userAgent??""}),(0,s.jsx)(n,{className:"font-mono text-xs",children:i.impersonatedBy??""}),(0,s.jsx)(n,{children:(0,s.jsx)(R,{"data-testid":`auth-session-revoke-${i.id}`,onClick:f(()=>{b(i.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Revoke")})})]},i.id))})]})})}),e[15]=b,e[16]=t,e[17]=a,e[18]=h):h=e[18];let u;e[19]!==l||e[20]!==t||e[21]!==o.data?.total?(u=t!==null&&(0,s.jsx)(L,{count:t.length,offset:l,onOffsetChange:q,pageSize:w,prefix:"auth-sessions",total:o.data?.total}),e[19]=l,e[20]=t,e[21]=o.data?.total,e[22]=u):u=e[22];let A;return e[23]!==c||e[24]!==m||e[25]!==h||e[26]!==u?(A=(0,s.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"auth-sessions",children:[c,m,h,u]}),e[23]=c,e[24]=m,e[25]=h,e[26]=u,e[27]=A):A=e[27],A},"ee");export{se as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as k}from"./chunk-EDL46BPM.js";import{j}from"./chunk-
|
|
1
|
+
import{a as k}from"./chunk-EDL46BPM.js";import{j}from"./chunk-4L2BABMS.js";import{B as b}from"./chunk-7EUM7G2I.js";import{a as $}from"./chunk-A6TVTNKO.js";import{a as w,b as A}from"./chunk-ADABTCDI.js";import{a as m,d as S}from"./chunk-5PEAXTYQ.js";var y=S($(),1),h=S(w(),1);var a=S(A(),1);var z=m(i=>{let t=(0,y.c)(21),{id:f,onChange:g,testId:e,value:v}=i,s=b(),u=(0,h.useId)(),[d]=(0,h.useState)(F),c;t[0]!==g?(c=m(C=>{g(C.target.value)},"d"),t[0]=g,t[1]=c):c=t[1];let I=c,o;t[2]!==s?(o=s("Shard key"),t[2]=s,t[3]=o):o=t[3];let x=d.length>0?u:void 0,r;t[4]!==s?(r=s("shard key (optional)"),t[4]=s,t[5]=r):r=t[5];let l;t[6]!==f||t[7]!==I||t[8]!==o||t[9]!==x||t[10]!==r||t[11]!==e||t[12]!==v?(l=(0,a.jsx)(j,{"aria-label":o,className:"h-8 w-48","data-testid":e,id:f,list:x,onChange:I,placeholder:r,value:v}),t[6]=f,t[7]=I,t[8]=o,t[9]=x,t[10]=r,t[11]=e,t[12]=v,t[13]=l):l=t[13];let n;t[14]!==u||t[15]!==d||t[16]!==e?(n=d.length>0&&(0,a.jsx)("datalist",{"data-testid":`${e}-recents`,id:u,children:d.map(N)}),t[14]=u,t[15]=d,t[16]=e,t[17]=n):n=t[17];let p;return t[18]!==l||t[19]!==n?(p=(0,a.jsxs)(a.Fragment,{children:[l,n]}),t[18]=l,t[19]=n,t[20]=p):p=t[20],p},"A");function F(){return k()}m(F,"$");function N(i){return(0,a.jsx)("option",{"aria-label":i,value:i},i)}m(N,"w");export{z as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as P}from"./chunk-
|
|
1
|
+
import{n as P}from"./chunk-BD76RVBZ.js";import{l as M}from"./chunk-7EUM7G2I.js";import{a as F}from"./chunk-A6TVTNKO.js";import{a as A}from"./chunk-ADABTCDI.js";import{a as o,d as v}from"./chunk-5PEAXTYQ.js";var S=v(F(),1),i=v(A(),1);var b=6e4,g=o(e=>(typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function","D"),w=5e3,U=o((e,r,s,h)=>{let t=(0,S.c)(10),n=s===void 0?w:s,d=P(),p=(0,i.useRef)(e),u;t[0]!==e?(u=o(()=>{p.current=e},"i"),t[0]=e,t[1]=u):u=t[1],(0,i.useEffect)(u);let f;t[2]!==r||t[3]!==n?(f=o(()=>{if(!r)return;let c=n,y=!1,T,m=o(()=>{y||(T=setTimeout(_,c))},"u"),E=o(()=>{c=n,m()},"_"),R=o(a=>{M(a)||(c=Math.max(n,Math.min(c*2,b)),m())},"M"),_=o(()=>{if(globalThis.document?.hidden===!0){m();return}let a;try{a=p.current()}catch(j){R(j);return}g(a)?Promise.resolve(a).then(E).catch(R):E()},"R");return m(),()=>{y=!0,clearTimeout(T)}},"n"),t[2]=r,t[3]=n,t[4]=f):f=t[4];let l;t[5]!==d||t[6]!==r||t[7]!==n||t[8]!==h?(l=[d,r,n,h],t[5]=d,t[6]=r,t[7]=n,t[8]=h,t[9]=l):l=t[9],(0,i.useEffect)(f,l)},"v"),B=o(async e=>{let r=(await Promise.allSettled(e)).find(s=>s.status==="rejected");if(r!==void 0)throw r.reason},"B");export{U as a,B as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as d}from"./chunk-
|
|
1
|
+
import{a as d}from"./chunk-RELSLYVS.js";import{a as S}from"./chunk-A6TVTNKO.js";import{a as P,b as G}from"./chunk-ADABTCDI.js";import{a as m,d as w}from"./chunk-5PEAXTYQ.js";var M=w(S(),1),v=w(P(),1);var N=w(G(),1);var z=m(r=>{let t=(0,M.c)(18),{count:a,offset:e,onOffsetChange:f,pageSize:o,prefix:s,total:n}=r;if(n===void 0)return null;let c=Math.max(0,Math.floor((n-1)/o)*o),p=e+a<n,x=e>0,i;t[0]!==e||t[1]!==f||t[2]!==o?(i=m(()=>{f(e+o)},"r"),t[0]=e,t[1]=f,t[2]=o,t[3]=i):i=t[3];let l;t[4]!==c||t[5]!==e||t[6]!==f||t[7]!==o?(l=m(()=>{f(Math.max(0,Math.min(e-o,c)))},"l"),t[4]=c,t[5]=e,t[6]=f,t[7]=o,t[8]=l):l=t[8];let h=a===0?0:e+a,g=a===0?0:e+1,u;return t[9]!==s||t[10]!==p||t[11]!==x||t[12]!==i||t[13]!==l||t[14]!==h||t[15]!==g||t[16]!==n?(u=(0,N.jsx)(d,{hasNext:p,hasPrevious:x,onNext:i,onPrevious:l,prefix:s,rangeEnd:h,rangeStart:g,total:n}),t[9]=s,t[10]=p,t[11]=x,t[12]=i,t[13]=l,t[14]=h,t[15]=g,t[16]=n,t[17]=u):u=t[17],u},"G"),A=m(r=>{let t=(0,M.c)(7),a;t[0]!==r?(a={offset:0,owner:r},t[0]=r,t[1]=a):a=t[1];let[e,f]=(0,v.useState)(a);e.owner!==r&&f({offset:0,owner:r});let o=e.owner===r?e.offset:0,s;t[2]!==r?(s=m(c=>{f({offset:c,owner:r})},"a"),t[2]=r,t[3]=s):s=t[3];let n;return t[4]!==o||t[5]!==s?(n=[o,s],t[4]=o,t[5]=s,t[6]=n):n=t[6],n},"N");export{z as a,A as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as r}from"./chunk-5PEAXTYQ.js";var d=[{headings:["Vocabulary","The mental model","The components","Request lifecycle","The data tiers","Compute tiers","The consistency model","The real-time engine"],id:"architecture",summary:"The full picture \u2014 topology, request lifecycle, the data tiers, the consistency model, and the design decisions behind them.",title:"Architecture"},{headings:["Choose Lunora when","Choose something else when","Against each alternative","Check these before you commit"],id:"choosing-lunora",summary:"A decision guide for choosing Lunora over Convex, Supabase, Firebase, Appwrite, or raw Cloudflare, including the cases where Lunora is the\u2026",title:"Is Lunora the right backend?"},{headings:["Authentication","lunora cloud deploy","lunora cloud rollback","lunora cloud eject","Reading logs","Push-to-deploy, without the CLI","What is not here yet"],id:"cloud/cli",summary:"Deploy to Lunora Cloud, roll a release back, and eject your data and config to your own Cloudflare account \u2014 all from the one `lunora`\u2026",title:"CLI"},{headings:["How telemetry reaches the cloud","Traces","Issues","Logs","Metrics","Traffic","Scoped ingest keys","Bring your own OpenTelemetry"],id:"cloud/monitoring",summary:"The Lunora cloud is a managed OpenTelemetry backend + control plane \u2014 deploy to it and your traces, logs, metrics, and AI generations flow\u2026",title:"Monitoring"},{headings:[],id:"cloud/serving-responses",summary:"The headers Lunora Cloud adds to an app's responses, what a browser does with them, and which deployments get them.",title:"Serving your app's responses"},{headings:["Make a production app sign-in only"],id:"cloud/who-can-open-my-app",summary:"Production apps on Lunora Cloud are open to anyone with the link. Your app controls sign-in; the preview password gate applies only to\u2026",title:"Who can open my app?"},{headings:["Connect an account","What gets created in your account","What Lunora Cloud keeps","Usage and billing","What works, and what doesn't","Limits","Disconnecting"],id:"cloud/your-own-cloudflare-account",summary:"Connect your Cloudflare account to Lunora Cloud with a scoped API token, and deploy into it as plain Workers. Your data stays in your\u2026",title:"Deploy into your own Cloudflare account"},{headings:["Requirements","Install","Your data","Isolation","What works, and what doesn't","Upgrades","Leaving","Pricing"],id:"cloud/your-own-server",summary:"Run Lunora apps on a Linux server you own, managed by Lunora Cloud through an agent that dials out. Your app data stays in a bucket you own.",title:"Run on your own server"},{headings:["When to use an action vs a mutation","ActionCtx","Calling queries and mutations from an action","Scheduling follow-up work"],id:"concepts/actions",summary:"Non-deterministic functions for external APIs and side effects \u2014 the action builder and its ActionCtx.",title:"Actions"},{headings:["Keep your session authority","Declare ownership once","Call Lunora from your own Worker","Dev proxy: two silent failures","Run both engines during the migration","Test it without a worker","When something is stuck"],id:"concepts/adopt-in-an-existing-app",summary:"Add Lunora to a working product that already has its own auth, Worker, and data layer \u2014 without rewriting either.",title:"Adopt in an existing app"},{headings:["Static lints","Runtime lints","Running advisors"],id:"concepts/advisors",summary:"Splinter-style lints that catch schema, performance, and security problems \u2014 many before you deploy.",title:"Advisors"},{headings:["Agent skills","Agent mode","The docs server","The local server","The MCP server","Keeping generated types honest"],id:"concepts/ai-tooling",summary:"Teach Claude Code, Cursor, and Copilot how to use Lunora \u2014 agent skills, agent-aware dev mode, the docs server, and the MCP server.",title:"AI coding agents"},{headings:["What lands in your project","Wire it up","The cards","Enabling the optional flows","Password rules","Username availability","Being an OAuth provider","Avatar and logo uploads"],id:"concepts/auth-ui",summary:"Copy-in sign-in, settings, and organization screens for React, Vue, Svelte, Solid, and Angular \u2014 the code lands in your project and you\u2026",title:"Auth UI"},{headings:["ctx.auth inside functions","@lunora/auth on the server","Routing /api/auth/*","The client side","Feeding row-level security","See also"],id:"concepts/authentication",summary:"How ctx.auth threads the signed-in user through queries, mutations, and actions \u2014 and feeds row-level security.",title:"Authentication"},{headings:["Point-in-time recovery","Snapshot backups","Export and import","Streaming data out continuously","Practising a restore"],id:"concepts/backups",summary:"Snapshot a deployment, recover a shard to any moment in the last 30 days, and move data in and out as NDJSON.",title:"Backups, export & import"},{headings:["Schema first","Reads","Writes","Inputs and safety","Scaling","Lean on Advisors"],id:"concepts/best-practices",summary:"The opinionated idioms that keep a Lunora app fast, safe, and reactive.",title:"Best practices"},{headings:["Enabling Workers Cache","Declarative cache headers on httpRoute","Programmatic cache purging","Why only HTTP actions?","Memoizing an expensive action result","Scaffolding cache-aware routes","Best practices"],id:"concepts/caching",summary:"Edge caching with Cloudflare Workers Cache \u2014 declarative headers on HTTP routes and programmatic cache purging from actions.",title:"Caching"},{headings:["The short version","Rows or events?","Live topics, whispers and rooms","Streams","Write a row, then tell the page","Things to know before you rely on a live topic"],id:"concepts/choosing-a-data-channel",summary:"Live query, stream, live topic, whisper, room or socket? Which one to use for which job.",title:"Choosing a data channel"},{headings:["Declaring it","What _commitSeq guarantees","Refreshed on every write","Three things it is not","When to reach for it"],id:"concepts/commit-ordering",summary:"Declare .commitOrdered() so every row carries _commitSeq \u2014 a per-shard sequence that orders commits, and the cursor a changefeed can page\u2026",title:"Commit ordering"},{headings:["Defining one","Installing one","What the namespace guarantees","What a component does NOT get","In the architecture view","Migrations","See also"],id:"concepts/components",summary:"Package backend features \u2014 tables, functions, and context \u2014 as an installable unit that cannot collide with the app that installs it.",title:"Components"},{headings:["Constraint kinds","Unique","Non-null","Foreign-key integrity","Error codes"],id:"concepts/constraints",summary:"Unique, non-null and foreign-key integrity declared on the schema and enforced at write time.",title:"Constraints"},{headings:["What it pins","Pinning auth and voice","Pinning mail","Set it once: changing it strands data","Runbook: moving an app to a new jurisdiction"],id:"concepts/data-residency",summary:"Pin Durable Objects to a Cloudflare jurisdiction with .jurisdiction(), and the export\u2192import runbook for moving regions.",title:"Data residency"},{headings:["The type table","Numbers, bigints, and dates","Optional versus null","Values that JSON cannot carry","Size limits","Types outside the schema"],id:"concepts/data-types",summary:"The value types a Lunora document can hold, how each is stored, and which ones need the wire codec to survive JSON.",title:"Data types"},{headings:["Start with lunora doctor","Catch it before it runs","The error overlay","Structured logging with ctx.log","The Studio","Find the slow or failing function","Watch production","Debugging authentication"],id:"concepts/debugging",summary:"The tools to reach for when something is broken \u2014 doctor, the error overlay, ctx.log, the Studio, insights, and live logs.",title:"Debugging"},{headings:["How ids are minted","Typing a reference with v.id","Reading and following ids","Validating an id that came from outside","Ids in exports and imports"],id:"concepts/document-ids",summary:"Every row carries an _id and a _creationTime \u2014 how they are minted, how v.id types a reference, and what an id does and does not guarantee.",title:"Document IDs"},{headings:["Locally: .dev.vars","In production: secrets and vars","Accessing env inside your app","The rule: never commit secrets"],id:"concepts/environment-variables",summary:"Configure secrets and vars \u2014 .dev.vars locally, wrangler secrets in production, env bindings inside functions.",title:"Environment variables"},{headings:["Multiple environments","Linking a checkout to a deployment","Preview deployments","Moving traffic between versions","Build once, deploy many","Custom domains","Trying a deploy without an account","Who changed what"],id:"concepts/environments",summary:"Running staging next to production, deploying an isolated environment, checking pull requests with a dry run, an isolated preview per pull\u2026",title:"Environments & releases"},{headings:["Throwing from a handler","Expected vs. unexpected","Reading error state on the client","Optimistic updates roll back on rejection","See also"],id:"concepts/error-handling",summary:"Throwing inside handlers, how errors travel to the client, and reading error state without losing optimistic safety.",title:"Error handling"},{headings:["What reaches your tracker","Wire it once, to both halves","Sentry","PostHog","Datadog, Axiom, Better Stack, and the rest","Source maps","Privacy"],id:"concepts/error-tracking",summary:"Send Lunora's failed calls and error logs to Sentry, PostHog, Datadog, or any error tracker, with the thrown error's real stack and\u2026",title:"Error tracking"},{headings:["External provider or @lunora/auth","The resolver","Client: hand over the token, refresh it","WebSockets and live queries","RLS with org claims","Memoization and revocation","Composing with @lunora/auth or Cloudflare Access","Walkthrough: Clerk"],id:"concepts/external-auth",summary:"Use Clerk, WorkOS AuthKit, Auth0, Supabase or any OIDC JWT issuer as your identity provider \u2014 verify its token at the Worker and feed\u2026",title:"External auth"},{headings:["Which contexts expose what","Uploading","Serving files","Named buckets","Deleting","See also"],id:"concepts/file-storage",summary:"Typed R2 buckets exposed as ctx.storage \u2014 uploading, serving via signed URLs, and deleting files from your functions.",title:"File storage"},{headings:["Where the work happens","Choosing between them","When a bare filter is fine","How the advisors catch this","Composing","An optional column that is not set","Inside an object column"],id:"concepts/filtering",summary:".filter() is a JavaScript predicate applied after rows are loaded \u2014 when to use it, and when to reach for an index instead.",title:"Filtering"},{headings:["The three context types","Surfaces on every ctx","ctx field matrix","Add-on surfaces (codegen-wired)"],id:"concepts/function-context",summary:"The ctx object passed to every query, mutation, and action \u2014 and what each kind is allowed to do with it.",title:"Function context"},{headings:["api.ts and internal.ts: function references","server.ts: typed helpers","dataModel.ts: Id and Doc","Importing the generated code","lunora/* vs @lunora/* imports","Linting and formatting","Regenerating"],id:"concepts/generated-code",summary:"What @lunora/codegen emits from your schema.ts, and how api / Id / Doc keep server and client in sync.",title:"Generated code"},{headings:["Declaring a point column and a geo index",'"Places near me": near(point, radiusMeters)',"Bounding box: within(box)","Single-shard scope","How the Advisors catch geo mistakes"],id:"concepts/geospatial",summary:'Store lat/lng points with v.geoPoint, index them with .geoIndex, and answer "places near me" and bounding-box reads with withGeoIndex.',title:"Geospatial"},{headings:["httpAction","HttpActionCtx","Typed routes with httpRoute","How routes mount in the worker","Adding routes to a router another module owns"],id:"concepts/http-endpoints",summary:"Public HTTP routes with httpAction and the Hono-based httpRouter.",title:"HTTP endpoints"},{headings:["Declaring an index","Querying with withIndex","Why every filtered read should hit an index","How the Advisors catch unindexed reads","Checking a read with explain","Aggregate indexes"],id:"concepts/indexes",summary:"Declare B-tree indexes on tables and query them with withIndex \u2014 every filtered read should hit one.",title:"Indexes"},{headings:["Calling internal functions","Internal functions and scheduling"],id:"concepts/internal-functions",summary:"internalQuery / internalMutation / internalAction \u2014 server-only functions never exposed to the client.",title:"Internal functions"},{headings:["Declare the stream","Publish","Follow a topic in the browser","Authorization","Where delivery stops","Platform support","React Native"],id:"concepts/live-streams",summary:"Publish events to named topics from the server and follow many of them over one SSE connection.",title:"Live topic streams"},{headings:["Turn CDC on first","Why the DO topology fits","Shapes \u2014 partial replication","The poke diff protocol","Custom mutators \u2014 optimistic, server-authoritative","The client store","Cross-shard joins \u2014 the one limit"],id:"concepts/local-first",summary:"Shapes, the poke diff protocol, and custom mutators \u2014 the Zero-class sync engine.",title:"Local-first sync"},{headings:["Strategies","Roles and bypass","What's masked, what isn't","Sensitive arguments","Tooling","See also"],id:"concepts/masking",summary:"Column-level redaction on the read path \u2014 the companion to row-level security.",title:"Data masking"},{headings:["The lifetime","Rebuilding: onShardInit","What .memory() buys, and what it does not","Restrictions","Choosing between .memory() and .ttl()"],id:"concepts/memory-tables",summary:"Declare .memory() for state the shard rebuilds rather than remembers \u2014 presence, cursors, live counters \u2014 and onShardInit to bring it back\u2026",title:"Memory tables"},{headings:["Attaching middleware","Augmenting ctx","Composing concerns"],id:"concepts/middleware",summary:"Compose cross-cutting concerns \u2014 auth checks, rate limiting, logging \u2014 and augment ctx for downstream handlers.",title:"Middleware"},{headings:["The deploy gate tells you when you need one","Schema migrations (global tables)","Data migrations (sharded tables)","Inspecting run-state in the Studio","One-off data edits without a deploy","Resetting local state"],id:"concepts/migrations",summary:"Schema-change SQL for global tables and online, resumable data migrations.",title:"Migrations"},{headings:["Queues and topics","What you get","Table ownership","Installed components"],id:"concepts/modules",summary:"Group lunora/ folders into modules and get a module catalog and an architecture diagram from codegen.",title:"Modules"},{headings:["Running as one node in a dev graph","Deploying from external IaC","Consuming the generated API from a sibling package","Calling the backend from a sibling Worker"],id:"concepts/monorepos-and-iac",summary:"Running the Lunora worker as one node in a larger dev graph, deploying it from Terraform/Pulumi/Alchemy, and consuming its generated API\u2026",title:"Monorepos and external IaC"},{headings:["The output is pinned to your CLI version","Wiring it into your project","What you get, and what you don't","Conformance"],id:"concepts/non-js-sdks",summary:"Generate a typed, self-contained Lunora client for Python, Go, Ruby, Rust, Swift, Java, Kotlin or Dart/Flutter \u2014 vendored into your\u2026",title:"Non-JS SDKs"},{headings:["Configure defineNotify","VAPID / FCM config via .dev.vars","Native devices (Android and iOS)","Register a browser push subscription","Send from an action","Queue-backed fan-out"],id:"concepts/notifications",summary:"Configure defineNotify in lunora/notify.ts for Web Push + FCM, register browser subscriptions, and send via ctx.notify / ctx.push from an\u2026",title:"Push notifications"},{headings:["Sinks","Structured logging with ctx.log","Tracing sub-operations with ctx.trace","Database telemetry (ctx.db and ctx.sql)","Trace sampling","Source maps","Application metrics with ctx.metrics","Container telemetry"],id:"concepts/observability",summary:"Ship Lunora's logs, traces, and metrics to any OTLP collector \u2014 the otlpSink worker option, ctx.log/ctx.trace/ctx.metrics, the zero-config\u2026",title:"Observability"},{headings:["Mutations are serialized, not retried","Where conflicts still happen","Handling a conflict on the client","Diagnosing a persistent conflict","Atomicity across shards",".global() tables"],id:"concepts/occ",summary:"Why mutations in one shard are serialized rather than retried, where optimistic-concurrency conflicts still arise, and what atomicity\u2026",title:"OCC & atomicity"},{headings:["Passing the adapters explicitly","What gets persisted","Surviving a breaking deploy","Multiple tabs","Sync status","Connection status UI","Boot with no network (the app shell)","The reconciliation model"],id:"concepts/offline-first",summary:"Persist reads and writes to disk so the app boots, renders, and accepts edits with no network.",title:"Offline-first"},{headings:["PaginationOptions","PaginationResult","Paging through a query","Ordering rows that hold NULL","Paging a findMany","Load more / infinite lists on the client",'Total count ("42 of 1,203")'],id:"concepts/pagination",summary:"Keyset pagination with .paginate(options) \u2014 page through a query and build an infinite list on the client.",title:"Pagination"},{headings:["ctx.db","ctx.auth","ctx.scheduler"],id:"concepts/queries-mutations",summary:"query / mutation / action \u2014 what each is for and how ctx is shaped.",title:"Queries & mutations"},{headings:["How this differs from a trigger","The convergence contract","What the handler receives","Execution and identity","Reads that should not wake you","Watching them work"],id:"concepts/reactors",summary:"Declare onQueryChange to run server logic when a query's result changes \u2014 the actor pattern, with no client on the other end and nothing\u2026",title:"Reactors (server-side reactivity)"},{headings:["Where a shard is created","Replica reads","Sockets near the client"],id:"concepts/read-replicas",summary:"Serve one-shot queries from a copy of the shard in the caller's region, pin where a shard is created, and terminate sockets near the client.",title:"Read replicas & placement"},{headings:["Hibernation","How an update reaches a subscriber","When a re-run fails","Reconnect","When WebSockets are blocked","Durable streams","Whispers (ephemeral peer messages)","Why no MQTT / Pub/Sub"],id:"concepts/realtime",summary:"How subscriptions, deltas, and hibernation fit together.",title:"Real-time"},{headings:["Using items","The manifest","Validation","Building the catalog","Distributing"],id:"concepts/registry-items",summary:"Package a reusable capability \u2014 schema, functions, bindings and env vars \u2014 as a registry item others install with one command.",title:"Authoring registry items"},{headings:["A worked example","The edge set","Directions","Depth, limit and score","Cycles and paging","It is an ordinary read","Fusing the graph into retrieval","From an AI agent"],id:"concepts/relation-graph",summary:"Traverse the foreign-key graph your schema already declares with ctx.db.related \u2014 depth-bounded, cycle-safe, scored by proximity, and\u2026",title:"Relation graph"},{headings:["The descriptors","Many-to-many","Index your foreign keys","Querying across a relation","Writing through a relation","Relations vs the relation graph"],id:"concepts/relations",summary:"Modeling many-to-one, one-to-many and many-to-many relationships with the one / many relation descriptors, foreign-key columns, join\u2026",title:"Relations"},{headings:["Default-closed","URLs and methods","Arguments","Choosing a shard","Authentication","Rate limiting","Caching","OpenAPI"],id:"concepts/rest-api",summary:"Publish a query, mutation, or action as a plain REST endpoint with .expose({ rest: true }) \u2014 default-closed, routed through the procedure\u2026",title:"Public REST API"},{headings:["Policies","Permissions and roles","Relation predicates","What's covered, what isn't","Testing policies","See also"],id:"concepts/rls",summary:"Server-side authorization that decides which rows a procedure can read or write.",title:"Row-level security"},{headings:["Node compatibility","Where the constraints bite","Bundling","The worker entry","Build once, deploy many"],id:"concepts/runtime",summary:"Everything runs on the Workers runtime \u2014 what that means for Node APIs, dependencies, and the 64 MiB bundle you have to fit into.",title:"Runtime & bundling"},{headings:["Deferring a function","Recurring jobs (Cron Triggers)","How dispatch works","See also"],id:"concepts/scheduling",summary:"Defer follow-up work with ctx.scheduler.runAfter / runAt, and run recurring jobs via Cron Triggers.",title:"Scheduling"},{headings:["Validators","Tier modifiers","Indexes"],id:"concepts/schema",summary:"Declarative tables, validators, indexes and sharding.",title:"Schema"},{headings:["Declaring a search index","Language","Running a search query","Matching rules","Filter fields","Relevance ordering, .take(n) and pagination","Limits","Backfill and staged"],id:"concepts/search",summary:"Declare a search index on a table and run relevance-ordered full-text queries.",title:"Full-text search"},{headings:["The HTTP edge","Auth, cookies, and secrets","Protecting public procedures","Securing sharded access","Advisor catalog","Config-time validation"],id:"concepts/security",summary:"Lunora's secure-by-default posture \u2014 the protections you get for free, how to opt out, and the advisor lints that catch the gaps.",title:"Security"},{headings:["Prerequisites","Write the accounts file","Run it","What a run does","Run it from CI","Seed from code instead","See also"],id:"concepts/seed-test-accounts",summary:"Create real, sign-in-able test accounts and organizations on a dev or staging worker with `lunora auth seed`, and re-run it safely from CI.",title:"Seed test accounts"},{headings:["From an SSR loader","From a script","From the terminal","From Python","From any language, over HTTP","Writing a new SDK"],id:"concepts/server-clients",summary:"Calling a Lunora deployment without a live subscription \u2014 from SSR loaders, scripts, other languages, or plain HTTP.",title:"Server-side & non-reactive clients"},{headings:["Declare a service","Call it from an action","What Lunora wires","Test an action that calls one","Make the service private","Smart Placement","Platforms","Migrating from URLs and HMAC"],id:"concepts/services",summary:"Call sibling Cloudflare Workers from actions over typed service bindings, run them in one dev session, and deploy them before the app.",title:"Services"},{headings:["When to shard","Migrating a populated table","What stays in the root DO","Going global","Cross-shard reads","The shard registry","Securing shard access"],id:"concepts/sharding",summary:"Default __root__ DO, opt-in .shardBy(), and .global() escape hatch.",title:"Sharding"},{headings:["The one caveat that matters","The read surface","_scheduled_functions","_storage"],id:"concepts/system-tables",summary:"Read pending scheduled jobs and stored file metadata through ctx.db.system \u2014 a read-only, eventually consistent view outside the mutation\u2026",title:"System tables"},{headings:["Install","Configure","Write a test","Run in CI"],id:"concepts/testing-ai-features",summary:"Drive a Lunora app's AI flows in a real browser with the e2e runner, and judge non-deterministic model output with natural-language\u2026",title:"Testing AI features end to end"},{headings:["The in-memory harness","Asserting reactive results","Mail-catcher helpers (E2E)","Running in CI"],id:"concepts/testing",summary:"Unit-test queries, mutations, and actions in memory with lunoraTest \u2014 no worker, no network.",title:"Testing"},{headings:["Declaring a TTL","Sweep semantics: coarse, batched, bounded","Not on .global() tables","Interaction with soft delete","How the Advisors catch TTL mistakes"],id:"concepts/ttl",summary:"Declare a table-level .ttl() so a DO alarm sweep auto-deletes expired rows \u2014 sessions, OTPs, and other ephemeral data.",title:"TTL & auto-expiry"},{headings:["Where types come from","Do not restate what is inferred","Reach for Doc and Id","Pin the client contract with .output()","Optional versus null in types","Bringing your own validators","Project configuration","Keeping types honest in CI"],id:"concepts/typescript",summary:"Getting the most out of Lunora's end-to-end types \u2014 where types come from, what to annotate, and what to let inference do.",title:"TypeScript"},{headings:["Job 1: column types in defineTable","Job 2: argument and return validation","Return-type inference to the client","Common validators","Coming from zod","ValidationError"],id:"concepts/validation",summary:"The v.* validators that type your columns and parse query / mutation / action inputs and outputs end to end.",title:"Validation"},{headings:["Declaring an index","Automatic write sync","ctx.vectors","RAG with @lunora/ai","Binding & config wiring"],id:"concepts/vector-search",summary:"Typed Vectorize indexes on ctx.vectors \u2014 automatic write sync, similarity search, and RAG with embeddings.",title:"Vector search"},{headings:["The specification","Conformance fixtures","SDKs built on it"],id:"concepts/wire-protocol",summary:"The language-independent Lunora client\u2194server wire protocol and the golden fixtures every SDK is tested against.",title:"Wire protocol"},{headings:["Idle and small apps: the free plan","Past the free plan: Workers Paid","Which meters grow with your app","Choosing where the cost lands"],id:"cost",summary:"What a self-hosted Lunora app costs on Cloudflare, what the free plan covers, and which meters grow with traffic.",title:"What Lunora costs to run"},{headings:["wrangler.jsonc","lunora.config.ts","Secrets","Containers","Deploy","Durable Object class limit","Worker size","Streaming logs"],id:"deployment",summary:"Wrangler bindings, secrets, and the deploy flow.",title:"Deployment"},{headings:["Redacted codes","Build-time errors","Throwing your own","Error codes"],id:"errors",summary:"Every well-known Lunora error code \u2014 its HTTP status, what it means, and what to do about it.",title:"Errors & warnings reference"},{headings:["Branching on one","The same number, in the document","Where the numbers come from","From your own code"],id:"exit-codes",summary:"The exit code every lunora command terminates with \u2014 what each number means, and how it is derived from the error catalog.",title:"CLI exit codes"},{headings:["Is Lunora open source?","Can I run Lunora on my own Cloudflare account?","Is Lunora production-ready?","Does Lunora run on Cloudflare's free plan?","Can one app scale past a single Durable Object?","How do I move an existing app to Lunora?"],id:"faq",summary:"Short answers to the questions people ask before adopting Lunora, with links to the pages that go deeper.",title:"FAQ"},{headings:["Install","Provide the client","Live queries","Mutations","Connection status","Reactive loaders"],id:"frameworks/angular",summary:"Use Lunora with Angular \u2014 provideLunora in your app config, signal-based liveQuery, imperative mutate, and a connectionStatus signal.",title:"Angular"},{headings:["Install","Exports","The integration","Single-worker composition with withLunora","Reactive-loader server helpers","Deploy"],id:"frameworks/astro",summary:"Compose Astro's @astrojs/cloudflare worker with Lunora realtime, plus reactive-loader server helpers for .astro frontmatter.",title:"Astro"},{headings:["One worker, two dispatch flows","Mount Lunora inside your framework","The per-framework matrix","Client adapters","Scaffolding","Vite composition"],id:"frameworks/bring-your-framework",summary:"Compose any meta-framework's SSR with Lunora realtime in one Cloudflare Worker.",title:"Bring your framework"},{headings:["One worker, two dispatch flows","Class A: Lunora owns the worker entry","Class B: the framework owns the CF adapter","Class C: SPA / SSR-less","Wrangler reconciliation"],id:"frameworks/deploy",summary:"One worker, one deploy \u2014 how a composed Lunora + meta-framework app ships to Cloudflare.",title:"Deploy your framework"},{headings:["Why two workers","Wiring them together","Client and server entry points","Loading data in a Server Component","Providing the client","Developing","Deploying"],id:"frameworks/nextjs",summary:"Run Lunora alongside Next.js on Cloudflare with the two-worker split \u2014 RSC loaders that hydrate into live subscriptions.",title:"Next.js"},{headings:["Install","Setup","How it works","Provide the client","Reactive loaders","Feature flags","Verify before deploy","Alternative: two-worker split"],id:"frameworks/nuxt",summary:"Run Lunora and Nuxt as one Cloudflare Worker \u2014 the @lunora/nuxt module mounts /_lunora/** into Nitro, plus reactive-loader server helpers.",title:"Nuxt"},{headings:["Scaffold a new app","Install","Create the client","Provide it","Live queries and mutations","HTTP streams","Local-first (shapes, custom mutators, TanStack DB)","Authentication (better-auth + Expo)"],id:"frameworks/react-native",summary:"Use Lunora in a React Native / Expo app \u2014 the same live hooks, plus an AsyncStorage-backed client and a better-auth Expo bridge.",title:"React Native / Expo"},{headings:["Install","Provide the client","Live queries","Mutations","Auth","Reactive loaders","One worker, one deploy"],id:"frameworks/react",summary:"Use Lunora with React \u2014 a provider, live useQuery/useMutation hooks, and the SSR-seed \u2192 live reactive-loader handoff.",title:"React"},{headings:["The problem with static loaders","The handoff","Why there's no flash","Identity continuity (SSR \u2192 client)","Sharding carries through","Status"],id:"frameworks/reactive-loaders",summary:"Your loaders are live \u2014 SSR data that hydrates into a real-time subscription with no flash.",title:"Reactive loaders"},{headings:["Install","Solid 1.x and Solid 2.0","Provide the client","Live queries","Mutations","Reactive loaders"],id:"frameworks/solid",summary:"Use Lunora with SolidJS \u2014 a provider, live createQuery/createMutation primitives, and the SSR-seed \u2192 live reactive-loader handoff.",title:"Solid"},{headings:["Install","Provide the client","Live queries","Mutations","Reactive loaders","One worker, one deploy"],id:"frameworks/svelte",summary:"Use Lunora with Svelte 5 / SvelteKit \u2014 context-provided client, live query/mutation stores, and the SSR-seed \u2192 live reactive-loader handoff.",title:"Svelte"},{headings:["What you're proving","1. Scaffold","2. Dev","3. Prove SSR preload (curl the raw HTML)","4. Prove the live subscription attaches","5. Prove live update (two tabs)","Identity check (optional, with auth)",'What "pass" looks like'],id:"frameworks/verify-live-loaders",summary:"How to actually prove live loaders work \u2014 scaffold, SSR-curl the preloaded value, two-tab live update.",title:"Manual end-to-end verification"},{headings:["Install","Provide the client","Live queries","Mutations","Reactive loaders","Worker composition"],id:"frameworks/vue",summary:"Use Lunora with Vue 3 \u2014 a client plugin, live useQuery/useMutation composables, and the server-side rendering (SSR) seed to live\u2026",title:"Vue"},{headings:["Requirements"],id:"getting-started",summary:"Scaffold a Lunora app and run the dev loop in under a minute.",title:"Getting started"},{headings:["Durable Objects","Statement limits (Durable Objects **and** D1)","Transaction limits","D1","R2","Workers","Worker startup (error 10021)","Queues"],id:"limits",summary:"Cloudflare ceilings you should keep in your head.",title:"Limits"},{headings:["Two translations, not one","Schema: transposing the relation graph","Procedures: the shape deltas","Writes: .returning() does not survive","Components decompose by hand"],id:"migrating/from-a-convex-toolkit",summary:"The second translation step a Drizzle-style schema DSL and a tRPC-style procedure builder add on top of the raw Convex mapping.",title:"Migrating from a Convex toolkit"},{headings:["Bump strategy","Breaking changes already landed","Recommended (non-breaking) follow-ups","See also"],id:"migrating/from-alpha",summary:"How a 1.0.0-alpha.* app moves to stable \u2014 dependency bumps plus every breaking change already landed on the road to 1.0.",title:"Upgrading from alpha to 1.0"},{headings:["At a glance","Schema","Queries, mutations, actions","React","Auth","Scheduler","File storage","Subscriptions"],id:"migrating/from-convex",summary:"Side-by-side mapping \u2014 schema, queries, mutations, actions, React hooks.",title:"Migrating from Convex"},{headings:["At a glance","Schema","Reads: onSnapshot \u2192 useQuery","Writes: setDoc \u2192 mutation","Cloud Functions \u2192 actions","Auth","File storage","Scheduled work"],id:"migrating/from-firebase",summary:"Side-by-side mapping \u2014 Firestore, Cloud Functions, Auth, Storage, and real-time listeners.",title:"Migrating from Firebase"},{headings:["At a glance","Schema","Reads: supabase.from(...).select() \u2192 useQuery","Writes: .insert() \u2192 mutation","Row-level security","Edge Functions \u2192 actions","Auth","File storage"],id:"migrating/from-supabase",summary:"Side-by-side mapping \u2014 Postgres tables, RLS, Edge Functions, Auth, Storage, and Realtime.",title:"Migrating from Supabase"},{headings:["No arbitrary external SQL or ad-hoc cross-dataset joins","RPC-first, not REST-first","Cross-shard writes are eventual, not atomic","No data warehouse hosting in the framework","No managed control plane as a hard dependency","Also deliberately absent","See also"],id:"non-goals",summary:"The things Lunora deliberately does not do \u2014 each with the reason it's a boundary and the escape hatch when you need past it.",title:"Design boundaries"},{headings:["Why Lunora","Self-host, or use Lunora Cloud","How Lunora compares","Where it's rough","What ships in the alpha","Start building"],id:"overview",summary:"The Convex-style real-time backend that runs on your own Cloudflare account \u2014 typed end to end, live by default, ~$0 at idle.",title:"Overview"},{headings:["Bindings and wrangler config","Secrets","LUNORA_ADMIN_TOKEN and the admin plane","Rate limiting and abuse","Auth and row-level security","Migrations","Observability","Health and readiness endpoint"],id:"production-checklist",summary:"Everything to verify before a Lunora app takes real traffic \u2014 bindings, secrets, admin tokens, rate limits, RLS, migrations, observability.",title:"Production checklist"},{headings:["Pick a starting point","Adding Lunora to an app you already have","What you get either way","Next steps"],id:"quickstarts",summary:"Every starting point Lunora scaffolds \u2014 pick your framework, run one command, and get a live backend wired to it.",title:"Quickstarts"},{headings:["1. See where you stand","2. Create the usage alerts","3. Add the budget alert by hand","4. Check delivery","In CI"],id:"runaway-bill",summary:"Set Cloudflare usage alerts well above normal with `lunora cloudflare alerts`, add the budget alert the API cannot, and check what\u2026",title:"Protect yourself from a runaway bill"},{headings:["Why startup grows with the app","Measure it locally","The fix: load function modules on demand","Keep heavy packages off the startup path"],id:"startup-cpu-limit",summary:'Why a large app fails to deploy with "Script startup exceeded CPU time limit", how to measure it, and how lazy function loading and\u2026',title:"Worker startup CPU limit (error 10021)"},{headings:["1. Scaffold","2. Model the data","3. Generate the migration","4. Write the query","5. Write the mutation","6. Wire the React app","7. Run the dev loop","8. Deploy"],id:"tutorial/realtime-chat",summary:"End-to-end Lunora walkthrough \u2014 schema, query, mutation, subscription, React, sharding.",title:"Build a real-time chat app in 15 minutes"},{headings:["Know when to act","Step 1: shard the messages","Step 2: put identities in a global table","Step 3: keep fan-out off the hot path","Step 4: lock down shard access","Step 5: migrate the data you already have","Checking your work","What you learned"],id:"tutorial/scaling",summary:"Take the chat app from one Durable Object to many \u2014 shard by channel, put identities in a global table, and keep cross-shard reads off the\u2026",title:"Tutorial: scaling the chat app"},{headings:["Release channels","What SemVer means here","Stability tiers",'What "experimental" means',"See also"],id:"versioning",summary:"What SemVer means for Lunora packages \u2014 release channels, stability tiers, and the experimental surface.",title:"Versioning & stability"}],l="https://lunora.sh/docs/",u=4,m=3,g=200,p=4,y=3,f=2,w=1,v=r(t=>t.slice(0,g).toLowerCase().split(/[^a-z0-9.]+/u).filter(a=>a.length>=m),"w"),b=r((t,a)=>{let n=t.id.toLowerCase(),e=t.title.toLowerCase(),s=t.summary.toLowerCase(),c=t.headings.map(i=>i.toLowerCase()),o=0;for(let i of a)n.includes(i)&&(o+=p),e.includes(i)&&(o+=y),c.some(h=>h.includes(i))&&(o+=f),s.includes(i)&&(o+=w);return o},"v"),k=r(t=>{let a=v(typeof t=="string"?t:""),n=a.length===0?[]:d.map(e=>({candidate:e,rank:b(e,a)})).filter(e=>e.rank>0).sort((e,s)=>s.rank-e.rank).slice(0,u).map(e=>({...e.candidate,url:`${l}${e.candidate.id}`}));return{entries:n.length===0?d.map(e=>e.id):n}},"b"),S=r(t=>{let{entries:a}=k(t);return a.every(n=>typeof n=="string")?[`Documentation pages under ${l}: ${a.join(", ")}`]:a.map(n=>{let e=n;return`${e.title} (${e.url}): ${e.summary} Sections: ${e.headings.join(", ")}`})},"k");export{S as knowledgeExcerpts};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as we}from"./chunk-5FHGTA7V.js";import{a as ve}from"./chunk-M6WDFEUZ.js";import{j as me}from"./chunk-SQO3WGXH.js";import"./chunk-R76ATTPC.js";import"./chunk-4AG356VE.js";import{a as q}from"./chunk-ECXQQPVU.js";import"./chunk-EOHXBC4U.js";import"./chunk-JEJV6SVN.js";import{a as ue}from"./chunk-V5ZKAZR6.js";import"./chunk-DMQVY5L7.js";import{a as ae,b as re,c as ne,d as L,e as h,f as p}from"./chunk-WVAWKCNQ.js";import{a as X}from"./chunk-LYVYUTQY.js";import{c as Ne}from"./chunk-LUHBGCMO.js";import{a as ee,e as te}from"./chunk-VUMS4VIV.js";import{n as ce}from"./chunk-PLCYDHU3.js";import"./chunk-WY23EROJ.js";import{B as Y,h as ie,i as de,j as U,p as pe,s as z}from"./chunk-G4H5DPO6.js";import"./chunk-JSVT5VBU.js";import{a as be}from"./chunk-A6TVTNKO.js";import{a as ke,b as Se}from"./chunk-ADABTCDI.js";import{a as s,d as he}from"./chunk-5PEAXTYQ.js";var xe=he(be(),1),i=he(ke(),1);var t=he(Se(),1);var Ce=["queued","running","rollingBack","paused","waiting","complete","errored","terminated"],Oe=["pause","resume","restart","terminate"],Ie=s(l=>{let e=(0,xe.c)(7),{busy:w,id:x,onAct:N}=l,b=Y(),a;e[0]!==w||e[1]!==x||e[2]!==N||e[3]!==b?(a=Oe.map(m=>m==="restart"?(0,t.jsx)(ve,{confirmLabel:b("Restart?"),disabled:w,onConfirm:s(()=>{N(m)},"onConfirm"),testId:`workflow-instance-${m}-${x}`,children:b(m)},m):(0,t.jsx)(q,{"data-testid":`workflow-instance-${m}-${x}`,disabled:w,onClick:s(()=>{N(m)},"onClick"),size:"sm",type:"button",variant:"ghost",children:b(m)},m)),e[0]=w,e[1]=x,e[2]=N,e[3]=b,e[4]=a):a=e[4];let d;return e[5]!==a?(d=(0,t.jsx)(t.Fragment,{children:a}),e[5]=a,e[6]=d):d=e[6],d},"Ce"),$e="WORKFLOWS_NOT_CONFIGURED",We=s(l=>typeof l=="object"&&l!==null&&l.code===$e,"Oe"),Ae=s(l=>{let e=l.error??l.output;if(e===void 0)return"\u2014";try{return JSON.stringify(e,pe)}catch{return"(unserializable)"}},"Ee"),Te=s(({loadDetail:l,loadInstances:e,readOnly:w,runAction:x,workflowName:N})=>{let b=ce(),a=Y(),[d,m]=(0,i.useState)(null),[v,R]=(0,i.useState)(null),[S,B]=(0,i.useState)(""),[C,O]=(0,i.useState)(null),[F,W]=(0,i.useState)(!1),[_,j]=(0,i.useState)(null),g=(0,i.useRef)(0),y=(0,i.useRef)(0),k=(0,i.useRef)(0),A=l??(n=>b.getWorkflowInstance(n)),I=w?void 0:x??(e===void 0?n=>b.setWorkflowInstanceStatus(n):void 0),T=s(async()=>{y.current+=1;let n=y.current;O(null),W(!1);let u=S===""?void 0:S;try{if(e===void 0){let r=await b.listWorkflowInstances({name:N,status:u});if(n!==y.current)return;if(r.configured===!1){m(null),W(!0);return}m(r.instances);return}let f=await e({name:N,status:u});n===y.current&&m(f)}catch(f){if(n!==y.current)return;m(null),We(f)?W(!0):O(U(f))}},"E");(0,i.useEffect)(()=>{g.current+=1,k.current+=1,R(null),z(T())},[N,S]);let P=s(async n=>{k.current+=1;let u=k.current;O(null);try{let f=await A({id:n,name:N});u===k.current&&R(f)}catch(f){u===k.current&&O(U(f))}},"W"),E=s(()=>{k.current+=1,R(null)},"A"),J=s(async(n,u)=>{if(I===void 0)return;let f=g.current;j(n),O(null);try{await I({action:u,id:n,name:N}),f===g.current&&await T()}catch(r){O(U(r))}j(null)},"L");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("h3",{className:"text-sm font-medium",children:a("Instance history")}),(0,t.jsxs)("select",{"aria-label":a("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:s(n=>{B(n.target.value)},"onChange"),value:S,children:[(0,t.jsx)("option",{value:"",children:a("All statuses")}),Ce.map(n=>(0,t.jsx)("option",{value:n,children:n},n))]})]}),C!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:C}),F&&(0,t.jsx)(ue,{description:a("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:a("Workflow inspection not configured")}),!F&&d!==null&&d.length===0&&(0,t.jsx)(ue,{description:a("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:a("No instances")}),d!==null&&d.length>0&&(0,t.jsx)(ee,{className:"overflow-hidden py-0",children:(0,t.jsx)(te,{className:"px-0",children:(0,t.jsxs)(ae,{"data-testid":"workflow-instances-table",children:[(0,t.jsx)(re,{children:(0,t.jsxs)(L,{children:[(0,t.jsx)(h,{children:a("Instance id")}),(0,t.jsx)(h,{children:a("Status")}),(0,t.jsx)(h,{children:a("Created")}),(0,t.jsx)(h,{children:a("Ended")}),(0,t.jsx)(h,{"aria-label":a("Actions")})]})}),(0,t.jsx)(ne,{children:d.map(n=>(0,t.jsxs)(L,{"data-testid":`workflow-instance-${n.id}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:n.id}),(0,t.jsx)(p,{className:"font-mono text-xs",children:n.status}),(0,t.jsx)(p,{className:"text-muted-foreground tabular-nums",children:n.createdOn??"\u2014"}),(0,t.jsx)(p,{className:"text-muted-foreground tabular-nums",children:n.endedOn??"\u2014"}),(0,t.jsx)(p,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[(0,t.jsx)(q,{"data-testid":`workflow-instance-steps-${n.id}`,onClick:s(()=>{z(P(n.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:a("Steps")}),I!==void 0&&(0,t.jsx)(Ie,{busy:_===n.id,id:n.id,onAct:s(u=>{z(J(n.id,u))},"onAct")},N)]})})]},n.id))})]})})}),v!==null&&(0,t.jsx)(ee,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,t.jsxs)(te,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("span",{className:"font-mono text-xs",children:[a("Steps")," \xB7 ",v.id]}),(0,t.jsx)(q,{"data-testid":"workflow-instance-detail-close",onClick:E,size:"xs",type:"button",variant:"ghost",children:a("Close")})]}),v.steps.length===0?(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:a("This instance has no recorded steps yet.")}):(0,t.jsxs)(ae,{"data-testid":"workflow-instance-steps",children:[(0,t.jsx)(re,{children:(0,t.jsxs)(L,{children:[(0,t.jsx)(h,{children:a("Step")}),(0,t.jsx)(h,{children:a("Type")}),(0,t.jsx)(h,{children:a("Attempts")}),(0,t.jsx)(h,{children:a("Started")}),(0,t.jsx)(h,{children:a("Output")})]})}),(0,t.jsx)(ne,{children:v.steps.map((n,u)=>(0,t.jsxs)(L,{"data-testid":`workflow-step-${String(u)}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:n.name}),(0,t.jsx)(p,{className:"text-xs text-muted-foreground",children:n.type??"\u2014"}),(0,t.jsx)(p,{className:"tabular-nums",children:n.attempts??"\u2014"}),(0,t.jsx)(p,{className:"text-muted-foreground tabular-nums",children:n.start??"\u2014"}),(0,t.jsx)(p,{className:"font-mono text-xs text-muted-foreground",children:Ae(n)})]},`${n.name}:${String(u)}`))})]})]})})]})},"_e"),_e=ie(X.createWorkflowInstance),Ee=ie(X.getWorkflowInstanceStatus),Je=ie(X.sendWorkflowEvent),De=s(l=>{if(l.error)return`${l.error.name}: ${l.error.message}`;if(l.output===void 0)return"\u2014";try{return JSON.stringify(l.output,pe)}catch{return"(unserializable)"}},"$e"),ge=s(l=>{let e=l.trim();if(e==="")return{value:void 0};try{return{value:JSON.parse(e)}}catch{return null}},"ve"),Fe=s((l,e)=>l.some(w=>w.exportName===e)?e:l[0]?.exportName??"","Fe"),Pe=s(l=>{let e=(0,xe.c)(72),{eventTypes:w,exportName:x,onSent:N}=l,b=ce(),a=Y(),[d,m]=(0,i.useState)(""),[v,R]=(0,i.useState)(""),[S,B]=(0,i.useState)(""),[C,O]=(0,i.useState)(!1),[F,W]=(0,i.useState)(null),_;e[0]!==b||e[1]!==x||e[2]!==N||e[3]!==a||e[4]!==v?(_=s(async(D,oe)=>{try{await b.query(Je,{exportName:x,id:D,payload:oe,type:v},de(""))}catch(fe){W(U(fe));return}try{await N(x,D)}catch(fe){let ye=fe;W(`${a("Event sent, but refreshing the instance failed")}: ${U(ye)}`)}},"_"),e[0]=b,e[1]=x,e[2]=N,e[3]=a,e[4]=v,e[5]=_):_=e[5];let j=_,g;e[6]!==j||e[7]!==d||e[8]!==S||e[9]!==a?(g=s(async()=>{let D=d.trim(),oe=ge(S);if(oe===null){W(a("Payload must be valid JSON"));return}O(!0),W(null),await j(D,oe.value).finally(()=>{O(!1)})},"N"),e[6]=j,e[7]=d,e[8]=S,e[9]=a,e[10]=g):g=e[10];let y=g,k;e[11]!==a?(k=a("Send event"),e[11]=a,e[12]=k):k=e[12];let A;e[13]!==k?(A=(0,t.jsx)("h3",{className:"text-sm font-medium",children:k}),e[13]=k,e[14]=A):A=e[14];let I;e[15]!==F?(I=F!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-event-error",role:"alert",children:F}),e[15]=F,e[16]=I):I=e[16];let T;e[17]!==a?(T=a("Instance id"),e[17]=a,e[18]=T):T=e[18];let P;e[19]===Symbol.for("react.memo_cache_sentinel")?(P=s(D=>{m(D.target.value)},"O"),e[19]=P):P=e[19];let E;e[20]!==a?(E=a("Instance id"),e[20]=a,e[21]=E):E=e[21];let J;e[22]!==d||e[23]!==T||e[24]!==E?(J=(0,t.jsx)(me,{"aria-label":T,className:"max-w-48","data-testid":"workflows-event-id",onChange:P,placeholder:E,value:d}),e[22]=d,e[23]=T,e[24]=E,e[25]=J):J=e[25];let n;e[26]!==a?(n=a("Event type"),e[26]=a,e[27]=n):n=e[27];let u;e[28]===Symbol.for("react.memo_cache_sentinel")?(u=s(D=>{R(D.target.value)},"L"),e[28]=u):u=e[28];let f;e[29]!==a?(f=a("Event type"),e[29]=a,e[30]=f):f=e[30];let r;e[31]!==n||e[32]!==f||e[33]!==v?(r=(0,t.jsx)(me,{"aria-label":n,className:"max-w-48","data-testid":"workflows-event-type",list:"workflows-event-types",onChange:u,placeholder:f,value:v}),e[31]=n,e[32]=f,e[33]=v,e[34]=r):r=e[34];let c;e[35]!==w?(c=w.map(Le),e[35]=w,e[36]=c):c=e[36];let o;e[37]!==c?(o=(0,t.jsx)("datalist",{"data-testid":"workflows-event-types",id:"workflows-event-types",children:c}),e[37]=c,e[38]=o):o=e[38];let $;e[39]!==x||e[40]!==d||e[41]!==C||e[42]!==v?($=C||x===""||d.trim()===""||v.trim()==="",e[39]=x,e[40]=d,e[41]=C,e[42]=v,e[43]=$):$=e[43];let K;e[44]!==y?(K=s(()=>{z(y())},"z"),e[44]=y,e[45]=K):K=e[45];let G;e[46]!==C||e[47]!==a?(G=a(C?"Sending\u2026":"Send event"),e[46]=C,e[47]=a,e[48]=G):G=e[48];let M;e[49]!==$||e[50]!==K||e[51]!==G?(M=(0,t.jsx)(q,{"data-testid":"workflows-event-button",disabled:$,onClick:K,children:G}),e[49]=$,e[50]=K,e[51]=G,e[52]=M):M=e[52];let Z;e[53]!==r||e[54]!==o||e[55]!==M||e[56]!==J?(Z=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[J,r,o,M]}),e[53]=r,e[54]=o,e[55]=M,e[56]=J,e[57]=Z):Z=e[57];let H;e[58]!==a?(H=a("Payload (JSON)"),e[58]=a,e[59]=H):H=e[59];let se;e[60]===Symbol.for("react.memo_cache_sentinel")?(se=s(D=>{B(D.target.value)},"Y"),e[60]=se):se=e[60];let Q;e[61]!==a?(Q=a("Payload (JSON, optional)"),e[61]=a,e[62]=Q):Q=e[62];let V;e[63]!==S||e[64]!==H||e[65]!==Q?(V=(0,t.jsx)(we,{"aria-label":H,className:"font-mono","data-testid":"workflows-event-payload",onChange:se,placeholder:Q,value:S}),e[63]=S,e[64]=H,e[65]=Q,e[66]=V):V=e[66];let le;return e[67]!==Z||e[68]!==V||e[69]!==A||e[70]!==I?(le=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-event",children:[A,I,Z,V]}),e[67]=Z,e[68]=V,e[69]=A,e[70]=I,e[71]=le):le=e[71],le},"Pe"),Ve=s(()=>{let l=ce(),e=Y(),{data:w,error:x}=Ne(X.listWorkflows,{}),[N,b]=(0,i.useState)(""),[a,d]=(0,i.useState)(""),[m,v]=(0,i.useState)(""),[R,S]=(0,i.useState)(!1),[B,C]=(0,i.useState)(null),[O,F]=(0,i.useState)([]),[W,_]=(0,i.useState)(null),j=w!==void 0,g=Array.isArray(w?.workflows)?[...w.workflows].toSorted((r,c)=>r.exportName.localeCompare(c.exportName)):[],y=Fe(g,N),k=g.find(r=>r.exportName===y),A=s(r=>{F(c=>{let o=c.filter($=>!($.exportName===r.exportName&&$.id===r.id));return[r,...o]})},"T"),I=s(async()=>{let r=y;if(r==="")return;let c=ge(m);if(c===null){C(e("Params must be valid JSON"));return}S(!0),C(null);try{let o=a.trim(),$=await l.query(_e,{exportName:r,id:o===""?void 0:o,params:c.value},de(""));A({exportName:r,id:$.id,status:$.status}),d("")}catch(o){C(U(o))}S(!1)},"F"),T=s(()=>{z(I())},"P"),P=s(async(r,c)=>{_(c);try{let o=await l.query(Ee,{exportName:r,id:c},de(""));A({error:o.error,exportName:r,id:o.id,output:o.output,status:o.status})}catch(o){throw _(null),o}_(null)},"O"),E=s(async(r,c)=>{try{await P(r,c)}catch(o){C(U(o))}},"E"),J=s(r=>{b(r.target.value)},"W"),n=s(r=>{d(r.target.value)},"A"),u=s(r=>{v(r.target.value)},"L"),f=s(r=>{let{export:c,id:o}=r.currentTarget.dataset;c!==void 0&&o!==void 0&&z(E(c,o))},"n");return(0,t.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[x!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:x}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")}),j&&g.length===0?(0,t.jsx)(ue,{description:e("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:e("No workflows defined")}):(0,t.jsx)(ee,{className:"overflow-hidden py-0",children:(0,t.jsx)(te,{className:"px-0",children:(0,t.jsxs)(ae,{"data-testid":"workflows-table",children:[(0,t.jsx)(re,{children:(0,t.jsxs)(L,{children:[(0,t.jsx)(h,{children:e("Export")}),(0,t.jsx)(h,{children:e("Name")}),(0,t.jsx)(h,{children:e("Class")})]})}),(0,t.jsx)(ne,{children:g.map(r=>(0,t.jsxs)(L,{"data-testid":`workflows-row-${r.exportName}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:r.exportName}),(0,t.jsx)(p,{className:"font-mono text-xs text-muted-foreground",children:r.name}),(0,t.jsx)(p,{className:"font-mono text-xs text-muted-foreground",children:r.className})]},r.exportName))})]})})}),g.length>0&&(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,t.jsx)("h3",{className:"text-sm font-medium",children:e("Start instance")}),B!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:B}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("select",{"aria-label":e("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:J,value:y,children:g.map(r=>(0,t.jsx)("option",{value:r.exportName,children:r.exportName},r.exportName))}),(0,t.jsx)(me,{"aria-label":e("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:n,placeholder:e("Instance id (optional)"),value:a}),(0,t.jsx)(q,{"data-testid":"workflows-start-button",disabled:R||y==="",onClick:T,children:e(R?"Starting\u2026":"Start instance")})]}),(0,t.jsx)(we,{"aria-label":e("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:u,placeholder:e("Params (JSON, optional)"),value:m})]}),g.length>0&&(0,t.jsx)(Pe,{eventTypes:w?.eventTypes??[],exportName:y,onSent:P},y),O.length>0&&(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,t.jsx)("h3",{className:"text-sm font-medium",children:e("Instances")}),(0,t.jsx)(ee,{className:"overflow-hidden py-0",children:(0,t.jsx)(te,{className:"px-0",children:(0,t.jsxs)(ae,{"data-testid":"workflows-instances-table",children:[(0,t.jsx)(re,{children:(0,t.jsxs)(L,{children:[(0,t.jsx)(h,{children:e("Workflow")}),(0,t.jsx)(h,{children:e("Instance id")}),(0,t.jsx)(h,{children:e("Status")}),(0,t.jsx)(h,{children:e("Output")}),(0,t.jsx)(h,{})]})}),(0,t.jsx)(ne,{children:O.map(r=>(0,t.jsxs)(L,{"data-testid":`workflows-instance-${r.id}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:r.exportName}),(0,t.jsx)(p,{className:"font-mono text-xs text-muted-foreground",children:r.id}),(0,t.jsx)(p,{className:"font-mono text-xs",children:r.status}),(0,t.jsx)(p,{className:"font-mono text-xs text-muted-foreground",children:De(r)}),(0,t.jsx)(p,{children:(0,t.jsx)(q,{"data-export":r.exportName,"data-id":r.id,"data-testid":`workflows-instance-refresh-${r.id}`,disabled:W===r.id,onClick:f,size:"xs",variant:"outline",children:W===r.id?e("Refreshing\u2026"):e("Refresh")})})]},`${r.exportName}:${r.id}`))})]})})})]}),k!==void 0&&(0,t.jsx)(Te,{workflowName:k.name})]})},"Ze");function Le(l){return(0,t.jsx)("option",{value:l,children:l},l)}s(Le,"De");export{Ve as default};
|
|
1
|
+
import{a as we}from"./chunk-SFGYW6JZ.js";import{a as ve}from"./chunk-B65U64C3.js";import{j as me}from"./chunk-4L2BABMS.js";import"./chunk-R76ATTPC.js";import"./chunk-4AG356VE.js";import{a as q}from"./chunk-LTWCT32V.js";import"./chunk-EOHXBC4U.js";import"./chunk-JEJV6SVN.js";import{a as ue}from"./chunk-ZKEXJDGJ.js";import"./chunk-DMQVY5L7.js";import{a as ae,b as re,c as ne,d as L,e as h,f as p}from"./chunk-H4NGBPG2.js";import{a as X}from"./chunk-LYVYUTQY.js";import{c as Ne}from"./chunk-U7U4ADXH.js";import{a as ee,e as te}from"./chunk-ZBAR562M.js";import{n as ce}from"./chunk-BD76RVBZ.js";import"./chunk-VKBLXJIZ.js";import{B as Y,h as ie,i as de,j as U,p as pe,s as z}from"./chunk-7EUM7G2I.js";import"./chunk-Z2ERBKWN.js";import{a as be}from"./chunk-A6TVTNKO.js";import{a as ke,b as Se}from"./chunk-ADABTCDI.js";import{a as s,d as he}from"./chunk-5PEAXTYQ.js";var xe=he(be(),1),i=he(ke(),1);var t=he(Se(),1);var Ce=["queued","running","rollingBack","paused","waiting","complete","errored","terminated"],Oe=["pause","resume","restart","terminate"],Ie=s(l=>{let e=(0,xe.c)(7),{busy:w,id:x,onAct:N}=l,b=Y(),a;e[0]!==w||e[1]!==x||e[2]!==N||e[3]!==b?(a=Oe.map(m=>m==="restart"?(0,t.jsx)(ve,{confirmLabel:b("Restart?"),disabled:w,onConfirm:s(()=>{N(m)},"onConfirm"),testId:`workflow-instance-${m}-${x}`,children:b(m)},m):(0,t.jsx)(q,{"data-testid":`workflow-instance-${m}-${x}`,disabled:w,onClick:s(()=>{N(m)},"onClick"),size:"sm",type:"button",variant:"ghost",children:b(m)},m)),e[0]=w,e[1]=x,e[2]=N,e[3]=b,e[4]=a):a=e[4];let d;return e[5]!==a?(d=(0,t.jsx)(t.Fragment,{children:a}),e[5]=a,e[6]=d):d=e[6],d},"Ce"),$e="WORKFLOWS_NOT_CONFIGURED",We=s(l=>typeof l=="object"&&l!==null&&l.code===$e,"Oe"),Ae=s(l=>{let e=l.error??l.output;if(e===void 0)return"\u2014";try{return JSON.stringify(e,pe)}catch{return"(unserializable)"}},"Ee"),Te=s(({loadDetail:l,loadInstances:e,readOnly:w,runAction:x,workflowName:N})=>{let b=ce(),a=Y(),[d,m]=(0,i.useState)(null),[v,R]=(0,i.useState)(null),[S,B]=(0,i.useState)(""),[C,O]=(0,i.useState)(null),[F,W]=(0,i.useState)(!1),[_,j]=(0,i.useState)(null),g=(0,i.useRef)(0),y=(0,i.useRef)(0),k=(0,i.useRef)(0),A=l??(n=>b.getWorkflowInstance(n)),I=w?void 0:x??(e===void 0?n=>b.setWorkflowInstanceStatus(n):void 0),T=s(async()=>{y.current+=1;let n=y.current;O(null),W(!1);let u=S===""?void 0:S;try{if(e===void 0){let r=await b.listWorkflowInstances({name:N,status:u});if(n!==y.current)return;if(r.configured===!1){m(null),W(!0);return}m(r.instances);return}let f=await e({name:N,status:u});n===y.current&&m(f)}catch(f){if(n!==y.current)return;m(null),We(f)?W(!0):O(U(f))}},"E");(0,i.useEffect)(()=>{g.current+=1,k.current+=1,R(null),z(T())},[N,S]);let P=s(async n=>{k.current+=1;let u=k.current;O(null);try{let f=await A({id:n,name:N});u===k.current&&R(f)}catch(f){u===k.current&&O(U(f))}},"W"),E=s(()=>{k.current+=1,R(null)},"A"),J=s(async(n,u)=>{if(I===void 0)return;let f=g.current;j(n),O(null);try{await I({action:u,id:n,name:N}),f===g.current&&await T()}catch(r){O(U(r))}j(null)},"L");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("h3",{className:"text-sm font-medium",children:a("Instance history")}),(0,t.jsxs)("select",{"aria-label":a("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:s(n=>{B(n.target.value)},"onChange"),value:S,children:[(0,t.jsx)("option",{value:"",children:a("All statuses")}),Ce.map(n=>(0,t.jsx)("option",{value:n,children:n},n))]})]}),C!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:C}),F&&(0,t.jsx)(ue,{description:a("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:a("Workflow inspection not configured")}),!F&&d!==null&&d.length===0&&(0,t.jsx)(ue,{description:a("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:a("No instances")}),d!==null&&d.length>0&&(0,t.jsx)(ee,{className:"overflow-hidden py-0",children:(0,t.jsx)(te,{className:"px-0",children:(0,t.jsxs)(ae,{"data-testid":"workflow-instances-table",children:[(0,t.jsx)(re,{children:(0,t.jsxs)(L,{children:[(0,t.jsx)(h,{children:a("Instance id")}),(0,t.jsx)(h,{children:a("Status")}),(0,t.jsx)(h,{children:a("Created")}),(0,t.jsx)(h,{children:a("Ended")}),(0,t.jsx)(h,{"aria-label":a("Actions")})]})}),(0,t.jsx)(ne,{children:d.map(n=>(0,t.jsxs)(L,{"data-testid":`workflow-instance-${n.id}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:n.id}),(0,t.jsx)(p,{className:"font-mono text-xs",children:n.status}),(0,t.jsx)(p,{className:"text-muted-foreground tabular-nums",children:n.createdOn??"\u2014"}),(0,t.jsx)(p,{className:"text-muted-foreground tabular-nums",children:n.endedOn??"\u2014"}),(0,t.jsx)(p,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[(0,t.jsx)(q,{"data-testid":`workflow-instance-steps-${n.id}`,onClick:s(()=>{z(P(n.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:a("Steps")}),I!==void 0&&(0,t.jsx)(Ie,{busy:_===n.id,id:n.id,onAct:s(u=>{z(J(n.id,u))},"onAct")},N)]})})]},n.id))})]})})}),v!==null&&(0,t.jsx)(ee,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,t.jsxs)(te,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("span",{className:"font-mono text-xs",children:[a("Steps")," \xB7 ",v.id]}),(0,t.jsx)(q,{"data-testid":"workflow-instance-detail-close",onClick:E,size:"xs",type:"button",variant:"ghost",children:a("Close")})]}),v.steps.length===0?(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:a("This instance has no recorded steps yet.")}):(0,t.jsxs)(ae,{"data-testid":"workflow-instance-steps",children:[(0,t.jsx)(re,{children:(0,t.jsxs)(L,{children:[(0,t.jsx)(h,{children:a("Step")}),(0,t.jsx)(h,{children:a("Type")}),(0,t.jsx)(h,{children:a("Attempts")}),(0,t.jsx)(h,{children:a("Started")}),(0,t.jsx)(h,{children:a("Output")})]})}),(0,t.jsx)(ne,{children:v.steps.map((n,u)=>(0,t.jsxs)(L,{"data-testid":`workflow-step-${String(u)}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:n.name}),(0,t.jsx)(p,{className:"text-xs text-muted-foreground",children:n.type??"\u2014"}),(0,t.jsx)(p,{className:"tabular-nums",children:n.attempts??"\u2014"}),(0,t.jsx)(p,{className:"text-muted-foreground tabular-nums",children:n.start??"\u2014"}),(0,t.jsx)(p,{className:"font-mono text-xs text-muted-foreground",children:Ae(n)})]},`${n.name}:${String(u)}`))})]})]})})]})},"_e"),_e=ie(X.createWorkflowInstance),Ee=ie(X.getWorkflowInstanceStatus),Je=ie(X.sendWorkflowEvent),De=s(l=>{if(l.error)return`${l.error.name}: ${l.error.message}`;if(l.output===void 0)return"\u2014";try{return JSON.stringify(l.output,pe)}catch{return"(unserializable)"}},"$e"),ge=s(l=>{let e=l.trim();if(e==="")return{value:void 0};try{return{value:JSON.parse(e)}}catch{return null}},"ve"),Fe=s((l,e)=>l.some(w=>w.exportName===e)?e:l[0]?.exportName??"","Fe"),Pe=s(l=>{let e=(0,xe.c)(72),{eventTypes:w,exportName:x,onSent:N}=l,b=ce(),a=Y(),[d,m]=(0,i.useState)(""),[v,R]=(0,i.useState)(""),[S,B]=(0,i.useState)(""),[C,O]=(0,i.useState)(!1),[F,W]=(0,i.useState)(null),_;e[0]!==b||e[1]!==x||e[2]!==N||e[3]!==a||e[4]!==v?(_=s(async(D,oe)=>{try{await b.query(Je,{exportName:x,id:D,payload:oe,type:v},de(""))}catch(fe){W(U(fe));return}try{await N(x,D)}catch(fe){let ye=fe;W(`${a("Event sent, but refreshing the instance failed")}: ${U(ye)}`)}},"_"),e[0]=b,e[1]=x,e[2]=N,e[3]=a,e[4]=v,e[5]=_):_=e[5];let j=_,g;e[6]!==j||e[7]!==d||e[8]!==S||e[9]!==a?(g=s(async()=>{let D=d.trim(),oe=ge(S);if(oe===null){W(a("Payload must be valid JSON"));return}O(!0),W(null),await j(D,oe.value).finally(()=>{O(!1)})},"N"),e[6]=j,e[7]=d,e[8]=S,e[9]=a,e[10]=g):g=e[10];let y=g,k;e[11]!==a?(k=a("Send event"),e[11]=a,e[12]=k):k=e[12];let A;e[13]!==k?(A=(0,t.jsx)("h3",{className:"text-sm font-medium",children:k}),e[13]=k,e[14]=A):A=e[14];let I;e[15]!==F?(I=F!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-event-error",role:"alert",children:F}),e[15]=F,e[16]=I):I=e[16];let T;e[17]!==a?(T=a("Instance id"),e[17]=a,e[18]=T):T=e[18];let P;e[19]===Symbol.for("react.memo_cache_sentinel")?(P=s(D=>{m(D.target.value)},"O"),e[19]=P):P=e[19];let E;e[20]!==a?(E=a("Instance id"),e[20]=a,e[21]=E):E=e[21];let J;e[22]!==d||e[23]!==T||e[24]!==E?(J=(0,t.jsx)(me,{"aria-label":T,className:"max-w-48","data-testid":"workflows-event-id",onChange:P,placeholder:E,value:d}),e[22]=d,e[23]=T,e[24]=E,e[25]=J):J=e[25];let n;e[26]!==a?(n=a("Event type"),e[26]=a,e[27]=n):n=e[27];let u;e[28]===Symbol.for("react.memo_cache_sentinel")?(u=s(D=>{R(D.target.value)},"L"),e[28]=u):u=e[28];let f;e[29]!==a?(f=a("Event type"),e[29]=a,e[30]=f):f=e[30];let r;e[31]!==n||e[32]!==f||e[33]!==v?(r=(0,t.jsx)(me,{"aria-label":n,className:"max-w-48","data-testid":"workflows-event-type",list:"workflows-event-types",onChange:u,placeholder:f,value:v}),e[31]=n,e[32]=f,e[33]=v,e[34]=r):r=e[34];let c;e[35]!==w?(c=w.map(Le),e[35]=w,e[36]=c):c=e[36];let o;e[37]!==c?(o=(0,t.jsx)("datalist",{"data-testid":"workflows-event-types",id:"workflows-event-types",children:c}),e[37]=c,e[38]=o):o=e[38];let $;e[39]!==x||e[40]!==d||e[41]!==C||e[42]!==v?($=C||x===""||d.trim()===""||v.trim()==="",e[39]=x,e[40]=d,e[41]=C,e[42]=v,e[43]=$):$=e[43];let K;e[44]!==y?(K=s(()=>{z(y())},"z"),e[44]=y,e[45]=K):K=e[45];let G;e[46]!==C||e[47]!==a?(G=a(C?"Sending\u2026":"Send event"),e[46]=C,e[47]=a,e[48]=G):G=e[48];let M;e[49]!==$||e[50]!==K||e[51]!==G?(M=(0,t.jsx)(q,{"data-testid":"workflows-event-button",disabled:$,onClick:K,children:G}),e[49]=$,e[50]=K,e[51]=G,e[52]=M):M=e[52];let Z;e[53]!==r||e[54]!==o||e[55]!==M||e[56]!==J?(Z=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[J,r,o,M]}),e[53]=r,e[54]=o,e[55]=M,e[56]=J,e[57]=Z):Z=e[57];let H;e[58]!==a?(H=a("Payload (JSON)"),e[58]=a,e[59]=H):H=e[59];let se;e[60]===Symbol.for("react.memo_cache_sentinel")?(se=s(D=>{B(D.target.value)},"Y"),e[60]=se):se=e[60];let Q;e[61]!==a?(Q=a("Payload (JSON, optional)"),e[61]=a,e[62]=Q):Q=e[62];let V;e[63]!==S||e[64]!==H||e[65]!==Q?(V=(0,t.jsx)(we,{"aria-label":H,className:"font-mono","data-testid":"workflows-event-payload",onChange:se,placeholder:Q,value:S}),e[63]=S,e[64]=H,e[65]=Q,e[66]=V):V=e[66];let le;return e[67]!==Z||e[68]!==V||e[69]!==A||e[70]!==I?(le=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-event",children:[A,I,Z,V]}),e[67]=Z,e[68]=V,e[69]=A,e[70]=I,e[71]=le):le=e[71],le},"Pe"),Ve=s(()=>{let l=ce(),e=Y(),{data:w,error:x}=Ne(X.listWorkflows,{}),[N,b]=(0,i.useState)(""),[a,d]=(0,i.useState)(""),[m,v]=(0,i.useState)(""),[R,S]=(0,i.useState)(!1),[B,C]=(0,i.useState)(null),[O,F]=(0,i.useState)([]),[W,_]=(0,i.useState)(null),j=w!==void 0,g=Array.isArray(w?.workflows)?[...w.workflows].toSorted((r,c)=>r.exportName.localeCompare(c.exportName)):[],y=Fe(g,N),k=g.find(r=>r.exportName===y),A=s(r=>{F(c=>{let o=c.filter($=>!($.exportName===r.exportName&&$.id===r.id));return[r,...o]})},"T"),I=s(async()=>{let r=y;if(r==="")return;let c=ge(m);if(c===null){C(e("Params must be valid JSON"));return}S(!0),C(null);try{let o=a.trim(),$=await l.query(_e,{exportName:r,id:o===""?void 0:o,params:c.value},de(""));A({exportName:r,id:$.id,status:$.status}),d("")}catch(o){C(U(o))}S(!1)},"F"),T=s(()=>{z(I())},"P"),P=s(async(r,c)=>{_(c);try{let o=await l.query(Ee,{exportName:r,id:c},de(""));A({error:o.error,exportName:r,id:o.id,output:o.output,status:o.status})}catch(o){throw _(null),o}_(null)},"O"),E=s(async(r,c)=>{try{await P(r,c)}catch(o){C(U(o))}},"E"),J=s(r=>{b(r.target.value)},"W"),n=s(r=>{d(r.target.value)},"A"),u=s(r=>{v(r.target.value)},"L"),f=s(r=>{let{export:c,id:o}=r.currentTarget.dataset;c!==void 0&&o!==void 0&&z(E(c,o))},"n");return(0,t.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[x!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:x}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")}),j&&g.length===0?(0,t.jsx)(ue,{description:e("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:e("No workflows defined")}):(0,t.jsx)(ee,{className:"overflow-hidden py-0",children:(0,t.jsx)(te,{className:"px-0",children:(0,t.jsxs)(ae,{"data-testid":"workflows-table",children:[(0,t.jsx)(re,{children:(0,t.jsxs)(L,{children:[(0,t.jsx)(h,{children:e("Export")}),(0,t.jsx)(h,{children:e("Name")}),(0,t.jsx)(h,{children:e("Class")})]})}),(0,t.jsx)(ne,{children:g.map(r=>(0,t.jsxs)(L,{"data-testid":`workflows-row-${r.exportName}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:r.exportName}),(0,t.jsx)(p,{className:"font-mono text-xs text-muted-foreground",children:r.name}),(0,t.jsx)(p,{className:"font-mono text-xs text-muted-foreground",children:r.className})]},r.exportName))})]})})}),g.length>0&&(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,t.jsx)("h3",{className:"text-sm font-medium",children:e("Start instance")}),B!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:B}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("select",{"aria-label":e("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:J,value:y,children:g.map(r=>(0,t.jsx)("option",{value:r.exportName,children:r.exportName},r.exportName))}),(0,t.jsx)(me,{"aria-label":e("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:n,placeholder:e("Instance id (optional)"),value:a}),(0,t.jsx)(q,{"data-testid":"workflows-start-button",disabled:R||y==="",onClick:T,children:e(R?"Starting\u2026":"Start instance")})]}),(0,t.jsx)(we,{"aria-label":e("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:u,placeholder:e("Params (JSON, optional)"),value:m})]}),g.length>0&&(0,t.jsx)(Pe,{eventTypes:w?.eventTypes??[],exportName:y,onSent:P},y),O.length>0&&(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,t.jsx)("h3",{className:"text-sm font-medium",children:e("Instances")}),(0,t.jsx)(ee,{className:"overflow-hidden py-0",children:(0,t.jsx)(te,{className:"px-0",children:(0,t.jsxs)(ae,{"data-testid":"workflows-instances-table",children:[(0,t.jsx)(re,{children:(0,t.jsxs)(L,{children:[(0,t.jsx)(h,{children:e("Workflow")}),(0,t.jsx)(h,{children:e("Instance id")}),(0,t.jsx)(h,{children:e("Status")}),(0,t.jsx)(h,{children:e("Output")}),(0,t.jsx)(h,{})]})}),(0,t.jsx)(ne,{children:O.map(r=>(0,t.jsxs)(L,{"data-testid":`workflows-instance-${r.id}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:r.exportName}),(0,t.jsx)(p,{className:"font-mono text-xs text-muted-foreground",children:r.id}),(0,t.jsx)(p,{className:"font-mono text-xs",children:r.status}),(0,t.jsx)(p,{className:"font-mono text-xs text-muted-foreground",children:De(r)}),(0,t.jsx)(p,{children:(0,t.jsx)(q,{"data-export":r.exportName,"data-id":r.id,"data-testid":`workflows-instance-refresh-${r.id}`,disabled:W===r.id,onClick:f,size:"xs",variant:"outline",children:W===r.id?e("Refreshing\u2026"):e("Refresh")})})]},`${r.exportName}:${r.id}`))})]})})})]}),k!==void 0&&(0,t.jsx)(Te,{workflowName:k.name})]})},"Ze");function Le(l){return(0,t.jsx)("option",{value:l,children:l},l)}s(Le,"De");export{Ve as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as f}from"./chunk-EOFWXI3T.js";import{B as p}from"./chunk-
|
|
1
|
+
import{b as f}from"./chunk-EOFWXI3T.js";import{B as p}from"./chunk-7EUM7G2I.js";import{a as g}from"./chunk-A6TVTNKO.js";import{b as h}from"./chunk-ADABTCDI.js";import{a as v,d}from"./chunk-5PEAXTYQ.js";var x=d(g(),1);var c=d(h(),1);var y=v(b=>{let e=(0,x.c)(14),{message:i,prefix:n}=b,r=p(),t=f(),l;e[0]!==t?(l=v(()=>{t?.openConsole({errorsOnly:!0})},"l"),e[0]=t,e[1]=l):l=e[1];let u=l;if(i===void 0)return null;let m=`${n}-live-error`,o;e[2]!==i||e[3]!==r?(o=r("Live unavailable: {liveError}",{liveError:i}),e[2]=i,e[3]=r,e[4]=o):o=e[4];let s;e[5]!==t||e[6]!==n||e[7]!==u||e[8]!==r?(s=t===void 0?null:(0,c.jsx)("button",{className:"underline outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":`${n}-live-error-console`,onClick:u,type:"button",children:r("Show in console")}),e[5]=t,e[6]=n,e[7]=u,e[8]=r,e[9]=s):s=e[9];let a;return e[10]!==m||e[11]!==o||e[12]!==s?(a=(0,c.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-destructive","data-testid":m,role:"status",children:[o,s]}),e[10]=m,e[11]=o,e[12]=s,e[13]=a):a=e[13],a},"E");export{y as a};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{F as ve,L as Ze,M as xe,N as et,O as tt,Q as rt,c as Q,g as Xe,h as Ge,n as Qe}from"./chunk-R76ATTPC.js";import{f as $e,g as Je,u as V,v as T,w as be,x as qe}from"./chunk-JEJV6SVN.js";import{a as ie,b as He,f as O,h as ge,i as J}from"./chunk-DMQVY5L7.js";import{x as ze}from"./chunk-
|
|
1
|
+
import{F as ve,L as Ze,M as xe,N as et,O as tt,Q as rt,c as Q,g as Xe,h as Ge,n as Qe}from"./chunk-R76ATTPC.js";import{f as $e,g as Je,u as V,v as T,w as be,x as qe}from"./chunk-JEJV6SVN.js";import{a as ie,b as He,f as O,h as ge,i as J}from"./chunk-DMQVY5L7.js";import{x as ze}from"./chunk-7EUM7G2I.js";import{a as wt}from"./chunk-A6TVTNKO.js";import{a as k,b as ae}from"./chunk-ADABTCDI.js";import{a as t,c as Ot,d as E}from"./chunk-5PEAXTYQ.js";var Nt=E(wt(),1);var Dt=E(k(),1);var Me={};Ot(Me,{Control:()=>It,Description:()=>Ft,Error:()=>vt,Item:()=>ht,Label:()=>gt,Root:()=>bt,Validity:()=>Vt});var w=E(k(),1);var Fe=E(k(),1);var ot="data-valid",it="data-invalid";var se={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},At={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},at={disabled:!1,...At},H={valid(r){return r===null?null:r?{[ot]:""}:{[it]:""}}};var _t={invalid:void 0,name:void 0,validityData:{state:se,errors:[],error:"",value:"",initialValue:null},setValidityData:O,disabled:void 0,setTouched:O,setDirty:O,setFilled:O,setFocused:O,focusOwnerRef:{current:void 0},validationMode:"onSubmit",shouldValidateOnChange:t(()=>!1,"shouldValidateOnChange"),state:at,registerFieldControl:O,validation:{getValidationProps:t((r,e=ge)=>e,"getValidationProps"),inputRef:{current:null},registeredInputs:new Map,registerInput:O,getInputControl:t(()=>null,"getInputControl"),commit:t(async()=>{},"commit"),change:O}},Oe=Fe.createContext(_t);function j(r=!0){let e=Fe.useContext(Oe);if(e.setValidityData===O&&!r)throw new Error(be(28));return e}t(j,"useFieldRootContext");var Ce=E(k(),1);var Pt=Ce.createContext(void 0);function st(r=!1){let e=Ce.useContext(Pt);if(!e&&!r)throw new Error(be(86));return e}t(st,"useFieldsetRootContext");var ye=E(k(),1);var kt=ye.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:O,validationMode:"onSubmit",submitCountRef:{current:0}});function Z(){return ye.useContext(kt)}t(Z,"useFormContext");var ne=E(k(),1);var Ie=E(k(),1);var we=Ie.createContext({controlId:void 0,registerControlId:O,resetControlId:O,labelId:void 0,setLabelId:O,messageIds:[],setMessageIds:O,getDescriptionProps:t(r=>r,"getDescriptionProps")});function B(){return Ie.useContext(we)}t(B,"useLabelableContext");var lt=E(ae(),1);var Ee=t(function(e){let o=Q(),[a,u]=ne.useState(o),[s,i]=ne.useState(),[f,p]=ne.useState([]),c=a===void 0?o:a,l=ie(()=>new Map),{messageIds:b}=B(),x=V((h,y)=>{let v=l.current;y===void 0?v.delete(h):v.set(h,y),u(A=>{if(v.size===0)return A;let U;for(let n of v.values()){if(n===A)return A;U===void 0&&(U=n)}return U})}),R=V(()=>{l.current.size===0&&u(o)}),g=ne.useCallback(h=>{let y=h["aria-describedby"]?h["aria-describedby"].split(" "):[];return y.push(...b,...f),{...h,"aria-describedby":Array.from(new Set(y)).join(" ")||void 0}},[b,f]),S=ne.useMemo(()=>({controlId:c,registerControlId:x,resetControlId:R,labelId:s,setLabelId:i,messageIds:f,setMessageIds:p,getDescriptionProps:g}),[c,x,R,s,i,f,p,g]);return(0,lt.jsx)(we.Provider,{value:S,children:e.children})},"LabelableProvider");var Ae=E(k(),1);function dt(r={}){let{id:e,enabled:o=!0}=r,{controlId:a,registerControlId:u,resetControlId:s}=B(),i=Q(),f=ie(()=>Symbol()),p=Ae.useRef(!1),c=Ae.useRef(!1),l=V(()=>{!p.current||u===O||(p.current=!1,u(f.current,void 0))});return T(()=>{if(!o||u===O){l();return}let b;if(e!==void 0)c.current=!0,b=e;else if(c.current)b=i;else{s();return}if(b===void 0){l();return}p.current=!0,u(f.current,b)},[e,o,u,s,i,f,l]),T(()=>l,[l]),(o?a:void 0)??e??i}t(dt,"useLabelableId");function ut(r,e){let o=Q(r);return T(()=>(e(o),()=>{e(a=>a===o?void 0:a)}),[o,e]),o}t(ut,"useRegisteredLabelId");function ct(r={}){let{id:e,fallbackControlId:o,native:a=!1,setLabelId:u,focusControl:s}=r,{controlId:i,setLabelId:f}=B(),p=V(R=>{f(R),u?.(R)}),c=ut(e,p),l=i??o;function b(R){if(s){s(R,l);return}if(!l)return;let g=Ut(R.currentTarget,l);$e(g)&&jt(g)}t(b,"focusControl");function x(R){let g=Ge(R.nativeEvent);Xe(g,"button,input,select,textarea")||(!R.defaultPrevented&&R.detail>1&&R.preventDefault(),!a&&b(R))}return t(x,"handleInteraction"),a?{id:c,htmlFor:l,onMouseDown:x}:{id:c,onClick:x,onPointerDown(R){R.preventDefault()}}}t(ct,"useLabel");function Ut(r,e){let o=r.getRootNode();for(;Je(o);){let a=o.getElementById(e);if(a)return a;o=o.host.getRootNode()}return qe(r).getElementById(e)}t(Ut,"getControlById");function jt(r){r.focus({focusVisible:!0})}t(jt,"focusElementWithVisible");var re=E(k(),1);function le(r,e){return{...r,state:{...r.state,valid:!e&&r.state.valid}}}t(le,"getCombinedFieldValidityData");var _e=Object.keys(se);function Bt(r,e){return r.matches(":disabled")?!1:!e||r.form===e?!0:r.form===null&&!r.hasAttribute("form")}t(Bt,"isEligibleInput");function ft(r,e){let o=null;for(let a of r.keys())if(Bt(a,e)){if(!a.validity.valid)return a;o??=a}return o}t(ft,"findRepresentativeInput");function mt(r){return{...se,valid:!r,customError:r}}t(mt,"makeState");function Pe(r){return r&&r.validationMessage?[r.validationMessage]:[]}t(Pe,"getNativeErrors");function pt(r){let{elementRef:e,formRef:o}=Z(),{setValidityData:a,validate:u,validityData:s,validationDebounceTime:i,invalid:f,markedDirtyRef:p,state:c,shouldValidateOnChange:l,validationMode:b,registeredFieldIdRef:x}=r,{controlId:R,getDescriptionProps:g}=B(),S=ve(),h=re.useRef(null),y=ie(()=>new Map).current,v=re.useRef(0),A=re.useRef(null),U=re.useCallback((M,_)=>(y.set(M,_),()=>{y.delete(M)}),[y]),n=V(()=>{let M=ft(y,e.current);return M&&y.get(M)?.controlRef.current||null}),m=V(async(M,_=!1)=>{v.current+=1;let D=v.current;function X(d,C=f){let N=x.current??R;if(N==null)return;let I=o.current.fields.get(N);if(!I)return;let z=le(d,C);o.current.fields.set(N,{...I,validityData:z})}t(X,"updateRegisteredFieldValidity");function ee(d,C){let N=d.valid===!1?C:[];return{value:M,state:d,error:N[0]??"",errors:N,initialValue:s.initialValue}}t(ee,"makeValidityData");function oe(d,C){let N=d.validity.customError?d.validationMessage:"",I=C.replace(/\r\n?/g,`
|
|
2
2
|
`);d.setCustomValidity(I),A.current=[d,I,N]}t(oe,"setCustomValidity");function $(){let d=A.current;A.current=null,d&&(!d[0].willValidate||d[0].validationMessage===d[1])&&d[0].setCustomValidity(d[2])}t($,"clearCustomValidity");function L(d,C,N){let I=ee(d,C);X(I,N),a(I)}t(L,"publish");function G(d){let C=_e.reduce((I,z)=>(I[z]=d.validity[z],I),{}),N=!1;for(let I of _e)if(I!=="valid"){if(I==="valueMissing"&&C[I])N=!0;else if(C[I])return C}return N&&!p.current&&(C.valid=!0,C.valueMissing=!1),C}t(G,"getState");function te(){return y.size>0?ft(y,e.current):h.current}t(te,"resolveRepresentativeInput");let W=te();function ue(){return W=te(),W?.willValidate?G(W):mt(!1)}if(t(ue,"refreshState"),_){if(c.valid!==!1||!W)return;if(!W.validity.valueMissing){$();let d=te(),C=d?.validity.customError?Pe(d):[];L(mt(C.length>0),C,!1);return}for(let d of _e)if(d!=="valid"&&d!=="valueMissing"&&d!=="customError"&&W.validity[d])return}S.clear(),$();let Y=ue(),F=Pe(W),K=l();if(F.length===0||K){let d=Array.from(o.current.fields.values()).reduce((I,z)=>(z.name&&(I[z.name]=z.getValue()),I),{}),C=u(M,d),N;if(typeof C=="object"&&C!==null&&"then"in C){if(Y.valid===!1?L(Y,F):(b==="onSubmit"||!s.state.customError)&&(Y.valid=null,L(Y,F)),N=await C,D!==v.current)return;Y=ue()}else N=C;F=N?[].concat(N).filter(Boolean):[],F.length>0?(Y.valid=!1,Y.customError=!0,W?.willValidate&&oe(W,F.join(`
|
|
3
3
|
`))):F=Pe(W)}L(Y,F)}),P=V((M,_=!1)=>{if(S.clear(),v.current+=1,_)return;let D=l();D&&M!==""&&i?S.start(i,()=>{m(M)}):m(M,!D)}),q=re.useCallback((M,_={})=>He(g(_),c.valid===!1&&!c.disabled&&!M?{"aria-invalid":!0}:ge),[g,c.disabled,c.valid]);return re.useMemo(()=>({getValidationProps:q,inputRef:h,registeredInputs:y,registerInput:U,getInputControl:n,commit:m,change:P}),[q,y,U,n,m,P])}t(pt,"useFieldValidation");var Ve=E(k(),1);function Rt(r){let{change:e,commit:o,invalid:a,markedDirtyRef:u,name:s,setRegisteredFieldName:i,registeredFieldIdRef:f,setValidityData:p,validityData:c}=r,{formRef:l}=Z(),b=Ve.useRef(null),x=Ve.useRef(null),R=Ve.useRef(!1),g=V(()=>{let n=x.current;if(n)return n.getValue?n.getValue():n.value});function S(n){return n.value===void 0?g():n.value}t(S,"getRegistrationValue");let h=V(()=>{let n=x.current;if(u.current=!0,!n){o(c.value);return}o(S(n))});function y(){let n=x.current;!n||!n.id||l.current.fields.set(n.id,{getValue:g,name:s??n.name,controlRef:n.controlRef,validityData:le(c,a),validate:h})}t(y,"refreshRegistration");function v(n=x.current?.id){n&&l.current.fields.delete(n)}t(v,"deleteRegistration");function A(n){if(R.current)return;R.current=!0;let m=S(n);p(P=>P.initialValue===m?P:{...P,initialValue:m})}t(A,"captureInitialValue"),T(()=>{let n=x.current;!n||!n.id||(i(s?void 0:n.name),l.current.fields.set(n.id,{getValue:g,name:s??n.name,controlRef:n.controlRef,validityData:le(c,a),validate:h}))},[l,g,a,s,i,h,c]),T(()=>{let n=l.current.fields;return()=>{let m=x.current?.id;m&&n.delete(m)}},[l]);let U=V((n,m)=>{if(!m){b.current===n&&(b.current=null,e(void 0,!0),v(),x.current=null,i(void 0),f.current=void 0);return}let P=x.current?.id,q=b.current;q&&q!==n&&e(void 0,!0),b.current=n,x.current=m,s||i(m.name),f.current=m.id,P&&P!==m.id&&v(P),A(m),y()});return[h,U]}t(Rt,"useFieldControlRegistration");var he=E(ae(),1);var Wt=w.forwardRef(t(function(e,o){let{errors:a,validationMode:u,submitCountRef:s}=Z(),{render:i,className:f,validate:p,validationDebounceTime:c=0,validationMode:l=u,name:b,disabled:x=!1,invalid:R,dirty:g,touched:S,actionsRef:h,style:y,...v}=e,A=st(!0)?.disabled,U=V(p||(()=>null)),n=A||x,[m,P]=w.useState(!1),[q,M]=w.useState(!1),[_,D]=w.useState(!1),[X,ee]=w.useState(!1),oe=w.useRef(void 0),$=g??q,L=S??m,G=w.useRef($),te=w.useRef(void 0),[W,ue]=w.useState(),Y=b??W;T(()=>{g!==void 0&&(G.current=g)},[g]);let F=V(Re=>{g===void 0&&(Re&&(G.current=!0),M(Re))}),K=V(Re=>{S===void 0&&P(Re)}),d=V(()=>l==="onChange"||l==="onSubmit"&&s.current>0),C=Y&&Object.hasOwn(a,Y)?a[Y]:null,N=!!(Array.isArray(C)?C.length:C),I=R===!0||N,[z,Te]=w.useState({state:se,error:"",errors:[],value:null,initialValue:null}),We=!I&&(n?null:z.state.valid),me=w.useMemo(()=>({disabled:n,touched:L,dirty:$,valid:We,filled:_,focused:X}),[n,L,$,We,_,X]),pe=pt({setValidityData:Te,validate:U,validityData:z,validationDebounceTime:c,invalid:I,markedDirtyRef:G,state:me,shouldValidateOnChange:d,validationMode:l,registeredFieldIdRef:te}),[Ye,Ke]=Rt({change:pe.change,commit:pe.commit,invalid:I,markedDirtyRef:G,name:b,setRegisteredFieldName:ue,registeredFieldIdRef:te,setValidityData:Te,validityData:z});w.useImperativeHandle(h,()=>({validate:Ye}),[Ye]);let Mt=w.useMemo(()=>({invalid:I,name:Y,validityData:z,setValidityData:Te,disabled:n,setTouched:K,setDirty:F,setFilled:D,setFocused:ee,focusOwnerRef:oe,validationMode:l,shouldValidateOnChange:d,state:me,registerFieldControl:Ke,validation:pe}),[I,Y,z,n,K,F,D,ee,l,d,me,Ke,pe]),Tt=J("div",e,{ref:o,state:me,props:v,stateAttributesMapping:H});return(0,he.jsx)(Oe.Provider,{value:Mt,children:Tt})},"FieldRootInner")),bt=w.forwardRef(t(function(e,o){return(0,he.jsx)(Ee,{children:(0,he.jsx)(Wt,{...e,ref:o})})},"FieldRoot"));var ce=E(k(),1);var De=E(k(),1);var ke=De.createContext({disabled:!1});function Le(){return De.useContext(ke)}t(Le,"useFieldItemContext");var gt=ce.forwardRef(t(function(e,o){let{render:a,className:u,style:s,id:i,nativeLabel:f=!0,...p}=e,c=j(!1),l=Le(),{labelId:b}=B(),x={...c.state,disabled:c.disabled||l.disabled},R=ce.useRef(null),g=ct({id:b??i,native:f});return J("label",e,{ref:[o,R],state:x,props:[g,p],stateAttributesMapping:H})},"FieldLabel"));var de=E(k(),1);var Ue=E(ae(),1);var Yt={...H,...Qe},vt=de.forwardRef(t(function(e,o){let{render:a,id:u,className:s,match:i,style:f,...p}=e,c=Q(u),{validityData:l,state:b,name:x}=j(!1),{setMessageIds:R}=B(),{errors:g}=Z(),S=x&&Object.hasOwn(g,x)?g[x]:null,h=!!(Array.isArray(S)?S.length:S),y=typeof i=="string",v=!1;i===!0?v=!0:b.disabled?v=!1:y?v=!!l.state[i]:v=h||l.state.valid===!1;let{mounted:A,transitionStatus:U,setMounted:n}=xe(v);T(()=>{if(!(!v||!c))return R(L=>L.concat(c)),()=>{R(L=>L.filter(G=>G!==c))}},[v,c,R]);let m=de.useRef(null),[P,q]=de.useState(null),[M,_]=de.useState(null),D=l.error;!y&&h?D=S:l.errors.length>1&&(D=l.errors);let X=D;Array.isArray(D)&&(X=D.length>1?(0,Ue.jsx)("ul",{children:D.map(L=>(0,Ue.jsx)("li",{children:L},L))}):D[0]);let ee=Array.isArray(D)?JSON.stringify(D):D;v&&ee!==M&&(_(ee),q(X)),Ze({open:v,ref:m,onComplete(){v||n(!1)}});let oe={...b,transitionStatus:U},$=J("div",e,{ref:[o,m],state:oe,props:[{id:c,children:v?X:P},p],stateAttributesMapping:Yt,enabled:A});return A?$:null},"FieldError"));var xt=E(k(),1);var Ft=xt.forwardRef(t(function(e,o){let{render:a,id:u,className:s,style:i,...f}=e,p=Q(u),c=j(!1),l=Le(),{setMessageIds:b}=B(),x={...c.state,disabled:c.disabled||l.disabled};return T(()=>{if(p)return b(g=>g.concat(p)),()=>{b(g=>g.filter(S=>S!==p))}},[p,b]),J("p",e,{ref:o,state:x,props:[{id:p},f],stateAttributesMapping:H})},"FieldDescription"));var Ne=E(k(),1);function Ct(r,e,o){let{setFocused:a,focusOwnerRef:u}=j(),s=V(i=>{(i?!r:u.current===s)&&(u.current=i&&s,o?.(i),a(i))});return T(()=>{let i=e.current;return i?.getRootNode()?.activeElement===i&&s(!0),()=>s(!1)},[r,e,s]),s}t(Ct,"useSetFieldFocused");function yt(r,e,o,a,u=!0,s){let{registerFieldControl:i}=j(),f=ie(()=>Symbol());T(()=>{let p=f.current;if(!u){i(p,void 0);return}i(p,{controlRef:r,getValue:a,id:e,name:s,value:o})},[r,u,a,e,s,i,f,o]),T(()=>{let p=f.current;return()=>{i(p,void 0)}},[i,f])}t(yt,"useRegisterFieldControl");var It=Ne.forwardRef(t(function(e,o){let{render:a,className:u,id:s,name:i,value:f,disabled:p=!1,onValueChange:c,defaultValue:l,autoFocus:b=!1,style:x,...R}=e,{state:g,name:S,disabled:h,setTouched:y,setDirty:v,validityData:A,setFilled:U,validationMode:n,validation:m}=j(),{clearErrors:P,elementRef:q,submitCountRef:M}=Z(),_=h||p,D=S??i,X={...g,disabled:_},{labelId:ee}=B(),oe=dt({id:s}),$=f!==void 0,L=f==null?void 0:String(f),G=V(()=>m.inputRef.current?.value);yt(m.inputRef,oe,L,G,!_,i),T(()=>{let F=L??m.inputRef.current?.value;F!==void 0&&U(F!=="")},[L,l,m.inputRef,U]),et(L,()=>{L!==void 0&&(P(D),v(L!==(A.initialValue??"")),m.change(L))});let te=Ne.useRef(null),W=Ct(_,te),ue=ve();return J("input",e,{ref:[o,te],state:X,props:[{id:oe,disabled:_,name:D,ref:m.inputRef,"aria-labelledby":ee,autoFocus:b,...$?{value:f}:{defaultValue:l},onChange(F){let K=F.currentTarget.value,d=tt(rt.none,F.nativeEvent);c?.(K,d),!$&&(v(K!==(A.initialValue??"")),U(K!==""),!F.nativeEvent.defaultPrevented&&!d.isCanceled&&(P(D),m.change(K)))},onFocus(){W(!0)},onBlur(F){if(y(!0),W(!1),n==="onBlur"){let K=F.currentTarget.value;m.commit(K),$&&queueMicrotask(()=>{let d=m.inputRef.current?.value;d!==void 0&&d!==K&&d!==(A.initialValue??"")&&m.commit(d)})}},onKeyDown(F){if(F.currentTarget.tagName==="INPUT"&&F.key==="Enter"){y(!0);let K=F.currentTarget.value,d=F.currentTarget.form;if(d&&d===q.current&&!F.defaultPrevented){let C=F.currentTarget,N=M.current;ue.start(0,()=>{M.current===N&&m.commit(C.value)})}else m.commit(K)}}},R,F=>m.getValidationProps(_,F)],stateAttributesMapping:H})},"FieldControl"));var fe=E(k(),1);var Et=E(ae(),1);var Vt=t(function(e){let{children:o}=e,{validityData:a,invalid:u}=j(!1),s=fe.useMemo(()=>le(a,u),[a,u]),i=s.state.valid===!1,{transitionStatus:f}=xe(i),p=fe.useMemo(()=>({...s,validity:s.state,transitionStatus:f}),[s,f]);return(0,Et.jsx)(fe.Fragment,{children:o(p)})},"FieldValidity");var Se=E(k(),1);var je=E(ae(),1);var ht=Se.forwardRef(t(function(e,o){let{render:a,className:u,style:s,disabled:i=!1,...f}=e,{state:p,disabled:c}=j(!1),l=c||i,b={...p,disabled:l},x=Se.useMemo(()=>({disabled:l}),[l]),R=J("div",e,{ref:o,state:b,props:f,stateAttributesMapping:H});return(0,je.jsx)(Ee,{children:(0,je.jsx)(ke.Provider,{value:x,children:R})})},"FieldItem"));var Lt=E(ae(),1);var Be=Dt.forwardRef(t(function(e,o){return(0,Lt.jsx)(Me.Control,{ref:o,...e})},"Input"));var St=E(ae(),1);function Hi(r){let e=(0,Nt.c)(10),o,a,u;e[0]!==r?({className:o,type:u,...a}=r,e[0]=r,e[1]=o,e[2]=a,e[3]=u):(o=e[1],a=e[2],u=e[3]);let s;e[4]!==o?(s=ze("h-8 w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-xs file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 md:text-xs dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",o),e[4]=o,e[5]=s):s=e[5];let i;return e[6]!==a||e[7]!==s||e[8]!==u?(i=(0,St.jsx)(Be,{type:u,"data-slot":"input",className:s,...a}),e[6]=a,e[7]=s,e[8]=u,e[9]=i):i=e[9],i}t(Hi,"m");export{H as a,j as b,Z as c,B as d,dt as e,ct as f,Le as g,Ct as h,yt as i,Hi as j};
|