@lunora/studio 1.0.0-alpha.369 → 1.0.0-alpha.370

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.
Files changed (100) hide show
  1. package/dist/packem_chunks/migrations-route.mjs +1 -1
  2. package/dist/standalone/{chunk-IXS7MHHM.js → chunk-2JD7ZSZV.js} +1 -1
  3. package/dist/standalone/{chunk-WYXSCWNG.js → chunk-2TBMJ7XV.js} +1 -1
  4. package/dist/standalone/{chunk-KPTRMV5Y.js → chunk-36RORAX3.js} +1 -1
  5. package/dist/standalone/{chunk-NQK3Y5UV.js → chunk-3IMLG2OT.js} +1 -1
  6. package/dist/standalone/{chunk-BCJWWHAX.js → chunk-5BXW4BR6.js} +1 -1
  7. package/dist/standalone/{chunk-WSKN5NCB.js → chunk-5KZIXB6E.js} +1 -1
  8. package/dist/standalone/{chunk-AW532XQ3.js → chunk-5QUEED5Z.js} +1 -1
  9. package/dist/standalone/{chunk-PACPUEWB.js → chunk-5SKGLIO5.js} +1 -1
  10. package/dist/standalone/{chunk-RL5SUZ6J.js → chunk-5X6BEWUI.js} +1 -1
  11. package/dist/standalone/{chunk-UWVPGEJM.js → chunk-5XN5GQP5.js} +1 -1
  12. package/dist/standalone/{chunk-HUIW5YJW.js → chunk-62XXKQH3.js} +1 -1
  13. package/dist/standalone/{chunk-3526X23C.js → chunk-6FLYVL6K.js} +1 -1
  14. package/dist/standalone/{chunk-UDDIUQ2F.js → chunk-6FNFOTRR.js} +1 -1
  15. package/dist/standalone/{chunk-LPNUYR43.js → chunk-6LLUZFDD.js} +1 -1
  16. package/dist/standalone/{chunk-YTZ7LWZ4.js → chunk-6VLPJOPR.js} +1 -1
  17. package/dist/standalone/{chunk-XC3XUPB7.js → chunk-6XL3EV2X.js} +1 -1
  18. package/dist/standalone/{chunk-UA3LPAFC.js → chunk-7N2OPADC.js} +1 -1
  19. package/dist/standalone/{chunk-HUFK6COH.js → chunk-7TTX42IR.js} +1 -1
  20. package/dist/standalone/{chunk-HCN5COJB.js → chunk-7YZKGLGA.js} +1 -1
  21. package/dist/standalone/{chunk-FZTPC7NT.js → chunk-AA3R3QNN.js} +1 -1
  22. package/dist/standalone/{chunk-2XVH2EXL.js → chunk-AMOPLAX6.js} +1 -1
  23. package/dist/standalone/{chunk-JULHAFJ4.js → chunk-ARGGBECJ.js} +1 -1
  24. package/dist/standalone/{chunk-5D3H63PI.js → chunk-B4K4IET7.js} +1 -1
  25. package/dist/standalone/{chunk-4M3NH7JL.js → chunk-CLYI7JF2.js} +1 -1
  26. package/dist/standalone/{chunk-E7INALU3.js → chunk-CNQBTB5C.js} +1 -1
  27. package/dist/standalone/{chunk-CB7ZTKPV.js → chunk-DBLSNTHL.js} +1 -1
  28. package/dist/standalone/{chunk-DK53RZKN.js → chunk-E5LR7G22.js} +1 -1
  29. package/dist/standalone/{chunk-QJQESOSM.js → chunk-E6FH3ZOB.js} +1 -1
  30. package/dist/standalone/{chunk-E2YYGOOQ.js → chunk-E6NWADUS.js} +1 -1
  31. package/dist/standalone/{chunk-QNWL62VF.js → chunk-F7EKRF7I.js} +1 -1
  32. package/dist/standalone/{chunk-4RB2U4LR.js → chunk-FHKZP25N.js} +1 -1
  33. package/dist/standalone/{chunk-DAQ5MG2K.js → chunk-FTJ6RR64.js} +1 -1
  34. package/dist/standalone/{chunk-D65BU7FE.js → chunk-G2Z7WFAT.js} +1 -1
  35. package/dist/standalone/{chunk-7PMFQ2MH.js → chunk-G6PUHYKD.js} +1 -1
  36. package/dist/standalone/{chunk-Z2OFUUXB.js → chunk-GM7MBMYI.js} +1 -1
  37. package/dist/standalone/{chunk-DJNIAP4K.js → chunk-H6KIDQ6V.js} +1 -1
  38. package/dist/standalone/{chunk-AZ4XQOCL.js → chunk-HGNPJO7S.js} +1 -1
  39. package/dist/standalone/{chunk-5H7O5AAH.js → chunk-HLWDT5VZ.js} +1 -1
  40. package/dist/standalone/{chunk-MTQ2AME6.js → chunk-HWFV5UCF.js} +1 -1
  41. package/dist/standalone/{chunk-OX4CGBCH.js → chunk-IDHU47FP.js} +1 -1
  42. package/dist/standalone/{chunk-3DSYXWHK.js → chunk-IDNHNCZV.js} +1 -1
  43. package/dist/standalone/{chunk-RJBL7JY4.js → chunk-IHWSRI72.js} +1 -1
  44. package/dist/standalone/{chunk-YPNUYWQA.js → chunk-J77YDVBD.js} +1 -1
  45. package/dist/standalone/{chunk-D7G6QZVG.js → chunk-JG74C6DH.js} +1 -1
  46. package/dist/standalone/{chunk-645TBHJ5.js → chunk-JT7UYB6L.js} +1 -1
  47. package/dist/standalone/{chunk-7AJWGPWM.js → chunk-JWQOB4EW.js} +1 -1
  48. package/dist/standalone/{chunk-SVFX7F32.js → chunk-K5BAERB3.js} +1 -1
  49. package/dist/standalone/{chunk-SBK3TAAB.js → chunk-KAK3HS5E.js} +1 -1
  50. package/dist/standalone/{chunk-Z5FIGWZI.js → chunk-KZ6YQ234.js} +1 -1
  51. package/dist/standalone/{chunk-KFQGXMDN.js → chunk-LZHT6UGJ.js} +1 -1
  52. package/dist/standalone/{chunk-MQ5QAANP.js → chunk-MGJZKA6O.js} +1 -1
  53. package/dist/standalone/{chunk-VRBDHZHG.js → chunk-MQBQBEGM.js} +1 -1
  54. package/dist/standalone/{chunk-4CP3Z5RO.js → chunk-NEFVDZHP.js} +1 -1
  55. package/dist/standalone/{chunk-FRAL2RO2.js → chunk-NHUEXULQ.js} +1 -1
  56. package/dist/standalone/{chunk-BDSMWSCC.js → chunk-NSAQ3EDS.js} +1 -1
  57. package/dist/standalone/{chunk-F3ZG77WE.js → chunk-NYJXRBOK.js} +1 -1
  58. package/dist/standalone/{chunk-R47IHY6Y.js → chunk-O24UFHUY.js} +1 -1
  59. package/dist/standalone/{chunk-LTUZJBOU.js → chunk-O6W2YLME.js} +1 -1
  60. package/dist/standalone/{chunk-2JI25KW2.js → chunk-O7XG7DTU.js} +1 -1
  61. package/dist/standalone/{chunk-CHRUVO6R.js → chunk-OBYE3IXP.js} +1 -1
  62. package/dist/standalone/{chunk-BRSAZHDR.js → chunk-OCYIIOBX.js} +1 -1
  63. package/dist/standalone/{chunk-BVANRUU4.js → chunk-OOOT4H45.js} +6 -6
  64. package/dist/standalone/{chunk-P37PUSCM.js → chunk-OQOKF4LL.js} +1 -1
  65. package/dist/standalone/{chunk-LT4GBBFX.js → chunk-OS5DOPZW.js} +1 -1
  66. package/dist/standalone/{chunk-ZHH5ZUAS.js → chunk-PDBCAPP6.js} +1 -1
  67. package/dist/standalone/{chunk-CVXWRAOE.js → chunk-PFNK2MGW.js} +1 -1
  68. package/dist/standalone/{chunk-SLEA53CP.js → chunk-PMDLNIHA.js} +1 -1
  69. package/dist/standalone/{chunk-PXVIHVAC.js → chunk-PZGLD7G7.js} +1 -1
  70. package/dist/standalone/{chunk-EU4ZGNNW.js → chunk-Q3WMP7OA.js} +1 -1
  71. package/dist/standalone/{chunk-XTU27CFW.js → chunk-Q65X2ZIP.js} +1 -1
  72. package/dist/standalone/{chunk-L2IIDFS6.js → chunk-QBRBGDCL.js} +1 -1
  73. package/dist/standalone/{chunk-YUJEQHLF.js → chunk-QR6RYVUD.js} +1 -1
  74. package/dist/standalone/{chunk-JKUOZ7WC.js → chunk-QSUQAWEP.js} +1 -1
  75. package/dist/standalone/{chunk-CEQ5CLF7.js → chunk-RLJYW6TY.js} +1 -1
  76. package/dist/standalone/{chunk-AJQGPPJL.js → chunk-SGIBDCPB.js} +1 -1
  77. package/dist/standalone/{chunk-VZGMGBF2.js → chunk-STK3KLLV.js} +1 -1
  78. package/dist/standalone/{chunk-NCHRXGHE.js → chunk-TDPAITW5.js} +1 -1
  79. package/dist/standalone/{chunk-J66QR7WA.js → chunk-TZ5PSNZW.js} +1 -1
  80. package/dist/standalone/{chunk-3CHB2JV2.js → chunk-UCJWHNUJ.js} +1 -1
  81. package/dist/standalone/{chunk-JMFIJ3RC.js → chunk-V3SVDOVD.js} +1 -1
  82. package/dist/standalone/{chunk-FJMFQ5AG.js → chunk-V6YA4TAL.js} +1 -1
  83. package/dist/standalone/{chunk-JK3WW3ZA.js → chunk-VB2XDTVB.js} +1 -1
  84. package/dist/standalone/{chunk-YWBYKFUD.js → chunk-VFB22IM2.js} +1 -1
  85. package/dist/standalone/{chunk-P4FZSY2J.js → chunk-VGIDGJ5K.js} +1 -1
  86. package/dist/standalone/{chunk-WRP4JGYX.js → chunk-VJC5PQ7D.js} +1 -1
  87. package/dist/standalone/{chunk-UXLXNYF2.js → chunk-W42GZL6T.js} +1 -1
  88. package/dist/standalone/{chunk-AHGTRV37.js → chunk-WGGSW4E2.js} +1 -1
  89. package/dist/standalone/{chunk-LJKB6B3H.js → chunk-XMOG3LIP.js} +1 -1
  90. package/dist/standalone/{chunk-HAJH74RY.js → chunk-Y2JFJP4B.js} +1 -1
  91. package/dist/standalone/{chunk-DAKKBHGF.js → chunk-YLXNXB7E.js} +1 -1
  92. package/dist/standalone/{chunk-7CCJOJJB.js → chunk-YYIW5EKO.js} +1 -1
  93. package/dist/standalone/{chunk-FAQYDT7O.js → chunk-ZCN4YUCA.js} +1 -1
  94. package/dist/standalone/{chunk-SPSYM34I.js → chunk-ZEWRYBCB.js} +1 -1
  95. package/dist/standalone/{chunk-DAO4DQDP.js → chunk-ZGZSTTKN.js} +1 -1
  96. package/dist/standalone/{chunk-UUWJUMOH.js → chunk-ZM3A5WO5.js} +1 -1
  97. package/dist/standalone/chunk-ZYZ5ATT2.js +1 -0
  98. package/dist/standalone/studio.js +1 -1
  99. package/package.json +5 -5
  100. package/dist/standalone/chunk-ZPOWCFQA.js +0 -1
