@lunora/studio 1.0.0-alpha.391 → 1.0.0-alpha.392
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/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/packem_chunks/ai-knowledge.mjs +1 -1
- package/dist/packem_chunks/auth-audit-panel.mjs +1 -1
- package/dist/standalone/{chunk-3IGIBOCF.js → chunk-22C2K5PS.js} +1 -1
- package/dist/standalone/{chunk-EMZ7RPR3.js → chunk-2CMHGYZ4.js} +1 -1
- package/dist/standalone/{chunk-Y5QMX4YG.js → chunk-2XAJCKRP.js} +1 -1
- package/dist/standalone/{chunk-WODOEE2A.js → chunk-34USSEJN.js} +1 -1
- package/dist/standalone/{chunk-ADS4BJ7K.js → chunk-3HVF5LKQ.js} +1 -1
- package/dist/standalone/{chunk-EAYN3IGE.js → chunk-3RCYH6UA.js} +1 -1
- package/dist/standalone/{chunk-OG7AJWFV.js → chunk-3YBXNEUY.js} +1 -1
- package/dist/standalone/{chunk-SKK6PGQ3.js → chunk-4YZAJTU5.js} +1 -1
- package/dist/standalone/{chunk-LQWEU5ZI.js → chunk-5D73GSOC.js} +1 -1
- package/dist/standalone/{chunk-K2LXQ3LS.js → chunk-5FFKYQHT.js} +1 -1
- package/dist/standalone/{chunk-TS4CMM2L.js → chunk-6HZDJA4T.js} +1 -1
- package/dist/standalone/{chunk-3K56NZDT.js → chunk-6IDVWVML.js} +1 -1
- package/dist/standalone/{chunk-LIZUJ6AU.js → chunk-6WTQL4W2.js} +1 -1
- package/dist/standalone/{chunk-PPC2ESMI.js → chunk-6YDEXJRE.js} +1 -1
- package/dist/standalone/{chunk-Y34WXKCA.js → chunk-725JLR43.js} +1 -1
- package/dist/standalone/{chunk-DRFBJBEN.js → chunk-7ELEYWJC.js} +1 -1
- package/dist/standalone/{chunk-ATBPQT7F.js → chunk-7ML357XR.js} +1 -1
- package/dist/standalone/{chunk-NNKVZBKP.js → chunk-7UPL6MQR.js} +1 -1
- package/dist/standalone/{chunk-V3DOKU22.js → chunk-7Z243YUE.js} +1 -1
- package/dist/standalone/{chunk-VQQEDEHH.js → chunk-ACCTEC6Y.js} +1 -1
- package/dist/standalone/{chunk-V5TGDG6U.js → chunk-AJFMXVR4.js} +1 -1
- package/dist/standalone/{chunk-NMZ34D2Z.js → chunk-ANHHDGNL.js} +1 -1
- package/dist/standalone/{chunk-4YWFAODW.js → chunk-ATYVKUH7.js} +1 -1
- package/dist/standalone/{chunk-3WYPRZY3.js → chunk-AZ6QNL6G.js} +1 -1
- package/dist/standalone/{chunk-ZQ7KYIN6.js → chunk-B34JDEEO.js} +1 -1
- package/dist/standalone/{chunk-4ZEERXMN.js → chunk-BFEX6HDU.js} +1 -1
- package/dist/standalone/{chunk-FR22DHUN.js → chunk-BKKE4QKE.js} +1 -1
- package/dist/standalone/{chunk-2ZJJH4YN.js → chunk-CDIV23I2.js} +2 -2
- package/dist/standalone/{chunk-Z3AINTU6.js → chunk-COMBKDVY.js} +1 -1
- package/dist/standalone/{chunk-CP3LCFFM.js → chunk-D63EYK5I.js} +1 -1
- package/dist/standalone/{chunk-Q6VRHDZJ.js → chunk-D7UOJY4N.js} +1 -1
- package/dist/standalone/{chunk-WMKSIEJP.js → chunk-DW5KLXPI.js} +1 -1
- package/dist/standalone/{chunk-EGUFPKS4.js → chunk-DYPC464U.js} +1 -1
- package/dist/standalone/{chunk-BBJJJI7F.js → chunk-E3IVOZVW.js} +1 -1
- package/dist/standalone/{chunk-CFQQHZYU.js → chunk-EFEAOMEB.js} +1 -1
- package/dist/standalone/{chunk-SKMAKUOG.js → chunk-EMNOVYZC.js} +1 -1
- package/dist/standalone/{chunk-KRSQ6N4R.js → chunk-EXHVWM27.js} +1 -1
- package/dist/standalone/{chunk-MNN3YCKF.js → chunk-EYBS3Q7O.js} +1 -1
- package/dist/standalone/{chunk-WXZ334CL.js → chunk-EZ5PVGPY.js} +1 -1
- package/dist/standalone/{chunk-PTL32GA6.js → chunk-FNBNPTCM.js} +1 -1
- package/dist/standalone/{chunk-EZMAQE3T.js → chunk-FT5WEK3S.js} +1 -1
- package/dist/standalone/{chunk-CQDENTSP.js → chunk-GVPVWT3Q.js} +1 -1
- package/dist/standalone/{chunk-HQZ7B5EU.js → chunk-H2HGJURT.js} +1 -1
- package/dist/standalone/{chunk-7Z5MTBZB.js → chunk-HWG2R642.js} +1 -1
- package/dist/standalone/{chunk-W6UUGZH7.js → chunk-HYAGF6A5.js} +1 -1
- package/dist/standalone/{chunk-B3GOYA2R.js → chunk-I37WFNA6.js} +1 -1
- package/dist/standalone/{chunk-LOEVTOKP.js → chunk-IFU5WQHZ.js} +1 -1
- package/dist/standalone/{chunk-APCHI5CD.js → chunk-INDH6PRB.js} +1 -1
- package/dist/standalone/{chunk-HB6ABGZU.js → chunk-JKTAHFTK.js} +1 -1
- package/dist/standalone/{chunk-23MMGFHI.js → chunk-JPL3WAVW.js} +1 -1
- package/dist/standalone/chunk-K2I3AGZR.js +1 -0
- package/dist/standalone/{chunk-24N5RZRI.js → chunk-KBPMT33Z.js} +1 -1
- package/dist/standalone/{chunk-ZJIYJZ6F.js → chunk-KMBE7RTC.js} +1 -1
- package/dist/standalone/{chunk-E7QYOQWH.js → chunk-KULAZ4W3.js} +1 -1
- package/dist/standalone/{chunk-KYZZGUIG.js → chunk-LEF32Q5K.js} +1 -1
- package/dist/standalone/{chunk-YLC2ZYCL.js → chunk-LFWS6VBU.js} +1 -1
- package/dist/standalone/{chunk-H54J65DJ.js → chunk-MA2KXG2L.js} +1 -1
- package/dist/standalone/{chunk-GERWUNAM.js → chunk-MPGM6L64.js} +1 -1
- package/dist/standalone/{chunk-MKH4V2DR.js → chunk-MVWMRJD5.js} +1 -1
- package/dist/standalone/{chunk-2QYMVMYR.js → chunk-N4P6WYRV.js} +1 -1
- package/dist/standalone/{chunk-6C555TU5.js → chunk-NP6H72XD.js} +1 -1
- package/dist/standalone/{chunk-XV2XEUUB.js → chunk-NPHGFVNE.js} +1 -1
- package/dist/standalone/{chunk-73D52JHL.js → chunk-NRWR25MB.js} +1 -1
- package/dist/standalone/{chunk-HMMALUXM.js → chunk-O46IV64X.js} +1 -1
- package/dist/standalone/{chunk-GTJYJW4A.js → chunk-O56AZXG6.js} +1 -1
- package/dist/standalone/{chunk-BHUWAGFN.js → chunk-OOPMRFI2.js} +1 -1
- package/dist/standalone/chunk-OZUPOUHR.js +1 -0
- package/dist/standalone/{chunk-O66HDCZT.js → chunk-PLDE5R5Y.js} +1 -1
- package/dist/standalone/{chunk-NAGIOR23.js → chunk-PRVBT5AJ.js} +1 -1
- package/dist/standalone/{chunk-FKF2BRRN.js → chunk-PUTERXSU.js} +1 -1
- package/dist/standalone/{chunk-NTVQ4PWU.js → chunk-PYG3TDLZ.js} +1 -1
- package/dist/standalone/{chunk-CBTPJPCZ.js → chunk-QHI77TGI.js} +1 -1
- package/dist/standalone/{chunk-SQ3M7JDP.js → chunk-QIROOZNJ.js} +1 -1
- package/dist/standalone/{chunk-KZXAVLQ4.js → chunk-QMZKJK53.js} +1 -1
- package/dist/standalone/{chunk-FGHKL42J.js → chunk-RIHWRGFS.js} +1 -1
- package/dist/standalone/{chunk-FKAOFBS3.js → chunk-RN32N6ZO.js} +1 -1
- package/dist/standalone/{chunk-ZLAVM2NT.js → chunk-RTD3B67U.js} +1 -1
- package/dist/standalone/{chunk-QJFCK6J4.js → chunk-RUCMNPTD.js} +1 -1
- package/dist/standalone/{chunk-CDJMXV45.js → chunk-RZJAZ5ED.js} +1 -1
- package/dist/standalone/{chunk-EHU26D2V.js → chunk-S64V5MAT.js} +1 -1
- package/dist/standalone/{chunk-MAWEZEX6.js → chunk-TFH347JK.js} +1 -1
- package/dist/standalone/{chunk-2G7JHC6S.js → chunk-TJ76NZTD.js} +1 -1
- package/dist/standalone/{chunk-UYW53K2N.js → chunk-TJV64AXT.js} +1 -1
- package/dist/standalone/{chunk-WLMTK3FN.js → chunk-TVDBLCXQ.js} +1 -1
- package/dist/standalone/{chunk-VJGP3BTD.js → chunk-TVJFKXX4.js} +1 -1
- package/dist/standalone/{chunk-4RII5S3H.js → chunk-UDKKUJHY.js} +1 -1
- package/dist/standalone/{chunk-W5BTAOHO.js → chunk-UEONVTOV.js} +1 -1
- package/dist/standalone/{chunk-JQBVRWFN.js → chunk-UNUSBFIC.js} +1 -1
- package/dist/standalone/{chunk-LLD7TMBV.js → chunk-UQ3WOVL2.js} +1 -1
- package/dist/standalone/{chunk-YDFZA3T4.js → chunk-UW34S35F.js} +1 -1
- package/dist/standalone/{chunk-UL5XVKGR.js → chunk-XHDCFSC6.js} +1 -1
- package/dist/standalone/{chunk-BULGXI7X.js → chunk-XKK5ABPC.js} +1 -1
- package/dist/standalone/{chunk-I2XT2POX.js → chunk-XYWMQVZ2.js} +1 -1
- package/dist/standalone/chunk-YESGXFAR.js +7 -0
- package/dist/standalone/{chunk-2D4WBSDO.js → chunk-Z6PYAG36.js} +1 -1
- package/dist/standalone/{chunk-BWHVY6L6.js → chunk-Z7ZRXPPE.js} +1 -1
- package/dist/standalone/{chunk-LLSK6QBX.js → chunk-ZHDO7DYM.js} +1 -1
- package/dist/standalone/{chunk-EYSF4DHD.js → chunk-ZIY53FID.js} +1 -1
- package/dist/standalone/studio.js +1 -1
- package/package.json +1 -1
- package/dist/standalone/chunk-C6FOSG2A.js +0 -7
- package/dist/standalone/chunk-IL64HWFW.js +0 -1
- package/dist/standalone/chunk-IPDJJHZK.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ct}from"./chunk-CFQQHZYU.js";import{a as lt}from"./chunk-NAGIOR23.js";import"./chunk-JNWK5MJC.js";import{a as De}from"./chunk-MNN3YCKF.js";import"./chunk-CP3LCFFM.js";import"./chunk-Y2YLTUMD.js";import"./chunk-CQDENTSP.js";import"./chunk-LMCBMC2V.js";import"./chunk-QF743FSL.js";import"./chunk-IQ5CIBXJ.js";import"./chunk-YNCZVYCO.js";import"./chunk-OWRWDDJT.js";import"./chunk-QHVUXMRV.js";import"./chunk-2NUCBQFU.js";import{a as it}from"./chunk-2KTN53PK.js";import{a as nt}from"./chunk-YLC2ZYCL.js";import{b as rt}from"./chunk-EDL46BPM.js";import{a as Ye}from"./chunk-W5BTAOHO.js";import"./chunk-4KPATTV6.js";import{h as Ue,i as ze}from"./chunk-7WGZSDRS.js";import"./chunk-N7FOBAV3.js";import{i as Ze}from"./chunk-2D4WBSDO.js";import"./chunk-4SY2N2RS.js";import"./chunk-4AG356VE.js";import{a as Xe}from"./chunk-CBTPJPCZ.js";import"./chunk-SCTYLLJT.js";import"./chunk-OZID3UYF.js";import{a as qe}from"./chunk-HMMALUXM.js";import{b as et}from"./chunk-BHUWAGFN.js";import"./chunk-L27FKJTG.js";import{a as Te}from"./chunk-FKF2BRRN.js";import"./chunk-EYSF4DHD.js";import{a as ot,b as st,c as dt,d as _e,e as q,f as T}from"./chunk-ZJIYJZ6F.js";import"./chunk-SKK6PGQ3.js";import"./chunk-4RII5S3H.js";import"./chunk-EOFWXI3T.js";import{a as F}from"./chunk-LYVYUTQY.js";import{c as de}from"./chunk-6C555TU5.js";import{a as tt,e as at}from"./chunk-XV2XEUUB.js";import{n as Ge}from"./chunk-C6FOSG2A.js";import"./chunk-ZPQBVYNN.js";import{B as ce,h as He,i as Qe,j as Ve,s as Se,w as je,x as le}from"./chunk-2ZJJH4YN.js";import"./chunk-PDBW6GTJ.js";import{a as Be}from"./chunk-A6TVTNKO.js";import{a as Pe,b as We}from"./chunk-ADABTCDI.js";import{a as d,d as se}from"./chunk-5PEAXTYQ.js";var be=se(Be(),1),he=se(Pe(),1);var mt=se(Be(),1),O=se(Pe(),1);var m=se(We(),1);var Tt=He(F.runMigration),ut=d(t=>{let e=(0,mt.c)(98),{initialShardKey:r}=t,n=Ge(),a=ce(),{queryShardKey:o,setShardKey:i,shardKey:s}=it(r),[l,f]=(0,O.useState)(""),[h,g]=(0,O.useState)("up"),[p,b]=(0,O.useState)(!0),[v,x]=(0,O.useState)(!1),[y,u]=(0,O.useState)(null),[w,k]=(0,O.useState)(null),L;e[0]!==s?(L=s.trim(),e[0]=s,e[1]=L):L=e[1];let C=L===o,j;e[2]===Symbol.for("react.memo_cache_sentinel")?(j={},e[2]=j):j=e[2];let M;e[3]!==o?(M={live:!0,shardKey:o},e[3]=o,e[4]=M):M=e[4];let $=de(F.migrationStatus,j,M),N=$.data?.migrations??null,Ie=$.error,{errorSource:Fe,liveError:Re}=$,ve,ye;e[5]!==o||e[6]!==$.data?(ve=d(()=>{$.data!==void 0&&rt(o)},"W"),ye=[$.data,o],e[5]=o,e[6]=$.data,e[7]=ve,e[8]=ye):(ve=e[7],ye=e[8]),(0,O.useEffect)(ve,ye);let xe;if(e[9]!==n||e[10]!==h||e[11]!==p||e[12]!==l||e[13]!==s||e[14]!==$||e[15]!==a){let I=d(async()=>{let Ae=l.trim();if(Ae===""){k(a("Enter a migration id")),u(null);return}x(!0),k(null);try{let Le=await n.query(Tt,{direction:h,dryRun:p,id:Ae},Qe(s));u(Le),$.refetch()}catch(Le){let qt=Le;u(null),k(Ve(qt))}x(!1)},"u");xe=d(()=>{Se(I())},"V"),e[9]=n,e[10]=h,e[11]=p,e[12]=l,e[13]=s,e[14]=$,e[15]=a,e[16]=xe}else xe=e[16];let ke=xe,we;e[17]===Symbol.for("react.memo_cache_sentinel")?(we=d(I=>{f(I.target.value)},"Y"),e[17]=we):we=e[17];let Ot=we,$e;e[18]===Symbol.for("react.memo_cache_sentinel")?($e=d(I=>{g(I.target.value==="down"?"down":"up")},"Z"),e[18]=$e):$e=e[18];let St=$e,Ne;e[19]===Symbol.for("react.memo_cache_sentinel")?(Ne=d(I=>{b(I.target.checked)},"ee"),e[19]=Ne):Ne=e[19];let jt=Ne,_;e[20]!==i||e[21]!==s?(_=(0,m.jsx)(nt,{onChange:i,testId:"mg-shard-input",value:s}),e[20]=i,e[21]=s,e[22]=_):_=e[22];let D;e[23]!==Re?(D=(0,m.jsx)(lt,{message:Re,prefix:"mg"}),e[23]=Re,e[24]=D):D=e[24];let K;e[25]!==_||e[26]!==D?(K=(0,m.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[_,D]}),e[25]=_,e[26]=D,e[27]=K):K=e[27];let E;e[28]!==Ie||e[29]!==Fe?(E=Ie!==null&&(0,m.jsx)(Te,{error:Fe,testId:"mg-status-error"}),e[28]=Ie,e[29]=Fe,e[30]=E):E=e[30];let J;e[31]!==N||e[32]!==a?(J=N!==null&&N.length===0&&(0,m.jsx)(qe,{description:a("Data migrations you run against this shard will be tracked here."),icon:(0,m.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,m.jsx)("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"})}),testId:"mg-empty",title:a("No migrations have run on this shard.")}),e[31]=N,e[32]=a,e[33]=J):J=e[33];let A;e[34]!==N||e[35]!==a?(A=N!==null&&N.length>0&&(0,m.jsx)(tt,{className:"overflow-hidden py-0",children:(0,m.jsx)(at,{className:"px-0",children:(0,m.jsxs)(ot,{"data-testid":"mg-table",children:[(0,m.jsx)(st,{children:(0,m.jsxs)(_e,{children:[(0,m.jsx)(q,{children:a("id")}),(0,m.jsx)(q,{children:a("direction")}),(0,m.jsx)(q,{children:a("status")}),(0,m.jsx)(q,{children:a("processed")}),(0,m.jsx)(q,{children:a("changed")}),(0,m.jsx)(q,{children:a("updated")}),(0,m.jsx)(q,{children:a("error")})]})}),(0,m.jsx)(dt,{children:N.map(Ct)})]})})}),e[34]=N,e[35]=a,e[36]=A):A=e[36];let P;e[37]!==a?(P=a("Run migration"),e[37]=a,e[38]=P):P=e[38];let B;e[39]!==P?(B=(0,m.jsx)(De,{children:P}),e[39]=P,e[40]=B):B=e[40];let W;e[41]!==a?(W=a("Migration id"),e[41]=a,e[42]=W):W=e[42];let U;e[43]!==a?(U=a("migration id"),e[43]=a,e[44]=U):U=e[44];let z;e[45]!==l||e[46]!==W||e[47]!==U?(z=(0,m.jsx)(Ze,{"aria-label":W,className:"w-auto","data-testid":"mg-id-input",onChange:Ot,placeholder:U,value:l}),e[45]=l,e[46]=W,e[47]=U,e[48]=z):z=e[48];let H;e[49]!==a?(H=a("Direction"),e[49]=a,e[50]=H):H=e[50];let Q;e[51]!==a?(Q=a("up"),e[51]=a,e[52]=Q):Q=e[52];let V;e[53]!==Q?(V=(0,m.jsx)("option",{value:"up",children:Q}),e[53]=Q,e[54]=V):V=e[54];let G;e[55]!==a?(G=a("down"),e[55]=a,e[56]=G):G=e[56];let X;e[57]!==G?(X=(0,m.jsx)("option",{value:"down",children:G}),e[57]=G,e[58]=X):X=e[58];let Y;e[59]!==h||e[60]!==H||e[61]!==V||e[62]!==X?(Y=(0,m.jsxs)("select",{"aria-label":H,className:"flex h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs transition-colors outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 dark:bg-input/30","data-testid":"mg-direction",onChange:St,value:h,children:[V,X]}),e[59]=h,e[60]=H,e[61]=V,e[62]=X,e[63]=Y):Y=e[63];let Z;e[64]!==p?(Z=(0,m.jsx)("input",{checked:p,className:"size-4 accent-primary","data-testid":"mg-dry-run",id:"mg-dry-run",onChange:jt,type:"checkbox"}),e[64]=p,e[65]=Z):Z=e[65];let ee;e[66]!==a?(ee=a("Dry run"),e[66]=a,e[67]=ee):ee=e[67];let te;e[68]!==Z||e[69]!==ee?(te=(0,m.jsxs)(De,{className:"flex items-center gap-1.5",htmlFor:"mg-dry-run",children:[Z,ee]}),e[68]=Z,e[69]=ee,e[70]=te):te=e[70];let ae;e[71]!==p||e[72]!==ke||e[73]!==v||e[74]!==C||e[75]!==a?(ae=p?(0,m.jsx)(Xe,{"data-testid":"mg-run",disabled:v||!C,onClick:ke,type:"button",children:a(v?"Running\u2026":"Run")}):(0,m.jsx)(Ye,{confirmLabel:a(v?"Running\u2026":"Run migration?"),disabled:v||!C,onConfirm:ke,testId:"mg-run",children:a("Run")}),e[71]=p,e[72]=ke,e[73]=v,e[74]=C,e[75]=a,e[76]=ae):ae=e[76];let re;e[77]!==z||e[78]!==Y||e[79]!==te||e[80]!==ae?(re=(0,m.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[z,Y,te,ae]}),e[77]=z,e[78]=Y,e[79]=te,e[80]=ae,e[81]=re):re=e[81];let ne;e[82]!==B||e[83]!==re?(ne=(0,m.jsxs)("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs",children:[B,re]}),e[82]=B,e[83]=re,e[84]=ne):ne=e[84];let ie;e[85]!==w?(ie=w!==null&&(0,m.jsx)("pre",{className:"text-sm text-destructive whitespace-pre-wrap","data-testid":"mg-run-error",role:"alert",children:w}),e[85]=w,e[86]=ie):ie=e[86];let oe;e[87]!==y||e[88]!==a?(oe=y!==null&&(0,m.jsxs)("p",{className:"text-sm text-muted-foreground","data-testid":"mg-run-result",children:[y.dryRun?a("Dry run: "):"",a("{status} \u2014 processed",{status:y.status}),y.processed,a(", changed"),y.changed]}),e[87]=y,e[88]=a,e[89]=oe):oe=e[89];let Oe;return e[90]!==K||e[91]!==E||e[92]!==J||e[93]!==A||e[94]!==ne||e[95]!==ie||e[96]!==oe?(Oe=(0,m.jsxs)("div",{className:"flex flex-col gap-3 pt-4","data-testid":"lunora-migrations",children:[K,E,J,A,ne,ie,oe]}),e[90]=K,e[91]=E,e[92]=J,e[93]=A,e[94]=ne,e[95]=ie,e[96]=oe,e[97]=Oe):Oe=e[97],Oe},"yt");function Ct(t){return(0,m.jsxs)(_e,{"data-testid":`mg-row-${t.id}`,children:[(0,m.jsx)(T,{children:t.id}),(0,m.jsx)(T,{children:t.direction}),(0,m.jsx)(T,{children:(0,m.jsx)(et,{variant:"secondary",children:t.status})}),(0,m.jsx)(T,{children:t.processed}),(0,m.jsx)(T,{children:t.changed}),(0,m.jsx)(T,{children:je(t.updatedAt)}),(0,m.jsx)(T,{children:t.error??""})]},t.id)}d(Ct,"Je");var c=se(We(),1);var Ke=1;function Mt(t){let e={},r=Object.keys(t);r.sort();for(let n of r)e[n]=t[n];return e}d(Mt,"ue");var me=d(t=>typeof t=="object"&&t!==null,"O"),It=d(t=>me(t)&&me(t.fields)&&me(t.indexes)&&me(t.relations)&&typeof t.shardMode=="string","me"),Ft=d(t=>{if(t===void 0||t.trim()==="")return{status:"absent"};let e;try{e=JSON.parse(t)}catch(r){return{error:`baseline is not valid JSON: ${r instanceof Error?r.message:String(r)}`,status:"invalid"}}if(!me(e)||e.version!==Ke||!me(e.tables))return{error:`baseline is malformed or written by an incompatible version (expected version ${String(Ke)})`,status:"invalid"};for(let[r,n]of Object.entries(e.tables))if(!It(n))return{error:`baseline table "${r}" has an invalid structure`,status:"invalid"};return{snapshot:{jurisdiction:typeof e.jurisdiction=="string"?e.jurisdiction:void 0,migrationIds:Array.isArray(e.migrationIds)?e.migrationIds:[],tables:e.tables,version:Ke},status:"ok"}},"he"),Rt=d((t,e)=>t.unique===e.unique&&t.fields.length===e.fields.length&&t.fields.every((r,n)=>r===e.fields[n]),"pe"),ht=d(t=>t.unique!==void 0,"Q"),ge=d(({nullable:t,optional:e,refined:r,unique:n,...a})=>JSON.stringify(Mt(a)),"M"),ft=d(t=>({form:JSON.stringify([ge(t),t.optional===!0,t.nullable===!0]),refined:t.refined===!0}),"U"),pt=d(t=>t.kind==="union"&&t.members?t.members.map(e=>ft(e)):[ft({...t,nullable:!1,optional:!1})],"W"),Lt=d((t,e)=>{if(e.kind!=="union")return!1;let r=pt(e);return pt(t).every(n=>r.some(a=>a.form===n.form&&(n.refined||!a.refined)))},"ge"),S=d(t=>{switch(t.kind){case"array":return`array(${t.of?S(t.of):"?"})`;case"from":return t.output===void 0?"from":`from(${t.output})`;case"id":return`id(${t.ref??"?"})`;case"literal":return`literal(${t.literal??"?"})`;case"object":return`object({ ${Object.keys(t.fields??{}).join(", ")} })`;case"record":return`record(${t.key?S(t.key):"?"}, ${t.of?S(t.of):"?"})`;case"union":return(t.members??[]).map(e=>S(e)).join(" | ");default:return t.kind}},"x"),fe=d((t,e,r)=>({remediation:"backfill",scope:"table",severity:"breaking",summary:r,table:t,type:e}),"T"),pe=d((t,e,r)=>({remediation:"none",scope:"table",severity:"safe",summary:r,table:t,type:e}),"F"),wt=d((t,e)=>{let r=JSON.stringify(t),n=JSON.stringify(e);return r===n?0:r<n?-1:1},"N"),ue=d(t=>({...t,...t.kind==="from"?{output:void 0}:{},...t.fields?{fields:Object.fromEntries(Object.entries(t.fields).map(([e,r])=>[e,ue(r)]))}:{},...t.key?{key:ue(t.key)}:{},...t.of?{of:ue(t.of)}:{},...t.members?{members:t.members.map(e=>ue(e)).toSorted(wt)}:{}}),"S"),gt=d(t=>t.kind==="union"?t.members??[]:[t],"B"),_t=d((t,e)=>{let r=[...t],n=[...e],a=new Set,o=new Set,i=d((s,l)=>{for(let[f,h]of r.entries()){if(o.has(f))continue;let g=n.findIndex((p,b)=>!a.has(b)&&s(h,p));g!==-1&&(a.add(g),o.add(f),l&&([r[f],n[g]]=Me(h,n[g])))}},"s");return i((s,l)=>JSON.stringify(s)===JSON.stringify(l),!1),i((s,l)=>ge(ue(s))===ge(ue(l)),!0),[r,n]},"ve"),Me=d((t,e)=>{if(t.kind==="union"||e.kind==="union"){let[a,o]=_t(gt(t),gt(e)),i=d((s,l)=>s.kind==="union"?{...s,members:l.toSorted(wt)}:l[0],"s");return[i(t,a),i(e,o)]}if(t.kind!==e.kind)return[t,e];if(t.kind==="from")return t.output===void 0||e.output===void 0?[{...t,output:void 0},{...e,output:void 0}]:[t,e];let r={...t.fields?{fields:{...t.fields}}:{}},n={...e.fields?{fields:{...e.fields}}:{}};for(let a of["key","of"])t[a]&&e[a]&&([r[a],n[a]]=Me(t[a],e[a]));for(let a of Object.keys(t.fields??{})){let o=t.fields?.[a],i=e.fields?.[a];o&&i&&r.fields&&n.fields&&([r.fields[a],n.fields[a]]=Me(o,i))}return[{...t,...r},{...e,...n}]},"R"),Dt=d((t,e,r,n,a)=>{let[o,i]=Me(r,n);if(o.kind===i.kind&&(!a||ge(o)===ge(i)))return;if(a&&Lt(o,i))return pe(t,"widenedFieldShape",`field ${t}.${e} widened: ${S(o)} \u2192 ${S(i)} \u2014 every stored value stays valid`);if(o.kind!==i.kind)return fe(t,"changedFieldKind",`field ${t}.${e} changed type: ${o.kind} \u2192 ${i.kind} \u2014 add a data migration to convert existing values`);let s=Object.values(i.fields??{});return a&&o.kind==="object"&&Object.keys(o.fields??{}).length===0&&s.length>0&&s.every(l=>l.optional)?pe(t,"widenedFieldShape",`field ${t}.${e} now records its optional object shape \u2014 stored values stay valid`):fe(t,"changedFieldShape",`field ${t}.${e} changed shape: ${S(o)} \u2192 ${S(i)} \u2014 stored values were written against the old shape; add a data migration to convert them`)},"be"),Kt=d((t,e,r,n,a)=>{let o=[];return r.unique!==n.unique&&o.push(n.unique===!0?{...fe(t,"addedFieldConstraint",`field ${t}.${e} became unique \u2014 existing duplicates would violate it; add a data migration to de-duplicate first`),field:e,uniqueOn:[e]}:pe(t,"relaxedFieldConstraint",`field ${t}.${e} is no longer unique`)),r.nullable!==n.nullable&&o.push(n.nullable===!0?pe(t,"relaxedFieldConstraint",`field ${t}.${e} became nullable`):fe(t,"addedFieldConstraint",`field ${t}.${e} is no longer nullable \u2014 rows holding NULL would be invalid; add a data migration to backfill them`)),a&&r.refined!==n.refined&&o.push(n.refined===!0?fe(t,"addedFieldConstraint",`field ${t}.${e} gained a validation refinement \u2014 stored values were never checked against it; add a data migration if any could fail`):pe(t,"relaxedFieldConstraint",`field ${t}.${e} dropped its validation refinement`)),o},"ye"),$t=d((t,e,r,n,a=!0)=>{let o=[],i=ht(r)&&ht(n),s=Dt(t,e,r,n,i);return s&&o.push(s),i&&o.push(...Kt(t,e,r,n,a)),r.optional&&!n.optional?o.push({remediation:"backfill",severity:"breaking",summary:`field ${t}.${e} became required \u2014 rows missing it would be invalid; add a data migration to backfill it`,table:t,scope:"table",type:"fieldOptionalToRequired"}):!r.optional&&n.optional&&o.push({remediation:"none",scope:"table",severity:"safe",summary:`field ${t}.${e} became optional`,table:t,type:"fieldRequiredToOptional"}),o},"ee"),Et=d((t,e,r)=>r.optional?{remediation:"none",scope:"table",severity:"safe",summary:`added optional field ${t}.${e}`,table:t,type:"addedOptionalField"}:{remediation:"backfill",severity:"breaking",summary:`added required field ${t}.${e} \u2014 existing rows have no value; add a data migration to backfill it`,table:t,scope:"table",type:"addedRequiredField"},"xe"),Jt=d((t,e)=>e.refinementsRecorded!==!0||t.refinementsRecorded===!0,"ke"),At=d((t,e,r,n)=>{for(let[a,o]of Object.entries(r.fields)){let i=e.fields[a];i===void 0?n.push({...Et(t,a,o),field:a}):n.push(...$t(t,a,i,o,Jt(e,r)).map(s=>({...s,field:a})))}for(let a of Object.keys(e.fields))r.fields[a]===void 0&&n.push({field:a,remediation:"backfill",severity:"breaking",summary:`removed field ${t}.${a} \u2014 add a data migration if stored data must be cleaned up`,table:t,scope:"table",type:"removedField"})},"$e"),Pt=d((t,e,r,n)=>{for(let[a,o]of Object.entries(r.indexes)){let i=e.indexes[a];if(i===void 0){n.push(o.unique?{remediation:"backfill",scope:"table",severity:"breaking",summary:`added unique index ${a} on ${t} \u2014 existing duplicates would violate it; add a data migration to de-duplicate first`,table:t,type:"addedIndex",uniqueOn:o.fields}:{remediation:"none",scope:"table",severity:"safe",summary:`added index ${a} on ${t}`,table:t,type:"addedIndex"});continue}Rt(i,o)||n.push(o.unique?{remediation:"backfill",scope:"table",severity:"breaking",summary:`index ${a} on ${t} changed shape and is unique \u2014 existing duplicates would violate it; add a data migration to de-duplicate first`,table:t,type:"changedIndex",uniqueOn:o.fields}:{remediation:"none",scope:"table",severity:"safe",summary:`index ${a} on ${t} changed shape \u2014 a query that relied on the old index may need updating`,table:t,type:"changedIndex"})}for(let a of Object.keys(e.indexes))r.indexes[a]===void 0&&n.push({remediation:"none",severity:"safe",index:a,summary:`removed index ${a} on ${t} \u2014 a query that used \`.withIndex("${a}")\` no longer compiles`,table:t,scope:"table",type:"removedIndex"})},"we"),Bt=d((t,e,r,n)=>{for(let a of Object.keys(r.relations))e.relations[a]===void 0&&n.push({remediation:"none",scope:"schema",severity:"safe",summary:`added relation ${t}.${a}`,table:t,type:"addedRelation"});for(let a of Object.keys(e.relations))r.relations[a]===void 0&&n.push({remediation:"none",scope:"schema",severity:"safe",summary:`removed relation ${t}.${a} \u2014 the stored foreign-key values stay in place, but its \`onDelete\` action no longer runs and a \`with: { ${a} }\` read no longer compiles`,table:t,type:"removedRelation",warning:!0})},"Oe"),Ee="shardBy:_unknown_",Ce="global",Wt=d((t,e)=>t===Ce&&e.startsWith(`${Ce}:`)||e===Ce&&t.startsWith(`${Ce}:`),"Se"),Ut=d((t,e,r)=>{if(e===r)return r!==Ee?void 0:{remediation:"rehome",scope:"table",severity:"breaking",summary:`table ${t} declares a non-literal .shardBy(...) key, so codegen cannot read which column partitions it \u2014 every such key records as "${Ee}" and two DIFFERENT keys would compare equal. Pass the shard key as a string literal; until then this is reported on every run, because the alternative is a silent pass on a re-home that strands every row (export/import is the only way back).`,table:t,type:"changedShardMode"};if(!Wt(e,r))return{remediation:"rehome",severity:"breaking",summary:`table ${t} changed shard mode: ${e} \u2192 ${r} \u2014 its physical storage moves, and existing rows do NOT follow the schema; re-home them with an export/import round trip (https://lunora.sh/docs/concepts/sharding#migrating-a-populated-table)`,table:t,scope:"table",type:"changedShardMode",...r===Ee?{}:{coverage:{shardMode:r,table:t}}}},"je"),bt=d(t=>t.memory!==void 0,"K"),vt=d(t=>t.after??0,"Y"),Je=d(t=>t.after===void 0?`{ field: "${t.field}" }`:`{ after: ${String(t.after)}, field: "${t.field}" }`,"_"),R=d(t=>t.after===void 0?`.ttl("${t.field}")`:`.ttl("${t.field}", { after: ${String(t.after)} })`,"w"),zt=d((t,e,r)=>{if(e===void 0&&r===void 0)return;let n=d((s,l)=>({coverage:{table:t,ttl:{...l.after===void 0?{}:{after:l.after},field:l.field}},expiry:{...l.after===void 0?{}:{after:l.after},field:l.field,...e===void 0?{}:{previous:{...e.after===void 0?{}:{after:e.after},field:e.field}}},remediation:"backfill",scope:"table",severity:"breaking",summary:s,table:t,type:"changedTtlPolicy"}),"n"),a=d(s=>({remediation:"none",scope:"table",severity:"safe",summary:s,table:t,type:"changedTtlPolicy",warning:!0}),"o");if(r===void 0)return a(`table ${t} dropped its TTL policy \u2014 its rows are no longer swept, so they stay until something else deletes them`);if(e===void 0)return n(`table ${t} gained a TTL policy ${R(r)} \u2014 every row already past the cutoff is deleted on the next alarm sweep; refresh or clear "${r.field}" on the rows that must survive, then declare a migration with covers: { table: "${t}", ttl: ${Je(r)} }`,r);if(e.field!==r.field)return n(`table ${t} moved its TTL to a different column: ${R(e)} \u2192 ${R(r)} \u2014 rows are now expired by a column they were never written against; populate "${r.field}" on the rows that must survive, then declare a migration with covers: { table: "${t}", ttl: ${Je(r)} }`,r);let o=vt(e),i=vt(r);return i<o?n(`table ${t} shortened its TTL: ${R(e)} \u2192 ${R(r)} \u2014 rows that were not expired under the old offset are deleted on the next alarm sweep; refresh "${r.field}" on the rows that must survive, then declare a migration with covers: { table: "${t}", ttl: ${Je(r)} }`,r):i>o?a(`table ${t} lengthened its TTL: ${R(e)} \u2192 ${R(r)} \u2014 every row stays, and expires later than it would have`):void 0},"Te"),Ht=d((t,e,r)=>{let n=[];return e.memory!==r.memory&&n.push(r.memory===!0?{remediation:"rehome",scope:"table",severity:"breaking",summary:`table ${t} became a .memory() table \u2014 every row is deleted in every shard on the next Durable Object cold start, and no data migration survives that; export the rows first if they must be kept, or revert`,table:t,type:"changedMemoryMode",coverage:{memory:!0,table:t}}:{remediation:"none",scope:"table",severity:"safe",summary:`table ${t} is no longer a .memory() table \u2014 its rows now survive a cold start`,table:t,type:"changedMemoryMode"}),e.commitOrdered!==r.commitOrdered&&n.push(r.commitOrdered===!0?{remediation:"backfill",scope:"table",severity:"breaking",summary:`table ${t} became .commitOrdered() \u2014 rows written before it carry no _commitSeq, so a \`_commitSeq > cursor\` changefeed never offers them; add a data migration over the table to stamp them (the rewrite allocates a sequence)`,table:t,type:"changedCommitOrdering",identityRewrites:!0}:{remediation:"none",scope:"table",severity:"safe",summary:`table ${t} is no longer .commitOrdered() \u2014 stored rows are untouched, but new rows carry no _commitSeq, so a \`_commitSeq > cursor\` changefeed stops advancing without erroring; update the consumers`,table:t,type:"changedCommitOrdering",warning:!0}),n},"Fe"),Qt=d((t,e,r,n)=>{let a=Ut(t,e.shardMode,r.shardMode);if(a&&n.push(a),bt(e)&&bt(r)){n.push(...Ht(t,e,r));let o=zt(t,e.ttl,r.ttl);o&&n.push(o)}At(t,e,r,n),Pt(t,e,r,n),Bt(t,e,r,n)},"qe"),Vt=d((t,e)=>{let r=[],n=t?.tables??{};for(let[a,o]of Object.entries(e.tables)){let i=n[a];if(i===void 0){r.push({remediation:"none",scope:"table",severity:"safe",summary:`added table ${a}`,table:a,type:"addedTable"});continue}Qt(a,i,o,r)}for(let a of Object.keys(n))e.tables[a]===void 0&&r.push({remediation:"none",scope:"table",severity:"safe",summary:`removed table ${a} \u2014 its rows are left in place in each shard's SQLite (nothing deletes them) but are unreachable through the schema; export the shard first if the data must be kept, or declare the table again to reach it`,table:a,type:"removedTable",warning:!0});if(t!==void 0&&t.jurisdiction!==e.jurisdiction){let a=t.jurisdiction??"(none)",o=e.jurisdiction??"(none)";r.push({remediation:"rehome",scope:"schema",severity:"breaking",summary:`Durable Object jurisdiction changed from ${a} to ${o} \u2014 this re-homes every DO and strands all existing shard, scheduler, and session-DO data in the old region (export then import to move it). Revert the change, or declare a migration with covers: { jurisdiction: "${e.jurisdiction??"none"}" } once the data is moved.`,type:"changedJurisdiction",coverage:{jurisdiction:e.jurisdiction??"none"}})}return{changes:r}},"Me"),yt=d(t=>Object.entries(t.fields).map(([e,r])=>({name:e,optional:r.optional,ref:Object.values(t.relations).find(n=>n.field===e&&n.kind==="one")?.table,type:S(r)})),"z"),xt=d((t,e,r)=>{let n={},a=e?.fields??{},o=r?.fields??{};for(let[i,s]of Object.entries(o)){let l=a[i];l===void 0?n[i]=e===void 0?"unchanged":"added":n[i]=$t(t,i,l,s).length===0?"unchanged":"changed"}for(let i of Object.keys(a))o[i]===void 0&&(n[i]="removed");return n},"X"),Gt=d((t,e)=>{let{changes:r}=Vt(t,e),n=new Set(r.filter(i=>i.scope==="table"&&i.table!==void 0).map(i=>i.table)),a=[],o=d((i,s)=>i?"added":n.has(s)?"changed":"context","r");for(let[i,s]of Object.entries(e.tables)){let l=t?.tables[i],f=o(l===void 0,i);a.push({columns:yt(s),fieldStatus:xt(i,l,s),name:i,shardMode:s.shardMode,status:f})}for(let[i,s]of Object.entries(t?.tables??{}))e.tables[i]===void 0&&a.push({columns:yt(s),fieldStatus:xt(i,s,void 0),name:i,shardMode:s.shardMode,status:"removed"});return a.sort((i,s)=>i.name.localeCompare(s.name)),{breakingCount:r.filter(i=>i.severity==="breaking").length,changes:r,tables:a}},"Ce"),kt=d(t=>{let e=Ft(t);return e.status==="ok"?e.snapshot:void 0},"Z"),Xt={added:"ring-2 ring-emerald-500/60",changed:"ring-2 ring-amber-500/70",context:"opacity-55",removed:"opacity-70 ring-2 ring-destructive/60"},Yt=d(t=>t==="global"||t.startsWith("global:")?"global":"shard","Ie"),Zt=d(t=>{let e=(0,be.c)(24),{appliedAt:r,hash:n,onSelect:a,selected:o,seq:i}=t,s=o?"border-s-primary bg-accent/60 text-foreground":"border-s-transparent text-muted-foreground hover:bg-accent/30 hover:text-foreground",l;e[0]!==s?(l=le("flex w-full flex-col items-start gap-1 border-s-2 px-4 py-3 text-start outline-none transition-colors",s),e[0]=s,e[1]=l):l=e[1];let f=`sh-version-${n}`,h;e[2]!==n||e[3]!==a?(h=d(()=>{a(n)},"m"),e[2]=n,e[3]=a,e[4]=h):h=e[4];let g;e[5]!==i?(g=(0,c.jsxs)("span",{className:"font-mono text-[13px] tabular-nums",children:["v",i]}),e[5]=i,e[6]=g):g=e[6];let p;e[7]!==n?(p=n.slice(0,7),e[7]=n,e[8]=p):p=e[8];let b;e[9]!==p?(b=(0,c.jsx)("span",{className:"ms-auto font-mono text-[10px] tracking-wider text-muted-foreground/70 uppercase",children:p}),e[9]=p,e[10]=b):b=e[10];let v;e[11]!==g||e[12]!==b?(v=(0,c.jsxs)("span",{className:"flex w-full items-baseline gap-2",children:[g,b]}),e[11]=g,e[12]=b,e[13]=v):v=e[13];let x;e[14]!==r?(x=je(r),e[14]=r,e[15]=x):x=e[15];let y;e[16]!==x?(y=(0,c.jsx)("span",{className:"font-mono text-[10px] tracking-wide text-muted-foreground/70",children:x}),e[16]=x,e[17]=y):y=e[17];let u;return e[18]!==y||e[19]!==l||e[20]!==f||e[21]!==h||e[22]!==v?(u=(0,c.jsx)("li",{children:(0,c.jsxs)("button",{className:l,"data-testid":f,onClick:h,type:"button",children:[v,y]})}),e[18]=y,e[19]=l,e[20]=f,e[21]=h,e[22]=v,e[23]=u):u=e[23],u},"Ee"),ea=d(t=>{let e=(0,be.c)(26),{breaking:r,count:n,first:a}=t,o=ce();if(a){let b;e[0]!==n?(b=(0,c.jsx)("span",{className:"text-3xl leading-none font-light tracking-tight tabular-nums",children:n}),e[0]=n,e[1]=b):b=e[1];let v;e[2]!==o?(v=o("tables"),e[2]=o,e[3]=v):v=e[3];let x;e[4]!==v?(x=(0,c.jsx)("span",{className:"font-mono text-[11px] tracking-widest text-muted-foreground uppercase",children:v}),e[4]=v,e[5]=x):x=e[5];let y;return e[6]!==b||e[7]!==x?(y=(0,c.jsxs)("div",{className:"flex items-baseline gap-3","data-testid":"sh-summary",children:[b,x]}),e[6]=b,e[7]=x,e[8]=y):y=e[8],y}let i=r>0&&"text-destructive",s;e[9]!==i?(s=le("text-3xl leading-none font-light tracking-tight tabular-nums",i),e[9]=i,e[10]=s):s=e[10];let l;e[11]!==n||e[12]!==s?(l=(0,c.jsx)("span",{className:s,children:n}),e[11]=n,e[12]=s,e[13]=l):l=e[13];let f;e[14]!==n||e[15]!==o?(f=o(n===1?"change":"changes"),e[14]=n,e[15]=o,e[16]=f):f=e[16];let h;e[17]!==f?(h=(0,c.jsx)("span",{className:"font-mono text-[11px] tracking-widest text-muted-foreground uppercase",children:f}),e[17]=f,e[18]=h):h=e[18];let g;e[19]!==r||e[20]!==o?(g=r>0&&(0,c.jsxs)("span",{className:"font-mono text-[11px] tracking-widest text-destructive uppercase",children:["\xB7 ",o("{count} breaking",{count:r})]}),e[19]=r,e[20]=o,e[21]=g):g=e[21];let p;return e[22]!==l||e[23]!==h||e[24]!==g?(p=(0,c.jsxs)("div",{className:"flex items-baseline gap-3","data-testid":"sh-summary",children:[l,h,g]}),e[22]=l,e[23]=h,e[24]=g,e[25]=p):p=e[25],p},"Ae"),Nt={addedFieldConstraint:{action:"added",kind:"constraint"},addedIndex:{action:"added",kind:"index"},addedOptionalField:{action:"added",kind:"field?"},addedRelation:{action:"added",kind:"relation"},addedRequiredField:{action:"added",kind:"field"},addedTable:{action:"added",kind:"table"},changedCommitOrdering:{action:"changed",kind:"commit ordering"},changedFieldKind:{action:"changed",kind:"field kind"},changedFieldShape:{action:"changed",kind:"field shape"},changedIndex:{action:"changed",kind:"index"},changedJurisdiction:{action:"changed",kind:"jurisdiction"},changedMemoryMode:{action:"changed",kind:"memory mode"},changedShardMode:{action:"changed",kind:"shard mode"},changedTtlPolicy:{action:"changed",kind:"TTL policy"},fieldOptionalToRequired:{action:"changed",kind:"field \u2192 required"},fieldRequiredToOptional:{action:"changed",kind:"field \u2192 optional"},relaxedFieldConstraint:{action:"removed",kind:"constraint"},removedField:{action:"removed",kind:"field"},removedIndex:{action:"removed",kind:"index"},removedRelation:{action:"removed",kind:"relation"},removedTable:{action:"removed",kind:"table"},widenedFieldShape:{action:"changed",kind:"field \u2192 wider"}},ta=d((t,e)=>{let r=`${Nt[t.type].action} ${e} `;return t.summary.startsWith(r)?t.summary.slice(r.length):t.summary},"De"),aa=d(t=>{let e=new Map;for(let n of t){let a=n.table??"",o=e.get(a);o===void 0?e.set(a,[n]):o.push(n)}let r=[...e].map(([n,a])=>({changes:a,table:n}));return[...r.filter(n=>n.table!==""),...r.filter(n=>n.table==="")]},"Le"),ra=d(t=>{let e=(0,be.c)(2),{children:r}=t,n;return e[0]!==r?(n=(0,c.jsx)("div",{className:"px-4 pt-4 pb-2 font-mono text-[10px] tracking-widest text-muted-foreground/70 uppercase",children:r}),e[0]=r,e[1]=n):n=e[1],n},"Je"),na=d(({pane:t,shardKey:e=""})=>{let r=ce(),n=ze(),a=Ue({strict:!1}).version,o=d(u=>{Se(n({search:{version:u},to:"/migrations"}))},"s"),i=de(F.schemaHistory,{},{shardKey:e}),s=i.data?.versions??[],l=a!==void 0&&s.some(u=>u.hash===a)?a:s[0]?.hash,f=s.findIndex(u=>u.hash===l),h=f===-1?void 0:s[f+1]?.hash,g=de(F.schemaVersion,{hash:l??""},{enabled:l!==void 0,shardKey:e}),p=de(F.schemaVersion,{hash:h??""},{enabled:h!==void 0,shardKey:e}),b=(0,he.useMemo)(()=>{let u=kt(g.data?.version?.snapshotJson);if(u!==void 0)return Gt(kt(p.data?.version?.snapshotJson),u)},[g.data,p.data]),v=(0,he.useMemo)(()=>(b?.tables??[]).map(u=>({columns:u.columns,name:u.name,tier:Yt(u.shardMode)})),[b]),x=(0,he.useMemo)(()=>{let u={};for(let w of b?.tables??[])u[w.name]=Xt[w.status];return u},[b]);if(i.error!==null)return(0,c.jsx)(Te,{error:i.errorSource,testId:"sh-error"});if(s.length===0)return(0,c.jsx)(qe,{description:r("Each distinct schema shape this shard runs is recorded here, so you can see what changed and when."),testId:"sh-empty",title:r("No schema versions recorded yet.")});let y=b?.changes??[];return(0,c.jsxs)("div",{className:"flex min-h-0 flex-1 gap-4","data-testid":"lunora-schema-history",children:[(0,c.jsxs)("nav",{className:"flex w-56 shrink-0 flex-col overflow-hidden border-e border-border","data-testid":"sh-timeline-rail",children:[(0,c.jsx)(ra,{children:r("Schema versions")}),(0,c.jsx)("ul",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"sh-timeline",children:s.map(u=>(0,c.jsx)(Zt,{appliedAt:u.appliedAt,hash:u.hash,onSelect:o,selected:u.hash===l,seq:u.seq},u.hash))})]}),(0,c.jsxs)("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col gap-4 pe-1 pt-4",children:[(0,c.jsx)(ea,{breaking:b?.breakingCount??0,count:h===void 0?v.length:y.length,first:h===void 0}),t==="diagram"?(0,c.jsx)("div",{className:"flex min-h-0 flex-1 flex-col",children:(0,c.jsx)(ct,{fill:!0,nodeClasses:x,tables:v,testIdPrefix:"sh"})}):(0,c.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"sh-changes",children:aa(y).map(u=>{let w=(b?.tables??[]).find(k=>k.name===u.table);return(0,c.jsxs)("section",{className:"mb-6",children:[(0,c.jsxs)("div",{className:"flex items-baseline gap-3 border-b border-border/60 pb-1.5",children:[(0,c.jsx)("span",{className:"font-mono text-[13px] text-foreground",children:u.table===""?r("schema"):u.table}),w!==void 0&&(0,c.jsx)("span",{className:"font-mono text-[10px] tracking-widest text-muted-foreground/70 tabular-nums uppercase",children:r("{count} columns",{count:w.columns.length})}),u.changes.length>1&&(0,c.jsx)("span",{className:"ms-auto font-mono text-[10px] tracking-widest text-muted-foreground/70 tabular-nums",children:u.changes.length})]}),(0,c.jsx)("ul",{children:u.changes.map(k=>{let{action:L,kind:C}=Nt[k.type],j=k.severity==="breaking",M=ta(k,C);return(0,c.jsxs)("li",{className:"flex items-baseline gap-4 border-s-2 py-1.5 ps-3 transition-colors hover:bg-accent/30",children:[(0,c.jsx)("span",{"aria-hidden":"true",className:le("-ms-3 h-3 w-0.5 shrink-0 self-center",j?"bg-destructive":"bg-transparent")}),(0,c.jsxs)("span",{className:"w-44 shrink-0 font-mono text-[10px] tracking-widest text-muted-foreground/70 uppercase",children:[r(L)," ",C]}),M!==u.table&&(0,c.jsx)("span",{className:le("min-w-0 font-mono text-[13px]",j?"text-destructive":"text-foreground"),children:M}),j&&(0,c.jsx)("span",{className:"ms-auto shrink-0 font-mono text-[10px] tracking-widest text-destructive uppercase",children:r("breaking")})]},`${k.type}-${k.summary}`)})})]},u.table)})})]})]})},"Pe"),ia=d(t=>le("-mb-px border-b-2 px-3 py-2.5 font-mono text-[11px] tracking-wider uppercase transition-colors outline-none","hover:bg-accent/40 focus-visible:bg-accent/40",t?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),"_e"),_a=d(t=>{let e=(0,be.c)(11),{initialShardKey:r}=t,n=ce(),[a,o]=(0,he.useState)("diagram"),i;e[0]!==a?(i=d((g,p,b,v)=>(0,c.jsxs)("button",{"aria-selected":a===g,className:ia(a===g),"data-testid":b,onClick:d(()=>{o(g)},"onClick"),role:"tab",type:"button",children:[p,v!==void 0&&(0,c.jsx)("span",{className:"ms-2 tabular-nums text-muted-foreground/70",children:v})]}),"s"),e[0]=a,e[1]=i):i=e[1];let s=i,l;e[2]!==n||e[3]!==s?(l=(0,c.jsxs)("div",{className:"flex shrink-0 items-center gap-1 border-b border-border px-3","data-testid":"mg-panes",role:"tablist",children:[s("diagram",n("Diagram"),"mg-pane-diagram"),s("changes",n("Changes"),"mg-pane-changes"),s("data",n("Data migrations"),"mg-pane-data")]}),e[2]=n,e[3]=s,e[4]=l):l=e[4];let f;e[5]!==r||e[6]!==a?(f=(0,c.jsx)("div",{className:"flex min-h-0 flex-1 flex-col",children:a==="data"?(0,c.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-4",children:(0,c.jsx)(ut,{initialShardKey:r})}):(0,c.jsx)(na,{pane:a,shardKey:r})}),e[5]=r,e[6]=a,e[7]=f):f=e[7];let h;return e[8]!==l||e[9]!==f?(h=(0,c.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col pt-4","data-testid":"lunora-migrations-route",children:[l,f]}),e[8]=l,e[9]=f,e[10]=h):h=e[10],h},"et");export{_a as default};
|
|
1
|
+
import{a as ct}from"./chunk-EFEAOMEB.js";import{a as lt}from"./chunk-PRVBT5AJ.js";import"./chunk-JNWK5MJC.js";import{a as De}from"./chunk-EYBS3Q7O.js";import"./chunk-D63EYK5I.js";import"./chunk-Y2YLTUMD.js";import"./chunk-GVPVWT3Q.js";import"./chunk-LMCBMC2V.js";import"./chunk-QF743FSL.js";import"./chunk-IQ5CIBXJ.js";import"./chunk-YNCZVYCO.js";import"./chunk-OWRWDDJT.js";import"./chunk-QHVUXMRV.js";import"./chunk-2NUCBQFU.js";import{a as it}from"./chunk-2KTN53PK.js";import{a as nt}from"./chunk-LFWS6VBU.js";import{b as rt}from"./chunk-EDL46BPM.js";import{a as Ye}from"./chunk-UEONVTOV.js";import"./chunk-4KPATTV6.js";import{h as Ue,i as ze}from"./chunk-7WGZSDRS.js";import"./chunk-N7FOBAV3.js";import{i as Ze}from"./chunk-Z6PYAG36.js";import"./chunk-4SY2N2RS.js";import"./chunk-4AG356VE.js";import{a as Xe}from"./chunk-QHI77TGI.js";import"./chunk-SCTYLLJT.js";import"./chunk-OZID3UYF.js";import{a as qe}from"./chunk-O46IV64X.js";import{b as et}from"./chunk-OOPMRFI2.js";import"./chunk-L27FKJTG.js";import{a as Te}from"./chunk-PUTERXSU.js";import"./chunk-ZIY53FID.js";import{a as ot,b as st,c as dt,d as _e,e as q,f as T}from"./chunk-KMBE7RTC.js";import"./chunk-4YZAJTU5.js";import"./chunk-UDKKUJHY.js";import"./chunk-EOFWXI3T.js";import{a as F}from"./chunk-LYVYUTQY.js";import{c as de}from"./chunk-NP6H72XD.js";import{a as tt,e as at}from"./chunk-NPHGFVNE.js";import{n as Ge}from"./chunk-YESGXFAR.js";import"./chunk-ZPQBVYNN.js";import{B as ce,h as He,i as Qe,j as Ve,s as Se,w as je,x as le}from"./chunk-CDIV23I2.js";import"./chunk-PDBW6GTJ.js";import{a as Be}from"./chunk-A6TVTNKO.js";import{a as Pe,b as We}from"./chunk-ADABTCDI.js";import{a as d,d as se}from"./chunk-5PEAXTYQ.js";var be=se(Be(),1),he=se(Pe(),1);var mt=se(Be(),1),O=se(Pe(),1);var m=se(We(),1);var Tt=He(F.runMigration),ut=d(t=>{let e=(0,mt.c)(98),{initialShardKey:r}=t,n=Ge(),a=ce(),{queryShardKey:o,setShardKey:i,shardKey:s}=it(r),[l,f]=(0,O.useState)(""),[h,g]=(0,O.useState)("up"),[p,b]=(0,O.useState)(!0),[v,x]=(0,O.useState)(!1),[y,u]=(0,O.useState)(null),[w,k]=(0,O.useState)(null),L;e[0]!==s?(L=s.trim(),e[0]=s,e[1]=L):L=e[1];let C=L===o,j;e[2]===Symbol.for("react.memo_cache_sentinel")?(j={},e[2]=j):j=e[2];let M;e[3]!==o?(M={live:!0,shardKey:o},e[3]=o,e[4]=M):M=e[4];let $=de(F.migrationStatus,j,M),N=$.data?.migrations??null,Ie=$.error,{errorSource:Fe,liveError:Re}=$,ve,ye;e[5]!==o||e[6]!==$.data?(ve=d(()=>{$.data!==void 0&&rt(o)},"W"),ye=[$.data,o],e[5]=o,e[6]=$.data,e[7]=ve,e[8]=ye):(ve=e[7],ye=e[8]),(0,O.useEffect)(ve,ye);let xe;if(e[9]!==n||e[10]!==h||e[11]!==p||e[12]!==l||e[13]!==s||e[14]!==$||e[15]!==a){let I=d(async()=>{let Ae=l.trim();if(Ae===""){k(a("Enter a migration id")),u(null);return}x(!0),k(null);try{let Le=await n.query(Tt,{direction:h,dryRun:p,id:Ae},Qe(s));u(Le),$.refetch()}catch(Le){let qt=Le;u(null),k(Ve(qt))}x(!1)},"u");xe=d(()=>{Se(I())},"V"),e[9]=n,e[10]=h,e[11]=p,e[12]=l,e[13]=s,e[14]=$,e[15]=a,e[16]=xe}else xe=e[16];let ke=xe,we;e[17]===Symbol.for("react.memo_cache_sentinel")?(we=d(I=>{f(I.target.value)},"Y"),e[17]=we):we=e[17];let Ot=we,$e;e[18]===Symbol.for("react.memo_cache_sentinel")?($e=d(I=>{g(I.target.value==="down"?"down":"up")},"Z"),e[18]=$e):$e=e[18];let St=$e,Ne;e[19]===Symbol.for("react.memo_cache_sentinel")?(Ne=d(I=>{b(I.target.checked)},"ee"),e[19]=Ne):Ne=e[19];let jt=Ne,_;e[20]!==i||e[21]!==s?(_=(0,m.jsx)(nt,{onChange:i,testId:"mg-shard-input",value:s}),e[20]=i,e[21]=s,e[22]=_):_=e[22];let D;e[23]!==Re?(D=(0,m.jsx)(lt,{message:Re,prefix:"mg"}),e[23]=Re,e[24]=D):D=e[24];let K;e[25]!==_||e[26]!==D?(K=(0,m.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[_,D]}),e[25]=_,e[26]=D,e[27]=K):K=e[27];let E;e[28]!==Ie||e[29]!==Fe?(E=Ie!==null&&(0,m.jsx)(Te,{error:Fe,testId:"mg-status-error"}),e[28]=Ie,e[29]=Fe,e[30]=E):E=e[30];let J;e[31]!==N||e[32]!==a?(J=N!==null&&N.length===0&&(0,m.jsx)(qe,{description:a("Data migrations you run against this shard will be tracked here."),icon:(0,m.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,m.jsx)("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"})}),testId:"mg-empty",title:a("No migrations have run on this shard.")}),e[31]=N,e[32]=a,e[33]=J):J=e[33];let A;e[34]!==N||e[35]!==a?(A=N!==null&&N.length>0&&(0,m.jsx)(tt,{className:"overflow-hidden py-0",children:(0,m.jsx)(at,{className:"px-0",children:(0,m.jsxs)(ot,{"data-testid":"mg-table",children:[(0,m.jsx)(st,{children:(0,m.jsxs)(_e,{children:[(0,m.jsx)(q,{children:a("id")}),(0,m.jsx)(q,{children:a("direction")}),(0,m.jsx)(q,{children:a("status")}),(0,m.jsx)(q,{children:a("processed")}),(0,m.jsx)(q,{children:a("changed")}),(0,m.jsx)(q,{children:a("updated")}),(0,m.jsx)(q,{children:a("error")})]})}),(0,m.jsx)(dt,{children:N.map(Ct)})]})})}),e[34]=N,e[35]=a,e[36]=A):A=e[36];let P;e[37]!==a?(P=a("Run migration"),e[37]=a,e[38]=P):P=e[38];let B;e[39]!==P?(B=(0,m.jsx)(De,{children:P}),e[39]=P,e[40]=B):B=e[40];let W;e[41]!==a?(W=a("Migration id"),e[41]=a,e[42]=W):W=e[42];let U;e[43]!==a?(U=a("migration id"),e[43]=a,e[44]=U):U=e[44];let z;e[45]!==l||e[46]!==W||e[47]!==U?(z=(0,m.jsx)(Ze,{"aria-label":W,className:"w-auto","data-testid":"mg-id-input",onChange:Ot,placeholder:U,value:l}),e[45]=l,e[46]=W,e[47]=U,e[48]=z):z=e[48];let H;e[49]!==a?(H=a("Direction"),e[49]=a,e[50]=H):H=e[50];let Q;e[51]!==a?(Q=a("up"),e[51]=a,e[52]=Q):Q=e[52];let V;e[53]!==Q?(V=(0,m.jsx)("option",{value:"up",children:Q}),e[53]=Q,e[54]=V):V=e[54];let G;e[55]!==a?(G=a("down"),e[55]=a,e[56]=G):G=e[56];let X;e[57]!==G?(X=(0,m.jsx)("option",{value:"down",children:G}),e[57]=G,e[58]=X):X=e[58];let Y;e[59]!==h||e[60]!==H||e[61]!==V||e[62]!==X?(Y=(0,m.jsxs)("select",{"aria-label":H,className:"flex h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs transition-colors outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 dark:bg-input/30","data-testid":"mg-direction",onChange:St,value:h,children:[V,X]}),e[59]=h,e[60]=H,e[61]=V,e[62]=X,e[63]=Y):Y=e[63];let Z;e[64]!==p?(Z=(0,m.jsx)("input",{checked:p,className:"size-4 accent-primary","data-testid":"mg-dry-run",id:"mg-dry-run",onChange:jt,type:"checkbox"}),e[64]=p,e[65]=Z):Z=e[65];let ee;e[66]!==a?(ee=a("Dry run"),e[66]=a,e[67]=ee):ee=e[67];let te;e[68]!==Z||e[69]!==ee?(te=(0,m.jsxs)(De,{className:"flex items-center gap-1.5",htmlFor:"mg-dry-run",children:[Z,ee]}),e[68]=Z,e[69]=ee,e[70]=te):te=e[70];let ae;e[71]!==p||e[72]!==ke||e[73]!==v||e[74]!==C||e[75]!==a?(ae=p?(0,m.jsx)(Xe,{"data-testid":"mg-run",disabled:v||!C,onClick:ke,type:"button",children:a(v?"Running\u2026":"Run")}):(0,m.jsx)(Ye,{confirmLabel:a(v?"Running\u2026":"Run migration?"),disabled:v||!C,onConfirm:ke,testId:"mg-run",children:a("Run")}),e[71]=p,e[72]=ke,e[73]=v,e[74]=C,e[75]=a,e[76]=ae):ae=e[76];let re;e[77]!==z||e[78]!==Y||e[79]!==te||e[80]!==ae?(re=(0,m.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[z,Y,te,ae]}),e[77]=z,e[78]=Y,e[79]=te,e[80]=ae,e[81]=re):re=e[81];let ne;e[82]!==B||e[83]!==re?(ne=(0,m.jsxs)("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs",children:[B,re]}),e[82]=B,e[83]=re,e[84]=ne):ne=e[84];let ie;e[85]!==w?(ie=w!==null&&(0,m.jsx)("pre",{className:"text-sm text-destructive whitespace-pre-wrap","data-testid":"mg-run-error",role:"alert",children:w}),e[85]=w,e[86]=ie):ie=e[86];let oe;e[87]!==y||e[88]!==a?(oe=y!==null&&(0,m.jsxs)("p",{className:"text-sm text-muted-foreground","data-testid":"mg-run-result",children:[y.dryRun?a("Dry run: "):"",a("{status} \u2014 processed",{status:y.status}),y.processed,a(", changed"),y.changed]}),e[87]=y,e[88]=a,e[89]=oe):oe=e[89];let Oe;return e[90]!==K||e[91]!==E||e[92]!==J||e[93]!==A||e[94]!==ne||e[95]!==ie||e[96]!==oe?(Oe=(0,m.jsxs)("div",{className:"flex flex-col gap-3 pt-4","data-testid":"lunora-migrations",children:[K,E,J,A,ne,ie,oe]}),e[90]=K,e[91]=E,e[92]=J,e[93]=A,e[94]=ne,e[95]=ie,e[96]=oe,e[97]=Oe):Oe=e[97],Oe},"yt");function Ct(t){return(0,m.jsxs)(_e,{"data-testid":`mg-row-${t.id}`,children:[(0,m.jsx)(T,{children:t.id}),(0,m.jsx)(T,{children:t.direction}),(0,m.jsx)(T,{children:(0,m.jsx)(et,{variant:"secondary",children:t.status})}),(0,m.jsx)(T,{children:t.processed}),(0,m.jsx)(T,{children:t.changed}),(0,m.jsx)(T,{children:je(t.updatedAt)}),(0,m.jsx)(T,{children:t.error??""})]},t.id)}d(Ct,"Je");var c=se(We(),1);var Ke=1;function Mt(t){let e={},r=Object.keys(t);r.sort();for(let n of r)e[n]=t[n];return e}d(Mt,"ue");var me=d(t=>typeof t=="object"&&t!==null,"O"),It=d(t=>me(t)&&me(t.fields)&&me(t.indexes)&&me(t.relations)&&typeof t.shardMode=="string","me"),Ft=d(t=>{if(t===void 0||t.trim()==="")return{status:"absent"};let e;try{e=JSON.parse(t)}catch(r){return{error:`baseline is not valid JSON: ${r instanceof Error?r.message:String(r)}`,status:"invalid"}}if(!me(e)||e.version!==Ke||!me(e.tables))return{error:`baseline is malformed or written by an incompatible version (expected version ${String(Ke)})`,status:"invalid"};for(let[r,n]of Object.entries(e.tables))if(!It(n))return{error:`baseline table "${r}" has an invalid structure`,status:"invalid"};return{snapshot:{jurisdiction:typeof e.jurisdiction=="string"?e.jurisdiction:void 0,migrationIds:Array.isArray(e.migrationIds)?e.migrationIds:[],tables:e.tables,version:Ke},status:"ok"}},"he"),Rt=d((t,e)=>t.unique===e.unique&&t.fields.length===e.fields.length&&t.fields.every((r,n)=>r===e.fields[n]),"pe"),ht=d(t=>t.unique!==void 0,"Q"),ge=d(({nullable:t,optional:e,refined:r,unique:n,...a})=>JSON.stringify(Mt(a)),"M"),ft=d(t=>({form:JSON.stringify([ge(t),t.optional===!0,t.nullable===!0]),refined:t.refined===!0}),"U"),pt=d(t=>t.kind==="union"&&t.members?t.members.map(e=>ft(e)):[ft({...t,nullable:!1,optional:!1})],"W"),Lt=d((t,e)=>{if(e.kind!=="union")return!1;let r=pt(e);return pt(t).every(n=>r.some(a=>a.form===n.form&&(n.refined||!a.refined)))},"ge"),S=d(t=>{switch(t.kind){case"array":return`array(${t.of?S(t.of):"?"})`;case"from":return t.output===void 0?"from":`from(${t.output})`;case"id":return`id(${t.ref??"?"})`;case"literal":return`literal(${t.literal??"?"})`;case"object":return`object({ ${Object.keys(t.fields??{}).join(", ")} })`;case"record":return`record(${t.key?S(t.key):"?"}, ${t.of?S(t.of):"?"})`;case"union":return(t.members??[]).map(e=>S(e)).join(" | ");default:return t.kind}},"x"),fe=d((t,e,r)=>({remediation:"backfill",scope:"table",severity:"breaking",summary:r,table:t,type:e}),"T"),pe=d((t,e,r)=>({remediation:"none",scope:"table",severity:"safe",summary:r,table:t,type:e}),"F"),wt=d((t,e)=>{let r=JSON.stringify(t),n=JSON.stringify(e);return r===n?0:r<n?-1:1},"N"),ue=d(t=>({...t,...t.kind==="from"?{output:void 0}:{},...t.fields?{fields:Object.fromEntries(Object.entries(t.fields).map(([e,r])=>[e,ue(r)]))}:{},...t.key?{key:ue(t.key)}:{},...t.of?{of:ue(t.of)}:{},...t.members?{members:t.members.map(e=>ue(e)).toSorted(wt)}:{}}),"S"),gt=d(t=>t.kind==="union"?t.members??[]:[t],"B"),_t=d((t,e)=>{let r=[...t],n=[...e],a=new Set,o=new Set,i=d((s,l)=>{for(let[f,h]of r.entries()){if(o.has(f))continue;let g=n.findIndex((p,b)=>!a.has(b)&&s(h,p));g!==-1&&(a.add(g),o.add(f),l&&([r[f],n[g]]=Me(h,n[g])))}},"s");return i((s,l)=>JSON.stringify(s)===JSON.stringify(l),!1),i((s,l)=>ge(ue(s))===ge(ue(l)),!0),[r,n]},"ve"),Me=d((t,e)=>{if(t.kind==="union"||e.kind==="union"){let[a,o]=_t(gt(t),gt(e)),i=d((s,l)=>s.kind==="union"?{...s,members:l.toSorted(wt)}:l[0],"s");return[i(t,a),i(e,o)]}if(t.kind!==e.kind)return[t,e];if(t.kind==="from")return t.output===void 0||e.output===void 0?[{...t,output:void 0},{...e,output:void 0}]:[t,e];let r={...t.fields?{fields:{...t.fields}}:{}},n={...e.fields?{fields:{...e.fields}}:{}};for(let a of["key","of"])t[a]&&e[a]&&([r[a],n[a]]=Me(t[a],e[a]));for(let a of Object.keys(t.fields??{})){let o=t.fields?.[a],i=e.fields?.[a];o&&i&&r.fields&&n.fields&&([r.fields[a],n.fields[a]]=Me(o,i))}return[{...t,...r},{...e,...n}]},"R"),Dt=d((t,e,r,n,a)=>{let[o,i]=Me(r,n);if(o.kind===i.kind&&(!a||ge(o)===ge(i)))return;if(a&&Lt(o,i))return pe(t,"widenedFieldShape",`field ${t}.${e} widened: ${S(o)} \u2192 ${S(i)} \u2014 every stored value stays valid`);if(o.kind!==i.kind)return fe(t,"changedFieldKind",`field ${t}.${e} changed type: ${o.kind} \u2192 ${i.kind} \u2014 add a data migration to convert existing values`);let s=Object.values(i.fields??{});return a&&o.kind==="object"&&Object.keys(o.fields??{}).length===0&&s.length>0&&s.every(l=>l.optional)?pe(t,"widenedFieldShape",`field ${t}.${e} now records its optional object shape \u2014 stored values stay valid`):fe(t,"changedFieldShape",`field ${t}.${e} changed shape: ${S(o)} \u2192 ${S(i)} \u2014 stored values were written against the old shape; add a data migration to convert them`)},"be"),Kt=d((t,e,r,n,a)=>{let o=[];return r.unique!==n.unique&&o.push(n.unique===!0?{...fe(t,"addedFieldConstraint",`field ${t}.${e} became unique \u2014 existing duplicates would violate it; add a data migration to de-duplicate first`),field:e,uniqueOn:[e]}:pe(t,"relaxedFieldConstraint",`field ${t}.${e} is no longer unique`)),r.nullable!==n.nullable&&o.push(n.nullable===!0?pe(t,"relaxedFieldConstraint",`field ${t}.${e} became nullable`):fe(t,"addedFieldConstraint",`field ${t}.${e} is no longer nullable \u2014 rows holding NULL would be invalid; add a data migration to backfill them`)),a&&r.refined!==n.refined&&o.push(n.refined===!0?fe(t,"addedFieldConstraint",`field ${t}.${e} gained a validation refinement \u2014 stored values were never checked against it; add a data migration if any could fail`):pe(t,"relaxedFieldConstraint",`field ${t}.${e} dropped its validation refinement`)),o},"ye"),$t=d((t,e,r,n,a=!0)=>{let o=[],i=ht(r)&&ht(n),s=Dt(t,e,r,n,i);return s&&o.push(s),i&&o.push(...Kt(t,e,r,n,a)),r.optional&&!n.optional?o.push({remediation:"backfill",severity:"breaking",summary:`field ${t}.${e} became required \u2014 rows missing it would be invalid; add a data migration to backfill it`,table:t,scope:"table",type:"fieldOptionalToRequired"}):!r.optional&&n.optional&&o.push({remediation:"none",scope:"table",severity:"safe",summary:`field ${t}.${e} became optional`,table:t,type:"fieldRequiredToOptional"}),o},"ee"),Et=d((t,e,r)=>r.optional?{remediation:"none",scope:"table",severity:"safe",summary:`added optional field ${t}.${e}`,table:t,type:"addedOptionalField"}:{remediation:"backfill",severity:"breaking",summary:`added required field ${t}.${e} \u2014 existing rows have no value; add a data migration to backfill it`,table:t,scope:"table",type:"addedRequiredField"},"xe"),Jt=d((t,e)=>e.refinementsRecorded!==!0||t.refinementsRecorded===!0,"ke"),At=d((t,e,r,n)=>{for(let[a,o]of Object.entries(r.fields)){let i=e.fields[a];i===void 0?n.push({...Et(t,a,o),field:a}):n.push(...$t(t,a,i,o,Jt(e,r)).map(s=>({...s,field:a})))}for(let a of Object.keys(e.fields))r.fields[a]===void 0&&n.push({field:a,remediation:"backfill",severity:"breaking",summary:`removed field ${t}.${a} \u2014 add a data migration if stored data must be cleaned up`,table:t,scope:"table",type:"removedField"})},"$e"),Pt=d((t,e,r,n)=>{for(let[a,o]of Object.entries(r.indexes)){let i=e.indexes[a];if(i===void 0){n.push(o.unique?{remediation:"backfill",scope:"table",severity:"breaking",summary:`added unique index ${a} on ${t} \u2014 existing duplicates would violate it; add a data migration to de-duplicate first`,table:t,type:"addedIndex",uniqueOn:o.fields}:{remediation:"none",scope:"table",severity:"safe",summary:`added index ${a} on ${t}`,table:t,type:"addedIndex"});continue}Rt(i,o)||n.push(o.unique?{remediation:"backfill",scope:"table",severity:"breaking",summary:`index ${a} on ${t} changed shape and is unique \u2014 existing duplicates would violate it; add a data migration to de-duplicate first`,table:t,type:"changedIndex",uniqueOn:o.fields}:{remediation:"none",scope:"table",severity:"safe",summary:`index ${a} on ${t} changed shape \u2014 a query that relied on the old index may need updating`,table:t,type:"changedIndex"})}for(let a of Object.keys(e.indexes))r.indexes[a]===void 0&&n.push({remediation:"none",severity:"safe",index:a,summary:`removed index ${a} on ${t} \u2014 a query that used \`.withIndex("${a}")\` no longer compiles`,table:t,scope:"table",type:"removedIndex"})},"we"),Bt=d((t,e,r,n)=>{for(let a of Object.keys(r.relations))e.relations[a]===void 0&&n.push({remediation:"none",scope:"schema",severity:"safe",summary:`added relation ${t}.${a}`,table:t,type:"addedRelation"});for(let a of Object.keys(e.relations))r.relations[a]===void 0&&n.push({remediation:"none",scope:"schema",severity:"safe",summary:`removed relation ${t}.${a} \u2014 the stored foreign-key values stay in place, but its \`onDelete\` action no longer runs and a \`with: { ${a} }\` read no longer compiles`,table:t,type:"removedRelation",warning:!0})},"Oe"),Ee="shardBy:_unknown_",Ce="global",Wt=d((t,e)=>t===Ce&&e.startsWith(`${Ce}:`)||e===Ce&&t.startsWith(`${Ce}:`),"Se"),Ut=d((t,e,r)=>{if(e===r)return r!==Ee?void 0:{remediation:"rehome",scope:"table",severity:"breaking",summary:`table ${t} declares a non-literal .shardBy(...) key, so codegen cannot read which column partitions it \u2014 every such key records as "${Ee}" and two DIFFERENT keys would compare equal. Pass the shard key as a string literal; until then this is reported on every run, because the alternative is a silent pass on a re-home that strands every row (export/import is the only way back).`,table:t,type:"changedShardMode"};if(!Wt(e,r))return{remediation:"rehome",severity:"breaking",summary:`table ${t} changed shard mode: ${e} \u2192 ${r} \u2014 its physical storage moves, and existing rows do NOT follow the schema; re-home them with an export/import round trip (https://lunora.sh/docs/concepts/sharding#migrating-a-populated-table)`,table:t,scope:"table",type:"changedShardMode",...r===Ee?{}:{coverage:{shardMode:r,table:t}}}},"je"),bt=d(t=>t.memory!==void 0,"K"),vt=d(t=>t.after??0,"Y"),Je=d(t=>t.after===void 0?`{ field: "${t.field}" }`:`{ after: ${String(t.after)}, field: "${t.field}" }`,"_"),R=d(t=>t.after===void 0?`.ttl("${t.field}")`:`.ttl("${t.field}", { after: ${String(t.after)} })`,"w"),zt=d((t,e,r)=>{if(e===void 0&&r===void 0)return;let n=d((s,l)=>({coverage:{table:t,ttl:{...l.after===void 0?{}:{after:l.after},field:l.field}},expiry:{...l.after===void 0?{}:{after:l.after},field:l.field,...e===void 0?{}:{previous:{...e.after===void 0?{}:{after:e.after},field:e.field}}},remediation:"backfill",scope:"table",severity:"breaking",summary:s,table:t,type:"changedTtlPolicy"}),"n"),a=d(s=>({remediation:"none",scope:"table",severity:"safe",summary:s,table:t,type:"changedTtlPolicy",warning:!0}),"o");if(r===void 0)return a(`table ${t} dropped its TTL policy \u2014 its rows are no longer swept, so they stay until something else deletes them`);if(e===void 0)return n(`table ${t} gained a TTL policy ${R(r)} \u2014 every row already past the cutoff is deleted on the next alarm sweep; refresh or clear "${r.field}" on the rows that must survive, then declare a migration with covers: { table: "${t}", ttl: ${Je(r)} }`,r);if(e.field!==r.field)return n(`table ${t} moved its TTL to a different column: ${R(e)} \u2192 ${R(r)} \u2014 rows are now expired by a column they were never written against; populate "${r.field}" on the rows that must survive, then declare a migration with covers: { table: "${t}", ttl: ${Je(r)} }`,r);let o=vt(e),i=vt(r);return i<o?n(`table ${t} shortened its TTL: ${R(e)} \u2192 ${R(r)} \u2014 rows that were not expired under the old offset are deleted on the next alarm sweep; refresh "${r.field}" on the rows that must survive, then declare a migration with covers: { table: "${t}", ttl: ${Je(r)} }`,r):i>o?a(`table ${t} lengthened its TTL: ${R(e)} \u2192 ${R(r)} \u2014 every row stays, and expires later than it would have`):void 0},"Te"),Ht=d((t,e,r)=>{let n=[];return e.memory!==r.memory&&n.push(r.memory===!0?{remediation:"rehome",scope:"table",severity:"breaking",summary:`table ${t} became a .memory() table \u2014 every row is deleted in every shard on the next Durable Object cold start, and no data migration survives that; export the rows first if they must be kept, or revert`,table:t,type:"changedMemoryMode",coverage:{memory:!0,table:t}}:{remediation:"none",scope:"table",severity:"safe",summary:`table ${t} is no longer a .memory() table \u2014 its rows now survive a cold start`,table:t,type:"changedMemoryMode"}),e.commitOrdered!==r.commitOrdered&&n.push(r.commitOrdered===!0?{remediation:"backfill",scope:"table",severity:"breaking",summary:`table ${t} became .commitOrdered() \u2014 rows written before it carry no _commitSeq, so a \`_commitSeq > cursor\` changefeed never offers them; add a data migration over the table to stamp them (the rewrite allocates a sequence)`,table:t,type:"changedCommitOrdering",identityRewrites:!0}:{remediation:"none",scope:"table",severity:"safe",summary:`table ${t} is no longer .commitOrdered() \u2014 stored rows are untouched, but new rows carry no _commitSeq, so a \`_commitSeq > cursor\` changefeed stops advancing without erroring; update the consumers`,table:t,type:"changedCommitOrdering",warning:!0}),n},"Fe"),Qt=d((t,e,r,n)=>{let a=Ut(t,e.shardMode,r.shardMode);if(a&&n.push(a),bt(e)&&bt(r)){n.push(...Ht(t,e,r));let o=zt(t,e.ttl,r.ttl);o&&n.push(o)}At(t,e,r,n),Pt(t,e,r,n),Bt(t,e,r,n)},"qe"),Vt=d((t,e)=>{let r=[],n=t?.tables??{};for(let[a,o]of Object.entries(e.tables)){let i=n[a];if(i===void 0){r.push({remediation:"none",scope:"table",severity:"safe",summary:`added table ${a}`,table:a,type:"addedTable"});continue}Qt(a,i,o,r)}for(let a of Object.keys(n))e.tables[a]===void 0&&r.push({remediation:"none",scope:"table",severity:"safe",summary:`removed table ${a} \u2014 its rows are left in place in each shard's SQLite (nothing deletes them) but are unreachable through the schema; export the shard first if the data must be kept, or declare the table again to reach it`,table:a,type:"removedTable",warning:!0});if(t!==void 0&&t.jurisdiction!==e.jurisdiction){let a=t.jurisdiction??"(none)",o=e.jurisdiction??"(none)";r.push({remediation:"rehome",scope:"schema",severity:"breaking",summary:`Durable Object jurisdiction changed from ${a} to ${o} \u2014 this re-homes every DO and strands all existing shard, scheduler, and session-DO data in the old region (export then import to move it). Revert the change, or declare a migration with covers: { jurisdiction: "${e.jurisdiction??"none"}" } once the data is moved.`,type:"changedJurisdiction",coverage:{jurisdiction:e.jurisdiction??"none"}})}return{changes:r}},"Me"),yt=d(t=>Object.entries(t.fields).map(([e,r])=>({name:e,optional:r.optional,ref:Object.values(t.relations).find(n=>n.field===e&&n.kind==="one")?.table,type:S(r)})),"z"),xt=d((t,e,r)=>{let n={},a=e?.fields??{},o=r?.fields??{};for(let[i,s]of Object.entries(o)){let l=a[i];l===void 0?n[i]=e===void 0?"unchanged":"added":n[i]=$t(t,i,l,s).length===0?"unchanged":"changed"}for(let i of Object.keys(a))o[i]===void 0&&(n[i]="removed");return n},"X"),Gt=d((t,e)=>{let{changes:r}=Vt(t,e),n=new Set(r.filter(i=>i.scope==="table"&&i.table!==void 0).map(i=>i.table)),a=[],o=d((i,s)=>i?"added":n.has(s)?"changed":"context","r");for(let[i,s]of Object.entries(e.tables)){let l=t?.tables[i],f=o(l===void 0,i);a.push({columns:yt(s),fieldStatus:xt(i,l,s),name:i,shardMode:s.shardMode,status:f})}for(let[i,s]of Object.entries(t?.tables??{}))e.tables[i]===void 0&&a.push({columns:yt(s),fieldStatus:xt(i,s,void 0),name:i,shardMode:s.shardMode,status:"removed"});return a.sort((i,s)=>i.name.localeCompare(s.name)),{breakingCount:r.filter(i=>i.severity==="breaking").length,changes:r,tables:a}},"Ce"),kt=d(t=>{let e=Ft(t);return e.status==="ok"?e.snapshot:void 0},"Z"),Xt={added:"ring-2 ring-emerald-500/60",changed:"ring-2 ring-amber-500/70",context:"opacity-55",removed:"opacity-70 ring-2 ring-destructive/60"},Yt=d(t=>t==="global"||t.startsWith("global:")?"global":"shard","Ie"),Zt=d(t=>{let e=(0,be.c)(24),{appliedAt:r,hash:n,onSelect:a,selected:o,seq:i}=t,s=o?"border-s-primary bg-accent/60 text-foreground":"border-s-transparent text-muted-foreground hover:bg-accent/30 hover:text-foreground",l;e[0]!==s?(l=le("flex w-full flex-col items-start gap-1 border-s-2 px-4 py-3 text-start outline-none transition-colors",s),e[0]=s,e[1]=l):l=e[1];let f=`sh-version-${n}`,h;e[2]!==n||e[3]!==a?(h=d(()=>{a(n)},"m"),e[2]=n,e[3]=a,e[4]=h):h=e[4];let g;e[5]!==i?(g=(0,c.jsxs)("span",{className:"font-mono text-[13px] tabular-nums",children:["v",i]}),e[5]=i,e[6]=g):g=e[6];let p;e[7]!==n?(p=n.slice(0,7),e[7]=n,e[8]=p):p=e[8];let b;e[9]!==p?(b=(0,c.jsx)("span",{className:"ms-auto font-mono text-[10px] tracking-wider text-muted-foreground/70 uppercase",children:p}),e[9]=p,e[10]=b):b=e[10];let v;e[11]!==g||e[12]!==b?(v=(0,c.jsxs)("span",{className:"flex w-full items-baseline gap-2",children:[g,b]}),e[11]=g,e[12]=b,e[13]=v):v=e[13];let x;e[14]!==r?(x=je(r),e[14]=r,e[15]=x):x=e[15];let y;e[16]!==x?(y=(0,c.jsx)("span",{className:"font-mono text-[10px] tracking-wide text-muted-foreground/70",children:x}),e[16]=x,e[17]=y):y=e[17];let u;return e[18]!==y||e[19]!==l||e[20]!==f||e[21]!==h||e[22]!==v?(u=(0,c.jsx)("li",{children:(0,c.jsxs)("button",{className:l,"data-testid":f,onClick:h,type:"button",children:[v,y]})}),e[18]=y,e[19]=l,e[20]=f,e[21]=h,e[22]=v,e[23]=u):u=e[23],u},"Ee"),ea=d(t=>{let e=(0,be.c)(26),{breaking:r,count:n,first:a}=t,o=ce();if(a){let b;e[0]!==n?(b=(0,c.jsx)("span",{className:"text-3xl leading-none font-light tracking-tight tabular-nums",children:n}),e[0]=n,e[1]=b):b=e[1];let v;e[2]!==o?(v=o("tables"),e[2]=o,e[3]=v):v=e[3];let x;e[4]!==v?(x=(0,c.jsx)("span",{className:"font-mono text-[11px] tracking-widest text-muted-foreground uppercase",children:v}),e[4]=v,e[5]=x):x=e[5];let y;return e[6]!==b||e[7]!==x?(y=(0,c.jsxs)("div",{className:"flex items-baseline gap-3","data-testid":"sh-summary",children:[b,x]}),e[6]=b,e[7]=x,e[8]=y):y=e[8],y}let i=r>0&&"text-destructive",s;e[9]!==i?(s=le("text-3xl leading-none font-light tracking-tight tabular-nums",i),e[9]=i,e[10]=s):s=e[10];let l;e[11]!==n||e[12]!==s?(l=(0,c.jsx)("span",{className:s,children:n}),e[11]=n,e[12]=s,e[13]=l):l=e[13];let f;e[14]!==n||e[15]!==o?(f=o(n===1?"change":"changes"),e[14]=n,e[15]=o,e[16]=f):f=e[16];let h;e[17]!==f?(h=(0,c.jsx)("span",{className:"font-mono text-[11px] tracking-widest text-muted-foreground uppercase",children:f}),e[17]=f,e[18]=h):h=e[18];let g;e[19]!==r||e[20]!==o?(g=r>0&&(0,c.jsxs)("span",{className:"font-mono text-[11px] tracking-widest text-destructive uppercase",children:["\xB7 ",o("{count} breaking",{count:r})]}),e[19]=r,e[20]=o,e[21]=g):g=e[21];let p;return e[22]!==l||e[23]!==h||e[24]!==g?(p=(0,c.jsxs)("div",{className:"flex items-baseline gap-3","data-testid":"sh-summary",children:[l,h,g]}),e[22]=l,e[23]=h,e[24]=g,e[25]=p):p=e[25],p},"Ae"),Nt={addedFieldConstraint:{action:"added",kind:"constraint"},addedIndex:{action:"added",kind:"index"},addedOptionalField:{action:"added",kind:"field?"},addedRelation:{action:"added",kind:"relation"},addedRequiredField:{action:"added",kind:"field"},addedTable:{action:"added",kind:"table"},changedCommitOrdering:{action:"changed",kind:"commit ordering"},changedFieldKind:{action:"changed",kind:"field kind"},changedFieldShape:{action:"changed",kind:"field shape"},changedIndex:{action:"changed",kind:"index"},changedJurisdiction:{action:"changed",kind:"jurisdiction"},changedMemoryMode:{action:"changed",kind:"memory mode"},changedShardMode:{action:"changed",kind:"shard mode"},changedTtlPolicy:{action:"changed",kind:"TTL policy"},fieldOptionalToRequired:{action:"changed",kind:"field \u2192 required"},fieldRequiredToOptional:{action:"changed",kind:"field \u2192 optional"},relaxedFieldConstraint:{action:"removed",kind:"constraint"},removedField:{action:"removed",kind:"field"},removedIndex:{action:"removed",kind:"index"},removedRelation:{action:"removed",kind:"relation"},removedTable:{action:"removed",kind:"table"},widenedFieldShape:{action:"changed",kind:"field \u2192 wider"}},ta=d((t,e)=>{let r=`${Nt[t.type].action} ${e} `;return t.summary.startsWith(r)?t.summary.slice(r.length):t.summary},"De"),aa=d(t=>{let e=new Map;for(let n of t){let a=n.table??"",o=e.get(a);o===void 0?e.set(a,[n]):o.push(n)}let r=[...e].map(([n,a])=>({changes:a,table:n}));return[...r.filter(n=>n.table!==""),...r.filter(n=>n.table==="")]},"Le"),ra=d(t=>{let e=(0,be.c)(2),{children:r}=t,n;return e[0]!==r?(n=(0,c.jsx)("div",{className:"px-4 pt-4 pb-2 font-mono text-[10px] tracking-widest text-muted-foreground/70 uppercase",children:r}),e[0]=r,e[1]=n):n=e[1],n},"Je"),na=d(({pane:t,shardKey:e=""})=>{let r=ce(),n=ze(),a=Ue({strict:!1}).version,o=d(u=>{Se(n({search:{version:u},to:"/migrations"}))},"s"),i=de(F.schemaHistory,{},{shardKey:e}),s=i.data?.versions??[],l=a!==void 0&&s.some(u=>u.hash===a)?a:s[0]?.hash,f=s.findIndex(u=>u.hash===l),h=f===-1?void 0:s[f+1]?.hash,g=de(F.schemaVersion,{hash:l??""},{enabled:l!==void 0,shardKey:e}),p=de(F.schemaVersion,{hash:h??""},{enabled:h!==void 0,shardKey:e}),b=(0,he.useMemo)(()=>{let u=kt(g.data?.version?.snapshotJson);if(u!==void 0)return Gt(kt(p.data?.version?.snapshotJson),u)},[g.data,p.data]),v=(0,he.useMemo)(()=>(b?.tables??[]).map(u=>({columns:u.columns,name:u.name,tier:Yt(u.shardMode)})),[b]),x=(0,he.useMemo)(()=>{let u={};for(let w of b?.tables??[])u[w.name]=Xt[w.status];return u},[b]);if(i.error!==null)return(0,c.jsx)(Te,{error:i.errorSource,testId:"sh-error"});if(s.length===0)return(0,c.jsx)(qe,{description:r("Each distinct schema shape this shard runs is recorded here, so you can see what changed and when."),testId:"sh-empty",title:r("No schema versions recorded yet.")});let y=b?.changes??[];return(0,c.jsxs)("div",{className:"flex min-h-0 flex-1 gap-4","data-testid":"lunora-schema-history",children:[(0,c.jsxs)("nav",{className:"flex w-56 shrink-0 flex-col overflow-hidden border-e border-border","data-testid":"sh-timeline-rail",children:[(0,c.jsx)(ra,{children:r("Schema versions")}),(0,c.jsx)("ul",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"sh-timeline",children:s.map(u=>(0,c.jsx)(Zt,{appliedAt:u.appliedAt,hash:u.hash,onSelect:o,selected:u.hash===l,seq:u.seq},u.hash))})]}),(0,c.jsxs)("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col gap-4 pe-1 pt-4",children:[(0,c.jsx)(ea,{breaking:b?.breakingCount??0,count:h===void 0?v.length:y.length,first:h===void 0}),t==="diagram"?(0,c.jsx)("div",{className:"flex min-h-0 flex-1 flex-col",children:(0,c.jsx)(ct,{fill:!0,nodeClasses:x,tables:v,testIdPrefix:"sh"})}):(0,c.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"sh-changes",children:aa(y).map(u=>{let w=(b?.tables??[]).find(k=>k.name===u.table);return(0,c.jsxs)("section",{className:"mb-6",children:[(0,c.jsxs)("div",{className:"flex items-baseline gap-3 border-b border-border/60 pb-1.5",children:[(0,c.jsx)("span",{className:"font-mono text-[13px] text-foreground",children:u.table===""?r("schema"):u.table}),w!==void 0&&(0,c.jsx)("span",{className:"font-mono text-[10px] tracking-widest text-muted-foreground/70 tabular-nums uppercase",children:r("{count} columns",{count:w.columns.length})}),u.changes.length>1&&(0,c.jsx)("span",{className:"ms-auto font-mono text-[10px] tracking-widest text-muted-foreground/70 tabular-nums",children:u.changes.length})]}),(0,c.jsx)("ul",{children:u.changes.map(k=>{let{action:L,kind:C}=Nt[k.type],j=k.severity==="breaking",M=ta(k,C);return(0,c.jsxs)("li",{className:"flex items-baseline gap-4 border-s-2 py-1.5 ps-3 transition-colors hover:bg-accent/30",children:[(0,c.jsx)("span",{"aria-hidden":"true",className:le("-ms-3 h-3 w-0.5 shrink-0 self-center",j?"bg-destructive":"bg-transparent")}),(0,c.jsxs)("span",{className:"w-44 shrink-0 font-mono text-[10px] tracking-widest text-muted-foreground/70 uppercase",children:[r(L)," ",C]}),M!==u.table&&(0,c.jsx)("span",{className:le("min-w-0 font-mono text-[13px]",j?"text-destructive":"text-foreground"),children:M}),j&&(0,c.jsx)("span",{className:"ms-auto shrink-0 font-mono text-[10px] tracking-widest text-destructive uppercase",children:r("breaking")})]},`${k.type}-${k.summary}`)})})]},u.table)})})]})]})},"Pe"),ia=d(t=>le("-mb-px border-b-2 px-3 py-2.5 font-mono text-[11px] tracking-wider uppercase transition-colors outline-none","hover:bg-accent/40 focus-visible:bg-accent/40",t?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),"_e"),_a=d(t=>{let e=(0,be.c)(11),{initialShardKey:r}=t,n=ce(),[a,o]=(0,he.useState)("diagram"),i;e[0]!==a?(i=d((g,p,b,v)=>(0,c.jsxs)("button",{"aria-selected":a===g,className:ia(a===g),"data-testid":b,onClick:d(()=>{o(g)},"onClick"),role:"tab",type:"button",children:[p,v!==void 0&&(0,c.jsx)("span",{className:"ms-2 tabular-nums text-muted-foreground/70",children:v})]}),"s"),e[0]=a,e[1]=i):i=e[1];let s=i,l;e[2]!==n||e[3]!==s?(l=(0,c.jsxs)("div",{className:"flex shrink-0 items-center gap-1 border-b border-border px-3","data-testid":"mg-panes",role:"tablist",children:[s("diagram",n("Diagram"),"mg-pane-diagram"),s("changes",n("Changes"),"mg-pane-changes"),s("data",n("Data migrations"),"mg-pane-data")]}),e[2]=n,e[3]=s,e[4]=l):l=e[4];let f;e[5]!==r||e[6]!==a?(f=(0,c.jsx)("div",{className:"flex min-h-0 flex-1 flex-col",children:a==="data"?(0,c.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-4",children:(0,c.jsx)(ut,{initialShardKey:r})}):(0,c.jsx)(na,{pane:a,shardKey:r})}),e[5]=r,e[6]=a,e[7]=f):f=e[7];let h;return e[8]!==l||e[9]!==f?(h=(0,c.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col pt-4","data-testid":"lunora-migrations-route",children:[l,f]}),e[8]=l,e[9]=f,e[10]=h):h=e[10],h},"et");export{_a as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ne}from"./chunk-
|
|
1
|
+
import{a as ne}from"./chunk-ACCTEC6Y.js";import{a as A}from"./chunk-EYBS3Q7O.js";import{a as re}from"./chunk-LFWS6VBU.js";import{b as te}from"./chunk-EDL46BPM.js";import{a as Q}from"./chunk-UEONVTOV.js";import"./chunk-4KPATTV6.js";import{i as ee}from"./chunk-Z6PYAG36.js";import"./chunk-4SY2N2RS.js";import"./chunk-4AG356VE.js";import{a as w}from"./chunk-QHI77TGI.js";import"./chunk-SCTYLLJT.js";import"./chunk-OZID3UYF.js";import{b as O}from"./chunk-OOPMRFI2.js";import"./chunk-L27FKJTG.js";import{a as X}from"./chunk-LYVYUTQY.js";import{c as I,d as P,n as H}from"./chunk-YESGXFAR.js";import"./chunk-ZPQBVYNN.js";import{B as Y,g as U,h as q,j,p as W,s as G,w as V}from"./chunk-CDIV23I2.js";import"./chunk-PDBW6GTJ.js";import"./chunk-A6TVTNKO.js";import{a as he,b as ge}from"./chunk-ADABTCDI.js";import{a as o,d as M}from"./chunk-5PEAXTYQ.js";var c=M(he(),1);var n=M(ge(),1);var be=o(t=>t.kind==="id"?t.table===void 0?"id":`id<${t.table}>`:t.kind==="array"?t.element===void 0?"array":`${t.element}[]`:t.kind,"me"),xe=o(t=>t===void 0||t.length===0?"()":`(${t.map(e=>`${e.name}${e.optional?"?":""}: ${be(e)}`).join(", ")})`,"ge"),ye=o(t=>{switch(t){case"array":return[];case"bigint":return I(0n);case"boolean":return!1;case"bytes":return I(new ArrayBuffer(0));case"number":return 0;case"object":case"record":return{};default:return""}},"be"),ve=o(t=>{let e={};for(let r of t??[])r.optional||(e[r.name]=ye(r.kind));return JSON.stringify(e,void 0,2)},"xe"),Ne=q(X.runAs),h="\xABsensitive\xBB",we=o(t=>(t??[]).filter(e=>e.sensitive===!0).map(e=>e.name),"ve"),Ae=o((t,e)=>{if(e.length===0)return t;try{let r=JSON.parse(t);if(typeof r!="object"||r===null||Array.isArray(r))return"";let l={...r};for(let i of e)Object.hasOwn(l,i)&&(l[i]=h);return JSON.stringify(l,null,2)}catch{return""}},"Ne"),Se=4,ke=o(t=>{let e=t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength);try{return new TextDecoder("utf-8",{fatal:!0}).decode(e)}catch{return}},"Ae"),$e=o(t=>Array.isArray(t)?[]:Object.keys(t).filter(e=>e.length>0),"we"),Ie=o(t=>{let e=[],r=new Set,l=[t];for(;l.length>0;){let i=l.pop();if(typeof i=="string")i.length>0&&e.push(i);else if(typeof i=="number"||typeof i=="bigint")e.push(String(i));else if(i instanceof ArrayBuffer||ArrayBuffer.isView(i)){let u=ke(i);u!==void 0&&u.length>0&&e.push(u)}else typeof i=="object"&&i!==null&&!r.has(i)&&(r.add(i),e.push(...$e(i)),l.push(...Object.values(i)))}return e},"Re"),je=o((t,e)=>{let r=[],l=new Set,i=[[t,e]];for(;i.length>0;){let[u,s]=i.pop()??[void 0,void 0];typeof s=="boolean"?r.push({key:u,text:s?"true":"false"}):typeof s=="object"&&s!==null&&!l.has(s)&&(l.add(s),Array.isArray(s)?i.push(...s.map(p=>[void 0,p])):i.push(...Object.entries(s)))}return r},"ke"),ae=o(t=>t.replaceAll(/[$()*+.?[\\\]^{|}]/gu,String.raw`\$&`),"P"),Oe=o((t,e)=>e.length>=Se?t.replaceAll(e,h):t.replaceAll(new RegExp(`(?<![A-Za-z0-9])${ae(e)}(?![A-Za-z0-9])`,"gu"),h),"Oe"),Re=o((t,e)=>{let r=t.replaceAll(`"${e.text}"`,h);if(e.key===void 0)return r;let l=ae(e.key);return r.replaceAll(new RegExp(`(?<![A-Za-z0-9_])${l}=${e.text}(?![A-Za-z0-9_])`,"gu"),`${e.key}=${h}`).replaceAll(new RegExp(String.raw`"${l}":\s*${e.text}(?![A-Za-z0-9_])`,"gu"),`"${e.key}":${h}`)},"Ie"),Ce=o((t,e,r)=>{if(r.length===0||typeof e!="object"||e===null)return t;let l=r.flatMap(s=>je(s,e[s])),i=r.flatMap(s=>Ie(e[s])).flatMap(s=>{let p=JSON.stringify(s).slice(1,-1);return p===s?[s]:[s,p]}).toSorted((s,p)=>p.length-s.length),u=t;for(let s of l)u=Re(u,s);for(let s of i)u=Oe(u,s);return u},"$e"),Te=10,Fe=o(t=>t===void 0?"undefined":JSON.stringify(t,W,2),"je"),ze=o((t,e)=>[{argsText:Ae(e.argsText,e.sensitive),at:Date.now(),id:(t[0]?.id??0)+1,kind:e.selected.kind,path:e.selected.path,redacted:e.sensitive.length>0,shardKey:e.shardKey,status:e.runStatus},...t].slice(0,Te),"Ce"),Ge=o(({functions:t,runAsIdentity:e=!1}={})=>{let r=Y(),l=H(),[i,u]=(0,c.useState)(null),[s,p]=(0,c.useState)(null),S=t??i??[],[R,C]=(0,c.useState)(""),[y,k]=(0,c.useState)("{}"),[g,T]=(0,c.useState)(""),[b,se]=(0,c.useState)(""),[$,x]=(0,c.useState)("idle"),[ie,v]=(0,c.useState)(void 0),[F,N]=(0,c.useState)(null),[z,oe]=(0,c.useState)([]);(0,c.useEffect)(()=>{if(t!==void 0)return;let a=!1;return l.listFunctions().then(f=>(a||u(f),f)).catch(f=>{a||p(j(f))}),()=>{a=!0}},[l,t]);let B=R===""?S[0]?.path??"":R,d=S.find(a=>a.path===B),le=o(async()=>{if(!d)return;let a;try{a=y.trim()===""?{}:P(JSON.parse(y))}catch(m){x("error"),v(void 0),N(r("Invalid JSON args: {message}",{message:m.message}));return}let f={__lunoraRef:d.path},K=g.trim()===""?{}:{shardKey:g.trim()},Z=e?b.trim():"",D=we(d.args),E=o(m=>{oe(me=>ze(me,{argsText:y,runStatus:m,selected:d,sensitive:D,shardKey:g}))},"M");x("running"),N(null);try{let m=Z===""?await U(l,d.kind,f,a,K):await l.query(Ne,{args:a,functionPath:d.path,userId:Z},K);te(g),v(m),x("success"),E("success")}catch(m){v(void 0),N(Ce(j(m),a,D)),x("error"),E("error")}},"H"),de=o(a=>{if(C(a.path),T(a.shardKey),a.redacted){v(void 0),N(r("Re-enter the sensitive values before running this again.")),x("error");return}k(a.argsText)},"G"),ue=o(a=>{C(a.target.value)},"W"),ce=o(a=>{k(a.target.value)},"X"),fe=o(a=>{se(a.target.value)},"Y"),J=o(()=>{G(le())},"E"),L=e?b.trim():"",_=$==="running"||d===void 0,pe=o(()=>{k(ve(d?.args))},"_");return(0,n.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-runner",children:[s!==null&&(0,n.jsx)("p",{className:"text-sm text-destructive","data-testid":"function-discover-error",role:"alert",children:s}),(0,n.jsxs)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,n.jsx)(A,{htmlFor:"function-select",children:r("Function")}),(0,n.jsx)("select",{"aria-label":r("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50","data-testid":"function-select",id:"function-select",onChange:ue,value:B,children:S.map(a=>(0,n.jsxs)("option",{value:a.path,children:[a.path," (",a.kind,")"]},a.path))}),d!==void 0&&(0,n.jsxs)("p",{className:"text-xs text-muted-foreground",children:[(0,n.jsx)("span",{className:"mr-1.5 font-medium",children:r("Signature")}),(0,n.jsx)("code",{className:"font-mono","data-testid":"function-signature",children:xe(d.args)})]})]}),(0,n.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)(A,{htmlFor:"args-input",children:r("Arguments")}),(0,n.jsx)(w,{"data-testid":"prefill-button",disabled:d===void 0,onClick:pe,size:"xs",type:"button",variant:"ghost",children:r("Prefill")})]}),(0,n.jsx)(ne,{"aria-label":r("Arguments"),className:"font-mono text-xs","data-testid":"args-input",id:"args-input",onChange:ce,value:y})]}),(0,n.jsx)(re,{onChange:T,testId:"shard-input",value:g}),e&&(0,n.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"run-as-field",children:[(0,n.jsx)(A,{htmlFor:"run-as-input",children:r("Run as identity (userId)")}),(0,n.jsx)(ee,{"aria-label":r("Run as identity (userId)"),className:"font-mono text-xs","data-testid":"run-as-input",id:"run-as-input",onChange:fe,placeholder:r("Leave empty to run as admin"),value:b}),(0,n.jsx)("p",{className:"text-[11px] text-muted-foreground",children:r("Dev only: runs the function as this user so you can test auth and RLS. Forged over the admin gate.")})]}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[L!==""&&d!==void 0&&d.kind!=="query"?(0,n.jsx)(Q,{confirmLabel:r("This will execute `{functionPath}` as user `{userId}`.",{functionPath:d.path,userId:L}),disabled:_,onConfirm:J,testId:"run-button",children:r("Run")}):(0,n.jsx)(w,{"data-testid":"run-button",disabled:_,onClick:J,type:"button",children:r("Run")}),d!==void 0&&(0,n.jsx)(O,{variant:"outline",children:d.kind}),e&&b.trim()!==""&&(0,n.jsx)(O,{"data-testid":"run-as-badge",variant:"secondary",children:r("as {userId}",{userId:b.trim()})})]})]}),$==="error"&&F!==null&&(0,n.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"error",role:"alert",children:F}),$==="success"&&(0,n.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"result",children:Fe(ie)}),z.length>0&&(0,n.jsx)("ul",{className:"flex flex-col overflow-hidden rounded-xl border border-border","data-testid":"fn-history",children:z.map((a,f)=>(0,n.jsxs)("li",{className:"flex flex-wrap items-center gap-2 border-b border-border px-3 py-2 text-sm last:border-b-0","data-testid":"fn-history-row",children:[(0,n.jsx)("span",{className:a.status==="success"?"text-success":"text-destructive","data-testid":`fn-history-status-${f.toString()}`,children:a.status==="success"?"\u2713":"\u2717"})," ",(0,n.jsxs)("span",{className:"font-mono text-xs",children:[a.path," (",a.kind,")"]})," ",(0,n.jsx)("time",{className:"text-xs text-muted-foreground",children:V(a.at)})," ",(0,n.jsx)(w,{className:"ml-auto","data-testid":`fn-history-load-${f.toString()}`,onClick:o(()=>{de(a)},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Load")})]},a.id))})]})},"Ge");export{Ge as FunctionRunner};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Ie,b as Te,c as $e,d as je,e as Ee}from"./chunk-
|
|
1
|
+
import{a as Ie,b as Te,c as $e,d as je,e as Ee}from"./chunk-UNUSBFIC.js";import"./chunk-T7UKRA6J.js";import{c as Se}from"./chunk-IFU5WQHZ.js";import"./chunk-XHDCFSC6.js";import{a as Ce}from"./chunk-EYBS3Q7O.js";import"./chunk-GVPVWT3Q.js";import"./chunk-LMCBMC2V.js";import"./chunk-QF743FSL.js";import"./chunk-IQ5CIBXJ.js";import"./chunk-YNCZVYCO.js";import"./chunk-OWRWDDJT.js";import"./chunk-QHVUXMRV.js";import"./chunk-2NUCBQFU.js";import{a as ke}from"./chunk-LFWS6VBU.js";import{b as he}from"./chunk-EDL46BPM.js";import{a as Ne}from"./chunk-UEONVTOV.js";import"./chunk-4KPATTV6.js";import"./chunk-N7FOBAV3.js";import"./chunk-Z6PYAG36.js";import"./chunk-4SY2N2RS.js";import"./chunk-4AG356VE.js";import{a as se}from"./chunk-QHI77TGI.js";import"./chunk-SCTYLLJT.js";import"./chunk-OZID3UYF.js";import"./chunk-L27FKJTG.js";import{a as Q}from"./chunk-LYVYUTQY.js";import{c as xe,d as ve}from"./chunk-NP6H72XD.js";import{a as pe,e as fe}from"./chunk-NPHGFVNE.js";import{c as oe,d as be,n as ye}from"./chunk-YESGXFAR.js";import"./chunk-ZPQBVYNN.js";import{B as re,b as Y,h as te,i as B,j as U,s as le}from"./chunk-CDIV23I2.js";import"./chunk-PDBW6GTJ.js";import{a as Je}from"./chunk-A6TVTNKO.js";import{a as Pe,b as Ve}from"./chunk-ADABTCDI.js";import{a,d as me}from"./chunk-5PEAXTYQ.js";var ce=me(Je(),1);var E=me(Pe(),1);var m=me(Ve(),1);var We=a(t=>`${JSON.stringify({end:!0,rows:t})}
|
|
2
2
|
`,"Ue"),ze=a(t=>{if(t===null||typeof t!="object"||Array.isArray(t))return;let e=t;if(!(e.end!==!0||e.table!==void 0))return typeof e.rows=="number"&&Number.isSafeInteger(e.rows)&&e.rows>=0?e.rows:Number.NaN},"Ve"),He=a(()=>{let t=0,e;return{problem:a(()=>e===void 0?'the export has no end marker: it was written before exports carried an end marker, or it was cut short. If you have checked that the file is complete, append {"end":true,"rows":N} as its last line, N being its exact row count':e===t?void 0:`the export's end marker declares ${String(e)} row(s) but ${String(t)} were read`,"problem"),read:a(r=>{if(e!==void 0)throw new Error("the export continues after its end marker");let n=ze(r);return n===void 0?(t+=1,!0):(e=n,!1)},"read")}},"Xe"),_=class extends Error{static{a(this,"Z")}problem;constructor(e){super(e.kind),this.name="CsvFormatError",this.problem=e}},Ze="\uFEFF",Ge=a(()=>{let t=[],e=1,r=!1,n=!1,o="start",l="",i=a(()=>{t.push(o==="closing"||l!==""?l:void 0),o="start",l=""},"l"),c=a(s=>{i(),t.some(p=>p!==void 0)&&s.push({cells:t,number:e}),t=[],e+=1},"c"),u=a((s,p)=>{let f=r;if(r=!1,!(f&&s===`
|
|
3
3
|
`)){if(o==="quoted"){s==='"'?o="closing":l+=s;return}if(o==="closing"&&s==='"'){l+=s,o="quoted";return}if(s===","){i();return}if(s==="\r"){c(p),r=!0;return}if(s===`
|
|
4
4
|
`){c(p);return}if(o==="closing")throw new _({kind:"text-after-quote",record:e});if(o==="start"&&s==='"'){o="quoted";return}o="unquoted",l+=s}},"d");return{finish:a(()=>{if(o==="quoted")throw new _({kind:"unterminated-quote",record:e});let s=[];return c(s),s},"finish"),push:a(s=>{let p=[],f=0;for(!n&&s!==""&&(n=!0,f=s.startsWith(Ze)?1:0);f<s.length;f+=1)u(s.charAt(f),p);return p},"push")}},"He"),Oe=a(async function*(t){let e=Ge();for await(let r of t)yield*e.push(r);yield*e.finish()},"be"),ie=a((t,e,r)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0})},"ne"),Ae=a(t=>{let e=[],r=new Set;return t.forEach((n,o)=>{let l=(n??"").trim();if(l==="")throw new _({column:o+1,kind:"empty-header"});if(r.has(l))throw new _({kind:"duplicate-header",name:l});r.add(l),e.push(l)}),e},"Ne"),Ke=a(({cells:t,number:e},r,n)=>{if(t.length!==r.length)throw new _({expected:r.length,found:t.length,kind:"ragged",record:e});let o={};return r.forEach((l,i)=>{let c=t[i];c!==void 0?ie(o,l,c):n.has(l)&&ie(o,l,null)}),{doc:o,record:e}},"Ce"),Qe=/^-?\d+$/u,Xe=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/iu,Ye=/^-?\d{11,}$/u,et=/^(\d{4})-(\d{2})-(\d{2})$/u,tt=/^(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(Z|[+-]\d{2}:\d{2})?$/u,rt=/\.(\d+)/u,nt=/[1-9]/u,ot=/^[+-]?(\d*)(?:\.(\d*))?(?:e([+-]?\d+))?$/iu,Le=a(t=>{let[,e="",r="",n="0"]=ot.exec(t)??[],o=`${e}${r}`,l=0,i=o.length;for(;l<i&&o.charAt(l)==="0";)l+=1;for(;i>l&&o.charAt(i-1)==="0";)i-=1;return l===i?{digits:"",exponent:0}:{digits:o.slice(l,i),exponent:Number(n)-r.length+(o.length-i)}},"he"),lt=a((t,e)=>{let r=Le(t),n=Le(e.toExponential());return r.digits===n.digits&&r.exponent===n.exponent?!0:r.digits!==""&&r.exponent>=0&&Number.isInteger(e)&&BigInt(r.digits)*10n**BigInt(r.exponent)===BigInt(Math.abs(e))},"rt"),st=a(t=>{let e=t.trim();if(!Xe.test(e))return;let r=Number(e);if(Number.isFinite(r))return lt(e,r)?{number:r}:{inexact:!0}},"nt"),at=a((t,e,r)=>{let n=new Date(0);return n.setUTCFullYear(t,e-1,r),n.getUTCMonth()===e-1&&n.getUTCDate()===r},"ot"),it=a((t,e,r,n)=>Number(t)<=23&&Number(e)<=59&&Number(r)<=59&&(n==="Z"||Number(n.slice(1,3))<=23&&Number(n.slice(4,6))<=59),"st"),dt=a(t=>{let[e="",r,...n]=t.split("T"),o=et.exec(e),l=r===void 0?void 0:tt.exec(r);if(o===null||n.length>0||r!==void 0&&l===null)return;let[,i="",c="",u=""]=o;if(!at(Number(i),Number(c),Number(u)))return;let[,s="0",p="0",f="0",w]=l??[];if(!it(s,p,f,w??"Z"))return;let g=rt.exec(r??"")?.[1]??"";if(nt.test(g.slice(3)))return;let x=Date.parse(l!==void 0&&w===void 0?`${t}Z`:t);return Number.isFinite(x)?x:void 0},"it"),ct=a(t=>{let e=st(t);return e===void 0?{expected:"number",kind:"rejected"}:"number"in e?{kind:"ok",value:e.number}:{expected:"number",inexact:!0,kind:"rejected"}},"lt"),ut=a(t=>{let e=t.trim(),r=dt(e);return r===void 0&&Ye.test(e)&&(r=Number(e)),r===void 0||!Number.isFinite(new Date(r).getTime())?{expected:"date",kind:"rejected"}:{kind:"ok",value:r}},"at"),mt=a(t=>{try{return oe(t),!0}catch{return!1}},"ct"),pt=a((t,e)=>{if(e==="bigint"){let r=t.trim();if(!Qe.test(r))return{expected:"bigint",kind:"rejected"};let n=BigInt(r);return mt(n)?{kind:"ok",value:n}:{expected:"bigint",kind:"rejected",tooLong:!0}}if(e==="boolean"){let r=t.trim().toLowerCase();return r==="true"||r==="false"?{kind:"ok",value:r==="true"}:{expected:"boolean",kind:"rejected"}}return e==="number"?ct(t):e==="date"||e==="timestamp"?ut(t):{kind:"ok",value:t}},"dt"),De=a(({doc:t,record:e},r)=>{let n={};for(let[o,l]of Object.entries(t)){if(l===null){ie(n,o,null);continue}let i=pt(l,r.get(o));if(i.kind==="rejected")throw new _({column:o,expected:i.expected,...i.inexact===!0&&{inexact:!0},kind:"cell-type",record:e,...i.tooLong===!0&&{tooLong:!0},value:l});ie(n,o,i.value)}return{doc:n,record:e}},"ke"),ft=a(async function*(t,e,r){let n;for await(let o of Oe(t))n===void 0?n=Ae(o.cells):yield De(Ke(o,n,r),e)},"ut"),ht=a(t=>new Set(t.filter(e=>e.nullable===!0&&!e.optional).map(e=>e.name)),"ft"),qe=a(t=>{if(t instanceof _)return t;throw t},"we"),wt=a(async(t,e,r,n)=>{let o,l,i;for await(let u of Oe(t)){if(o===void 0){try{o=Ae(u.cells)}catch(p){l=qe(p),o=[]}continue}let s;try{s=De(Ke(u,o,r),e)}catch(p){i??=qe(p);continue}n(s)}let c=l??i;if(c!==void 0)throw c},"mt"),Be=te(Q.exportShard),ne=te(Q.importShard),gt=te(Q.listTables),bt=te(Q.describeTable),yt={},xt=a(t=>t.map(e=>JSON.stringify(oe(e))).join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as He}from"./chunk-ODEIAS3V.js";import{a as Se}from"./chunk-MNN3YCKF.js";import{a as Ze}from"./chunk-ZLAVM2NT.js";import{a as qe}from"./chunk-W5BTAOHO.js";import{i as ze}from"./chunk-2D4WBSDO.js";import"./chunk-4SY2N2RS.js";import"./chunk-4AG356VE.js";import{a as $e}from"./chunk-CBTPJPCZ.js";import"./chunk-SCTYLLJT.js";import"./chunk-OZID3UYF.js";import{b as Ge}from"./chunk-BHUWAGFN.js";import"./chunk-L27FKJTG.js";import{a as Fe}from"./chunk-LYVYUTQY.js";import{n as Ke}from"./chunk-C6FOSG2A.js";import"./chunk-ZPQBVYNN.js";import{B as Oe,h as Pe,i as me,j as Ce,k as Ue,s as Re}from"./chunk-2ZJJH4YN.js";import"./chunk-PDBW6GTJ.js";import{a as at}from"./chunk-A6TVTNKO.js";import{a as ot,b as lt}from"./chunk-ADABTCDI.js";import{a as s,d as Me}from"./chunk-5PEAXTYQ.js";var Ee=Me(at(),1),m=Me(ot(),1);var r=Me(lt(),1);var De=Pe(Fe.getPitrBookmark),st=Pe(Fe.pitrRestore),nt=/^\d+$/u,Je=s(ie=>{let e=ie.trim(),h=nt.test(e)?Number(e):Date.parse(e),l=new Date(h);return Number.isNaN(l.getTime())?void 0:{epochMs:h,iso:l.toISOString()}},"$e"),it=s(ie=>{let e=(0,Ee.c)(9),{text:h}=ie,l=Oe();if(h.trim()==="")return null;let t,o,p;if(e[0]!==l||e[1]!==h){let y=Je(h);t="font-mono text-xs text-muted-foreground",o="pitr-time-resolved",p=y===void 0?l("Not a time \u2014 use epoch-ms or ISO 8601."):l("Resolves to {instant} (a date-time without an offset is read in this browser's time zone; a bare date is UTC)",{instant:y.iso}),e[0]=l,e[1]=h,e[2]=t,e[3]=o,e[4]=p}else t=e[2],o=e[3],p=e[4];let N;return e[5]!==t||e[6]!==o||e[7]!==p?(N=(0,r.jsx)("p",{className:t,"data-testid":o,children:p}),e[5]=t,e[6]=o,e[7]=p,e[8]=N):N=e[8],N},"lt"),gt=s(ie=>{let e=(0,Ee.c)(140),{initialShardKey:h}=ie,l=Ke(),t=Oe(),o=h??"",p=He(o),[N,y]=(0,m.useState)(null),[f,Qe]=(0,m.useState)(""),[ce,je]=(0,m.useState)(null),[c,We]=(0,m.useState)(""),[b,Xe]=(0,m.useState)(!1),[i,Ye]=(0,m.useState)(null),[ue,w]=(0,m.useState)(null),[de,I]=(0,m.useState)(!1),[C,Ve]=(0,m.useState)(!1),pe;e[0]!==l||e[1]!==o?(pe=s(async a=>{I(!0),w(null);let d;try{d={current:(await l.query(De,{},me(o))).current,error:null,unavailable:!1}}catch(n){let v=n;d={current:null,error:Ce(v),unavailable:Ue(v)==="PITR_UNAVAILABLE"}}a?.aborted!==!0&&(d.error===null?y(d.current):w(d.error),Ve(d.unavailable),I(!1))},"fe"),e[0]=l,e[1]=o,e[2]=pe):pe=e[2];let x=pe,he,fe;e[3]!==x?(he=s(()=>{let a=new AbortController;return Re(x(a.signal)),()=>{a.abort()}},"ue"),fe=[x],e[3]=x,e[4]=he,e[5]=fe):(he=e[4],fe=e[5]),(0,m.useEffect)(he,fe);let be;e[6]!==l||e[7]!==o?(be=s(async()=>{let a=await l.query(De,{},me(o));y(a.current)},"he"),e[6]=l,e[7]=o,e[8]=be):be=e[8],Ze(be,!C);let xe;e[9]===Symbol.for("react.memo_cache_sentinel")?(xe=s(a=>{Qe(a.target.value)},"be"),e[9]=xe):xe=e[9];let et=xe,ke;e[10]===Symbol.for("react.memo_cache_sentinel")?(ke=s(a=>{We(a.target.value)},"xe"),e[10]=ke):ke=e[10];let tt=ke,Ne;e[11]===Symbol.for("react.memo_cache_sentinel")?(Ne=s(a=>{Xe(a.target.checked)},"ke"),e[11]=Ne):Ne=e[11];let rt=Ne,ge,R,u,k,g,ve;if(e[12]!==c||e[13]!==l||e[14]!==ce||e[15]!==x||e[16]!==o||e[17]!==p||e[18]!==t||e[19]!==f){u=Je(f),R=s(()=>{if(u===void 0)return;let d=o;Re((async()=>{I(!0),w(null);let n;try{n={result:await l.query(De,{time:u.epochMs},me(d))}}catch(v){n={error:Ce(v)}}p.current===d&&("result"in n?(je(n.result.forTime===void 0?null:{bookmark:n.result.forTime,shard:d}),y(n.result.current)):(je(null),w(n.error)),I(!1))})())},"C"),g=ce?.shard===o?ce.bookmark:null;let a;e[26]!==l||e[27]!==x||e[28]!==o?(a=s(d=>{Re((async()=>{I(!0),w(null);try{let n=await l.mutation(st,d,me(o));Ye(n),await x()}catch(n){let v=n;w(Ce(v)),Ue(v)==="PITR_UNAVAILABLE"&&Ve(!0)}I(!1)})())},"o"),e[26]=l,e[27]=x,e[28]=o,e[29]=a):a=e[29],k=a,ge=c.trim()!==""||u!==void 0,ve=t("Restore {shard} to {target}?",{shard:o===""?t("root"):o,target:c.trim()===""?u?.iso??"":t("the given bookmark")}),e[12]=c,e[13]=l,e[14]=ce,e[15]=x,e[16]=o,e[17]=p,e[18]=t,e[19]=f,e[20]=ge,e[21]=R,e[22]=u,e[23]=k,e[24]=g,e[25]=ve}else ge=e[20],R=e[21],u=e[22],k=e[23],g=e[24],ve=e[25];let Te=ve,ye;e[30]!==c||e[31]!==u?.epochMs||e[32]!==b||e[33]!==k?(ye=s(()=>{let a=b?{restart:!0}:{};c.trim()===""?a.time=u?.epochMs:a.bookmark=c.trim(),k(a)},"Ne"),e[30]=c,e[31]=u?.epochMs,e[32]=b,e[33]=k,e[34]=ye):ye=e[34];let Be=ye,we;e[35]!==b||e[36]!==i||e[37]!==k?(we=s(()=>{i!==null&&k(b?{bookmark:i.undoBookmark,restart:!0}:{bookmark:i.undoBookmark})},"ye"),e[35]=b,e[36]=i,e[37]=k,e[38]=we):we=e[38];let Ae=we,S;e[39]!==t?(S=t("Shard"),e[39]=t,e[40]=S):S=e[40];let T;e[41]!==o||e[42]!==t?(T=o===""?t("root"):o,e[41]=o,e[42]=t,e[43]=T):T=e[43];let B;e[44]!==T?(B=(0,r.jsx)("span",{className:"font-mono",children:T}),e[44]=T,e[45]=B):B=e[45];let A;e[46]!==S||e[47]!==B?(A=(0,r.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:[S,": ",B]})}),e[46]=S,e[47]=B,e[48]=A):A=e[48];let _;e[49]!==t?(_=t("In-place recovery to any moment in the last 30 days. For older or portable recovery, use the snapshot backup tier."),e[49]=t,e[50]=_):_=e[50];let L;e[51]!==_?(L=(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"pitr-note",children:_}),e[51]=_,e[52]=L):L=e[52];let M;e[53]!==ue?(M=ue!==null&&(0,r.jsx)("p",{className:"text-sm text-destructive","data-testid":"pitr-error",role:"alert",children:ue}),e[53]=ue,e[54]=M):M=e[54];let P;e[55]!==t?(P=t("Current bookmark"),e[55]=t,e[56]=P):P=e[56];let U;e[57]!==P?(U=(0,r.jsx)("h3",{className:"mb-2 text-sm font-semibold",children:P}),e[57]=P,e[58]=U):U=e[58];let F;e[59]!==N?(F=N??(0,r.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),e[59]=N,e[60]=F):F=e[60];let O;e[61]!==F?(O=(0,r.jsx)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-current",children:F}),e[61]=F,e[62]=O):O=e[62];let q;e[63]!==U||e[64]!==O?(q=(0,r.jsxs)("section",{className:"rounded-xl border border-border bg-card p-3 shadow-xs",children:[U,O]}),e[63]=U,e[64]=O,e[65]=q):q=e[65];let z;e[66]!==t?(z=t("Restore"),e[66]=t,e[67]=z):z=e[67];let D;e[68]!==z?(D=(0,r.jsx)("h3",{className:"text-sm font-semibold",children:z}),e[68]=z,e[69]=D):D=e[69];let E;e[70]!==t?(E=t("Time (ISO or epoch-ms, last 30 days)"),e[70]=t,e[71]=E):E=e[71];let j;e[72]!==E?(j=(0,r.jsx)(Se,{htmlFor:"pitr-time",children:E}),e[72]=E,e[73]=j):j=e[73];let V;e[74]!==f?(V=(0,r.jsx)(ze,{"data-testid":"pitr-time",id:"pitr-time",onChange:et,placeholder:"2026-06-01T00:00:00.000Z",value:f}),e[74]=f,e[75]=V):V=e[75];let _e=de||C||u===void 0,K;e[76]!==t?(K=t("Preview"),e[76]=t,e[77]=K):K=e[77];let Z;e[78]!==R||e[79]!==_e||e[80]!==K?(Z=(0,r.jsx)($e,{"data-testid":"pitr-preview",disabled:_e,onClick:R,size:"sm",type:"button",variant:"outline",children:K}),e[78]=R,e[79]=_e,e[80]=K,e[81]=Z):Z=e[81];let $;e[82]!==V||e[83]!==Z?($=(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[V,Z]}),e[82]=V,e[83]=Z,e[84]=$):$=e[84];let G;e[85]!==f?(G=(0,r.jsx)(it,{text:f}),e[85]=f,e[86]=G):G=e[86];let H;e[87]!==g||e[88]!==t?(H=g!==null&&(0,r.jsxs)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-preview-bookmark",children:[t("Bookmark for that time"),": ",g]}),e[87]=g,e[88]=t,e[89]=H):H=e[89];let J;e[90]!==j||e[91]!==$||e[92]!==G||e[93]!==H?(J=(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[j,$,G,H]}),e[90]=j,e[91]=$,e[92]=G,e[93]=H,e[94]=J):J=e[94];let Q;e[95]!==t?(Q=t("Or an explicit bookmark (wins over time)"),e[95]=t,e[96]=Q):Q=e[96];let W;e[97]!==Q?(W=(0,r.jsx)(Se,{htmlFor:"pitr-bookmark",children:Q}),e[97]=Q,e[98]=W):W=e[98];let X;e[99]!==t?(X=t("bookmark string"),e[99]=t,e[100]=X):X=e[100];let Y;e[101]!==c||e[102]!==X?(Y=(0,r.jsx)(ze,{"data-testid":"pitr-bookmark",id:"pitr-bookmark",onChange:tt,placeholder:X,value:c}),e[101]=c,e[102]=X,e[103]=Y):Y=e[103];let ee;e[104]!==W||e[105]!==Y?(ee=(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[W,Y]}),e[104]=W,e[105]=Y,e[106]=ee):ee=e[106];let te;e[107]!==b?(te=(0,r.jsx)("input",{checked:b,className:"size-4 accent-primary","data-testid":"pitr-restart",id:"pitr-restart",onChange:rt,type:"checkbox"}),e[107]=b,e[108]=te):te=e[108];let re;e[109]!==t?(re=t("Restart the shard now so recovery applies immediately"),e[109]=t,e[110]=re):re=e[110];let oe;e[111]!==te||e[112]!==re?(oe=(0,r.jsxs)(Se,{className:"flex items-center gap-2 text-xs font-normal text-muted-foreground",htmlFor:"pitr-restart",children:[te,re]}),e[111]=te,e[112]=re,e[113]=oe):oe=e[113];let Le=de||C||!ge,ae;e[114]!==t?(ae=t("Restore"),e[114]=t,e[115]=ae):ae=e[115];let le;e[116]!==Te||e[117]!==Be||e[118]!==Le||e[119]!==ae?(le=(0,r.jsx)("div",{children:(0,r.jsx)(qe,{confirmLabel:Te,disabled:Le,onConfirm:Be,testId:"pitr-restore",children:ae})}),e[116]=Te,e[117]=Be,e[118]=Le,e[119]=ae,e[120]=le):le=e[120];let se;e[121]!==D||e[122]!==J||e[123]!==ee||e[124]!==oe||e[125]!==le?(se=(0,r.jsxs)("section",{className:"flex flex-col gap-3 rounded-xl border border-border bg-card p-3 shadow-xs",children:[D,J,ee,oe,le]}),e[121]=D,e[122]=J,e[123]=ee,e[124]=oe,e[125]=le,e[126]=se):se=e[126];let ne;e[127]!==de||e[128]!==Ae||e[129]!==i||e[130]!==t||e[131]!==C?(ne=i!==null&&(0,r.jsxs)("section",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs","data-testid":"pitr-result",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold",children:t("Restore armed")}),(0,r.jsx)(Ge,{variant:i.restarted?"destructive":"secondary",children:i.restarted?t("restarted now"):t("on next restart")})]}),(0,r.jsxs)("p",{className:"font-mono text-xs break-all text-muted-foreground",children:[t("Restored to"),": ",i.restoredTo]}),(0,r.jsxs)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-undo-bookmark",children:[t("Undo bookmark"),": ",i.undoBookmark]}),(0,r.jsx)("div",{children:(0,r.jsx)(qe,{confirmLabel:t("Confirm undo"),disabled:de||C,onConfirm:Ae,testId:"pitr-undo",children:t("Undo restore")})})]}),e[127]=de,e[128]=Ae,e[129]=i,e[130]=t,e[131]=C,e[132]=ne):ne=e[132];let Ie;return e[133]!==A||e[134]!==L||e[135]!==M||e[136]!==q||e[137]!==se||e[138]!==ne?(Ie=(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-pitr",children:[A,L,M,q,se,ne]}),e[133]=A,e[134]=L,e[135]=M,e[136]=q,e[137]=se,e[138]=ne,e[139]=Ie):Ie=e[139],Ie},"Nt");export{gt as PitrPanel};
|
|
1
|
+
import{a as He}from"./chunk-ODEIAS3V.js";import{a as Se}from"./chunk-EYBS3Q7O.js";import{a as Ze}from"./chunk-RTD3B67U.js";import{a as qe}from"./chunk-UEONVTOV.js";import{i as ze}from"./chunk-Z6PYAG36.js";import"./chunk-4SY2N2RS.js";import"./chunk-4AG356VE.js";import{a as $e}from"./chunk-QHI77TGI.js";import"./chunk-SCTYLLJT.js";import"./chunk-OZID3UYF.js";import{b as Ge}from"./chunk-OOPMRFI2.js";import"./chunk-L27FKJTG.js";import{a as Fe}from"./chunk-LYVYUTQY.js";import{n as Ke}from"./chunk-YESGXFAR.js";import"./chunk-ZPQBVYNN.js";import{B as Oe,h as Pe,i as me,j as Ce,k as Ue,s as Re}from"./chunk-CDIV23I2.js";import"./chunk-PDBW6GTJ.js";import{a as at}from"./chunk-A6TVTNKO.js";import{a as ot,b as lt}from"./chunk-ADABTCDI.js";import{a as s,d as Me}from"./chunk-5PEAXTYQ.js";var Ee=Me(at(),1),m=Me(ot(),1);var r=Me(lt(),1);var De=Pe(Fe.getPitrBookmark),st=Pe(Fe.pitrRestore),nt=/^\d+$/u,Je=s(ie=>{let e=ie.trim(),h=nt.test(e)?Number(e):Date.parse(e),l=new Date(h);return Number.isNaN(l.getTime())?void 0:{epochMs:h,iso:l.toISOString()}},"$e"),it=s(ie=>{let e=(0,Ee.c)(9),{text:h}=ie,l=Oe();if(h.trim()==="")return null;let t,o,p;if(e[0]!==l||e[1]!==h){let y=Je(h);t="font-mono text-xs text-muted-foreground",o="pitr-time-resolved",p=y===void 0?l("Not a time \u2014 use epoch-ms or ISO 8601."):l("Resolves to {instant} (a date-time without an offset is read in this browser's time zone; a bare date is UTC)",{instant:y.iso}),e[0]=l,e[1]=h,e[2]=t,e[3]=o,e[4]=p}else t=e[2],o=e[3],p=e[4];let N;return e[5]!==t||e[6]!==o||e[7]!==p?(N=(0,r.jsx)("p",{className:t,"data-testid":o,children:p}),e[5]=t,e[6]=o,e[7]=p,e[8]=N):N=e[8],N},"lt"),gt=s(ie=>{let e=(0,Ee.c)(140),{initialShardKey:h}=ie,l=Ke(),t=Oe(),o=h??"",p=He(o),[N,y]=(0,m.useState)(null),[f,Qe]=(0,m.useState)(""),[ce,je]=(0,m.useState)(null),[c,We]=(0,m.useState)(""),[b,Xe]=(0,m.useState)(!1),[i,Ye]=(0,m.useState)(null),[ue,w]=(0,m.useState)(null),[de,I]=(0,m.useState)(!1),[C,Ve]=(0,m.useState)(!1),pe;e[0]!==l||e[1]!==o?(pe=s(async a=>{I(!0),w(null);let d;try{d={current:(await l.query(De,{},me(o))).current,error:null,unavailable:!1}}catch(n){let v=n;d={current:null,error:Ce(v),unavailable:Ue(v)==="PITR_UNAVAILABLE"}}a?.aborted!==!0&&(d.error===null?y(d.current):w(d.error),Ve(d.unavailable),I(!1))},"fe"),e[0]=l,e[1]=o,e[2]=pe):pe=e[2];let x=pe,he,fe;e[3]!==x?(he=s(()=>{let a=new AbortController;return Re(x(a.signal)),()=>{a.abort()}},"ue"),fe=[x],e[3]=x,e[4]=he,e[5]=fe):(he=e[4],fe=e[5]),(0,m.useEffect)(he,fe);let be;e[6]!==l||e[7]!==o?(be=s(async()=>{let a=await l.query(De,{},me(o));y(a.current)},"he"),e[6]=l,e[7]=o,e[8]=be):be=e[8],Ze(be,!C);let xe;e[9]===Symbol.for("react.memo_cache_sentinel")?(xe=s(a=>{Qe(a.target.value)},"be"),e[9]=xe):xe=e[9];let et=xe,ke;e[10]===Symbol.for("react.memo_cache_sentinel")?(ke=s(a=>{We(a.target.value)},"xe"),e[10]=ke):ke=e[10];let tt=ke,Ne;e[11]===Symbol.for("react.memo_cache_sentinel")?(Ne=s(a=>{Xe(a.target.checked)},"ke"),e[11]=Ne):Ne=e[11];let rt=Ne,ge,R,u,k,g,ve;if(e[12]!==c||e[13]!==l||e[14]!==ce||e[15]!==x||e[16]!==o||e[17]!==p||e[18]!==t||e[19]!==f){u=Je(f),R=s(()=>{if(u===void 0)return;let d=o;Re((async()=>{I(!0),w(null);let n;try{n={result:await l.query(De,{time:u.epochMs},me(d))}}catch(v){n={error:Ce(v)}}p.current===d&&("result"in n?(je(n.result.forTime===void 0?null:{bookmark:n.result.forTime,shard:d}),y(n.result.current)):(je(null),w(n.error)),I(!1))})())},"C"),g=ce?.shard===o?ce.bookmark:null;let a;e[26]!==l||e[27]!==x||e[28]!==o?(a=s(d=>{Re((async()=>{I(!0),w(null);try{let n=await l.mutation(st,d,me(o));Ye(n),await x()}catch(n){let v=n;w(Ce(v)),Ue(v)==="PITR_UNAVAILABLE"&&Ve(!0)}I(!1)})())},"o"),e[26]=l,e[27]=x,e[28]=o,e[29]=a):a=e[29],k=a,ge=c.trim()!==""||u!==void 0,ve=t("Restore {shard} to {target}?",{shard:o===""?t("root"):o,target:c.trim()===""?u?.iso??"":t("the given bookmark")}),e[12]=c,e[13]=l,e[14]=ce,e[15]=x,e[16]=o,e[17]=p,e[18]=t,e[19]=f,e[20]=ge,e[21]=R,e[22]=u,e[23]=k,e[24]=g,e[25]=ve}else ge=e[20],R=e[21],u=e[22],k=e[23],g=e[24],ve=e[25];let Te=ve,ye;e[30]!==c||e[31]!==u?.epochMs||e[32]!==b||e[33]!==k?(ye=s(()=>{let a=b?{restart:!0}:{};c.trim()===""?a.time=u?.epochMs:a.bookmark=c.trim(),k(a)},"Ne"),e[30]=c,e[31]=u?.epochMs,e[32]=b,e[33]=k,e[34]=ye):ye=e[34];let Be=ye,we;e[35]!==b||e[36]!==i||e[37]!==k?(we=s(()=>{i!==null&&k(b?{bookmark:i.undoBookmark,restart:!0}:{bookmark:i.undoBookmark})},"ye"),e[35]=b,e[36]=i,e[37]=k,e[38]=we):we=e[38];let Ae=we,S;e[39]!==t?(S=t("Shard"),e[39]=t,e[40]=S):S=e[40];let T;e[41]!==o||e[42]!==t?(T=o===""?t("root"):o,e[41]=o,e[42]=t,e[43]=T):T=e[43];let B;e[44]!==T?(B=(0,r.jsx)("span",{className:"font-mono",children:T}),e[44]=T,e[45]=B):B=e[45];let A;e[46]!==S||e[47]!==B?(A=(0,r.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:[S,": ",B]})}),e[46]=S,e[47]=B,e[48]=A):A=e[48];let _;e[49]!==t?(_=t("In-place recovery to any moment in the last 30 days. For older or portable recovery, use the snapshot backup tier."),e[49]=t,e[50]=_):_=e[50];let L;e[51]!==_?(L=(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"pitr-note",children:_}),e[51]=_,e[52]=L):L=e[52];let M;e[53]!==ue?(M=ue!==null&&(0,r.jsx)("p",{className:"text-sm text-destructive","data-testid":"pitr-error",role:"alert",children:ue}),e[53]=ue,e[54]=M):M=e[54];let P;e[55]!==t?(P=t("Current bookmark"),e[55]=t,e[56]=P):P=e[56];let U;e[57]!==P?(U=(0,r.jsx)("h3",{className:"mb-2 text-sm font-semibold",children:P}),e[57]=P,e[58]=U):U=e[58];let F;e[59]!==N?(F=N??(0,r.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),e[59]=N,e[60]=F):F=e[60];let O;e[61]!==F?(O=(0,r.jsx)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-current",children:F}),e[61]=F,e[62]=O):O=e[62];let q;e[63]!==U||e[64]!==O?(q=(0,r.jsxs)("section",{className:"rounded-xl border border-border bg-card p-3 shadow-xs",children:[U,O]}),e[63]=U,e[64]=O,e[65]=q):q=e[65];let z;e[66]!==t?(z=t("Restore"),e[66]=t,e[67]=z):z=e[67];let D;e[68]!==z?(D=(0,r.jsx)("h3",{className:"text-sm font-semibold",children:z}),e[68]=z,e[69]=D):D=e[69];let E;e[70]!==t?(E=t("Time (ISO or epoch-ms, last 30 days)"),e[70]=t,e[71]=E):E=e[71];let j;e[72]!==E?(j=(0,r.jsx)(Se,{htmlFor:"pitr-time",children:E}),e[72]=E,e[73]=j):j=e[73];let V;e[74]!==f?(V=(0,r.jsx)(ze,{"data-testid":"pitr-time",id:"pitr-time",onChange:et,placeholder:"2026-06-01T00:00:00.000Z",value:f}),e[74]=f,e[75]=V):V=e[75];let _e=de||C||u===void 0,K;e[76]!==t?(K=t("Preview"),e[76]=t,e[77]=K):K=e[77];let Z;e[78]!==R||e[79]!==_e||e[80]!==K?(Z=(0,r.jsx)($e,{"data-testid":"pitr-preview",disabled:_e,onClick:R,size:"sm",type:"button",variant:"outline",children:K}),e[78]=R,e[79]=_e,e[80]=K,e[81]=Z):Z=e[81];let $;e[82]!==V||e[83]!==Z?($=(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[V,Z]}),e[82]=V,e[83]=Z,e[84]=$):$=e[84];let G;e[85]!==f?(G=(0,r.jsx)(it,{text:f}),e[85]=f,e[86]=G):G=e[86];let H;e[87]!==g||e[88]!==t?(H=g!==null&&(0,r.jsxs)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-preview-bookmark",children:[t("Bookmark for that time"),": ",g]}),e[87]=g,e[88]=t,e[89]=H):H=e[89];let J;e[90]!==j||e[91]!==$||e[92]!==G||e[93]!==H?(J=(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[j,$,G,H]}),e[90]=j,e[91]=$,e[92]=G,e[93]=H,e[94]=J):J=e[94];let Q;e[95]!==t?(Q=t("Or an explicit bookmark (wins over time)"),e[95]=t,e[96]=Q):Q=e[96];let W;e[97]!==Q?(W=(0,r.jsx)(Se,{htmlFor:"pitr-bookmark",children:Q}),e[97]=Q,e[98]=W):W=e[98];let X;e[99]!==t?(X=t("bookmark string"),e[99]=t,e[100]=X):X=e[100];let Y;e[101]!==c||e[102]!==X?(Y=(0,r.jsx)(ze,{"data-testid":"pitr-bookmark",id:"pitr-bookmark",onChange:tt,placeholder:X,value:c}),e[101]=c,e[102]=X,e[103]=Y):Y=e[103];let ee;e[104]!==W||e[105]!==Y?(ee=(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[W,Y]}),e[104]=W,e[105]=Y,e[106]=ee):ee=e[106];let te;e[107]!==b?(te=(0,r.jsx)("input",{checked:b,className:"size-4 accent-primary","data-testid":"pitr-restart",id:"pitr-restart",onChange:rt,type:"checkbox"}),e[107]=b,e[108]=te):te=e[108];let re;e[109]!==t?(re=t("Restart the shard now so recovery applies immediately"),e[109]=t,e[110]=re):re=e[110];let oe;e[111]!==te||e[112]!==re?(oe=(0,r.jsxs)(Se,{className:"flex items-center gap-2 text-xs font-normal text-muted-foreground",htmlFor:"pitr-restart",children:[te,re]}),e[111]=te,e[112]=re,e[113]=oe):oe=e[113];let Le=de||C||!ge,ae;e[114]!==t?(ae=t("Restore"),e[114]=t,e[115]=ae):ae=e[115];let le;e[116]!==Te||e[117]!==Be||e[118]!==Le||e[119]!==ae?(le=(0,r.jsx)("div",{children:(0,r.jsx)(qe,{confirmLabel:Te,disabled:Le,onConfirm:Be,testId:"pitr-restore",children:ae})}),e[116]=Te,e[117]=Be,e[118]=Le,e[119]=ae,e[120]=le):le=e[120];let se;e[121]!==D||e[122]!==J||e[123]!==ee||e[124]!==oe||e[125]!==le?(se=(0,r.jsxs)("section",{className:"flex flex-col gap-3 rounded-xl border border-border bg-card p-3 shadow-xs",children:[D,J,ee,oe,le]}),e[121]=D,e[122]=J,e[123]=ee,e[124]=oe,e[125]=le,e[126]=se):se=e[126];let ne;e[127]!==de||e[128]!==Ae||e[129]!==i||e[130]!==t||e[131]!==C?(ne=i!==null&&(0,r.jsxs)("section",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs","data-testid":"pitr-result",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold",children:t("Restore armed")}),(0,r.jsx)(Ge,{variant:i.restarted?"destructive":"secondary",children:i.restarted?t("restarted now"):t("on next restart")})]}),(0,r.jsxs)("p",{className:"font-mono text-xs break-all text-muted-foreground",children:[t("Restored to"),": ",i.restoredTo]}),(0,r.jsxs)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-undo-bookmark",children:[t("Undo bookmark"),": ",i.undoBookmark]}),(0,r.jsx)("div",{children:(0,r.jsx)(qe,{confirmLabel:t("Confirm undo"),disabled:de||C,onConfirm:Ae,testId:"pitr-undo",children:t("Undo restore")})})]}),e[127]=de,e[128]=Ae,e[129]=i,e[130]=t,e[131]=C,e[132]=ne):ne=e[132];let Ie;return e[133]!==A||e[134]!==L||e[135]!==M||e[136]!==q||e[137]!==se||e[138]!==ne?(Ie=(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-pitr",children:[A,L,M,q,se,ne]}),e[133]=A,e[134]=L,e[135]=M,e[136]=q,e[137]=se,e[138]=ne,e[139]=Ie):Ie=e[139],Ie},"Nt");export{gt as PitrPanel};
|