@@ -1,4 +1,4 @@
1
- import{a as As,b as v,c as Fs,d as Ps}from"./chunk-BVANRUU4.js";import{a as Ms}from"./chunk-GWNGVKLG.js";import{a as ne,b as Ot}from"./chunk-6G3E4PJ2.js";import{a,d as U}from"./chunk-5PEAXTYQ.js";var de=a(t=>{try{return t(),!0}catch{return!1}},"o"),Bn=new Set([Object.prototype,Function.prototype]),Oe=a((t,e,s)=>{let r;for(let i=t;i!==null&&!Bn.has(i);i=Object.getPrototypeOf(i)){let n=Object.getOwnPropertyDescriptor(i,e)?.[s];typeof n=="function"&&(r=n)}return r},"y"),G=a((t,e)=>Oe(t,e,"get"),"r"),_s=Oe(Date.prototype,"getTime","value"),Wn=G(Map.prototype,"size"),$n=G(Set.prototype,"size"),zn=G(ArrayBuffer.prototype,"byteLength"),Te=typeof URL=="function"?G(URL.prototype,"href"):void 0,Et=typeof URL=="function"?URL.prototype:void 0,Gn=Te!==void 0&&Function.prototype.toString.call(Te).includes("[native code]"),Ls=Oe(Error,"isError","value"),xs=Error.prototype,Vn=a((t,e)=>typeof Ls=="function"?Ls(t):e!==null&&(e===xs||xs.isPrototypeOf(e)),"L"),Jn=Oe(Map.prototype,"forEach","value"),Yn=Oe(Set.prototype,"forEach","value"),It=Object.getPrototypeOf(Uint8Array.prototype),Rt={data:{buffer:G(DataView.prototype,"buffer"),byteLength:G(DataView.prototype,"byteLength"),byteOffset:G(DataView.prototype,"byteOffset")},typed:{buffer:G(It,"buffer"),byteLength:G(It,"byteLength"),byteOffset:G(It,"byteOffset")}},Qs=a(t=>Reflect.apply(_s,t,[]),"S"),Ds=a(t=>Reflect.apply(Te,t,[]),"m"),Us=a(t=>{let e=[];return Reflect.apply(Jn,t,[(s,r)=>e.push([r,s])]),e},"A"),Hs=a(t=>{let e=[];return Reflect.apply(Yn,t,[s=>e.push(s)]),e},"w"),Ns=a(t=>{let e=de(()=>Reflect.apply(Rt.typed.buffer,t,[]))?Rt.typed:Rt.data;return new Uint8Array(Reflect.apply(e.buffer,t,[]),Reflect.apply(e.byteOffset,t,[]),Reflect.apply(e.byteLength,t,[]))},"j"),We=a(t=>{if(Array.isArray(t))return"array";let e=Object.getPrototypeOf(t);return e===null||e===Object.prototype?"plain":de(()=>Reflect.apply(_s,t,[]))?"builtin-date":de(()=>Reflect.apply(Wn,t,[]))?"builtin-map":de(()=>Reflect.apply($n,t,[]))?"builtin-set":de(()=>Reflect.apply(zn,t,[]))?"builtin-array-buffer":ArrayBuffer.isView(t)?"builtin-view":Vn(t,e)?"builtin-error":Te!==void 0&&(Gn||Et!==void 0&&e!==null&&(e===Et||Et.isPrototypeOf(e)))&&de(()=>Reflect.apply(Te,t,[]))?"builtin-url":"other"},"D");var Xn=2**32-1,Zn=/["\\\u0000-\u001F\uD800-\uDFFF]/,Ks=a(t=>Zn.test(t)?JSON.stringify(t):`"${t}"`,"y"),ea=a(t=>Number.isNaN(t)?"nan":t===1/0?"inf":t===-1/0?"-inf":Object.is(t,-0)?"-0":void 0,"u"),ta=a((t,e)=>{let s=t,r=Object.keys(s).sort(),i="{",n=!0;for(let o of r){let c=s[o];c!==void 0&&(n?n=!1:i+=",",i+=Ks(o),i+=":",i+=e(c))}return`${i}}`},"g"),sa=a(t=>{let{length:e}=t,s=Number.isInteger(e)?e:Math.trunc(e)||0;if(s>Xn)throw new RangeError("stable-key: array length exceeds 2**32 - 1");return s},"d"),Ee=a(t=>{if(t===void 0)return"null";if(typeof t=="bigint")throw new TypeError("stableStringify: cannot use a bigint in a stable JSON cache key \u2014 pass it as a string, or use stableWireKey");if(typeof t=="function"||typeof t=="symbol")throw new TypeError(`stableStringify: cannot use a ${typeof t} in a stable JSON cache key \u2014 only plain objects, arrays, and JSON primitives are supported`);if(typeof t=="number"){let s=ea(t);if(s!==void 0)return s}if(typeof t=="string")return Ks(t);if(t===null||typeof t!="object")return JSON.stringify(t);let e=We(t);if(e==="array"){let s=sa(t),r="[";for(let i=0;i<s;i+=1)i>0&&(r+=","),r+=Ee(t[i]);return`${r}]`}if(e!=="plain"){let s=t.constructor?.name??"value";throw new TypeError(`stableStringify: cannot use a ${s} in a stable JSON cache key \u2014 only plain objects, arrays, and JSON primitives are supported (wire-typed values key via stableWireKey)`)}return ta(t,Ee)},"c");var At=a(t=>{if(t===null||typeof t!="object")return!1;let e=Object.getPrototypeOf(t);return e===null||e===Object.prototype},"e");var $e=a(t=>{let e="";for(let s=0;s<t.length;s+=32768)e+=String.fromCharCode(...t.subarray(s,s+32768));return btoa(e)},"u"),ra=a(t=>{let e=atob(t),s=new Uint8Array(e.length);for(let r=0;r<e.length;r+=1)s[r]=e.codePointAt(r)??0;return s},"R"),A="$lunora.wire$",ze=64,Ge=1024,ia="__proto__",na=/^-?\d+$/,js={BigInt64Array,BigUint64Array,Float32Array,Float64Array,Int8Array,Int16Array,Int32Array,Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array},qs={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError},Ft=a((t,e,s)=>{e===ia?Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:s,writable:!0}):t[e]=s},"b");var aa=a(t=>{let e=t.toString();if(e.length>Ge)throw new RangeError(`wire-codec: over-long bigint (max ${String(Ge)} digits)`);return[A,"bigint",e]},"B"),oa=a(t=>Number.isNaN(t)?[A,"nan"]:t===1/0?[A,"inf"]:t===-1/0?[A,"-inf"]:t,"_"),ca=a((t,e)=>{let s=e(Object.fromEntries(Object.keys(t).map(n=>[n,t[n]]))),r=t,i=[A,"error",String(r.name),String(r.message),s];return t.cause!==void 0&&i.push(e(t.cause)),i},"P"),ha=a(t=>{let e=t.constructor.name,s=Ns(t);return e==="Uint8Array"?[A,"bytes",$e(s)]:[A,"bytes",$e(s),e]},"$"),ua=a((t,e,s)=>{switch(e){case"builtin-array-buffer":return[A,"bytes",$e(new Uint8Array(t)),"ArrayBuffer"];case"builtin-date":return[A,"date",s(Qs(t))];case"builtin-error":return ca(t,s);case"builtin-map":return[A,"map",Us(t).map(([r,i])=>[s(r),s(i)])];case"builtin-set":return[A,"set",Hs(t).map(r=>s(r))];case"builtin-url":return[A,"url",Ds(t)];case"builtin-view":return ha(t);default:return}},"k"),da=a((t,e)=>{let s=t.map(r=>H(r,e));return s.length>0&&s[0]===A?[A,"arr",s]:s},"D"),la=a((t,e)=>{let s={};for(let r of Object.keys(t)){let i=t[r];i!==void 0&&Ft(s,r,H(i,e))}return s},"C"),H=a((t,e=0)=>{if(e>ze)throw new RangeError(`wire-codec: value nesting exceeds the ${String(ze)}-level limit`);if(t===void 0)return[A,"undefined"];if(t===null)return t;if(typeof t=="bigint")return aa(t);if(typeof t=="number")return oa(t);if(typeof t!="object")return t;let s=We(t);if(s==="array")return da(t,e+1);if(s==="plain")return la(t,e+1);let r=ua(t,s,n=>H(n,e+1));if(r!==void 0)return r;let i=t.constructor?.name??"value";throw new TypeError(`wire-codec: cannot encode a ${i} over the Lunora wire \u2014 only plain objects, arrays, and the supported built-ins (Date, Error, URL, Map, Set, ArrayBuffer/typed arrays, bigint) round-trip`)},"y"),pa=a(t=>{let e=t[2];if(typeof e!="string"||e.length>Ge||!na.test(e))throw new RangeError(`wire-codec: invalid or over-long bigint (max ${String(Ge)} digits)`);return BigInt(e)},"M"),fa=a((t,e)=>{let s=e(t[2]);if(typeof s!="number")throw new TypeError("wire-codec: malformed date \u2014 epoch must be a number");return new Date(s)},"F"),ma=a((t,e)=>{let s=t[2];return new Map(s.map(r=>{if(!Array.isArray(r)||r.length!==2)throw new TypeError("wire-codec: malformed map entry \u2014 expected a [key, value] pair");return[e(r[0]),e(r[1])]}))},"G"),ya=a(t=>{let e=t[2];if(typeof e!="string")throw new TypeError("wire-codec: malformed url \u2014 href must be a string");return new URL(e)},"L"),va=a((t,e)=>{let s=t[2],r=t[3];if(typeof s!="string"||typeof r!="string")throw new TypeError("wire-codec: malformed error \u2014 name and message must be strings");let i=(Object.hasOwn(qs,s)?qs[s]:void 0)??Error,n=new i(r);n.name!==s&&Object.defineProperty(n,"name",{configurable:!0,value:s,writable:!0});let o=e(t[4]);if(o===null||typeof o!="object"||Array.isArray(o))throw new TypeError("wire-codec: malformed error \u2014 props must be an object");for(let[c,h]of Object.entries(o))Ft(n,c,h);return t.length>5&&Object.defineProperty(n,"cause",{configurable:!0,value:e(t[5]),writable:!0}),n},"W"),ga=a(t=>{let e=t[2];if(typeof e!="string")throw new TypeError("wire-codec: malformed bytes \u2014 payload must be a base64 string");let s=ra(e);if($e(s)!==e)throw new TypeError("wire-codec: malformed bytes \u2014 payload must be canonical padded base64");let r=t[3]??"Uint8Array";if(r==="ArrayBuffer")return s.buffer.byteLength===s.byteLength?s.buffer:new Uint8Array(s).buffer;let i=Object.hasOwn(js,r)?js[r]:void 0;return i?new i(new Uint8Array(s).buffer):s},"v"),ba=a((t,e)=>{switch(t[1]){case"-inf":return-1/0;case"arr":return t[2].map(s=>e(s));case"bigint":return pa(t);case"bytes":return ga(t);case"date":return fa(t,e);case"error":return va(t,e);case"inf":return 1/0;case"map":return ma(t,e);case"nan":return Number.NaN;case"set":return new Set(t[2].map(s=>e(s)));case"undefined":return;case"url":return ya(t);default:return t.map(s=>e(s))}},"Y"),wa=a((t,e)=>{let s={};for(let r of Object.keys(t))Ft(s,r,T(t[r],e));return s},"H"),T=a((t,e=0)=>{if(e>ze)throw new RangeError(`wire-codec: value nesting exceeds the ${String(ze)}-level limit`);if(t===null||typeof t!="object")return t;if(Array.isArray(t)){let s=t;return s[0]===A?ba(s,r=>T(r,e+1)):s.map(r=>T(r,e+1))}return wa(t,e+1)},"f"),Bs=a(t=>{let e=JSON.parse(t);return t.includes(A)||t.includes(String.raw`\u`)?T(e):e},"J"),Sa=a(t=>{try{let e=Bs(t);return At(e)?e:void 0}catch{return}},"X");var q=a(t=>Ee(H(t)),"a");var le=U(ne(),1),Ws=U(Ot(),1);var Ie=le.createContext(void 0),Re=a(t=>{let e=le.useContext(Ie);if(t)return t;if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},"useQueryClient"),Pt=a(({client:t,children:e})=>(le.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),(0,Ws.jsx)(Ie.Provider,{value:t,children:e})),"QueryClientProvider");var j=class{static{a(this,"Subscribable")}constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};var Ca=class extends j{static{a(this,"FocusManager")}#e;#t;#s;constructor(){super(),this.#s=t=>{if(typeof window<"u"&&window.addEventListener){let e=a(()=>t(),"listener");return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}}}onSubscribe(){this.#t||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(t){this.#s=t,this.#t?.(),this.#t=t(e=>{typeof e=="boolean"?this.setFocused(e):this.onFocus()})}setFocused(t){this.#e!==t&&(this.#e=t,this.onFocus())}onFocus(){let t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},pe=new Ca;var ka={setTimeout:a((t,e)=>setTimeout(t,e),"setTimeout"),clearTimeout:a(t=>clearTimeout(t),"clearTimeout"),setInterval:a((t,e)=>setInterval(t,e),"setInterval"),clearInterval:a(t=>clearInterval(t),"clearInterval")},Ta=class{static{a(this,"TimeoutManager")}#e=ka;#t=!1;setTimeoutProvider(t){this.#e=t}setTimeout(t,e){return this.#e.setTimeout(t,e)}clearTimeout(t){this.#e.clearTimeout(t)}setInterval(t,e){return this.#e.setInterval(t,e)}clearInterval(t){this.#e.clearInterval(t)}},V=new Ta;function $s(t){setTimeout(t,0)}a($s,"systemSetTimeoutZero");var Lt=typeof window>"u"||"Deno"in globalThis;function O(){}a(O,"noop");function Vs(t,e){return typeof t=="function"?t(e):t}a(Vs,"functionalUpdate");function Ae(t){return typeof t=="number"&&t>=0&&t!==1/0}a(Ae,"isValidTimeout");function Ve(t,e){return Math.max(t+(e||0)-Date.now(),0)}a(Ve,"timeUntilStale");function B(t,e){return typeof t=="function"?t(e):t}a(B,"resolveStaleTime");function x(t,e){return typeof t=="function"?t(e):t}a(x,"resolveQueryBoolean");function Je(t,e){let{type:s="all",exact:r,fetchStatus:i,predicate:n,queryKey:o,stale:c}=t;if(o){if(r){if(e.queryHash!==Fe(o,e.options))return!1}else if(!ae(e.queryKey,o))return!1}if(s!=="all"){let h=e.isActive();if(s==="active"&&!h||s==="inactive"&&h)return!1}return!(typeof c=="boolean"&&e.isStale()!==c||i&&i!==e.state.fetchStatus||n&&!n(e))}a(Je,"matchQuery");function Ye(t,e){let{exact:s,status:r,predicate:i,mutationKey:n}=t;if(n){if(!e.options.mutationKey)return!1;if(s){if(J(e.options.mutationKey)!==J(n))return!1}else if(!ae(e.options.mutationKey,n))return!1}return!(r&&e.state.status!==r||i&&!i(e))}a(Ye,"matchMutation");function Fe(t,e){return(e?.queryKeyHashFn||J)(t)}a(Fe,"hashQueryKeyByOptions");function J(t){return JSON.stringify(t,(e,s)=>Mt(s)?Object.keys(s).sort().reduce((r,i)=>(r[i]=s[i],r),{}):s)}a(J,"hashKey");function ae(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(Array.isArray(t)&&Array.isArray(e)){for(let r=0;r<e.length;r++)if(!ae(t[r],e[r]))return!1;return!0}let s=Object.keys(e);for(let r of s)if(!ae(t[r],e[r]))return!1;return!0}return!1}a(ae,"partialMatchKey");var Oa=Object.prototype.hasOwnProperty;function xt(t,e,s=0){if(t===e)return t;if(s>500)return e;let r=zs(t)&&zs(e);if(!r&&!(Mt(t)&&Mt(e)))return e;let n=(r?t:Object.keys(t)).length,o=r?e:Object.keys(e),c=o.length,h=r?new Array(c):{},d=0;for(let u=0;u<c;u++){let l=r?u:o[u],p=t[l],f=e[l];if(p===f){h[l]=p,(r?u<n:Oa.call(t,l))&&d++;continue}if(p===null||f===null||typeof p!="object"||typeof f!="object"){h[l]=f;continue}let y=xt(p,f,s+1);h[l]=y,y===p&&d++}return n===c&&d===n?t:h}a(xt,"replaceEqualDeep");function fe(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(let s in t)if(t[s]!==e[s])return!1;return!0}a(fe,"shallowEqualObjects");function zs(t){return Array.isArray(t)&&t.length===Object.keys(t).length}a(zs,"isPlainArray");function Mt(t){if(!Gs(t))return!1;let e=t.constructor;if(e===void 0)return!0;let s=e.prototype;return!(!Gs(s)||!s.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}a(Mt,"isPlainObject");function Gs(t){return Object.prototype.toString.call(t)==="[object Object]"}a(Gs,"hasObjectPrototype");function Js(t){return new Promise(e=>{V.setTimeout(e,t)})}a(Js,"sleep");function Pe(t,e,s){return typeof s.structuralSharing=="function"?s.structuralSharing(t,e):s.structuralSharing!==!1?xt(t,e):e}a(Pe,"replaceData");function Ea(t){return t}a(Ea,"keepPreviousData");function Ys(t,e,s=0){let r=[...t,e];return s&&r.length>s?r.slice(1):r}a(Ys,"addToEnd");function Xs(t,e,s=0){let r=[e,...t];return s&&r.length>s?r.slice(0,-1):r}a(Xs,"addToStart");var me=Symbol();function Xe(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:!t.queryFn||t.queryFn===me?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}a(Xe,"ensureQueryFn");function ye(t,e){return typeof t=="function"?t(...e):!!t}a(ye,"shouldThrowError");function Zs(t,e,s){let r=!1,i;return Object.defineProperty(t,"signal",{enumerable:!0,get:a(()=>(i??=e(),r||(r=!0,i.aborted?s():i.addEventListener("abort",s,{once:!0})),i),"get")}),t}a(Zs,"addConsumeAwareSignal");var Y=(()=>{let t=a(()=>Lt,"isServerFn");return{isServer(){return t()},setIsServer(e){t=e}}})();function Me(){let t,e,s=new Promise((i,n)=>{t=i,e=n});s.status="pending",s.catch(()=>{});function r(i){Object.assign(s,i),delete s.resolve,delete s.reject}return a(r,"finalize"),s.resolve=i=>{r({status:"fulfilled",value:i}),t(i)},s.reject=i=>{r({status:"rejected",reason:i}),e(i)},s}a(Me,"pendingThenable");var er=$s;function Ia(){let t=[],e=0,s=a(c=>{c()},"notifyFn"),r=a(c=>{c()},"batchNotifyFn"),i=er,n=a(c=>{e?t.push(c):i(()=>{s(c)})},"schedule"),o=a(()=>{let c=t;t=[],c.length&&i(()=>{r(()=>{c.forEach(h=>{s(h)})})})},"flush");return{batch:a(c=>{let h;e++;try{h=c()}finally{e--,e||o()}return h},"batch"),batchCalls:a(c=>(...h)=>{n(()=>{c(...h)})},"batchCalls"),schedule:n,setNotifyFunction:a(c=>{s=c},"setNotifyFunction"),setBatchNotifyFunction:a(c=>{r=c},"setBatchNotifyFunction"),setScheduler:a(c=>{i=c},"setScheduler")}}a(Ia,"createNotifyManager");var C=Ia();var Ra=class extends j{static{a(this,"OnlineManager")}#e=!0;#t;#s;constructor(){super(),this.#s=t=>{if(typeof window<"u"&&window.addEventListener){let e=a(()=>t(!0),"onlineListener"),s=a(()=>t(!1),"offlineListener");return window.addEventListener("online",e,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",s)}}}}onSubscribe(){this.#t||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(t){this.#s=t,this.#t?.(),this.#t=t(this.setOnline.bind(this))}setOnline(t){this.#e!==t&&(this.#e=t,this.listeners.forEach(s=>{s(t)}))}isOnline(){return this.#e}},ve=new Ra;function Aa(t){return Math.min(1e3*2**t,3e4)}a(Aa,"defaultRetryDelay");function _t(t){return(t??"online")==="online"?ve.isOnline():!0}a(_t,"canFetch");var Ze=class extends Error{static{a(this,"CancelledError")}constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function et(t){let e=!1,s=0,r,i=Me(),n=a(()=>i.status!=="pending","isResolved"),o=a(m=>{if(!n()){let g=new Ze(m);p(g),t.onCancel?.(g)}},"cancel"),c=a(()=>{e=!0},"cancelRetry"),h=a(()=>{e=!1},"continueRetry"),d=a(()=>pe.isFocused()&&(t.networkMode==="always"||ve.isOnline())&&t.canRun(),"canContinue"),u=a(()=>_t(t.networkMode)&&t.canRun(),"canStart"),l=a(m=>{n()||(r?.(),i.resolve(m))},"resolve"),p=a(m=>{n()||(r?.(),i.reject(m))},"reject"),f=a(()=>new Promise(m=>{r=a(g=>{(n()||d())&&m(g)},"continueFn"),t.onPause?.()}).then(()=>{r=void 0,n()||t.onContinue?.()}),"pause"),y=a(()=>{if(n())return;let m,g=s===0?t.initialPromise:void 0;try{m=g??t.fn()}catch(w){m=Promise.reject(w)}Promise.resolve(m).then(l).catch(w=>{if(n())return;let k=t.retry??(Y.isServer()?0:3),E=t.retryDelay??Aa,S=typeof E=="function"?E(s,w):E,I=k===!0||typeof k=="number"&&s<k||typeof k=="function"&&k(s,w);if(e||!I){p(w);return}s++,t.onFail?.(s,w),Js(S).then(()=>d()?void 0:f()).then(()=>{e?p(w):y()})})},"run");return{promise:i,status:a(()=>i.status,"status"),cancel:o,continue:a(()=>(r?.(),i),"continue"),cancelRetry:c,continueRetry:h,canStart:u,start:a(()=>(u()?y():f().then(y),i),"start")}}a(et,"createRetryer");var tt=class{static{a(this,"Removable")}#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Ae(this.gcTime)&&(this.#e=V.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Y.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(V.clearTimeout(this.#e),this.#e=void 0)}};function sr(t){return{onFetch:a((e,s)=>{let r=e.options,i=e.fetchOptions?.meta?.fetchMore?.direction,n=e.state.data?.pages||[],o=e.state.data?.pageParams||[],c={pages:[],pageParams:[]},h=0,d=a(async()=>{let u=!1,l=a(y=>{Zs(y,()=>e.signal,()=>u=!0)},"addSignalProperty"),p=Xe(e.options,e.fetchOptions),f=a(async(y,m,g)=>{if(u)return Promise.reject(e.signal.reason);if(m==null&&y.pages.length)return Promise.resolve(y);let k=a(()=>{let ie={client:e.client,queryKey:e.queryKey,pageParam:m,direction:g?"backward":"forward",meta:e.options.meta};return l(ie),ie},"createQueryFnContext")(),E=await p(k),{maxPages:S}=e.options,I=g?Xs:Ys;return{pages:I(y.pages,E,S),pageParams:I(y.pageParams,m,S)}},"fetchPage");if(i&&n.length){let y=i==="backward",m=y?Fa:tr,g={pages:n,pageParams:o},w=m(r,g);c=await f(g,w,y)}else{let y=t??n.length;do{let m=h===0?o[0]??r.initialPageParam:tr(r,c);if(h>0&&m==null)break;c=await f(c,m),h++}while(h<y)}return c},"fetchFn");e.options.persister?e.fetchFn=()=>e.options.persister?.(d,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},s):e.fetchFn=d},"onFetch")}}a(sr,"infiniteQueryBehavior");function tr(t,{pages:e,pageParams:s}){let r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,s[r],s):void 0}a(tr,"getNextPageParam");function Fa(t,{pages:e,pageParams:s}){return e.length>0?t.getPreviousPageParam?.(e[0],e,s[0],s):void 0}a(Fa,"getPreviousPageParam");var nr=class extends tt{static{a(this,"Query")}#e;#t;#s;#r;#n;#i;#o;#a;constructor(t){super(),this.#a=!1,this.#o=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#n=t.client,this.#r=this.#n.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#t=ir(this.options),this.state=t.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#i?.promise}setOptions(t){if(this.options={...this.#o,...t},t?._type&&(this.#e=t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=ir(this.options);e.data!==void 0&&(this.setState(rr(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(t,e){let s=Pe(this.state.data,t,this.options);return this.#c({data:s,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),s}setState(t){this.#c({type:"setState",state:t})}cancel(t){let e=this.#i?.promise;return this.#i?.cancel(t),e?e.then(O).catch(O):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>x(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===me||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>B(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!Ve(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(this.#i&&(this.#a||this.#u()?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#r.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}#u(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"}invalidate(){this.state.isInvalidated||this.#c({type:"invalidate"})}async fetch(t,e){if(this.state.fetchStatus!=="idle"&&this.#i?.status()!=="rejected"){if(this.state.data!==void 0&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(t&&this.setOptions(t),!this.options.queryFn){let h=this.observers.find(d=>d.options.queryFn);h&&this.setOptions(h.options)}let s=new AbortController,r=a(h=>{Object.defineProperty(h,"signal",{enumerable:!0,get:a(()=>(this.#a=!0,s.signal),"get")})},"addSignalProperty"),i=a(()=>{let h=Xe(this.options,e),u=a(()=>{let l={client:this.#n,queryKey:this.queryKey,meta:this.meta};return r(l),l},"createQueryFnContext")();return this.#a=!1,this.options.persister?this.options.persister(h,u,this):h(u)},"fetchFn"),o=a(()=>{let h={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#n,state:this.state,fetchFn:i};return r(h),h},"createFetchContext")();(this.#e==="infinite"?sr(this.options.pages):this.options.behavior)?.onFetch(o,this),this.#s=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==o.fetchOptions?.meta)&&this.#c({type:"fetch",meta:o.fetchOptions?.meta}),this.#i=et({initialPromise:e?.initialPromise,fn:o.fetchFn,onCancel:a(h=>{h instanceof Ze&&h.revert&&this.setState({...this.#s,fetchStatus:"idle"}),s.abort()},"onCancel"),onFail:a((h,d)=>{this.#c({type:"failed",failureCount:h,error:d})},"onFail"),onPause:a(()=>{this.#c({type:"pause"})},"onPause"),onContinue:a(()=>{this.#c({type:"continue"})},"onContinue"),retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:a(()=>!0,"canRun")});try{let h=await this.#i.start();if(h===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(h),this.#r.config.onSuccess?.(h,this),this.#r.config.onSettled?.(h,this.state.error,this),h}catch(h){if(h instanceof Ze){if(h.silent)return this.#i.promise;if(h.revert){if(this.state.data===void 0)throw h;return this.state.data}}throw this.#c({type:"error",error:h}),this.#r.config.onError?.(h,this),this.#r.config.onSettled?.(this.state.data,h,this),h}finally{this.scheduleGc()}}#c(t){let e=a(s=>{switch(t.type){case"failed":return{...s,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...Qt(s.data,this.options),fetchMeta:t.meta??null};case"success":let r={...s,...rr(t.data,t.dataUpdatedAt),dataUpdateCount:s.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#s=t.manual?r:void 0,r;case"error":let i=t.error;return{...s,error:i,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...t.state}}},"reducer");this.state=e(this.state),C.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:t})})}};function Qt(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:_t(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}a(Qt,"fetchState");function rr(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}a(rr,"successState");function ir(t){let e=typeof t.initialData=="function"?t.initialData():t.initialData,s=e!==void 0,r=s?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:s?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}a(ir,"getDefaultState");var Ut=class extends j{static{a(this,"QueryObserver")}constructor(t,e){super(),this.options=e,this.#e=t,this.#a=null,this.#o=Me(),this.bindMethods(),this.setOptions(e)}#e;#t=void 0;#s=void 0;#r=void 0;#n;#i;#o;#a;#u;#c;#f;#d;#l;#h;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),ar(this.#t,this.options)?this.#p():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Dt(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Dt(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#w(),this.#S(),this.#t.removeObserver(this)}setOptions(t){let e=this.options,s=this.#t;if(this.options=this.#e.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof x(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#C(),this.#t.setOptions(this.options),e._defaulted&&!fe(this.options,e)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});let r=this.hasListeners();r&&or(this.#t,s,this.options,e)&&this.#p(),this.updateResult(),r&&(this.#t!==s||x(this.options.enabled,this.#t)!==x(e.enabled,this.#t)||B(this.options.staleTime,this.#t)!==B(e.staleTime,this.#t))&&this.#y();let i=this.#v();r&&(this.#t!==s||x(this.options.enabled,this.#t)!==x(e.enabled,this.#t)||i!==this.#h)&&this.#g(i)}getOptimisticResult(t){let e=this.#e.getQueryCache().build(this.#e,t),s=this.createResult(e,t);return Ma(this,s)&&(this.#r=s,this.#i=this.options,this.#n=this.#t.state),s}getCurrentResult(){return this.#r}trackResult(t,e){return new Proxy(t,{get:a((s,r)=>(this.trackProp(r),e?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#o.status==="pending"&&this.#o.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(s,r)),"get")})}trackProp(t){this.#m.add(t)}getCurrentQuery(){return this.#t}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let e=this.#e.defaultQueryOptions(t),s=this.#e.getQueryCache().build(this.#e,e);return s.fetch().then(()=>this.createResult(s,e))}fetch(t){return this.#p({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#p(t){this.#C();let e=this.#t.fetch(this.options,t);return t?.throwOnError||(e=e.catch(O)),e}#y(){this.#w();let t=B(this.options.staleTime,this.#t);if(Y.isServer()||this.#r.isStale||!Ae(t))return;let s=Ve(this.#r.dataUpdatedAt,t)+1;this.#d=V.setTimeout(()=>{this.#r.isStale||this.updateResult()},s)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#g(t){this.#S(),this.#h=t,!(Y.isServer()||x(this.options.enabled,this.#t)===!1||!Ae(this.#h)||this.#h===0)&&(this.#l=V.setInterval(()=>{(this.options.refetchIntervalInBackground||pe.isFocused())&&this.#p()},this.#h))}#b(){this.#y(),this.#g(this.#v())}#w(){this.#d!==void 0&&(V.clearTimeout(this.#d),this.#d=void 0)}#S(){this.#l!==void 0&&(V.clearInterval(this.#l),this.#l=void 0)}createResult(t,e){let s=this.#t,r=this.options,i=this.#r,n=this.#n,o=this.#i,h=t!==s?t.state:this.#s,{state:d}=t,u={...d},l=!1,p;if(e._optimisticResults){let F=this.hasListeners(),R=!F&&ar(t,e),Z=F&&or(t,s,e,r);(R||Z)&&(u={...u,...Qt(d.data,t.options)}),e._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:f,errorUpdatedAt:y,status:m}=u;p=u.data;let g=!1;if(e.placeholderData!==void 0&&p===void 0&&m==="pending"){let F;i?.isPlaceholderData&&e.placeholderData===o?.placeholderData?(F=i.data,g=!0):F=typeof e.placeholderData=="function"?e.placeholderData(this.#f?.state.data,this.#f):e.placeholderData,F!==void 0&&(m="success",p=Pe(i?.data,F,e),l=!0)}if(e.select&&p!==void 0&&!g)if(i&&p===n?.data&&e.select===this.#u)p=this.#c;else try{this.#u=e.select,p=e.select(p),p=Pe(i?.data,p,e),this.#c=p,this.#a=null}catch(F){this.#a=F}this.#a&&(f=this.#a,p=this.#c,y=Date.now(),m="error");let w=u.fetchStatus==="fetching",k=m==="pending",E=m==="error",S=k&&w,I=p!==void 0,L={status:m,fetchStatus:u.fetchStatus,isPending:k,isSuccess:m==="success",isError:E,isInitialLoading:S,isLoading:S,data:p,dataUpdatedAt:u.dataUpdatedAt,error:f,errorUpdatedAt:y,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:u.dataUpdateCount>h.dataUpdateCount||u.errorUpdateCount>h.errorUpdateCount,isFetching:w,isRefetching:w&&!k,isLoadingError:E&&!I,isPaused:u.fetchStatus==="paused",isPlaceholderData:l,isRefetchError:E&&I,isStale:Ht(t,e),refetch:this.refetch,promise:this.#o,isEnabled:x(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){let F=L.data!==void 0,R=L.status==="error"&&!F,Z=a(Be=>{R?Be.reject(L.error):F&&Be.resolve(L.data)},"finalizeThenableIfPossible"),Rs=a(()=>{let Be=this.#o=L.promise=Me();Z(Be)},"recreateThenable"),qe=this.#o;switch(qe.status){case"pending":t.queryHash===s.queryHash&&Z(qe);break;case"fulfilled":(R||L.data!==qe.value)&&Rs();break;case"rejected":(!R||L.error!==qe.reason)&&Rs();break}}return L}updateResult(){let t=this.#r,e=this.createResult(this.#t,this.options);if(this.#n=this.#t.state,this.#i=this.options,this.#n.data!==void 0&&(this.#f=this.#t),fe(e,t))return;this.#r=e;let s=a(()=>{if(!t)return!0;let{notifyOnChangeProps:r}=this.options,i=typeof r=="function"?r():r;if(i==="all"||!i&&!this.#m.size)return!0;let n=new Set(i??this.#m);return this.options.throwOnError&&n.add("error"),Object.keys(this.#r).some(o=>{let c=o;return this.#r[c]!==t[c]&&n.has(c)})},"shouldNotifyListeners");this.#k({listeners:s()})}#C(){let t=this.#e.getQueryCache().build(this.#e,this.options);if(t===this.#t)return;let e=this.#t;this.#t=t,this.#s=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#k(t){C.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function Pa(t,e){return x(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&x(e.retryOnMount,t)===!1)}a(Pa,"shouldLoadOnMount");function ar(t,e){return Pa(t,e)||t.state.data!==void 0&&Dt(t,e,e.refetchOnMount)}a(ar,"shouldFetchOnMount");function Dt(t,e,s){if(x(e.enabled,t)!==!1&&B(e.staleTime,t)!=="static"){let r=typeof s=="function"?s(t):s;return r==="always"||r!==!1&&Ht(t,e)}return!1}a(Dt,"shouldFetchOn");function or(t,e,s,r){return(t!==e||x(r.enabled,t)===!1)&&(!s.suspense||t.state.status!=="error")&&Ht(t,s)}a(or,"shouldFetchOptionally");function Ht(t,e){return x(e.enabled,t)!==!1&&t.isStaleByTime(B(e.staleTime,t))}a(Ht,"isStale");function Ma(t,e){return!fe(t.getCurrentResult(),e)}a(Ma,"shouldAssignObserverCurrentProperties");var cr=class extends tt{static{a(this,"Mutation")}#e;#t;#s;#r;constructor(t){super(),this.#e=t.client,this.mutationId=t.mutationId,this.#s=t.mutationCache,this.#t=[],this.state=t.state||Nt(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#t.includes(t)||(this.#t.push(t),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#t=this.#t.filter(e=>e!==t),this.scheduleGc(),this.#s.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#s.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(t){let e=a(()=>{this.#n({type:"continue"})},"onContinue"),s={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=et({fn:a(()=>this.options.mutationFn?this.options.mutationFn(t,s):Promise.reject(new Error("No mutationFn found")),"fn"),onFail:a((n,o)=>{this.#n({type:"failed",failureCount:n,error:o})},"onFail"),onPause:a(()=>{this.#n({type:"pause"})},"onPause"),onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:a(()=>this.#s.canRun(this),"canRun")});let r=this.state.status==="pending",i=!this.#r.canStart();try{if(r)e();else{this.#n({type:"pending",variables:t,isPaused:i}),this.#s.config.onMutate&&await this.#s.config.onMutate(t,this,s);let o=await this.options.onMutate?.(t,s);o!==this.state.context&&this.#n({type:"pending",context:o,variables:t,isPaused:i})}let n=await this.#r.start();return await this.#s.config.onSuccess?.(n,t,this.state.context,this,s),await this.options.onSuccess?.(n,t,this.state.context,s),await this.#s.config.onSettled?.(n,null,this.state.variables,this.state.context,this,s),await this.options.onSettled?.(n,null,t,this.state.context,s),this.#n({type:"success",data:n}),n}catch(n){try{await this.#s.config.onError?.(n,t,this.state.context,this,s)}catch(o){Promise.reject(o)}try{await this.options.onError?.(n,t,this.state.context,s)}catch(o){Promise.reject(o)}try{await this.#s.config.onSettled?.(void 0,n,this.state.variables,this.state.context,this,s)}catch(o){Promise.reject(o)}try{await this.options.onSettled?.(void 0,n,t,this.state.context,s)}catch(o){Promise.reject(o)}throw this.#n({type:"error",error:n}),n}finally{this.#s.runNext(this)}}#n(t){let e=a(s=>{switch(t.type){case"failed":return{...s,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...s,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:t.error,failureCount:s.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}},"reducer");this.state=e(this.state),C.batch(()=>{this.#t.forEach(s=>{s.onMutationUpdate(t)}),this.#s.notify({mutation:this,type:"updated",action:t})})}};function Nt(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}a(Nt,"getDefaultState");var hr=class extends j{static{a(this,"MutationCache")}constructor(t={}){super(),this.config=t,this.#e=new Set,this.#t=new Map,this.#s=0}#e;#t;#s;build(t,e,s){let r=new cr({client:t,mutationCache:this,mutationId:++this.#s,options:t.defaultMutationOptions(e),state:s});return this.add(r),r}add(t){this.#e.add(t);let e=st(t);if(typeof e=="string"){let s=this.#t.get(e);s?s.push(t):this.#t.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#e.delete(t)){let e=st(t);if(typeof e=="string"){let s=this.#t.get(e);if(s)if(s.length>1){let r=s.indexOf(t);r!==-1&&s.splice(r,1)}else s[0]===t&&this.#t.delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){let e=st(t);if(typeof e=="string"){let r=this.#t.get(e)?.find(i=>i.state.status==="pending");return!r||r===t}else return!0}runNext(t){let e=st(t);return typeof e=="string"?this.#t.get(e)?.find(r=>r!==t&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){C.batch(()=>{this.#e.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(t){let e={exact:!0,...t};return this.getAll().find(s=>Ye(e,s))}findAll(t={}){return this.getAll().filter(e=>Ye(t,e))}notify(t){C.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){let t=this.getAll().filter(e=>e.state.isPaused);return C.batch(()=>Promise.all(t.map(e=>e.continue().catch(O))))}};function st(t){return t.options.scope?.id}a(st,"scopeFor");var Kt=class extends j{static{a(this,"MutationObserver")}#e;#t=void 0;#s;#r;constructor(t,e){super(),this.#e=t,this.setOptions(e),this.bindMethods(),this.#n()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){let e=this.options;this.options=this.#e.defaultMutationOptions(t),fe(this.options,e)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#s,observer:this}),e?.mutationKey&&this.options.mutationKey&&J(e.mutationKey)!==J(this.options.mutationKey)?this.reset():this.#s?.state.status==="pending"&&this.#s.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#s?.removeObserver(this)}onMutationUpdate(t){this.#n(),this.#i(t)}getCurrentResult(){return this.#t}reset(){this.#s?.removeObserver(this),this.#s=void 0,this.#n(),this.#i()}mutate(t,e){return this.#r=e,this.#s?.removeObserver(this),this.#s=this.#e.getMutationCache().build(this.#e,this.options),this.#s.addObserver(this),this.#s.execute(t)}#n(){let t=this.#s?.state??Nt();this.#t={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#i(t){C.batch(()=>{if(this.#r&&this.hasListeners()){let e=this.#t.variables,s=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#r.onSuccess?.(t.data,e,s,r)}catch(i){Promise.reject(i)}try{this.#r.onSettled?.(t.data,null,e,s,r)}catch(i){Promise.reject(i)}}else if(t?.type==="error"){try{this.#r.onError?.(t.error,e,s,r)}catch(i){Promise.reject(i)}try{this.#r.onSettled?.(void 0,t.error,e,s,r)}catch(i){Promise.reject(i)}}}this.listeners.forEach(e=>{e(this.#t)})})}};var ur=class extends j{static{a(this,"QueryCache")}constructor(t={}){super(),this.config=t,this.#e=new Map}#e;build(t,e,s){let r=e.queryKey,i=e.queryHash??Fe(r,e),n=this.get(i);return n||(n=new nr({client:t,queryKey:r,queryHash:i,options:t.defaultQueryOptions(e),state:s,defaultOptions:t.getQueryDefaults(r)}),this.add(n)),n}add(t){this.#e.has(t.queryHash)||(this.#e.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){let e=this.#e.get(t.queryHash);e&&(t.destroy(),e===t&&this.#e.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){C.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#e.get(t)}getAll(){return[...this.#e.values()]}find(t){let e={exact:!0,...t};return this.getAll().find(s=>Je(e,s))}findAll(t={}){let e=this.getAll();return Object.keys(t).length>0?e.filter(s=>Je(t,s)):e}notify(t){C.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){C.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){C.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}};var jt=class{static{a(this,"QueryClient")}#e;#t;#s;#r;#n;#i;#o;#a;constructor(t={}){this.#e=t.queryCache||new ur,this.#t=t.mutationCache||new hr,this.#s=t.defaultOptions||{},this.#r=new Map,this.#n=new Map,this.#i=0}mount(){this.#i++,this.#i===1&&(this.#o=pe.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#a=ve.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#i--,this.#i===0&&(this.#o?.(),this.#o=void 0,this.#a?.(),this.#a=void 0)}isFetching(t){return this.#e.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#t.findAll({...t,status:"pending"}).length}getQueryData(t){let e=this.defaultQueryOptions({queryKey:t});return this.#e.get(e.queryHash)?.state.data}ensureQueryData(t){let e=this.defaultQueryOptions(t),s=this.#e.build(this,e),r=s.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&s.isStaleByTime(B(e.staleTime,s))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return this.#e.findAll(t).map(({queryKey:e,state:s})=>{let r=s.data;return[e,r]})}setQueryData(t,e,s){let r=this.defaultQueryOptions({queryKey:t}),n=this.#e.get(r.queryHash)?.state.data,o=Vs(e,n);if(o!==void 0)return this.#e.build(this,r).setData(o,{...s,manual:!0})}setQueriesData(t,e,s){return C.batch(()=>this.#e.findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,s)]))}getQueryState(t){let e=this.defaultQueryOptions({queryKey:t});return this.#e.get(e.queryHash)?.state}removeQueries(t){let e=this.#e;C.batch(()=>{e.findAll(t).forEach(s=>{e.remove(s)})})}resetQueries(t,e){let s=this.#e;return C.batch(()=>(s.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){let s={revert:!0,...e},r=C.batch(()=>this.#e.findAll(t).map(i=>i.cancel(s)));return Promise.all(r).then(O).catch(O)}invalidateQueries(t,e={}){return C.batch(()=>(this.#e.findAll(t).forEach(s=>{s.invalidate()}),t?.refetchType==="none"?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e)))}refetchQueries(t,e={}){let s={...e,cancelRefetch:e.cancelRefetch??!0},r=C.batch(()=>this.#e.findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let n=i.fetch(void 0,s);return s.throwOnError||(n=n.catch(O)),i.state.fetchStatus==="paused"?Promise.resolve():n}));return Promise.all(r).then(O)}fetchQuery(t){let e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);let s=this.#e.build(this,e);return s.isStaleByTime(B(e.staleTime,s))?s.fetch(e):Promise.resolve(s.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(O).catch(O)}fetchInfiniteQuery(t){return t._type="infinite",this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(O).catch(O)}ensureInfiniteQueryData(t){return t._type="infinite",this.ensureQueryData(t)}resumePausedMutations(){return ve.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#s}setDefaultOptions(t){this.#s=t}setQueryDefaults(t,e){this.#r.set(J(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){let e=[...this.#r.values()],s={};return e.forEach(r=>{ae(t,r.queryKey)&&Object.assign(s,r.defaultOptions)}),s}setMutationDefaults(t,e){this.#n.set(J(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){let e=[...this.#n.values()],s={};return e.forEach(r=>{ae(t,r.mutationKey)&&Object.assign(s,r.defaultOptions)}),s}defaultQueryOptions(t){if(t._defaulted)return t;let e={...this.#s.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Fe(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===me&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#s.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};var oe=U(ne(),1);var Le=U(ne(),1),La=U(Ot(),1);function xa(){let t=!1;return{clearReset:a(()=>{t=!1},"clearReset"),reset:a(()=>{t=!0},"reset"),isReset:a(()=>t,"isReset")}}a(xa,"createValue");var _a=Le.createContext(xa()),dr=a(()=>Le.useContext(_a),"useQueryErrorResetBoundary");var lr=U(ne(),1);var pr=a((t,e,s)=>{let r=s?.state.error&&typeof t.throwOnError=="function"?ye(t.throwOnError,[s.state.error,s]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},"ensurePreventErrorBoundaryRetry"),fr=a(t=>{lr.useEffect(()=>{t.clearReset()},[t])},"useClearResetErrorBoundary"),mr=a(({result:t,errorResetBoundary:e,throwOnError:s,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||ye(s,[t.error,r])),"getHasError");var rt=U(ne(),1);var yr=rt.createContext(!1),vr=a(()=>rt.useContext(yr),"useIsRestoring"),Jd=yr.Provider;var gr=a(t=>{if(t.suspense){let s=a(i=>i==="static"?i:Math.max(i??1e3,1e3),"clamp"),r=t.staleTime;t.staleTime=typeof r=="function"?(...i)=>s(r(...i)):s(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},"ensureSuspenseTimers"),br=a((t,e)=>t.isLoading&&t.isFetching&&!e,"willFetch"),wr=a((t,e)=>t?.suspense&&e.isPending,"shouldSuspend"),qt=a((t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()}),"fetchOptimistic");function Sr(t,e,s){let r=vr(),i=dr(),n=Re(s),o=n.defaultQueryOptions(t);n.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let c=n.getQueryCache().get(o.queryHash),h=t.subscribed!==!1;o._optimisticResults=r?"isRestoring":h?"optimistic":void 0,gr(o),pr(o,i,c),fr(i);let d=!n.getQueryCache().get(o.queryHash),[u]=oe.useState(()=>new e(n,o)),l=u.getOptimisticResult(o),p=!r&&h;if(oe.useSyncExternalStore(oe.useCallback(f=>{let y=p?u.subscribe(C.batchCalls(f)):O;return u.updateResult(),y},[u,p]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),oe.useEffect(()=>{u.setOptions(o)},[o,u]),wr(o,l))throw qt(o,u,i);if(mr({result:l,errorResetBoundary:i,throwOnError:o.throwOnError,query:c,suspense:o.suspense}))throw l.error;return n.getDefaultOptions().queries?._experimental_afterQuery?.(o,l),o.experimental_prefetchInRender&&!Y.isServer()&&br(l,r)&&(d?qt(o,u,i):c?.promise)?.catch(O).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?l:u.trackResult(l)}a(Sr,"useBaseQuery");function Qa(t,e){return Sr(t,Ut,e)}a(Qa,"useQuery");var ee=U(ne(),1);function Da(t,e){let s=Re(e),[r]=ee.useState(()=>new Kt(s,t));ee.useEffect(()=>{r.setOptions(t)},[r,t]);let i=ee.useSyncExternalStore(ee.useCallback(o=>r.subscribe(C.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),n=ee.useCallback((o,c)=>{r.mutate(o,c).catch(O)},[r]);if(i.error&&ye(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:n,mutateAsync:i.mutate}}a(Da,"useMutation");var te="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",Bt=a(t=>{let e="",s=0,r=t.length-2;for(;s<r;s+=3){let n=t[s]<<16|t[s+1]<<8|t[s+2];e+=te.charAt(n>>18&63)+te.charAt(n>>12&63)+te.charAt(n>>6&63)+te.charAt(n&63)}let i=t.length-s;if(i===1){let n=t[s]<<16;e+=te.charAt(n>>18&63)+te.charAt(n>>12&63)}else if(i===2){let n=t[s]<<16|t[s+1]<<8;e+=te.charAt(n>>18&63)+te.charAt(n>>12&63)+te.charAt(n>>6&63)}return e},"A");var Ua=a(t=>{if(t===null||typeof t!="object")return!1;let e=Object.getPrototypeOf(t);return e===null||e===Object.prototype},"l"),Ha="_id",Wt="_creationTime",$t="page",Cr="pageDelta",Na=a(t=>{if(Array.isArray(t))return t;if(Ua(t)&&Array.isArray(t[$t]))return t[$t]},"y"),Ka=a(t=>{let e;for(let s of t){let r=s[Wt];if(typeof r=="number"){if(e!==void 0){if(r<e)return!0;if(r>e)return!1}e=r}}return!1},"g"),ja=a((t,e)=>{let s=e[Wt];if(typeof s!="number")return t.length;let r=Ka(t);for(let[i,n]of t.entries()){let o=n[Wt];if(typeof o=="number"&&(r?o<s:o>s))return i}return t.length},"A"),qa=a(t=>{if(typeof t!="object"||t===null)return;let e=t[Ha];return typeof e=="string"?e:void 0},"b"),Ba=a(t=>{if(typeof t!="object"||t===null)return!1;let e=t;return typeof e.key=="string"&&typeof e.table=="string"&&(e.op==="insert"||e.op==="update"||e.op==="delete")},"D"),Wa=a((t,e)=>{let{key:s,op:r,row:i}=e,n=[],o=-1;for(let c of t){let h=qa(c);if(h===void 0)return;if(h===s){if(r==="delete")continue;o===-1&&(o=n.length)}n.push(c)}if(r==="delete")return n;if(i!==void 0)return o===-1?n.splice(ja(n,i),0,i):n[o]=i,n},"x"),$a=a((t,e)=>{let s=Na(t);if(s===void 0)return;let r=Wa(s,e);return r===void 0||Array.isArray(t)?r:{...t,[$t]:r}},"E"),zt=Symbol("lunora.unmergeableDelta"),kr=a((t,e)=>{if("data"in t&&t.data!==void 0)return T(t.data);let s=T(t.delta);return Ba(s)?e===void 0?s:$a(e,s)??zt:s},"m");var Tr=a(()=>{let t=null;return{get:a(()=>t,"get"),set:a(e=>{t=e},"set")}},"r");var Pl=new Set(Object.keys(As)),N=class extends v{static{a(this,"R")}constructor(e,s){super("INTERNAL",e,{data:s})}};var it=a(t=>{let e=t?.data?.retryAfterMs;return typeof e=="number"&&Number.isFinite(e)?e:void 0},"f"),Gt=new Set(["TOKEN_EXPIRED","UNAUTHENTICATED"]),xe=a(t=>Gt.has(t?.code??""),"u");var _e=a(t=>typeof t=="string"||Array.isArray(t)&&t.every(e=>typeof e=="string")?{hint:t}:{},"n");var Vt=a(t=>{if(t===null)return;let e=Number(t);if(Number.isFinite(e))return e>0?e*1e3:void 0;let s=Date.parse(t);if(Number.isNaN(s))return;let r=s-Date.now();return r>0?r:void 0},"v"),za=a((t,e)=>{let s=Vt(e);if(!(s===void 0||it(t)!==void 0))return t.data===void 0?{retryAfterMs:s}:typeof t.data=="object"&&t.data!==null&&!Array.isArray(t.data)?{...t.data,retryAfterMs:s}:void 0},"p"),ge=a(t=>{let e=t?.error;if(typeof e!="object"||e===null||Array.isArray(e))return;let{why:s,...r}=e;return typeof s=="string"?{...r,why:s}:r},"y"),Jt=a(()=>new N("LunoraClient: batch slot carried no error envelope"),"E"),Or=a((t,e)=>{let s=t.error,r=typeof s?.code=="string"?s.code:void 0,i=typeof s?.message=="string"?s.message:void 0;return{code:r,messageText:(typeof t.message=="string"?t.message:void 0)??i??e}},"c"),Er=a(t=>{let{code:e,messageText:s}=Or(t,"stream error"),r=t.error,i=r?.why,n=e===void 0?new Error(s):new v(e,s,_e(r?.hint));return typeof i=="string"&&(n.why=i),n},"D"),Yt=a(t=>{let{code:e,messageText:s}=Or(t,"subscription error"),r=t.error,i=typeof r?.why=="string"?{why:r.why}:{};return{message:s,...e===void 0?{}:{code:e},..._e(r?.hint),...i}},"O"),Ga=Symbol.for("lunora.serverVerdict"),be=a(t=>{let e=new Error(t.message??"request failed");if(e.code=t.code,e[Ga]=!0,t.data!==void 0)try{e.data=T(t.data)}catch{}return t.hint!==void 0&&(e.hint=t.hint),t.docsUrl!==void 0&&(e.docsUrl=t.docsUrl),typeof t.why=="string"&&(e.why=t.why),e},"d"),Va=a(t=>Object.freeze(Object.fromEntries([...t].filter(([e])=>e!=="set-cookie"))),"b"),K=a((t,e)=>Object.defineProperty(t,"headers",{value:Va(e)}),"w"),Xt=a((t,e)=>{let s=be(t),r=za(s,e.get("retry-after"));return r!==void 0&&(s.data=r),K(s,e)},"j"),Zt=a(t=>{let e=ge(t);return e===void 0?Jt():be(e)},"M"),Ir=new WeakSet,nt=a(t=>{let e=new v("WIRE_DECODE_FAILED",`LunoraClient: the call succeeded but its result could not be decoded (a mutation has still committed) \u2014 ${t instanceof Error?t.message:String(t)}`,{cause:t});return Ir.add(e),e},"N"),Qe=a(t=>t instanceof Error&&Ir.has(t),"T");var at=class{static{a(this,"u")}values=new Map;subscribers=new Map;get(e){return this.values.has(e.key)?this.values.get(e.key):e.defaultValue}set(e,s){if(s===void 0){this.reset(e);return}this.values.set(e.key,s),this.notify(e.key,s)}reset(e){this.values.delete(e.key),this.notify(e.key,e.defaultValue)}clear(){this.values.clear(),this.subscribers.clear()}subscribe(e,s){let r=this.subscribers.get(e.key);return r||(r=new Set,this.subscribers.set(e.key,r)),r.add(s),()=>{r.delete(s),r.size===0&&this.subscribers.delete(e.key)}}notify(e,s){let r=this.subscribers.get(e);if(r)for(let i of r)try{i(s)}catch{}}};var ot=a(t=>t===void 0||t===""?"":`&bucket=${encodeURIComponent(t)}`,"a"),es=a(t=>t.startsWith("https://")?`wss://${t.slice(8)}`:t.startsWith("http://")?`ws://${t.slice(7)}`:t,"h"),_=a((t,e)=>`${t.endsWith("/")?t.slice(0,-1):t}${e}`,"$"),M=a((t,e)=>{let s=new URLSearchParams;for(let[i,n]of Object.entries(e))n!==void 0&&n!==""&&s.set(i,String(n));let r=s.toString();return r===""?t:`${t}?${r}`},"d"),Ja="http://same-origin.invalid",De=a(t=>new URL(t,Ja),"p"),Ya=/^[a-z][a-z\d+.-]*:/iu,ts=a((t,e)=>{if(Ya.test(e))return t.toString();let s=`${t.pathname}${t.search}${t.hash}`;return e.startsWith("//")?`//${t.host}${s}`:s},"S");var ss=0,we,Rr=a((t,e)=>{for(let s of t)try{s(e)}catch{}},"f"),Xa=a(t=>{let e=[...t.callbacks],s=t.lastValue;return()=>{for(let r of e){if(t.lastValue!==s)return;t.callbacks.has(r)&&Rr([r],s)}}},"p"),Ar=a(t=>{we===void 0?t():we.add(t)},"k"),Fr=a(()=>ss,"L"),Za=a((t,e)=>{let s=t;for(let r of e)try{s=r.transform(s)}catch{}return s},"y"),Pr=a((t,e)=>{e!==t.lastValue&&(t.lastValue=e,we===void 0?Rr(t.callbacks,e):we.add(t))},"d"),ct=a((t,e=()=>!0)=>{let s=new Set;we=s;try{t()}finally{we=void 0;let r=[...s].map(i=>typeof i=="function"?i:Xa(i));for(let i of r){if(!e())break;try{i()}catch{}}}},"v"),W=a((t,e)=>{Pr(t,Za(e,t.optimisticLayers))},"m"),ht=a((t,e)=>{let s;try{s=e(t.lastValue)}catch{return}let r={id:Symbol("optimistic"),transform:e},i=!1;t.optimisticLayers.push(r),Pr(t,s);let n=a(()=>{let c=t.optimisticLayers.findIndex(h=>h.id===r.id);return c===-1?!1:(t.optimisticLayers.splice(c,1),!0)},"s"),o=a(()=>{W(t,t.serverBase)},"a");return{confirm:a(c=>{if(c===void 0){n();return}r.commitCursor=c,ss+=1,r.acknowledgedAt=ss,t.serverCursor!==void 0&&t.serverCursor>=c&&n()&&o()},"confirm"),rollback:a(()=>{i||(i=!0,n(),o())},"rollback")}},"b"),ut=a((t,e)=>{if(e===void 0||t.optimisticLayers.length===0)return!1;let s=t.optimisticLayers.length;return t.optimisticLayers=t.optimisticLayers.filter(r=>r.commitCursor===void 0||r.commitCursor>e),t.optimisticLayers.length!==s},"h"),Mr=a((t,e)=>{t.optimisticLayers.length!==0&&(t.optimisticLayers=t.optimisticLayers.filter(s=>s.acknowledgedAt===void 0||s.acknowledgedAt>e))},"g"),he=a(t=>{for(let e=t.length-1;e>=0;e-=1)t[e]?.()},"w");var Lr=0,eo="lunora-bridge",to=1e3,so=3e3,dt=class{static{a(this,"p")}bc;tabId;heartbeatInterval;leaderTimeout;knownLeader=void 0;leader=!1;running=!1;promotionPending=!1;lastHeartbeat=0;pendingData=new Map;heldData=new Map;heartbeatTimer=void 0;leaderCheckTimer=void 0;onBecomeLeader;onStopBeingLeader;onConnectionStatus;onSubscriptionData;onLeaderClaimAnswered;onSubscriptionError;onSubscriptionSettled;constructor(e={}){if(Lr+=1,this.tabId=`tab_${String(Lr)}_${crypto.randomUUID()}`,this.heartbeatInterval=e.heartbeatInterval??to,this.leaderTimeout=e.leaderTimeout??so,this.onBecomeLeader=e.onBecomeLeader,this.onStopBeingLeader=e.onStopBeingLeader,this.onConnectionStatus=e.onConnectionStatus,this.onSubscriptionData=e.onSubscriptionData,this.onLeaderClaimAnswered=e.onLeaderClaimAnswered,this.onSubscriptionError=e.onSubscriptionError,this.onSubscriptionSettled=e.onSubscriptionSettled,typeof BroadcastChannel>"u"){this.bc=void 0;return}this.bc=new BroadcastChannel(e.channelName??eo),this.bc.addEventListener("message",s=>{this.handleMessage(s.data)})}start(){if(!this.running){if(this.running=!0,this.bc===void 0){this.becomeLeader();return}this.broadcast({type:"claim-leadership",tabId:this.tabId,ts:Date.now()}),setTimeout(()=>{this.running&&this.knownLeader===void 0&&this.becomeLeader()},this.leaderTimeout),this.leaderCheckTimer=setInterval(()=>{this.checkLeaderHealth()},this.leaderTimeout),this.heartbeatTimer=setInterval(()=>{this.sendHeartbeat()},this.heartbeatInterval)}}stop(){this.running=!1,this.leader&&(this.broadcast({type:"yield-leadership",tabId:this.tabId}),this.leader=!1,this.knownLeader=void 0,this.onStopBeingLeader?.()),this.heartbeatTimer!==void 0&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0),this.leaderCheckTimer!==void 0&&(clearInterval(this.leaderCheckTimer),this.leaderCheckTimer=void 0),this.bc?.close()}isLeader(){return this.leader}promoteImmediately(){this.running&&this.becomeLeader()}get leaderTabId(){return this.knownLeader}get id(){return this.tabId}get isRunning(){return this.running}broadcastSubscriptionData(e,s,r,i,n,o){this.leader&&(this.pendingData.size===0&&queueMicrotask(()=>{this.flushPendingData()}),this.pendingData.set(e,{type:"subscription-data",tabId:this.tabId,key:e,data:s,...r===void 0?{}:{cursor:r},...i===void 0?{}:{epoch:i},...n===void 0?{}:{identity:n},...o===void 0?{}:{claims:o}}))}broadcastSubscriptionError(e,s,r,i){this.leader&&this.broadcast({type:"subscription-error",tabId:this.tabId,key:e,error:s,...r===void 0?{}:{identity:r},...i===void 0?{}:{claims:i}})}broadcastSubscriptionSettled(e,s,r,i,n,o,c){this.leader&&this.broadcast({type:"subscription-settled",tabId:this.tabId,key:e,...s===void 0?{}:{cursor:s},...r===void 0?{}:{epoch:r},...i===void 0?{}:{lastMutationId:i},...n===void 0?{}:{clientId:n},...o===void 0?{}:{identity:o},...c===void 0?{}:{claims:c}})}broadcastConnectionStatus(e,s){this.leader&&this.broadcast({type:"connection-status",tabId:this.tabId,status:e,...s===void 0?{}:{identity:s}})}broadcast(e){this.flushPendingData(),this.bc?.postMessage(e)}flushPendingData(){if(this.pendingData.size===0)return;let e=[...this.pendingData.values()];if(this.pendingData.clear(),!this.leader)return;let s,r=!0;for(let[i,n]of e.entries()){let o=i<e.length-1;try{this.bc?.postMessage(o?{...n,more:!0}:n),s=n,r=!o}catch{}}!r&&s!==void 0&&this.bc?.postMessage(s)}applySubscriptionData(e){let s=this.heldData.get(e.tabId)??[];if(s.push(e),e.more===!0){this.heldData.set(e.tabId,s);return}this.heldData.delete(e.tabId),ct(()=>{for(let r of s)this.onSubscriptionData?.(r.key,r.data,r.cursor,r.epoch,r.identity,r.claims)},()=>this.running)}handleMessage(e){switch(e.type){case"claim-leadership":{this.handleClaimLeadership(e);break}case"connection-status":{if(this.leader||e.tabId===this.tabId)break;this.onConnectionStatus?.(e.status,e.identity);break}case"heartbeat":{this.handleHeartbeat(e);break}case"subscription-data":{if(this.leader||e.tabId===this.tabId)break;this.applySubscriptionData(e);break}case"subscription-error":{if(this.leader||e.tabId===this.tabId)break;this.onSubscriptionError?.(e.key,e.error,e.identity,e.claims);break}case"subscription-settled":{if(this.leader||e.tabId===this.tabId)break;this.onSubscriptionSettled?.(e.key,e.cursor,e.epoch,e.lastMutationId,e.clientId,e.identity,e.claims);break}case"yield-leadership":{this.heldData.delete(e.tabId),this.knownLeader===e.tabId&&(this.knownLeader=void 0,this.running&&!this.leader&&this.claimAndPromote());break}}}handleClaimLeadership(e){if(e.tabId!==this.tabId){if(this.leader){this.broadcast({type:"heartbeat",tabId:this.tabId,ts:Date.now()}),this.onLeaderClaimAnswered?.();return}this.knownLeader===void 0&&e.tabId<this.tabId&&(this.knownLeader=e.tabId,this.lastHeartbeat=e.ts)}}handleHeartbeat(e){if(e.tabId!==this.tabId){if(this.leader){this.resolveLeaderVsLeaderTieBreak(e);return}this.lastHeartbeat=e.ts,this.knownLeader=e.tabId}}resolveLeaderVsLeaderTieBreak(e){e.tabId<this.tabId?(this.leader=!1,this.knownLeader=e.tabId,this.lastHeartbeat=e.ts,this.onStopBeingLeader?.()):this.broadcast({type:"heartbeat",tabId:this.tabId,ts:Date.now()})}becomeLeader(){this.leader||(this.leader=!0,this.knownLeader=this.tabId,this.lastHeartbeat=Date.now(),this.onBecomeLeader?.(),this.broadcast({type:"heartbeat",tabId:this.tabId,ts:Date.now()}))}sendHeartbeat(){this.leader&&this.broadcast({type:"heartbeat",tabId:this.tabId,ts:Date.now()})}checkLeaderHealth(){if(!(!this.running||this.leader)){if(this.knownLeader===void 0){this.claimAndPromote();return}Date.now()-this.lastHeartbeat>this.leaderTimeout&&(this.heldData.delete(this.knownLeader),this.knownLeader=void 0,this.claimAndPromote())}}claimAndPromote(){this.promotionPending||(this.promotionPending=!0,this.broadcast({type:"claim-leadership",tabId:this.tabId,ts:Date.now()}),setTimeout(()=>{this.promotionPending=!1,this.running&&this.knownLeader===void 0&&this.becomeLeader()},this.leaderTimeout))}};var Ue=a((t={},e=Math.random)=>{let s=t.initialDelayMs??250,r=t.maxDelayMs??3e4,i=t.jitter??!0,n=0;return{next(){let o=Math.min(r,s*2**n);if(n+=1,!i)return o;let c=o/2;return Math.floor(c+e()*(o-c))},reset(){n=0}}},"s");var ro=1024,lt=a(t=>{let e=t.maxBuffer??ro,s=[],r=[],i=!1,n,o=!1,c=a(()=>{let u=r.shift();if(!u)return!1;if(n)return u.reject(n),!0;if(s.length>0){let l=s.shift();return u.resolve({done:!1,value:l}),!0}return i?(u.resolve({done:!0,value:void 0}),!0):(r.unshift(u),!1)},"u"),h={complete(){if(!(i||n))for(i=!0;c(););},fail(u){if(!(i||n)){for(n=u,s.length=0;c(););t.onFail?.()}},push(u){if(!(i||n||o)){if(s.length>=e){h.fail(new v("STREAM_BACKPRESSURE",`stream buffer overflow (max=${e.toString()}); the consumer cannot keep up with the producer`));return}s.push(u),c()}}},d=a(()=>{if(!o){o=!0,i=!0,s.length=0;try{t.onCancel()}catch{}for(;c(););}},"c");return{handle:h,iterable:{cancel:d,[Symbol.asyncIterator](){return{next(){if(n)return Promise.reject(n);if(s.length>0){let u=s.shift();return Promise.resolve({done:!1,value:u})}return i?Promise.resolve({done:!0,value:void 0}):new Promise((u,l)=>{r.push({reject:l,resolve:u})})},return(){return d(),Promise.resolve({done:!0,value:void 0})}}}}}},"p");var Se=a(t=>t.reason??Object.assign(new Error("The operation was aborted"),{name:"AbortError"}),"c"),ce=a(async(t,e,s,r=()=>new N(`LunoraClient: request timed out after ${t.toString()}ms`))=>{if(e?.aborted)throw Se(e);let i=new AbortController,n=[],o=new Promise((h,d)=>{if(t>0){let u=setTimeout(()=>{d(r()),i.abort()},t);n.push(()=>{clearTimeout(u)})}if(e){let u=a(()=>{i.abort(),d(Se(e))},"a");e.addEventListener("abort",u,{once:!0}),n.push(()=>{e.removeEventListener("abort",u)})}}),c=s(i.signal);c.catch(()=>{});try{return await Promise.race([c,o])}finally{for(let h of n)h()}},"m"),rs=a(async(t,e)=>{if(e===void 0)return t;if(e.aborted)throw t.catch(()=>{}),Se(e);let s=a(()=>{},"o"),r=new Promise((i,n)=>{s=a(()=>{n(Se(e))},"o"),e.addEventListener("abort",s,{once:!0})});t.catch(()=>{});try{return await Promise.race([t,r])}finally{e.removeEventListener("abort",s)}},"E"),xr=a(async(t,e)=>!Number.isFinite(e)||e<=0?t.read():ce(e,void 0,async()=>t.read(),()=>new v("STREAM_IDLE",`stream received nothing for ${e.toString()}ms`)),"y");var pt=/^ /u,io=/^\d+$/u,no=2147483647,ao=10,oo=1e3,_r=a(t=>typeof t=="object"&&t!==null?JSON.stringify(t):String(t),"O"),co=a(t=>{let e="",s,r,i=[];for(let n of t.split(`
1
+ import{a as As,b as v,c as Fs,d as Ps}from"./chunk-OOOT4H45.js";import{a as Ms}from"./chunk-GWNGVKLG.js";import{a as ne,b as Ot}from"./chunk-6G3E4PJ2.js";import{a,d as U}from"./chunk-5PEAXTYQ.js";var de=a(t=>{try{return t(),!0}catch{return!1}},"o"),Bn=new Set([Object.prototype,Function.prototype]),Oe=a((t,e,s)=>{let r;for(let i=t;i!==null&&!Bn.has(i);i=Object.getPrototypeOf(i)){let n=Object.getOwnPropertyDescriptor(i,e)?.[s];typeof n=="function"&&(r=n)}return r},"y"),G=a((t,e)=>Oe(t,e,"get"),"r"),_s=Oe(Date.prototype,"getTime","value"),Wn=G(Map.prototype,"size"),$n=G(Set.prototype,"size"),zn=G(ArrayBuffer.prototype,"byteLength"),Te=typeof URL=="function"?G(URL.prototype,"href"):void 0,Et=typeof URL=="function"?URL.prototype:void 0,Gn=Te!==void 0&&Function.prototype.toString.call(Te).includes("[native code]"),Ls=Oe(Error,"isError","value"),xs=Error.prototype,Vn=a((t,e)=>typeof Ls=="function"?Ls(t):e!==null&&(e===xs||xs.isPrototypeOf(e)),"L"),Jn=Oe(Map.prototype,"forEach","value"),Yn=Oe(Set.prototype,"forEach","value"),It=Object.getPrototypeOf(Uint8Array.prototype),Rt={data:{buffer:G(DataView.prototype,"buffer"),byteLength:G(DataView.prototype,"byteLength"),byteOffset:G(DataView.prototype,"byteOffset")},typed:{buffer:G(It,"buffer"),byteLength:G(It,"byteLength"),byteOffset:G(It,"byteOffset")}},Qs=a(t=>Reflect.apply(_s,t,[]),"S"),Ds=a(t=>Reflect.apply(Te,t,[]),"m"),Us=a(t=>{let e=[];return Reflect.apply(Jn,t,[(s,r)=>e.push([r,s])]),e},"A"),Hs=a(t=>{let e=[];return Reflect.apply(Yn,t,[s=>e.push(s)]),e},"w"),Ns=a(t=>{let e=de(()=>Reflect.apply(Rt.typed.buffer,t,[]))?Rt.typed:Rt.data;return new Uint8Array(Reflect.apply(e.buffer,t,[]),Reflect.apply(e.byteOffset,t,[]),Reflect.apply(e.byteLength,t,[]))},"j"),We=a(t=>{if(Array.isArray(t))return"array";let e=Object.getPrototypeOf(t);return e===null||e===Object.prototype?"plain":de(()=>Reflect.apply(_s,t,[]))?"builtin-date":de(()=>Reflect.apply(Wn,t,[]))?"builtin-map":de(()=>Reflect.apply($n,t,[]))?"builtin-set":de(()=>Reflect.apply(zn,t,[]))?"builtin-array-buffer":ArrayBuffer.isView(t)?"builtin-view":Vn(t,e)?"builtin-error":Te!==void 0&&(Gn||Et!==void 0&&e!==null&&(e===Et||Et.isPrototypeOf(e)))&&de(()=>Reflect.apply(Te,t,[]))?"builtin-url":"other"},"D");var Xn=2**32-1,Zn=/["\\\u0000-\u001F\uD800-\uDFFF]/,Ks=a(t=>Zn.test(t)?JSON.stringify(t):`"${t}"`,"y"),ea=a(t=>Number.isNaN(t)?"nan":t===1/0?"inf":t===-1/0?"-inf":Object.is(t,-0)?"-0":void 0,"u"),ta=a((t,e)=>{let s=t,r=Object.keys(s).sort(),i="{",n=!0;for(let o of r){let c=s[o];c!==void 0&&(n?n=!1:i+=",",i+=Ks(o),i+=":",i+=e(c))}return`${i}}`},"g"),sa=a(t=>{let{length:e}=t,s=Number.isInteger(e)?e:Math.trunc(e)||0;if(s>Xn)throw new RangeError("stable-key: array length exceeds 2**32 - 1");return s},"d"),Ee=a(t=>{if(t===void 0)return"null";if(typeof t=="bigint")throw new TypeError("stableStringify: cannot use a bigint in a stable JSON cache key \u2014 pass it as a string, or use stableWireKey");if(typeof t=="function"||typeof t=="symbol")throw new TypeError(`stableStringify: cannot use a ${typeof t} in a stable JSON cache key \u2014 only plain objects, arrays, and JSON primitives are supported`);if(typeof t=="number"){let s=ea(t);if(s!==void 0)return s}if(typeof t=="string")return Ks(t);if(t===null||typeof t!="object")return JSON.stringify(t);let e=We(t);if(e==="array"){let s=sa(t),r="[";for(let i=0;i<s;i+=1)i>0&&(r+=","),r+=Ee(t[i]);return`${r}]`}if(e!=="plain"){let s=t.constructor?.name??"value";throw new TypeError(`stableStringify: cannot use a ${s} in a stable JSON cache key \u2014 only plain objects, arrays, and JSON primitives are supported (wire-typed values key via stableWireKey)`)}return ta(t,Ee)},"c");var At=a(t=>{if(t===null||typeof t!="object")return!1;let e=Object.getPrototypeOf(t);return e===null||e===Object.prototype},"e");var $e=a(t=>{let e="";for(let s=0;s<t.length;s+=32768)e+=String.fromCharCode(...t.subarray(s,s+32768));return btoa(e)},"u"),ra=a(t=>{let e=atob(t),s=new Uint8Array(e.length);for(let r=0;r<e.length;r+=1)s[r]=e.codePointAt(r)??0;return s},"R"),A="$lunora.wire$",ze=64,Ge=1024,ia="__proto__",na=/^-?\d+$/,js={BigInt64Array,BigUint64Array,Float32Array,Float64Array,Int8Array,Int16Array,Int32Array,Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array},qs={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError},Ft=a((t,e,s)=>{e===ia?Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:s,writable:!0}):t[e]=s},"b");var aa=a(t=>{let e=t.toString();if(e.length>Ge)throw new RangeError(`wire-codec: over-long bigint (max ${String(Ge)} digits)`);return[A,"bigint",e]},"B"),oa=a(t=>Number.isNaN(t)?[A,"nan"]:t===1/0?[A,"inf"]:t===-1/0?[A,"-inf"]:t,"_"),ca=a((t,e)=>{let s=e(Object.fromEntries(Object.keys(t).map(n=>[n,t[n]]))),r=t,i=[A,"error",String(r.name),String(r.message),s];return t.cause!==void 0&&i.push(e(t.cause)),i},"P"),ha=a(t=>{let e=t.constructor.name,s=Ns(t);return e==="Uint8Array"?[A,"bytes",$e(s)]:[A,"bytes",$e(s),e]},"$"),ua=a((t,e,s)=>{switch(e){case"builtin-array-buffer":return[A,"bytes",$e(new Uint8Array(t)),"ArrayBuffer"];case"builtin-date":return[A,"date",s(Qs(t))];case"builtin-error":return ca(t,s);case"builtin-map":return[A,"map",Us(t).map(([r,i])=>[s(r),s(i)])];case"builtin-set":return[A,"set",Hs(t).map(r=>s(r))];case"builtin-url":return[A,"url",Ds(t)];case"builtin-view":return ha(t);default:return}},"k"),da=a((t,e)=>{let s=t.map(r=>H(r,e));return s.length>0&&s[0]===A?[A,"arr",s]:s},"D"),la=a((t,e)=>{let s={};for(let r of Object.keys(t)){let i=t[r];i!==void 0&&Ft(s,r,H(i,e))}return s},"C"),H=a((t,e=0)=>{if(e>ze)throw new RangeError(`wire-codec: value nesting exceeds the ${String(ze)}-level limit`);if(t===void 0)return[A,"undefined"];if(t===null)return t;if(typeof t=="bigint")return aa(t);if(typeof t=="number")return oa(t);if(typeof t!="object")return t;let s=We(t);if(s==="array")return da(t,e+1);if(s==="plain")return la(t,e+1);let r=ua(t,s,n=>H(n,e+1));if(r!==void 0)return r;let i=t.constructor?.name??"value";throw new TypeError(`wire-codec: cannot encode a ${i} over the Lunora wire \u2014 only plain objects, arrays, and the supported built-ins (Date, Error, URL, Map, Set, ArrayBuffer/typed arrays, bigint) round-trip`)},"y"),pa=a(t=>{let e=t[2];if(typeof e!="string"||e.length>Ge||!na.test(e))throw new RangeError(`wire-codec: invalid or over-long bigint (max ${String(Ge)} digits)`);return BigInt(e)},"M"),fa=a((t,e)=>{let s=e(t[2]);if(typeof s!="number")throw new TypeError("wire-codec: malformed date \u2014 epoch must be a number");return new Date(s)},"F"),ma=a((t,e)=>{let s=t[2];return new Map(s.map(r=>{if(!Array.isArray(r)||r.length!==2)throw new TypeError("wire-codec: malformed map entry \u2014 expected a [key, value] pair");return[e(r[0]),e(r[1])]}))},"G"),ya=a(t=>{let e=t[2];if(typeof e!="string")throw new TypeError("wire-codec: malformed url \u2014 href must be a string");return new URL(e)},"L"),va=a((t,e)=>{let s=t[2],r=t[3];if(typeof s!="string"||typeof r!="string")throw new TypeError("wire-codec: malformed error \u2014 name and message must be strings");let i=(Object.hasOwn(qs,s)?qs[s]:void 0)??Error,n=new i(r);n.name!==s&&Object.defineProperty(n,"name",{configurable:!0,value:s,writable:!0});let o=e(t[4]);if(o===null||typeof o!="object"||Array.isArray(o))throw new TypeError("wire-codec: malformed error \u2014 props must be an object");for(let[c,h]of Object.entries(o))Ft(n,c,h);return t.length>5&&Object.defineProperty(n,"cause",{configurable:!0,value:e(t[5]),writable:!0}),n},"W"),ga=a(t=>{let e=t[2];if(typeof e!="string")throw new TypeError("wire-codec: malformed bytes \u2014 payload must be a base64 string");let s=ra(e);if($e(s)!==e)throw new TypeError("wire-codec: malformed bytes \u2014 payload must be canonical padded base64");let r=t[3]??"Uint8Array";if(r==="ArrayBuffer")return s.buffer.byteLength===s.byteLength?s.buffer:new Uint8Array(s).buffer;let i=Object.hasOwn(js,r)?js[r]:void 0;return i?new i(new Uint8Array(s).buffer):s},"v"),ba=a((t,e)=>{switch(t[1]){case"-inf":return-1/0;case"arr":return t[2].map(s=>e(s));case"bigint":return pa(t);case"bytes":return ga(t);case"date":return fa(t,e);case"error":return va(t,e);case"inf":return 1/0;case"map":return ma(t,e);case"nan":return Number.NaN;case"set":return new Set(t[2].map(s=>e(s)));case"undefined":return;case"url":return ya(t);default:return t.map(s=>e(s))}},"Y"),wa=a((t,e)=>{let s={};for(let r of Object.keys(t))Ft(s,r,T(t[r],e));return s},"H"),T=a((t,e=0)=>{if(e>ze)throw new RangeError(`wire-codec: value nesting exceeds the ${String(ze)}-level limit`);if(t===null||typeof t!="object")return t;if(Array.isArray(t)){let s=t;return s[0]===A?ba(s,r=>T(r,e+1)):s.map(r=>T(r,e+1))}return wa(t,e+1)},"f"),Bs=a(t=>{let e=JSON.parse(t);return t.includes(A)||t.includes(String.raw`\u`)?T(e):e},"J"),Sa=a(t=>{try{let e=Bs(t);return At(e)?e:void 0}catch{return}},"X");var q=a(t=>Ee(H(t)),"a");var le=U(ne(),1),Ws=U(Ot(),1);var Ie=le.createContext(void 0),Re=a(t=>{let e=le.useContext(Ie);if(t)return t;if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},"useQueryClient"),Pt=a(({client:t,children:e})=>(le.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),(0,Ws.jsx)(Ie.Provider,{value:t,children:e})),"QueryClientProvider");var j=class{static{a(this,"Subscribable")}constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};var Ca=class extends j{static{a(this,"FocusManager")}#e;#t;#s;constructor(){super(),this.#s=t=>{if(typeof window<"u"&&window.addEventListener){let e=a(()=>t(),"listener");return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}}}onSubscribe(){this.#t||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(t){this.#s=t,this.#t?.(),this.#t=t(e=>{typeof e=="boolean"?this.setFocused(e):this.onFocus()})}setFocused(t){this.#e!==t&&(this.#e=t,this.onFocus())}onFocus(){let t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},pe=new Ca;var ka={setTimeout:a((t,e)=>setTimeout(t,e),"setTimeout"),clearTimeout:a(t=>clearTimeout(t),"clearTimeout"),setInterval:a((t,e)=>setInterval(t,e),"setInterval"),clearInterval:a(t=>clearInterval(t),"clearInterval")},Ta=class{static{a(this,"TimeoutManager")}#e=ka;#t=!1;setTimeoutProvider(t){this.#e=t}setTimeout(t,e){return this.#e.setTimeout(t,e)}clearTimeout(t){this.#e.clearTimeout(t)}setInterval(t,e){return this.#e.setInterval(t,e)}clearInterval(t){this.#e.clearInterval(t)}},V=new Ta;function $s(t){setTimeout(t,0)}a($s,"systemSetTimeoutZero");var Lt=typeof window>"u"||"Deno"in globalThis;function O(){}a(O,"noop");function Vs(t,e){return typeof t=="function"?t(e):t}a(Vs,"functionalUpdate");function Ae(t){return typeof t=="number"&&t>=0&&t!==1/0}a(Ae,"isValidTimeout");function Ve(t,e){return Math.max(t+(e||0)-Date.now(),0)}a(Ve,"timeUntilStale");function B(t,e){return typeof t=="function"?t(e):t}a(B,"resolveStaleTime");function x(t,e){return typeof t=="function"?t(e):t}a(x,"resolveQueryBoolean");function Je(t,e){let{type:s="all",exact:r,fetchStatus:i,predicate:n,queryKey:o,stale:c}=t;if(o){if(r){if(e.queryHash!==Fe(o,e.options))return!1}else if(!ae(e.queryKey,o))return!1}if(s!=="all"){let h=e.isActive();if(s==="active"&&!h||s==="inactive"&&h)return!1}return!(typeof c=="boolean"&&e.isStale()!==c||i&&i!==e.state.fetchStatus||n&&!n(e))}a(Je,"matchQuery");function Ye(t,e){let{exact:s,status:r,predicate:i,mutationKey:n}=t;if(n){if(!e.options.mutationKey)return!1;if(s){if(J(e.options.mutationKey)!==J(n))return!1}else if(!ae(e.options.mutationKey,n))return!1}return!(r&&e.state.status!==r||i&&!i(e))}a(Ye,"matchMutation");function Fe(t,e){return(e?.queryKeyHashFn||J)(t)}a(Fe,"hashQueryKeyByOptions");function J(t){return JSON.stringify(t,(e,s)=>Mt(s)?Object.keys(s).sort().reduce((r,i)=>(r[i]=s[i],r),{}):s)}a(J,"hashKey");function ae(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(Array.isArray(t)&&Array.isArray(e)){for(let r=0;r<e.length;r++)if(!ae(t[r],e[r]))return!1;return!0}let s=Object.keys(e);for(let r of s)if(!ae(t[r],e[r]))return!1;return!0}return!1}a(ae,"partialMatchKey");var Oa=Object.prototype.hasOwnProperty;function xt(t,e,s=0){if(t===e)return t;if(s>500)return e;let r=zs(t)&&zs(e);if(!r&&!(Mt(t)&&Mt(e)))return e;let n=(r?t:Object.keys(t)).length,o=r?e:Object.keys(e),c=o.length,h=r?new Array(c):{},d=0;for(let u=0;u<c;u++){let l=r?u:o[u],p=t[l],f=e[l];if(p===f){h[l]=p,(r?u<n:Oa.call(t,l))&&d++;continue}if(p===null||f===null||typeof p!="object"||typeof f!="object"){h[l]=f;continue}let y=xt(p,f,s+1);h[l]=y,y===p&&d++}return n===c&&d===n?t:h}a(xt,"replaceEqualDeep");function fe(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(let s in t)if(t[s]!==e[s])return!1;return!0}a(fe,"shallowEqualObjects");function zs(t){return Array.isArray(t)&&t.length===Object.keys(t).length}a(zs,"isPlainArray");function Mt(t){if(!Gs(t))return!1;let e=t.constructor;if(e===void 0)return!0;let s=e.prototype;return!(!Gs(s)||!s.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}a(Mt,"isPlainObject");function Gs(t){return Object.prototype.toString.call(t)==="[object Object]"}a(Gs,"hasObjectPrototype");function Js(t){return new Promise(e=>{V.setTimeout(e,t)})}a(Js,"sleep");function Pe(t,e,s){return typeof s.structuralSharing=="function"?s.structuralSharing(t,e):s.structuralSharing!==!1?xt(t,e):e}a(Pe,"replaceData");function Ea(t){return t}a(Ea,"keepPreviousData");function Ys(t,e,s=0){let r=[...t,e];return s&&r.length>s?r.slice(1):r}a(Ys,"addToEnd");function Xs(t,e,s=0){let r=[e,...t];return s&&r.length>s?r.slice(0,-1):r}a(Xs,"addToStart");var me=Symbol();function Xe(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:!t.queryFn||t.queryFn===me?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}a(Xe,"ensureQueryFn");function ye(t,e){return typeof t=="function"?t(...e):!!t}a(ye,"shouldThrowError");function Zs(t,e,s){let r=!1,i;return Object.defineProperty(t,"signal",{enumerable:!0,get:a(()=>(i??=e(),r||(r=!0,i.aborted?s():i.addEventListener("abort",s,{once:!0})),i),"get")}),t}a(Zs,"addConsumeAwareSignal");var Y=(()=>{let t=a(()=>Lt,"isServerFn");return{isServer(){return t()},setIsServer(e){t=e}}})();function Me(){let t,e,s=new Promise((i,n)=>{t=i,e=n});s.status="pending",s.catch(()=>{});function r(i){Object.assign(s,i),delete s.resolve,delete s.reject}return a(r,"finalize"),s.resolve=i=>{r({status:"fulfilled",value:i}),t(i)},s.reject=i=>{r({status:"rejected",reason:i}),e(i)},s}a(Me,"pendingThenable");var er=$s;function Ia(){let t=[],e=0,s=a(c=>{c()},"notifyFn"),r=a(c=>{c()},"batchNotifyFn"),i=er,n=a(c=>{e?t.push(c):i(()=>{s(c)})},"schedule"),o=a(()=>{let c=t;t=[],c.length&&i(()=>{r(()=>{c.forEach(h=>{s(h)})})})},"flush");return{batch:a(c=>{let h;e++;try{h=c()}finally{e--,e||o()}return h},"batch"),batchCalls:a(c=>(...h)=>{n(()=>{c(...h)})},"batchCalls"),schedule:n,setNotifyFunction:a(c=>{s=c},"setNotifyFunction"),setBatchNotifyFunction:a(c=>{r=c},"setBatchNotifyFunction"),setScheduler:a(c=>{i=c},"setScheduler")}}a(Ia,"createNotifyManager");var C=Ia();var Ra=class extends j{static{a(this,"OnlineManager")}#e=!0;#t;#s;constructor(){super(),this.#s=t=>{if(typeof window<"u"&&window.addEventListener){let e=a(()=>t(!0),"onlineListener"),s=a(()=>t(!1),"offlineListener");return window.addEventListener("online",e,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",s)}}}}onSubscribe(){this.#t||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(t){this.#s=t,this.#t?.(),this.#t=t(this.setOnline.bind(this))}setOnline(t){this.#e!==t&&(this.#e=t,this.listeners.forEach(s=>{s(t)}))}isOnline(){return this.#e}},ve=new Ra;function Aa(t){return Math.min(1e3*2**t,3e4)}a(Aa,"defaultRetryDelay");function _t(t){return(t??"online")==="online"?ve.isOnline():!0}a(_t,"canFetch");var Ze=class extends Error{static{a(this,"CancelledError")}constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function et(t){let e=!1,s=0,r,i=Me(),n=a(()=>i.status!=="pending","isResolved"),o=a(m=>{if(!n()){let g=new Ze(m);p(g),t.onCancel?.(g)}},"cancel"),c=a(()=>{e=!0},"cancelRetry"),h=a(()=>{e=!1},"continueRetry"),d=a(()=>pe.isFocused()&&(t.networkMode==="always"||ve.isOnline())&&t.canRun(),"canContinue"),u=a(()=>_t(t.networkMode)&&t.canRun(),"canStart"),l=a(m=>{n()||(r?.(),i.resolve(m))},"resolve"),p=a(m=>{n()||(r?.(),i.reject(m))},"reject"),f=a(()=>new Promise(m=>{r=a(g=>{(n()||d())&&m(g)},"continueFn"),t.onPause?.()}).then(()=>{r=void 0,n()||t.onContinue?.()}),"pause"),y=a(()=>{if(n())return;let m,g=s===0?t.initialPromise:void 0;try{m=g??t.fn()}catch(w){m=Promise.reject(w)}Promise.resolve(m).then(l).catch(w=>{if(n())return;let k=t.retry??(Y.isServer()?0:3),E=t.retryDelay??Aa,S=typeof E=="function"?E(s,w):E,I=k===!0||typeof k=="number"&&s<k||typeof k=="function"&&k(s,w);if(e||!I){p(w);return}s++,t.onFail?.(s,w),Js(S).then(()=>d()?void 0:f()).then(()=>{e?p(w):y()})})},"run");return{promise:i,status:a(()=>i.status,"status"),cancel:o,continue:a(()=>(r?.(),i),"continue"),cancelRetry:c,continueRetry:h,canStart:u,start:a(()=>(u()?y():f().then(y),i),"start")}}a(et,"createRetryer");var tt=class{static{a(this,"Removable")}#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Ae(this.gcTime)&&(this.#e=V.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Y.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(V.clearTimeout(this.#e),this.#e=void 0)}};function sr(t){return{onFetch:a((e,s)=>{let r=e.options,i=e.fetchOptions?.meta?.fetchMore?.direction,n=e.state.data?.pages||[],o=e.state.data?.pageParams||[],c={pages:[],pageParams:[]},h=0,d=a(async()=>{let u=!1,l=a(y=>{Zs(y,()=>e.signal,()=>u=!0)},"addSignalProperty"),p=Xe(e.options,e.fetchOptions),f=a(async(y,m,g)=>{if(u)return Promise.reject(e.signal.reason);if(m==null&&y.pages.length)return Promise.resolve(y);let k=a(()=>{let ie={client:e.client,queryKey:e.queryKey,pageParam:m,direction:g?"backward":"forward",meta:e.options.meta};return l(ie),ie},"createQueryFnContext")(),E=await p(k),{maxPages:S}=e.options,I=g?Xs:Ys;return{pages:I(y.pages,E,S),pageParams:I(y.pageParams,m,S)}},"fetchPage");if(i&&n.length){let y=i==="backward",m=y?Fa:tr,g={pages:n,pageParams:o},w=m(r,g);c=await f(g,w,y)}else{let y=t??n.length;do{let m=h===0?o[0]??r.initialPageParam:tr(r,c);if(h>0&&m==null)break;c=await f(c,m),h++}while(h<y)}return c},"fetchFn");e.options.persister?e.fetchFn=()=>e.options.persister?.(d,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},s):e.fetchFn=d},"onFetch")}}a(sr,"infiniteQueryBehavior");function tr(t,{pages:e,pageParams:s}){let r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,s[r],s):void 0}a(tr,"getNextPageParam");function Fa(t,{pages:e,pageParams:s}){return e.length>0?t.getPreviousPageParam?.(e[0],e,s[0],s):void 0}a(Fa,"getPreviousPageParam");var nr=class extends tt{static{a(this,"Query")}#e;#t;#s;#r;#n;#i;#o;#a;constructor(t){super(),this.#a=!1,this.#o=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#n=t.client,this.#r=this.#n.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#t=ir(this.options),this.state=t.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#i?.promise}setOptions(t){if(this.options={...this.#o,...t},t?._type&&(this.#e=t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=ir(this.options);e.data!==void 0&&(this.setState(rr(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(t,e){let s=Pe(this.state.data,t,this.options);return this.#c({data:s,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),s}setState(t){this.#c({type:"setState",state:t})}cancel(t){let e=this.#i?.promise;return this.#i?.cancel(t),e?e.then(O).catch(O):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>x(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===me||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>B(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!Ve(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(this.#i&&(this.#a||this.#u()?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#r.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}#u(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"}invalidate(){this.state.isInvalidated||this.#c({type:"invalidate"})}async fetch(t,e){if(this.state.fetchStatus!=="idle"&&this.#i?.status()!=="rejected"){if(this.state.data!==void 0&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(t&&this.setOptions(t),!this.options.queryFn){let h=this.observers.find(d=>d.options.queryFn);h&&this.setOptions(h.options)}let s=new AbortController,r=a(h=>{Object.defineProperty(h,"signal",{enumerable:!0,get:a(()=>(this.#a=!0,s.signal),"get")})},"addSignalProperty"),i=a(()=>{let h=Xe(this.options,e),u=a(()=>{let l={client:this.#n,queryKey:this.queryKey,meta:this.meta};return r(l),l},"createQueryFnContext")();return this.#a=!1,this.options.persister?this.options.persister(h,u,this):h(u)},"fetchFn"),o=a(()=>{let h={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#n,state:this.state,fetchFn:i};return r(h),h},"createFetchContext")();(this.#e==="infinite"?sr(this.options.pages):this.options.behavior)?.onFetch(o,this),this.#s=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==o.fetchOptions?.meta)&&this.#c({type:"fetch",meta:o.fetchOptions?.meta}),this.#i=et({initialPromise:e?.initialPromise,fn:o.fetchFn,onCancel:a(h=>{h instanceof Ze&&h.revert&&this.setState({...this.#s,fetchStatus:"idle"}),s.abort()},"onCancel"),onFail:a((h,d)=>{this.#c({type:"failed",failureCount:h,error:d})},"onFail"),onPause:a(()=>{this.#c({type:"pause"})},"onPause"),onContinue:a(()=>{this.#c({type:"continue"})},"onContinue"),retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:a(()=>!0,"canRun")});try{let h=await this.#i.start();if(h===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(h),this.#r.config.onSuccess?.(h,this),this.#r.config.onSettled?.(h,this.state.error,this),h}catch(h){if(h instanceof Ze){if(h.silent)return this.#i.promise;if(h.revert){if(this.state.data===void 0)throw h;return this.state.data}}throw this.#c({type:"error",error:h}),this.#r.config.onError?.(h,this),this.#r.config.onSettled?.(this.state.data,h,this),h}finally{this.scheduleGc()}}#c(t){let e=a(s=>{switch(t.type){case"failed":return{...s,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...Qt(s.data,this.options),fetchMeta:t.meta??null};case"success":let r={...s,...rr(t.data,t.dataUpdatedAt),dataUpdateCount:s.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#s=t.manual?r:void 0,r;case"error":let i=t.error;return{...s,error:i,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...t.state}}},"reducer");this.state=e(this.state),C.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:t})})}};function Qt(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:_t(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}a(Qt,"fetchState");function rr(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}a(rr,"successState");function ir(t){let e=typeof t.initialData=="function"?t.initialData():t.initialData,s=e!==void 0,r=s?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:s?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}a(ir,"getDefaultState");var Ut=class extends j{static{a(this,"QueryObserver")}constructor(t,e){super(),this.options=e,this.#e=t,this.#a=null,this.#o=Me(),this.bindMethods(),this.setOptions(e)}#e;#t=void 0;#s=void 0;#r=void 0;#n;#i;#o;#a;#u;#c;#f;#d;#l;#h;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),ar(this.#t,this.options)?this.#p():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Dt(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Dt(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#w(),this.#S(),this.#t.removeObserver(this)}setOptions(t){let e=this.options,s=this.#t;if(this.options=this.#e.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof x(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#C(),this.#t.setOptions(this.options),e._defaulted&&!fe(this.options,e)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});let r=this.hasListeners();r&&or(this.#t,s,this.options,e)&&this.#p(),this.updateResult(),r&&(this.#t!==s||x(this.options.enabled,this.#t)!==x(e.enabled,this.#t)||B(this.options.staleTime,this.#t)!==B(e.staleTime,this.#t))&&this.#y();let i=this.#v();r&&(this.#t!==s||x(this.options.enabled,this.#t)!==x(e.enabled,this.#t)||i!==this.#h)&&this.#g(i)}getOptimisticResult(t){let e=this.#e.getQueryCache().build(this.#e,t),s=this.createResult(e,t);return Ma(this,s)&&(this.#r=s,this.#i=this.options,this.#n=this.#t.state),s}getCurrentResult(){return this.#r}trackResult(t,e){return new Proxy(t,{get:a((s,r)=>(this.trackProp(r),e?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#o.status==="pending"&&this.#o.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(s,r)),"get")})}trackProp(t){this.#m.add(t)}getCurrentQuery(){return this.#t}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let e=this.#e.defaultQueryOptions(t),s=this.#e.getQueryCache().build(this.#e,e);return s.fetch().then(()=>this.createResult(s,e))}fetch(t){return this.#p({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#p(t){this.#C();let e=this.#t.fetch(this.options,t);return t?.throwOnError||(e=e.catch(O)),e}#y(){this.#w();let t=B(this.options.staleTime,this.#t);if(Y.isServer()||this.#r.isStale||!Ae(t))return;let s=Ve(this.#r.dataUpdatedAt,t)+1;this.#d=V.setTimeout(()=>{this.#r.isStale||this.updateResult()},s)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#g(t){this.#S(),this.#h=t,!(Y.isServer()||x(this.options.enabled,this.#t)===!1||!Ae(this.#h)||this.#h===0)&&(this.#l=V.setInterval(()=>{(this.options.refetchIntervalInBackground||pe.isFocused())&&this.#p()},this.#h))}#b(){this.#y(),this.#g(this.#v())}#w(){this.#d!==void 0&&(V.clearTimeout(this.#d),this.#d=void 0)}#S(){this.#l!==void 0&&(V.clearInterval(this.#l),this.#l=void 0)}createResult(t,e){let s=this.#t,r=this.options,i=this.#r,n=this.#n,o=this.#i,h=t!==s?t.state:this.#s,{state:d}=t,u={...d},l=!1,p;if(e._optimisticResults){let F=this.hasListeners(),R=!F&&ar(t,e),Z=F&&or(t,s,e,r);(R||Z)&&(u={...u,...Qt(d.data,t.options)}),e._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:f,errorUpdatedAt:y,status:m}=u;p=u.data;let g=!1;if(e.placeholderData!==void 0&&p===void 0&&m==="pending"){let F;i?.isPlaceholderData&&e.placeholderData===o?.placeholderData?(F=i.data,g=!0):F=typeof e.placeholderData=="function"?e.placeholderData(this.#f?.state.data,this.#f):e.placeholderData,F!==void 0&&(m="success",p=Pe(i?.data,F,e),l=!0)}if(e.select&&p!==void 0&&!g)if(i&&p===n?.data&&e.select===this.#u)p=this.#c;else try{this.#u=e.select,p=e.select(p),p=Pe(i?.data,p,e),this.#c=p,this.#a=null}catch(F){this.#a=F}this.#a&&(f=this.#a,p=this.#c,y=Date.now(),m="error");let w=u.fetchStatus==="fetching",k=m==="pending",E=m==="error",S=k&&w,I=p!==void 0,L={status:m,fetchStatus:u.fetchStatus,isPending:k,isSuccess:m==="success",isError:E,isInitialLoading:S,isLoading:S,data:p,dataUpdatedAt:u.dataUpdatedAt,error:f,errorUpdatedAt:y,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:u.dataUpdateCount>h.dataUpdateCount||u.errorUpdateCount>h.errorUpdateCount,isFetching:w,isRefetching:w&&!k,isLoadingError:E&&!I,isPaused:u.fetchStatus==="paused",isPlaceholderData:l,isRefetchError:E&&I,isStale:Ht(t,e),refetch:this.refetch,promise:this.#o,isEnabled:x(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){let F=L.data!==void 0,R=L.status==="error"&&!F,Z=a(Be=>{R?Be.reject(L.error):F&&Be.resolve(L.data)},"finalizeThenableIfPossible"),Rs=a(()=>{let Be=this.#o=L.promise=Me();Z(Be)},"recreateThenable"),qe=this.#o;switch(qe.status){case"pending":t.queryHash===s.queryHash&&Z(qe);break;case"fulfilled":(R||L.data!==qe.value)&&Rs();break;case"rejected":(!R||L.error!==qe.reason)&&Rs();break}}return L}updateResult(){let t=this.#r,e=this.createResult(this.#t,this.options);if(this.#n=this.#t.state,this.#i=this.options,this.#n.data!==void 0&&(this.#f=this.#t),fe(e,t))return;this.#r=e;let s=a(()=>{if(!t)return!0;let{notifyOnChangeProps:r}=this.options,i=typeof r=="function"?r():r;if(i==="all"||!i&&!this.#m.size)return!0;let n=new Set(i??this.#m);return this.options.throwOnError&&n.add("error"),Object.keys(this.#r).some(o=>{let c=o;return this.#r[c]!==t[c]&&n.has(c)})},"shouldNotifyListeners");this.#k({listeners:s()})}#C(){let t=this.#e.getQueryCache().build(this.#e,this.options);if(t===this.#t)return;let e=this.#t;this.#t=t,this.#s=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#k(t){C.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function Pa(t,e){return x(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&x(e.retryOnMount,t)===!1)}a(Pa,"shouldLoadOnMount");function ar(t,e){return Pa(t,e)||t.state.data!==void 0&&Dt(t,e,e.refetchOnMount)}a(ar,"shouldFetchOnMount");function Dt(t,e,s){if(x(e.enabled,t)!==!1&&B(e.staleTime,t)!=="static"){let r=typeof s=="function"?s(t):s;return r==="always"||r!==!1&&Ht(t,e)}return!1}a(Dt,"shouldFetchOn");function or(t,e,s,r){return(t!==e||x(r.enabled,t)===!1)&&(!s.suspense||t.state.status!=="error")&&Ht(t,s)}a(or,"shouldFetchOptionally");function Ht(t,e){return x(e.enabled,t)!==!1&&t.isStaleByTime(B(e.staleTime,t))}a(Ht,"isStale");function Ma(t,e){return!fe(t.getCurrentResult(),e)}a(Ma,"shouldAssignObserverCurrentProperties");var cr=class extends tt{static{a(this,"Mutation")}#e;#t;#s;#r;constructor(t){super(),this.#e=t.client,this.mutationId=t.mutationId,this.#s=t.mutationCache,this.#t=[],this.state=t.state||Nt(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#t.includes(t)||(this.#t.push(t),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#t=this.#t.filter(e=>e!==t),this.scheduleGc(),this.#s.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#s.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(t){let e=a(()=>{this.#n({type:"continue"})},"onContinue"),s={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=et({fn:a(()=>this.options.mutationFn?this.options.mutationFn(t,s):Promise.reject(new Error("No mutationFn found")),"fn"),onFail:a((n,o)=>{this.#n({type:"failed",failureCount:n,error:o})},"onFail"),onPause:a(()=>{this.#n({type:"pause"})},"onPause"),onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:a(()=>this.#s.canRun(this),"canRun")});let r=this.state.status==="pending",i=!this.#r.canStart();try{if(r)e();else{this.#n({type:"pending",variables:t,isPaused:i}),this.#s.config.onMutate&&await this.#s.config.onMutate(t,this,s);let o=await this.options.onMutate?.(t,s);o!==this.state.context&&this.#n({type:"pending",context:o,variables:t,isPaused:i})}let n=await this.#r.start();return await this.#s.config.onSuccess?.(n,t,this.state.context,this,s),await this.options.onSuccess?.(n,t,this.state.context,s),await this.#s.config.onSettled?.(n,null,this.state.variables,this.state.context,this,s),await this.options.onSettled?.(n,null,t,this.state.context,s),this.#n({type:"success",data:n}),n}catch(n){try{await this.#s.config.onError?.(n,t,this.state.context,this,s)}catch(o){Promise.reject(o)}try{await this.options.onError?.(n,t,this.state.context,s)}catch(o){Promise.reject(o)}try{await this.#s.config.onSettled?.(void 0,n,this.state.variables,this.state.context,this,s)}catch(o){Promise.reject(o)}try{await this.options.onSettled?.(void 0,n,t,this.state.context,s)}catch(o){Promise.reject(o)}throw this.#n({type:"error",error:n}),n}finally{this.#s.runNext(this)}}#n(t){let e=a(s=>{switch(t.type){case"failed":return{...s,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...s,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:t.error,failureCount:s.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}},"reducer");this.state=e(this.state),C.batch(()=>{this.#t.forEach(s=>{s.onMutationUpdate(t)}),this.#s.notify({mutation:this,type:"updated",action:t})})}};function Nt(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}a(Nt,"getDefaultState");var hr=class extends j{static{a(this,"MutationCache")}constructor(t={}){super(),this.config=t,this.#e=new Set,this.#t=new Map,this.#s=0}#e;#t;#s;build(t,e,s){let r=new cr({client:t,mutationCache:this,mutationId:++this.#s,options:t.defaultMutationOptions(e),state:s});return this.add(r),r}add(t){this.#e.add(t);let e=st(t);if(typeof e=="string"){let s=this.#t.get(e);s?s.push(t):this.#t.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#e.delete(t)){let e=st(t);if(typeof e=="string"){let s=this.#t.get(e);if(s)if(s.length>1){let r=s.indexOf(t);r!==-1&&s.splice(r,1)}else s[0]===t&&this.#t.delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){let e=st(t);if(typeof e=="string"){let r=this.#t.get(e)?.find(i=>i.state.status==="pending");return!r||r===t}else return!0}runNext(t){let e=st(t);return typeof e=="string"?this.#t.get(e)?.find(r=>r!==t&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){C.batch(()=>{this.#e.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(t){let e={exact:!0,...t};return this.getAll().find(s=>Ye(e,s))}findAll(t={}){return this.getAll().filter(e=>Ye(t,e))}notify(t){C.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){let t=this.getAll().filter(e=>e.state.isPaused);return C.batch(()=>Promise.all(t.map(e=>e.continue().catch(O))))}};function st(t){return t.options.scope?.id}a(st,"scopeFor");var Kt=class extends j{static{a(this,"MutationObserver")}#e;#t=void 0;#s;#r;constructor(t,e){super(),this.#e=t,this.setOptions(e),this.bindMethods(),this.#n()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){let e=this.options;this.options=this.#e.defaultMutationOptions(t),fe(this.options,e)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#s,observer:this}),e?.mutationKey&&this.options.mutationKey&&J(e.mutationKey)!==J(this.options.mutationKey)?this.reset():this.#s?.state.status==="pending"&&this.#s.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#s?.removeObserver(this)}onMutationUpdate(t){this.#n(),this.#i(t)}getCurrentResult(){return this.#t}reset(){this.#s?.removeObserver(this),this.#s=void 0,this.#n(),this.#i()}mutate(t,e){return this.#r=e,this.#s?.removeObserver(this),this.#s=this.#e.getMutationCache().build(this.#e,this.options),this.#s.addObserver(this),this.#s.execute(t)}#n(){let t=this.#s?.state??Nt();this.#t={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#i(t){C.batch(()=>{if(this.#r&&this.hasListeners()){let e=this.#t.variables,s=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#r.onSuccess?.(t.data,e,s,r)}catch(i){Promise.reject(i)}try{this.#r.onSettled?.(t.data,null,e,s,r)}catch(i){Promise.reject(i)}}else if(t?.type==="error"){try{this.#r.onError?.(t.error,e,s,r)}catch(i){Promise.reject(i)}try{this.#r.onSettled?.(void 0,t.error,e,s,r)}catch(i){Promise.reject(i)}}}this.listeners.forEach(e=>{e(this.#t)})})}};var ur=class extends j{static{a(this,"QueryCache")}constructor(t={}){super(),this.config=t,this.#e=new Map}#e;build(t,e,s){let r=e.queryKey,i=e.queryHash??Fe(r,e),n=this.get(i);return n||(n=new nr({client:t,queryKey:r,queryHash:i,options:t.defaultQueryOptions(e),state:s,defaultOptions:t.getQueryDefaults(r)}),this.add(n)),n}add(t){this.#e.has(t.queryHash)||(this.#e.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){let e=this.#e.get(t.queryHash);e&&(t.destroy(),e===t&&this.#e.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){C.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#e.get(t)}getAll(){return[...this.#e.values()]}find(t){let e={exact:!0,...t};return this.getAll().find(s=>Je(e,s))}findAll(t={}){let e=this.getAll();return Object.keys(t).length>0?e.filter(s=>Je(t,s)):e}notify(t){C.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){C.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){C.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}};var jt=class{static{a(this,"QueryClient")}#e;#t;#s;#r;#n;#i;#o;#a;constructor(t={}){this.#e=t.queryCache||new ur,this.#t=t.mutationCache||new hr,this.#s=t.defaultOptions||{},this.#r=new Map,this.#n=new Map,this.#i=0}mount(){this.#i++,this.#i===1&&(this.#o=pe.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#a=ve.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#i--,this.#i===0&&(this.#o?.(),this.#o=void 0,this.#a?.(),this.#a=void 0)}isFetching(t){return this.#e.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#t.findAll({...t,status:"pending"}).length}getQueryData(t){let e=this.defaultQueryOptions({queryKey:t});return this.#e.get(e.queryHash)?.state.data}ensureQueryData(t){let e=this.defaultQueryOptions(t),s=this.#e.build(this,e),r=s.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&s.isStaleByTime(B(e.staleTime,s))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return this.#e.findAll(t).map(({queryKey:e,state:s})=>{let r=s.data;return[e,r]})}setQueryData(t,e,s){let r=this.defaultQueryOptions({queryKey:t}),n=this.#e.get(r.queryHash)?.state.data,o=Vs(e,n);if(o!==void 0)return this.#e.build(this,r).setData(o,{...s,manual:!0})}setQueriesData(t,e,s){return C.batch(()=>this.#e.findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,s)]))}getQueryState(t){let e=this.defaultQueryOptions({queryKey:t});return this.#e.get(e.queryHash)?.state}removeQueries(t){let e=this.#e;C.batch(()=>{e.findAll(t).forEach(s=>{e.remove(s)})})}resetQueries(t,e){let s=this.#e;return C.batch(()=>(s.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){let s={revert:!0,...e},r=C.batch(()=>this.#e.findAll(t).map(i=>i.cancel(s)));return Promise.all(r).then(O).catch(O)}invalidateQueries(t,e={}){return C.batch(()=>(this.#e.findAll(t).forEach(s=>{s.invalidate()}),t?.refetchType==="none"?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e)))}refetchQueries(t,e={}){let s={...e,cancelRefetch:e.cancelRefetch??!0},r=C.batch(()=>this.#e.findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let n=i.fetch(void 0,s);return s.throwOnError||(n=n.catch(O)),i.state.fetchStatus==="paused"?Promise.resolve():n}));return Promise.all(r).then(O)}fetchQuery(t){let e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);let s=this.#e.build(this,e);return s.isStaleByTime(B(e.staleTime,s))?s.fetch(e):Promise.resolve(s.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(O).catch(O)}fetchInfiniteQuery(t){return t._type="infinite",this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(O).catch(O)}ensureInfiniteQueryData(t){return t._type="infinite",this.ensureQueryData(t)}resumePausedMutations(){return ve.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#s}setDefaultOptions(t){this.#s=t}setQueryDefaults(t,e){this.#r.set(J(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){let e=[...this.#r.values()],s={};return e.forEach(r=>{ae(t,r.queryKey)&&Object.assign(s,r.defaultOptions)}),s}setMutationDefaults(t,e){this.#n.set(J(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){let e=[...this.#n.values()],s={};return e.forEach(r=>{ae(t,r.mutationKey)&&Object.assign(s,r.defaultOptions)}),s}defaultQueryOptions(t){if(t._defaulted)return t;let e={...this.#s.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Fe(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===me&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#s.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};var oe=U(ne(),1);var Le=U(ne(),1),La=U(Ot(),1);function xa(){let t=!1;return{clearReset:a(()=>{t=!1},"clearReset"),reset:a(()=>{t=!0},"reset"),isReset:a(()=>t,"isReset")}}a(xa,"createValue");var _a=Le.createContext(xa()),dr=a(()=>Le.useContext(_a),"useQueryErrorResetBoundary");var lr=U(ne(),1);var pr=a((t,e,s)=>{let r=s?.state.error&&typeof t.throwOnError=="function"?ye(t.throwOnError,[s.state.error,s]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},"ensurePreventErrorBoundaryRetry"),fr=a(t=>{lr.useEffect(()=>{t.clearReset()},[t])},"useClearResetErrorBoundary"),mr=a(({result:t,errorResetBoundary:e,throwOnError:s,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||ye(s,[t.error,r])),"getHasError");var rt=U(ne(),1);var yr=rt.createContext(!1),vr=a(()=>rt.useContext(yr),"useIsRestoring"),Jd=yr.Provider;var gr=a(t=>{if(t.suspense){let s=a(i=>i==="static"?i:Math.max(i??1e3,1e3),"clamp"),r=t.staleTime;t.staleTime=typeof r=="function"?(...i)=>s(r(...i)):s(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},"ensureSuspenseTimers"),br=a((t,e)=>t.isLoading&&t.isFetching&&!e,"willFetch"),wr=a((t,e)=>t?.suspense&&e.isPending,"shouldSuspend"),qt=a((t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()}),"fetchOptimistic");function Sr(t,e,s){let r=vr(),i=dr(),n=Re(s),o=n.defaultQueryOptions(t);n.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let c=n.getQueryCache().get(o.queryHash),h=t.subscribed!==!1;o._optimisticResults=r?"isRestoring":h?"optimistic":void 0,gr(o),pr(o,i,c),fr(i);let d=!n.getQueryCache().get(o.queryHash),[u]=oe.useState(()=>new e(n,o)),l=u.getOptimisticResult(o),p=!r&&h;if(oe.useSyncExternalStore(oe.useCallback(f=>{let y=p?u.subscribe(C.batchCalls(f)):O;return u.updateResult(),y},[u,p]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),oe.useEffect(()=>{u.setOptions(o)},[o,u]),wr(o,l))throw qt(o,u,i);if(mr({result:l,errorResetBoundary:i,throwOnError:o.throwOnError,query:c,suspense:o.suspense}))throw l.error;return n.getDefaultOptions().queries?._experimental_afterQuery?.(o,l),o.experimental_prefetchInRender&&!Y.isServer()&&br(l,r)&&(d?qt(o,u,i):c?.promise)?.catch(O).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?l:u.trackResult(l)}a(Sr,"useBaseQuery");function Qa(t,e){return Sr(t,Ut,e)}a(Qa,"useQuery");var ee=U(ne(),1);function Da(t,e){let s=Re(e),[r]=ee.useState(()=>new Kt(s,t));ee.useEffect(()=>{r.setOptions(t)},[r,t]);let i=ee.useSyncExternalStore(ee.useCallback(o=>r.subscribe(C.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),n=ee.useCallback((o,c)=>{r.mutate(o,c).catch(O)},[r]);if(i.error&&ye(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:n,mutateAsync:i.mutate}}a(Da,"useMutation");var te="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",Bt=a(t=>{let e="",s=0,r=t.length-2;for(;s<r;s+=3){let n=t[s]<<16|t[s+1]<<8|t[s+2];e+=te.charAt(n>>18&63)+te.charAt(n>>12&63)+te.charAt(n>>6&63)+te.charAt(n&63)}let i=t.length-s;if(i===1){let n=t[s]<<16;e+=te.charAt(n>>18&63)+te.charAt(n>>12&63)}else if(i===2){let n=t[s]<<16|t[s+1]<<8;e+=te.charAt(n>>18&63)+te.charAt(n>>12&63)+te.charAt(n>>6&63)}return e},"A");var Ua=a(t=>{if(t===null||typeof t!="object")return!1;let e=Object.getPrototypeOf(t);return e===null||e===Object.prototype},"l"),Ha="_id",Wt="_creationTime",$t="page",Cr="pageDelta",Na=a(t=>{if(Array.isArray(t))return t;if(Ua(t)&&Array.isArray(t[$t]))return t[$t]},"y"),Ka=a(t=>{let e;for(let s of t){let r=s[Wt];if(typeof r=="number"){if(e!==void 0){if(r<e)return!0;if(r>e)return!1}e=r}}return!1},"g"),ja=a((t,e)=>{let s=e[Wt];if(typeof s!="number")return t.length;let r=Ka(t);for(let[i,n]of t.entries()){let o=n[Wt];if(typeof o=="number"&&(r?o<s:o>s))return i}return t.length},"A"),qa=a(t=>{if(typeof t!="object"||t===null)return;let e=t[Ha];return typeof e=="string"?e:void 0},"b"),Ba=a(t=>{if(typeof t!="object"||t===null)return!1;let e=t;return typeof e.key=="string"&&typeof e.table=="string"&&(e.op==="insert"||e.op==="update"||e.op==="delete")},"D"),Wa=a((t,e)=>{let{key:s,op:r,row:i}=e,n=[],o=-1;for(let c of t){let h=qa(c);if(h===void 0)return;if(h===s){if(r==="delete")continue;o===-1&&(o=n.length)}n.push(c)}if(r==="delete")return n;if(i!==void 0)return o===-1?n.splice(ja(n,i),0,i):n[o]=i,n},"x"),$a=a((t,e)=>{let s=Na(t);if(s===void 0)return;let r=Wa(s,e);return r===void 0||Array.isArray(t)?r:{...t,[$t]:r}},"E"),zt=Symbol("lunora.unmergeableDelta"),kr=a((t,e)=>{if("data"in t&&t.data!==void 0)return T(t.data);let s=T(t.delta);return Ba(s)?e===void 0?s:$a(e,s)??zt:s},"m");var Tr=a(()=>{let t=null;return{get:a(()=>t,"get"),set:a(e=>{t=e},"set")}},"r");var Pl=new Set(Object.keys(As)),N=class extends v{static{a(this,"R")}constructor(e,s){super("INTERNAL",e,{data:s})}};var it=a(t=>{let e=t?.data?.retryAfterMs;return typeof e=="number"&&Number.isFinite(e)?e:void 0},"f"),Gt=new Set(["TOKEN_EXPIRED","UNAUTHENTICATED"]),xe=a(t=>Gt.has(t?.code??""),"u");var _e=a(t=>typeof t=="string"||Array.isArray(t)&&t.every(e=>typeof e=="string")?{hint:t}:{},"n");var Vt=a(t=>{if(t===null)return;let e=Number(t);if(Number.isFinite(e))return e>0?e*1e3:void 0;let s=Date.parse(t);if(Number.isNaN(s))return;let r=s-Date.now();return r>0?r:void 0},"v"),za=a((t,e)=>{let s=Vt(e);if(!(s===void 0||it(t)!==void 0))return t.data===void 0?{retryAfterMs:s}:typeof t.data=="object"&&t.data!==null&&!Array.isArray(t.data)?{...t.data,retryAfterMs:s}:void 0},"p"),ge=a(t=>{let e=t?.error;if(typeof e!="object"||e===null||Array.isArray(e))return;let{why:s,...r}=e;return typeof s=="string"?{...r,why:s}:r},"y"),Jt=a(()=>new N("LunoraClient: batch slot carried no error envelope"),"E"),Or=a((t,e)=>{let s=t.error,r=typeof s?.code=="string"?s.code:void 0,i=typeof s?.message=="string"?s.message:void 0;return{code:r,messageText:(typeof t.message=="string"?t.message:void 0)??i??e}},"c"),Er=a(t=>{let{code:e,messageText:s}=Or(t,"stream error"),r=t.error,i=r?.why,n=e===void 0?new Error(s):new v(e,s,_e(r?.hint));return typeof i=="string"&&(n.why=i),n},"D"),Yt=a(t=>{let{code:e,messageText:s}=Or(t,"subscription error"),r=t.error,i=typeof r?.why=="string"?{why:r.why}:{};return{message:s,...e===void 0?{}:{code:e},..._e(r?.hint),...i}},"O"),Ga=Symbol.for("lunora.serverVerdict"),be=a(t=>{let e=new Error(t.message??"request failed");if(e.code=t.code,e[Ga]=!0,t.data!==void 0)try{e.data=T(t.data)}catch{}return t.hint!==void 0&&(e.hint=t.hint),t.docsUrl!==void 0&&(e.docsUrl=t.docsUrl),typeof t.why=="string"&&(e.why=t.why),e},"d"),Va=a(t=>Object.freeze(Object.fromEntries([...t].filter(([e])=>e!=="set-cookie"))),"b"),K=a((t,e)=>Object.defineProperty(t,"headers",{value:Va(e)}),"w"),Xt=a((t,e)=>{let s=be(t),r=za(s,e.get("retry-after"));return r!==void 0&&(s.data=r),K(s,e)},"j"),Zt=a(t=>{let e=ge(t);return e===void 0?Jt():be(e)},"M"),Ir=new WeakSet,nt=a(t=>{let e=new v("WIRE_DECODE_FAILED",`LunoraClient: the call succeeded but its result could not be decoded (a mutation has still committed) \u2014 ${t instanceof Error?t.message:String(t)}`,{cause:t});return Ir.add(e),e},"N"),Qe=a(t=>t instanceof Error&&Ir.has(t),"T");var at=class{static{a(this,"u")}values=new Map;subscribers=new Map;get(e){return this.values.has(e.key)?this.values.get(e.key):e.defaultValue}set(e,s){if(s===void 0){this.reset(e);return}this.values.set(e.key,s),this.notify(e.key,s)}reset(e){this.values.delete(e.key),this.notify(e.key,e.defaultValue)}clear(){this.values.clear(),this.subscribers.clear()}subscribe(e,s){let r=this.subscribers.get(e.key);return r||(r=new Set,this.subscribers.set(e.key,r)),r.add(s),()=>{r.delete(s),r.size===0&&this.subscribers.delete(e.key)}}notify(e,s){let r=this.subscribers.get(e);if(r)for(let i of r)try{i(s)}catch{}}};var ot=a(t=>t===void 0||t===""?"":`&bucket=${encodeURIComponent(t)}`,"a"),es=a(t=>t.startsWith("https://")?`wss://${t.slice(8)}`:t.startsWith("http://")?`ws://${t.slice(7)}`:t,"h"),_=a((t,e)=>`${t.endsWith("/")?t.slice(0,-1):t}${e}`,"$"),M=a((t,e)=>{let s=new URLSearchParams;for(let[i,n]of Object.entries(e))n!==void 0&&n!==""&&s.set(i,String(n));let r=s.toString();return r===""?t:`${t}?${r}`},"d"),Ja="http://same-origin.invalid",De=a(t=>new URL(t,Ja),"p"),Ya=/^[a-z][a-z\d+.-]*:/iu,ts=a((t,e)=>{if(Ya.test(e))return t.toString();let s=`${t.pathname}${t.search}${t.hash}`;return e.startsWith("//")?`//${t.host}${s}`:s},"S");var ss=0,we,Rr=a((t,e)=>{for(let s of t)try{s(e)}catch{}},"f"),Xa=a(t=>{let e=[...t.callbacks],s=t.lastValue;return()=>{for(let r of e){if(t.lastValue!==s)return;t.callbacks.has(r)&&Rr([r],s)}}},"p"),Ar=a(t=>{we===void 0?t():we.add(t)},"k"),Fr=a(()=>ss,"L"),Za=a((t,e)=>{let s=t;for(let r of e)try{s=r.transform(s)}catch{}return s},"y"),Pr=a((t,e)=>{e!==t.lastValue&&(t.lastValue=e,we===void 0?Rr(t.callbacks,e):we.add(t))},"d"),ct=a((t,e=()=>!0)=>{let s=new Set;we=s;try{t()}finally{we=void 0;let r=[...s].map(i=>typeof i=="function"?i:Xa(i));for(let i of r){if(!e())break;try{i()}catch{}}}},"v"),W=a((t,e)=>{Pr(t,Za(e,t.optimisticLayers))},"m"),ht=a((t,e)=>{let s;try{s=e(t.lastValue)}catch{return}let r={id:Symbol("optimistic"),transform:e},i=!1;t.optimisticLayers.push(r),Pr(t,s);let n=a(()=>{let c=t.optimisticLayers.findIndex(h=>h.id===r.id);return c===-1?!1:(t.optimisticLayers.splice(c,1),!0)},"s"),o=a(()=>{W(t,t.serverBase)},"a");return{confirm:a(c=>{if(c===void 0){n();return}r.commitCursor=c,ss+=1,r.acknowledgedAt=ss,t.serverCursor!==void 0&&t.serverCursor>=c&&n()&&o()},"confirm"),rollback:a(()=>{i||(i=!0,n(),o())},"rollback")}},"b"),ut=a((t,e)=>{if(e===void 0||t.optimisticLayers.length===0)return!1;let s=t.optimisticLayers.length;return t.optimisticLayers=t.optimisticLayers.filter(r=>r.commitCursor===void 0||r.commitCursor>e),t.optimisticLayers.length!==s},"h"),Mr=a((t,e)=>{t.optimisticLayers.length!==0&&(t.optimisticLayers=t.optimisticLayers.filter(s=>s.acknowledgedAt===void 0||s.acknowledgedAt>e))},"g"),he=a(t=>{for(let e=t.length-1;e>=0;e-=1)t[e]?.()},"w");var Lr=0,eo="lunora-bridge",to=1e3,so=3e3,dt=class{static{a(this,"p")}bc;tabId;heartbeatInterval;leaderTimeout;knownLeader=void 0;leader=!1;running=!1;promotionPending=!1;lastHeartbeat=0;pendingData=new Map;heldData=new Map;heartbeatTimer=void 0;leaderCheckTimer=void 0;onBecomeLeader;onStopBeingLeader;onConnectionStatus;onSubscriptionData;onLeaderClaimAnswered;onSubscriptionError;onSubscriptionSettled;constructor(e={}){if(Lr+=1,this.tabId=`tab_${String(Lr)}_${crypto.randomUUID()}`,this.heartbeatInterval=e.heartbeatInterval??to,this.leaderTimeout=e.leaderTimeout??so,this.onBecomeLeader=e.onBecomeLeader,this.onStopBeingLeader=e.onStopBeingLeader,this.onConnectionStatus=e.onConnectionStatus,this.onSubscriptionData=e.onSubscriptionData,this.onLeaderClaimAnswered=e.onLeaderClaimAnswered,this.onSubscriptionError=e.onSubscriptionError,this.onSubscriptionSettled=e.onSubscriptionSettled,typeof BroadcastChannel>"u"){this.bc=void 0;return}this.bc=new BroadcastChannel(e.channelName??eo),this.bc.addEventListener("message",s=>{this.handleMessage(s.data)})}start(){if(!this.running){if(this.running=!0,this.bc===void 0){this.becomeLeader();return}this.broadcast({type:"claim-leadership",tabId:this.tabId,ts:Date.now()}),setTimeout(()=>{this.running&&this.knownLeader===void 0&&this.becomeLeader()},this.leaderTimeout),this.leaderCheckTimer=setInterval(()=>{this.checkLeaderHealth()},this.leaderTimeout),this.heartbeatTimer=setInterval(()=>{this.sendHeartbeat()},this.heartbeatInterval)}}stop(){this.running=!1,this.leader&&(this.broadcast({type:"yield-leadership",tabId:this.tabId}),this.leader=!1,this.knownLeader=void 0,this.onStopBeingLeader?.()),this.heartbeatTimer!==void 0&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0),this.leaderCheckTimer!==void 0&&(clearInterval(this.leaderCheckTimer),this.leaderCheckTimer=void 0),this.bc?.close()}isLeader(){return this.leader}promoteImmediately(){this.running&&this.becomeLeader()}get leaderTabId(){return this.knownLeader}get id(){return this.tabId}get isRunning(){return this.running}broadcastSubscriptionData(e,s,r,i,n,o){this.leader&&(this.pendingData.size===0&&queueMicrotask(()=>{this.flushPendingData()}),this.pendingData.set(e,{type:"subscription-data",tabId:this.tabId,key:e,data:s,...r===void 0?{}:{cursor:r},...i===void 0?{}:{epoch:i},...n===void 0?{}:{identity:n},...o===void 0?{}:{claims:o}}))}broadcastSubscriptionError(e,s,r,i){this.leader&&this.broadcast({type:"subscription-error",tabId:this.tabId,key:e,error:s,...r===void 0?{}:{identity:r},...i===void 0?{}:{claims:i}})}broadcastSubscriptionSettled(e,s,r,i,n,o,c){this.leader&&this.broadcast({type:"subscription-settled",tabId:this.tabId,key:e,...s===void 0?{}:{cursor:s},...r===void 0?{}:{epoch:r},...i===void 0?{}:{lastMutationId:i},...n===void 0?{}:{clientId:n},...o===void 0?{}:{identity:o},...c===void 0?{}:{claims:c}})}broadcastConnectionStatus(e,s){this.leader&&this.broadcast({type:"connection-status",tabId:this.tabId,status:e,...s===void 0?{}:{identity:s}})}broadcast(e){this.flushPendingData(),this.bc?.postMessage(e)}flushPendingData(){if(this.pendingData.size===0)return;let e=[...this.pendingData.values()];if(this.pendingData.clear(),!this.leader)return;let s,r=!0;for(let[i,n]of e.entries()){let o=i<e.length-1;try{this.bc?.postMessage(o?{...n,more:!0}:n),s=n,r=!o}catch{}}!r&&s!==void 0&&this.bc?.postMessage(s)}applySubscriptionData(e){let s=this.heldData.get(e.tabId)??[];if(s.push(e),e.more===!0){this.heldData.set(e.tabId,s);return}this.heldData.delete(e.tabId),ct(()=>{for(let r of s)this.onSubscriptionData?.(r.key,r.data,r.cursor,r.epoch,r.identity,r.claims)},()=>this.running)}handleMessage(e){switch(e.type){case"claim-leadership":{this.handleClaimLeadership(e);break}case"connection-status":{if(this.leader||e.tabId===this.tabId)break;this.onConnectionStatus?.(e.status,e.identity);break}case"heartbeat":{this.handleHeartbeat(e);break}case"subscription-data":{if(this.leader||e.tabId===this.tabId)break;this.applySubscriptionData(e);break}case"subscription-error":{if(this.leader||e.tabId===this.tabId)break;this.onSubscriptionError?.(e.key,e.error,e.identity,e.claims);break}case"subscription-settled":{if(this.leader||e.tabId===this.tabId)break;this.onSubscriptionSettled?.(e.key,e.cursor,e.epoch,e.lastMutationId,e.clientId,e.identity,e.claims);break}case"yield-leadership":{this.heldData.delete(e.tabId),this.knownLeader===e.tabId&&(this.knownLeader=void 0,this.running&&!this.leader&&this.claimAndPromote());break}}}handleClaimLeadership(e){if(e.tabId!==this.tabId){if(this.leader){this.broadcast({type:"heartbeat",tabId:this.tabId,ts:Date.now()}),this.onLeaderClaimAnswered?.();return}this.knownLeader===void 0&&e.tabId<this.tabId&&(this.knownLeader=e.tabId,this.lastHeartbeat=e.ts)}}handleHeartbeat(e){if(e.tabId!==this.tabId){if(this.leader){this.resolveLeaderVsLeaderTieBreak(e);return}this.lastHeartbeat=e.ts,this.knownLeader=e.tabId}}resolveLeaderVsLeaderTieBreak(e){e.tabId<this.tabId?(this.leader=!1,this.knownLeader=e.tabId,this.lastHeartbeat=e.ts,this.onStopBeingLeader?.()):this.broadcast({type:"heartbeat",tabId:this.tabId,ts:Date.now()})}becomeLeader(){this.leader||(this.leader=!0,this.knownLeader=this.tabId,this.lastHeartbeat=Date.now(),this.onBecomeLeader?.(),this.broadcast({type:"heartbeat",tabId:this.tabId,ts:Date.now()}))}sendHeartbeat(){this.leader&&this.broadcast({type:"heartbeat",tabId:this.tabId,ts:Date.now()})}checkLeaderHealth(){if(!(!this.running||this.leader)){if(this.knownLeader===void 0){this.claimAndPromote();return}Date.now()-this.lastHeartbeat>this.leaderTimeout&&(this.heldData.delete(this.knownLeader),this.knownLeader=void 0,this.claimAndPromote())}}claimAndPromote(){this.promotionPending||(this.promotionPending=!0,this.broadcast({type:"claim-leadership",tabId:this.tabId,ts:Date.now()}),setTimeout(()=>{this.promotionPending=!1,this.running&&this.knownLeader===void 0&&this.becomeLeader()},this.leaderTimeout))}};var Ue=a((t={},e=Math.random)=>{let s=t.initialDelayMs??250,r=t.maxDelayMs??3e4,i=t.jitter??!0,n=0;return{next(){let o=Math.min(r,s*2**n);if(n+=1,!i)return o;let c=o/2;return Math.floor(c+e()*(o-c))},reset(){n=0}}},"s");var ro=1024,lt=a(t=>{let e=t.maxBuffer??ro,s=[],r=[],i=!1,n,o=!1,c=a(()=>{let u=r.shift();if(!u)return!1;if(n)return u.reject(n),!0;if(s.length>0){let l=s.shift();return u.resolve({done:!1,value:l}),!0}return i?(u.resolve({done:!0,value:void 0}),!0):(r.unshift(u),!1)},"u"),h={complete(){if(!(i||n))for(i=!0;c(););},fail(u){if(!(i||n)){for(n=u,s.length=0;c(););t.onFail?.()}},push(u){if(!(i||n||o)){if(s.length>=e){h.fail(new v("STREAM_BACKPRESSURE",`stream buffer overflow (max=${e.toString()}); the consumer cannot keep up with the producer`));return}s.push(u),c()}}},d=a(()=>{if(!o){o=!0,i=!0,s.length=0;try{t.onCancel()}catch{}for(;c(););}},"c");return{handle:h,iterable:{cancel:d,[Symbol.asyncIterator](){return{next(){if(n)return Promise.reject(n);if(s.length>0){let u=s.shift();return Promise.resolve({done:!1,value:u})}return i?Promise.resolve({done:!0,value:void 0}):new Promise((u,l)=>{r.push({reject:l,resolve:u})})},return(){return d(),Promise.resolve({done:!0,value:void 0})}}}}}},"p");var Se=a(t=>t.reason??Object.assign(new Error("The operation was aborted"),{name:"AbortError"}),"c"),ce=a(async(t,e,s,r=()=>new N(`LunoraClient: request timed out after ${t.toString()}ms`))=>{if(e?.aborted)throw Se(e);let i=new AbortController,n=[],o=new Promise((h,d)=>{if(t>0){let u=setTimeout(()=>{d(r()),i.abort()},t);n.push(()=>{clearTimeout(u)})}if(e){let u=a(()=>{i.abort(),d(Se(e))},"a");e.addEventListener("abort",u,{once:!0}),n.push(()=>{e.removeEventListener("abort",u)})}}),c=s(i.signal);c.catch(()=>{});try{return await Promise.race([c,o])}finally{for(let h of n)h()}},"m"),rs=a(async(t,e)=>{if(e===void 0)return t;if(e.aborted)throw t.catch(()=>{}),Se(e);let s=a(()=>{},"o"),r=new Promise((i,n)=>{s=a(()=>{n(Se(e))},"o"),e.addEventListener("abort",s,{once:!0})});t.catch(()=>{});try{return await Promise.race([t,r])}finally{e.removeEventListener("abort",s)}},"E"),xr=a(async(t,e)=>!Number.isFinite(e)||e<=0?t.read():ce(e,void 0,async()=>t.read(),()=>new v("STREAM_IDLE",`stream received nothing for ${e.toString()}ms`)),"y");var pt=/^ /u,io=/^\d+$/u,no=2147483647,ao=10,oo=1e3,_r=a(t=>typeof t=="object"&&t!==null?JSON.stringify(t):String(t),"O"),co=a(t=>{let e="",s,r,i=[];for(let n of t.split(`
2
2
  `))if(n.startsWith("event:"))e=n.slice(6).replace(pt,"");else if(n.startsWith("data:"))i.push(n.slice(5).replace(pt,""));else if(n.startsWith("id:")){let o=n.slice(3).replace(pt,"");o.includes("\0")||(s=o)}else if(n.startsWith("retry:")){let o=n.slice(6).replace(pt,"");io.test(o)&&Number.isSafeInteger(Number(o))&&(r=Math.min(Number(o),no))}return{data:i.join(`
3
3
  `),event:e,id:s,retry:r}},"U"),ho=a((t,e,s)=>{let r=e.params??{},i=t.path.split("/").map(c=>{if(!c.startsWith(":"))return c;let h=c.slice(1),d=r[h];if(d===void 0)throw new v("HTTP_STREAM_MISSING_PARAM",`httpStream: missing path param ":${h}" for route ${t.path}`);return encodeURIComponent(_r(d))}).join("/"),n=new URLSearchParams;for(let[c,h]of Object.entries(e.searchParams??{}))h!==void 0&&n.set(c,_r(h));let o=n.toString();return`${s.endsWith("/")?s.slice(0,-1):s}${i}${o===""?"":`?${o}`}`},"Y"),uo=a((t,e)=>{if(t.event==="complete")return e.complete(t.data),!0;if(t.event==="error"){let s={};try{s=JSON.parse(t.data)}catch{}let r=typeof s.message=="string"?s.message:"stream error",i=typeof s.code=="string"?s.code:"HTTP_STREAM_ERROR",n=new v(i,r,_e(s.hint));return typeof s.why=="string"&&(n.why=s.why),e.fail(n),!0}if((t.event===""||t.event==="message")&&t.data!=="")try{e.push(T(JSON.parse(t.data)))}catch{return e.fail(new v("HTTP_STREAM_BAD_CHUNK","httpStream: malformed SSE chunk (invalid JSON)")),!0}return!1},"J"),Dr=a((t,e)=>{let s="",r=!1,i=a(o=>{let c=r?`\r${o}`:o;r=c.endsWith("\r"),r&&(c=c.slice(0,-1)),s+=c.replaceAll(`\r
4
4
  `,`
@@ -1 +1 @@
1
- import{b as i,j as a}from"./chunk-YUVGMKHG.js";import{a as o}from"./chunk-ZPQBVYNN.js";import{x as n}from"./chunk-BVANRUU4.js";import{a as r}from"./chunk-5PEAXTYQ.js";function s(e){return a(e.defaultTagName??"div",e,e)}r(s,"useRender");var g=o("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-none border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive font-mono text-[11px] tracking-wide uppercase focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline",success:"bg-success/10 text-success font-mono text-[11px] tracking-wide uppercase [a]:hover:bg-success/15 dark:bg-success/15",warning:"bg-warning/10 text-warning font-mono text-[11px] tracking-wide uppercase [a]:hover:bg-warning/15 dark:bg-warning/15",info:"bg-info/10 text-info font-mono text-[11px] tracking-wide uppercase [a]:hover:bg-info/15 dark:bg-info/15"}},defaultVariants:{variant:"default"}});function x({className:e,variant:t="default",render:d,...u}){return s({defaultTagName:"span",props:i({className:n(g({variant:t}),e)},u),render:d,state:{slot:"badge",variant:t}})}r(x,"f");export{s as a,x as b};
1
+ import{b as i,j as a}from"./chunk-YUVGMKHG.js";import{a as o}from"./chunk-ZPQBVYNN.js";import{x as n}from"./chunk-OOOT4H45.js";import{a as r}from"./chunk-5PEAXTYQ.js";function s(e){return a(e.defaultTagName??"div",e,e)}r(s,"useRender");var g=o("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-none border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive font-mono text-[11px] tracking-wide uppercase focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline",success:"bg-success/10 text-success font-mono text-[11px] tracking-wide uppercase [a]:hover:bg-success/15 dark:bg-success/15",warning:"bg-warning/10 text-warning font-mono text-[11px] tracking-wide uppercase [a]:hover:bg-warning/15 dark:bg-warning/15",info:"bg-info/10 text-info font-mono text-[11px] tracking-wide uppercase [a]:hover:bg-info/15 dark:bg-info/15"}},defaultVariants:{variant:"default"}});function x({className:e,variant:t="default",render:d,...u}){return s({defaultTagName:"span",props:i({className:n(g({variant:t}),e)},u),render:d,state:{slot:"badge",variant:t}})}r(x,"f");export{s as a,x as b};
@@ -1,2 +1,2 @@
1
- import{a as fe}from"./chunk-WRP4JGYX.js";import"./chunk-O3AZ7JKE.js";import{a as ie}from"./chunk-UBX5ZPLV.js";import{a as de}from"./chunk-XTU27CFW.js";import"./chunk-D65UVZIA.js";import{i as me}from"./chunk-EU4ZGNNW.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import{a as b}from"./chunk-PACPUEWB.js";import"./chunk-JMZT3CEW.js";import"./chunk-VUOEJJUH.js";import{a as ue}from"./chunk-LJKB6B3H.js";import{b as he}from"./chunk-SVFX7F32.js";import"./chunk-YUVGMKHG.js";import{a as pe}from"./chunk-DK53RZKN.js";import"./chunk-QNWL62VF.js";import"./chunk-2JI25KW2.js";import"./chunk-R47IHY6Y.js";import"./chunk-4PI2OSSP.js";import{a as H}from"./chunk-2W4UO5BC.js";import{c as oe}from"./chunk-RL5SUZ6J.js";import{m as se}from"./chunk-7AJWGPWM.js";import"./chunk-ZPQBVYNN.js";import{B as ce,h as Z,i as ee,j as te,s as ae,v as le,w as re,x as ne}from"./chunk-BVANRUU4.js";import"./chunk-PDBW6GTJ.js";import{a as ve}from"./chunk-GWNGVKLG.js";import{a as ge,b as Ne}from"./chunk-6G3E4PJ2.js";import{a as l,d as Y}from"./chunk-5PEAXTYQ.js";var t=Y(Ne(),1);var be=Y(ve(),1),v=Y(ge(),1);function ye({className:a,orientation:e="horizontal",...s}){return(0,t.jsx)(ie,{"data-slot":"separator",orientation:e,className:ne("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",a),...s})}l(ye,"ge");var we=/https?:\/\/[^\s"'<>)]+/i,xe=l(a=>a===void 0?void 0:we.exec(a)?.[0],"re"),N=l(a=>a===void 0?"":Array.isArray(a)?a.join(", "):a,"v"),Ce=/<a\s(?:[^>]*?\s)?href\s*=\s*["'](https?:\/\/[^"'\s]+)["']/iu,ke=/&(?:amp|#0*38|#x0*26);/giu,Se=l(a=>a===void 0?void 0:((a.html===void 0?void 0:Ce.exec(a.html)?.[1])??xe(a.text)??xe(a.html))?.replaceAll(ke,"&"),"ye"),Te=l((a,e)=>{let s=e.trim().toLowerCase();return s===""?a:a.filter(o=>`${o.subject} ${N(o.to)} ${N(o.cc)}`.toLowerCase().includes(s))},"Ce"),je=l((a,e)=>{if(a.length!==0)return a.find(s=>s.id===e)??a[0]},"Se"),Le=Z(H.clearCapturedMail),_e=Z(H.sendTestMail),Me=l(a=>{let e=(0,be.c)(36),{limit:s}=a,o=se(),p;e[0]!==s?(p={limit:s},e[0]=s,e[1]=p):p=e[1];let{data:I,error:y,errorSource:w,isLoading:g,poll:P,refetch:c}=oe(H.getCapturedMail,p),[C,f]=(0,v.useState)(null),[q,k]=(0,v.useState)(null),[i,h]=(0,v.useState)("html"),[x,B]=(0,v.useState)(""),r=I?.entries??[],m=y??C,D=y===null?C:w,S;e[2]!==o||e[3]!==c?(S=l(async()=>{f(null);try{await o.query(Le,{},ee("")),k(null),c()}catch(d){f(te(d))}},"S"),e[2]=o,e[3]=c,e[4]=S):S=e[4];let R=S,T;e[5]!==o||e[6]!==c?(T=l(async()=>{f(null);try{await o.query(_e,{},ee("")),c()}catch(d){f(te(d))}},"T"),e[5]=o,e[6]=c,e[7]=T):T=e[7];let Q=T;de(P,!0);let j;e[8]!==R?(j=l(()=>{ae(R())},"k"),e[8]=R,e[9]=j):j=e[9];let U=j,L;e[10]!==Q?(L=l(()=>{ae(Q())},"A"),e[10]=Q,e[11]=L):L=e[11];let W=L,_;e[12]===Symbol.for("react.memo_cache_sentinel")?(_=l(d=>{B(d.currentTarget.value)},"E"),e[12]=_):_=e[12];let G=_,M;e[13]===Symbol.for("react.memo_cache_sentinel")?(M=l(d=>{let{id:u}=d.currentTarget.dataset;u!==void 0&&k(u)},"_"),e[13]=M):M=e[13];let J=M,z;e[14]===Symbol.for("react.memo_cache_sentinel")?(z=l(d=>{let u=d.currentTarget.dataset.tab;(u==="headers"||u==="html"||u==="text")&&h(u)},"L"),e[14]=z):z=e[14];let K=z,$=Te(r,x),A=je($,q),n=Se(A),O;e[15]!==n?(O=l(()=>{n!==void 0&&le(n)},"j"),e[15]=n,e[16]=O):O=e[16];let V=O,F;e[17]!==n?(F=l(()=>{n!==void 0&&"window"in globalThis&&globalThis.window.open(n,"_blank","noopener")},"$"),e[17]=n,e[18]=F):F=e[18];let X=F,E;return e[19]!==r||e[20]!==m||e[21]!==D||e[22]!==x||e[23]!==g||e[24]!==n||e[25]!==U||e[26]!==V||e[27]!==G||e[28]!==X||e[29]!==J||e[30]!==K||e[31]!==W||e[32]!==A||e[33]!==i||e[34]!==$?(E={entries:r,error:m,errorSource:D,filter:x,isLoading:g,link:n,onClear:U,onCopyLink:V,onFilterChange:G,onOpenLink:X,onSelectMessage:J,onSelectTab:K,onSendTest:W,selected:A,tab:i,visible:$},e[19]=r,e[20]=m,e[21]=D,e[22]=x,e[23]=g,e[24]=n,e[25]=U,e[26]=V,e[27]=G,e[28]=X,e[29]=J,e[30]=K,e[31]=W,e[32]=A,e[33]=i,e[34]=$,e[35]=E):E=e[35],E},"Ae"),ze=`<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src data:; style-src 'unsafe-inline'; font-src data:">`,$e=l(a=>`${ze}${a}`,"_e"),Ke=l(({limit:a=100})=>{let e=ce(),{entries:s,error:o,errorSource:p,filter:I,isLoading:y,link:w,onClear:g,onCopyLink:P,onFilterChange:c,onOpenLink:C,onSelectMessage:f,onSelectTab:q,onSendTest:k,selected:i,tab:h,visible:x}=Me({limit:a}),B=l(r=>e(r==="html"?"HTML":r==="text"?"Plain text":"Headers"),"H");return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"mail-panel",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(b,{"data-testid":"mail-send-test",onClick:k,size:"sm",type:"button",variant:"outline",children:e("Send test")}),(0,t.jsx)(b,{"data-testid":"mail-clear",disabled:s.length===0,onClick:g,size:"sm",type:"button",variant:"outline",children:e("Clear inbox")}),s.length>0&&(0,t.jsx)(he,{className:"ml-auto","data-testid":"mail-count",variant:"secondary",children:e("{count} messages",{count:s.length})})]}),o!==null&&(0,t.jsx)(pe,{error:p,testId:"mail-error"}),o===null&&!y&&s.length===0&&(0,t.jsx)(ue,{description:e("Email your app sends in dev is captured here \u2014 nothing is delivered."),icon:(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsx)("path",{d:"M4 5h16v14H4z"}),(0,t.jsx)("path",{d:"m4 6 8 6 8-6"})]}),testId:"mail-empty",title:e("No captured email.")}),s.length>0&&(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-[minmax(0,22rem)_1fr]","data-testid":"mail-reader",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)(me,{"aria-label":e("Search messages"),"data-testid":"mail-search",onChange:c,placeholder:e("Filter messages"),type:"search",value:I}),(0,t.jsx)(fe,{className:"max-h-[32rem] rounded-xl border border-border bg-card shadow-xs","data-testid":"mail-list",children:(0,t.jsx)("ul",{className:"divide-y",children:x.map(r=>{let m=r.id===i?.id;return(0,t.jsx)("li",{children:(0,t.jsxs)("button",{className:`flex w-full flex-col items-start gap-0.5 px-3 py-2 text-left text-sm hover:bg-muted/60 ${m?"bg-muted":""}`,"data-active":m,"data-id":r.id,"data-testid":"mail-list-item",onClick:f,type:"button",children:[(0,t.jsx)("span",{className:"w-full truncate font-medium",children:r.subject||e("(no subject)")}),(0,t.jsx)("span",{className:"w-full truncate text-xs text-muted-foreground",children:N(r.to)}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:re(r.capturedAt,"\u2014")})]})},r.id)})})})]}),i!==void 0&&(0,t.jsxs)("div",{className:"flex min-w-0 flex-col gap-3 rounded-xl border border-border bg-card p-4 shadow-xs","data-testid":"mail-detail",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("h2",{className:"truncate text-base font-semibold","data-testid":"mail-subject",children:i.subject||e("(no subject)")}),(0,t.jsxs)("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-xs text-muted-foreground",children:[(0,t.jsx)("dt",{children:e("From")}),(0,t.jsx)("dd",{className:"truncate font-mono",children:i.from??"\u2014"}),(0,t.jsx)("dt",{children:e("To")}),(0,t.jsx)("dd",{className:"truncate font-mono",children:N(i.to)}),i.cc!==void 0&&i.cc.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("dt",{children:e("Cc")}),(0,t.jsx)("dd",{className:"truncate font-mono",children:N(i.cc)})]}),(0,t.jsx)("dt",{children:e("Sent")}),(0,t.jsx)("dd",{className:"tabular-nums",children:re(i.capturedAt,"\u2014")})]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2","data-testid":"mail-actions",children:[(0,t.jsx)(b,{"data-testid":"mail-copy-link",disabled:w===void 0,onClick:P,size:"sm",type:"button",variant:"outline",children:e("Copy link")}),(0,t.jsx)(b,{"data-testid":"mail-open-link",disabled:w===void 0,onClick:C,size:"sm",type:"button",variant:"outline",children:e("Open in new tab")})]}),(0,t.jsx)(ye,{}),(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"mail-tabs",role:"tablist",children:["html","text","headers"].map(r=>(0,t.jsx)(b,{"aria-selected":h===r,"data-tab":r,"data-testid":`mail-tab-${r}`,onClick:q,role:"tab",size:"sm",type:"button",variant:h===r?"secondary":"ghost",children:B(r)},r))}),(0,t.jsxs)("div",{className:"min-h-[12rem]",children:[h==="html"&&(i.html===void 0?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("No HTML body.")}):(0,t.jsx)("iframe",{className:"h-[24rem] w-full rounded-md border bg-white","data-testid":"mail-preview-html",sandbox:"",srcDoc:$e(i.html),title:e("Email preview")})),h==="text"&&(i.text===void 0?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("No text body.")}):(0,t.jsx)("pre",{className:"overflow-auto whitespace-pre-wrap rounded-md border bg-muted/30 p-3 text-xs","data-testid":"mail-preview-text",children:i.text})),h==="headers"&&(i.headers===void 0||Object.keys(i.headers).length===0?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("No headers.")}):(0,t.jsx)("pre",{className:"overflow-auto whitespace-pre-wrap rounded-md border bg-muted/30 p-3 text-xs","data-testid":"mail-preview-headers",children:Object.entries(i.headers).map(([r,m])=>`${r}: ${m}`).join(`
1
+ import{a as fe}from"./chunk-VJC5PQ7D.js";import"./chunk-O3AZ7JKE.js";import{a as ie}from"./chunk-UBX5ZPLV.js";import{a as de}from"./chunk-Q65X2ZIP.js";import"./chunk-D65UVZIA.js";import{i as me}from"./chunk-Q3WMP7OA.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import{a as b}from"./chunk-5SKGLIO5.js";import"./chunk-JMZT3CEW.js";import"./chunk-VUOEJJUH.js";import{a as ue}from"./chunk-XMOG3LIP.js";import{b as he}from"./chunk-K5BAERB3.js";import"./chunk-YUVGMKHG.js";import{a as pe}from"./chunk-E5LR7G22.js";import"./chunk-F7EKRF7I.js";import"./chunk-O7XG7DTU.js";import"./chunk-O24UFHUY.js";import"./chunk-4PI2OSSP.js";import{a as H}from"./chunk-2W4UO5BC.js";import{c as oe}from"./chunk-5X6BEWUI.js";import{m as se}from"./chunk-JWQOB4EW.js";import"./chunk-ZPQBVYNN.js";import{B as ce,h as Z,i as ee,j as te,s as ae,v as le,w as re,x as ne}from"./chunk-OOOT4H45.js";import"./chunk-PDBW6GTJ.js";import{a as ve}from"./chunk-GWNGVKLG.js";import{a as ge,b as Ne}from"./chunk-6G3E4PJ2.js";import{a as l,d as Y}from"./chunk-5PEAXTYQ.js";var t=Y(Ne(),1);var be=Y(ve(),1),v=Y(ge(),1);function ye({className:a,orientation:e="horizontal",...s}){return(0,t.jsx)(ie,{"data-slot":"separator",orientation:e,className:ne("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",a),...s})}l(ye,"ge");var we=/https?:\/\/[^\s"'<>)]+/i,xe=l(a=>a===void 0?void 0:we.exec(a)?.[0],"re"),N=l(a=>a===void 0?"":Array.isArray(a)?a.join(", "):a,"v"),Ce=/<a\s(?:[^>]*?\s)?href\s*=\s*["'](https?:\/\/[^"'\s]+)["']/iu,ke=/&(?:amp|#0*38|#x0*26);/giu,Se=l(a=>a===void 0?void 0:((a.html===void 0?void 0:Ce.exec(a.html)?.[1])??xe(a.text)??xe(a.html))?.replaceAll(ke,"&"),"ye"),Te=l((a,e)=>{let s=e.trim().toLowerCase();return s===""?a:a.filter(o=>`${o.subject} ${N(o.to)} ${N(o.cc)}`.toLowerCase().includes(s))},"Ce"),je=l((a,e)=>{if(a.length!==0)return a.find(s=>s.id===e)??a[0]},"Se"),Le=Z(H.clearCapturedMail),_e=Z(H.sendTestMail),Me=l(a=>{let e=(0,be.c)(36),{limit:s}=a,o=se(),p;e[0]!==s?(p={limit:s},e[0]=s,e[1]=p):p=e[1];let{data:I,error:y,errorSource:w,isLoading:g,poll:P,refetch:c}=oe(H.getCapturedMail,p),[C,f]=(0,v.useState)(null),[q,k]=(0,v.useState)(null),[i,h]=(0,v.useState)("html"),[x,B]=(0,v.useState)(""),r=I?.entries??[],m=y??C,D=y===null?C:w,S;e[2]!==o||e[3]!==c?(S=l(async()=>{f(null);try{await o.query(Le,{},ee("")),k(null),c()}catch(d){f(te(d))}},"S"),e[2]=o,e[3]=c,e[4]=S):S=e[4];let R=S,T;e[5]!==o||e[6]!==c?(T=l(async()=>{f(null);try{await o.query(_e,{},ee("")),c()}catch(d){f(te(d))}},"T"),e[5]=o,e[6]=c,e[7]=T):T=e[7];let Q=T;de(P,!0);let j;e[8]!==R?(j=l(()=>{ae(R())},"k"),e[8]=R,e[9]=j):j=e[9];let U=j,L;e[10]!==Q?(L=l(()=>{ae(Q())},"A"),e[10]=Q,e[11]=L):L=e[11];let W=L,_;e[12]===Symbol.for("react.memo_cache_sentinel")?(_=l(d=>{B(d.currentTarget.value)},"E"),e[12]=_):_=e[12];let G=_,M;e[13]===Symbol.for("react.memo_cache_sentinel")?(M=l(d=>{let{id:u}=d.currentTarget.dataset;u!==void 0&&k(u)},"_"),e[13]=M):M=e[13];let J=M,z;e[14]===Symbol.for("react.memo_cache_sentinel")?(z=l(d=>{let u=d.currentTarget.dataset.tab;(u==="headers"||u==="html"||u==="text")&&h(u)},"L"),e[14]=z):z=e[14];let K=z,$=Te(r,x),A=je($,q),n=Se(A),O;e[15]!==n?(O=l(()=>{n!==void 0&&le(n)},"j"),e[15]=n,e[16]=O):O=e[16];let V=O,F;e[17]!==n?(F=l(()=>{n!==void 0&&"window"in globalThis&&globalThis.window.open(n,"_blank","noopener")},"$"),e[17]=n,e[18]=F):F=e[18];let X=F,E;return e[19]!==r||e[20]!==m||e[21]!==D||e[22]!==x||e[23]!==g||e[24]!==n||e[25]!==U||e[26]!==V||e[27]!==G||e[28]!==X||e[29]!==J||e[30]!==K||e[31]!==W||e[32]!==A||e[33]!==i||e[34]!==$?(E={entries:r,error:m,errorSource:D,filter:x,isLoading:g,link:n,onClear:U,onCopyLink:V,onFilterChange:G,onOpenLink:X,onSelectMessage:J,onSelectTab:K,onSendTest:W,selected:A,tab:i,visible:$},e[19]=r,e[20]=m,e[21]=D,e[22]=x,e[23]=g,e[24]=n,e[25]=U,e[26]=V,e[27]=G,e[28]=X,e[29]=J,e[30]=K,e[31]=W,e[32]=A,e[33]=i,e[34]=$,e[35]=E):E=e[35],E},"Ae"),ze=`<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src data:; style-src 'unsafe-inline'; font-src data:">`,$e=l(a=>`${ze}${a}`,"_e"),Ke=l(({limit:a=100})=>{let e=ce(),{entries:s,error:o,errorSource:p,filter:I,isLoading:y,link:w,onClear:g,onCopyLink:P,onFilterChange:c,onOpenLink:C,onSelectMessage:f,onSelectTab:q,onSendTest:k,selected:i,tab:h,visible:x}=Me({limit:a}),B=l(r=>e(r==="html"?"HTML":r==="text"?"Plain text":"Headers"),"H");return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"mail-panel",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(b,{"data-testid":"mail-send-test",onClick:k,size:"sm",type:"button",variant:"outline",children:e("Send test")}),(0,t.jsx)(b,{"data-testid":"mail-clear",disabled:s.length===0,onClick:g,size:"sm",type:"button",variant:"outline",children:e("Clear inbox")}),s.length>0&&(0,t.jsx)(he,{className:"ml-auto","data-testid":"mail-count",variant:"secondary",children:e("{count} messages",{count:s.length})})]}),o!==null&&(0,t.jsx)(pe,{error:p,testId:"mail-error"}),o===null&&!y&&s.length===0&&(0,t.jsx)(ue,{description:e("Email your app sends in dev is captured here \u2014 nothing is delivered."),icon:(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsx)("path",{d:"M4 5h16v14H4z"}),(0,t.jsx)("path",{d:"m4 6 8 6 8-6"})]}),testId:"mail-empty",title:e("No captured email.")}),s.length>0&&(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-[minmax(0,22rem)_1fr]","data-testid":"mail-reader",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)(me,{"aria-label":e("Search messages"),"data-testid":"mail-search",onChange:c,placeholder:e("Filter messages"),type:"search",value:I}),(0,t.jsx)(fe,{className:"max-h-[32rem] rounded-xl border border-border bg-card shadow-xs","data-testid":"mail-list",children:(0,t.jsx)("ul",{className:"divide-y",children:x.map(r=>{let m=r.id===i?.id;return(0,t.jsx)("li",{children:(0,t.jsxs)("button",{className:`flex w-full flex-col items-start gap-0.5 px-3 py-2 text-left text-sm hover:bg-muted/60 ${m?"bg-muted":""}`,"data-active":m,"data-id":r.id,"data-testid":"mail-list-item",onClick:f,type:"button",children:[(0,t.jsx)("span",{className:"w-full truncate font-medium",children:r.subject||e("(no subject)")}),(0,t.jsx)("span",{className:"w-full truncate text-xs text-muted-foreground",children:N(r.to)}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:re(r.capturedAt,"\u2014")})]})},r.id)})})})]}),i!==void 0&&(0,t.jsxs)("div",{className:"flex min-w-0 flex-col gap-3 rounded-xl border border-border bg-card p-4 shadow-xs","data-testid":"mail-detail",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("h2",{className:"truncate text-base font-semibold","data-testid":"mail-subject",children:i.subject||e("(no subject)")}),(0,t.jsxs)("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-xs text-muted-foreground",children:[(0,t.jsx)("dt",{children:e("From")}),(0,t.jsx)("dd",{className:"truncate font-mono",children:i.from??"\u2014"}),(0,t.jsx)("dt",{children:e("To")}),(0,t.jsx)("dd",{className:"truncate font-mono",children:N(i.to)}),i.cc!==void 0&&i.cc.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("dt",{children:e("Cc")}),(0,t.jsx)("dd",{className:"truncate font-mono",children:N(i.cc)})]}),(0,t.jsx)("dt",{children:e("Sent")}),(0,t.jsx)("dd",{className:"tabular-nums",children:re(i.capturedAt,"\u2014")})]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2","data-testid":"mail-actions",children:[(0,t.jsx)(b,{"data-testid":"mail-copy-link",disabled:w===void 0,onClick:P,size:"sm",type:"button",variant:"outline",children:e("Copy link")}),(0,t.jsx)(b,{"data-testid":"mail-open-link",disabled:w===void 0,onClick:C,size:"sm",type:"button",variant:"outline",children:e("Open in new tab")})]}),(0,t.jsx)(ye,{}),(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"mail-tabs",role:"tablist",children:["html","text","headers"].map(r=>(0,t.jsx)(b,{"aria-selected":h===r,"data-tab":r,"data-testid":`mail-tab-${r}`,onClick:q,role:"tab",size:"sm",type:"button",variant:h===r?"secondary":"ghost",children:B(r)},r))}),(0,t.jsxs)("div",{className:"min-h-[12rem]",children:[h==="html"&&(i.html===void 0?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("No HTML body.")}):(0,t.jsx)("iframe",{className:"h-[24rem] w-full rounded-md border bg-white","data-testid":"mail-preview-html",sandbox:"",srcDoc:$e(i.html),title:e("Email preview")})),h==="text"&&(i.text===void 0?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("No text body.")}):(0,t.jsx)("pre",{className:"overflow-auto whitespace-pre-wrap rounded-md border bg-muted/30 p-3 text-xs","data-testid":"mail-preview-text",children:i.text})),h==="headers"&&(i.headers===void 0||Object.keys(i.headers).length===0?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("No headers.")}):(0,t.jsx)("pre",{className:"overflow-auto whitespace-pre-wrap rounded-md border bg-muted/30 p-3 text-xs","data-testid":"mail-preview-headers",children:Object.entries(i.headers).map(([r,m])=>`${r}: ${m}`).join(`
2
2
  `)}))]})]})]})]})},"Qe");export{Ke as MailPanel};
@@ -1 +1 @@
1
- import{i as D}from"./chunk-EU4ZGNNW.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import{a as B}from"./chunk-PACPUEWB.js";import"./chunk-JMZT3CEW.js";import"./chunk-VUOEJJUH.js";import{a as U}from"./chunk-LJKB6B3H.js";import{b as S}from"./chunk-SVFX7F32.js";import"./chunk-YUVGMKHG.js";import{a as q}from"./chunk-DK53RZKN.js";import"./chunk-QNWL62VF.js";import{a as G,b as J,c as K,d as F,e as s,f as o}from"./chunk-J66QR7WA.js";import"./chunk-2JI25KW2.js";import"./chunk-R47IHY6Y.js";import"./chunk-4PI2OSSP.js";import{a as V}from"./chunk-2W4UO5BC.js";import{c as R}from"./chunk-RL5SUZ6J.js";import{a as H,e as O}from"./chunk-ZHH5ZUAS.js";import"./chunk-7AJWGPWM.js";import"./chunk-ZPQBVYNN.js";import{B as W,w as P}from"./chunk-BVANRUU4.js";import"./chunk-PDBW6GTJ.js";import{a as ae}from"./chunk-GWNGVKLG.js";import{a as re,b as ie}from"./chunk-6G3E4PJ2.js";import{a as n,d as j}from"./chunk-5PEAXTYQ.js";var X=j(ae(),1),M=j(re(),1);var t=j(ie(),1);var ne=n(e=>e==="ok"?"success":e==="failed"?"destructive":e==="expired"?"warning":"secondary","te"),Q=n(e=>e.endpoint??e.id,"M"),ve=n(()=>{let e=(0,X.c)(38),r=W(),[i,Y]=(0,M.useState)("all"),[l,Z]=(0,M.useState)(""),g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g={},e[0]=g):g=e[0];let{data:I,error:d,errorSource:x,isLoading:_,refetch:v}=R(V.listPushSubscriptions,g),N;if(e[1]!==I?.subscriptions||e[2]!==d||e[3]!==x||e[4]!==_||e[5]!==i||e[6]!==v||e[7]!==l||e[8]!==r){let L=I?.subscriptions??[],T=l.trim().toLowerCase(),A=L.filter(a=>i!=="all"&&a.kind!==i?!1:T===""?!0:`${Q(a)} ${a.userId??""}`.toLowerCase().includes(T)),b;e[10]===Symbol.for("react.memo_cache_sentinel")?(b=n(a=>{Z(a.target.value)},"w"),e[10]=b):b=e[10];let ee=b,w;e[11]!==v?(w=n(()=>{v()},"y"),e[11]=v,e[12]=w):w=e[12];let E=w,k;e[13]===Symbol.for("react.memo_cache_sentinel")?(k=["all","web-push","fcm"],e[13]=k):k=e[13];let te=k,c;e[14]!==i||e[15]!==r?(c=(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"nt-kind-filter",role:"tablist",children:te.map(a=>(0,t.jsx)(B,{"aria-selected":i===a,"data-testid":`nt-kind-${a}`,onClick:n(()=>{Y(a)},"onClick"),role:"tab",size:"sm",type:"button",variant:i===a?"secondary":"ghost",children:a==="all"?r("All"):a},a))}),e[14]=i,e[15]=r,e[16]=c):c=e[16];let m;e[17]!==r?(m=r("Filter devices"),e[17]=r,e[18]=m):m=e[18];let h;e[19]!==r?(h=r("filter endpoint, user"),e[19]=r,e[20]=h):h=e[20];let u;e[21]!==l||e[22]!==m||e[23]!==h?(u=(0,t.jsx)(D,{"aria-label":m,className:"h-8 w-56","data-testid":"nt-search",onChange:ee,placeholder:h,value:l}),e[21]=l,e[22]=m,e[23]=h,e[24]=u):u=e[24];let f;e[25]!==r?(f=r("Refresh"),e[25]=r,e[26]=f):f=e[26];let p;e[27]!==E||e[28]!==f?(p=(0,t.jsx)(B,{className:"ml-auto","data-testid":"nt-refresh",onClick:E,size:"sm",type:"button",variant:"outline",children:f}),e[27]=E,e[28]=f,e[29]=p):p=e[29];let $=L.length>0&&(0,t.jsx)(S,{"data-testid":"nt-count",variant:"secondary",children:r("{count} devices",{count:L.length})}),y;e[30]!==p||e[31]!==$||e[32]!==c||e[33]!==u?(y=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,u,p,$]}),e[30]=p,e[31]=$,e[32]=c,e[33]=u,e[34]=y):y=e[34];let C;e[35]!==d||e[36]!==x?(C=d!==null&&(0,t.jsx)(q,{error:x,testId:"nt-error"}),e[35]=d,e[36]=x,e[37]=C):C=e[37],N=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-notifications",children:[y,C,d===null&&!_&&A.length===0&&(0,t.jsx)(U,{description:r("Registered Web Push / FCM devices appear here. Configure lunora/notify.ts with defineNotify({ store }) and register a device with ctx.push.register(...)."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M15 17h5l-1.4-1.4A2 2 0 0 1 18 14.2V11a6 6 0 0 0-4-5.7V5a2 2 0 1 0-4 0v.3A6 6 0 0 0 6 11v3.2a2 2 0 0 1-.6 1.4L4 17h5m6 0v1a3 3 0 1 1-6 0v-1m6 0H9"})}),testId:"nt-empty",title:r("No registered devices.")}),A.length>0&&(0,t.jsx)(H,{className:"overflow-hidden py-0",children:(0,t.jsx)(O,{className:"max-h-[30rem] overflow-auto px-0",children:(0,t.jsxs)(G,{"data-testid":"nt-table",children:[(0,t.jsx)(J,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(s,{children:r("kind")}),(0,t.jsx)(s,{children:r("endpoint")}),(0,t.jsx)(s,{children:r("user")}),(0,t.jsx)(s,{children:r("last seen")}),(0,t.jsx)(s,{children:r("status")}),(0,t.jsx)(s,{children:r("error")})]})}),(0,t.jsx)(K,{children:A.map(a=>{let z=Q(a);return(0,t.jsxs)(F,{"data-testid":"nt-row",children:[(0,t.jsx)(o,{children:(0,t.jsx)(S,{variant:"outline",children:a.kind})}),(0,t.jsx)(o,{className:"max-w-[28ch] truncate font-mono text-xs",title:z,children:z}),(0,t.jsx)(o,{className:"max-w-[16ch] truncate font-mono text-xs",children:a.userId??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,t.jsx)(o,{className:"text-muted-foreground tabular-nums",children:P(a.lastSeenAt,"\u2014")}),(0,t.jsx)(o,{children:(0,t.jsx)(S,{"data-testid":`nt-status-${a.id}`,variant:ne(a.lastStatus),children:a.lastStatus??r("n/a")})}),(0,t.jsx)(o,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",title:a.lastError??void 0,children:a.lastError??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},a.id)})})]})})})]}),e[1]=I?.subscriptions,e[2]=d,e[3]=x,e[4]=_,e[5]=i,e[6]=v,e[7]=l,e[8]=r,e[9]=N}else N=e[9];return N},"ge");export{ve as default};
1
+ import{i as D}from"./chunk-Q3WMP7OA.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import{a as B}from"./chunk-5SKGLIO5.js";import"./chunk-JMZT3CEW.js";import"./chunk-VUOEJJUH.js";import{a as U}from"./chunk-XMOG3LIP.js";import{b as S}from"./chunk-K5BAERB3.js";import"./chunk-YUVGMKHG.js";import{a as q}from"./chunk-E5LR7G22.js";import"./chunk-F7EKRF7I.js";import{a as G,b as J,c as K,d as F,e as s,f as o}from"./chunk-TZ5PSNZW.js";import"./chunk-O7XG7DTU.js";import"./chunk-O24UFHUY.js";import"./chunk-4PI2OSSP.js";import{a as V}from"./chunk-2W4UO5BC.js";import{c as R}from"./chunk-5X6BEWUI.js";import{a as H,e as O}from"./chunk-PDBCAPP6.js";import"./chunk-JWQOB4EW.js";import"./chunk-ZPQBVYNN.js";import{B as W,w as P}from"./chunk-OOOT4H45.js";import"./chunk-PDBW6GTJ.js";import{a as ae}from"./chunk-GWNGVKLG.js";import{a as re,b as ie}from"./chunk-6G3E4PJ2.js";import{a as n,d as j}from"./chunk-5PEAXTYQ.js";var X=j(ae(),1),M=j(re(),1);var t=j(ie(),1);var ne=n(e=>e==="ok"?"success":e==="failed"?"destructive":e==="expired"?"warning":"secondary","te"),Q=n(e=>e.endpoint??e.id,"M"),ve=n(()=>{let e=(0,X.c)(38),r=W(),[i,Y]=(0,M.useState)("all"),[l,Z]=(0,M.useState)(""),g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g={},e[0]=g):g=e[0];let{data:I,error:d,errorSource:x,isLoading:_,refetch:v}=R(V.listPushSubscriptions,g),N;if(e[1]!==I?.subscriptions||e[2]!==d||e[3]!==x||e[4]!==_||e[5]!==i||e[6]!==v||e[7]!==l||e[8]!==r){let L=I?.subscriptions??[],T=l.trim().toLowerCase(),A=L.filter(a=>i!=="all"&&a.kind!==i?!1:T===""?!0:`${Q(a)} ${a.userId??""}`.toLowerCase().includes(T)),b;e[10]===Symbol.for("react.memo_cache_sentinel")?(b=n(a=>{Z(a.target.value)},"w"),e[10]=b):b=e[10];let ee=b,w;e[11]!==v?(w=n(()=>{v()},"y"),e[11]=v,e[12]=w):w=e[12];let E=w,k;e[13]===Symbol.for("react.memo_cache_sentinel")?(k=["all","web-push","fcm"],e[13]=k):k=e[13];let te=k,c;e[14]!==i||e[15]!==r?(c=(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"nt-kind-filter",role:"tablist",children:te.map(a=>(0,t.jsx)(B,{"aria-selected":i===a,"data-testid":`nt-kind-${a}`,onClick:n(()=>{Y(a)},"onClick"),role:"tab",size:"sm",type:"button",variant:i===a?"secondary":"ghost",children:a==="all"?r("All"):a},a))}),e[14]=i,e[15]=r,e[16]=c):c=e[16];let m;e[17]!==r?(m=r("Filter devices"),e[17]=r,e[18]=m):m=e[18];let h;e[19]!==r?(h=r("filter endpoint, user"),e[19]=r,e[20]=h):h=e[20];let u;e[21]!==l||e[22]!==m||e[23]!==h?(u=(0,t.jsx)(D,{"aria-label":m,className:"h-8 w-56","data-testid":"nt-search",onChange:ee,placeholder:h,value:l}),e[21]=l,e[22]=m,e[23]=h,e[24]=u):u=e[24];let f;e[25]!==r?(f=r("Refresh"),e[25]=r,e[26]=f):f=e[26];let p;e[27]!==E||e[28]!==f?(p=(0,t.jsx)(B,{className:"ml-auto","data-testid":"nt-refresh",onClick:E,size:"sm",type:"button",variant:"outline",children:f}),e[27]=E,e[28]=f,e[29]=p):p=e[29];let $=L.length>0&&(0,t.jsx)(S,{"data-testid":"nt-count",variant:"secondary",children:r("{count} devices",{count:L.length})}),y;e[30]!==p||e[31]!==$||e[32]!==c||e[33]!==u?(y=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,u,p,$]}),e[30]=p,e[31]=$,e[32]=c,e[33]=u,e[34]=y):y=e[34];let C;e[35]!==d||e[36]!==x?(C=d!==null&&(0,t.jsx)(q,{error:x,testId:"nt-error"}),e[35]=d,e[36]=x,e[37]=C):C=e[37],N=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-notifications",children:[y,C,d===null&&!_&&A.length===0&&(0,t.jsx)(U,{description:r("Registered Web Push / FCM devices appear here. Configure lunora/notify.ts with defineNotify({ store }) and register a device with ctx.push.register(...)."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M15 17h5l-1.4-1.4A2 2 0 0 1 18 14.2V11a6 6 0 0 0-4-5.7V5a2 2 0 1 0-4 0v.3A6 6 0 0 0 6 11v3.2a2 2 0 0 1-.6 1.4L4 17h5m6 0v1a3 3 0 1 1-6 0v-1m6 0H9"})}),testId:"nt-empty",title:r("No registered devices.")}),A.length>0&&(0,t.jsx)(H,{className:"overflow-hidden py-0",children:(0,t.jsx)(O,{className:"max-h-[30rem] overflow-auto px-0",children:(0,t.jsxs)(G,{"data-testid":"nt-table",children:[(0,t.jsx)(J,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(s,{children:r("kind")}),(0,t.jsx)(s,{children:r("endpoint")}),(0,t.jsx)(s,{children:r("user")}),(0,t.jsx)(s,{children:r("last seen")}),(0,t.jsx)(s,{children:r("status")}),(0,t.jsx)(s,{children:r("error")})]})}),(0,t.jsx)(K,{children:A.map(a=>{let z=Q(a);return(0,t.jsxs)(F,{"data-testid":"nt-row",children:[(0,t.jsx)(o,{children:(0,t.jsx)(S,{variant:"outline",children:a.kind})}),(0,t.jsx)(o,{className:"max-w-[28ch] truncate font-mono text-xs",title:z,children:z}),(0,t.jsx)(o,{className:"max-w-[16ch] truncate font-mono text-xs",children:a.userId??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,t.jsx)(o,{className:"text-muted-foreground tabular-nums",children:P(a.lastSeenAt,"\u2014")}),(0,t.jsx)(o,{children:(0,t.jsx)(S,{"data-testid":`nt-status-${a.id}`,variant:ne(a.lastStatus),children:a.lastStatus??r("n/a")})}),(0,t.jsx)(o,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",title:a.lastError??void 0,children:a.lastError??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},a.id)})})]})})})]}),e[1]=I?.subscriptions,e[2]=d,e[3]=x,e[4]=_,e[5]=i,e[6]=v,e[7]=l,e[8]=r,e[9]=N}else N=e[9];return N},"ge");export{ve as default};
@@ -1 +1 @@
1
- import{a as B}from"./chunk-YPNUYWQA.js";import{a as j}from"./chunk-XTU27CFW.js";import"./chunk-DA2CAFXI.js";import"./chunk-RTS5G3ET.js";import"./chunk-QRA7AKYO.js";import"./chunk-PACPUEWB.js";import"./chunk-JMZT3CEW.js";import"./chunk-VUOEJJUH.js";import{a as I}from"./chunk-LJKB6B3H.js";import{b as w}from"./chunk-SVFX7F32.js";import"./chunk-YUVGMKHG.js";import{a as C}from"./chunk-DK53RZKN.js";import"./chunk-QNWL62VF.js";import{a as A,b as D,c as P,d as b,e as l,f as n}from"./chunk-J66QR7WA.js";import"./chunk-2JI25KW2.js";import"./chunk-R47IHY6Y.js";import"./chunk-4PI2OSSP.js";import{a as u}from"./chunk-2W4UO5BC.js";import{c as p}from"./chunk-RL5SUZ6J.js";import{a as v,e as S}from"./chunk-ZHH5ZUAS.js";import{e as R}from"./chunk-7AJWGPWM.js";import"./chunk-ZPQBVYNN.js";import{B as k,w as N}from"./chunk-BVANRUU4.js";import"./chunk-PDBW6GTJ.js";import"./chunk-GWNGVKLG.js";import{b as Q}from"./chunk-6G3E4PJ2.js";import{a as m,d as H}from"./chunk-5PEAXTYQ.js";var e=H(Q(),1);var _="payment_subscriptions",O="payment_events",V=[_,O],Y={},E=new Set(["active","trialing"]),z=new Set(["past_due","unpaid"]),s=m((a,t)=>{if(a[t]!==void 0)return a[t];let h=a.__doc__;return typeof h=="string"?R(h)?.[t]:void 0},"a"),o=m(a=>typeof a=="string"?a:typeof a=="number"||typeof a=="bigint"||typeof a=="boolean"?String(a):"","s"),J=m(a=>E.has(a)?"default":z.has(a)?"destructive":"outline","q"),ie=m(({limit:a=100})=>{let t=k(),h=B(),{data:x}=p(u.listTables,Y,{live:!0}),F=x!==void 0,L=Array.isArray(x)&&V.every(r=>x.some(d=>d.name===r)),c=h.payments&&L,i=p(u.readTablePage,{filters:[],limit:a,offset:0,orderBy:{column:"updatedAt",direction:"desc"},search:"",table:_},{enabled:c}),f=p(u.readTablePage,{filters:[],limit:25,offset:0,orderBy:{column:"processedAt",direction:"desc"},search:"",table:O},{enabled:c}),g=p(u.facetColumn,{column:"state",table:_},{enabled:c});j(()=>{if(c)return Promise.all([i.poll(),f.poll(),g.poll()])},!0);let y=i.data?.rows??[],M=f.data?.rows??[],U=i.error??f.error,q=i.error===null?f.errorSource:i.errorSource,G=i.data?.total??y.length,T=g.data?.values===void 0?y.filter(r=>E.has(o(s(r,"state")))).length:g.data.values.reduce((r,d)=>r+(E.has(o(d.value))?d.count:0),0);return F&&!c?(0,e.jsx)("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:(0,e.jsx)(I,{description:t("No @lunora/payment tables found in this deployment. Add `.extend(paymentExtension)` to lunora/schema.ts and wire `payment` on createShardDO() to sync customers and subscriptions."),testId:"payments-unconfigured",title:t("No payments configured")})}):(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:[(0,e.jsx)("div",{className:"flex items-center gap-2","data-testid":"payments-summary",children:(0,e.jsxs)(v,{className:"justify-between gap-0 py-0",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[(0,e.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Subscriptions")}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:T}),(0,e.jsx)(w,{variant:"default",children:t("{count} active",{count:T})})]})]}),(0,e.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:t("{total} total",{total:G})})]})}),U===null?void 0:(0,e.jsx)(C,{error:q}),y.length===0&&!i.isLoading?(0,e.jsx)(I,{testId:"payments-empty",title:t("No subscriptions yet")}):(0,e.jsx)(v,{className:"overflow-hidden py-0",children:(0,e.jsx)(S,{className:"px-0",children:(0,e.jsxs)(A,{children:[(0,e.jsx)(D,{children:(0,e.jsxs)(b,{children:[(0,e.jsx)(l,{children:t("Provider")}),(0,e.jsx)(l,{children:t("Reference")}),(0,e.jsx)(l,{children:t("Plan")}),(0,e.jsx)(l,{children:t("State")}),(0,e.jsx)(l,{children:t("Renews")})]})}),(0,e.jsx)(P,{children:y.map(r=>{let d=o(s(r,"state"));return(0,e.jsxs)(b,{"data-testid":"payment-subscription-row",children:[(0,e.jsx)(n,{children:o(s(r,"provider"))}),(0,e.jsx)(n,{children:o(s(r,"referenceId"))}),(0,e.jsx)(n,{children:o(s(r,"priceId"))}),(0,e.jsx)(n,{children:(0,e.jsx)(w,{variant:J(d),children:d})}),(0,e.jsx)(n,{children:N(s(r,"currentPeriodEnd"))})]},o(s(r,"providerSubscriptionId")))})})]})})}),(0,e.jsxs)(v,{className:"overflow-hidden py-0",children:[(0,e.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,e.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Recent webhook events")})}),(0,e.jsx)(S,{className:"px-0",children:(0,e.jsx)(A,{children:(0,e.jsx)(P,{children:M.map(r=>(0,e.jsxs)(b,{"data-testid":"payment-event-row",children:[(0,e.jsx)(n,{children:o(s(r,"provider"))}),(0,e.jsx)(n,{className:"font-medium",children:o(s(r,"type"))}),(0,e.jsx)(n,{className:"text-muted-foreground",children:o(s(r,"providerEventId"))}),(0,e.jsx)(n,{children:N(s(r,"processedAt"))})]},o(s(r,"providerEventId"))))})})})]})]})},"oe");export{ie as PaymentsPanel};
1
+ import{a as B}from"./chunk-J77YDVBD.js";import{a as j}from"./chunk-Q65X2ZIP.js";import"./chunk-DA2CAFXI.js";import"./chunk-RTS5G3ET.js";import"./chunk-QRA7AKYO.js";import"./chunk-5SKGLIO5.js";import"./chunk-JMZT3CEW.js";import"./chunk-VUOEJJUH.js";import{a as I}from"./chunk-XMOG3LIP.js";import{b as w}from"./chunk-K5BAERB3.js";import"./chunk-YUVGMKHG.js";import{a as C}from"./chunk-E5LR7G22.js";import"./chunk-F7EKRF7I.js";import{a as A,b as D,c as P,d as b,e as l,f as n}from"./chunk-TZ5PSNZW.js";import"./chunk-O7XG7DTU.js";import"./chunk-O24UFHUY.js";import"./chunk-4PI2OSSP.js";import{a as u}from"./chunk-2W4UO5BC.js";import{c as p}from"./chunk-5X6BEWUI.js";import{a as v,e as S}from"./chunk-PDBCAPP6.js";import{e as R}from"./chunk-JWQOB4EW.js";import"./chunk-ZPQBVYNN.js";import{B as k,w as N}from"./chunk-OOOT4H45.js";import"./chunk-PDBW6GTJ.js";import"./chunk-GWNGVKLG.js";import{b as Q}from"./chunk-6G3E4PJ2.js";import{a as m,d as H}from"./chunk-5PEAXTYQ.js";var e=H(Q(),1);var _="payment_subscriptions",O="payment_events",V=[_,O],Y={},E=new Set(["active","trialing"]),z=new Set(["past_due","unpaid"]),s=m((a,t)=>{if(a[t]!==void 0)return a[t];let h=a.__doc__;return typeof h=="string"?R(h)?.[t]:void 0},"a"),o=m(a=>typeof a=="string"?a:typeof a=="number"||typeof a=="bigint"||typeof a=="boolean"?String(a):"","s"),J=m(a=>E.has(a)?"default":z.has(a)?"destructive":"outline","q"),ie=m(({limit:a=100})=>{let t=k(),h=B(),{data:x}=p(u.listTables,Y,{live:!0}),F=x!==void 0,L=Array.isArray(x)&&V.every(r=>x.some(d=>d.name===r)),c=h.payments&&L,i=p(u.readTablePage,{filters:[],limit:a,offset:0,orderBy:{column:"updatedAt",direction:"desc"},search:"",table:_},{enabled:c}),f=p(u.readTablePage,{filters:[],limit:25,offset:0,orderBy:{column:"processedAt",direction:"desc"},search:"",table:O},{enabled:c}),g=p(u.facetColumn,{column:"state",table:_},{enabled:c});j(()=>{if(c)return Promise.all([i.poll(),f.poll(),g.poll()])},!0);let y=i.data?.rows??[],M=f.data?.rows??[],U=i.error??f.error,q=i.error===null?f.errorSource:i.errorSource,G=i.data?.total??y.length,T=g.data?.values===void 0?y.filter(r=>E.has(o(s(r,"state")))).length:g.data.values.reduce((r,d)=>r+(E.has(o(d.value))?d.count:0),0);return F&&!c?(0,e.jsx)("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:(0,e.jsx)(I,{description:t("No @lunora/payment tables found in this deployment. Add `.extend(paymentExtension)` to lunora/schema.ts and wire `payment` on createShardDO() to sync customers and subscriptions."),testId:"payments-unconfigured",title:t("No payments configured")})}):(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:[(0,e.jsx)("div",{className:"flex items-center gap-2","data-testid":"payments-summary",children:(0,e.jsxs)(v,{className:"justify-between gap-0 py-0",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[(0,e.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Subscriptions")}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:T}),(0,e.jsx)(w,{variant:"default",children:t("{count} active",{count:T})})]})]}),(0,e.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:t("{total} total",{total:G})})]})}),U===null?void 0:(0,e.jsx)(C,{error:q}),y.length===0&&!i.isLoading?(0,e.jsx)(I,{testId:"payments-empty",title:t("No subscriptions yet")}):(0,e.jsx)(v,{className:"overflow-hidden py-0",children:(0,e.jsx)(S,{className:"px-0",children:(0,e.jsxs)(A,{children:[(0,e.jsx)(D,{children:(0,e.jsxs)(b,{children:[(0,e.jsx)(l,{children:t("Provider")}),(0,e.jsx)(l,{children:t("Reference")}),(0,e.jsx)(l,{children:t("Plan")}),(0,e.jsx)(l,{children:t("State")}),(0,e.jsx)(l,{children:t("Renews")})]})}),(0,e.jsx)(P,{children:y.map(r=>{let d=o(s(r,"state"));return(0,e.jsxs)(b,{"data-testid":"payment-subscription-row",children:[(0,e.jsx)(n,{children:o(s(r,"provider"))}),(0,e.jsx)(n,{children:o(s(r,"referenceId"))}),(0,e.jsx)(n,{children:o(s(r,"priceId"))}),(0,e.jsx)(n,{children:(0,e.jsx)(w,{variant:J(d),children:d})}),(0,e.jsx)(n,{children:N(s(r,"currentPeriodEnd"))})]},o(s(r,"providerSubscriptionId")))})})]})})}),(0,e.jsxs)(v,{className:"overflow-hidden py-0",children:[(0,e.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,e.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Recent webhook events")})}),(0,e.jsx)(S,{className:"px-0",children:(0,e.jsx)(A,{children:(0,e.jsx)(P,{children:M.map(r=>(0,e.jsxs)(b,{"data-testid":"payment-event-row",children:[(0,e.jsx)(n,{children:o(s(r,"provider"))}),(0,e.jsx)(n,{className:"font-medium",children:o(s(r,"type"))}),(0,e.jsx)(n,{className:"text-muted-foreground",children:o(s(r,"providerEventId"))}),(0,e.jsx)(n,{children:N(s(r,"processedAt"))})]},o(s(r,"providerEventId"))))})})})]})]})},"oe");export{ie as PaymentsPanel};
@@ -1 +1 @@
1
- import{b as g}from"./chunk-UA3LPAFC.js";import"./chunk-DK53RZKN.js";import"./chunk-QNWL62VF.js";import"./chunk-J66QR7WA.js";import"./chunk-2JI25KW2.js";import"./chunk-R47IHY6Y.js";import"./chunk-4PI2OSSP.js";import{a as m}from"./chunk-2W4UO5BC.js";import{c as p}from"./chunk-RL5SUZ6J.js";import"./chunk-ZHH5ZUAS.js";import"./chunk-7AJWGPWM.js";import"./chunk-ZPQBVYNN.js";import{B as f}from"./chunk-BVANRUU4.js";import"./chunk-PDBW6GTJ.js";import{a as S}from"./chunk-GWNGVKLG.js";import{b as A}from"./chunk-6G3E4PJ2.js";import{a as r,d as h}from"./chunk-5PEAXTYQ.js";var R=h(S(),1);var k=h(A(),1);var _=r((e,s)=>({"admin-token-weak":e("Weak admin token"),"auth-secret-weak":e("Weak auth secret"),"cookies-insecure":e("Session cookies are not Secure"),"cors-wildcard-credentials":e("Wildcard CORS with credentials"),"csrf-disabled":e("CSRF/origin guard is off"),"dev-args-unredacted":e("Request log keeps un-redacted args"),"security-headers-disabled":e("Security headers are off"),"ws-gate-open":e("User subscriptions are ungated")})[s.kind],"k"),w=r(e=>Array.isArray(e.findings)?e.findings:[],"g"),b=r(e=>({"admin-token-weak":"LUNORA_ADMIN_TOKEN","auth-secret-weak":"AUTH_SECRET","cookies-insecure":"BETTER_AUTH_URL","cors-wildcard-credentials":"LUNORA_ALLOWED_ORIGINS","csrf-disabled":"LUNORA_SECURITY_CSRF","dev-args-unredacted":"request log","security-headers-disabled":"LUNORA_SECURITY_HEADERS","ws-gate-open":"LUNORA_WS_BEARER"})[e.kind],"S"),E=r((e,s)=>({"admin-token-weak":e("Your admin token is {length} characters \u2014 use at least {min} for a brute-force-resistant secret.",{length:s.detail?.length,min:s.detail?.min}),"auth-secret-weak":e("Your auth secret is {length} characters \u2014 use at least {min} (e.g. `openssl rand -hex 32`) to sign sessions safely.",{length:s.detail?.length,min:s.detail?.min}),"cookies-insecure":e("BETTER_AUTH_URL is a plaintext http:// origin, so session cookies cannot be Secure and ride in cleartext. Serve auth over https:// in production."),"cors-wildcard-credentials":e("LUNORA_ALLOWED_ORIGINS includes a wildcard while credentials are allowed \u2014 browsers reject this and it defeats the allowlist. Name explicit origins instead of *."),"csrf-disabled":e("LUNORA_SECURITY_CSRF is off, so cross-origin state-changing cookie requests are not blocked. Re-enable it in production to keep mutations un-forgeable."),"dev-args-unredacted":e("This worker reports a development environment, so the request log stores raw args and identity. Confirm it isn't a mislabeled production deploy."),"security-headers-disabled":e("LUNORA_SECURITY_HEADERS is off, so HSTS, CSP, nosniff, and frame-options are not applied. Re-enable the baseline headers in production."),"ws-gate-open":e("LUNORA_WS_BEARER is unset, so the WebSocket upgrade gate is open: anyone who can reach the worker can open a socket and run ordinary user subscriptions. Admin subscriptions are unaffected \u2014 they need the admin token. Set it if subscribers should present a shared credential.")})[s.kind],"A"),O=r(()=>{let e=(0,R.c)(8),s=f(),i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={},e[0]=i):i=e[0];let{data:a,error:d,errorSource:c}=p(m.getSecurityAudit,i),n;if(e[1]!==a||e[2]!==s){let u=a===void 0?null:w(a);n=u===null?null:u.map(t=>({description:E(s,t),entity:b(t),issueType:_(s,t),key:t.kind,level:t.level})),e[1]=a,e[2]=s,e[3]=n}else n=e[3];let l=n,o;return e[4]!==d||e[5]!==c||e[6]!==l?(o=(0,k.jsx)(g,{error:d,errorSource:c,rows:l,testId:"lunora-security-advisor"}),e[4]=d,e[5]=c,e[6]=l,e[7]=o):o=e[7],o},"T");export{O as default};
1
+ import{b as g}from"./chunk-7N2OPADC.js";import"./chunk-E5LR7G22.js";import"./chunk-F7EKRF7I.js";import"./chunk-TZ5PSNZW.js";import"./chunk-O7XG7DTU.js";import"./chunk-O24UFHUY.js";import"./chunk-4PI2OSSP.js";import{a as m}from"./chunk-2W4UO5BC.js";import{c as p}from"./chunk-5X6BEWUI.js";import"./chunk-PDBCAPP6.js";import"./chunk-JWQOB4EW.js";import"./chunk-ZPQBVYNN.js";import{B as f}from"./chunk-OOOT4H45.js";import"./chunk-PDBW6GTJ.js";import{a as S}from"./chunk-GWNGVKLG.js";import{b as A}from"./chunk-6G3E4PJ2.js";import{a as r,d as h}from"./chunk-5PEAXTYQ.js";var R=h(S(),1);var k=h(A(),1);var _=r((e,s)=>({"admin-token-weak":e("Weak admin token"),"auth-secret-weak":e("Weak auth secret"),"cookies-insecure":e("Session cookies are not Secure"),"cors-wildcard-credentials":e("Wildcard CORS with credentials"),"csrf-disabled":e("CSRF/origin guard is off"),"dev-args-unredacted":e("Request log keeps un-redacted args"),"security-headers-disabled":e("Security headers are off"),"ws-gate-open":e("User subscriptions are ungated")})[s.kind],"k"),w=r(e=>Array.isArray(e.findings)?e.findings:[],"g"),b=r(e=>({"admin-token-weak":"LUNORA_ADMIN_TOKEN","auth-secret-weak":"AUTH_SECRET","cookies-insecure":"BETTER_AUTH_URL","cors-wildcard-credentials":"LUNORA_ALLOWED_ORIGINS","csrf-disabled":"LUNORA_SECURITY_CSRF","dev-args-unredacted":"request log","security-headers-disabled":"LUNORA_SECURITY_HEADERS","ws-gate-open":"LUNORA_WS_BEARER"})[e.kind],"S"),E=r((e,s)=>({"admin-token-weak":e("Your admin token is {length} characters \u2014 use at least {min} for a brute-force-resistant secret.",{length:s.detail?.length,min:s.detail?.min}),"auth-secret-weak":e("Your auth secret is {length} characters \u2014 use at least {min} (e.g. `openssl rand -hex 32`) to sign sessions safely.",{length:s.detail?.length,min:s.detail?.min}),"cookies-insecure":e("BETTER_AUTH_URL is a plaintext http:// origin, so session cookies cannot be Secure and ride in cleartext. Serve auth over https:// in production."),"cors-wildcard-credentials":e("LUNORA_ALLOWED_ORIGINS includes a wildcard while credentials are allowed \u2014 browsers reject this and it defeats the allowlist. Name explicit origins instead of *."),"csrf-disabled":e("LUNORA_SECURITY_CSRF is off, so cross-origin state-changing cookie requests are not blocked. Re-enable it in production to keep mutations un-forgeable."),"dev-args-unredacted":e("This worker reports a development environment, so the request log stores raw args and identity. Confirm it isn't a mislabeled production deploy."),"security-headers-disabled":e("LUNORA_SECURITY_HEADERS is off, so HSTS, CSP, nosniff, and frame-options are not applied. Re-enable the baseline headers in production."),"ws-gate-open":e("LUNORA_WS_BEARER is unset, so the WebSocket upgrade gate is open: anyone who can reach the worker can open a socket and run ordinary user subscriptions. Admin subscriptions are unaffected \u2014 they need the admin token. Set it if subscribers should present a shared credential.")})[s.kind],"A"),O=r(()=>{let e=(0,R.c)(8),s=f(),i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={},e[0]=i):i=e[0];let{data:a,error:d,errorSource:c}=p(m.getSecurityAudit,i),n;if(e[1]!==a||e[2]!==s){let u=a===void 0?null:w(a);n=u===null?null:u.map(t=>({description:E(s,t),entity:b(t),issueType:_(s,t),key:t.kind,level:t.level})),e[1]=a,e[2]=s,e[3]=n}else n=e[3];let l=n,o;return e[4]!==d||e[5]!==c||e[6]!==l?(o=(0,k.jsx)(g,{error:d,errorSource:c,rows:l,testId:"lunora-security-advisor"}),e[4]=d,e[5]=c,e[6]=l,e[7]=o):o=e[7],o},"T");export{O as default};
@@ -1 +1 @@
1
- import{a as s}from"./chunk-PACPUEWB.js";import{B as d}from"./chunk-BVANRUU4.js";import{a as h,b as k}from"./chunk-6G3E4PJ2.js";import{a as e,d as r}from"./chunk-5PEAXTYQ.js";var l=r(h(),1);var t=r(k(),1);var g=e(({children:m,confirmLabel:c,disabled:a=!1,onConfirm:p,testId:i})=>{let o=d(),[f,n]=(0,l.useState)(!1),u=e(()=>{n(!0)},"f"),C=e(()=>{n(!1)},"l"),b=e(()=>{n(!1),p()},"p");return f?(0,t.jsxs)("span",{className:"inline-flex items-center gap-1","data-testid":`${i}-prompt`,role:"group",children:[(0,t.jsx)(s,{"data-testid":`${i}-confirm`,disabled:a,onClick:b,size:"sm",type:"button",variant:"destructive",children:c??o("Confirm")}),(0,t.jsx)(s,{"data-testid":`${i}-cancel`,onClick:C,size:"sm",type:"button",variant:"ghost",children:o("Cancel")})]}):(0,t.jsx)(s,{"data-testid":i,disabled:a,onClick:u,size:"sm",type:"button",variant:"outline",children:m})},"k");export{g as a};
1
+ import{a as s}from"./chunk-5SKGLIO5.js";import{B as d}from"./chunk-OOOT4H45.js";import{a as h,b as k}from"./chunk-6G3E4PJ2.js";import{a as e,d as r}from"./chunk-5PEAXTYQ.js";var l=r(h(),1);var t=r(k(),1);var g=e(({children:m,confirmLabel:c,disabled:a=!1,onConfirm:p,testId:i})=>{let o=d(),[f,n]=(0,l.useState)(!1),u=e(()=>{n(!0)},"f"),C=e(()=>{n(!1)},"l"),b=e(()=>{n(!1),p()},"p");return f?(0,t.jsxs)("span",{className:"inline-flex items-center gap-1","data-testid":`${i}-prompt`,role:"group",children:[(0,t.jsx)(s,{"data-testid":`${i}-confirm`,disabled:a,onClick:b,size:"sm",type:"button",variant:"destructive",children:c??o("Confirm")}),(0,t.jsx)(s,{"data-testid":`${i}-cancel`,onClick:C,size:"sm",type:"button",variant:"ghost",children:o("Cancel")})]}):(0,t.jsx)(s,{"data-testid":i,disabled:a,onClick:u,size:"sm",type:"button",variant:"outline",children:m})},"k");export{g as a};